diff --git a/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc b/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc new file mode 100644 index 0000000000000..64a433f0f25cd --- /dev/null +++ b/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc @@ -0,0 +1,703 @@ +// -*- C++ -*- +// +// Package: Alignment/OfflineValidation +// Class: DiMuonVertexValidation +// +/**\class DiMuonVertexValidation DiMuonVertexValidation.cc Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc + + Description: Class to perform validation Tracker Alignment Validations by means of a PV and the SV constructed with a di-muon pair + +*/ +// +// Original Author: Marco Musich +// Created: Wed, 21 Apr 2021 09:06:25 GMT +// +// + +// system include files +#include +#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/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +// muons +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" + +// utils +#include "DataFormats/Math/interface/deltaR.h" +#include "TLorentzVector.h" + +// tracks +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" +#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" + +// vertices +#include "RecoVertex/VertexTools/interface/VertexDistanceXY.h" +#include "RecoVertex/VertexTools/interface/VertexDistance3D.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// ROOT +#include "TH1F.h" +#include "TH2F.h" + +//#define LogDebug(X) std::cout << X << + +// +// Ancillary class for plotting +// +class PlotsVsDiMuKinematics { +public: + PlotsVsDiMuKinematics() : m_name(""), m_title(""), m_ytitle(""), m_isBooked(false) {} + + //________________________________________________________________________________// + // overloaded constructor + PlotsVsDiMuKinematics(const std::string& name, const std::string& tt, const std::string& ytt) + : m_name(name), m_title(tt), m_ytitle(ytt), m_isBooked(false) {} + + ~PlotsVsDiMuKinematics() = default; + + //________________________________________________________________________________// + void bookFromPSet(const TFileDirectory& fs, const edm::ParameterSet& hpar) { + std::string namePostfix; + std::string titlePostfix; + float xmin, xmax; + + for (const auto& xAx : axisChoices) { + switch (xAx) { + case xAxis::Z_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuMuPhi"; + titlePostfix = "#mu#mu pair #phi;#mu^{+}#mu^{-} #phi"; + break; + case xAxis::Z_ETA: + xmin = -3.5; + xmax = 3.5; + namePostfix = "MuMuEta"; + titlePostfix = "#mu#mu pair #eta;#mu^{+}#mu^{-} #eta"; + break; + case xAxis::MP_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuPlusPhi"; + titlePostfix = "#mu^{+} #phi;#mu^{+} #phi [rad]"; + break; + case xAxis::MP_ETA: + xmin = -2.4; + xmax = 2.4; + namePostfix = "MuPlusEta"; + titlePostfix = "#mu^{+} #eta;#mu^{+} #eta"; + break; + case xAxis::MM_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuMinusPhi"; + titlePostfix = "#mu^{-} #phi;#mu^{-} #phi [rad]"; + break; + case xAxis::MM_ETA: + xmin = -2.4; + xmax = 2.4; + namePostfix = "MuMinusEta"; + titlePostfix = "#mu^{-} #eta;#mu^{+} #eta"; + break; + default: + throw cms::Exception("LogicalError") << " there is not such Axis choice as " << xAx; + } + + const auto& h2name = fmt::sprintf("%sVs%s", hpar.getParameter("name"), namePostfix); + const auto& h2title = fmt::sprintf("%s vs %s;%s% s", + hpar.getParameter("title"), + titlePostfix, + hpar.getParameter("title"), + hpar.getParameter("yUnits")); + + m_h2_map[xAx] = fs.make(h2name.c_str(), + h2title.c_str(), + hpar.getParameter("NxBins"), + xmin, + xmax, + hpar.getParameter("NyBins"), + hpar.getParameter("ymin"), + hpar.getParameter("ymax")); + } + + // flip the is booked bit + m_isBooked = true; + } + + //________________________________________________________________________________// + void bookPlots(TFileDirectory& fs, const float valmin, const float valmax, const int nxbins, const int nybins) { + if (m_name.empty() && m_title.empty() && m_ytitle.empty()) { + edm::LogError("PlotsVsDiMuKinematics") + << "In" << __FUNCTION__ << "," << __LINE__ + << "trying to book plots without the right constructor being called!" << std::endl; + return; + } + + static constexpr float maxMuEta = 2.4; + static constexpr float maxMuMuEta = 3.5; + TH1F::SetDefaultSumw2(kTRUE); + + // clang-format off + m_h2_map[xAxis::Z_ETA] = fs.make(fmt::sprintf("%sVsMuMuEta", m_name).c_str(), + fmt::sprintf("%s vs #mu#mu pair #eta;#mu^{+}#mu^{-} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + + m_h2_map[xAxis::Z_PHI] = fs.make(fmt::sprintf("%sVsMuMuPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu#mu pair #phi;#mu^{+}#mu^{-} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuMuEta, maxMuMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MP_ETA] = fs.make(fmt::sprintf("%sVsMuPlusEta", m_name).c_str(), + fmt::sprintf("%s vs #mu^{+} #eta;#mu^{+} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuEta, maxMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MP_PHI] = fs.make(fmt::sprintf("%sVsMuPlusPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu^{+} #phi;#mu^{+} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + + m_h2_map[xAxis::MM_ETA] = fs.make(fmt::sprintf("%sVsMuMinusEta", m_name).c_str(), + fmt::sprintf("%s vs #mu^{-} #eta;#mu^{-} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuEta, maxMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MM_PHI] = fs.make(fmt::sprintf("%sVsMuMinusPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu^{-} #phi;#mu^{-} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + // clang-format on + + // flip the is booked bit + m_isBooked = true; + } + + //________________________________________________________________________________// + void fillPlots(const float val, const std::pair& momenta) { + if (!m_isBooked) { + edm::LogError("PlotsVsDiMuKinematics") + << "In" << __FUNCTION__ << "," << __LINE__ << "trying to fill a plot not booked!" << std::endl; + return; + } + + m_h2_map[xAxis::Z_ETA]->Fill((momenta.first + momenta.second).Eta(), val); + m_h2_map[xAxis::Z_PHI]->Fill((momenta.first + momenta.second).Phi(), val); + m_h2_map[xAxis::MP_ETA]->Fill((momenta.first).Eta(), val); + m_h2_map[xAxis::MP_PHI]->Fill((momenta.first).Phi(), val); + m_h2_map[xAxis::MM_ETA]->Fill((momenta.second).Eta(), val); + m_h2_map[xAxis::MM_PHI]->Fill((momenta.second).Phi(), val); + } + +private: + enum xAxis { Z_PHI, Z_ETA, MP_PHI, MP_ETA, MM_PHI, MM_ETA }; + const std::vector axisChoices = { + xAxis::Z_PHI, xAxis::Z_ETA, xAxis::MP_PHI, xAxis::MP_ETA, xAxis::MM_PHI, xAxis::MM_ETA}; + + const std::string m_name; + const std::string m_title; + const std::string m_ytitle; + + bool m_isBooked; + + std::map m_h2_map; +}; + +// +// class declaration +// + +class DiMuonVertexValidation : public edm::one::EDAnalyzer { +public: + explicit DiMuonVertexValidation(const edm::ParameterSet&); + ~DiMuonVertexValidation() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + + std::vector pTthresholds_; + float maxSVdist_; + + // plot configurations + + edm::ParameterSet CosPhiConfiguration_; + edm::ParameterSet CosPhi3DConfiguration_; + edm::ParameterSet VtxProbConfiguration_; + edm::ParameterSet VtxDistConfiguration_; + edm::ParameterSet VtxDist3DConfiguration_; + edm::ParameterSet VtxDistSigConfiguration_; + edm::ParameterSet VtxDist3DSigConfiguration_; + edm::ParameterSet DiMuMassConfiguration_; + + // control plots + + TH1F* hSVProb_; + TH1F* hSVDist_; + TH1F* hSVDistSig_; + TH1F* hSVDist3D_; + TH1F* hSVDist3DSig_; + + TH1F* hCosPhi_; + TH1F* hCosPhi3D_; + TH1F* hCosPhiInv_; + TH1F* hCosPhiInv3D_; + + TH1F* hInvMass_; + TH1F* hTrackInvMass_; + + // 2D maps + + PlotsVsDiMuKinematics CosPhiPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics CosPhi3DPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxProbPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDistPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDist3DPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDistSigPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDist3DSigPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics ZMassPlots = PlotsVsDiMuKinematics(); + + const edm::ESGetToken ttbESToken_; + + edm::EDGetTokenT tracksToken_; //used to select what tracks to read from configuration file + edm::EDGetTokenT muonsToken_; //used to select what tracks to read from configuration file + edm::EDGetTokenT vertexToken_; //used to select what vertices to read from configuration file +}; + +// +// constants, enums and typedefs +// + +static constexpr float cmToum = 10e4; + +// +// static data member definitions +// + +// +// constructors and destructor +// +DiMuonVertexValidation::DiMuonVertexValidation(const edm::ParameterSet& iConfig) + : pTthresholds_(iConfig.getParameter>("pTThresholds")), + maxSVdist_(iConfig.getParameter("maxSVdist")), + CosPhiConfiguration_(iConfig.getParameter("CosPhiConfig")), + CosPhi3DConfiguration_(iConfig.getParameter("CosPhi3DConfig")), + VtxProbConfiguration_(iConfig.getParameter("VtxProbConfig")), + VtxDistConfiguration_(iConfig.getParameter("VtxDistConfig")), + VtxDist3DConfiguration_(iConfig.getParameter("VtxDist3DConfig")), + VtxDistSigConfiguration_(iConfig.getParameter("VtxDistSigConfig")), + VtxDist3DSigConfiguration_(iConfig.getParameter("VtxDist3DSigConfig")), + DiMuMassConfiguration_(iConfig.getParameter("DiMuMassConfig")), + ttbESToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + tracksToken_(consumes(iConfig.getParameter("tracks"))), + muonsToken_(consumes(iConfig.getParameter("muons"))), + vertexToken_(consumes(iConfig.getParameter("vertices"))) { + usesResource(TFileService::kSharedResource); + + // sort the vector of thresholds + std::sort(pTthresholds_.begin(), pTthresholds_.end(), [](const double& lhs, const double& rhs) { return lhs > rhs; }); + + edm::LogInfo("DiMuonVertexValidation") << __FUNCTION__; + for (const auto& thr : pTthresholds_) { + edm::LogInfo("DiMuonVertexValidation") << " Threshold: " << thr << " "; + } + edm::LogInfo("DiMuonVertexValidation") << "\n Max SV distance: " << maxSVdist_ << " "; +} + +DiMuonVertexValidation::~DiMuonVertexValidation() = default; + +// +// member functions +// + +// ------------ method called for each event ------------ +void DiMuonVertexValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + // select the good muons + std::vector myGoodMuonVector; + for (const auto& muon : iEvent.get(muonsToken_)) { + const reco::TrackRef t = muon.innerTrack(); + if (!t.isNull()) { + if (t->quality(reco::TrackBase::highPurity)) { + if (t->chi2() / t->ndof() <= 2.5 && t->numberOfValidHits() >= 5 && + t->hitPattern().numberOfValidPixelHits() >= 2 && t->quality(reco::TrackBase::highPurity)) + myGoodMuonVector.emplace_back(&muon); + } + } + } + + LogDebug("DiMuonVertexValidation") << "myGoodMuonVector size: " << myGoodMuonVector.size() << std::endl; + std::sort(myGoodMuonVector.begin(), myGoodMuonVector.end(), [](const reco::Muon*& lhs, const reco::Muon*& rhs) { + return lhs->pt() > rhs->pt(); + }); + + // just check the ordering + for (const auto& muon : myGoodMuonVector) { + LogDebug("DiMuonVertexValidation") << "pT: " << muon->pt() << " "; + } + LogDebug("DiMuonVertexValidation") << std::endl; + + // reject if there's no Z + if (myGoodMuonVector.size() < 2) + return; + if ((myGoodMuonVector[0]->pt()) < pTthresholds_[0] || (myGoodMuonVector[1]->pt() < pTthresholds_[1])) + return; + if (myGoodMuonVector[0]->charge() * myGoodMuonVector[1]->charge() > 0) + return; + + const auto& m1 = myGoodMuonVector[1]->p4(); + const auto& m0 = myGoodMuonVector[0]->p4(); + const auto& mother = m0 + m1; + + float invMass = mother.M(); + hInvMass_->Fill(invMass); + + // just copy the top two muons + std::vector theZMuonVector; + theZMuonVector.reserve(2); + theZMuonVector.emplace_back(myGoodMuonVector[1]); + theZMuonVector.emplace_back(myGoodMuonVector[0]); + + // do the matching of Z muons with inner tracks + std::vector myTracks; + + unsigned int i = 0; + for (const auto& muon : theZMuonVector) { + i++; + float minD = 1000.; + const reco::Track* theMatch = nullptr; + for (const auto& track : iEvent.get(tracksToken_)) { + float D = ::deltaR(muon->eta(), muon->phi(), track.eta(), track.phi()); + if (D < minD) { + minD = D; + theMatch = &track; + } + } + LogDebug("DiMuonVertexValidation") << "pushing new track: " << i << std::endl; + myTracks.emplace_back(theMatch); + } + + LogDebug("DiMuonVertexValidation") << "selected tracks: " << myTracks.size() << std::endl; + + const TransientTrackBuilder* theB = &iSetup.getData(ttbESToken_); + TransientVertex aTransientVertex; + std::vector tks; + + if (myTracks.size() != 2) + return; + + const auto& t1 = myTracks[1]->momentum(); + const auto& t0 = myTracks[0]->momentum(); + const auto& ditrack = t1 + t0; + + const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1]; + const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1]; + + static constexpr float mumass = 0.105658367; //mu mass (GeV/c^2) + + TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + (mumass * mumass))); + TLorentzVector p4_tminus( + tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + (mumass * mumass))); + + const auto& Zp4 = p4_tplus + p4_tminus; + float track_invMass = Zp4.M(); + hTrackInvMass_->Fill(track_invMass); + + // creat the pair of TLorentVectors used to make the plos + std::pair tktk_p4 = std::make_pair(p4_tplus, p4_tminus); + + // fill the z->mm mass plots + ZMassPlots.fillPlots(track_invMass, tktk_p4); + + math::XYZPoint ZpT(ditrack.x(), ditrack.y(), 0); + math::XYZPoint Zp(ditrack.x(), ditrack.y(), ditrack.z()); + + for (const auto& track : myTracks) { + reco::TransientTrack trajectory = theB->build(track); + tks.push_back(trajectory); + } + + KalmanVertexFitter kalman(true); + aTransientVertex = kalman.vertex(tks); + + double SVProb = TMath::Prob(aTransientVertex.totalChiSquared(), (int)aTransientVertex.degreesOfFreedom()); + + LogDebug("DiMuonVertexValidation") << " vertex prob: " << SVProb << std::endl; + + hSVProb_->Fill(SVProb); + + if (!aTransientVertex.isValid()) + return; + + // fill the VtxProb plots + VtxProbPlots.fillPlots(SVProb, tktk_p4); + + // get collection of reconstructed vertices from event + edm::Handle vertexHandle = iEvent.getHandle(vertexToken_); + + math::XYZPoint MainVertex(0, 0, 0); + reco::Vertex TheMainVertex = vertexHandle.product()->front(); + + if (vertexHandle.isValid()) { + const reco::VertexCollection* vertices = vertexHandle.product(); + if ((*vertices).at(0).isValid()) { + auto theMainVtx = (*vertices).at(0); + MainVertex.SetXYZ(theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z()); + } + } + + const math::XYZPoint myVertex( + aTransientVertex.position().x(), aTransientVertex.position().y(), aTransientVertex.position().z()); + const math::XYZPoint deltaVtx( + MainVertex.x() - myVertex.x(), MainVertex.y() - myVertex.y(), MainVertex.z() - myVertex.z()); + + if (TheMainVertex.isValid()) { + // Z Vertex distance in the xy plane + + VertexDistanceXY vertTool; + double distance = vertTool.distance(aTransientVertex, TheMainVertex).value(); + double dist_err = vertTool.distance(aTransientVertex, TheMainVertex).error(); + + hSVDist_->Fill(distance * cmToum); + hSVDistSig_->Fill(distance / dist_err); + + // fill the VtxDist plots + VtxDistPlots.fillPlots(distance * cmToum, tktk_p4); + + // fill the VtxDisSig plots + VtxDistSigPlots.fillPlots(distance / dist_err, tktk_p4); + + // Z Vertex distance in 3D + + VertexDistance3D vertTool3D; + double distance3D = vertTool3D.distance(aTransientVertex, TheMainVertex).value(); + double dist3D_err = vertTool3D.distance(aTransientVertex, TheMainVertex).error(); + + hSVDist3D_->Fill(distance3D * cmToum); + hSVDist3DSig_->Fill(distance3D / dist3D_err); + + // fill the VtxDist3D plots + VtxDist3DPlots.fillPlots(distance3D * cmToum, tktk_p4); + + // fill the VtxDisSig plots + VtxDist3DSigPlots.fillPlots(distance3D / dist3D_err, tktk_p4); + + LogDebug("DiMuonVertexValidation") << "distance: " << distance << "+/-" << dist_err << std::endl; + // cut on the PV - SV distance + if (distance * cmToum < maxSVdist_) { + double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) / + (sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) * + sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y())); + + double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) / + (sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) * + sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z())); + + LogDebug("DiMuonVertexValidation") << "cos(phi) = " << cosphi << std::endl; + + hCosPhi_->Fill(cosphi); + hCosPhi3D_->Fill(cosphi3D); + + // fill the cosphi plots + CosPhiPlots.fillPlots(cosphi, tktk_p4); + + // fill the VtxDisSig plots + CosPhi3DPlots.fillPlots(cosphi3D, tktk_p4); + } + } +} + +// ------------ method called once each job just before starting event loop ------------ +void DiMuonVertexValidation::beginJob() { + edm::Service fs; + + // clang-format off + TH1F::SetDefaultSumw2(kTRUE); + hSVProb_ = fs->make("VtxProb", ";ZV vertex probability;N(#mu#mu pairs)", 100, 0., 1.); + + hSVDist_ = fs->make("VtxDist", ";PV-ZV xy distance [#mum];N(#mu#mu pairs)", 100, 0., 300.); + hSVDistSig_ = fs->make("VtxDistSig", ";PV-ZV xy distance signficance;N(#mu#mu pairs)", 100, 0., 5.); + + hSVDist3D_ = fs->make("VtxDist3D", ";PV-ZV 3D distance [#mum];N(#mu#mu pairs)", 100, 0., 300.); + hSVDist3DSig_ = fs->make("VtxDist3DSig", ";PV-ZV 3D distance signficance;N(#mu#mu pairs)", 100, 0., 5.); + + hInvMass_ = fs->make("InvMass", ";M(#mu#mu) [GeV];N(#mu#mu pairs)", 70., 50., 120.); + hTrackInvMass_ = fs->make("TkTkInvMass", ";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.); + + hCosPhi_ = fs->make("CosPhi", ";cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.); + hCosPhi3D_ = fs->make("CosPhi3D", ";cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.); + + hCosPhiInv_ = fs->make("CosPhiInv", ";inverted cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.); + hCosPhiInv3D_ = fs->make("CosPhiInv3D", ";inverted cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.); + // clang-format on + + // 2D Maps + + TFileDirectory dirCosPhi = fs->mkdir("CosPhiPlots"); + CosPhiPlots.bookFromPSet(dirCosPhi, CosPhiConfiguration_); + + TFileDirectory dirCosPhi3D = fs->mkdir("CosPhi3DPlots"); + CosPhi3DPlots.bookFromPSet(dirCosPhi3D, CosPhi3DConfiguration_); + + TFileDirectory dirVtxProb = fs->mkdir("VtxProbPlots"); + VtxProbPlots.bookFromPSet(dirVtxProb, VtxProbConfiguration_); + + TFileDirectory dirVtxDist = fs->mkdir("VtxDistPlots"); + VtxDistPlots.bookFromPSet(dirVtxDist, VtxDistConfiguration_); + + TFileDirectory dirVtxDist3D = fs->mkdir("VtxDist3DPlots"); + VtxDist3DPlots.bookFromPSet(dirVtxDist3D, VtxDist3DConfiguration_); + + TFileDirectory dirVtxDistSig = fs->mkdir("VtxDistSigPlots"); + VtxDistSigPlots.bookFromPSet(dirVtxDistSig, VtxDistSigConfiguration_); + + TFileDirectory dirVtxDist3DSig = fs->mkdir("VtxDist3DSigPlots"); + VtxDist3DSigPlots.bookFromPSet(dirVtxDist3DSig, VtxDist3DSigConfiguration_); + + TFileDirectory dirInvariantMass = fs->mkdir("InvariantMassPlots"); + ZMassPlots.bookFromPSet(dirInvariantMass, DiMuMassConfiguration_); +} + +// ------------ method called once each job just after ending the event loop ------------ +void DiMuonVertexValidation::endJob() { + TH1F::SetDefaultSumw2(kTRUE); + const unsigned int nBinsX = hCosPhi_->GetNbinsX(); + for (unsigned int i = 1; i <= nBinsX; i++) { + //float binContent = hCosPhi_->GetBinContent(i); + float invertedBinContent = hCosPhi_->GetBinContent(nBinsX + 1 - i); + float invertedBinError = hCosPhi_->GetBinError(nBinsX + 1 - i); + hCosPhiInv_->SetBinContent(i, invertedBinContent); + hCosPhiInv_->SetBinError(i, invertedBinError); + + //float binContent3D = hCosPhi3D_->GetBinContent(i); + float invertedBinContent3D = hCosPhi3D_->GetBinContent(nBinsX + 1 - i); + float invertedBinError3D = hCosPhi3D_->GetBinError(nBinsX + 1 - i); + hCosPhiInv3D_->SetBinContent(i, invertedBinContent3D); + hCosPhiInv3D_->SetBinError(i, invertedBinError3D); + } +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void DiMuonVertexValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("tracks", edm::InputTag("generalTracks")); + desc.add("muons", edm::InputTag("muons")); + desc.add("vertices", edm::InputTag("offlinePrimaryVertices")); + desc.add>("pTThresholds", {30., 10.}); + desc.add("maxSVdist", 50.); + + { + edm::ParameterSetDescription psDiMuMass; + psDiMuMass.add("name", "DiMuMass"); + psDiMuMass.add("title", "M(#mu#mu)"); + psDiMuMass.add("yUnits", "[GeV]"); + psDiMuMass.add("NxBins", 24); + psDiMuMass.add("NyBins", 50); + psDiMuMass.add("ymin", 70.); + psDiMuMass.add("ymax", 120.); + desc.add("DiMuMassConfig", psDiMuMass); + } + { + edm::ParameterSetDescription psCosPhi; + psCosPhi.add("name", "CosPhi"); + psCosPhi.add("title", "cos(#phi_{xy})"); + psCosPhi.add("yUnits", ""); + psCosPhi.add("NxBins", 50); + psCosPhi.add("NyBins", 50); + psCosPhi.add("ymin", -1.); + psCosPhi.add("ymax", 1.); + desc.add("CosPhiConfig", psCosPhi); + } + { + edm::ParameterSetDescription psCosPhi3D; + psCosPhi3D.add("name", "CosPhi3D"); + psCosPhi3D.add("title", "cos(#phi_{3D})"); + psCosPhi3D.add("yUnits", ""); + psCosPhi3D.add("NxBins", 50); + psCosPhi3D.add("NyBins", 50); + psCosPhi3D.add("ymin", -1.); + psCosPhi3D.add("ymax", 1.); + desc.add("CosPhi3DConfig", psCosPhi3D); + } + { + edm::ParameterSetDescription psVtxProb; + psVtxProb.add("name", "VtxProb"); + psVtxProb.add("title", "Prob(#chi^{2}_{SV})"); + psVtxProb.add("yUnits", ""); + psVtxProb.add("NxBins", 50); + psVtxProb.add("NyBins", 50); + psVtxProb.add("ymin", 0); + psVtxProb.add("ymax", 1.); + desc.add("VtxProbConfig", psVtxProb); + } + { + edm::ParameterSetDescription psVtxDist; + psVtxDist.add("name", "VtxDist"); + psVtxDist.add("title", "d_{xy}(PV,SV)"); + psVtxDist.add("yUnits", "[#mum]"); + psVtxDist.add("NxBins", 50); + psVtxDist.add("NyBins", 100); + psVtxDist.add("ymin", 0); + psVtxDist.add("ymax", 300.); + desc.add("VtxDistConfig", psVtxDist); + } + { + edm::ParameterSetDescription psVtxDist3D; + psVtxDist3D.add("name", "VtxDist3D"); + psVtxDist3D.add("title", "d_{3D}(PV,SV)"); + psVtxDist3D.add("yUnits", "[#mum]"); + psVtxDist3D.add("NxBins", 50); + psVtxDist3D.add("NyBins", 250); + psVtxDist3D.add("ymin", 0); + psVtxDist3D.add("ymax", 500.); + desc.add("VtxDist3DConfig", psVtxDist3D); + } + { + edm::ParameterSetDescription psVtxDistSig; + psVtxDistSig.add("name", "VtxDistSig"); + psVtxDistSig.add("title", "d_{xy}(PV,SV)/#sigma_{dxy}(PV,SV)"); + psVtxDistSig.add("yUnits", ""); + psVtxDistSig.add("NxBins", 50); + psVtxDistSig.add("NyBins", 100); + psVtxDistSig.add("ymin", 0); + psVtxDistSig.add("ymax", 5.); + desc.add("VtxDistSigConfig", psVtxDistSig); + } + { + edm::ParameterSetDescription psVtxDist3DSig; + psVtxDist3DSig.add("name", "VtxDist3DSig"); + psVtxDist3DSig.add("title", "d_{3D}(PV,SV)/#sigma_{d3D}(PV,SV)"); + psVtxDist3DSig.add("yUnits", ""); + psVtxDist3DSig.add("NxBins", 50); + psVtxDist3DSig.add("NyBins", 100); + psVtxDist3DSig.add("ymin", 0); + psVtxDist3DSig.add("ymax", 5.); + desc.add("VtxDist3DSigConfig", psVtxDist3DSig); + } + + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(DiMuonVertexValidation); diff --git a/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py b/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py new file mode 100644 index 0000000000000..b06f58ab7868f --- /dev/null +++ b/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py @@ -0,0 +1,253 @@ +from __future__ import print_function +from fnmatch import fnmatch +import FWCore.ParameterSet.Config as cms +import FWCore.Utilities.FileUtils as FileUtils +import FWCore.ParameterSet.VarParsing as VarParsing +import sys + +from Configuration.StandardSequences.Eras import eras + +################################################################### +def best_match(rcd): +################################################################### + ''' + find out where to best match the input conditions + ''' + print(rcd) + for pattern, string in connection_map: + print(pattern, fnmatch(rcd, pattern)) + if fnmatch(rcd, pattern): + return string + +options = VarParsing.VarParsing () +options.register('maxEvents', + -1, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "number of events to process (\"-1\" for all)") +options.register ('era', + '2017', # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "CMS running era") + +options.register ('GlobalTag', + '113X_mc2017_realistic_v4', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "seed number") + +options.register ('records', + [], + VarParsing.VarParsing.multiplicity.list, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "record:tag names to be used/changed from GT") + +options.register ('external', + [], + VarParsing.VarParsing.multiplicity.list, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "record:fle.db picks the following record from this external file") + +options.register ('myseed', + '1', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "seed number") + +options.register ('myfile', + 'root://cms-xrd-global.cern.ch//store/relval/CMSSW_10_6_1/RelValZMM_13/GEN-SIM-RECO/PU25ns_106X_mc2017_realistic_v6_HS-v1/10000/44690279-DDF3-0D43-B92D-F5CB57EF7E6A.root', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "file name") + +options.register ('FileList', + '', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "FileList in DAS format") + +options.register ('outputName', + 'default', # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output file") + +options.parseArguments() + +if(options.FileList): + print("FileList: ", options.FileList) +else: + print("inputFile: ", options.myfile) +print("outputFile: ", "DiMuonVertexValidation_{fname}_{fseed}.root".format(fname = options.outputName,fseed=options.myseed)) +print("era: ", options.era) +print("conditionGT: ", options.GlobalTag) +print("conditionOverwrite: ", options.records) +print("external conditions:", options.external) +print("max events: ", options.maxEvents) + +if options.era=='2016': + print("===> running era 2016") + process = cms.Process('Analysis',eras.Run2_2016) +elif options.era=='2017': + print("===> running era 2017") + process = cms.Process('Analysis',eras.Run2_2017) +elif options.era=='2018': + print("===> running era 2018") + process = cms.Process('Analysis',eras.Run2_2018) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +################################################################### +# Tell the program where to find the conditons +connection_map = [ + ('Tracker*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('SiPixel*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('SiStrip*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('Beam*', 'frontier://PromptProd/CMS_CONDITIONS'), + ] + +if options.external: + connection_map.extend( + (i.split(':')[0], 'sqlite_file:%s' % i.split(':')[1]) for i in options.external + ) + +connection_map.sort(key=lambda x: -1*len(x[0])) + +################################################################### +# creat the map for the GT toGet +records = [] +if options.records: + for record in options.records: + rcd, tag = tuple(record.split(':')) + print("control point:",rcd,tag) + if len(rcd)==0: + print("no overriding will occur") + continue + records.append( + cms.PSet( + record = cms.string(rcd), + tag = cms.string(tag), + connect = cms.string(best_match(rcd)) + ) + ) + +################################################################### +# configure the Global Tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '') +process.GlobalTag.toGet = cms.VPSet(*records) + +''' +process.GlobalTag.toGet = cms.VPSet( + cms.PSet(record = cms.string("TrackerAlignmentRcd"), + tag = cms.string("TrackerAlignment_Upgrade2017_design_v4"), + #tag = cms.string("TrackerAlignment_2017_ultralegacymc_v1"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") + ), + cms.PSet(record = cms.string("TrackerAlignmentErrorExtendedRcd"), + tag = cms.string("TrackerAlignmentErrorsExtended_Upgrade2017_design_v0"), + #tag = cms.string("TrackerAlignmentExtendedErrors_2017_ultralegacymc_v1"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") + ) +) +''' + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) ) + +#process.load('FWCore.MessageService.MessageLogger_cfi') +#process.MessageLogger.cerr.FwkReport.reportEvery = 1000 + +################################################################### +# Messages +################################################################### +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.enable = False +process.MessageLogger.DiMuonVertexValidation=dict() +process.MessageLogger.cout = cms.untracked.PSet( + enable = cms.untracked.bool(True), + threshold = cms.untracked.string("INFO"), + default = cms.untracked.PSet(limit = cms.untracked.int32(0)), + FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1), + reportEvery = cms.untracked.int32(1000) + ), + DiMuonVertexValidation = cms.untracked.PSet( limit = cms.untracked.int32(-1)), + enableStatistics = cms.untracked.bool(True) + ) + +################################################################### +# Source +################################################################### +if(options.FileList): + print('Loading file list from ASCII file') + filelist = FileUtils.loadListFromFile (options.FileList) + readFiles = cms.untracked.vstring( *filelist) +else: + readFiles = cms.untracked.vstring([options.myfile]) + +process.source = cms.Source("PoolSource", + fileNames = readFiles, + #skipEvents = cms.untracked.uint32(45000) +) + +################################################################### +# TransientTrack from https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideTransientTracks +################################################################### +process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") +process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi') +process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi') +process.load('TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff') + +#################################################################### +# Get the BeamSpot +#################################################################### +process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff") + +#################################################################### +# Track Refitter +#################################################################### +process.load("RecoTracker.TrackProducer.TrackRefitters_cff") +import RecoTracker.TrackProducer.TrackRefitters_cff +process.TrackRefitter = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone() +process.TrackRefitter.src = "generalTracks" +process.TrackRefitter.TrajectoryInEvent = True +process.TrackRefitter.NavigationSchool = '' +process.TrackRefitter.TTRHBuilder = "WithAngleAndTemplate" + +#################################################################### +# Sequence +#################################################################### +process.seqTrackselRefit = cms.Sequence(process.offlineBeamSpot* + # in case NavigatioSchool is set !='' + #process.MeasurementTrackerEvent* + process.TrackRefitter) + +#################################################################### +# Re-do vertices +#################################################################### +from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices +process.offlinePrimaryVerticesFromRefittedTrks = offlinePrimaryVertices.clone() +process.offlinePrimaryVerticesFromRefittedTrks.TrackLabel = cms.InputTag("TrackRefitter") + +#################################################################### +# Output file +#################################################################### +process.TFileService = cms.Service("TFileService",fileName=cms.string("DiMuonVertexValidation_"+options.outputName+"_"+options.myseed+".root")) + +# Additional output definition +process.analysis = cms.EDAnalyzer("DiMuonVertexValidation", + muons = cms.InputTag('muons'), + #tracks = cms.InputTag('generalTracks'), + tracks = cms.InputTag('TrackRefitter'), + vertices = cms.InputTag('offlinePrimaryVerticesFromRefittedTrks')) + +#################################################################### +# Path +#################################################################### +process.p = cms.Path(process.seqTrackselRefit + + process.offlinePrimaryVerticesFromRefittedTrks + + process.analysis) diff --git a/Alignment/OfflineValidation/test/test_all.sh b/Alignment/OfflineValidation/test/test_all.sh index 1f809c9e19ca0..0501533bbb3c9 100755 --- a/Alignment/OfflineValidation/test/test_all.sh +++ b/Alignment/OfflineValidation/test/test_all.sh @@ -9,6 +9,8 @@ if test -f "validation_config.ini"; then rm -f validation_config.ini fi +cmsRun ${LOCAL_TEST_DIR}/DiMuonVertexValidation_cfg.py maxEvents=10 || die "Failure running DiMuonVertexValidation_cfg.py" $? + ## copy into local sqlite file the ideal alignment echo "COPYING locally Ideal Alignment ..." conddb --yes --db pro copy TrackerAlignment_Upgrade2017_design_v4 --destdb myfile.db diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index 789682fb420e5..a71e02e4214d1 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -1,25 +1,13 @@ #include "EcalTPGParamBuilder.h" #include "EcalTPGDBApp.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 "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" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" -#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" //modif-alex-27-july-2015 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" @@ -51,7 +39,21 @@ double oneOverEtResolEt(double* x, double* par) { } EcalTPGParamBuilder::EcalTPGParamBuilder(edm::ParameterSet const& pSet) - : xtal_LSB_EB_(0), xtal_LSB_EE_(0), nSample_(5), complement2_(7), useDBShape_(true) { + : theEndcapGeometryToken_(esConsumes(edm::ESInputTag("", "EcalEndcap"))), + theBarrelGeometryToken_(esConsumes(edm::ESInputTag("", "EcalBarrel"))), + eTTmapToken_(esConsumes()), + ecalmappingToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalPedestalsToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalGainRatiosToken_(esConsumes()), + ecalADCToGeVConstantToken_(esConsumes()), + xtal_LSB_EB_(0), + xtal_LSB_EE_(0), + nSample_(5), + complement2_(7), + useDBShape_(true) { ped_conf_id_ = 0; lin_conf_id_ = 0; lut_conf_id_ = 0; @@ -392,27 +394,18 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& using namespace std; // 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.product(); - theBarrelGeometry_ = theBarrelGeometry_handle.product(); + eTTmap_ = &evtSetup.getData(eTTmapToken_); + theEndcapGeometry_ = &evtSetup.getData(theEndcapGeometryToken_); + theBarrelGeometry_ = &evtSetup.getData(theBarrelGeometryToken_); // electronics mapping - ESHandle ecalmapping; - evtSetup.get().get(ecalmapping); - theMapping_ = ecalmapping.product(); + theMapping_ = &evtSetup.getData(ecalmappingToken_); // get record for alpha std::ostringstream ss; ss << "EcalLaserDbAnalyzer::analyze\n"; - edm::ESHandle handle; - evtSetup.get().get(handle); + const EcalLaserAlphaMap& laserAlphaMap = evtSetup.getData(ecalLaserAlphasToken_).getMap(); // map of apdpns ss << "EcalLaserDbAnalyzer::analyze-> got EcalLaserDbRecord: \n"; - const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns //modif-alex-27-july-2015-+ Jean june 2016 beg // use alpha to check @@ -482,9 +475,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& edm::LogInfo("TopInfo") << "INFO: READING transparency correction tag" << "\n"; // std::cout << "new feature, read a tag" << std::endl; - ESHandle pAPDPNRatios; - evtSetup.get().get(pAPDPNRatios); - const EcalLaserAPDPNRatios* lratio = pAPDPNRatios.product(); + const EcalLaserAPDPNRatios* lratio = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); // std::cout << " laser map size " << lratio->getLaserMap().size() << std::endl; EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap::const_iterator itratio; @@ -573,14 +564,18 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& if (m_write_ped == 1) { ss << "Getting the pedestals from offline DB...\n"; - ESHandle pedHandle; - evtSetup.get().get(pedHandle); - pedMap = pedHandle.product()->getMap(); + pedMap = evtSetup.getData(ecalPedestalsToken_).getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } } else if (m_write_ped == 0) { @@ -653,10 +648,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedMap = peds.getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } @@ -721,10 +722,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedMap = peds.getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } } @@ -734,13 +741,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // Intercalib constants ss << "Getting intercalib from offline DB...\n"; - ESHandle pIntercalib; - evtSetup.get().get(pIntercalib); - const EcalIntercalibConstants* intercalib = pIntercalib.product(); + const EcalIntercalibConstants* intercalib = &evtSetup.getData(ecalIntercalibConstantsToken_); const EcalIntercalibConstantMap& calibMap = intercalib->getMap(); + const auto& calibMapEB = calibMap.barrelItems(); + const auto& calibMapEE = calibMap.endcapItems(); EcalIntercalibConstantMap::const_iterator calIter; int nCal = 0; - for (calIter = calibMap.begin(); calIter != calibMap.end() && nCal < 10; ++calIter, nCal++) { + for (calIter = calibMapEB.begin(); calIter != calibMapEB.end() && nCal < 10; ++calIter, ++nCal) { + ss << (*calIter) << "\n"; + } + for (calIter = calibMapEE.begin(); calIter != calibMapEE.end() && nCal < 10; ++calIter, ++nCal) { ss << (*calIter) << "\n"; } edm::LogInfo("TopInfo") << ss.str(); @@ -767,13 +777,17 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // Gain Ratios ss << "Getting the gain ratios from offline DB...\n"; - ESHandle pRatio; - evtSetup.get().get(pRatio); - const EcalGainRatioMap& gainMap = pRatio.product()->getMap(); + const EcalGainRatioMap& gainMap = evtSetup.getData(ecalGainRatiosToken_).getMap(); + const auto& gainMapEB = gainMap.barrelItems(); + const auto& gainMapEE = gainMap.endcapItems(); EcalGainRatioMap::const_iterator gainIter; int nGain = 0; - for (gainIter = gainMap.begin(); gainIter != gainMap.end() && nGain < 10; ++gainIter, nGain++) { - const EcalMGPAGainRatio& aGain = (*gainIter); + for (gainIter = gainMapEB.begin(); gainIter != gainMapEB.end() && nGain < 10; ++gainIter, ++nGain) { + const auto aGain = (*gainIter); + ss << aGain.gain12Over6() << ", " << aGain.gain6Over1() * aGain.gain12Over6() << "\n"; + } + for (gainIter = gainMapEE.begin(); gainIter != gainMapEE.end() && nGain < 10; ++gainIter, ++nGain) { + const auto aGain = (*gainIter); ss << aGain.gain12Over6() << ", " << aGain.gain6Over1() * aGain.gain12Over6() << "\n"; } edm::LogInfo("TopInfo") << ss.str(); @@ -781,9 +795,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // ADCtoGeV ss << "Getting the ADC to GeV from offline DB...\n"; - ESHandle pADCToGeV; - evtSetup.get().get(pADCToGeV); - const EcalADCToGeVConstant* ADCToGeV = pADCToGeV.product(); + const EcalADCToGeVConstant* ADCToGeV = &evtSetup.getData(ecalADCToGeVConstantToken_); xtal_LSB_EB_ = ADCToGeV->getEBValue(); xtal_LSB_EE_ = ADCToGeV->getEEValue(); ss << "xtal_LSB_EB_ = " << xtal_LSB_EB_ << "\n"; diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h index 434a8aa982799..0484a330031f5 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h @@ -1,5 +1,5 @@ -#ifndef ECALTPGPARAMBUILDER_H -#define ECALTPGPARAMBUILDER_H +#ifndef CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h +#define CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h //Author: Pascal Paganini - LLR //Date: 2006/07/10 15:58:06 $ @@ -9,17 +9,30 @@ // 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/EventSetup.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" - +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" #include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" #include "OnlineDB/EcalCondDB/interface/all_fe_config_types.h" @@ -36,8 +49,6 @@ #include #include -class CaloSubdetectorGeometry; -class EcalElectronicsMapping; class EcalTPGDBApp; class coeffStruc { @@ -56,15 +67,15 @@ class linStruc { int shift_[3]; }; -class EcalTPGParamBuilder : public edm::EDAnalyzer { +class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { public: explicit EcalTPGParamBuilder(edm::ParameterSet const& pSet); ~EcalTPGParamBuilder() override; void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; void beginJob() override; - bool checkIfOK(EcalPedestals::Item item); private: + bool checkIfOK(EcalPedestals::Item item); bool computeLinearizerParam( double theta, double gainRatio, double calibCoeff, std::string subdet, int& mult, int& shift); void create_header(); @@ -93,11 +104,22 @@ class EcalTPGParamBuilder : public edm::EDAnalyzer { std::string getDet(int tcc); std::pair getCrate(int tcc); + edm::ESGetToken theEndcapGeometryToken_; + edm::ESGetToken theBarrelGeometryToken_; const CaloSubdetectorGeometry* theEndcapGeometry_; const CaloSubdetectorGeometry* theBarrelGeometry_; - edm::ESHandle eTTmap_; + edm::ESGetToken eTTmapToken_; + const EcalTrigTowerConstituentsMap* eTTmap_; + edm::ESGetToken ecalmappingToken_; const EcalElectronicsMapping* theMapping_; + edm::ESGetToken ecalLaserAlphasToken_; + edm::ESGetToken ecalLaserAPDPNRatiosToken_; + edm::ESGetToken ecalPedestalsToken_; + edm::ESGetToken ecalIntercalibConstantsToken_; + edm::ESGetToken ecalGainRatiosToken_; + edm::ESGetToken ecalADCToGeVConstantToken_; + bool useTransverseEnergy_; double xtal_LSB_EB_, xtal_LSB_EE_; double Et_sat_EB_, Et_sat_EE_; diff --git a/CalibTracker/Configuration/python/Reconstruction_cff.py b/CalibTracker/Configuration/python/Reconstruction_cff.py index f6cafe076db9e..5e20b01ceb9a2 100644 --- a/CalibTracker/Configuration/python/Reconstruction_cff.py +++ b/CalibTracker/Configuration/python/Reconstruction_cff.py @@ -1,24 +1,24 @@ import FWCore.ParameterSet.Config as cms -#local reconstruction +# local reconstruction from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * from EventFilter.SiStripRawToDigi.SiStripDigis_cfi import * from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import * from RecoLocalTracker.SiStripZeroSuppression.SiStripZeroSuppression_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterizer_cfi import * -recolocal = cms.Sequence( siPixelDigis*siPixelClustersPreSplitting*siStripDigis*siStripZeroSuppression*siStripClusters) -siPixelDigis.InputLabel = 'rawDataCollector' +recolocal = cms.Sequence(siPixelDigis + siPixelClustersPreSplitting + siStripDigis + siStripZeroSuppression + siStripClusters) +siPixelDigis.cpu.InputLabel = 'rawDataCollector' -#tracking +# tracking from RecoVertex.BeamSpotProducer.BeamSpot_cff import * from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoTracker.Configuration.RecoTracker_cff import * from RecoTracker.Configuration.RecoTrackerP5_cff import * from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * -recotrack = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ckftracks) -recotrackP5 = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ctftracksP5) +recotrack = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ckftracks) +recotrackP5 = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ctftracksP5) -#Schedule -reconstruction_step = cms.Path( recolocal + recotrack ) -reconstructionP5_step = cms.Path( recolocal + recotrackP5 ) +# Schedule +reconstruction_step = cms.Path(recolocal + recotrack) +reconstructionP5_step = cms.Path(recolocal + recotrackP5) diff --git a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h index 3281c2e576e0a..c3aef2499eb5e 100644 --- a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h +++ b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h @@ -13,6 +13,7 @@ // A. Di Mattia (PCL multi stream processing and monitoring) // M. Delcourt (monitoring) // M. Musich (migration to thread-safe DQMStore access) +// P. David (merge ShallowGainCalibration with SiStripGainsPCLWorker) // // Created: Wed, 12 Apr 2017 14:46:48 GMT // @@ -111,45 +112,14 @@ class SiStripGainsPCLWorker : public DQMGlobalEDAnalyzer VChargeHisto; /*!< Charge monitor plots to be output */ - //Data members for processing - - edm::EDGetTokenT > TrigTech_token_; - edm::EDGetTokenT > trackchi2ndof_token_; - edm::EDGetTokenT > trackp_token_; - edm::EDGetTokenT > trackpt_token_; - edm::EDGetTokenT > tracketa_token_; - edm::EDGetTokenT > trackphi_token_; - edm::EDGetTokenT > trackhitsvalid_token_; - edm::EDGetTokenT > trackalgo_token_; - edm::EDGetTokenT > trackindex_token_; - edm::EDGetTokenT > rawid_token_; - edm::EDGetTokenT > localdirx_token_; - edm::EDGetTokenT > localdiry_token_; - edm::EDGetTokenT > localdirz_token_; - edm::EDGetTokenT > firststrip_token_; - edm::EDGetTokenT > nstrips_token_; - edm::EDGetTokenT > saturation_token_; - edm::EDGetTokenT > overlapping_token_; - edm::EDGetTokenT > farfromedge_token_; - edm::EDGetTokenT > charge_token_; - edm::EDGetTokenT > path_token_; - edm::EDGetTokenT > chargeoverpath_token_; - edm::EDGetTokenT > amplitude_token_; - edm::EDGetTokenT > gainused_token_; - edm::EDGetTokenT > gainusedTick_token_; + edm::EDGetTokenT> m_tracks_token; + edm::EDGetTokenT m_association_token; edm::ESGetToken tTopoToken_; - edm::ESGetToken tkGeomToken_; + edm::ESGetToken tkGeomTokenBR_, tkGeomToken_; edm::ESGetToken gainToken_; edm::ESGetToken qualityToken_; - std::string EventPrefix_; //(""); - std::string EventSuffix_; //(""); - std::string TrackPrefix_; //("track"); - std::string TrackSuffix_; //(""); - std::string CalibPrefix_; //("GainCalibration"); - std::string CalibSuffix_; //(""); - // maps histograms index to topology std::map theTopologyMap; }; diff --git a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py index cf71afd80c963..dff525f9166ab 100644 --- a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py +++ b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py @@ -12,17 +12,5 @@ DQMdir = cms.untracked.string('AlCaReco/SiStripGains'), calibrationMode = cms.untracked.string('StdBunch'), ChargeHisto = cms.untracked.vstring('TIB','TIB_layer_1','TOB','TOB_layer_1','TIDminus','TIDplus','TECminus','TECplus','TEC_thin','TEC_thick'), - gain = cms.untracked.PSet(label = cms.untracked.string('shallowGainCalibration'), - prefix = cms.untracked.string("GainCalibration"), - suffix = cms.untracked.string('') - ), - evtinfo = cms.untracked.PSet(label = cms.untracked.string('shallowEventRun'), - prefix = cms.untracked.string(""), - suffix = cms.untracked.string('') - ), - tracks = cms.untracked.PSet(label = cms.untracked.string('shallowTracks'), - prefix = cms.untracked.string("track"), - suffix = cms.untracked.string('') - ) + tracks=cms.InputTag("generalTracks",""), ) - diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index e10d14d05da40..d1510a53ad69d 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -50,58 +50,12 @@ SiStripGainsPCLWorker::SiStripGainsPCLWorker(const edm::ParameterSet& iConfig) { dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T dqm_tag_.push_back("Harvest"); // statistic collection: Harvest - // configure token for gathering the ntuple variables - edm::ParameterSet swhallowgain_pset = iConfig.getUntrackedParameter("gain"); - - std::string label = swhallowgain_pset.getUntrackedParameter("label"); - CalibPrefix_ = swhallowgain_pset.getUntrackedParameter("prefix"); - CalibSuffix_ = swhallowgain_pset.getUntrackedParameter("suffix"); - - trackindex_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "trackindex" + CalibSuffix_)); - rawid_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "rawid" + CalibSuffix_)); - localdirx_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdirx" + CalibSuffix_)); - localdiry_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdiry" + CalibSuffix_)); - localdirz_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdirz" + CalibSuffix_)); - firststrip_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "firststrip" + CalibSuffix_)); - nstrips_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "nstrips" + CalibSuffix_)); - saturation_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "saturation" + CalibSuffix_)); - overlapping_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "overlapping" + CalibSuffix_)); - farfromedge_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "farfromedge" + CalibSuffix_)); - charge_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "charge" + CalibSuffix_)); - path_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "path" + CalibSuffix_)); -#ifdef ExtendedCALIBTree - chargeoverpath_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "chargeoverpath" + CalibSuffix_)); -#endif - amplitude_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "amplitude" + CalibSuffix_)); - gainused_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "gainused" + CalibSuffix_)); - gainusedTick_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "gainusedTick" + CalibSuffix_)); - - edm::ParameterSet evtinfo_pset = iConfig.getUntrackedParameter("evtinfo"); - label = evtinfo_pset.getUntrackedParameter("label"); - EventPrefix_ = evtinfo_pset.getUntrackedParameter("prefix"); - EventSuffix_ = evtinfo_pset.getUntrackedParameter("suffix"); - TrigTech_token_ = consumes>(edm::InputTag(label, EventPrefix_ + "TrigTech" + EventSuffix_)); - - edm::ParameterSet track_pset = iConfig.getUntrackedParameter("tracks"); - label = track_pset.getUntrackedParameter("label"); - TrackPrefix_ = track_pset.getUntrackedParameter("prefix"); - TrackSuffix_ = track_pset.getUntrackedParameter("suffix"); - - trackchi2ndof_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "chi2ndof" + TrackSuffix_)); - trackp_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "momentum" + TrackSuffix_)); - trackpt_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "pt" + TrackSuffix_)); - tracketa_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "eta" + TrackSuffix_)); - trackphi_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "phi" + TrackSuffix_)); - trackhitsvalid_token_ = - consumes>(edm::InputTag(label, TrackPrefix_ + "hitsvalid" + TrackSuffix_)); - trackalgo_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "algo" + TrackSuffix_)); + m_tracks_token = consumes>(iConfig.getParameter("tracks")); + m_association_token = consumes(iConfig.getParameter("tracks")); tTopoToken_ = esConsumes(); - tkGeomToken_ = esConsumes(); + tkGeomTokenBR_ = esConsumes(); + tkGeomToken_ = esConsumes<>(); gainToken_ = esConsumes(); qualityToken_ = esConsumes(); } @@ -114,7 +68,7 @@ void SiStripGainsPCLWorker::dqmBeginRun(edm::Run const& run, static constexpr float defaultGainTick = 690. / 640.; // fills the APV collections at each begin run - const TrackerGeometry* bareTkGeomPtr = &iSetup.getData(tkGeomToken_); + const TrackerGeometry* bareTkGeomPtr = &iSetup.getData(tkGeomTokenBR_); checkBookAPVColls(bareTkGeomPtr, histograms); const auto gainHandle = iSetup.getHandle(gainToken_); @@ -157,6 +111,63 @@ void SiStripGainsPCLWorker::dqmBeginRun(edm::Run const& run, } } +namespace { + struct HitCluster { + uint32_t det; + const SiStripCluster* strip; + const SiPixelCluster* pixel; + HitCluster(uint32_t detId, const SiStripCluster* strip, const SiPixelCluster* pixel) + : det(detId), strip(strip), pixel(pixel) {} + }; + std::vector getClusters(const TrackingRecHit* hit) { + const auto simple1d = dynamic_cast(hit); + const auto simple = dynamic_cast(hit); + const auto matched = dynamic_cast(hit); + const auto pixel = dynamic_cast(hit); + std::vector clusters; + if (matched) { + clusters.emplace_back(matched->monoId(), &matched->monoCluster(), nullptr); + clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), nullptr); + } else if (simple) { + clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), nullptr); + } else if (simple1d) { + clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), nullptr); + } else if (pixel) { + clusters.emplace_back(pixel->geographicalId().rawId(), nullptr, pixel->cluster().get()); + } + return clusters; + } + + bool isFarFromBorder(const TrajectoryStateOnSurface& trajState, uint32_t detId, const TrackerGeometry* tGeom) { + const auto gdu = tGeom->idToDetUnit(detId); + if ((!dynamic_cast(gdu)) && (!dynamic_cast(gdu))) { + edm::LogWarning("SiStripGainCalibTableProducer") + << "DetId " << detId << " does not seem to belong to the tracker"; + return false; + } + const auto plane = gdu->surface(); + const auto trapBounds = dynamic_cast(&plane.bounds()); + const auto rectBounds = dynamic_cast(&plane.bounds()); + + static constexpr double distFromBorder = 1.0; + double halfLength = 0.; + if (trapBounds) { + halfLength = trapBounds->parameters()[3]; + } else if (rectBounds) { + halfLength = .5 * gdu->surface().bounds().length(); + } else { + return false; + } + + const auto pos = trajState.localPosition(); + const auto posError = trajState.localError().positionError(); + if (std::abs(pos.y()) + posError.yy() >= (halfLength - distFromBorder)) + return false; + + return true; + } +} // namespace + //********************************************************************************// // ------------ method called for each event ------------ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, @@ -170,88 +181,13 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, edm::LogInfo("SiStripGainsPCLWorker") << "Processing run " << runnumber << " and event " << eventnumber << std::endl; const TrackerTopology* topo = &iSetup.getData(tTopoToken_); + const TrackerGeometry* tGeom = &iSetup.getData(tkGeomToken_); - // ***************************** - // * Event data handles - // ***************************** - - //Event data - - // Track data - Handle> handle01; - iEvent.getByToken(trackchi2ndof_token_, handle01); - auto trackchi2ndof = handle01.product(); - - Handle> handle02; - iEvent.getByToken(trackp_token_, handle02); - auto trackp = handle02.product(); - - Handle> handle03; - iEvent.getByToken(tracketa_token_, handle03); - auto tracketa = handle03.product(); - - Handle> handle04; - iEvent.getByToken(trackhitsvalid_token_, handle04); - auto trackhitsvalid = handle04.product(); - - Handle> handle05; - iEvent.getByToken(trackalgo_token_, handle05); - auto trackalgo = handle05.product(); - - // CalibTree data - Handle> handle06; - iEvent.getByToken(trackindex_token_, handle06); - auto trackindex = handle06.product(); - - Handle> handle07; - iEvent.getByToken(rawid_token_, handle07); - auto rawid = handle07.product(); - - Handle> handle08; - iEvent.getByToken(firststrip_token_, handle08); - auto firststrip = handle08.product(); - - Handle> handle09; - iEvent.getByToken(nstrips_token_, handle09); - auto nstrips = handle09.product(); - - Handle> handle10; - iEvent.getByToken(saturation_token_, handle10); - auto saturation = handle10.product(); - - Handle> handle11; - iEvent.getByToken(overlapping_token_, handle11); - auto overlapping = handle11.product(); - - Handle> handle12; - iEvent.getByToken(farfromedge_token_, handle12); - auto farfromedge = handle12.product(); - - Handle> handle13; - iEvent.getByToken(charge_token_, handle13); - auto charge = handle13.product(); - - Handle> handle14; - iEvent.getByToken(path_token_, handle14); - auto path = handle14.product(); - -#ifdef ExtendedCALIBTree - Handle> handle15; - iEvent.getByToken(chargeoverpath_token_, handle15); - auto chargeoverpath = handle15.product(); -#endif - - Handle> handle16; - iEvent.getByToken(amplitude_token_, handle16); - auto amplitude = handle16.product(); - - Handle> handle17; - iEvent.getByToken(gainused_token_, handle17); - auto gainused = handle17.product(); - - Handle> handle18; - iEvent.getByToken(gainusedTick_token_, handle18); - auto gainusedTick = handle18.product(); + // Event data handles + edm::Handle> tracks; + iEvent.getByToken(m_tracks_token, tracks); + edm::Handle trajTrackAssociations; + iEvent.getByToken(m_association_token, trajTrackAssociations); for (const auto& elem : theTopologyMap) { LogDebug("SiStripGainsPCLWorker") << elem.first << " - " << elem.second.m_string << " " @@ -263,166 +199,187 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, int elepos = statCollectionFromMode(m_calibrationMode.c_str()); - histograms.EventStats->Fill(0., 0., 1); - histograms.EventStats->Fill(1., 0., trackp->size()); - histograms.EventStats->Fill(2., 0., charge->size()); - - unsigned int FirstAmplitude = 0; - for (unsigned int i = 0; i < charge->size(); i++) { - FirstAmplitude += (*nstrips)[i]; - int TI = (*trackindex)[i]; + std::size_t nStoredClusters{0}; + for (const auto& assoc : *trajTrackAssociations) { + const auto traj = assoc.key.get(); + const auto track = assoc.val.get(); - if ((*tracketa)[TI] < MinTrackEta) - continue; - if ((*tracketa)[TI] > MaxTrackEta) - continue; - if ((*trackp)[TI] < MinTrackMomentum) - continue; - if ((*trackp)[TI] > MaxTrackMomentum) - continue; - if ((*trackhitsvalid)[TI] < MinTrackHits) - continue; - if ((*trackchi2ndof)[TI] > MaxTrackChiOverNdf) - continue; - if ((*trackalgo)[TI] > MaxTrackingIteration) - continue; - - std::shared_ptr APV = histograms.APVsColl.at( - ((*rawid)[i] << 4) | - ((*firststrip)[i] / - 128)); //works for both strip and pixel thanks to firstStrip encoding for pixel in the calibTree - - if (APV->SubDet > 2 && (*farfromedge)[i] == false) - continue; - if (APV->SubDet > 2 && (*overlapping)[i] == true) - continue; - if (APV->SubDet > 2 && (*saturation)[i] && !AllowSaturation) - continue; - if (APV->SubDet > 2 && (*nstrips)[i] > MaxNrStrips) + if ((track->eta() < MinTrackEta) || (track->eta() > MaxTrackEta) || (track->p() < MinTrackMomentum) || + (track->p() > MaxTrackMomentum) || (track->numberOfValidHits() < MinTrackHits) || + ((track->chi2() / track->ndof()) > MaxTrackChiOverNdf) || (track->algo() > MaxTrackingIteration)) continue; - int Charge = 0; - if (APV->SubDet > 2 && (useCalibration || !FirstSetOfConstants)) { - bool Saturation = false; - for (unsigned int s = 0; s < (*nstrips)[i]; s++) { - int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s]; - if (useCalibration && !FirstSetOfConstants) { - StripCharge = (int)(StripCharge * (APV->PreviousGain / APV->CalibGain)); - } else if (useCalibration) { - StripCharge = (int)(StripCharge / APV->CalibGain); - } else if (!FirstSetOfConstants) { - StripCharge = (int)(StripCharge * APV->PreviousGain); - } - if (StripCharge > 1024) { - StripCharge = 255; - Saturation = true; - } else if (StripCharge > 254) { - StripCharge = 254; - Saturation = true; - } - Charge += StripCharge; - } - if (Saturation && !AllowSaturation) + int iCluster{-1}; + for (const auto& meas : traj->measurements()) { + const auto& trajState = meas.updatedState(); + if (!trajState.isValid()) continue; - } else if (APV->SubDet > 2) { - Charge = (*charge)[i]; - } else { - Charge = (*charge)[i] / 265.0; //expected scale factor between pixel and strip charge - } - double ClusterChargeOverPath = ((double)Charge) / (*path)[i]; - if (APV->SubDet > 2) { - if (Validation) { - ClusterChargeOverPath /= (*gainused)[i]; - } - if (OldGainRemoving) { - ClusterChargeOverPath *= (*gainused)[i]; - } - } + // there can be 2 (stereo module), 1 (no stereo module), or 0 (no pixel or strip hit) clusters + auto clusters = getClusters(meas.recHit()->hit()); + for (const auto hitCluster : clusters) { + ++iCluster; + bool saturation = false; + bool overlapping = false; + unsigned int charge = 0; + int firstStrip = 0; + unsigned int nStrips = 0; + if (hitCluster.strip) { + const auto& ampls = hitCluster.strip->amplitudes(); + firstStrip = hitCluster.strip->firstStrip(); + nStrips = ampls.size(); + charge = hitCluster.strip->charge(); + saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) { return amp >= 254; }); + + overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128))); + } else if (hitCluster.pixel) { + const auto& ampls = hitCluster.pixel->pixelADC(); + const int firstRow = hitCluster.pixel->minPixelRow(); + const int firstCol = hitCluster.pixel->minPixelCol(); + firstStrip = ((firstRow / 80) << 3 | (firstCol / 52)) * 128; //Hack to save the APVId + nStrips = 0; + for (const auto amp : ampls) { + charge += amp; + if (amp >= 254) + saturation = true; + } + } + // works for both strip and pixel thanks to firstStrip encoding for pixel above, as in the calibTree + std::shared_ptr APV = histograms.APVsColl.at((hitCluster.det << 4) | (firstStrip / 128)); - // keep processing of pixel cluster charge until here - if (APV->SubDet <= 2) - continue; + const auto farFromEdge = (hitCluster.strip ? isFarFromBorder(trajState, hitCluster.det, tGeom) : true); + if ((APV->SubDet > 2) && + ((!farFromEdge) || overlapping || (saturation && !AllowSaturation) || (nStrips > MaxNrStrips))) + continue; - // real histogram for calibration - histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath); - LogDebug("SiStripGainsPCLWorker") << " for mode " << m_calibrationMode << "\n" - << " i " << i << " useCalibration " << useCalibration << " FirstSetOfConstants " - << FirstSetOfConstants << " APV->PreviousGain " << APV->PreviousGain - << " APV->CalibGain " << APV->CalibGain << " APV->DetId " << APV->DetId - << " APV->Index " << APV->Index << " Charge " << Charge << " Path " << (*path)[i] - << " ClusterChargeOverPath " << ClusterChargeOverPath << std::endl; - - // Fill monitoring histograms - int mCharge1 = 0; - int mCharge2 = 0; - int mCharge3 = 0; - int mCharge4 = 0; - if (APV->SubDet > 2) { - for (unsigned int s = 0; s < (*nstrips)[i]; s++) { - int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s]; - if (StripCharge > 1024) - StripCharge = 255; - else if (StripCharge > 254) - StripCharge = 254; - mCharge1 += StripCharge; - mCharge2 += StripCharge; - mCharge3 += StripCharge; - mCharge4 += StripCharge; - } - // Revome gains for monitoring - mCharge2 *= (*gainused)[i]; // remove G2 - mCharge3 *= (*gainusedTick)[i]; // remove G1 - mCharge4 *= ((*gainused)[i] * (*gainusedTick)[i]); // remove G1 and G2 - } + int clusterCharge = 0; + if (APV->SubDet > 2) { // strip + if (useCalibration || !FirstSetOfConstants) { + saturation = false; + for (const auto origCharge : hitCluster.strip->amplitudes()) { + int stripCharge; + if (useCalibration) { + if (FirstSetOfConstants) { + stripCharge = int(origCharge / APV->CalibGain); + } else { + stripCharge = int(origCharge * (APV->PreviousGain / APV->CalibGain)); + } + } else { + if (FirstSetOfConstants) { + stripCharge = origCharge; + } else { + stripCharge = int(origCharge * APV->PreviousGain); + } + } + if (stripCharge > 1024) { + stripCharge = 255; + saturation = true; + } else if (stripCharge > 254) { + stripCharge = 254; + saturation = true; + } + clusterCharge += stripCharge; + } + if (saturation && !AllowSaturation) + continue; + } else { + clusterCharge = charge; + } + } else { // pixel + clusterCharge = charge / 265.0; //expected scale factor between pixel and strip charge + } - LogDebug("SiStripGainsPCLWorker") << " full charge " << mCharge1 << " remove G2 " << mCharge2 << " remove G1 " - << mCharge3 << " remove G1*G2 " << mCharge4 << std::endl; - - auto indices = APVGain::FetchIndices(theTopologyMap, (*rawid)[i], topo); - - for (auto m : indices) - histograms.Charge_1[elepos][m]->Fill(((double)mCharge1) / (*path)[i]); - for (auto m : indices) - histograms.Charge_2[elepos][m]->Fill(((double)mCharge2) / (*path)[i]); - for (auto m : indices) - histograms.Charge_3[elepos][m]->Fill(((double)mCharge3) / (*path)[i]); - for (auto m : indices) - histograms.Charge_4[elepos][m]->Fill(((double)mCharge4) / (*path)[i]); - - if (APV->SubDet == StripSubdetector::TIB) { - histograms.Charge_Vs_PathlengthTIB[elepos]->Fill((*path)[i], Charge); // TIB - - } else if (APV->SubDet == StripSubdetector::TOB) { - histograms.Charge_Vs_PathlengthTOB[elepos]->Fill((*path)[i], Charge); // TOB - - } else if (APV->SubDet == StripSubdetector::TID) { - if (APV->Eta < 0) { - histograms.Charge_Vs_PathlengthTIDM[elepos]->Fill((*path)[i], Charge); - } // TID minus - else if (APV->Eta > 0) { - histograms.Charge_Vs_PathlengthTIDP[elepos]->Fill((*path)[i], Charge); - } // TID plus - - } else if (APV->SubDet == StripSubdetector::TEC) { - if (APV->Eta < 0) { - if (APV->Thickness < 0.04) { - histograms.Charge_Vs_PathlengthTECM1[elepos]->Fill((*path)[i], Charge); - } // TEC minus, type 1 - else if (APV->Thickness > 0.04) { - histograms.Charge_Vs_PathlengthTECM2[elepos]->Fill((*path)[i], Charge); - } // TEC minus, type 2 - } else if (APV->Eta > 0) { - if (APV->Thickness < 0.04) { - histograms.Charge_Vs_PathlengthTECP1[elepos]->Fill((*path)[i], Charge); - } // TEC plus, type 1 - else if (APV->Thickness > 0.04) { - histograms.Charge_Vs_PathlengthTECP2[elepos]->Fill((*path)[i], Charge); - } // TEC plus, type 2 + const auto trackDir = trajState.localDirection(); + const auto path = (10. * APV->Thickness) / std::abs(trackDir.z() / trackDir.mag()); + double ClusterChargeOverPath = ((double)clusterCharge) / path; + if (APV->SubDet > 2) { + if (Validation) { + ClusterChargeOverPath /= APV->PreviousGain; + } + if (OldGainRemoving) { + ClusterChargeOverPath *= APV->PreviousGain; + } + } else { + // keep processing of pixel cluster charge until here + continue; + } + ++nStoredClusters; + + // real histogram for calibration + histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath); + LogDebug("SiStripGainsPCLWorker") + << " for mode " << m_calibrationMode << "\n" + << " i " << iCluster << " useCalibration " << useCalibration << " FirstSetOfConstants " + << FirstSetOfConstants << " APV->PreviousGain " << APV->PreviousGain << " APV->CalibGain " << APV->CalibGain + << " APV->DetId " << APV->DetId << " APV->Index " << APV->Index << " Charge " << clusterCharge << " Path " + << path << " ClusterChargeOverPath " << ClusterChargeOverPath << std::endl; + + // Fill monitoring histograms + int mCharge1 = 0; + for (const auto sCharge : hitCluster.strip->amplitudes()) { + if (sCharge > 254) { + mCharge1 += 254; + } else { + mCharge1 += sCharge; + } + } + // Revome gains for monitoring + int mCharge2 = mCharge1 * APV->PreviousGain; // remove G2 + int mCharge3 = mCharge1 * APV->PreviousGainTick; // remove G1 + int mCharge4 = mCharge1 * APV->PreviousGain * APV->PreviousGainTick; // remove G1 and G2 + + LogDebug("SiStripGainsPCLWorker") << " full charge " << mCharge1 << " remove G2 " << mCharge2 << " remove G1 " + << mCharge3 << " remove G1*G2 " << mCharge4 << std::endl; + + auto indices = APVGain::FetchIndices(theTopologyMap, hitCluster.det, topo); + + for (auto m : indices) + histograms.Charge_1[elepos][m]->Fill(((double)mCharge1) / path); + for (auto m : indices) + histograms.Charge_2[elepos][m]->Fill(((double)mCharge2) / path); + for (auto m : indices) + histograms.Charge_3[elepos][m]->Fill(((double)mCharge3) / path); + for (auto m : indices) + histograms.Charge_4[elepos][m]->Fill(((double)mCharge4) / path); + + if (APV->SubDet == StripSubdetector::TIB) { + histograms.Charge_Vs_PathlengthTIB[elepos]->Fill(path, clusterCharge); // TIB + + } else if (APV->SubDet == StripSubdetector::TOB) { + histograms.Charge_Vs_PathlengthTOB[elepos]->Fill(path, clusterCharge); // TOB + + } else if (APV->SubDet == StripSubdetector::TID) { + if (APV->Eta < 0) { + histograms.Charge_Vs_PathlengthTIDM[elepos]->Fill(path, clusterCharge); + } // TID minus + else if (APV->Eta > 0) { + histograms.Charge_Vs_PathlengthTIDP[elepos]->Fill(path, clusterCharge); + } // TID plus + + } else if (APV->SubDet == StripSubdetector::TEC) { + if (APV->Eta < 0) { + if (APV->Thickness < 0.04) { + histograms.Charge_Vs_PathlengthTECM1[elepos]->Fill(path, clusterCharge); + } // TEC minus, type 1 + else if (APV->Thickness > 0.04) { + histograms.Charge_Vs_PathlengthTECM2[elepos]->Fill(path, clusterCharge); + } // TEC minus, type 2 + } else if (APV->Eta > 0) { + if (APV->Thickness < 0.04) { + histograms.Charge_Vs_PathlengthTECP1[elepos]->Fill(path, clusterCharge); + } // TEC plus, type 1 + else if (APV->Thickness > 0.04) { + histograms.Charge_Vs_PathlengthTECP2[elepos]->Fill(path, clusterCharge); + } // TEC plus, type 2 + } + } } } + } - } // END OF ON-CLUSTER LOOP + histograms.EventStats->Fill(0., 0., 1); + histograms.EventStats->Fill(1., 0., tracks->size()); + histograms.EventStats->Fill(2., 0., nStoredClusters); //LogDebug("SiStripGainsPCLWorker")<<" for mode"<< m_calibrationMode // <<" entries in histogram:"<< histograms.Charge_Vs_Index[elepos].getEntries() diff --git a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc index 1356b162945ce..5fd45144ce72c 100644 --- a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc +++ b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc @@ -148,6 +148,9 @@ class SiStripHitEffFromCalibTree : public ConditionDBWriter { float _effPlotMin; TString _title; + edm::ESGetToken _tkGeomToken; + edm::ESGetToken _tTopoToken; + unsigned int nTEClayers; TH1F* bxHisto; @@ -205,6 +208,8 @@ SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree(const edm::ParameterSet& _tkMapMin = conf.getUntrackedParameter("TkMapMin", 0.9); _effPlotMin = conf.getUntrackedParameter("EffPlotMin", 0.9); _title = conf.getParameter("Title"); + _tkGeomToken = esConsumes(); + _tTopoToken = esConsumes(); reader = new SiStripDetInfoFileReader(FileInPath_.fullPath()); nTEClayers = 9; // number of wheels @@ -226,14 +231,8 @@ void SiStripHitEffFromCalibTree::algoEndJob() { } void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::EventSetup& c) { - edm::ESHandle tracker; - c.get().get(tracker); - const TrackerGeometry* tkgeom = &(*tracker); - - //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - c.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const auto& tkgeom = c.getData(_tkGeomToken); + const auto& tTopo = c.getData(_tTopoToken); // read bad modules to mask ifstream badModules_file; @@ -305,7 +304,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve cout << "A module is bad if efficiency < the avg in layer - " << threshold << " and has at least " << nModsMin << " nModsMin." << endl; - unsigned int run, evt, bx; + unsigned int run, evt, bx{0}; double instLumi, PU; //Open the ROOT Calib Tree @@ -493,7 +492,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve stripCluster = ClusterLocX / Pitch + nstrips / 2.0; } else { DetId ClusterDetId(id); - const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId); + const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom.idToDetUnit(ClusterDetId); const StripTopology& Topo = stripdet->specificTopology(); nstrips = Topo.nstrips(); Pitch = stripdet->surface().bounds().width() / Topo.nstrips(); @@ -713,7 +712,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TIB //&&&&&&&&&&&&&&&&& - component = tTopo->tibLayer(BC[i].detid); + component = tTopo.tibLayer(BC[i].detid); SetBadComponents(0, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TID) { @@ -721,7 +720,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TID //&&&&&&&&&&&&&&&&& - component = tTopo->tidSide(BC[i].detid) == 2 ? tTopo->tidWheel(BC[i].detid) : tTopo->tidWheel(BC[i].detid) + 3; + component = tTopo.tidSide(BC[i].detid) == 2 ? tTopo.tidWheel(BC[i].detid) : tTopo.tidWheel(BC[i].detid) + 3; SetBadComponents(1, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TOB) { @@ -729,7 +728,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TOB //&&&&&&&&&&&&&&&&& - component = tTopo->tobLayer(BC[i].detid); + component = tTopo.tobLayer(BC[i].detid); SetBadComponents(2, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TEC) { @@ -737,7 +736,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TEC //&&&&&&&&&&&&&&&&& - component = tTopo->tecSide(BC[i].detid) == 2 ? tTopo->tecWheel(BC[i].detid) : tTopo->tecWheel(BC[i].detid) + 9; + component = tTopo.tecSide(BC[i].detid) == 2 ? tTopo.tecWheel(BC[i].detid) : tTopo.tecWheel(BC[i].detid) + 9; SetBadComponents(3, component, BC[i], ssV, NBadComponent); } } @@ -758,16 +757,16 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve SiStripDetId a(detid); if (a.subdetId() == 3) { subdet = 0; - component = tTopo->tibLayer(detid); + component = tTopo.tibLayer(detid); } else if (a.subdetId() == 4) { subdet = 1; - component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3; + component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3; } else if (a.subdetId() == 5) { subdet = 2; - component = tTopo->tobLayer(detid); + component = tTopo.tobLayer(detid); } else if (a.subdetId() == 6) { subdet = 3; - component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9; + component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9; } SiStripQuality::Range sqrange = diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py index 6f7764abeaf01..d48108361e0a9 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py @@ -74,7 +74,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py index c0170b402a959..b8e80843e2a30 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py @@ -66,7 +66,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py index d62c9a5be3963..13b9756315bd3 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py @@ -66,7 +66,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py index 394c1b7856688..af1c884625da0 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py @@ -70,7 +70,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc index 8e94b94e8b3b6..0fc3c4ae5591d 100644 --- a/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc +++ b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc @@ -120,7 +120,9 @@ void TrackDistanceValueMapProducer::produce(edm::StreamID streamID, // just copy the first nth std::vector reduced_vdR2; - std::copy(v_dR2.begin(), v_dR2.begin() + nthClosestTrack_, std::back_inserter(reduced_vdR2)); + std::copy(v_dR2.begin(), + v_dR2.begin() + std::min(v_dR2.size(), static_cast(nthClosestTrack_)), + std::back_inserter(reduced_vdR2)); v2_dR2.push_back(reduced_vdR2); } diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py index 191c7acee4697..9dde4ff8f48f7 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py @@ -68,26 +68,15 @@ offlineBeamSpot + ALCARECOCalibrationTracksRefitAAG ) -# ------------------------------------------------------------------------------ -# Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi import shallowEventRun -from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks -from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowEventRunAAG = shallowEventRun.clone() -ALCARECOShallowTracksAAG = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) -ALCARECOShallowGainCalibrationAAG = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) -ALCARECOShallowSequenceAAG = cms.Sequence(ALCARECOShallowEventRunAAG*ALCARECOShallowTracksAAG*ALCARECOShallowGainCalibrationAAG) - # ------------------------------------------------------------------------------ # This is the module actually doing the calibration -from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker -ALCARECOSiStripCalibAAG = SiStripGainsPCLWorker.clone() -ALCARECOSiStripCalibAAG.FirstSetOfConstants = cms.untracked.bool(False) -ALCARECOSiStripCalibAAG.DQMdir = cms.untracked.string('AlCaReco/SiStripGainsAAG') -ALCARECOSiStripCalibAAG.calibrationMode = cms.untracked.string('AagBunch') -ALCARECOSiStripCalibAAG.gain.label = cms.untracked.string('ALCARECOShallowGainCalibrationAAG') -ALCARECOSiStripCalibAAG.evtinfo.label = cms.untracked.string('ALCARECOShallowEventRunAAG') -ALCARECOSiStripCalibAAG.tracks.label = cms.untracked.string('ALCARECOShallowTracksAAG') +from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker +ALCARECOSiStripCalibAAG = SiStripGainsPCLWorker.clone( + tracks = cms.InputTag('ALCARECOCalibrationTracksRefitAAG'), + FirstSetOfConstants = cms.untracked.bool(False), + DQMdir = cms.untracked.string('AlCaReco/SiStripGainsAAG'), + calibrationMode = cms.untracked.string('AagBunch') + ) # ---------------------------------------------------------------------------- @@ -104,7 +93,6 @@ seqALCARECOPromptCalibProdSiStripGainsAAG = cms.Sequence( ALCARECOCalMinBiasFilterForSiStripGainsAAG * ALCARECOTrackFilterRefitAAG * - ALCARECOShallowSequenceAAG * ALCARECOSiStripCalibAAG * MEtoEDMConvertSiStripGainsAAG ) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py index 5f39af2ae57ee..9ff51194bf1fc 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py @@ -67,26 +67,15 @@ offlineBeamSpot + ALCARECOCalibrationTracksRefit ) -# ------------------------------------------------------------------------------ -# Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi import shallowEventRun -from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks -from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowEventRun = shallowEventRun.clone() -ALCARECOShallowTracks = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) -ALCARECOShallowGainCalibration = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) -ALCARECOShallowSequence = cms.Sequence(ALCARECOShallowEventRun*ALCARECOShallowTracks*ALCARECOShallowGainCalibration) - # ------------------------------------------------------------------------------ # This is the module actually doing the calibration from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker -ALCARECOSiStripCalib = SiStripGainsPCLWorker.clone() -ALCARECOSiStripCalib.FirstSetOfConstants = cms.untracked.bool(False) -ALCARECOSiStripCalib.DQMdir = cms.untracked.string('AlCaReco/SiStripGains') -ALCARECOSiStripCalib.calibrationMode = cms.untracked.string('StdBunch') -ALCARECOSiStripCalib.gain.label = cms.untracked.string('ALCARECOShallowGainCalibration') -ALCARECOSiStripCalib.evtinfo.label = cms.untracked.string('ALCARECOShallowEventRun') -ALCARECOSiStripCalib.tracks.label = cms.untracked.string('ALCARECOShallowTracks') +ALCARECOSiStripCalib = SiStripGainsPCLWorker.clone( + tracks = cms.InputTag('ALCARECOCalibrationTracksRefit'), + FirstSetOfConstants = cms.untracked.bool(False), + DQMdir = cms.untracked.string('AlCaReco/SiStripGains'), + calibrationMode = cms.untracked.string('StdBunch') + ) # ---------------------------------------------------------------------------- # **************************************************************************** @@ -105,7 +94,6 @@ seqALCARECOPromptCalibProdSiStripGains = cms.Sequence( ALCARECOCalMinBiasFilterForSiStripGains * ALCARECOTrackFilterRefit * - ALCARECOShallowSequence * ALCARECOSiStripCalib * MEtoEDMConvertSiStripGains ) diff --git a/CondCore/CondDB/interface/Auth.h b/CondCore/CondDB/interface/Auth.h index f49bdcdcb010e..d2204f0ecb1fe 100644 --- a/CondCore/CondDB/interface/Auth.h +++ b/CondCore/CondDB/interface/Auth.h @@ -23,6 +23,13 @@ namespace cond { std::string(COND_WRITER_ROLE), std::string(COND_ADMIN_ROLE)}; + typedef enum { DEFAULT_ROLE = 0, READER_ROLE = 1, WRITER_ROLE = 2, ADMIN_ROLE = 3 } RoleCode; + + static const std::pair s_roleCodeArray[] = {std::make_pair(COND_DEFAULT_ROLE, DEFAULT_ROLE), + std::make_pair(COND_READER_ROLE, READER_ROLE), + std::make_pair(COND_WRITER_ROLE, WRITER_ROLE), + std::make_pair(COND_ADMIN_ROLE, ADMIN_ROLE)}; + static constexpr const char* const COND_DEFAULT_PRINCIPAL = "COND_DEFAULT_PRINCIPAL"; static constexpr const char* const COND_KEY = "Memento"; diff --git a/CondCore/CondDB/interface/CredentialStore.h b/CondCore/CondDB/interface/CredentialStore.h index 75231d7873f98..aac004269ba17 100644 --- a/CondCore/CondDB/interface/CredentialStore.h +++ b/CondCore/CondDB/interface/CredentialStore.h @@ -168,6 +168,7 @@ namespace cond { std::shared_ptr m_connection; std::shared_ptr m_session; + std::string m_authenticatedPrincipal; int m_principalId; // the key used to encrypt the db credentials accessibles by the owner of the authenticated key. std::string m_principalKey; diff --git a/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc b/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc index eff66cb1b7d6e..d4ae2e56a04e4 100644 --- a/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc +++ b/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc @@ -5,21 +5,20 @@ namespace cond { - std::pair getDbCredentials(const std::string& connectionString, - bool updateMode, - const std::string& authPath) { + std::tuple getDbCredentials(const std::string& connectionString, + int accessType, + const std::string& authPath) { std::string ap = authPath; if (ap.empty()) { ap = std::string(std::getenv(cond::auth::COND_AUTH_PATH)); } - auto ret = std::make_pair(std::string(""), std::string("")); + auto ret = std::make_tuple(std::string(""), std::string(""), std::string("")); if (!ap.empty()) { CredentialStore credDb; credDb.setUpForConnectionString(connectionString, ap); - std::string role(cond::auth::COND_READER_ROLE); - if (updateMode) - role = cond::auth::COND_WRITER_ROLE; - ret = credDb.getUserCredentials(connectionString, role); + std::string role(cond::auth::s_roleCodeArray[accessType].first); + auto creds = credDb.getUserCredentials(connectionString, role); + ret = std::tie(credDb.keyPrincipalName(), creds.first, creds.second); } return ret; } diff --git a/CondCore/CondDB/src/CredentialStore.cc b/CondCore/CondDB/src/CredentialStore.cc index e4d9ca0338904..35f2a731639fe 100644 --- a/CondCore/CondDB/src/CredentialStore.cc +++ b/CondCore/CondDB/src/CredentialStore.cc @@ -645,6 +645,7 @@ void cond::CredentialStore::startSession(bool readMode) { // ok, authenticated! m_principalId = princData.id; m_principalKey = cipher0.b64decrypt(princData.principalKey); + m_authenticatedPrincipal = m_key.principalName(); if (!readMode) { auth::Cipher cipher0(m_principalKey); @@ -716,6 +717,7 @@ void cond::CredentialStore::startSession(bool readMode) { cond::CredentialStore::CredentialStore() : m_connection(), m_session(), + m_authenticatedPrincipal(""), m_principalId(-1), m_principalKey(""), m_serviceName(""), @@ -1532,6 +1534,6 @@ bool cond::CredentialStore::exportAll(coral_bridge::AuthenticationCredentialSet& const std::string& cond::CredentialStore::serviceName() { return m_serviceName; } -const std::string& cond::CredentialStore::keyPrincipalName() { return m_key.principalName(); } +const std::string& cond::CredentialStore::keyPrincipalName() { return m_authenticatedPrincipal; } std::string cond::CredentialStore::log() { return m_log.str(); } diff --git a/CondCore/CondDB/src/IOVEditor.cc b/CondCore/CondDB/src/IOVEditor.cc index 68ebf1f8c848d..c779d9bc79fa3 100644 --- a/CondCore/CondDB/src/IOVEditor.cc +++ b/CondCore/CondDB/src/IOVEditor.cc @@ -97,8 +97,7 @@ namespace cond { tag, m_session->sessionHash, cond::auth::COND_SESSION_HASH_CODE, cond::auth::COND_DBTAG_LOCK_ACCESS_CODE); if (!mylock) cond::throwException( - "Tag \"" + tag + "\" can't be accessed for update, because it has been locked by an other session. \"" + - m_session->principalName + "\".", + "Tag \"" + tag + "\" can't be accessed for update, because it has been locked by an other session.", "IOVEditor::load"); } } diff --git a/CondCore/CondDB/src/SessionImpl.cc b/CondCore/CondDB/src/SessionImpl.cc index 512e2b22ce2ad..da610956a4776 100644 --- a/CondCore/CondDB/src/SessionImpl.cc +++ b/CondCore/CondDB/src/SessionImpl.cc @@ -43,14 +43,14 @@ namespace cond { SessionImpl::~SessionImpl() { close(); } void SessionImpl::close() { - if (coralSession.get()) { + if (isActive()) { if (coralSession->transaction().isActive()) { - coralSession->transaction().rollback(); + rollbackTransaction(); } if (!lockedTags.empty()) { - coralSession->transaction().start(true); + startTransaction(false); releaseTagLocks(); - coralSession->transaction().commit(); + commitTransaction(); } coralSession.reset(); } diff --git a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc index eb90ceb74ff9a..903ff5dd17387 100644 --- a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc +++ b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc @@ -9,26 +9,35 @@ #include LumiBasedUpdateAnalyzer::LumiBasedUpdateAnalyzer(const edm::ParameterSet& iConfig) - : m_record(iConfig.getParameter("record")) {} -LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer() { - std::cout << "LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer" << std::endl; + : m_record(iConfig.getParameter("record")), m_ret(-2) {} + +LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer() {} + +void LumiBasedUpdateAnalyzer::beginJob() { + edm::Service mydbservice; + if (!mydbservice.isAvailable()) { + return; + } + mydbservice->lockRecords(); } -void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::cout << "LumiBasedUpdateAnalyzer::analyze " << std::endl; + +void LumiBasedUpdateAnalyzer::endJob() { + edm::Service mydbservice; + if (mydbservice.isAvailable()) { + mydbservice->releaseLocks(); + } +} + +void LumiBasedUpdateAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, + const edm::EventSetup& context) { edm::Service mydbservice; if (!mydbservice.isAvailable()) { - std::cout << "Service is unavailable" << std::endl; return; } mydbservice->logger().start(); - if (!m_tagLocks) { - mydbservice->lockRecords(); - m_tagLocks = true; - } ::sleep(2); - //unsigned int irun = evt.id().run(); - unsigned int irun = evt.getLuminosityBlock().run(); - unsigned int lumiId = evt.getLuminosityBlock().luminosityBlock(); + unsigned int irun = lumiSeg.getRun().run(); + unsigned int lumiId = lumiSeg.luminosityBlock(); std::string tag = mydbservice->tag(m_record); std::cout << "tag " << tag << std::endl; std::cout << "run " << irun << std::endl; @@ -39,20 +48,26 @@ void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSet mybeamspot.SetType(int(lumiId)); std::cout << mybeamspot.GetBeamType() << std::endl; mydbservice->logger().logDebug() << "BeamType: " << mybeamspot.GetBeamType(); - int ret = 0; + m_ret = 0; try { mydbservice->writeForNextLumisection(&mybeamspot, m_record); } catch (const std::exception& e) { std::cout << "Error:" << e.what() << std::endl; mydbservice->logger().logError() << e.what(); - ret = -1; + m_ret = -1; } - mydbservice->logger().end(ret); } -void LumiBasedUpdateAnalyzer::endJob() { - if (m_tagLocks) { - edm::Service mydbservice; - mydbservice->releaseLocks(); + +void LumiBasedUpdateAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) { + edm::Service mydbservice; + if (mydbservice.isAvailable()) { + mydbservice->logger().logInfo() << "EndLuminosityBlock"; + mydbservice->logger().end(m_ret); } } + +void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { + std::cout << "LumiBasedUpdateAnalyzer::analyze " << std::endl; +} + DEFINE_FWK_MODULE(LumiBasedUpdateAnalyzer); diff --git a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h index 390eed9a1658d..855a0a2818bdb 100644 --- a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h +++ b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h @@ -17,12 +17,15 @@ class LumiBasedUpdateAnalyzer : public edm::EDAnalyzer { public: explicit LumiBasedUpdateAnalyzer(const edm::ParameterSet& iConfig); virtual ~LumiBasedUpdateAnalyzer(); - virtual void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup); + virtual void beginJob(); virtual void endJob(); + virtual void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context); + virtual void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup); + virtual void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup); private: std::string m_record; - bool m_tagLocks; + int m_ret; // ----------member data --------------------------- }; #endif diff --git a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp index 8ee33535cc0fc..f9ddb33cb5bed 100644 --- a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp +++ b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp @@ -14,7 +14,7 @@ #include #include "tbb/parallel_for_each.h" -#include "tbb/task_scheduler_init.h" +#include "tbb/global_control.h" namespace cond { @@ -505,7 +505,7 @@ int cond::TestGTPerf::execute() { if (nThrF > 1) session.transaction().commit(); - tbb::task_scheduler_init init(nThrF); + tbb::global_control init(tbb::global_control::max_allowed_parallelism, nThrF); std::vector > tasks; std::string payloadTypeName; @@ -568,7 +568,7 @@ int cond::TestGTPerf::execute() { std::shared_ptr payloadPtr; - tbb::task_scheduler_init initD(nThrD); + tbb::global_control initD(tbb::global_control::max_allowed_parallelism, nThrD); std::vector > tasksD; timex.interval("setup deserialization"); diff --git a/CondCore/Utilities/python/conddblib.py b/CondCore/Utilities/python/conddblib.py index 04c04bbf7f354..563303d689a81 100644 --- a/CondCore/Utilities/python/conddblib.py +++ b/CondCore/Utilities/python/conddblib.py @@ -6,7 +6,7 @@ __credits__ = ['Giacomo Govi', 'Miguel Ojeda', 'Andreas Pfeiffer'] __license__ = 'Unknown' __maintainer__ = 'Giacomo Govi' -__email__ = 'mojedasa@cern.ch' +__email__ = 'giacomo.govi@cern.ch' import os @@ -43,6 +43,11 @@ ONLINEORAPRO = 'cms_orcon_prod' ONLINEORAINT = 'cmsintr_lb' +# access role codes +READ_ROLE = 1 +WRITE_ROLE = 2 +ADMIN_ROLE = 3 + # Set initial level to WARN. This so that log statements don't occur in # the absense of explicit logging being enabled. if logger.level == logging.NOTSET: @@ -196,6 +201,9 @@ def make_dbtype( backendName, schemaName, baseType ): if schemaName is not None: members['__table_args__'] = {'schema': schemaName } for k,v in baseType.columns.items(): + defColVal = None + if len(v)==3: + defColVal = v[2] if isinstance(v[0],DbRef): refColDbt = v[0].rtype.columns[v[0].rcol][0] pk = (True if v[1]==_Col.pk else False) @@ -213,7 +221,10 @@ def make_dbtype( backendName, schemaName, baseType ): members[k] = sqlalchemy.Column(v[0],primary_key=True) else: nullable = (True if v[1]==_Col.nullable else False) - members[k] = sqlalchemy.Column(v[0],nullable=nullable) + if defColVal is None: + members[k] = sqlalchemy.Column(v[0],nullable=nullable) + else: + members[k] = sqlalchemy.Column(v[0],nullable=nullable, default=defColVal) dbType = type(dbtype_name,(_Base,),members) if backendName not in db_models.keys(): @@ -236,7 +247,8 @@ class Tag: 'last_validated_time':(sqlalchemy.BIGINT,_Col.notNull), 'end_of_validity':(sqlalchemy.BIGINT,_Col.notNull), 'insertion_time':(sqlalchemy.TIMESTAMP,_Col.notNull), - 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull) } + 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull), + 'protection_code':(sqlalchemy.Integer,_Col.notNull,0) } class TagMetadata: __tablename__ = 'TAG_METADATA' @@ -245,6 +257,13 @@ class TagMetadata: 'min_since': (sqlalchemy.BIGINT,_Col.notNull), 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull) } +class TagAuthorization: + __tablename__ = 'TAG_AUTHORIZATION' + columns = { 'tag_name': (DbRef(Tag,'name'),_Col.pk), + 'access_type': (sqlalchemy.Integer,_Col.notNull), + 'credential': (sqlalchemy.String(name_length),_Col.notNull), + 'credential_type':(sqlalchemy.Integer,_Col.notNull) } + class Payload: __tablename__ = 'PAYLOAD' columns = { 'hash': (sqlalchemy.CHAR(hash_length),_Col.pk), @@ -357,6 +376,7 @@ def __init__(self, url): self.get_dbtype(RunInfo) if not self._is_sqlite: self.get_dbtype(TagMetadata) + self.get_dbtype(TagAuthorization) self.get_dbtype(BoostRunMap) self._is_valid = self.is_valid() @@ -515,7 +535,7 @@ def make_url(database='pro',read_only = True): url = sqlalchemy.engine.url.make_url('sqlite:///%s' % database) return url -def connect(url, authPath=None, verbose=0): +def connect(url, authPath=None, verbose=0, as_admin=False): '''Returns a Connection instance to the CMS Condition DB. See database_help for the description of the database parameter. @@ -527,6 +547,7 @@ def connect(url, authPath=None, verbose=0): 2 = In addition, results of the queries (all rows and the column headers). ''' + check_admin = as_admin if url.drivername == 'oracle': if url.username is None: logging.error('Could not resolve the username for the connection %s. Please provide a connection in the format oracle://[user]:[pass]@[host]' %url ) @@ -556,10 +577,17 @@ def connect(url, authPath=None, verbose=0): explicit_auth =True else: import pluginCondDBPyBind11Interface as credential_store - connect_for_update = ( url.username == dbwriter_user_name ) + role_code = 1 + if url.username == dbwriter_user_name: + role_code = 2 + if check_admin: + role_code = 3 connection_string = oracle_connection_string(url.host.lower(),schema_name) logging.debug('Using db key to get credentials for %s' %connection_string ) - (username,password) = credential_store.get_db_credentials(connection_string,connect_for_update,authPath) + (dbuser,username,password) = credential_store.get_db_credentials(connection_string,role_code,authPath) + if username=='' or password=='': + raise Exception('No credentials found to connect on %s with the required access role.'%connection_string) + check_admin = False url.username = username url.password = password else: @@ -570,7 +598,10 @@ def connect(url, authPath=None, verbose=0): if pwd is None or pwd == '': raise Exception('Empty password provided, bailing out...') url.password = pwd - + if check_admin: + raise Exception('Admin access has not been granted. Please provide a valid admin db-key.') + if check_admin: + raise Exception('Admin access is not available for technology "%s".' %url.drivername) if verbose >= 1: logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) diff --git a/CondCore/Utilities/python/o2olib.py b/CondCore/Utilities/python/o2olib.py index e3bf619dc681e..764f44bcaf487 100644 --- a/CondCore/Utilities/python/o2olib.py +++ b/CondCore/Utilities/python/o2olib.py @@ -38,6 +38,7 @@ class O2OJob(_Base): __table_args__ = {'schema' : schema_name} name = sqlalchemy.Column(sqlalchemy.String(100), primary_key=True) enabled = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) + frequent = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) tag_name = sqlalchemy.Column(sqlalchemy.String(100), nullable=False) interval = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) @@ -171,7 +172,7 @@ def connect( self, service, args ): def runManager( self ): return O2ORunMgr( self.db_connection, self.session, O2OMgr.logger( self ) ) - def add( self, job_name, config_filename, int_val, en_flag ): + def add( self, job_name, config_filename, int_val, freq_flag, en_flag ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -182,15 +183,18 @@ def add( self, job_name, config_filename, int_val, en_flag ): configJson = self.readConfiguration( config_filename ) if configJson == '': return False - job = O2OJob(name=job_name,tag_name='-',enabled=en_flag,interval=int_val) - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + freq_val = 0 + if freq_flag: + freq_val = 1 + job = O2OJob(name=job_name,tag_name='-',enabled=en_flag,frequent=freq_val,interval=int_val) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(job) self.session.add(config) self.session.commit() O2OMgr.logger( self).info( "New o2o job '%s' created.", job_name ) return True - def set( self, job_name, en_flag ): + def set( self, job_name, en_flag, fr_val=None ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -198,13 +202,22 @@ def set( self, job_name, en_flag ): if enabled is None: O2OMgr.logger( self).error( "A job called '%s' does not exist.", job_name ) return - job = O2OJob(name=job_name,enabled=en_flag) - action = 'enabled' - if not en_flag: - action = 'disabled' - self.session.merge(job) - self.session.commit() - O2OMgr.logger( self).info( "Job '%s' %s." %(job_name,action) ) + if en_flag is not None and enabled != en_flag: + job = O2OJob(name=job_name,enabled=en_flag) + self.session.merge(job) + self.session.commit() + action = 'enabled' + if not en_flag: + action = 'disabled' + O2OMgr.logger( self).info( "Job '%s' %s." %(job_name,action) ) + if fr_val is not None: + job = O2OJob(name=job_name,frequent=fr_val) + self.session.merge(job) + self.session.commit() + if fr_val==1: + O2OMgr.logger( self).info( "Job '%s' set 'frequent'") + else: + O2OMgr.logger( self).info( "Job '%s' unset 'frequent'") def setConfig( self, job_name, config_filename ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) @@ -217,7 +230,7 @@ def setConfig( self, job_name, config_filename ): configJson = self.readConfiguration( config_filename ) if configJson == '': return False - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(config) self.session.commit() O2OMgr.logger( self).info( "New configuration inserted for job '%s'", job_name ) @@ -244,7 +257,7 @@ def migrateConfig( self ): configDict = {} configDict['tag']=tag configJson = json.dumps( configDict ) - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(config) O2OMgr.logger( self).info( "Configuration for job '%s' inserted.", job_name ) self.session.commit() @@ -254,12 +267,14 @@ def listJobs( self ): res = self.session.query(O2ORun.job_name,sqlalchemy.func.max(O2ORun.start_time)).group_by(O2ORun.job_name).order_by(O2ORun.job_name) for r in res: runs[r[0]] = str(r[1]) - res = self.session.query(O2OJob.name, O2OJob.interval, O2OJob.enabled).order_by(O2OJob.name).all() + res = self.session.query(O2OJob.name, O2OJob.interval, O2OJob.enabled, O2OJob.frequent).order_by(O2OJob.name).all() table = [] for r in res: row = [] row.append(r[0]), row.append('%5d' %r[1] ) + frequent = 'Y' if (r[3]==1) else 'N' + row.append('%4s' %frequent ) enabled = 'Y' if (r[2]==1) else 'N' row.append('%4s' %enabled ) lastRun = '-' @@ -267,7 +282,7 @@ def listJobs( self ): lastRun = runs[r[0]] row.append( lastRun ) table.append(row) - headers = ['Job name','Interval','Enabled','Last run start'] + headers = ['Job name','Interval','Frequent','Enabled','Last run start'] print_table( headers, table ) def listConfig( self, jname ): @@ -358,7 +373,7 @@ def startJob( self, job_name ): self.logger.error( str(e) ) return 6 self.job_name = job_name - self.start = datetime.now() + self.start = datetime.now(timezone.utc) run = O2ORun(job_name=self.job_name,start_time=self.start,status_code=startStatus) self.session.add(run) self.session.commit() @@ -373,7 +388,7 @@ def startJob( self, job_name ): def endJob( self, status, log ): - self.end = datetime.now() + self.end = datetime.now(timezone.utc) try: run = O2ORun(job_name=self.job_name,start_time=self.start,end_time=self.end,status_code=status,log=log) self.session.merge(run) @@ -390,7 +405,7 @@ def executeJob( self, args ): logFolder = os.getcwd() if logFolderEnvVar in os.environ: logFolder = os.environ[logFolderEnvVar] - datelabel = datetime.now().strftime("%y-%m-%d-%H-%M-%S") + datelabel = datetime.now(timezone.utc).strftime("%y-%m-%d-%H-%M-%S") logFileName = '%s-%s.log' %(job_name,datelabel) logFile = os.path.join(logFolder,logFileName) started = self.startJob( job_name ) @@ -443,11 +458,16 @@ def execute(self): parser_create.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) parser_create.add_argument('--interval', '-i', type=int, help='the chron job interval',default=0) + parser_create.add_argument('--frequent', '-f',action='store_true',help='set the "frequent" flag for this job') parser_create.set_defaults(func=self.create) parser_setConfig = parser_subparsers.add_parser('setConfig', description='Set a new configuration for the specified job. The configuration is expected as a list of entries "param": "value" (dictionary). The "param" labels will be used to inject the values in the command to execute. The dictionary is stored in JSON format.') parser_setConfig.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) parser_setConfig.set_defaults(func=self.setConfig) + parser_setFrequent = parser_subparsers.add_parser('setFrequent',description='Set the "frequent" flag for the specified job') + parser_setFrequent.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) + parser_setFrequent.add_argument('--flag', '-f', choices=['0','1'], help='the flag value to set',required=True) + parser_setFrequent.set_defaults(func=self.setFrequent) parser_setInterval = parser_subparsers.add_parser('setInterval',description='Set a new execution interval for the specified job') parser_setInterval.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_setInterval.add_argument('--interval', '-i', type=int, help='the chron job interval',required=True) @@ -516,6 +536,9 @@ def enable(self): def disable(self): self.mgr.set( self.args.name, False ) + def setFrequent(self): + self.mgr.set( self.args.name, None, int(self.args.flag) ) + def migrate(self): self.mgr.migrateConfig() diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index 0692224a1a24c..f2476e432d7ae 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -38,11 +38,28 @@ from CondCore.Utilities.tier0 import Tier0Handler, Tier0Error, tier0Url maxSince = 18446744073709551615 sizeOfTimestamp = 19 +tag_db_lock_access_code = 8 +tag_db_write_access_code = 2 +tag_db_read_access_code = 1 +tag_db_no_protection_code = 0 + +db_key_credential_type_code = 1 +db_cmsuser_credential_type_code = 2 +db_session_credential_type_code = 4 + +db_access_code_map = { tag_db_write_access_code: "W", tag_db_lock_access_code: "L" } + +db_credential_type_map = { db_key_credential_type_code : ("DB KEY",'K'), + db_cmsuser_credential_type_code : ("CMS USER",'U'), + db_session_credential_type_code : ("DB SESSION",'S'), } + # Utility functions def _rawdict(obj): return dict([(str(column), getattr(obj, column)) for column in obj.__table__.columns.keys()]) +def _rawdict_selection(obj): + return dict([(str(column), getattr(obj, column)) for column in obj._fields]) def _get_payload_full_hash(session, payload, check=True): # Limited to 2 to know whether there is more than one in a single query @@ -262,11 +279,11 @@ def _check_same_object(args): if (args.destdb is None or args.db == args.destdb) and (args.second is None or args.first == args.second): raise Exception('The source object and the destination object are the same (i.e. same database and same name): %s' % str_db_object(args.db, args.first)) -def _connect(db, init, read_only, args): +def _connect(db, init, read_only, args, as_admin=False): logging.debug('Preparing connection to %s ...', db) - url = conddb.make_url( db, read_only ) + url = conddb.make_url( db, read_only) pretty_url = url if url.drivername == 'oracle+frontier': ws = url.host.rsplit('%2F') @@ -275,7 +292,10 @@ def _connect(db, init, read_only, args): connTo = '%s [%s]' %(db,pretty_url) logging.info('Connecting to %s', connTo) logging.debug('DB url: %s',url) - connection = conddb.connect(url, authPath=args.authPath, verbose=0 if args.verbose is None else args.verbose - 1) + verbose= 0 + if args.verbose is not None: + verbose = args.verbose - 1 + connection = conddb.connect(url, args.authPath, verbose, as_admin) if not read_only: @@ -298,7 +318,7 @@ def _connect(db, init, read_only, args): return connection -def connect(args, init=False, read_only=True): +def connect(args, init=False, read_only=True, as_admin=False): args.force = args.force if 'force' in dir(args) else False if 'destdb' in args: @@ -314,8 +334,7 @@ def connect(args, init=False, read_only=True): conn2 = _connect(args.destdb, init, False, args) return conn1, conn2 - return _connect( args.db, init, read_only, args) - + return _connect( args.db, init, read_only, args, as_admin) def str_db_object(db, name): return '%s::%s' % (db, name) @@ -924,6 +943,7 @@ def _get_synchro_policy( synchronization ): raise Exception('Cannot handle synchronization %s' %synchronization) return _synchro_map[synchronization] + def listTags_(args): connection = connect(args) session = connection.session() @@ -1608,7 +1628,8 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t Tag1 = session1.get_dbtype(conddb.Tag) Tag2 = session2.get_dbtype(conddb.Tag) # Copy the tag - tag = _rawdict(session1.query(Tag1).get(first)) + obj = session1.query(Tag1.name, Tag1.time_type, Tag1.object_type, Tag1.synchronization, Tag1.description, Tag1.last_validated_time, Tag1.end_of_validity, Tag1.insertion_time, Tag1.modification_time).filter(Tag1.name == first).first() + tag = _rawdict_selection(obj) tag['name'] = second if session2._is_sqlite: @@ -1634,15 +1655,14 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t selectStr += ' selecting insertion time < %s' %args.snapshot logging.info('Copying tag %s to %s %s', str_db_object(args.db, first), str_db_object(args.destdb, second), selectStr) - - query = session2.query(Tag2).filter(Tag2.name == second ) + query = session2.query(Tag2.time_type, Tag2.object_type, Tag2.synchronization).filter(Tag2.name == second ) destExists = False destPayloadType = None destTimeType = None destSynchro = None for t in query: destExists = True - t = _rawdict(t) + t = _rawdict_selection(t) destPayloadType = t['object_type'] destTimeType = t['time_type'] destSynchro = t['synchronization'] @@ -2506,6 +2526,111 @@ def fromTimestamp_( args ): else: output(args,"String date time for timestamp %s: '%s'" %(args.timestamp, sdt)) +def showProtections( args ): + connection = connect(args, False, True, True) + session = connection.session() + Tag = session.get_dbtype(conddb.Tag) + result = session.query(Tag.name, Tag.protection_code).filter(Tag.name==args.tag).all() + get_authorizations = False + table = [] + for res in result: + protection_fl = '-' + protection_str = 'not protected' + if res[1]!=tag_db_no_protection_code: + get_authorizations = True + write_flag = res[1] & tag_db_write_access_code + lock_flag = res[1] & tag_db_lock_access_code + protection_fl = '' + protection_str = '' + if write_flag != 0: + protection_fl += db_access_code_map[tag_db_write_access_code] + protection_str += 'write protected' + if lock_flag != 0: + protection_fl += db_access_code_map[tag_db_lock_access_code] + if protection_str != '': + protection_str += ',' + protection_str += 'locked' + table.append((args.tag,protection_fl,protection_str)) + break + if len(table)==0: + logging.error('Tag %s does not exists.'%args.tag) + return 1 + output_table(args,table,['Tag','Flags','Protection']) + if get_authorizations: + TagAuthorization = session.get_dbtype(conddb.TagAuthorization) + results = session.query(TagAuthorization.access_type, TagAuthorization.credential, TagAuthorization.credential_type).filter(TagAuthorization.tag_name==args.tag).all() + table = [] + for r in results: + table.append((db_access_code_map[r[0]],db_credential_type_map[r[2]][0],r[1])) + output_table(args,table,['Access Type','Credential Type','Credential']) + return 0 + +def setProtection( args ): + if args.credential is not None and args.credentialtype is None: + logging.error('Specified option "credential" requires option "credentialtype') + return 2 + if not args.remove and args.accesstype == db_access_code_map[tag_db_lock_access_code]: + logging.error("Lock can't be set by command line tool action.") + return 2 + connection = connect(args, False, True, True) + session = connection.session() + Tag = session.get_dbtype(conddb.Tag) + result = session.query(Tag.name, Tag.protection_code).filter(Tag.name==args.tag).all() + full_protection_code = None + for res in result: + full_protection_code = res[1] + if full_protection_code is None: + logging.error('Tag %s does not exists.'%args.tag) + return 1 + TagAuthorization = session.get_dbtype(conddb.TagAuthorization) + input_access_code = None + for k in db_access_code_map.keys(): + if db_access_code_map[k] == args.accesstype: + input_access_code = k + input_credential = None + input_credential_code = None + input_credential_type = None + if args.credential is not None: + if input_access_code == tag_db_lock_access_code: + logger.warning('Ignoring credentials specified for the lock - the full lock will be removed.') + else: + input_credential = args.credential + for k in db_credential_type_map.keys(): + if db_credential_type_map[k][1] == args.credentialtype: + input_credential_code = k + input_credential_type = db_credential_type_map[k][0] + new_protection_code = 0 + action = 'Access permission altered.' + note = '' + if args.remove: + query = session.query(TagAuthorization).filter(TagAuthorization.tag_name == args.tag) + query = query.filter(TagAuthorization.access_type == input_access_code) + if input_credential is not None: + query = query.filter(TagAuthorization.credential == input_credential) + query = query.filter(TagAuthorization.credential_type == input_credential_code) + new_protection_code = full_protection_code + note = '%s permission for %s "%s" removed'%(args.accesstype,input_credential_type,args.credential) + else: + for code in db_access_code_map.keys(): + if code != input_access_code: + new_protection_code |= (full_protection_code & code) + note = '%s restrictions removed'%args.accesstype + query = query.delete() + else: + new_protection_code = full_protection_code | input_access_code + if input_credential is not None: + session.add(TagAuthorization(tag_name=args.tag, access_type=input_access_code, + credential=input_credential, credential_type=input_credential_code )) + note = '%s permission for %s "%s" added'%(args.accesstype,input_credential_type,args.credential) + else: + note = '%s restriction set'%args.accesstype + session.merge(Tag(name=args.tag,protection_code=new_protection_code)) + _update_tag_log(session,args.tag,datetime.datetime.utcnow(),action,note) + session.commit() + logging.info(note) + logging.info('Tag header updated. Action(s): %s' %action) + return 0 + def main(): '''Entry point. ''' @@ -2653,6 +2778,18 @@ def main(): parser_fromTimestamp.add_argument('timestamp', help="The Time timetype value") parser_fromTimestamp.set_defaults(func=fromTimestamp_) + parser_showProtections = parser_subparsers.add_parser('showProtections', description='Display the access restriction for the specified tag') + parser_showProtections.add_argument('tag', help="The tag name") + parser_showProtections.set_defaults(func=showProtections) + + parser_setProtection = parser_subparsers.add_parser('setProtection', description='Set an access restriction for the specified tag') + parser_setProtection.add_argument('tag', help="The tag name") + parser_setProtection.add_argument('--accesstype','-a', choices=[db_access_code_map[tag_db_write_access_code],db_access_code_map[tag_db_lock_access_code]], required=True, help='The access type of the protection (flag)') + parser_setProtection.add_argument('--credential','-c', help='The credential entitled with the permission') + parser_setProtection.add_argument('--credentialtype','-t', choices=[db_credential_type_map[db_key_credential_type_code][1],db_credential_type_map[db_cmsuser_credential_type_code][1]],help='The type of the credential provided. Required for "credential" option') + parser_setProtection.add_argument('--remove','-r',action='store_true', help='Remove the specified protection') + parser_setProtection.set_defaults(func=setProtection) + args = parser.parse_args() logging.basicConfig( format = '[%(asctime)s] %(levelname)s: %(message)s', diff --git a/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h b/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h index e6556c5ab8962..1466cca86783b 100644 --- a/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h +++ b/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h @@ -71,8 +71,6 @@ class EcalCondObjectContainer { return ee_.end(); } - inline const_iterator begin() const { return eb_.begin(); } - inline const_iterator end() const { return ee_.end(); } inline void setValue(const uint32_t id, const Item &item) { (*this)[id] = item; } diff --git a/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc b/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc index c1e462a8c5a75..d85b1e1eb7420 100644 --- a/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc +++ b/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc @@ -5,7 +5,8 @@ EcalIntercalibConstantsGPU::EcalIntercalibConstantsGPU(EcalIntercalibConstants const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } diff --git a/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc b/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc index ed06c6591597d..7cc7117ba48de 100644 --- a/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc +++ b/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc @@ -5,7 +5,8 @@ EcalLaserAPDPNRatiosRefGPU::EcalLaserAPDPNRatiosRefGPU(EcalLaserAPDPNRatiosRef const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } diff --git a/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc b/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc index b16742f4964c8..538c0438829bc 100644 --- a/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc +++ b/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc @@ -5,7 +5,8 @@ EcalLaserAlphasGPU::EcalLaserAlphasGPU(EcalLaserAlphas const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 1b984ce2c0d6a..947e4b2ec8c78 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -45,6 +45,8 @@ 'phase1_2017_design' : '113X_mc2017_design_v5', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector 'phase1_2017_realistic' : '113X_mc2017_realistic_v5', + # GlobalTag for MC production with realistic conditions for Phase1 2017 detector, for PP reference run + 'phase1_2017_realistic_ppref' : '120X_mc2017_realistic_forppRef5TeV_v1', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode 'phase1_2017_cosmics' : '113X_mc2017cosmics_realistic_deco_v5', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode diff --git a/GeneratorInterface/Herwig7Interface/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py diff --git a/GeneratorInterface/Herwig7Interface/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py diff --git a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py index 3f56b43d74d00..68648d19e2bd6 100644 --- a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CP5Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) diff --git a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py index c2ff018b3a23b..46db99fa77df4 100644 --- a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py +++ b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py @@ -6,6 +6,7 @@ from Configuration.Generator.Herwig7Settings.Herwig7LHECommonSettings_cfi import * from Configuration.Generator.Herwig7Settings.Herwig7LHEPowhegSettings_cfi import * +externalLHEProducer.generateConcurrently = cms.untracked.bool(False) generator = cms.EDFilter("Herwig7GeneratorFilter", herwig7CH3SettingsBlock, diff --git a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py index fe4cc50904e45..d94cb5b3caed2 100644 --- a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CP5Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py new file mode 100644 index 0000000000000..0ab27b9359f09 --- /dev/null +++ b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + crossSection = cms.untracked.double(51360.0), # 17120.0 x 3 + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'WeakSingleBoson:ffbar2W = on', + '24:onMode = off', + '24:onIfAny = 11 12', + '24:onIfAny = 13 14', + '24:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) + +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py similarity index 79% rename from Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py rename to Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py index fbd32220020da..d6f2fd727959d 100644 --- a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), @@ -11,16 +11,17 @@ maxEventsToPrint = cms.untracked.int32(0), PythiaParameters = cms.PSet( pythia8CommonSettingsBlock, - pythia8CUEP8M1SettingsBlock, + pythia8CP5SettingsBlock, processParameters = cms.vstring( 'WeakSingleBoson:ffbar2W = on', '24:onMode = off', - '24:onIfAny = 12 13', + '24:onIfAny = 13 14', ), parameterSets = cms.vstring('pythia8CommonSettings', - 'pythia8CUEP8M1Settings', + 'pythia8CP5Settings', 'processParameters', ) ) ) +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py new file mode 100644 index 0000000000000..5f3c2c32ba905 --- /dev/null +++ b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py @@ -0,0 +1,30 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.), + crossSection = cms.untracked.double(1.), + comEnergy = cms.double(14000.0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'NewGaugeBoson:ffbar2Wprime = on', + '34:m0 = 2000 ', + '34:onMode = off', + '34:onIfAny = 11 12', + '34:onIfAny = 13 14', + '34:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) + +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py deleted file mode 100644 index db8a2ac229a02..0000000000000 --- a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for replacing the default pixel track "fitting" with eihter Riemann or BrokenLine fit - -pixelNtupleFit = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py new file mode 100644 index 0000000000000..94b14a4f5a6e3 --- /dev/null +++ b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for replacing the legacy pixel tracks with the "Patatrack" pixel ntuplets, +# fishbone cleaning, and either the Broken Line fit (by default) or the Riemann fit. +# It also replaces the "gap" pixel vertices with a density-based vertex reconstruction algorithm. + +pixelNtupletFit = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index b7973c29c2b45..69e22b117dde9 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -989,7 +989,7 @@ def genS(fragment,howMuch): ## pp reference tests -ppRefAlca2017 = {'--conditions':'auto:phase1_2017_realistic', '--era':'Run2_2017_ppRef'} +ppRefAlca2017 = {'--conditions':'auto:phase1_2017_realistic_ppref', '--era':'Run2_2017_ppRef', '--beamspot':'Fixed_EmitRealistic5TeVppCollision2017'} ppRefDefaults2017=merge([ppRefAlca2017,{'-n':2}]) steps['QCD_Pt_80_120_13_PPREF']=merge([ppRefDefaults2017,gen2017('QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi',Kby(9,150))]) @@ -2211,10 +2211,13 @@ def gen2021HiMix(fragment,howMuch): } step3_pixel_ntuplet_cpu = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + '--procModifiers': 'pixelNtupletFit' +} +step3_pixel_ntuplet_gpu = { + '--procModifiers': 'pixelNtupletFit,gpu' } step3_pixel_triplets = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' } step3_gpu = { '--procModifiers': 'gpu', @@ -2348,9 +2351,9 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2018reHLT_ZBPrompt']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']=merge([{'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,DQM:@pixelTrackingOnlyDQM'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixel_ntuplet_cpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_pixel_ntuplet_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsCPU']=merge([step3_pixel_ntuplet_cpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_pixel_ntuplet_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_ECALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,DQM:@ecalOnly'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_ECALOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_ECALOnlyCPU']]) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 748ed6d1375af..d33df15bc0e40 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1,4 +1,4 @@ -from copy import deepcopy +from copy import copy, deepcopy from collections import OrderedDict import six from .MatrixUtil import merge, Kby @@ -396,246 +396,151 @@ def condition(self, fragment, stepList, key, hasHarvest): '--procModifiers': 'mlpf' } -# Patatrack workflows -class UpgradeWorkflowPatatrack(UpgradeWorkflow): +# Patatrack workflows: +# - 2018 conditions, TTbar +# - 2018 conditions, Z->mumu, +# - 2021 conditions, TTbar +# - 2021 conditions, Z->mumu, +class PatatrackWorkflow(UpgradeWorkflow): + def __init__(self, reco, harvest, **kwargs): + # adapt the parameters for the UpgradeWorkflow init method + super(PatatrackWorkflow, self).__init__( + steps = [ + 'Reco', + 'HARVEST', + 'RecoFakeHLT', + 'HARVESTFakeHLT', + 'RecoGlobal', + 'HARVESTGlobal', + ], + PU = [], + **kwargs) + self.__reco = reco + self.__reco.update({ + '--datatier': 'GEN-SIM-RECO,DQMIO', + '--eventcontent': 'RECOSIM,DQM' + }) + self.__harvest = harvest + def condition(self, fragment, stepList, key, hasHarvest): - is_2018_ttbar = ('2018' in key and fragment=="TTbar_13") - is_2021_ttbar = ('2021' in key and fragment=="TTbar_14TeV") - is_2018_zmumu = ('2018' in key and fragment=="ZMM_13") - is_2021_zmumu = ('2021' in key and fragment=="ZMM_14") - result = any((is_2018_ttbar, is_2021_ttbar, is_2018_zmumu, is_2021_zmumu)) and hasHarvest and self.condition_(fragment, stepList, key, hasHarvest) - if result: - # skip ALCA and Nano - skipList = [s for s in stepList if (("ALCA" in s) or ("Nano" in s))] - for skip in skipList: + # select only a subset of the workflows + selected = [ + ('2018' in key and fragment == "TTbar_13"), + ('2021' in key and fragment == "TTbar_14TeV"), + ('2018' in key and fragment == "ZMM_13"), + ('2021' in key and fragment == "ZMM_14"), + ] + result = any(selected) and hasHarvest + + # skip ALCA and Nano steps + for skip in copy(stepList): + if ("ALCA" in skip) or ("Nano" in skip): stepList.remove(skip) return result - def condition_(self, fragment, stepList, key, hasHarvest): - return True -class UpgradeWorkflowPatatrack_PixelOnlyCPU(UpgradeWorkflowPatatrack): def setup_(self, step, stepName, stepDict, k, properties): if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) + stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]]) elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'}, stepDict[step][k]]) + stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]]) - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key -upgradeWFs['PatatrackPixelOnlyCPU'] = UpgradeWorkflowPatatrack_PixelOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyCPU', offset = 0.501, ) -upgradeWFs['PatatrackPixelOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' -} - -upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = UpgradeWorkflowPatatrack_PixelOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], - suffix = 'Patatrack_PixelOnlyTripletsCPU', - offset = 0.505, -) - -upgradeWFs['PatatrackPixelOnlyTripletsCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' -} - -class UpgradeWorkflowPatatrack_PixelOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackPixelOnlyGPU'] = UpgradeWorkflowPatatrack_PixelOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit,gpu' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyGPU', offset = 0.502, ) -upgradeWFs['PatatrackPixelOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} +upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, + suffix = 'Patatrack_PixelOnlyTripletsCPU', + offset = 0.505, +) -upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = UpgradeWorkflowPatatrack_PixelOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyTripletsGPU', offset = 0.506, ) -upgradeWFs['PatatrackPixelOnlyTripletsGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' -} - -class UpgradeWorkflowPatatrack_ECALOnlyCPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@ecalOnlyValidation+@ecal'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackECALOnlyCPU'] = UpgradeWorkflowPatatrack_ECALOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackECALOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', + }, + harvest = { + '-s': 'HARVESTING:@ecalOnlyValidation+@ecal' + }, suffix = 'Patatrack_ECALOnlyCPU', offset = 0.511, ) -upgradeWFs['PatatrackECALOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', -} - -class UpgradeWorkflowPatatrack_ECALOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@ecalOnlyValidation+@ecal'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackECALOnlyGPU'] = UpgradeWorkflowPatatrack_ECALOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackECALOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', + '--procModifiers': 'gpu' + }, + harvest = { + '-s': 'HARVESTING:@ecalOnlyValidation+@ecal' + }, suffix = 'Patatrack_ECALOnlyGPU', offset = 0.512, ) -upgradeWFs['PatatrackECALOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} - -class UpgradeWorkflowPatatrack_HCALOnlyCPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackHCALOnlyCPU'] = UpgradeWorkflowPatatrack_HCALOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackHCALOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', + }, + harvest = { + '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only' + }, suffix = 'Patatrack_HCALOnlyCPU', offset = 0.521, ) -upgradeWFs['PatatrackHCALOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', -} - -class UpgradeWorkflowPatatrack_HCALOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackHCALOnlyGPU'] = UpgradeWorkflowPatatrack_HCALOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackHCALOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', + '--procModifiers': 'gpu' + }, + harvest = { + '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only' + }, suffix = 'Patatrack_HCALOnlyGPU', offset = 0.522, ) -upgradeWFs['PatatrackHCALOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} - # end of Patatrack workflows class UpgradeWorkflow_ProdLike(UpgradeWorkflow): @@ -1345,7 +1250,7 @@ def __init__(self, howMuch, dataset): ('PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'PhotonJets_Pt_10_14TeV')), ('QQH1352T_Tauola_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'QQH1352T_Tauola_14TeV')), ('MinBias_14TeV_pythia8_TuneCP5_cfi', UpgradeFragment(Kby(90,100),'MinBias_14TeV')), - ('WM_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'WM_14TeV')), + ('WToMuNu_14TeV_TuneCP5_pythia8_cfi', UpgradeFragment(Kby(9,100),'WToMuNu_14TeV')), ('ZMM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(18,100),'ZMM_13')), ('QCDForPF_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(50,100),'QCD_FlatPt_15_3000HS_14')), ('DYToLL_M-50_14TeV_pythia8_cff', UpgradeFragment(Kby(9,100),'DYToLL_M_50_14TeV')), @@ -1415,14 +1320,14 @@ def __init__(self, howMuch, dataset): ('FlatRandomPtAndDxyGunProducer_MuPt2To10_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To10')), ('FlatRandomPtAndDxyGunProducer_MuPt10To30_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt10To30')), ('FlatRandomPtAndDxyGunProducer_MuPt30To100_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt30To100')), - ('B0ToKstarMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(304,3030),'B0ToKstarMuMu_14TeV')), # 3.3% - ('BsToEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(223,2222),'BsToEleEle_14TeV')), # 4.5% - ('BsToJpsiGamma_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(2500,25000),'BsToJpsiGamma_14TeV')), # 0.4% + ('B0ToKstarMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(304,3030),'B0ToKstarMuMu_14TeV')), # 3.3% + ('BsToEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(223,2222),'BsToEleEle_14TeV')), # 4.5% + ('BsToJpsiGamma_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(2500,25000),'BsToJpsiGamma_14TeV')), # 0.4% ('BsToJpsiPhi_mumuKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(910,9090),'BsToJpsiPhi_mumuKK_14TeV')), # 1.1% - ('BsToMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(313,3125),'BsToMuMu_14TeV')), # 3.2% - ('BsToPhiPhi_KKKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(556,5555),'BsToPhiPhi_KKKK_14TeV')), # 1.8% + ('BsToMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(313,3125),'BsToMuMu_14TeV')), # 3.2% + ('BsToPhiPhi_KKKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(556,5555),'BsToPhiPhi_KKKK_14TeV')), # 1.8% ('TauToMuMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(18939,189393),'TauToMuMuMu_14TeV')), # effi = 5.280e-04 - ('BdToKstarEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(206,2061),'BdToKstarEleEle_14TeV')), #effi = 4.850e-02 + ('BdToKstarEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(206,2061),'BdToKstarEleEle_14TeV')), #effi = 4.850e-02 ('ZpTT_1500_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'ZpTT_1500_14')), ('BuMixing_BMuonFilter_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(900,10000),'BuMixing_14')), ('Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'Upsilon1SToMuMu_14')), @@ -1430,4 +1335,17 @@ def __init__(self, howMuch, dataset): ('QCD_Pt_1800_2400_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50), 'QCD_Pt_1800_2400_14')), ('DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'DisplacedSUSY_14TeV')), ('GluGluTo2Jets_M_300_2000_14TeV_Exhume_cff',UpgradeFragment(Kby(9,100),'GluGluTo2Jets_14TeV')), + ('TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'TTbarToDilepton_14TeV')), + ('QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'QQToHToTauTau_14TeV')), + ('ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToEE_m6000_14TeV')), + ('ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToMM_m6000_14TeV')), + ('SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')), + ('VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')), + ('EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), + ('WToLNu_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')), + ('WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')), + ('DoubleMuFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleMuFlatPt1p5To8')), + ('DoubleElectronFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleElectronFlatPt1p5To8')), + ('DoubleMuFlatPt1p5To8Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt1p5To8Dxy100')), + ('DoubleMuFlatPt2To100Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To100Dxy100')), ]) diff --git a/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py b/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py index 1e6cf30d8c917..3d64a8c1c4912 100644 --- a/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py @@ -8,9 +8,9 @@ gctDigis.inputLabel = 'rawDataRepacker' gtDigis.DaqGtInputTag = 'rawDataRepacker' gtEvmDigis.EvmGtInputTag = 'rawDataRepacker' -siPixelDigis.InputLabel = 'rawDataRepacker' +siPixelDigis.cpu.InputLabel = 'rawDataRepacker' siStripDigis.ProductLabel = 'rawDataRepacker' -ecalDigis.InputLabel = 'rawDataRepacker' +ecalDigis.cpu.InputLabel = 'rawDataRepacker' ecalPreshowerDigis.sourceTag = 'rawDataRepacker' hcalDigis.InputLabel = 'rawDataRepacker' muonCSCDigis.InputObjects = 'rawDataRepacker' @@ -18,7 +18,23 @@ muonRPCDigis.InputLabel = 'rawDataRepacker' castorDigis.InputLabel = 'rawDataRepacker' -RawToDigiTask = cms.Task(csctfDigis,dttfDigis,gctDigis,gtDigis,gtEvmDigis,siPixelDigis,siStripDigis,ecalDigis,ecalPreshowerDigis,hcalDigis,muonCSCDigis,muonDTDigis,muonRPCDigis,castorDigis,scalersRawToDigi) +RawToDigiTask = cms.Task( + csctfDigis, + dttfDigis, + gctDigis, + gtDigis, + gtEvmDigis, + siPixelDigis, + siStripDigis, + ecalDigis, + ecalPreshowerDigis, + hcalDigis, + muonCSCDigis, + muonDTDigis, + muonRPCDigis, + castorDigis, + scalersRawToDigi) + RawToDigi = cms.Sequence(RawToDigiTask) RawToDigiTask_woGCT = RawToDigiTask.copyAndExclude([gctDigis]) diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 42fa09bd30c62..ef77578a7775d 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -75,7 +75,7 @@ scalersRawToDigi.scalersInputTag = 'rawDataCollector' siPixelDigis.cpu.InputLabel = 'rawDataCollector' -(~gpu).toModify(ecalDigis, InputLabel='rawDataCollector') +ecalDigis.cpu.InputLabel = 'rawDataCollector' ecalPreshowerDigis.sourceTag = 'rawDataCollector' hcalDigis.InputLabel = 'rawDataCollector' muonCSCDigis.InputObjects = 'rawDataCollector' @@ -87,7 +87,7 @@ run3_common.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([castorDigis])) from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -# Remove siPixelDigis until we have phase1 pixel digis +# Remove siPixelDigis until we have Phase 2 pixel digis phase2_tracker.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([siPixelDigis])) # FIXME diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index e03d228a857fb..62d03776be5de 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -235,6 +235,7 @@ bunchSpacingProducer, offlineBeamSpot, hcalOnlyLocalRecoTask, + hcalOnlyGlobalRecoTask, pfClusteringHBHEHFOnlyTask ) diff --git a/Configuration/StandardSequences/python/Services_cff.py b/Configuration/StandardSequences/python/Services_cff.py index ef1da8dec1d59..0949c7b8d4972 100644 --- a/Configuration/StandardSequences/python/Services_cff.py +++ b/Configuration/StandardSequences/python/Services_cff.py @@ -8,12 +8,13 @@ # DQM store service from DQMServices.Core.DQMStore_cfi import * -# load CUDA services when the "gpu" modifier is enabled +# load CUDA services when the "gpu" or "pixelNtupletFit" modifiers are enabled def _addCUDAServices(process): process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") from Configuration.ProcessModifiers.gpu_cff import gpu -modifyConfigurationStandardSequencesServicesAddCUDAServices_ = gpu.makeProcessModifier(_addCUDAServices) +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit +modifyConfigurationStandardSequencesServicesAddCUDAServices_ = (gpu | pixelNtupletFit).makeProcessModifier(_addCUDAServices) # load TritonService when SONIC workflow is enabled def _addTritonService(process): diff --git a/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py b/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py index 834b4249888f3..dbcc43f08352c 100644 --- a/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py +++ b/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py @@ -27,7 +27,7 @@ ## from L1Trigger.L1TCalorimeter.L1TCaloStage1_PPFromRaw_cff import * -ecalDigis.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) +ecalDigis.cpu.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) hcalDigis.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) simHcalTriggerPrimitiveDigis.InputTagFEDRaw = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.cc b/DQM/BeamMonitor/plugins/BeamMonitor.cc index 38a5105eb0fb2..3471760327667 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/BeamMonitor.cc @@ -137,6 +137,7 @@ BeamMonitor::BeamMonitor(const ParameterSet& ps) minNrVertices_ = ps.getParameter("PVFitter").getUntrackedParameter("minNrVerticesForFit"); minVtxNdf_ = ps.getParameter("PVFitter").getUntrackedParameter("minVertexNdf"); minVtxWgt_ = ps.getParameter("PVFitter").getUntrackedParameter("minVertexMeanWeight"); + useLockRecords_ = ps.getUntrackedParameter("useLockRecords"); if (!monitorName_.empty()) monitorName_ = monitorName_ + "/"; @@ -203,6 +204,12 @@ namespace { }; } // namespace +void BeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) { + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->lockRecords(); + } +} + void BeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { frun = iRun.run(); ftimestamp = iRun.beginTime().value(); @@ -1544,8 +1551,11 @@ void BeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) { mapLSBSTrkSize.clear(); mapLSPVStoreSize.clear(); mapLSCF.clear(); -} + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->releaseLocks(); + } +} //-------------------------------------------------------- void BeamMonitor::scrollTH1(TH1* h, time_t ref) { char offsetTime[64]; diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.h b/DQM/BeamMonitor/plugins/BeamMonitor.h index 24b6903739f92..4fbd758c06edc 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.h +++ b/DQM/BeamMonitor/plugins/BeamMonitor.h @@ -37,6 +37,8 @@ class BeamMonitor : public DQMOneEDAnalyzer { protected: // BeginRun + void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; @@ -114,7 +116,7 @@ class BeamMonitor : public DQMOneEDAnalyzer { int countGapLumi_; bool processed_; - + bool useLockRecords_; // ----------member data --------------------------- // std::vector fBSvector; diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc index 0600349e5c4c8..1d0ec92d83b1b 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc @@ -134,6 +134,7 @@ FakeBeamMonitor::FakeBeamMonitor(const ParameterSet& ps) minNrVertices_ = ps.getParameter("PVFitter").getUntrackedParameter("minNrVerticesForFit"); minVtxNdf_ = ps.getParameter("PVFitter").getUntrackedParameter("minVertexNdf"); minVtxWgt_ = ps.getParameter("PVFitter").getUntrackedParameter("minVertexMeanWeight"); + useLockRecords_ = ps.getUntrackedParameter("useLockRecords"); if (!monitorName_.empty()) monitorName_ = monitorName_ + "/"; @@ -196,6 +197,12 @@ namespace { }; } // namespace +void FakeBeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) { + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->lockRecords(); + } +} + void FakeBeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { frun = iRun.run(); ftimestamp = iRun.beginTime().value(); @@ -1499,7 +1506,7 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, } //-------------------------------------------------------- -void FakeBeamMonitor::RestartFitting() { +void FakeBeamMonitor::RestartFitting() { // if (debug_) edm::LogInfo("FakeBeamMonitor") << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" << endl; @@ -1552,6 +1559,9 @@ void FakeBeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) { mapLSBSTrkSize.clear(); mapLSPVStoreSize.clear(); mapLSCF.clear(); + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->releaseLocks(); + } } //-------------------------------------------------------- diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h index e14337dfbda45..934486fbd4ed7 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h @@ -37,7 +37,9 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer ~FakeBeamMonitor() override; protected: - // BeginRun + //BeginRun + void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; @@ -109,7 +111,7 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer int countGapLumi_; bool processed_; - + bool useLockRecords_; // ----------member data --------------------------- // std::vector fBSvector; diff --git a/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py b/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py index 59f02f0ea11fa..0462fc89680e0 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py @@ -11,6 +11,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('ctfWithMaterialTracksP5'), ## ctfWithMaterialTracksP5 for CRAFT diff --git a/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py b/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py index 209465897fedc..341f51f5393ae 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py @@ -12,6 +12,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('generalTracks'), ## ctfWithMaterialTracksP5 for CRAFT diff --git a/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py b/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py index 87e4a7c8142b4..2202dc08e92c8 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py @@ -10,6 +10,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('ctfPixelLess'), diff --git a/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py b/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py index 4365d5850eb4e..3bfeadf0c31ab 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py @@ -13,6 +13,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('pixelTracks'), diff --git a/DQM/BeamMonitor/python/BeamMonitor_cff.py b/DQM/BeamMonitor/python/BeamMonitor_cff.py index 0494a65b047c6..d3cb006c6f10c 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_cff.py @@ -13,6 +13,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('generalTracks'), diff --git a/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py b/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py index 18305eb868507..685fc43bbd93e 100644 --- a/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py +++ b/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py @@ -11,6 +11,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('pixelTracks'), diff --git a/DQM/HcalTasks/python/OfflineSourceSequence_pp.py b/DQM/HcalTasks/python/OfflineSourceSequence_pp.py index 0543cf3aae84d..65172a4180be0 100644 --- a/DQM/HcalTasks/python/OfflineSourceSequence_pp.py +++ b/DQM/HcalTasks/python/OfflineSourceSequence_pp.py @@ -1,36 +1,41 @@ import FWCore.ParameterSet.Config as cms #----------------- -# HCAL DQM Offline Source Sequence Definition for pp -# To be used for Offline DQM importing +# HCAL DQM Offline Source Sequence Definition for pp +# To be used for Offline DQM importing #----------------- -# import the tasks +# import the tasks from DQM.HcalTasks.DigiTask import digiTask from DQM.HcalTasks.RawTask import rawTask from DQM.HcalTasks.TPTask import tpTask from DQM.HcalTasks.RecHitTask import recHitTask, recHitPreRecoTask -# set processing type to Offine +# set processing type to Offine digiTask.ptype = cms.untracked.int32(1) tpTask.ptype = cms.untracked.int32(1) recHitTask.ptype = cms.untracked.int32(1) rawTask.ptype = cms.untracked.int32(1) recHitPreRecoTask.ptype = cms.untracked.int32(1) -# set the label for Emulator TP Task +# set the label for Emulator TP Task tpTask.tagEmul = cms.untracked.InputTag("valHcalTriggerPrimitiveDigis") hcalOfflineSourceSequence = cms.Sequence( - digiTask - +tpTask - +recHitTask - +rawTask) + digiTask + + tpTask + + recHitTask + + rawTask ) hcalOnlyOfflineSourceSequence = cms.Sequence( - digiTask - +recHitPreRecoTask - +rawTask) + digiTask + + recHitPreRecoTask + + rawTask ) + +from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +_phase1_hcalOnlyOfflineSourceSequence = hcalOnlyOfflineSourceSequence.copy() +_phase1_hcalOnlyOfflineSourceSequence.replace(recHitPreRecoTask, recHitTask) +run3_HB.toReplaceWith(hcalOnlyOfflineSourceSequence, _phase1_hcalOnlyOfflineSourceSequence) from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal _phase2_hcalOfflineSourceSequence = hcalOfflineSourceSequence.copyAndExclude([tpTask,rawTask]) diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index 316b4cf91c64d..4c864996a3609 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestLegacy' BSOnlineJobName = 'BeamSpotOnlineTestLegacy' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True #from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 #process = cms.Process("BeamMonitor", Run2_2018) FIXME @@ -19,7 +20,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' - + useLockRecords = False # process.MessageLogger = cms.Service("MessageLogger", debugModules = cms.untracked.vstring('*'), @@ -36,6 +37,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False #--------------- # Input sources @@ -287,7 +289,7 @@ process.castorDigis.InputLabel = rawDataInputTag process.csctfDigis.producer = rawDataInputTag process.dttfDigis.DTTF_FED_Source = rawDataInputTag -process.ecalDigis.InputLabel = rawDataInputTag +process.ecalDigis.cpu.InputLabel = rawDataInputTag process.ecalPreshowerDigis.sourceTag = rawDataInputTag process.gctDigis.inputLabel = rawDataInputTag process.gtDigis.DaqGtInputTag = rawDataInputTag @@ -303,6 +305,7 @@ process.dqmBeamMonitor.OnlineMode = True process.dqmBeamMonitor.recordName = BSOnlineRecordName +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) process.dqmBeamMonitor.resetEveryNLumi = 5 # was 10 for HI process.dqmBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI 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 3765c52e57290..6a8ae674e3e88 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -8,7 +8,7 @@ BSOnlineTag = 'BeamSpotOnlineTestLegacy' BSOnlineJobName = 'BeamSpotOnlineTestLegacy' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' - +useLockRecords = True import sys from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 process = cms.Process("FakeBeamMonitor", Run2_2018) @@ -18,6 +18,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # process.MessageLogger = cms.Service("MessageLogger", @@ -35,9 +36,11 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False else: time.sleep(48.) + #--------------- # Input sources if unitTest: @@ -83,6 +86,7 @@ process.load("DQM.BeamMonitor.FakeBeamMonitor_cff") + #---------------- # Setup tracking #process.load("Configuration.StandardSequences.GeometryRecoDB_cff") @@ -115,7 +119,7 @@ """ process.castorDigis.InputLabel = rawDataInputTag process.csctfDigis.producer = rawDataInputTag process.dttfDigis.DTTF_FED_Source = rawDataInputTag -process.ecalDigis.InputLabel = rawDataInputTag +process.ecalDigis.cpu.InputLabel = rawDataInputTag process.ecalPreshowerDigis.sourceTag = rawDataInputTag process.gctDigis.inputLabel = rawDataInputTag process.gtDigis.DaqGtInputTag = rawDataInputTag @@ -132,7 +136,7 @@ process.dqmFakeBeamMonitor.resetEveryNLumi = 5 # was 10 for HI process.dqmFakeBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI - +process.dqmFakeBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) #--------- diff --git a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py index 9fffc4061cba8..c28d3ce966be3 100644 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestHLT' BSOnlineJobName = 'BeamSpotOnlineTestHLT' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True #from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 #process = cms.Process("BeamMonitor", Run2_2018) # FIMXE @@ -19,6 +20,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # Message logger #process.load("FWCore.MessageLogger.MessageLogger_cfi") @@ -41,6 +43,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False # Common part for PP and H.I Running #----------------------------- @@ -95,6 +98,7 @@ #process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run2_data', '') # Change Beam Monitor variables +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) if process.dqmRunConfig.type.value() is "production": process.dqmBeamMonitor.BeamFitter.WriteAscii = True process.dqmBeamMonitor.BeamFitter.AsciiFileName = '/nfshome0/yumiceva/BeamMonitorDQM/BeamFitResults.txt' 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 a32d96c6d7628..de82265a4ced6 100644 --- a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestHLT' BSOnlineJobName = 'BeamSpotOnlineTestHLT' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True import sys from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 @@ -17,6 +18,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # switch live = True # FIXME @@ -25,7 +27,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True - + useLockRecords = False # Common part for PP and H.I Running #----------------------------- @@ -81,7 +83,6 @@ #----------------------------- process.load("DQM.BeamMonitor.FakeBeamMonitor_cff") process.dqmBeamMonitor = process.dqmFakeBeamMonitor.clone() - #--------------- # Calibration #--------------- @@ -106,7 +107,7 @@ process.dqmBeamMonitor.monitorName = 'FakeBeamMonitor' process.dqmBeamMonitor.OnlineMode = True process.dqmBeamMonitor.recordName = BSOnlineRecordName - +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) process.dqmBeamMonitor.resetEveryNLumi = 5 process.dqmBeamMonitor.resetPVEveryNLumi = 5 diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index ba03f7f75f2d6..cd21b498d7f9c 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -115,7 +115,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") - process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -168,7 +168,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") 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 747ec4d01b07a..2aa8f0fc32dfe 100644 --- a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py @@ -179,7 +179,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -204,7 +204,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") 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 0c692470fc983..a68733cef810a 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -162,7 +162,7 @@ process.ecalMonitorTask.workerParameters.PresampleTask.params.doPulseMaxCheck = False elif runTypeName == 'hi_run': process.ecalMonitorTask.collectionTags.Source = "rawDataRepacker" - process.ecalDigis.InputLabel = cms.InputTag('rawDataRepacker') + process.ecalDigis.cpu.InputLabel = cms.InputTag('rawDataRepacker') elif runTypeName == 'hpu_run': if not unitTest: process.source.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('*')) 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 b28f92d0f8d4e..5c2cafbbfa0e2 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -48,7 +48,6 @@ # Pixel sequence: process.load('Configuration.StandardSequences.MagneticField_cff') process.load('EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi') -process.siPixelDigis.cpu.Timing = False process.siPixelDigis.cpu.IncludeErrors = True process.load('DQM.SiPixelMonitorRawData.SiPixelMonitorHLT_cfi') process.SiPixelHLTSource.saveFile = False diff --git a/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py index b2358e79a1bb6..3887c06b60772 100644 --- a/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py @@ -172,7 +172,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -191,7 +191,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py index e2c9f057f04b1..c995051a63b2e 100644 --- a/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py @@ -185,7 +185,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -207,7 +207,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py index 93df769c2dfe4..b5b25b9fc318a 100644 --- a/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py @@ -182,7 +182,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -201,7 +201,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py index 4ed9c5e298890..0cb164bf2c0b4 100644 --- a/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py @@ -194,7 +194,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -216,7 +216,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") 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 0c7f4707b6d8b..e1e87d866dcc4 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -130,7 +130,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataRepacker") process.ctppsPixelDigis.inputLabel = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") process.muonCSCDigis.InputObjects = cms.InputTag("rawDataRepacker") 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 d2d4ecb4f630d..222cebbf0e1d1 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -128,7 +128,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataRepacker") process.ctppsPixelDigis.inputLabel = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") process.muonCSCDigis.InputObjects = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/last_lumi.txt b/DQM/Integration/python/clients/last_lumi.txt new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/DQM/Integration/python/clients/last_lumi.txt @@ -0,0 +1 @@ +0 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 2decc1b774251..433f9f3510d15 100644 --- a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py @@ -90,7 +90,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") 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 889fc8a978d22..3004cb47ef80b 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -493,7 +493,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -515,7 +515,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index e656189341e70..ba01e3b4ed41a 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -59,7 +59,9 @@ from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * valCscStage2Digis = cscTriggerPrimitiveDigis.clone( CSCComparatorDigiProducer = "muonCSCDigis:MuonCSCComparatorDigi", - CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi" + CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi", + GEMPadDigiClusterProducer = "", + commonParam = dict(runME11ILT = False) ) from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM diff --git a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py index 45e9fe07dba89..7a35ab7b2c0af 100644 --- a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py +++ b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py @@ -19,7 +19,6 @@ # Pixel RawToDigi conversion process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") process.siPixelDigis.InputLabel = "source" -process.siPixelDigis.Timing = False process.siPixelDigis.IncludeErrors = True process.load("DQM.SiPixelMonitorRawData.SiPixelMonitorHLT_cfi") diff --git a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py index 275130d77852b..6636d82cfd54f 100644 --- a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py +++ b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py @@ -19,7 +19,6 @@ # Pixel RawToDigi conversion process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") process.siPixelDigis.InputLabel = "source" -process.siPixelDigis.Timing = False process.siPixelDigis.IncludeErrors = True process.load("DQM.SiPixelMonitorRawData.SiPixelMonitorRawData_cfi") diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py index e9c1052fe9c13..173396b7d9fac 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py @@ -70,6 +70,12 @@ # Track cluster from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import * +SiPixelPhase1TrackClustersOnTrackCorrCharge.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorr.enabled=cms.bool(False) +SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorrOuter.enabled=cms.bool(False) +SiPixelPhase1TrackClustersOnTrackCorrChargeInner.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorrInner.enabled=cms.bool(False) from DQM.SiPixelPhase1Track.SiPixelPhase1TrackResiduals_cfi import * siPixelPhase1OnlineDQM_source = cms.Sequence( diff --git a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml index 9781015a98d6a..9445daca14d82 100644 --- a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml +++ b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index e20d91d101f99..4f57ba4617981 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -31,11 +31,16 @@ #include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" +#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h" +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" + namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { enum { ON_TRACK_CHARGE, + ON_TRACK_CORRECTEDCHARGE, + TEMPLATE_CORRECTION, ON_TRACK_BIGPIXELCHARGE, ON_TRACK_NOTBIGPIXELCHARGE, ON_TRACK_SIZE, @@ -53,6 +58,10 @@ namespace { SIZE_VS_ETA_ON_TRACK_INNER, ON_TRACK_CHARGE_OUTER, ON_TRACK_CHARGE_INNER, + ON_TRACK_CORRECTEDCHARGE_OUTER, + ON_TRACK_CORRECTEDCHARGE_INNER, + TEMPLATE_CORRECTION_OUTER, + TEMPLATE_CORRECTION_INNER, ON_TRACK_SHAPE_OUTER, ON_TRACK_SHAPE_INNER, @@ -74,10 +83,14 @@ namespace { public: explicit SiPixelPhase1TrackClusters(const edm::ParameterSet& conf); + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; private: const bool applyVertexCut_; + const SiPixelTemplateDBObject* templateDBobject_; + std::vector thePixelTemp_; + const TrackerTopology* tkTpl = nullptr; edm::EDGetTokenT tracksToken_; edm::EDGetTokenT offlinePrimaryVerticesToken_; @@ -86,6 +99,8 @@ namespace { edm::ESGetToken trackerTopoToken_; edm::ESGetToken trackerGeomToken_; edm::ESGetToken clusterShapeHitFilterToken_; + + edm::ESGetToken templateDBobjectToken_; }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) @@ -99,10 +114,23 @@ namespace { pixelClusterShapeCacheToken_ = consumes(iConfig.getParameter("clusterShapeCache")); - trackerTopoToken_ = esConsumes(); - trackerGeomToken_ = esConsumes(); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); clusterShapeHitFilterToken_ = esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter")); + templateDBobjectToken_ = esConsumes(); + } + + void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + //get topology + tkTpl = &iSetup.getData(trackerTopoToken_); + + // Initialize 1D templates + templateDBobject_ = &iSetup.getData(templateDBobjectToken_); + if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) + edm::LogError("SiPixelPhase1TrackClusters") + << "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << std::endl; } void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -115,13 +143,6 @@ namespace { return; } - // get geometry - edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); - assert(tracker.isValid()); - - edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); - auto const& tkTpl = *tTopoHandle; - edm::ESHandle shapeFilterH = iSetup.getHandle(clusterShapeHitFilterToken_); auto const& shapeFilter = *shapeFilterH; @@ -141,6 +162,8 @@ namespace { return; } + SiPixelTemplate templ(thePixelTemp_); + edm::Handle pixelClusterShapeCacheH; iEvent.getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH); if (!pixelClusterShapeCacheH.isValid()) { @@ -185,8 +208,8 @@ namespace { // PXB_L4 IS IN THE OTHER WAY // CAN BE XORed BUT LETS KEEP THINGS SIMPLE - bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || - ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); + bool iAmOuter = ((tkTpl->pxbLadder(id) % 2 == 1) && tkTpl->pxbLayer(id) != 4) || + ((tkTpl->pxbLadder(id) % 2 != 1) && tkTpl->pxbLayer(id) == 4); auto pixhit = dynamic_cast(hit->hit()); if (!pixhit) @@ -221,6 +244,18 @@ namespace { // correct charge for track impact angle auto charge = cluster.charge() * ltp.absdz(); + //Correct charge with Template1D + float cotAlpha = ltp.dxdz(); + float cotBeta = ltp.dydz(); + float locBx = 1.; + if (cotBeta < 0.) + locBx = -1.; + float locBz = locBx; + if (cotAlpha < 0.) + locBz = -locBx; + templ.interpolate(templateDBobject_->getTemplateID(id), cotAlpha, cotBeta, locBz, locBx); + auto charge_cor = (charge * templ.qscale()) / templ.r_qMeas_qTrue(); + auto tmpl = templ.qscale() / templ.r_qMeas_qTrue(); auto clustgp = pixhit->globalPosition(); // from rechit @@ -261,6 +296,8 @@ namespace { histo[ON_TRACK_NCLUSTERS].fill(id, &iEvent); histo[ON_TRACK_CHARGE].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION].fill(tmpl, id, &iEvent); histo[ON_TRACK_SIZE].fill(cluster.size(), id, &iEvent); histo[ON_TRACK_POSITIONB].fill(clustgp.z(), clustgp.phi(), id, &iEvent); @@ -273,9 +310,13 @@ namespace { if (iAmOuter) { histo[SIZE_VS_ETA_ON_TRACK_OUTER].fill(etatk, cluster.sizeY(), id, &iEvent); histo[ON_TRACK_CHARGE_OUTER].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE_OUTER].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION_OUTER].fill(tmpl, id, &iEvent); } else { histo[SIZE_VS_ETA_ON_TRACK_INNER].fill(etatk, cluster.sizeY(), id, &iEvent); histo[ON_TRACK_CHARGE_INNER].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE_INNER].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION_INNER].fill(tmpl, id, &iEvent); } } } diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py index 9dd2232a56e25..22b3ff0fde731 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py @@ -63,6 +63,28 @@ ) ) +SiPixelPhase1TrackClustersOnTrackCorrCharge = DefaultHistoTrack.clone( + name = "charge_corr", + title = "Template Corrected Cluster Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save(), + Specification().groupBy("PXForward/PXRing").save(), + ) +) + +SiPixelPhase1TrackTemplateCorr = SiPixelPhase1TrackClustersOnTrackCorrCharge.clone( + name = "template_corr", + title = "Template Correction", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U." +) + SiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( name = "bigpixelcharge", title = "Corrected Big Pixel Charge (OnTrack)", @@ -469,6 +491,35 @@ title = "Corrected Cluster Charge (OnTrack) inner ladders" ) +SiPixelPhase1TrackClustersOnTrackCorrChargeOuter = DefaultHistoTrack.clone( + name = "chargeOuter_corr", + title = "Template Corrected Cluster Charge (OnTrack) outer ladders", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + Specification().groupBy("PXBarrel/PXLayer").save() + ) +) + +SiPixelPhase1TrackClustersOnTrackCorrChargeInner = SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "chargeInner_corr", + title = "Template Corrected Cluster Charge (OnTrack) inner ladders" +) + +SiPixelPhase1TrackTemplateCorrOuter = SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "templateOuter_corr", + title = "Template Correction outer ladders", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U." +) + +SiPixelPhase1TrackTemplateCorrInner = SiPixelPhase1TrackTemplateCorrOuter.clone( + name = "templateInner_corr", + title = "Template Correction inner ladders" +) + + SiPixelPhase1TrackClustersOnTrackShapeOuter = DefaultHistoTrack.clone( topFolderName = "PixelPhase1/ClusterShape", name = "shapeFilterOuter", @@ -488,6 +539,8 @@ # copy this in the enum SiPixelPhase1TrackClustersConf = cms.VPSet( SiPixelPhase1TrackClustersOnTrackCharge, + SiPixelPhase1TrackClustersOnTrackCorrCharge, + SiPixelPhase1TrackTemplateCorr, SiPixelPhase1TrackClustersOnTrackBigPixelCharge, SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, SiPixelPhase1TrackClustersOnTrackSize, @@ -505,6 +558,10 @@ SiPixelPhase1ClustersSizeVsEtaOnTrackInner, SiPixelPhase1TrackClustersOnTrackChargeOuter, SiPixelPhase1TrackClustersOnTrackChargeInner, + SiPixelPhase1TrackClustersOnTrackCorrChargeOuter, + SiPixelPhase1TrackClustersOnTrackCorrChargeInner, + SiPixelPhase1TrackTemplateCorrOuter, + SiPixelPhase1TrackTemplateCorrInner, SiPixelPhase1TrackClustersOnTrackShapeOuter, SiPixelPhase1TrackClustersOnTrackShapeInner, diff --git a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc index 3b20214367712..52aa356da8ac4 100644 --- a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc +++ b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc @@ -1,4 +1,3 @@ - // -*- C++ -*- // Package: SiStripMonitorCluster // Class: SiStripMonitorCluster @@ -652,8 +651,15 @@ void SiStripMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSe runNb = iEvent.id().run(); eventNb++; - trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0) - : iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection + + if (!iEvent.isRealData()) { + trendVar = trendVs10Ls_ ? iEvent.eventAuxiliary().luminosityBlock() / 10.f + : iEvent.eventAuxiliary().luminosityBlock(); // 10 lumisection : lumisection + + } else { + trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0) + : iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection + } int NPixClusters = 0, NStripClusters = 0, MultiplicityRegion = 0; bool isPixValid = false; diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index 455df453412e8..94499fec84ff5 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -17,6 +17,7 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet) TopFolderName_(pSet.getParameter("TopFolderName")), AlignmentLabel_(pSet.getParameter("AlignmentLabel")), ndof_(pSet.getParameter("ndof")), + useHPfoAlignmentPlots_(pSet.getParameter("useHPforAlignmentPlots")), errorPrinted_(false), nbvtx(nullptr), bsX(nullptr), @@ -42,10 +43,14 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet) dzVsPhi_pt1(nullptr), dxyVsEta_pt1(nullptr), dzVsEta_pt1(nullptr), + dxyVsEtaVsPhi_pt1(nullptr), + dzVsEtaVsPhi_pt1(nullptr), dxyVsPhi_pt10(nullptr), dzVsPhi_pt10(nullptr), dxyVsEta_pt10(nullptr), - dzVsEta_pt10(nullptr) { + dzVsEta_pt10(nullptr), + dxyVsEtaVsPhi_pt10(nullptr), + dzVsEtaVsPhi_pt10(nullptr) { // dqmStore_ = edm::Service().operator->(); vertexInputTag_ = pSet.getParameter("vertexLabel"); @@ -176,10 +181,12 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c double DzMax = conf_.getParameter("DzMax"); int PhiBin = conf_.getParameter("PhiBin"); + int PhiBin2D = conf_.getParameter("PhiBin2D"); double PhiMin = conf_.getParameter("PhiMin"); double PhiMax = conf_.getParameter("PhiMax"); int EtaBin = conf_.getParameter("EtaBin"); + int EtaBin2D = conf_.getParameter("EtaBin2D"); double EtaMin = conf_.getParameter("EtaMin"); double EtaMax = conf_.getParameter("EtaMax"); @@ -249,6 +256,38 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 2); + dxyVsEtaVsPhi_pt1 = iBooker.bookProfile2D("dxyVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)", 3); + + dzVsEtaVsPhi_pt1 = iBooker.bookProfile2D("dzVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 3); + dxyVsPhi_pt10 = iBooker.bookProfile("dxyVsPhi_pt10", "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #phi", PhiBin, @@ -296,6 +335,38 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c ""); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 2); + + dxyVsEtaVsPhi_pt10 = iBooker.bookProfile2D("dxyVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)", 3); + + dzVsEtaVsPhi_pt10 = iBooker.bookProfile2D("dzVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 3); } PrimaryVertexMonitor::~PrimaryVertexMonitor() {} @@ -398,7 +469,7 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { for (reco::Vertex::trackRef_iterator t = v.tracks_begin(); t != v.tracks_end(); t++) { bool isHighPurity = (**t).quality(reco::TrackBase::highPurity); - if (!isHighPurity) + if (!isHighPurity && useHPfoAlignmentPlots_) continue; float pt = (**t).pt(); @@ -434,6 +505,8 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { dzVsPhi_pt1->Fill(phi, Dz); dxyVsEta_pt1->Fill(eta, Dxy); dzVsEta_pt1->Fill(eta, Dz); + dxyVsEtaVsPhi_pt1->Fill(eta, phi, Dxy); + dzVsEtaVsPhi_pt1->Fill(eta, phi, Dz); if (pt < 10.) continue; @@ -441,6 +514,8 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { dzVsPhi_pt10->Fill(phi, Dz); dxyVsEta_pt10->Fill(eta, Dxy); dzVsEta_pt10->Fill(eta, Dz); + dxyVsEtaVsPhi_pt10->Fill(eta, phi, Dxy); + dzVsEtaVsPhi_pt10->Fill(eta, phi, Dz); } ntracks->Fill(float(nTracks)); sumpt->Fill(sumPT); diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h index 7053cdc855986..ffd3a9e53a97f 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h @@ -50,6 +50,7 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { std::string TopFolderName_; std::string AlignmentLabel_; int ndof_; + bool useHPfoAlignmentPlots_; bool errorPrinted_; // the histos @@ -66,8 +67,10 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { MonitorElement *dxy, *dxy2, *dz, *dxyErr, *dzErr; MonitorElement *dxyVsPhi_pt1, *dzVsPhi_pt1; MonitorElement *dxyVsEta_pt1, *dzVsEta_pt1; + MonitorElement *dxyVsEtaVsPhi_pt1, *dzVsEtaVsPhi_pt1; MonitorElement *dxyVsPhi_pt10, *dzVsPhi_pt10; MonitorElement *dxyVsEta_pt10, *dzVsEta_pt10; + MonitorElement *dxyVsEtaVsPhi_pt10, *dzVsEtaVsPhi_pt10; }; #endif diff --git a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py index f8de48cbe8ec9..2e65214b50493 100644 --- a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py +++ b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py @@ -7,6 +7,7 @@ AlignmentLabel = cms.string("Alignment"), vertexLabel = cms.InputTag("offlinePrimaryVertices"), beamSpotLabel = cms.InputTag("offlineBeamSpot"), + useHPforAlignmentPlots = cms.bool(True), ndof = cms.int32( 4 ), TkSizeBin = cms.int32( 100 ), TkSizeMax = cms.double(499.5), @@ -20,9 +21,11 @@ DzMax = cms.double(2000.0), DzMin = cms.double(-2000.0), PhiBin = cms.int32(32), + PhiBin2D = cms.int32(12), PhiMax = cms.double(3.141592654), PhiMin = cms.double(-3.141592654), EtaBin = cms.int32(26), + EtaBin2D = cms.int32(8), EtaMax = cms.double(2.5), EtaMin = cms.double(-2.5) ) @@ -31,5 +34,5 @@ from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase1Pixel.toModify(pvMonitor, EtaBin=31, EtaMin=-3.0, EtaMax=3.0) -phase2_tracker.toModify(pvMonitor, EtaBin=41, EtaMin=-4.0, EtaMax=4.0) +phase2_tracker.toModify(pvMonitor, EtaBin=41, EtaBin2D=9, EtaMin=-4.0, EtaMax=4.0) diff --git a/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py b/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py index ef0d64652b80c..930879f7b3b3c 100644 --- a/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py +++ b/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py @@ -9,19 +9,23 @@ hltPixelVerticesMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltPixelVertices") hltPixelVerticesMonitoring.vertexLabel = cms.InputTag("hltPixelVertices") hltPixelVerticesMonitoring.ndof = cms.int32(1) +hltPixelVerticesMonitoring.useHPforAlignmentPlots = cms.bool(False) hltTrimmedPixelVerticesMonitoring = hltVerticesMonitoring.clone() hltTrimmedPixelVerticesMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltTrimmedPixelVertices") hltTrimmedPixelVerticesMonitoring.vertexLabel = cms.InputTag("hltTrimmedPixelVertices") hltTrimmedPixelVerticesMonitoring.ndof = cms.int32(1) +hltTrimmedPixelVerticesMonitoring.useHPforAlignmentPlots = cms.bool(False) hltVerticesPFFilterMonitoring = hltVerticesMonitoring.clone() hltVerticesPFFilterMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltVerticesPFFilter") hltVerticesPFFilterMonitoring.vertexLabel = cms.InputTag("hltVerticesPFFilter") +hltVerticesPFFilterMonitoring.useHPforAlignmentPlots = cms.bool(False) hltVerticesL3PFBjetsMonitoring = hltVerticesMonitoring.clone() hltVerticesL3PFBjetsMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltVerticesL3PFBjets") hltVerticesL3PFBjetsMonitoring.vertexLabel = cms.InputTag("hltVerticesL3PFBjets") +hltVerticesL3PFBjetsMonitoring.useHPforAlignmentPlots = cms.bool(False) vertexingMonitorHLT = cms.Sequence( hltPixelVerticesMonitoring diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py index ccdfee07c0e35..414873fa500db 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py @@ -15,6 +15,25 @@ ) ) +hltSiPixelPhase1TrackClustersOnTrackCorrCharge = hltDefaultHistoTrack.clone( + name = "charge_cor", + title = "Tempalte Corrected Cluster Charge (OnTrack)", + range_min = 0, range_max = 200e3, range_nbins = 200, + xlabel = "Charge (electrons)", + enabled=False, + specs = VPSet( + hltStandardSpecifications1D + ) +) + +hltSiPixelPhase1TrackTemplateCorr = hltSiPixelPhase1TrackClustersOnTrackCorrCharge.clone( + name = "template_corr", + title = "Tempalte Correction", + range_min = 0, range_max = 20, range_nbins = 200, + xlabel = "A.U.", + enabled=False +) + hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( name = "bigpixelcharge", title = "Corrected Big Pixel Charge (OnTrack)", @@ -309,6 +328,38 @@ title = "Corrected Cluster Charge (OnTrack) inner ladders" ) + +hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter = hltDefaultHistoTrack.clone( + name = "chargeOuter_corr", + title = "Template Corrected Cluster Charge (OnTrack) outer ladders", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled = False, + specs = VPSet( + Specification().groupBy("PXBarrel/PXLayer").save() + ) +) + +hltSiPixelPhase1TrackClustersOnTrackCorrChargeInner = hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "chargeInner_corr", + title = "Template Corrected Cluster Charge (OnTrack) inner ladders", + enabled = False +) + +hltSiPixelPhase1TrackTemplateCorrOuter = hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "templateOuter_corr", + title = "Template Correction outer ladders", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U.", + enabled = False +) + +hltSiPixelPhase1TrackTemplateCorrInner = hltSiPixelPhase1TrackTemplateCorrOuter.clone( + name = "templateInner_corr", + title = "Template Correction inner ladders", + enabled = False +) + hltSiPixelPhase1TrackClustersOnTrackShapeOuter = hltDefaultHistoTrack.clone( enabled = False, name = "shapeFilterOuter", @@ -331,6 +382,8 @@ ### THE LIST DEFINED IN THE ENUM ### https://cmssdt.cern.ch/lxr/source/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc#0063 hltSiPixelPhase1TrackClustersOnTrackCharge, + hltSiPixelPhase1TrackClustersOnTrackCorrCharge, + hltSiPixelPhase1TrackTemplateCorr, hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge, hltSiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, hltSiPixelPhase1TrackClustersOnTrackSize, @@ -348,6 +401,10 @@ hltSiPixelPhase1ClustersSizeVsEtaOnTrackInner, hltSiPixelPhase1TrackClustersOnTrackChargeOuter, hltSiPixelPhase1TrackClustersOnTrackChargeInner, + hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter, + hltSiPixelPhase1TrackClustersOnTrackCorrChargeInner, + hltSiPixelPhase1TrackTemplateCorrOuter, + hltSiPixelPhase1TrackTemplateCorrInner, hltSiPixelPhase1TrackClustersOnTrackShapeOuter, hltSiPixelPhase1TrackClustersOnTrackShapeInner, diff --git a/DataFormats/CSCDigi/interface/CSCConstants.h b/DataFormats/CSCDigi/interface/CSCConstants.h index 58160a61896c8..e91e3bec88364 100644 --- a/DataFormats/CSCDigi/interface/CSCConstants.h +++ b/DataFormats/CSCDigi/interface/CSCConstants.h @@ -22,6 +22,15 @@ class CSCConstants { NUM_CFEBS_ME11_UNGANGED = NUM_CFEBS_ME1A_UNGANGED + NUM_CFEBS_ME1B, // 7 // Run-2: Maximum number of cathode front-end boards MAX_CFEBS_RUN2 = NUM_CFEBS_ME11_UNGANGED, // 7 + // CFEBS for the rest of the system + NUM_CFEBS_ME12 = 5, + NUM_CFEBS_ME13 = 4, + NUM_CFEBS_ME21 = 5, + NUM_CFEBS_ME22 = 5, + NUM_CFEBS_ME31 = 5, + NUM_CFEBS_ME32 = 5, + NUM_CFEBS_ME41 = 5, + NUM_CFEBS_ME42 = 5 }; enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; @@ -70,10 +79,21 @@ class CSCConstants { NUM_HALF_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 32 NUM_HALF_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 96 NUM_HALF_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_HALF_STRIPS_PER_CFEB, // 128 + NUM_HALF_STRIPS_ME11_GANGED = NUM_CFEBS_ME11_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME11_UNGANGED = NUM_CFEBS_ME11_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 224 // max halfstrip number in ME1/1 chambers MAX_HALF_STRIP_ME1A_GANGED = NUM_HALF_STRIPS_ME1A_GANGED - 1, // 31 MAX_HALF_STRIP_ME1A_UNGANGED = NUM_HALF_STRIPS_ME1A_UNGANGED - 1, // 95 MAX_HALF_STRIP_ME1B = NUM_HALF_STRIPS_ME1B - 1, // 127 + // half-strips for the rest of the system + NUM_HALF_STRIPS_ME12 = NUM_CFEBS_ME12 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME13 = NUM_CFEBS_ME13 * NUM_HALF_STRIPS_PER_CFEB, // 128 + NUM_HALF_STRIPS_ME21 = NUM_CFEBS_ME21 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME22 = NUM_CFEBS_ME22 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME31 = NUM_CFEBS_ME31 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME32 = NUM_CFEBS_ME32 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME41 = NUM_CFEBS_ME41 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME42 = NUM_CFEBS_ME42 * NUM_HALF_STRIPS_PER_CFEB, // 160 }; // CSCs have 6 layers. The key (reference) layer is the third layer @@ -109,6 +129,12 @@ class CSCConstants { MAX_LCTS_PER_CSC = 2, // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector MAX_LCTS_PER_MPC = 18, + /* + An EMTF sector processor receives LCTs from 5 MPCS + or 45 chambers when not considering overlapping EMTF SPs + 18 CSCs in ME1; 9 x 3 CSCs in ME2,3,4 + */ + MAX_CSCS_PER_EMTF_SP_NO_OVERLAP = 45, // Reference BX for LCTs in simulation and firmware LCT_CENTRAL_BX = 8, /* diff --git a/DataFormats/Common/interface/ProductData.h b/DataFormats/Common/interface/ProductData.h index 63aee33f21edc..9ec7867298def 100644 --- a/DataFormats/Common/interface/ProductData.h +++ b/DataFormats/Common/interface/ProductData.h @@ -53,7 +53,7 @@ namespace edm { void unsafe_resetProductData() const { wrapper_.reset(); } - void setProvenance(ProductProvenanceRetriever const* provRetriever) { prov_.setStore(provRetriever); } + void setProvenance(ProductProvenanceLookup const* provRetriever) { prov_.setStore(provRetriever); } void setProductID(ProductID const& pid) { prov_.setProductID(pid); } diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index ece599d1c9926..2067ac2151d80 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -54,7 +54,7 @@ namespace ticl { inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } std::vector &vertices() { return vertices_; } - std::vector &vertex_multiplicity() { return vertex_multiplicity_; } + std::vector &vertex_multiplicity() { return vertex_multiplicity_; } std::vector > &edges() { return edges_; } inline void setSeed(edm::ProductID pid, int index) { seedID_ = pid; @@ -119,8 +119,8 @@ namespace ticl { inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } inline const std::vector &vertices() const { return vertices_; } inline const unsigned int vertices(int index) const { return vertices_[index]; } - inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } - inline const uint8_t vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } + inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } + inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } inline const std::vector > &edges() const { return edges_; } inline const edm::ProductID &seedID() const { return seedID_; } inline const int seedIndex() const { return seedIndex_; } @@ -153,7 +153,7 @@ namespace ticl { // The vertices of the DAG are the indices of the // 2d objects in the global collection std::vector vertices_; - std::vector vertex_multiplicity_; + std::vector vertex_multiplicity_; // The edges connect two vertices together in a directed doublet // ATTENTION: order matters! diff --git a/DataFormats/HGCalReco/src/classes_def.xml b/DataFormats/HGCalReco/src/classes_def.xml index e105e092985f8..9ac5b29b4f2e2 100644 --- a/DataFormats/HGCalReco/src/classes_def.xml +++ b/DataFormats/HGCalReco/src/classes_def.xml @@ -1,6 +1,7 @@ - + + diff --git a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h index d25ad2f686aca..5be863ec51179 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h @@ -20,7 +20,7 @@ namespace l1tp2 { inline float hovere() const { return hovere_; }; inline float isolation() const { return iso_; }; inline float puCorrPt() const { return puCorrPt_; }; - std::vector>& associated_l1EGs() { return associated_l1EGs_; }; + const std::vector>& associated_l1EGs() const { return associated_l1EGs_; }; void setExperimentalParams(const std::map& params) { experimentalParams_ = params; }; void setAssociated_l1EGs(const std::vector> l1EGs) { associated_l1EGs_ = l1EGs; }; diff --git a/DataFormats/L1TParticleFlow/BuildFile.xml b/DataFormats/L1TParticleFlow/BuildFile.xml index c647cee335b3c..791c2fadaf728 100644 --- a/DataFormats/L1TParticleFlow/BuildFile.xml +++ b/DataFormats/L1TParticleFlow/BuildFile.xml @@ -5,6 +5,7 @@ + diff --git a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h index 3fbc7f64fd59b..68b3e8c43d028 100644 --- a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h +++ b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h @@ -2,7 +2,7 @@ #define DataFormats_L1TParticleFlow_HPSPFTau_H #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateRef, l1t::PFCandidateRefVector -#include "DataFormats/L1TParticleFlow/interface/PFJet.h" // l1t::PFJet, l1t::PFJetCollection, l1t::PFJetRef +#include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/Candidate/interface/LeafCandidate.h" // reco::LeafCandidate #include "DataFormats/Candidate/interface/Particle.h" // reco::Particle::LorentzVector #include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" @@ -21,10 +21,10 @@ namespace l1t { /// accessor functions for reco level quantities bool isChargedPFCandSeeded() const { return seedChargedPFCand_.isNonnull(); } - bool isPFJetSeeded() const { return seedPFJet_.isNonnull(); } + bool isJetSeeded() const { return seedJet_.isNonnull(); } const l1t::PFCandidateRef& seedChargedPFCand() const { return seedChargedPFCand_; } - const l1t::PFJetRef& seedPFJet() const { return seedPFJet_; } + const reco::CaloJetRef& seedJet() const { return seedJet_; } const l1t::PFCandidateRef& leadChargedPFCand() const { return leadChargedPFCand_; } const l1t::PFCandidateRefVector& signalAllL1PFCandidates() const { return signalAllL1PFCandidates_; } @@ -57,9 +57,9 @@ namespace l1t { enum Kind { kUndefined, kOneProng0Pi0, kOneProng1Pi0, kThreeProng0Pi0, kThreeProng1Pi0 }; Kind tauType() const { return tauType_; } - const reco::Particle::LorentzVector& strip_p4() const { return strip_p4_; } + const reco::Particle::LorentzVector& stripP4() const { return stripP4_; } - float sumAllL1PFCandidates_pt() const { return sumAllL1PFCandidates_pt_; } + float sumAllL1PFCandidatesPt() const { return sumAllL1PFCandidatesPt_; } float signalConeSize() const { return signalConeSize_; } float isolationConeSize() const { return signalConeSize_; } @@ -67,7 +67,6 @@ namespace l1t { float sumNeutralIso() const { return sumNeutralIso_; } float sumCombinedIso() const { return sumCombinedIso_; } float sumChargedIsoPileup() const { return sumChargedIsoPileup_; } - float rhoCorr() const { return rhoCorr_; } bool passTightIso() const { return passTightIso_; } bool passMediumIso() const { return passMediumIso_; } @@ -79,9 +78,75 @@ namespace l1t { bool passLooseRelIso() const { return passLooseRelIso_; } bool passVLooseRelIso() const { return passVLooseRelIso_; } + void setSeedChargedPFCand(l1t::PFCandidateRef seedChargedPFCand) { seedChargedPFCand_ = seedChargedPFCand; } + void setSeedJet(reco::CaloJetRef seedJet) { seedJet_ = seedJet; } + void setLeadChargedPFCand(l1t::PFCandidateRef leadChargedPFCand) { leadChargedPFCand_ = leadChargedPFCand; } + + void setSignalAllL1PFCandidates(l1t::PFCandidateRefVector signalAllL1PFCandidates) { + signalAllL1PFCandidates_ = signalAllL1PFCandidates; + } + void setSignalChargedHadrons(l1t::PFCandidateRefVector signalChargedHadrons) { + signalChargedHadrons_ = signalChargedHadrons; + } + void setSignalElectrons(l1t::PFCandidateRefVector signalElectrons) { signalElectrons_ = signalElectrons; } + void setSignalNeutralHadrons(l1t::PFCandidateRefVector signalNeutralHadrons) { + signalNeutralHadrons_ = signalNeutralHadrons; + } + void setSignalPhotons(l1t::PFCandidateRefVector signalPhotons) { signalPhotons_ = signalPhotons; } + void setSignalMuons(l1t::PFCandidateRefVector signalMuons) { signalMuons_ = signalMuons; } + + void setStripAllL1PFCandidates(l1t::PFCandidateRefVector stripAllL1PFCandidates) { + stripAllL1PFCandidates_ = stripAllL1PFCandidates; + } + void setStripElectrons(l1t::PFCandidateRefVector stripElectrons) { stripElectrons_ = stripElectrons; } + void setStripPhotons(l1t::PFCandidateRefVector stripPhotons) { stripPhotons_ = stripPhotons; } + + void setIsoAllL1PFCandidates(l1t::PFCandidateRefVector isoAllL1PFCandidates) { + isoAllL1PFCandidates_ = isoAllL1PFCandidates; + } + void setIsoChargedHadrons(l1t::PFCandidateRefVector isoChargedHadrons) { isoChargedHadrons_ = isoChargedHadrons; } + void setIsoElectrons(l1t::PFCandidateRefVector isoElectrons) { isoElectrons_ = isoElectrons; } + void setIsoNeutralHadrons(l1t::PFCandidateRefVector isoNeutralHadrons) { isoNeutralHadrons_ = isoNeutralHadrons; } + void setIsoPhotons(l1t::PFCandidateRefVector isoPhotons) { isoPhotons_ = isoPhotons; } + void setIsoMuons(l1t::PFCandidateRefVector isoMuons) { isoMuons_ = isoMuons; } + + void setSumAllL1PFCandidates(l1t::PFCandidateRefVector sumAllL1PFCandidates) { + sumAllL1PFCandidates_ = sumAllL1PFCandidates; + } + void setSumChargedHadrons(l1t::PFCandidateRefVector sumChargedHadrons) { sumChargedHadrons_ = sumChargedHadrons; } + void setSumElectrons(l1t::PFCandidateRefVector sumElectrons) { sumElectrons_ = sumElectrons; } + void setSumNeutralHadrons(l1t::PFCandidateRefVector sumNeutralHadrons) { sumNeutralHadrons_ = sumNeutralHadrons; } + void setSumPhotons(l1t::PFCandidateRefVector sumPhotons) { sumPhotons_ = sumPhotons; } + void setSumMuons(l1t::PFCandidateRefVector sumMuons) { sumMuons_ = sumMuons; } + + void setPrimaryVertex(l1t::TkPrimaryVertexRef primaryVertex) { primaryVertex_ = primaryVertex; } + + void setTauType(Kind tauType) { tauType_ = tauType; } + + void setStripP4(reco::Particle::LorentzVector& stripP4) { stripP4_ = stripP4; } + + void setSumAllL1PFCandidatesPt(float sumAllL1PFCandidatesPt) { sumAllL1PFCandidatesPt_ = sumAllL1PFCandidatesPt; } + void setSignalConeSize(float signalConeSize) { signalConeSize_ = signalConeSize; } + void setisolationConeSize(float isolationConeSize) { signalConeSize_ = isolationConeSize; } + + void setSumChargedIso(float sumChargedIso) { sumChargedIso_ = sumChargedIso; } + void setSumNeutralIso(float sumNeutralIso) { sumNeutralIso_ = sumNeutralIso; } + void setSumCombinedIso(float sumCombinedIso) { sumCombinedIso_ = sumCombinedIso; } + void setSumChargedIsoPileup(float sumChargedIsoPileup) { sumChargedIsoPileup_ = sumChargedIsoPileup; } + + void setPassTightIso(bool passTightIso) { passTightIso_ = passTightIso; } + void setPassMediumIso(bool passMediumIso) { passMediumIso_ = passMediumIso; } + void setPassLooseIso(bool passLooseIso) { passLooseIso_ = passLooseIso; } + void setPassVLooseIso(bool passVLooseIso) { passVLooseIso_ = passVLooseIso; } + + void setPassTightRelIso(bool passTightRelIso) { passTightRelIso_ = passTightRelIso; } + void setPassMediumRelIso(bool passMediumRelIso) { passMediumRelIso_ = passMediumRelIso; } + void setPassLooseRelIso(bool passLooseRelIso) { passLooseRelIso_ = passLooseRelIso; } + void setPassVLooseRelIso(bool passVLooseRelIso) { passVLooseRelIso_ = passVLooseRelIso; } + private: l1t::PFCandidateRef seedChargedPFCand_; - l1t::PFJetRef seedPFJet_; + reco::CaloJetRef seedJet_; l1t::PFCandidateRef leadChargedPFCand_; l1t::PFCandidateRefVector signalAllL1PFCandidates_; @@ -112,9 +177,9 @@ namespace l1t { l1t::TkPrimaryVertexRef primaryVertex_; Kind tauType_; - reco::Particle::LorentzVector strip_p4_; + reco::Particle::LorentzVector stripP4_; - float sumAllL1PFCandidates_pt_; + float sumAllL1PFCandidatesPt_; float signalConeSize_; float isolationConeSize_; @@ -122,7 +187,6 @@ namespace l1t { float sumNeutralIso_; float sumCombinedIso_; float sumChargedIsoPileup_; // charged PFCands failing dz cut (maybe useful to correct neutral isolation for pile-up contributions by applying delta-beta corrections) - float rhoCorr_; // rho correction (maybe useful for applying pile-up corrections to neutral isolation) bool passTightIso_; bool passMediumIso_; @@ -135,11 +199,12 @@ namespace l1t { bool passVLooseRelIso_; }; - void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex); - void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertex_z); } // namespace l1t /// print to stream std::ostream& operator<<(std::ostream& os, const l1t::HPSPFTau& l1PFTau); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertexZ); + #endif diff --git a/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h b/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h index 6d9af0e32ed98..d7392819a7fcc 100644 --- a/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h +++ b/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h @@ -1,14 +1,9 @@ #ifndef DataFormats_L1TParticleFlow_HPSPFTauFwd_H #define DataFormats_L1TParticleFlow_HPSPFTauFwd_H -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" namespace l1t { - - class HPSPFTau; - typedef std::vector HPSPFTauCollection; typedef edm::Ref HPSPFTauRef; diff --git a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc index 3eb8f7526e178..a346c1b963943 100644 --- a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc +++ b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc @@ -8,7 +8,6 @@ l1t::HPSPFTau::HPSPFTau() sumNeutralIso_(0.), sumCombinedIso_(0.), sumChargedIsoPileup_(0.), - rhoCorr_(0.), passTightIso_(false), passMediumIso_(false), passLooseIso_(false), @@ -34,8 +33,8 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { os << "seed:"; if (l1PFTau.isChargedPFCandSeeded()) { os << " chargedPFCand"; - } else if (l1PFTau.isPFJetSeeded()) { - os << " PFJet"; + } else if (l1PFTau.isJetSeeded()) { + os << " CaloJet"; } else { cms::Exception ex("InconsistentTau"); ex.addContext("Calling HPSPFTau::operator <<"); @@ -51,7 +50,7 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { for (const auto& l1PFCand : l1PFTau.stripAllL1PFCandidates()) { printPFCand(os, *l1PFCand, l1PFTau.primaryVertex()); } - os << "strip pT = " << l1PFTau.strip_p4().pt() << std::endl; + os << "strip pT = " << l1PFTau.stripP4().pt() << std::endl; os << "isolationPFCands:" << std::endl; for (const auto& l1PFCand : l1PFTau.isoAllL1PFCandidates()) { printPFCand(os, *l1PFCand, l1PFTau.primaryVertex()); @@ -61,30 +60,30 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { return os; } -void l1t::printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex) { - float primaryVertex_z = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.; - l1t::printPFCand(os, l1PFCand, primaryVertex_z); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex) { + float primaryVertexZ = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.; + printPFCand(os, l1PFCand, primaryVertexZ); } -void l1t::printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertex_z) { - std::string type_string; +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertexZ) { + std::string typeString; if (l1PFCand.id() == l1t::PFCandidate::ChargedHadron) - type_string = "PFChargedHadron"; + typeString = "PFChargedHadron"; else if (l1PFCand.id() == l1t::PFCandidate::Electron) - type_string = "PFElectron"; + typeString = "PFElectron"; else if (l1PFCand.id() == l1t::PFCandidate::NeutralHadron) - type_string = "PFNeutralHadron"; + typeString = "PFNeutralHadron"; else if (l1PFCand.id() == l1t::PFCandidate::Photon) - type_string = "PFPhoton"; + typeString = "PFPhoton"; else if (l1PFCand.id() == l1t::PFCandidate::Muon) - type_string = "PFMuon"; + typeString = "PFMuon"; else - type_string = "N/A"; - os << " " << type_string << " with pT = " << l1PFCand.pt() << ", eta = " << l1PFCand.eta() + typeString = "N/A"; + os << " " << typeString << " with pT = " << l1PFCand.pt() << ", eta = " << l1PFCand.eta() << ", phi = " << l1PFCand.phi() << "," << " mass = " << l1PFCand.mass() << ", charge = " << l1PFCand.charge(); - if (l1PFCand.charge() != 0 && primaryVertex_z != 0.) { - os << " (dz = " << std::fabs(l1PFCand.pfTrack()->vertex().z() - primaryVertex_z) << ")"; + if (l1PFCand.charge() != 0 && primaryVertexZ != 0.) { + os << " (dz = " << std::fabs(l1PFCand.pfTrack()->vertex().z() - primaryVertexZ) << ")"; } os << std::endl; } diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index 21831204808af..112f0566c7b84 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -44,13 +44,15 @@ - - + + + - + + diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index f6ea410767e7a..fe8d9ea50fdb5 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -56,6 +56,7 @@ + diff --git a/DataFormats/Math/interface/CMSUnits.h b/DataFormats/Math/interface/CMSUnits.h index 7d10ac9f49985..0c3fea27c92f7 100644 --- a/DataFormats/Math/interface/CMSUnits.h +++ b/DataFormats/Math/interface/CMSUnits.h @@ -18,6 +18,7 @@ namespace cms_units { using angle_units::operators::operator""_deg; using angle_units::operators::operator""_pi; using angle_units::operators::operator""_rad; + using angle_units::operators::almostEqual; using angle_units::operators::convertDegToRad; using angle_units::operators::convertRadToDeg; diff --git a/DataFormats/Math/interface/GeantUnits.h b/DataFormats/Math/interface/GeantUnits.h index 382c895e9e960..ec627d0c51a5c 100644 --- a/DataFormats/Math/interface/GeantUnits.h +++ b/DataFormats/Math/interface/GeantUnits.h @@ -11,9 +11,9 @@ namespace geant_units { using angle_units::piRadians; // Needed by files the include this file - constexpr long double joule(6.24150e+12); - constexpr long double seconds(1.e+9); - constexpr long double nanoseconds(1.); + constexpr double joule(6.24150e+12); + constexpr double seconds(1.e+9); + constexpr double nanoseconds(1.); namespace operators { @@ -23,40 +23,41 @@ namespace geant_units { using angle_units::operators::operator""_deg; using angle_units::operators::operator""_pi; using angle_units::operators::operator""_rad; + using angle_units::operators::almostEqual; using angle_units::operators::convertDegToRad; using angle_units::operators::convertRadToDeg; // Length - constexpr long double operator"" _mm(long double length) { return length * 1.; } - constexpr long double operator"" _cm(long double length) { return length * 10.; } - constexpr long double operator"" _m(long double length) { return length * 1000.; } - constexpr long double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; } - constexpr long double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; } - constexpr long double operator"" _mm(unsigned long long int length) { return length * 1; } - constexpr long double operator"" _cm(unsigned long long int length) { return length * 10; } + constexpr double operator"" _mm(long double length) { return length * 1.; } + constexpr double operator"" _cm(long double length) { return length * 10.; } + constexpr double operator"" _m(long double length) { return length * 1000.; } + constexpr double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; } + constexpr double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; } + constexpr double operator"" _mm(unsigned long long int length) { return length * 1; } + constexpr double operator"" _cm(unsigned long long int length) { return length * 10; } // Time - constexpr long double operator"" _s(long double x) { return x * seconds; } - constexpr long double operator"" _ns(long double x) { return x * nanoseconds; } + constexpr double operator"" _s(long double x) { return x * seconds; } + constexpr double operator"" _ns(long double x) { return x * nanoseconds; } // Energy - constexpr long double operator"" _MeV(long double energy) { return energy * 1.; } - constexpr long double operator"" _eV(long double energy) { return energy * 1.e-6_MeV; } - constexpr long double operator"" _TeV(long double energy) { return energy * 1.e6_MeV; } - constexpr long double operator"" _GeV(long double energy) { return energy * 1000._MeV; } + constexpr double operator"" _MeV(long double energy) { return energy * 1.; } + constexpr double operator"" _eV(long double energy) { return energy * 1.e-6_MeV; } + constexpr double operator"" _TeV(long double energy) { return energy * 1.e6_MeV; } + constexpr double operator"" _GeV(long double energy) { return energy * 1000._MeV; } // Mass - constexpr long double operator"" _kg(long double mass) { + constexpr double operator"" _kg(long double mass) { return mass * (1._eV / 1.602176487e-19) * 1._s * 1._s / (1._m * 1._m); } - constexpr long double operator"" _g(long double mass) { return mass * 1.e-3_kg; } - constexpr long double operator"" _mg(long double mass) { return mass * 1.e-3_g; } - constexpr long double operator"" _mole(long double mass) { return mass * 1.; } + constexpr double operator"" _g(long double mass) { return mass * 1.e-3_kg; } + constexpr double operator"" _mg(long double mass) { return mass * 1.e-3_g; } + constexpr double operator"" _mole(long double mass) { return mass * 1.; } // Material properties - constexpr long double operator"" _mg_per_cm3(long double density) { return density * 1._mg / 1._cm3; } - constexpr long double operator"" _g_per_cm3(long double density) { return density * 1._g / 1._cm3; } - constexpr long double operator"" _g_per_mole(long double mass) { return mass * 1._g / 1._mole; } + constexpr double operator"" _mg_per_cm3(long double density) { return density * 1._mg / 1._cm3; } + constexpr double operator"" _g_per_cm3(long double density) { return density * 1._g / 1._cm3; } + constexpr double operator"" _g_per_mole(long double mass) { return mass * 1._g / 1._mole; } template inline constexpr NumType convertMmToCm(NumType millimeters) // Millimeters -> centimeters @@ -96,7 +97,7 @@ namespace geant_units { // Convert Geant units to desired units template - inline constexpr NumType convertUnitsTo(long double desiredUnits, NumType val) { + inline constexpr NumType convertUnitsTo(double desiredUnits, NumType val) { return (val / desiredUnits); } } // namespace operators diff --git a/DataFormats/Math/interface/angle_units.h b/DataFormats/Math/interface/angle_units.h index 3895afbce17c7..dce9138e9e94f 100644 --- a/DataFormats/Math/interface/angle_units.h +++ b/DataFormats/Math/interface/angle_units.h @@ -5,17 +5,17 @@ namespace angle_units { - constexpr long double piRadians(M_PIl); // M_PIl is long double version of pi - constexpr long double degPerRad = 180. / piRadians; // Degrees per radian + constexpr double piRadians(M_PI); + constexpr double degPerRad = 180. / piRadians; // Degrees per radian namespace operators { // Angle - constexpr long double operator"" _pi(long double x) { return x * piRadians; } - constexpr long double operator"" _pi(unsigned long long int x) { return x * piRadians; } - constexpr long double operator"" _deg(long double deg) { return deg / degPerRad; } - constexpr long double operator"" _deg(unsigned long long int deg) { return deg / degPerRad; } - constexpr long double operator"" _rad(long double rad) { return rad * 1.; } + constexpr double operator"" _pi(long double x) { return x * piRadians; } + constexpr double operator"" _pi(unsigned long long int x) { return x * piRadians; } + constexpr double operator"" _deg(long double deg) { return deg / degPerRad; } + constexpr double operator"" _deg(unsigned long long int deg) { return deg / degPerRad; } + constexpr double operator"" _rad(long double rad) { return rad * 1.; } template inline constexpr NumType convertRadToDeg(NumType radians) // Radians -> degrees @@ -24,10 +24,19 @@ namespace angle_units { } template - inline constexpr long double convertDegToRad(NumType degrees) // Degrees -> radians + inline constexpr double convertDegToRad(NumType degrees) // Degrees -> radians { return (degrees / degPerRad); } + + template + typename std::enable_if::is_integer, bool>::type almostEqual(NumType x, + NumType y, + int ulp) { + return std::fabs(x - y) <= std::numeric_limits::epsilon() * std::fabs(x + y) * ulp || + std::fabs(x - y) < std::numeric_limits::min(); + } + } // namespace operators } // namespace angle_units diff --git a/DataFormats/Provenance/BuildFile.xml b/DataFormats/Provenance/BuildFile.xml index f7e648f4e31f5..35d18bc3e928e 100644 --- a/DataFormats/Provenance/BuildFile.xml +++ b/DataFormats/Provenance/BuildFile.xml @@ -1,6 +1,5 @@ - diff --git a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h b/DataFormats/Provenance/interface/ProductProvenanceLookup.h similarity index 55% rename from DataFormats/Provenance/interface/ProductProvenanceRetriever.h rename to DataFormats/Provenance/interface/ProductProvenanceLookup.h index 61942d26736bb..5b1311cad7cb9 100644 --- a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h +++ b/DataFormats/Provenance/interface/ProductProvenanceLookup.h @@ -1,15 +1,13 @@ -#ifndef DataFormats_Provenance_BranchMapper_h -#define DataFormats_Provenance_BranchMapper_h +#ifndef DataFormats_Provenance_ProductProvenanceLookup_h +#define DataFormats_Provenance_ProductProvenanceLookup_h /*---------------------------------------------------------------------- -ProductProvenanceRetriever: Manages the per event/lumi/run per product provenance. +ProductProvenanceLookup: Gives access to the per event/lumi/run per product provenance. ----------------------------------------------------------------------*/ #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProcessHistoryID.h" -#include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/propagate_const.h" #include "FWCore/Utilities/interface/Likely.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" @@ -18,66 +16,25 @@ ProductProvenanceRetriever: Manages the per event/lumi/run per product provenanc #include #include #include -#include /* - ProductProvenanceRetriever + ProductProvenanceLookup */ namespace edm { - class ProvenanceReaderBase; - class ModuleCallingContext; class ProductRegistry; - struct ProductProvenanceHasher { - size_t operator()(ProductProvenance const& tid) const { return tid.branchID().id(); } - }; - - struct ProductProvenanceEqual { - //The default operator== for ProductProvenance does not work for this case - // Since (ab)==false does not mean a==b for the operators - // defined for ProductProvenance - bool operator()(ProductProvenance const& iLHS, ProductProvenance const iRHS) const { - return iLHS.branchID().id() == iRHS.branchID().id(); - } - }; - - class ProvenanceReaderBase { - public: - ProvenanceReaderBase() {} - virtual ~ProvenanceReaderBase(); - virtual std::set readProvenance(unsigned int transitionIndex) const = 0; - virtual void readProvenanceAsync(WaitingTaskHolder task, - ModuleCallingContext const* moduleCallingContext, - unsigned int transitionIndex, - std::atomic*>& writeTo) const = 0; - }; - - class ProductProvenanceRetriever { + class ProductProvenanceLookup { public: - explicit ProductProvenanceRetriever(unsigned int iTransitionIndex); - ProductProvenanceRetriever(unsigned int iTransitionIndex, edm::ProductRegistry const&); - explicit ProductProvenanceRetriever(std::unique_ptr reader); - - ProductProvenanceRetriever& operator=(ProductProvenanceRetriever const&) = delete; + ProductProvenanceLookup(); + explicit ProductProvenanceLookup(edm::ProductRegistry const&); + virtual ~ProductProvenanceLookup(); - ~ProductProvenanceRetriever(); + ProductProvenanceLookup& operator=(ProductProvenanceLookup const&) = delete; ProductProvenance const* branchIDToProvenance(BranchID const& bid) const; - - ProductProvenance const* branchIDToProvenanceForProducedOnly(BranchID const& bid) const; - void insertIntoSet(ProductProvenance provenanceProduct) const; - - void mergeProvenanceRetrievers(std::shared_ptr other); - - void mergeParentProcessRetriever(ProductProvenanceRetriever const& provRetriever); - - void deepCopy(ProductProvenanceRetriever const&); - - void reset(); - - void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const* moduleCallingContext) const; + ProductProvenance const* branchIDToProvenanceForProducedOnly(BranchID const& bid) const; void update(edm::ProductRegistry const&); @@ -133,18 +90,16 @@ namespace edm { mutable std::atomic isParentageSet_; }; - private: - void readProvenance() const; - void setTransitionIndex(unsigned int transitionIndex) { transitionIndex_ = transitionIndex; } - void setupEntryInfoSet(edm::ProductRegistry const&); + protected: + virtual std::unique_ptr> readProvenance() const = 0; + virtual const ProductProvenanceLookup* nextRetriever() const = 0; std::vector entryInfoSet_; mutable std::atomic*> readEntryInfoSet_; - edm::propagate_const> nextRetriever_; - edm::propagate_const parentProcessRetriever_; - std::shared_ptr provenanceReader_; - unsigned int transitionIndex_; - }; + edm::propagate_const parentProcessRetriever_; + private: + void setupEntryInfoSet(edm::ProductRegistry const&); + }; } // namespace edm #endif diff --git a/DataFormats/Provenance/interface/Provenance.h b/DataFormats/Provenance/interface/Provenance.h index 0ef5a9d7ed53d..d14ee35ba1298 100644 --- a/DataFormats/Provenance/interface/Provenance.h +++ b/DataFormats/Provenance/interface/Provenance.h @@ -29,7 +29,7 @@ existence. namespace edm { class MergeableRunProductMetadataBase; class ProductProvenance; - class ProductProvenanceRetriever; + class ProductProvenanceLookup; class Provenance { public: @@ -57,7 +57,7 @@ namespace edm { std::string const& processName() const { return stable().processName(); } std::string const& productInstanceName() const { return stable().productInstanceName(); } std::string const& friendlyClassName() const { return stable().friendlyClassName(); } - ProductProvenanceRetriever const* store() const { return store_; } + ProductProvenanceLookup const* store() const { return store_; } std::set const& branchAliases() const { return stable().branchAliases(); } // Usually branchID() and originalBranchID() return exactly the same result. @@ -74,7 +74,7 @@ namespace edm { void write(std::ostream& os) const; - void setStore(ProductProvenanceRetriever const* store) { store_ = store; } + void setStore(ProductProvenanceLookup const* store) { store_ = store; } ProductID const& productID() const { return stable().productID(); } @@ -90,7 +90,7 @@ namespace edm { private: StableProvenance stableProvenance_; - ProductProvenanceRetriever const* store_; + ProductProvenanceLookup const* store_; MergeableRunProductMetadataBase const* mergeableRunProductMetadata_; }; diff --git a/DataFormats/Provenance/interface/ProvenanceFwd.h b/DataFormats/Provenance/interface/ProvenanceFwd.h index e17d4b4446107..942dcbf1924b1 100644 --- a/DataFormats/Provenance/interface/ProvenanceFwd.h +++ b/DataFormats/Provenance/interface/ProvenanceFwd.h @@ -25,7 +25,7 @@ namespace edm { class RunID; class StableProvenance; class Timestamp; - class ProductProvenanceRetriever; + class ProductProvenanceLookup; } // namespace edm namespace cms { diff --git a/DataFormats/Provenance/src/ProductProvenanceLookup.cc b/DataFormats/Provenance/src/ProductProvenanceLookup.cc new file mode 100644 index 0000000000000..366406e509aad --- /dev/null +++ b/DataFormats/Provenance/src/ProductProvenanceLookup.cc @@ -0,0 +1,115 @@ +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" +#include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "FWCore/Utilities/interface/EDMException.h" + +#include + +/* + ProductProvenanceLookup +*/ + +namespace edm { + ProductProvenanceLookup::ProductProvenanceLookup() + : entryInfoSet_(), readEntryInfoSet_(), parentProcessRetriever_(nullptr) {} + + ProductProvenanceLookup::ProductProvenanceLookup(edm::ProductRegistry const& iReg) + : entryInfoSet_(), readEntryInfoSet_(), parentProcessRetriever_(nullptr) { + setupEntryInfoSet(iReg); + } + + ProductProvenanceLookup::~ProductProvenanceLookup() { delete readEntryInfoSet_.load(); } + + void ProductProvenanceLookup::setupEntryInfoSet(edm::ProductRegistry const& iReg) { + std::set ids; + for (auto const& p : iReg.productList()) { + if (p.second.branchType() == edm::InEvent) { + if (p.second.produced() or p.second.isProvenanceSetOnRead()) { + ids.insert(p.second.branchID()); + } + } + } + entryInfoSet_.reserve(ids.size()); + for (auto const& b : ids) { + entryInfoSet_.emplace_back(b); + } + } + + void ProductProvenanceLookup::update(edm::ProductRegistry const& iReg) { + entryInfoSet_.clear(); + setupEntryInfoSet(iReg); + } + + void ProductProvenanceLookup::insertIntoSet(ProductProvenance entryInfo) const { + //NOTE:do not read provenance here because we only need the full + // provenance when someone tries to access it not when doing the insert + // doing the delay saves 20% of time when doing an analysis job + //readProvenance(); + auto itFound = + std::lower_bound(entryInfoSet_.begin(), + entryInfoSet_.end(), + entryInfo.branchID(), + [](auto const& iEntry, edm::BranchID const& iValue) { return iEntry.branchID() < iValue; }); + if UNLIKELY (itFound == entryInfoSet_.end() or itFound->branchID() != entryInfo.branchID()) { + throw edm::Exception(edm::errors::LogicError) << "ProductProvenanceLookup::insertIntoSet passed a BranchID " + << entryInfo.branchID().id() << " that has not been pre-registered"; + } + itFound->threadsafe_set(entryInfo.moveParentageID()); + } + + ProductProvenance const* ProductProvenanceLookup::branchIDToProvenance(BranchID const& bid) const { + auto itFound = std::lower_bound( + entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { + return iEntry.branchID() < iValue; + }); + if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { + if (auto p = itFound->productProvenance()) { + return p; + } + } + if (parentProcessRetriever_) { + return parentProcessRetriever_->branchIDToProvenance(bid); + } + //check in source + if (nullptr == readEntryInfoSet_.load()) { + auto readProv = readProvenance(); + std::set const* expected = nullptr; + if (readEntryInfoSet_.compare_exchange_strong(expected, readProv.get())) { + readProv.release(); + } + } + auto ptr = readEntryInfoSet_.load(); + if (ptr) { + ProductProvenance ei(bid); + auto itRead = ptr->find(ei); + if (itRead != ptr->end()) { + return &*itRead; + } + } + auto nr = nextRetriever(); + if (nr) { + return nr->branchIDToProvenance(bid); + } + return nullptr; + } + + ProductProvenance const* ProductProvenanceLookup::branchIDToProvenanceForProducedOnly(BranchID const& bid) const { + auto itFound = std::lower_bound( + entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { + return iEntry.branchID() < iValue; + }); + if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { + if (auto p = itFound->productProvenance()) { + return p; + } + } + if (parentProcessRetriever_) { + return parentProcessRetriever_->branchIDToProvenanceForProducedOnly(bid); + } + auto nr = nextRetriever(); + if (nr) { + return nr->branchIDToProvenanceForProducedOnly(bid); + } + return nullptr; + } + +} // namespace edm diff --git a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc b/DataFormats/Provenance/src/ProductProvenanceRetriever.cc deleted file mode 100644 index 6013a70b49370..0000000000000 --- a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc +++ /dev/null @@ -1,195 +0,0 @@ -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" -#include "DataFormats/Provenance/interface/ProductRegistry.h" -#include "FWCore/Utilities/interface/EDMException.h" - -#include -#include -#include - -/* - ProductProvenanceRetriever -*/ - -namespace edm { - ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex) - : entryInfoSet_(), - readEntryInfoSet_(), - nextRetriever_(), - parentProcessRetriever_(nullptr), - provenanceReader_(), - transitionIndex_(iTransitionIndex) {} - - ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex, - edm::ProductRegistry const& iReg) - : entryInfoSet_(), - readEntryInfoSet_(), - nextRetriever_(), - parentProcessRetriever_(nullptr), - provenanceReader_(), - transitionIndex_(iTransitionIndex) { - setupEntryInfoSet(iReg); - } - - ProductProvenanceRetriever::ProductProvenanceRetriever(std::unique_ptr reader) - : entryInfoSet_(), - readEntryInfoSet_(), - nextRetriever_(), - parentProcessRetriever_(nullptr), - provenanceReader_(reader.release()), - transitionIndex_(std::numeric_limits::max()) { - assert(provenanceReader_); - } - - ProductProvenanceRetriever::~ProductProvenanceRetriever() { delete readEntryInfoSet_.load(); } - - void ProductProvenanceRetriever::readProvenance() const { - if (nullptr == readEntryInfoSet_.load() && provenanceReader_) { - auto temp = - std::make_unique const>(provenanceReader_->readProvenance(transitionIndex_)); - std::set const* expected = nullptr; - if (readEntryInfoSet_.compare_exchange_strong(expected, temp.get())) { - temp.release(); - } - } - } - - void ProductProvenanceRetriever::setupEntryInfoSet(edm::ProductRegistry const& iReg) { - std::set ids; - for (auto const& p : iReg.productList()) { - if (p.second.branchType() == edm::InEvent) { - if (p.second.produced() or p.second.isProvenanceSetOnRead()) { - ids.insert(p.second.branchID()); - } - } - } - entryInfoSet_.reserve(ids.size()); - for (auto const& b : ids) { - entryInfoSet_.emplace_back(b); - } - } - - void ProductProvenanceRetriever::update(edm::ProductRegistry const& iReg) { - entryInfoSet_.clear(); - setupEntryInfoSet(iReg); - } - - void ProductProvenanceRetriever::readProvenanceAsync(WaitingTaskHolder task, - ModuleCallingContext const* moduleCallingContext) const { - if (provenanceReader_ and nullptr == readEntryInfoSet_.load()) { - provenanceReader_->readProvenanceAsync(task, moduleCallingContext, transitionIndex_, readEntryInfoSet_); - } - if (nextRetriever_) { - nextRetriever_->readProvenanceAsync(task, moduleCallingContext); - } - } - - void ProductProvenanceRetriever::deepCopy(ProductProvenanceRetriever const& iFrom) { - if (iFrom.readEntryInfoSet_) { - if (readEntryInfoSet_) { - delete readEntryInfoSet_.exchange(nullptr); - } - readEntryInfoSet_ = new std::set(*iFrom.readEntryInfoSet_); - } else { - if (readEntryInfoSet_) { - delete readEntryInfoSet_.load(); - readEntryInfoSet_ = nullptr; - } - } - assert(iFrom.entryInfoSet_.empty()); - provenanceReader_ = iFrom.provenanceReader_; - - if (iFrom.nextRetriever_) { - if (not nextRetriever_) { - nextRetriever_ = std::make_shared(transitionIndex_); - } - nextRetriever_->deepCopy(*(iFrom.nextRetriever_)); - } - } - - void ProductProvenanceRetriever::reset() { - delete readEntryInfoSet_.load(); - readEntryInfoSet_ = nullptr; - for (auto& e : entryInfoSet_) { - e.resetParentage(); - } - if (nextRetriever_) { - nextRetriever_->reset(); - } - parentProcessRetriever_ = nullptr; - } - - void ProductProvenanceRetriever::insertIntoSet(ProductProvenance entryInfo) const { - //NOTE:do not read provenance here because we only need the full - // provenance when someone tries to access it not when doing the insert - // doing the delay saves 20% of time when doing an analysis job - //readProvenance(); - auto itFound = - std::lower_bound(entryInfoSet_.begin(), - entryInfoSet_.end(), - entryInfo.branchID(), - [](auto const& iEntry, edm::BranchID const& iValue) { return iEntry.branchID() < iValue; }); - if UNLIKELY (itFound == entryInfoSet_.end() or itFound->branchID() != entryInfo.branchID()) { - throw edm::Exception(edm::errors::LogicError) << "ProductProvenanceRetriever::insertIntoSet passed a BranchID " - << entryInfo.branchID().id() << " that has not been pre-registered"; - } - itFound->threadsafe_set(entryInfo.moveParentageID()); - } - - void ProductProvenanceRetriever::mergeProvenanceRetrievers(std::shared_ptr other) { - nextRetriever_ = other; - } - - void ProductProvenanceRetriever::mergeParentProcessRetriever(ProductProvenanceRetriever const& provRetriever) { - parentProcessRetriever_ = &provRetriever; - } - - ProductProvenance const* ProductProvenanceRetriever::branchIDToProvenance(BranchID const& bid) const { - auto itFound = std::lower_bound( - entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { - return iEntry.branchID() < iValue; - }); - if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { - if (auto p = itFound->productProvenance()) { - return p; - } - } - if (parentProcessRetriever_) { - return parentProcessRetriever_->branchIDToProvenance(bid); - } - //check in source - readProvenance(); - auto ptr = readEntryInfoSet_.load(); - if (ptr) { - ProductProvenance ei(bid); - auto itRead = ptr->find(ei); - if (itRead != ptr->end()) { - return &*itRead; - } - } - if (nextRetriever_) { - return nextRetriever_->branchIDToProvenance(bid); - } - return nullptr; - } - - ProductProvenance const* ProductProvenanceRetriever::branchIDToProvenanceForProducedOnly(BranchID const& bid) const { - auto itFound = std::lower_bound( - entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { - return iEntry.branchID() < iValue; - }); - if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { - if (auto p = itFound->productProvenance()) { - return p; - } - } - if (parentProcessRetriever_) { - return parentProcessRetriever_->branchIDToProvenanceForProducedOnly(bid); - } - if (nextRetriever_) { - return nextRetriever_->branchIDToProvenanceForProducedOnly(bid); - } - return nullptr; - } - - ProvenanceReaderBase::~ProvenanceReaderBase() {} -} // namespace edm diff --git a/DataFormats/Provenance/src/Provenance.cc b/DataFormats/Provenance/src/Provenance.cc index 7aaad3cc48ad4..59ce7161e529c 100644 --- a/DataFormats/Provenance/src/Provenance.cc +++ b/DataFormats/Provenance/src/Provenance.cc @@ -1,7 +1,7 @@ #include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/Provenance/interface/MergeableRunProductMetadataBase.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include diff --git a/DetectorDescription/Core/interface/DDName.h b/DetectorDescription/Core/interface/DDName.h index 53c24c87914e6..f977086747c5a 100644 --- a/DetectorDescription/Core/interface/DDName.h +++ b/DetectorDescription/Core/interface/DDName.h @@ -4,6 +4,8 @@ #include #include #include + +#include "FWCore/Utilities/interface/StdPairHasher.h" #include #include @@ -15,7 +17,8 @@ class DDCurrentNamespace; class DDName { public: using id_type = int; - using Registry = tbb::concurrent_unordered_map, id_type>; + using key_type = std::pair; + using Registry = tbb::concurrent_unordered_map; using IdToName = tbb::concurrent_vector; //! Constructs a DDName with name \a name and assigns \a name to the namespace \a ns. diff --git a/DetectorDescription/Core/interface/DDValue.h b/DetectorDescription/Core/interface/DDValue.h index 42839aa8598d9..d86a6ce854013 100644 --- a/DetectorDescription/Core/interface/DDValue.h +++ b/DetectorDescription/Core/interface/DDValue.h @@ -11,6 +11,7 @@ #include "DetectorDescription/Core/interface/DDValuePair.h" #include "tbb/concurrent_unordered_map.h" #include "tbb/concurrent_vector.h" +#include "FWCore/Utilities/interface/zero_allocator.h" /** A DDValue std::maps a std::vector of DDValuePair (std::string,double) to a name. Names of DDValues are stored transiently. Furthermore, an ID is assigned std::mapping to the name. @@ -107,7 +108,7 @@ class DDValue { void init(const std::string&); - using Names = tbb::concurrent_vector>; + using Names = tbb::concurrent_vector>; static Names& names(); static Names initializeNames(); diff --git a/DetectorDescription/Core/src/StoresInstantiation.cc b/DetectorDescription/Core/src/StoresInstantiation.cc index 01fdb672bf926..9ec55e0e85810 100644 --- a/DetectorDescription/Core/src/StoresInstantiation.cc +++ b/DetectorDescription/Core/src/StoresInstantiation.cc @@ -35,6 +35,5 @@ template class DDI::Singleton, std::unique_ptr > >; template class DDI::Singleton > >; //Used internally by DDLogicalPart //The following are used by DDName -template class DDI::Singleton, int> >; -template class DDI::Singleton< - tbb::concurrent_vector, int>::const_iterator> >; +template class DDI::Singleton; +template class DDI::Singleton; diff --git a/DetectorDescription/Core/test/BuildFile.xml b/DetectorDescription/Core/test/BuildFile.xml index 62b629ed03d8b..2c2383c30e494 100644 --- a/DetectorDescription/Core/test/BuildFile.xml +++ b/DetectorDescription/Core/test/BuildFile.xml @@ -16,9 +16,6 @@ - - - diff --git a/DetectorDescription/DDCMS/test/BuildFile.xml b/DetectorDescription/DDCMS/test/BuildFile.xml index 9e6f6b904bd6b..9da64a9377f34 100644 --- a/DetectorDescription/DDCMS/test/BuildFile.xml +++ b/DetectorDescription/DDCMS/test/BuildFile.xml @@ -66,3 +66,7 @@ + + + + diff --git a/DetectorDescription/Core/test/DDUnits.cppunit.cc b/DetectorDescription/DDCMS/test/DDUnits.cppunit.cc similarity index 83% rename from DetectorDescription/Core/test/DDUnits.cppunit.cc rename to DetectorDescription/DDCMS/test/DDUnits.cppunit.cc index 0c0f25904c2ef..9bbffc446f372 100644 --- a/DetectorDescription/Core/test/DDUnits.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDUnits.cppunit.cc @@ -29,17 +29,17 @@ CPPUNIT_TEST_SUITE_REGISTRATION(testDDUnits); void testDDUnits::checkUnits() { std::cout << "\nMy pi: " << std::setprecision(16) << piRadians << " == " << 1_pi << " == " << 1._pi << "\n"; - CPPUNIT_ASSERT(M_PIl == piRadians); - CPPUNIT_ASSERT(M_PIl == 1_pi); - CPPUNIT_ASSERT(M_PIl == 1._pi); + CPPUNIT_ASSERT(M_PI == piRadians); + CPPUNIT_ASSERT(M_PI == 1_pi); + CPPUNIT_ASSERT(M_PI == 1._pi); double twoPiAngle = 2_pi; std::cout << "My 2pi angle: " << twoPiAngle << " [rad] == " << convertRadToDeg(twoPiAngle) << " [deg]\n"; - CPPUNIT_ASSERT(2 * M_PIl == 2 * piRadians); + CPPUNIT_ASSERT(2 * M_PI == 2 * piRadians); CPPUNIT_ASSERT(2 * M_PI == twoPiAngle); - CPPUNIT_ASSERT(2 * M_PIl == 2_pi); - CPPUNIT_ASSERT(2 * M_PIl == 2._pi); + CPPUNIT_ASSERT(2 * M_PI == 2_pi); + CPPUNIT_ASSERT(2 * M_PI == 2._pi); CPPUNIT_ASSERT(90_deg == 1_pi / 2); CPPUNIT_ASSERT(120_deg == 2_pi / 3); @@ -50,13 +50,13 @@ void testDDUnits::checkUnits() { CPPUNIT_ASSERT(angle90 == 90); double angle120 = convertRadToDeg(2_pi / 3); - CPPUNIT_ASSERT(angle120 == 120.); + CPPUNIT_ASSERT(almostEqual(angle120, 120., 2)); double angle135 = convertRadToDeg(3_pi / 4); - CPPUNIT_ASSERT(angle135 == 135.); + CPPUNIT_ASSERT(almostEqual(angle135, 135., 2)); double angle150 = convertRadToDeg(5_pi / 6); - CPPUNIT_ASSERT(angle150 == 150.); + CPPUNIT_ASSERT(almostEqual(angle150, 150., 2)); cout << "Mass of 1 kg is " << 1._kg << " or " << 1 * CLHEP::kg << "\n"; cout << "Mass of 1 g is " << 1._g << " or " << 1 * CLHEP::g << "\n"; diff --git a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc index 97f9828e9f5ec..d9a8b35ebb89e 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc @@ -1,4 +1,5 @@ #include +#include #include "CUDADataFormats/EcalDigi/interface/DigisCollection.h" #include "CondFormats/DataRecord/interface/EcalMappingElectronicsRcd.h" @@ -23,13 +24,19 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { public: explicit EcalCPUDigisProducer(edm::ParameterSet const& ps); - ~EcalCPUDigisProducer() override; + ~EcalCPUDigisProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions&); private: void acquire(edm::Event const&, edm::EventSetup const&, edm::WaitingTaskWithArenaHolder) override; void produce(edm::Event&, edm::EventSetup const&) override; + template + edm::EDPutTokenT dummyProduces(ARGS&&... args) { + return (produceDummyIntegrityCollections_) ? produces(std::forward(args)...) + : edm::EDPutTokenT{}; + } + private: // input digi collections in GPU-friendly format using InputProduct = cms::cuda::Product>; @@ -43,7 +50,7 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { // whether to produce dummy integrity collections bool produceDummyIntegrityCollections_; - // dummy SRP collections + // dummy producer collections edm::EDPutTokenT ebSrFlagToken_; edm::EDPutTokenT eeSrFlagToken_; @@ -59,8 +66,15 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { // dummy integrity errors edm::EDPutTokenT integrityTTIdErrorsToken_; + edm::EDPutTokenT integrityZSXtalIdErrorsToken_; edm::EDPutTokenT integrityBlockSizeErrorsToken_; + edm::EDPutTokenT pnDiodeDigisToken_; + + // dummy TCC collections + edm::EDPutTokenT ecalTriggerPrimitivesToken_; + edm::EDPutTokenT ecalPseudoStripInputsToken_; + // FIXME better way to pass pointers from acquire to produce? std::vector> idsebtmp, idseetmp; std::vector> dataebtmp, dataeetmp; @@ -84,45 +98,41 @@ EcalCPUDigisProducer::EcalCPUDigisProducer(const edm::ParameterSet& ps) : // input digi collections in GPU-friendly format digisInEBToken_{consumes(ps.getParameter("digisInLabelEB"))}, digisInEEToken_{consumes(ps.getParameter("digisInLabelEE"))}, + // output digi collections in legacy format digisOutEBToken_{produces(ps.getParameter("digisOutLabelEB"))}, digisOutEEToken_{produces(ps.getParameter("digisOutLabelEE"))}, + // whether to produce dummy integrity collections produceDummyIntegrityCollections_{ps.getParameter("produceDummyIntegrityCollections")}, - // dummy SRP collections - ebSrFlagToken_{produceDummyIntegrityCollections_ ? produces() - : edm::EDPutTokenT{}}, - eeSrFlagToken_{produceDummyIntegrityCollections_ ? produces() - : edm::EDPutTokenT{}}, + + // dummy collections + ebSrFlagToken_{dummyProduces()}, + eeSrFlagToken_{dummyProduces()}, + // dummy integrity for xtal data - ebIntegrityGainErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainErrors") - : edm::EDPutTokenT{}}, - ebIntegrityGainSwitchErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainSwitchErrors") - : edm::EDPutTokenT{}}, - ebIntegrityChIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityChIdErrors") - : edm::EDPutTokenT{}}, + ebIntegrityGainErrorsToken_{dummyProduces("EcalIntegrityGainErrors")}, + ebIntegrityGainSwitchErrorsToken_{dummyProduces("EcalIntegrityGainSwitchErrors")}, + ebIntegrityChIdErrorsToken_{dummyProduces("EcalIntegrityChIdErrors")}, + // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) - eeIntegrityGainErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainErrors") - : edm::EDPutTokenT{}}, - eeIntegrityGainSwitchErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainSwitchErrors") - : edm::EDPutTokenT{}}, - eeIntegrityChIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityChIdErrors") - : edm::EDPutTokenT{}}, + eeIntegrityGainErrorsToken_{dummyProduces("EcalIntegrityGainErrors")}, + eeIntegrityGainSwitchErrorsToken_{dummyProduces("EcalIntegrityGainSwitchErrors")}, + eeIntegrityChIdErrorsToken_{dummyProduces("EcalIntegrityChIdErrors")}, + // dummy integrity errors - integrityTTIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityTTIdErrors") - : edm::EDPutTokenT{}}, - integrityBlockSizeErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityBlockSizeErrors") - : edm::EDPutTokenT{}} {} + integrityTTIdErrorsToken_{dummyProduces("EcalIntegrityTTIdErrors")}, + integrityZSXtalIdErrorsToken_{dummyProduces("EcalIntegrityZSXtalIdErrors")}, + integrityBlockSizeErrorsToken_{dummyProduces("EcalIntegrityBlockSizeErrors")}, + + // + pnDiodeDigisToken_{dummyProduces()}, -EcalCPUDigisProducer::~EcalCPUDigisProducer() {} + // dummy TCC collections + ecalTriggerPrimitivesToken_{dummyProduces("EcalTriggerPrimitives")}, + ecalPseudoStripInputsToken_{dummyProduces("EcalPseudoStripInputs")} +// constructor body +{} void EcalCPUDigisProducer::acquire(edm::Event const& event, edm::EventSetup const& setup, @@ -176,7 +186,7 @@ void EcalCPUDigisProducer::produce(edm::Event& event, edm::EventSetup const& set event.put(digisOutEEToken_, std::move(digisEE)); if (produceDummyIntegrityCollections_) { - // dummy SRP collections + // dummy collections event.emplace(ebSrFlagToken_); event.emplace(eeSrFlagToken_); // dummy integrity for xtal data @@ -189,7 +199,13 @@ void EcalCPUDigisProducer::produce(edm::Event& event, edm::EventSetup const& set event.emplace(eeIntegrityChIdErrorsToken_); // dummy integrity errors event.emplace(integrityTTIdErrorsToken_); + event.emplace(integrityZSXtalIdErrorsToken_); event.emplace(integrityBlockSizeErrorsToken_); + // + event.emplace(pnDiodeDigisToken_); + // dummy TCC collections + event.emplace(ecalTriggerPrimitivesToken_); + event.emplace(ecalPseudoStripInputsToken_); } } diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc index b1c4c2aee087f..650e0e1911cfb 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc @@ -110,36 +110,51 @@ EcalRawToDigi::EcalRawToDigi(edm::ParameterSet const& conf) edm::InputTag dataLabel = conf.getParameter("InputLabel"); edm::InputTag fedsLabel = conf.getParameter("FedLabel"); - // Producer products : - produces("ebDigis"); - produces("eeDigis"); - produces(); - produces(); - produces(); - produces(); - produces("EcalTriggerPrimitives"); - produces("EcalPseudoStripInputs"); - - // Integrity for xtal data - produces("EcalIntegrityGainErrors"); - produces("EcalIntegrityGainSwitchErrors"); - produces("EcalIntegrityChIdErrors"); - - // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) - produces("EcalIntegrityGainErrors"); - produces("EcalIntegrityGainSwitchErrors"); - produces("EcalIntegrityChIdErrors"); - - // Integrity Errors - produces("EcalIntegrityTTIdErrors"); - produces("EcalIntegrityZSXtalIdErrors"); - produces("EcalIntegrityBlockSizeErrors"); + // Producer products + if (headerUnpacking_) { + produces(); + } + + if (feUnpacking_) { + produces("ebDigis"); + produces("eeDigis"); + + // Integrity for xtal data + produces("EcalIntegrityGainErrors"); + produces("EcalIntegrityGainSwitchErrors"); + produces("EcalIntegrityChIdErrors"); + + // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) + produces("EcalIntegrityGainErrors"); + produces("EcalIntegrityGainSwitchErrors"); + produces("EcalIntegrityChIdErrors"); + + // Integrity Errors + produces("EcalIntegrityTTIdErrors"); + produces("EcalIntegrityZSXtalIdErrors"); + produces("EcalIntegrityBlockSizeErrors"); + + // + produces(); + } + + if (srpUnpacking_) { + produces(); + produces(); + } + + if (tccUnpacking_) { + produces("EcalTriggerPrimitives"); + produces("EcalPseudoStripInputs"); + } // Mem channels' integrity - produces("EcalIntegrityMemTtIdErrors"); - produces("EcalIntegrityMemBlockSizeErrors"); - produces("EcalIntegrityMemChIdErrors"); - produces("EcalIntegrityMemGainErrors"); + if (memUnpacking_) { + produces("EcalIntegrityMemTtIdErrors"); + produces("EcalIntegrityMemBlockSizeErrors"); + produces("EcalIntegrityMemChIdErrors"); + produces("EcalIntegrityMemGainErrors"); + } dataToken_ = consumes(dataLabel); if (REGIONAL_) { diff --git a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py index 00a54ad56c128..0238a62f34568 100644 --- a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py +++ b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py @@ -1,28 +1,49 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -# legacy raw to digi on the CPU +# ECAL unpacker running on CPU from EventFilter.EcalRawToDigi.EcalUnpackerData_cfi import ecalEBunpacker as _ecalEBunpacker -ecalDigis = _ecalEBunpacker.clone() +ecalDigis = SwitchProducerCUDA( + cpu = _ecalEBunpacker.clone() +) -ecalDigisTask = cms.Task(ecalDigis) +ecalDigisTask = cms.Task( + # ECAL unpacker running on CPU + ecalDigis +) # process modifier to run on GPUs from Configuration.ProcessModifiers.gpu_cff import gpu -# GPU-friendly EventSetup modules +# ECAL conditions used by the unpacker running on GPU from EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi import ecalElectronicsMappingGPUESProducer -# raw to digi on GPUs +# ECAL unpacker running on GPU from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU ecalDigisGPU = _ecalRawToDigiGPU.clone() -# copy the digi from the GPU to the CPU and convert to legacy format +# disable the ECAL unpacker collections that are not available in the GPU unpacker +gpu.toModify(ecalDigis.cpu, + headerUnpacking = False, + memUnpacking = False +) + +# extend the SwitchProducer to add a case to copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer -_ecalDigis_gpu = _ecalCPUDigisProducer.clone( - digisInLabelEB = ('ecalDigisGPU', 'ebDigis'), - digisInLabelEE = ('ecalDigisGPU', 'eeDigis'), - produceDummyIntegrityCollections = True +gpu.toModify(ecalDigis, + # copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format + cuda = _ecalCPUDigisProducer.clone( + digisInLabelEB = ('ecalDigisGPU', 'ebDigis'), + digisInLabelEE = ('ecalDigisGPU', 'eeDigis'), + produceDummyIntegrityCollections = True + ) ) -gpu.toReplaceWith(ecalDigis, _ecalDigis_gpu) -gpu.toReplaceWith(ecalDigisTask, cms.Task(ecalElectronicsMappingGPUESProducer, ecalDigisGPU, ecalDigis)) +gpu.toReplaceWith(ecalDigisTask, cms.Task( + # ECAL conditions used by the unpacker running on GPU + ecalElectronicsMappingGPUESProducer, + # run the ECAL unpacker on GPU + ecalDigisGPU, + # run the ECAL unpacker on CPU, or copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format + ecalDigis +)) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index 189763dc6fd46..cd5b02c5d848c 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -37,7 +37,7 @@ #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" -#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/DetId/interface/DetIdCollection.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h" #include "FWCore/Utilities/interface/typedefs.h" @@ -70,7 +70,7 @@ class PixelDataFormatter { typedef cms_uint32_t Word32; typedef cms_uint64_t Word64; - PixelDataFormatter(const SiPixelFedCabling* map, bool phase1 = false); + PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase1 = false); void setErrorStatus(bool ErrorStatus); void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo); @@ -84,20 +84,28 @@ class PixelDataFormatter { void formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, const BadChannels& badChannels); - cms_uint32_t linkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; } + void unpackFEDErrors(Errors const& errors, + std::vector const& tkerrorlist, + std::vector const& usererrorlist, + edm::DetSetVector& errorcollection, + DetIdCollection& tkerror_detidcollection, + DetIdCollection& usererror_detidcollection, + edmNew::DetSetVector& disabled_channelcollection, + DetErrors& nodeterrors); + + cms_uint32_t getLinkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; } private: mutable int theDigiCounter; mutable int theWordCounter; - SiPixelFedCabling const* theCablingTree; + SiPixelFedCablingTree const* theCablingTree; const SiPixelFrameReverter* theFrameReverter; const SiPixelQuality* badPixelInfo; const std::set* modulesToUnpack; bool includeErrors; bool useQualityInfo; - bool debug; int allDetDigis; int hasDetDigis; std::unique_ptr errorcheck; @@ -116,13 +124,6 @@ class PixelDataFormatter { const PixelDigi& digi, std::map >& words) const; - int word2digi(const int fedId, - const SiPixelFrameConverter* converter, - const bool includeError, - const bool useQuality, - const Word32& word, - Digis& digis) const; - std::string print(const PixelDigi& digi) const; std::string print(const Word64& word) const; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc index d09e703c36a00..9e2bf3d5820e9 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc @@ -104,72 +104,16 @@ void SiPixelDigiErrorsFromSoA::produce(edm::Event& iEvent, const edm::EventSetup } } - constexpr uint32_t dummydetid = 0xffffffff; - typedef PixelDataFormatter::Errors::iterator IE; - for (auto& error : errors) { - uint32_t errordetid = error.first; - if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); - } else { - edm::DetSet& errorDetSet = errorcollection.find_or_insert(errordetid); - errorDetSet.data.insert(errorDetSet.data.end(), error.second.begin(), error.second.end()); - // Fill detid of the detectors where there is error AND the error number is listed - // in the configurable error list in the job option cfi. - // Code needs to be here, because there can be a set of errors for each - // entry in the for loop over PixelDataFormatter::Errors - - std::vector disabledChannelsDetSet; - - for (auto const& aPixelError : errorDetSet) { - // For the time being, we extend the error handling functionality with ErrorType 25 - // In the future, we should sort out how the usage of tkerrorlist can be generalized - if (aPixelError.getType() == 25) { - int fedId = aPixelError.getFedId(); - const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId); - if (fed) { - cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32()); - const sipixelobjects::PixelFEDLink* link = fed->link(linkId); - if (link) { - // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it - // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme - PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; - for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { - const sipixelobjects::PixelROC* roc = link->roc(iRoc); - if (roc->idInDetUnit() < ch.roc_first) - ch.roc_first = roc->idInDetUnit(); - if (roc->idInDetUnit() > ch.roc_last) - ch.roc_last = roc->idInDetUnit(); - } - disabledChannelsDetSet.push_back(ch); - } - } - } else { - // fill list of detIds to be turned off by tracking - if (!tkerrorlist_.empty()) { - auto it_find = std::find(tkerrorlist_.begin(), tkerrorlist_.end(), aPixelError.getType()); - if (it_find != tkerrorlist_.end()) { - tkerror_detidcollection.push_back(errordetid); - } - } - } - - // fill list of detIds with errors to be studied - if (!usererrorlist_.empty()) { - auto it_find = std::find(usererrorlist_.begin(), usererrorlist_.end(), aPixelError.getType()); - if (it_find != usererrorlist_.end()) { - usererror_detidcollection.push_back(errordetid); - } - } - - } // loop on DetSet of errors - - if (!disabledChannelsDetSet.empty()) { - disabled_channelcollection.insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); - } - - } // if error assigned to a real DetId - } // loop on errors in event for this FED - + formatter.unpackFEDErrors(errors, + tkerrorlist_, + usererrorlist_, + errorcollection, + tkerror_detidcollection, + usererror_detidcollection, + disabled_channelcollection, + nodeterrors); + + const uint32_t dummydetid = 0xffffffff; edm::DetSet& errorDetSet = errorcollection.find_or_insert(dummydetid); errorDetSet.data = nodeterrors; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc index 348503dd5a412..b340a78fecf7c 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc @@ -1,37 +1,30 @@ #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.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/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/CPUTimer.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" - -#include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/Utilities/interface/thread_safety_macros.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" +#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" -#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" - -#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include #include @@ -177,7 +170,6 @@ void SiPixelDigiToRaw::fillDescriptions(edm::ConfigurationDescriptions& descript edm::ParameterSetDescription desc; desc.add("InputLabel"); desc.add("UsePhase1", false); - desc.addUntracked("Timing", false)->setComment("deprecated"); descriptions.add("siPixelRawData", desc); } diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 93d3f023d44e8..ce704452a3e5a 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -1,70 +1,118 @@ // Skip FED40 pilot-blade // Include parameter driven interface to SiPixelQuality for study purposes // exclude ROC(raw) based on bad ROC list in SiPixelQuality -// enabled by: process.siPixelDigis.UseQualityInfo = True (BY DEFAULT NOT USED) +// enabled by: process.siPixelDigis.useQualityInfo = True (BY DEFAULT NOT USED) // 20-10-2010 Andrew York (Tennessee) // Jan 2016 Tamas Almos Vami (Tav) (Wigner RCP) -- Cabling Map label option // Jul 2017 Viktor Veszpremi -- added PixelFEDChannel -#include "SiPixelRawToDigi.h" - #include #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Event.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 "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" - -#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetIdCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" +#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/DetId/interface/DetIdCollection.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" - -#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "TH1D.h" -#include "TFile.h" -using namespace std; +/** \class SiPixelRawToDigi + * Plug-in module that performs Raw data to digi conversion + * for pixel subdetector + */ + +class SiPixelRawToDigi : public edm::stream::EDProducer<> { +public: + /// ctor + explicit SiPixelRawToDigi(const edm::ParameterSet&); + + /// dtor + ~SiPixelRawToDigi() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + /// get data, convert to digis attach againe to Event + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + edm::ParameterSet config_; + std::unique_ptr cabling_; + const SiPixelQuality* badPixelInfo_; + PixelUnpackingRegions* regions_; + const std::vector tkerrorlist_; + const std::vector usererrorlist_; + std::vector fedIds_; + edm::ESWatcher recordWatcher_; + edm::ESWatcher qualityWatcher_; + // always consumed + const edm::EDGetTokenT fedRawDataCollectionToken_; + const edm::ESGetToken cablingMapToken_; + // consume only if pixel quality is used -> useQuality_ + edm::ESGetToken siPixelQualityToken_; + // always produced + const edm::EDPutTokenT> siPixelDigiCollectionToken_; + // produce only if error collections are included -> includeErrors_ + edm::EDPutTokenT> errorPutToken_; + edm::EDPutTokenT tkErrorPutToken_; + edm::EDPutTokenT userErrorPutToken_; + edm::EDPutTokenT> disabledChannelPutToken_; + const bool includeErrors_; + const bool useQuality_; + const bool usePilotBlade_; + const bool usePhase1_; +}; // ----------------------------------------------------------------------------- SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) - : config_(conf), badPixelInfo_(nullptr), regions_(nullptr), hCPU(nullptr), hDigi(nullptr) { - includeErrors = config_.getParameter("IncludeErrors"); - useQuality = config_.getParameter("UseQualityInfo"); - - tkerrorlist = config_.getParameter>("ErrorList"); - usererrorlist = config_.getParameter>("UserErrorList"); - - tFEDRawDataCollection = consumes(config_.getParameter("InputLabel")); - if (useQuality) { - tSiPixelQuality = esConsumes(); + : config_(conf), + badPixelInfo_(nullptr), + regions_(nullptr), + tkerrorlist_(config_.getParameter>("ErrorList")), + usererrorlist_(config_.getParameter>("UserErrorList")), + fedRawDataCollectionToken_{consumes(config_.getParameter("InputLabel"))}, + cablingMapToken_{esConsumes( + edm::ESInputTag("", config_.getParameter("CablingMapLabel")))}, + siPixelDigiCollectionToken_{produces>()}, + includeErrors_(config_.getParameter("IncludeErrors")), + useQuality_(config_.getParameter("UseQualityInfo")), + usePilotBlade_(config_.getParameter("UsePilotBlade")), + usePhase1_(config_.getParameter("UsePhase1")) + +{ + if (useQuality_) { + siPixelQualityToken_ = esConsumes(); } - //start counters - ndigis = 0; - nwords = 0; - // Products - produces>(); - if (includeErrors) { - produces>(); - produces(); - produces("UserErrorModules"); - produces>(); + if (includeErrors_) { + errorPutToken_ = produces>(); + tkErrorPutToken_ = produces(); + userErrorPutToken_ = produces("UserErrorModules"); + disabledChannelPutToken_ = produces>(); } // regions @@ -72,41 +120,20 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) regions_ = new PixelUnpackingRegions(config_, consumesCollector()); } - // Timing - bool timing = config_.getUntrackedParameter("Timing", false); - if (timing) { - theTimer = std::make_unique(); - hCPU = new TH1D("hCPU", "hCPU", 100, 0., 0.050); - hDigi = new TH1D("hDigi", "hDigi", 50, 0., 15000.); - } - // Control the usage of pilot-blade data, FED=40 - usePilotBlade = config_.getParameter("UsePilotBlade"); - if (usePilotBlade) + if (usePilotBlade_) edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)"; // Control the usage of phase1 - usePhase1 = config_.getParameter("UsePhase1"); - if (usePhase1) + if (usePhase1_) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; - - //CablingMap could have a label //Tav - cablingMapLabel = config_.getParameter("CablingMapLabel"); - tCablingMap = esConsumes(edm::ESInputTag("", cablingMapLabel)); } // ----------------------------------------------------------------------------- SiPixelRawToDigi::~SiPixelRawToDigi() { edm::LogInfo("SiPixelRawToDigi") << " HERE ** SiPixelRawToDigi destructor!"; - if (regions_) delete regions_; - - if (theTimer) { - TFile rootFile("analysis.root", "RECREATE", "my histograms"); - hCPU->Write(); - hDigi->Write(); - } } void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -114,17 +141,11 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("IncludeErrors", true); desc.add("UseQualityInfo", false); { - std::vector temp1; - temp1.reserve(1); - temp1.push_back(29); - desc.add>("ErrorList", temp1) + desc.add>("ErrorList", std::vector{29}) ->setComment("## ErrorList: list of error codes used by tracking to invalidate modules"); } { - std::vector temp1; - temp1.reserve(1); - temp1.push_back(40); - desc.add>("UserErrorList", temp1) + desc.add>("UserErrorList", std::vector{40}) ->setComment("## UserErrorList: list of error codes used by Pixel experts for investigation"); } desc.add("InputLabel", edm::InputTag("siPixelRawData")); @@ -137,11 +158,9 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("Regions", psd0) ->setComment("## Empty Regions PSet means complete unpacking"); } - desc.addUntracked("Timing", false); desc.add("UsePilotBlade", false)->setComment("## Use pilot blades"); desc.add("UsePhase1", false)->setComment("## Use phase1"); desc.add("CablingMapLabel", "")->setComment("CablingMap label"); //Tav - desc.addOptional("CheckPixelOrder"); // never used, kept for back-compatibility descriptions.add("siPixelRawToDigi", desc); } @@ -150,47 +169,43 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript // ----------------------------------------------------------------------------- void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { const uint32_t dummydetid = 0xffffffff; - debug = edm::MessageDrop::instance()->debugEnabled; // initialize cabling map or update if necessary - if (recordWatcher.check(es)) { + if (recordWatcher_.check(es)) { // cabling map, which maps online address (fed->link->ROC->local pixel) to offline (DetId->global pixel) - edm::ESHandle cablingMap = es.getHandle(tCablingMap); - fedIds = cablingMap->fedIds(); + edm::ESHandle cablingMap = es.getHandle(cablingMapToken_); + fedIds_ = cablingMap->fedIds(); cabling_ = cablingMap->cablingTree(); LogDebug("map version:") << cabling_->version(); } // initialize quality record or update if necessary - if (qualityWatcher.check(es) && useQuality) { + if (qualityWatcher_.check(es) && useQuality_) { // quality info for dead pixel modules or ROCs - edm::ESHandle qualityInfo = es.getHandle(tSiPixelQuality); + edm::ESHandle qualityInfo = es.getHandle(siPixelQualityToken_); badPixelInfo_ = qualityInfo.product(); if (!badPixelInfo_) { - edm::LogError("SiPixelQualityNotPresent") - << " Configured to use SiPixelQuality, but SiPixelQuality not present" << endl; + edm::LogError("SiPixelQualityNotPresent") << "Configured to use SiPixelQuality, but SiPixelQuality not present"; } } edm::Handle buffers; - ev.getByToken(tFEDRawDataCollection, buffers); + ev.getByToken(fedRawDataCollectionToken_, buffers); // create product (digis & errors) - auto collection = std::make_unique>(); + auto collection = edm::DetSetVector(); // collection->reserve(8*1024); - auto errorcollection = std::make_unique>(); - auto tkerror_detidcollection = std::make_unique(); - auto usererror_detidcollection = std::make_unique(); - auto disabled_channelcollection = std::make_unique>(); + auto errorcollection = edm::DetSetVector{}; + auto tkerror_detidcollection = DetIdCollection{}; + auto usererror_detidcollection = DetIdCollection{}; + auto disabled_channelcollection = edmNew::DetSetVector{}; - PixelDataFormatter formatter(cabling_.get(), usePhase1); // for phase 1 & 0 + PixelDataFormatter formatter(cabling_.get(), usePhase1_); // for phase 1 & 0 - formatter.setErrorStatus(includeErrors); + formatter.setErrorStatus(includeErrors_); - if (useQuality) - formatter.setQualityStatus(useQuality, badPixelInfo_); + if (useQuality_) + formatter.setQualityStatus(useQuality_, badPixelInfo_); - if (theTimer) - theTimer->start(); bool errorsInEvent = false; PixelDataFormatter::DetErrors nodeterrors; @@ -202,17 +217,16 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { << regions_->nForwardModules() << " " << regions_->nModules(); } - for (auto aFed = fedIds.begin(); aFed != fedIds.end(); ++aFed) { + for (auto aFed = fedIds_.begin(); aFed != fedIds_.end(); ++aFed) { int fedId = *aFed; - if (!usePilotBlade && (fedId == 40)) + if (!usePilotBlade_ && (fedId == 40)) continue; // skip pilot blade data if (regions_ && !regions_->mayUnpackFED(fedId)) continue; - if (debug) - LogDebug("SiPixelRawToDigi") << " PRODUCE DIGI FOR FED: " << fedId << endl; + LogDebug("SiPixelRawToDigi") << "PRODUCE DIGI FOR FED:" << fedId; PixelDataFormatter::Errors errors; @@ -220,103 +234,34 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { const FEDRawData& fedRawData = buffers->FEDData(fedId); //convert data to digi and strip off errors - formatter.interpretRawData(errorsInEvent, fedId, fedRawData, *collection, errors); + formatter.interpretRawData(errorsInEvent, fedId, fedRawData, collection, errors); //pack errors into collection - if (includeErrors) { - typedef PixelDataFormatter::Errors::iterator IE; - for (IE is = errors.begin(); is != errors.end(); is++) { - uint32_t errordetid = is->first; - if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); - } else { - edm::DetSet& errorDetSet = errorcollection->find_or_insert(errordetid); - errorDetSet.data.insert(errorDetSet.data.end(), is->second.begin(), is->second.end()); - // Fill detid of the detectors where there is error AND the error number is listed - // in the configurable error list in the job option cfi. - // Code needs to be here, because there can be a set of errors for each - // entry in the for loop over PixelDataFormatter::Errors - - std::vector disabledChannelsDetSet; - - for (auto const& aPixelError : errorDetSet) { - // For the time being, we extend the error handling functionality with ErrorType 25 - // In the future, we should sort out how the usage of tkerrorlist can be generalized - if (usePhase1 && aPixelError.getType() == 25) { - assert(aPixelError.getFedId() == fedId); - const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId); - if (fed) { - cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32()); - const sipixelobjects::PixelFEDLink* link = fed->link(linkId); - if (link) { - // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it - // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme - PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; - for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { - const sipixelobjects::PixelROC* roc = link->roc(iRoc); - if (roc->idInDetUnit() < ch.roc_first) - ch.roc_first = roc->idInDetUnit(); - if (roc->idInDetUnit() > ch.roc_last) - ch.roc_last = roc->idInDetUnit(); - } - disabledChannelsDetSet.push_back(ch); - } - } - } else { - // fill list of detIds to be turned off by tracking - if (!tkerrorlist.empty()) { - std::vector::iterator it_find = - find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); - if (it_find != tkerrorlist.end()) { - tkerror_detidcollection->push_back(errordetid); - } - } - } - - // fill list of detIds with errors to be studied - if (!usererrorlist.empty()) { - std::vector::iterator it_find = - find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); - if (it_find != usererrorlist.end()) { - usererror_detidcollection->push_back(errordetid); - } - } - - } // loop on DetSet of errors - - if (!disabledChannelsDetSet.empty()) { - disabled_channelcollection->insert( - errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); - } - } // if error assigned to a real DetId - } // loop on errors in event for this FED - } // if errors to be included in the event - } // loop on FED data to be unpacked - - if (includeErrors) { - edm::DetSet& errorDetSet = errorcollection->find_or_insert(dummydetid); + if (includeErrors_) { + formatter.unpackFEDErrors(errors, + tkerrorlist_, + usererrorlist_, + errorcollection, + tkerror_detidcollection, + usererror_detidcollection, + disabled_channelcollection, + nodeterrors); + } // if errors to be included in the event + } // loop on FED data to be unpacked + + if (includeErrors_) { + edm::DetSet& errorDetSet = errorcollection.find_or_insert(dummydetid); errorDetSet.data = nodeterrors; } if (errorsInEvent) LogDebug("SiPixelRawToDigi") << "Error words were stored in this event"; - if (theTimer) { - theTimer->stop(); - LogDebug("SiPixelRawToDigi") << "TIMING IS: (real)" << theTimer->realTime(); - ndigis += formatter.nDigis(); - nwords += formatter.nWords(); - LogDebug("SiPixelRawToDigi") << " (Words/Digis) this ev: " << formatter.nWords() << "/" << formatter.nDigis() - << "--- all :" << nwords << "/" << ndigis; - hCPU->Fill(theTimer->realTime()); - hDigi->Fill(formatter.nDigis()); - } - - ev.put(std::move(collection)); - if (includeErrors) { - ev.put(std::move(errorcollection)); - ev.put(std::move(tkerror_detidcollection)); - ev.put(std::move(usererror_detidcollection), "UserErrorModules"); - ev.put(std::move(disabled_channelcollection)); + ev.emplace(siPixelDigiCollectionToken_, std::move(collection)); + if (includeErrors_) { + ev.emplace(errorPutToken_, std::move(errorcollection)); + ev.emplace(tkErrorPutToken_, std::move(tkerror_detidcollection)); + ev.emplace(userErrorPutToken_, std::move(usererror_detidcollection)); + ev.emplace(disabledChannelPutToken_, std::move(disabled_channelcollection)); } } // declare this as a framework plugin diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h deleted file mode 100644 index c475479cc7303..0000000000000 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef SiPixelRawToDigi_H -#define SiPixelRawToDigi_H - -/** \class SiPixelRawToDigi_H - * Plug-in module that performs Raw data to digi conversion - * for pixel subdetector - */ - -#include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/CPUTimer.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -class SiPixelFedCablingTree; -class SiPixelFedCabling; -class SiPixelQuality; -class TH1D; -class PixelUnpackingRegions; - -class SiPixelRawToDigi : public edm::stream::EDProducer<> { -public: - /// ctor - explicit SiPixelRawToDigi(const edm::ParameterSet&); - - /// dtor - ~SiPixelRawToDigi() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - /// get data, convert to digis attach againe to Event - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - edm::ParameterSet config_; - std::unique_ptr cabling_; - const SiPixelQuality* badPixelInfo_; - PixelUnpackingRegions* regions_; - edm::EDGetTokenT tFEDRawDataCollection; - TH1D *hCPU, *hDigi; - std::unique_ptr theTimer; - bool includeErrors; - bool useQuality; - bool debug; - std::vector tkerrorlist; - std::vector usererrorlist; - std::vector fedIds; - edm::ESWatcher recordWatcher; - edm::ESWatcher qualityWatcher; - edm::InputTag label; - edm::ESGetToken tSiPixelQuality; - edm::ESGetToken tCablingMap; - int ndigis; - int nwords; - bool usePilotBlade; - bool usePhase1; - std::string cablingMapLabel; -}; -#endif diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py index bb78b3ee8c6ea..0c5946f226a11 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms siPixelRawData = cms.EDProducer("SiPixelDigiToRaw", - Timing = cms.untracked.bool(False), InputLabel = cms.InputTag("simSiPixelDigis"), ## Use phase1 UsePhase1 = cms.bool(False), diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py index 34897891cd323..81622b3b9d1e1 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py @@ -3,7 +3,7 @@ from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * ## regional seeded unpacking for specialized HLT paths -siPixelDigisRegional = siPixelDigis.clone() +siPixelDigisRegional = siPixelDigis.cpu.clone() siPixelDigisRegional.Regions = cms.PSet( inputs = cms.VInputTag( "hltL2EtCutDoublePFIsoTau45Trk5" ), deltaPhi = cms.vdouble( 0.5 ), diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py index 50c8f0fcabd3c..13fff5e0e1600 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py @@ -1,15 +1,20 @@ import FWCore.ParameterSet.Config as cms -from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi - from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu + +# legacy pixel unpacker +from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi siPixelDigis = SwitchProducerCUDA( cpu = _siPixelRawToDigi.clone() ) +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigis.cpu, UsePhase1=True) +phase1Pixel.toModify(siPixelDigis.cpu, + UsePhase1 = True +) -from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA gpu.toModify(siPixelDigis, cuda = cms.EDAlias( siPixelDigiErrors = cms.VPSet( diff --git a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py index 5c1ff74be9c69..8a84ba90b5ac0 100644 --- a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py +++ b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py @@ -1,30 +1,43 @@ import FWCore.ParameterSet.Config as cms from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import siPixelDigis -from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA -siPixelDigisTask = cms.Task(siPixelDigis) +siPixelDigisTask = cms.Task( + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigis +) +# copy the pixel digis (except errors) and clusters to the host +from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA siPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# copy the pixel digis errors to the host +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA siPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# convert the pixel digis errors to the legacy format +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA siPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone() +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigiErrors, UsePhase1=True) - -siPixelDigisTaskCUDA = cms.Task( - siPixelDigisSoA, - siPixelDigiErrorsSoA, - siPixelDigiErrors +phase1Pixel.toModify(siPixelDigiErrors, + UsePhase1 = True ) + from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelDigisTask_gpu = siPixelDigisTask.copy() -_siPixelDigisTask_gpu.add(siPixelDigisTaskCUDA) -gpu.toReplaceWith(siPixelDigisTask, _siPixelDigisTask_gpu) +gpu.toReplaceWith(siPixelDigisTask, cms.Task( + # copy the pixel digis (except errors) and clusters to the host + siPixelDigisSoA, + # copy the pixel digis errors to the host + siPixelDigiErrorsSoA, + # convert the pixel digis errors to the legacy format + siPixelDigiErrors, + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigisTask.copy() +)) diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 74514b5bdf4dd..5557f8061446e 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -39,22 +39,9 @@ namespace { // Special for layer 1 bpix rocs 6/9/16 d.k. THIS STAYS. constexpr int COL_bits1_l1 = 6; constexpr int ROW_bits1_l1 = 7; - - // Moved to the header file, keep commented out unti the final version is done/ - // constexpr int ADC_shift = 0; - // constexpr int PXID_shift = ADC_shift + ADC_bits; - // constexpr int DCOL_shift = PXID_shift + PXID_bits; - // constexpr int ROC_shift = DCOL_shift + DCOL_bits; - // constexpr int LINK_shift = ROC_shift + ROC_bits; - // constexpr PixelDataFormatter::Word32 LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits); - // constexpr PixelDataFormatter::Word32 ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits); - // constexpr PixelDataFormatter::Word32 DCOL_mask = ~(~PixelDataFormatter::Word32(0) << DCOL_bits); - // constexpr PixelDataFormatter::Word32 PXID_mask = ~(~PixelDataFormatter::Word32(0) << PXID_bits); - // constexpr PixelDataFormatter::Word32 ADC_mask = ~(~PixelDataFormatter::Word32(0) << ADC_bits); - //const bool DANEK = false; } // namespace -PixelDataFormatter::PixelDataFormatter(const SiPixelFedCabling* map, bool phase) +PixelDataFormatter::PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase) : theDigiCounter(0), theWordCounter(0), theCablingTree(map), @@ -81,25 +68,25 @@ PixelDataFormatter::PixelDataFormatter(const SiPixelFedCabling* map, bool phase) if (phase1) { // for phase 1 LINK_shift = ROC_shift + ROC_bits1; - LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits1); - ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits1); + LINK_mask = ~(~Word32(0) << LINK_bits1); + ROC_mask = ~(~Word32(0) << ROC_bits1); // special for layer 1 ROC ROW_shift = ADC_shift + ADC_bits; COL_shift = ROW_shift + ROW_bits1_l1; - COL_mask = ~(~PixelDataFormatter::Word32(0) << COL_bits1_l1); - ROW_mask = ~(~PixelDataFormatter::Word32(0) << ROW_bits1_l1); + COL_mask = ~(~Word32(0) << COL_bits1_l1); + ROW_mask = ~(~Word32(0) << ROW_bits1_l1); maxROCIndex = 8; } else { // for phase 0 LINK_shift = ROC_shift + ROC_bits; - LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits); - ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits); + LINK_mask = ~(~Word32(0) << LINK_bits); + ROC_mask = ~(~Word32(0) << ROC_bits); maxROCIndex = 25; } - DCOL_mask = ~(~PixelDataFormatter::Word32(0) << DCOL_bits); - PXID_mask = ~(~PixelDataFormatter::Word32(0) << PXID_bits); - ADC_mask = ~(~PixelDataFormatter::Word32(0) << ADC_bits); + DCOL_mask = ~(~Word32(0) << DCOL_bits); + PXID_mask = ~(~Word32(0) << PXID_bits); + ADC_mask = ~(~Word32(0) << ADC_bits); if (phase1) { errorcheck = std::unique_ptr(new ErrorChecker()); @@ -186,8 +173,6 @@ void PixelDataFormatter::interpretRawData( int nlink = (ww >> LINK_shift) & LINK_mask; int nroc = (ww >> ROC_shift) & ROC_mask; - //if(DANEK) cout<<" fed, link, roc "<print()<<" layer "<bpixLayerPhase1(rawId)<<" " - // <idInDetUnit(); skipROC = badPixelInfo->IsRocBad(rawId, rocInDet); @@ -239,11 +221,8 @@ void PixelDataFormatter::interpretRawData( // for l1 roc use the roc column and row index instead of dcol and pixel index. int col = (ww >> COL_shift) & COL_mask; int row = (ww >> ROW_shift) & ROW_mask; - //if(DANEK) cout<<" layer 1: raw2digi "<(localCR); // local pixel coordinate - //if(DANEK) cout<dcol()<<" "<pxid()<<" "<rocCol()<<" "<rocRow()<> DCOL_shift) & DCOL_mask; int pxid = (ww >> PXID_shift) & PXID_mask; - //if(DANEK) cout<<" raw2digi "<(localDP); // local pixel coordinate - //if(DANEK) cout<dcol()<<" "<pxid()<<" "<rocCol()<<" "<rocRow()<toGlobal(*local); // global pixel coordinate (in module) (*detDigis).data.emplace_back(global.row, global.col, adc); - //if(DANEK) cout<> DCOL_shift) & DCOL_mask; -// int pxid = (ww >> PXID_shift) & PXID_mask; -// // int adc = (ww >> ADC_shift) & ADC_mask; -// LocalPixel::DcolPxid local = { dcol, pxid }; -// valid[i] = local.valid(); -// GlobalPixel global = rocp->toGlobal( LocalPixel(local) ); -// row[i]=global.row; col[i]=global.col; -// } -// } - void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, @@ -308,7 +266,6 @@ void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, bool barrel = PixelModuleName::isBarrel(rawId); if (barrel) layer = PixelROC::bpixLayerPhase1(rawId); - //if(DANEK) cout<<" layer "<second.begin(), detBadChannels->second.end(), [&](const PixelFEDChannel& ch) { - return (int(ch.fed) == fedId && ch.link == linkId(words[fedId].back())); + return (int(ch.fed) == fedId && ch.link == getLinkId(words[fedId].back())); }); if (badChannel != detBadChannels->second.end()) { LogError("FormatDataException") << " while marked bad, found digi for FED " << fedId << " Link " - << linkId(words[fedId].back()) << " on module " << rawId << endl + << getLinkId(words[fedId].back()) << " on module " << rawId << endl << print(digi) << endl; } } // if (fedId) @@ -401,9 +358,7 @@ void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, int PixelDataFormatter::digi2word(cms_uint32_t detId, const PixelDigi& digi, std::map >& words) const { - LogDebug("PixelDataFormatter") - // <<" detId: " << detId - << print(digi); + LogDebug("PixelDataFormatter") << print(digi); DetectorIndex detector = {detId, digi.row(), digi.column()}; ElectronicIndex cabling; @@ -411,9 +366,6 @@ int PixelDataFormatter::digi2word(cms_uint32_t detId, if (fedId < 0) return fedId; - //if(DANEK) cout<<" digi2raw "< >& words) const { - LogDebug("PixelDataFormatter") - // <<" detId: " << detId - << print(digi); + LogDebug("PixelDataFormatter") << print(digi); DetectorIndex detector = {detId, digi.row(), digi.column()}; ElectronicIndex cabling; @@ -437,10 +387,6 @@ int PixelDataFormatter::digi2wordPhase1Layer1(cms_uint32_t detId, int col = ((cabling.dcol) * 2) + ((cabling.pxid) % 2); int row = LocalPixel::numRowsInRoc - ((cabling.pxid) / 2); - //if(DANEK) cout<<" layer 1: digi2raw "<> DCOL_shift) & DCOL_mask; - cabling.pxid = (word >> PXID_shift) & PXID_mask; - cabling.link = (word >> LINK_shift) & LINK_mask; - cabling.roc = (word >> ROC_shift) & ROC_mask; - int adc = (word >> ADC_shift) & ADC_mask; - - if (debug) { - LocalPixel::DcolPxid pixel = {cabling.dcol, cabling.pxid}; - LocalPixel local(pixel); - LogTrace("") << " link: " << cabling.link << ", roc: " << cabling.roc << " rocRow: " << local.rocRow() - << ", rocCol:" << local.rocCol() << " (dcol: " << cabling.dcol << ", pxid:" << cabling.pxid - << "), adc:" << adc; - } - - if (!converter) - return 0; - - DetectorIndex detIdx; - int status = converter->toDetector(cabling, detIdx); - if (status) - return status; - - // exclude ROC(raw) based on bad ROC list bad in SiPixelQuality - // enable: process.siPixelDigis.UseQualityInfo = True - // 20-10-2010 A.Y. - if (useQuality && badPixelInfo) { - CablingPathToDetUnit path = {static_cast(fedId), - static_cast(cabling.link), - static_cast(cabling.roc)}; - const PixelROC* roc = theCablingTree->findItem(path); - short rocInDet = (short)roc->idInDetUnit(); - bool badROC = badPixelInfo->IsRocBad(detIdx.rawId, rocInDet); - if (badROC) - return 0; - } - - if (modulesToUnpack && modulesToUnpack->find(detIdx.rawId) == modulesToUnpack->end()) - return 0; - - digis[detIdx.rawId].emplace_back(detIdx.row, detIdx.col, adc); - - theDigiCounter++; - - if (debug) - LogTrace("") << digis[detIdx.rawId].back(); - return 0; -} - std::string PixelDataFormatter::print(const PixelDigi& digi) const { ostringstream str; str << " DIGI: row: " << digi.row() << ", col: " << digi.column() << ", adc: " << digi.adc(); @@ -520,3 +406,76 @@ std::string PixelDataFormatter::print(const Word64& word) const { str << "word64: " << reinterpret_cast&>(word); return str.str(); } + +void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& errors, + std::vector const& tkerrorlist, + std::vector const& usererrorlist, + edm::DetSetVector& errorcollection, + DetIdCollection& tkerror_detidcollection, + DetIdCollection& usererror_detidcollection, + edmNew::DetSetVector& disabled_channelcollection, + DetErrors& nodeterrors) { + const uint32_t dummyDetId = 0xffffffff; + for (const auto& [errorDetId, rawErrorsVec] : errors) { + if (errorDetId == dummyDetId) { // errors given dummy detId must be sorted by Fed + nodeterrors.insert(nodeterrors.end(), rawErrorsVec.begin(), rawErrorsVec.end()); + } else { + edm::DetSet& errorDetSet = errorcollection.find_or_insert(errorDetId); + errorDetSet.data.insert(errorDetSet.data.end(), rawErrorsVec.begin(), rawErrorsVec.end()); + // Fill detid of the detectors where there is error AND the error number is listed + // in the configurable error list in the job option cfi. + // Code needs to be here, because there can be a set of errors for each + // entry in the for loop over PixelDataFormatter::Errors + + std::vector disabledChannelsDetSet; + + for (auto const& aPixelError : errorDetSet) { + // For the time being, we extend the error handling functionality with ErrorType 25 + // In the future, we should sort out how the usage of tkerrorlist can be generalized + if (phase1 && aPixelError.getType() == 25) { + int fedId = aPixelError.getFedId(); + const sipixelobjects::PixelFEDCabling* fed = theCablingTree->fed(fedId); + if (fed) { + cms_uint32_t linkId = getLinkId(aPixelError.getWord32()); + const sipixelobjects::PixelFEDLink* link = fed->link(linkId); + if (link) { + // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it + // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme + PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; + for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { + const sipixelobjects::PixelROC* roc = link->roc(iRoc); + if (roc->idInDetUnit() < ch.roc_first) + ch.roc_first = roc->idInDetUnit(); + if (roc->idInDetUnit() > ch.roc_last) + ch.roc_last = roc->idInDetUnit(); + } + disabledChannelsDetSet.push_back(ch); + } + } + } else { + // fill list of detIds to be turned off by tracking + if (!tkerrorlist.empty()) { + auto it_find = std::find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); + if (it_find != tkerrorlist.end()) { + tkerror_detidcollection.push_back(errorDetId); + } + } + } + + // fill list of detIds with errors to be studied + if (!usererrorlist.empty()) { + auto it_find = std::find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); + if (it_find != usererrorlist.end()) { + usererror_detidcollection.push_back(errorDetId); + } + } + + } // loop on DetSet of errors + + if (!disabledChannelsDetSet.empty()) { + disabled_channelcollection.insert(errorDetId, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); + } + + } // if error assigned to a real DetId + } // loop on errors in event for this FED +} diff --git a/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py b/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py index 5a82f804ee8fe..b457b7f840843 100644 --- a/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py @@ -78,7 +78,6 @@ # In 2012, extension = _LHC InputLabel = cms.untracked.string('rawDataCollector'), # InputLabel = cms.untracked.string('siPixelRawData'), - CheckPixelOrder = cms.untracked.bool(False) ) process.p = cms.Path(process.hltfilter*process.dumper) diff --git a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py index 8cfcdf2944364..17c420cca4488 100644 --- a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py @@ -273,7 +273,6 @@ #process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('205718:49-205718:734') process.d = cms.EDAnalyzer("SiPixelRawDumper", - Timing = cms.untracked.bool(False), IncludeErrors = cms.untracked.bool(True), # In 2012, label = rawDataCollector, extension = _LHC # InputLabel = cms.untracked.string('rawDataCollector'), @@ -284,7 +283,6 @@ # old # InputLabel = cms.untracked.string('siPixelRawData'), # InputLabel = cms.untracked.string('source'), - CheckPixelOrder = cms.untracked.bool(False), # 0 - nothing, 1 - error , 2- data, 3-headers, 4-hex Verbosity = cms.untracked.int32(1), # threshold, print fed/channel num of errors if tot_errors > events * PrintThreshold, default 0,001 diff --git a/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py b/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py index 684025205db54..4f683f1b49657 100644 --- a/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py @@ -48,7 +48,6 @@ #process.siPixelDigis.InputLabel = 'source' #process.siPixelDigis.InputLabel = 'rawDataCollector' process.siPixelDigis.IncludeErrors = True -process.siPixelDigis.Timing = False #process.siPixelDigis.UseCablingTree = True process.MessageLogger = cms.Service("MessageLogger", diff --git a/EventFilter/SiPixelRawToDigi/test/test.py b/EventFilter/SiPixelRawToDigi/test/test.py index 9620c86c9f92c..711597299b56d 100644 --- a/EventFilter/SiPixelRawToDigi/test/test.py +++ b/EventFilter/SiPixelRawToDigi/test/test.py @@ -21,7 +21,6 @@ process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") #process.siPixelDigis.InputLabel = "rawDataCollector" process.siPixelDigis.InputLabel = "rawDataCollector" -process.siPixelDigis.Timing = True process.siPixelDigis.UseQualityInfo = False process.siPixelDigis.IncludeErrors = True process.siPixelDigis.ErrorList = [29] diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index a145898efb7c5..e39363529cbaa 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -1178,7 +1178,7 @@ void FedRawDataInputSource::readSupervisor() { //make sure threads finish reading unsigned numFinishedThreads = 0; while (numFinishedThreads < workerThreads_.size()) { - unsigned int tid; + unsigned tid = 0; while (!workerPool_.try_pop(tid)) { usleep(10000); } diff --git a/FWCore/Framework/bin/BuildFile.xml b/FWCore/Framework/bin/BuildFile.xml index ddd3e9852e0a2..4dd924fbc4590 100644 --- a/FWCore/Framework/bin/BuildFile.xml +++ b/FWCore/Framework/bin/BuildFile.xml @@ -85,3 +85,18 @@ + + + + + + + + + + + + + + + diff --git a/FWCore/Framework/interface/EventPrincipal.h b/FWCore/Framework/interface/EventPrincipal.h index 41c53cc2aa95d..bfc35e168b13c 100644 --- a/FWCore/Framework/interface/EventPrincipal.h +++ b/FWCore/Framework/interface/EventPrincipal.h @@ -14,7 +14,7 @@ is the DataBlock. #include "DataFormats/Common/interface/WrapperBase.h" #include "DataFormats/Provenance/interface/BranchListIndex.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "DataFormats/Provenance/interface/EventSelectionID.h" #include "FWCore/Utilities/interface/StreamID.h" diff --git a/FWCore/Framework/interface/ProductProvenanceRetriever.h b/FWCore/Framework/interface/ProductProvenanceRetriever.h new file mode 100644 index 0000000000000..b9b99fb90acd3 --- /dev/null +++ b/FWCore/Framework/interface/ProductProvenanceRetriever.h @@ -0,0 +1,66 @@ +#ifndef DataFormats_Provenance_ProductProvenanceRetriever_h +#define DataFormats_Provenance_ProductProvenanceRetriever_h + +/*---------------------------------------------------------------------- + +ProductProvenanceRetriever: Manages the per event/lumi/run per product provenance. + +----------------------------------------------------------------------*/ +#include "DataFormats/Provenance/interface/ProductProvenance.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" +#include "FWCore/Concurrency/interface/WaitingTaskHolder.h" +#include "FWCore/Utilities/interface/propagate_const.h" + +#include +#include +#include + +/* + ProductProvenanceRetriever +*/ + +namespace edm { + class ModuleCallingContext; + class ProductRegistry; + + class ProvenanceReaderBase { + public: + ProvenanceReaderBase() {} + virtual ~ProvenanceReaderBase(); + virtual std::set readProvenance(unsigned int transitionIndex) const = 0; + virtual void readProvenanceAsync(WaitingTaskHolder task, + ModuleCallingContext const* moduleCallingContext, + unsigned int transitionIndex, + std::atomic*>& writeTo) const = 0; + }; + + class ProductProvenanceRetriever : public ProductProvenanceLookup { + public: + explicit ProductProvenanceRetriever(unsigned int iTransitionIndex); + ProductProvenanceRetriever(unsigned int iTransitionIndex, edm::ProductRegistry const&); + explicit ProductProvenanceRetriever(std::unique_ptr reader); + + ProductProvenanceRetriever& operator=(ProductProvenanceRetriever const&) = delete; + + void mergeProvenanceRetrievers(std::shared_ptr other); + + void mergeParentProcessRetriever(ProductProvenanceRetriever const& provRetriever); + + void deepCopy(ProductProvenanceRetriever const&); + + void reset(); + + void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const* moduleCallingContext) const; + + private: + std::unique_ptr> readProvenance() const final; + const ProductProvenanceLookup* nextRetriever() const final { return nextRetriever_.get(); } + void setTransitionIndex(unsigned int transitionIndex) { transitionIndex_ = transitionIndex; } + + edm::propagate_const> nextRetriever_; + std::shared_ptr provenanceReader_; + unsigned int transitionIndex_; + }; + +} // namespace edm +#endif diff --git a/FWCore/Framework/src/ProductProvenanceRetriever.cc b/FWCore/Framework/src/ProductProvenanceRetriever.cc new file mode 100644 index 0000000000000..e59591779148e --- /dev/null +++ b/FWCore/Framework/src/ProductProvenanceRetriever.cc @@ -0,0 +1,90 @@ +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" +#include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "FWCore/Utilities/interface/EDMException.h" + +#include +#include + +/* + ProductProvenanceRetriever +*/ + +namespace edm { + ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex) + : ProductProvenanceLookup(), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {} + + ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex, + edm::ProductRegistry const& iReg) + : ProductProvenanceLookup(iReg), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {} + + ProductProvenanceRetriever::ProductProvenanceRetriever(std::unique_ptr reader) + : ProductProvenanceLookup(), + nextRetriever_(), + provenanceReader_(reader.release()), + transitionIndex_(std::numeric_limits::max()) { + assert(provenanceReader_); + } + + std::unique_ptr> ProductProvenanceRetriever::readProvenance() const { + std::unique_ptr> temp; + if (provenanceReader_) { + temp = std::make_unique const>(provenanceReader_->readProvenance(transitionIndex_)); + } + return temp; + } + + void ProductProvenanceRetriever::readProvenanceAsync(WaitingTaskHolder task, + ModuleCallingContext const* moduleCallingContext) const { + if (provenanceReader_ and nullptr == readEntryInfoSet_.load()) { + provenanceReader_->readProvenanceAsync(task, moduleCallingContext, transitionIndex_, readEntryInfoSet_); + } + if (nextRetriever_) { + nextRetriever_->readProvenanceAsync(task, moduleCallingContext); + } + } + + void ProductProvenanceRetriever::deepCopy(ProductProvenanceRetriever const& iFrom) { + if (iFrom.readEntryInfoSet_) { + if (readEntryInfoSet_) { + delete readEntryInfoSet_.exchange(nullptr); + } + readEntryInfoSet_ = new std::set(*iFrom.readEntryInfoSet_); + } else { + if (readEntryInfoSet_) { + delete readEntryInfoSet_.load(); + readEntryInfoSet_ = nullptr; + } + } + assert(iFrom.entryInfoSet_.empty()); + provenanceReader_ = iFrom.provenanceReader_; + + if (iFrom.nextRetriever_) { + if (not nextRetriever_) { + nextRetriever_ = std::make_shared(transitionIndex_); + } + nextRetriever_->deepCopy(*(iFrom.nextRetriever_)); + } + } + + void ProductProvenanceRetriever::reset() { + delete readEntryInfoSet_.load(); + readEntryInfoSet_ = nullptr; + for (auto& e : entryInfoSet_) { + e.resetParentage(); + } + if (nextRetriever_) { + nextRetriever_->reset(); + } + parentProcessRetriever_ = nullptr; + } + + void ProductProvenanceRetriever::mergeProvenanceRetrievers(std::shared_ptr other) { + nextRetriever_ = other; + } + + void ProductProvenanceRetriever::mergeParentProcessRetriever(ProductProvenanceRetriever const& provRetriever) { + parentProcessRetriever_ = &provRetriever; + } + + ProvenanceReaderBase::~ProvenanceReaderBase() {} +} // namespace edm diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index feadb5cdea5f4..93b7c793aef5e 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -11,7 +11,7 @@ #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/BranchKey.h" #include "DataFormats/Provenance/interface/ParentageRegistry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/FWCore/Framework/test/dependentrecord_t.cppunit.cc b/FWCore/Framework/test/dependentrecord_t.cppunit.cc index 5f9576d186282..04f792a61ac2b 100644 --- a/FWCore/Framework/test/dependentrecord_t.cppunit.cc +++ b/FWCore/Framework/test/dependentrecord_t.cppunit.cc @@ -38,6 +38,7 @@ #include #include #include +#include using namespace edm::eventsetup; diff --git a/FWCore/Integration/test/TestParentage.cc b/FWCore/Integration/test/TestParentage.cc index def68595eb017..cdde44a14f800 100644 --- a/FWCore/Integration/test/TestParentage.cc +++ b/FWCore/Integration/test/TestParentage.cc @@ -3,7 +3,7 @@ #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/Parentage.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" @@ -37,7 +37,7 @@ namespace { // ProductsResolver which for SubProcesses could lead to a different // retriever. In SubProcesses, the following function follows the // links in the retrievers themselves. Both should give the same answer. - void getAncestorsFromRetriever(edm::ProductProvenanceRetriever const* retriever, + void getAncestorsFromRetriever(edm::ProductProvenanceLookup const* retriever, edm::BranchID const& branchID, std::set& ancestors) { edm::ProductProvenance const* productProvenance = retriever->branchIDToProvenance(branchID); @@ -110,7 +110,7 @@ namespace edmtest { } } - edm::ProductProvenanceRetriever const* retriever = prov->store(); + auto const* retriever = prov->store(); std::set ancestorsFromRetriever; getAncestorsFromRetriever(retriever, prov->originalBranchID(), ancestorsFromRetriever); diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index ab4383d5d83bf..6d300b885ae5a 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -171,7 +171,8 @@ def __init__(self,*arg,**kargs): if len(arg) != 0: #raise ValueError("unnamed arguments are not allowed. Please use the syntax 'name = value' when assigning arguments.") for block in arg: - if type(block).__name__ != "PSet": + # Allow __PSet for testing + if type(block).__name__ not in ["PSet", "__PSet"]: raise ValueError("Only PSets can be passed as unnamed argument blocks. This is a "+type(block).__name__) self.__setParameters(block.parameters_()) self.__setParameters(kargs) @@ -386,7 +387,6 @@ def __init__(self,type_,*arg,**kargs): # arg = arg[1:] #else: # del args['type_'] - arg = tuple([x for x in arg if x != None]) super(_TypedParameterizable,self).__init__(*arg,**kargs) saveOrigin(self, 1) def _place(self,name,proc): @@ -397,11 +397,7 @@ def type_(self): def copy(self): returnValue =_TypedParameterizable.__new__(type(self)) params = self.parameters_() - args = list() - if len(params) == 0: - args.append(None) - returnValue.__init__(self.__type,*args, - **params) + returnValue.__init__(self.__type,**params) returnValue._isModified = self._isModified return returnValue def clone(self, *args, **params): @@ -418,9 +414,18 @@ def clone(self, *args, **params): """ returnValue =_TypedParameterizable.__new__(type(self)) myparams = self.parameters_() - if len(myparams) == 0 and len(params) and len(args): - args.append(None) - + + # Prefer parameters given in PSet blocks over those in clone-from module + for block in args: + # Allow __PSet for testing + if type(block).__name__ not in ["PSet", "__PSet"]: + raise ValueError("Only PSets can be passed as unnamed argument blocks. This is a "+type(block).__name__) + for name in block.parameterNames_(): + try: + del myparams[name] + except KeyError: + pass + _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr) if self._Parameterizable__validator is not None: myparams["allowAnyLabel_"] = self._Parameterizable__validator @@ -677,9 +682,10 @@ def dumpPython(self, options=PrintOptions()): if i == 0: if n>nPerLine: result += '\n'+options.indentation() else: - result += ', ' if i % nPerLine == 0: - result += '\n'+options.indentation() + result += ',\n'+options.indentation() + else: + result += ', ' result += self.pythonValueForItem(v,options) if n>nPerLine: options.unindent() @@ -795,6 +801,25 @@ def __init__(self): def testUsingBlock(self): a = UsingBlock("a") self.assert_(isinstance(a, _ParameterTypeBase)) + def testConstruction(self): + class __Test(_TypedParameterizable): + pass + class __TestType(_SimpleParameterTypeBase): + def _isValid(self,value): + return True + class __PSet(_ParameterTypeBase,_Parameterizable): + def __init__(self,*arg,**args): + #need to call the inits separately + _ParameterTypeBase.__init__(self) + _Parameterizable.__init__(self,*arg,**args) + + a = __Test("MyType", __PSet(a=__TestType(1))) + self.assertEqual(a.a.value(), 1) + b = __Test("MyType", __PSet(a=__TestType(1)), __PSet(b=__TestType(2))) + self.assertEqual(b.a.value(), 1) + self.assertEqual(b.b.value(), 2) + self.assertRaises(ValueError, lambda: __Test("MyType", __PSet(a=__TestType(1)), __PSet(a=__TestType(2)))) + def testCopy(self): class __Test(_TypedParameterizable): pass @@ -805,6 +830,11 @@ def _isValid(self,value): b = a.copy() self.assertEqual(b.t.value(),1) self.assertEqual(b.u.value(),2) + + c = __Test("MyType") + self.assertEqual(len(c.parameterNames_()), 0) + d = c.copy() + self.assertEqual(len(d.parameterNames_()), 0) def testClone(self): class __Test(_TypedParameterizable): pass @@ -816,6 +846,9 @@ def __init__(self,*arg,**args): #need to call the inits separately _ParameterTypeBase.__init__(self) _Parameterizable.__init__(self,*arg,**args) + def dumpPython(self,options=PrintOptions()): + return "__PSet(\n"+_Parameterizable.dumpPython(self, options)+options.indentation()+")" + a = __Test("MyType", t=__TestType(1), u=__TestType(2), @@ -842,7 +875,32 @@ def __init__(self,*arg,**args): self.assertEqual(hasattr(b,"w"), False) self.assertEqual(hasattr(c.x,"a"), False) self.assertEqual(hasattr(c.x,"c"), False) - self.assertRaises(TypeError,a.clone,None,**{"v":1}) + self.assertRaises(TypeError,a.clone,**{"v":1}) + d = a.clone(__PSet(k=__TestType(42))) + self.assertEqual(d.t.value(), 1) + self.assertEqual(d.k.value(), 42) + d2 = a.clone(__PSet(t=__TestType(42))) + self.assertEqual(d2.t.value(), 42) + d3 = a.clone(__PSet(t=__TestType(42)), + __PSet(u=__TestType(56))) + self.assertEqual(d3.t.value(), 42) + self.assertEqual(d3.u.value(), 56) + self.assertRaises(ValueError,a.clone, + __PSet(t=__TestType(42)), + __PSet(t=__TestType(56))) + d4 = a.clone(__PSet(t=__TestType(43)), u = 57) + self.assertEqual(d4.t.value(), 43) + self.assertEqual(d4.u.value(), 57) + self.assertRaises(TypeError,a.clone,t=__TestType(43),**{"doesNotExist":57}) + + e = __Test("MyType") + self.assertEqual(len(e.parameterNames_()), 0) + f = e.clone(__PSet(a = __TestType(1)), b = __TestType(2)) + self.assertEqual(f.a.value(), 1) + self.assertEqual(f.b.value(), 2) + g = e.clone() + self.assertEqual(len(g.parameterNames_()), 0) + def testModified(self): class __TestType(_SimpleParameterTypeBase): def _isValid(self,value): diff --git a/FWCore/PluginManager/interface/PluginFactoryBase.h b/FWCore/PluginManager/interface/PluginFactoryBase.h index 67577ae3beeaa..ce61339e3dbee 100644 --- a/FWCore/PluginManager/interface/PluginFactoryBase.h +++ b/FWCore/PluginManager/interface/PluginFactoryBase.h @@ -26,7 +26,7 @@ #include #include "tbb/concurrent_unordered_map.h" #include "tbb/concurrent_vector.h" - +#include "FWCore/Utilities/interface/zero_allocator.h" #include "FWCore/Utilities/interface/Signal.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" // user include files @@ -61,7 +61,7 @@ namespace edmplugin { std::atomic m_ptr; }; - typedef tbb::concurrent_vector> PMakers; + typedef tbb::concurrent_vector> PMakers; typedef tbb::concurrent_unordered_map Plugins; // ---------- const member functions --------------------- diff --git a/FWCore/Services/plugins/InitRootHandlers.cc b/FWCore/Services/plugins/InitRootHandlers.cc index 6d16975ca11f8..d7425d712b855 100644 --- a/FWCore/Services/plugins/InitRootHandlers.cc +++ b/FWCore/Services/plugins/InitRootHandlers.cc @@ -76,7 +76,7 @@ namespace edm { public: typedef tbb::concurrent_unordered_set Container_type; - ThreadTracker() : tbb::task_scheduler_observer(true) { observe(true); } + ThreadTracker() : tbb::task_scheduler_observer() { observe(); } ~ThreadTracker() override = default; void on_scheduler_entry(bool) override { diff --git a/FWCore/Services/plugins/StallMonitor.cc b/FWCore/Services/plugins/StallMonitor.cc index a1ea21a03bc67..536834e958016 100644 --- a/FWCore/Services/plugins/StallMonitor.cc +++ b/FWCore/Services/plugins/StallMonitor.cc @@ -24,7 +24,7 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/OStreamColumn.h" #include "FWCore/Utilities/interface/Exception.h" - +#include "FWCore/Utilities/interface/StdPairHasher.h" #include "tbb/concurrent_unordered_map.h" #include @@ -227,7 +227,9 @@ namespace edm { // for this purpose. using StreamID_value = decltype(std::declval().value()); using ModuleID = decltype(std::declval().id()); - tbb::concurrent_unordered_map, std::pair> + tbb::concurrent_unordered_map, + std::pair, + edm::StdPairHasher> stallStart_{}; std::vector moduleLabels_{}; diff --git a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc index 165d6fb1fa573..01bdada2fa949 100644 --- a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc +++ b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc @@ -20,7 +20,7 @@ #include "DataFormats/Provenance/interface/BranchIDList.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/BranchListIndex.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/BranchType.h" #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "DataFormats/Provenance/interface/EventEntryDescription.h" // kludge to allow compilation diff --git a/FWCore/Utilities/interface/StdPairHasher.h b/FWCore/Utilities/interface/StdPairHasher.h new file mode 100644 index 0000000000000..b61cc5ce57346 --- /dev/null +++ b/FWCore/Utilities/interface/StdPairHasher.h @@ -0,0 +1,18 @@ +#ifndef FWCore_Utilities_std_pair_hasher_h +#define FWCore_Utilities_std_pair_hasher_h +/* + tbb::hash was changed to used std::hash which does not have an implementation for std::pair. +*/ +#include "FWCore/Utilities/interface/hash_combine.h" + +namespace edm { + struct StdPairHasher { + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + }; +} // namespace edm +#endif diff --git a/FWCore/Utilities/interface/hash_combine.h b/FWCore/Utilities/interface/hash_combine.h index 775e062a2ac92..d2639df973c02 100644 --- a/FWCore/Utilities/interface/hash_combine.h +++ b/FWCore/Utilities/interface/hash_combine.h @@ -38,6 +38,6 @@ namespace edm { hash_combine(seed, args...); return seed; } -} // namespace edm +} // namespace edm #endif diff --git a/FWCore/Utilities/interface/zero_allocator.h b/FWCore/Utilities/interface/zero_allocator.h new file mode 100644 index 0000000000000..85dbfaf87a67a --- /dev/null +++ b/FWCore/Utilities/interface/zero_allocator.h @@ -0,0 +1,61 @@ +#ifndef FWCore_Utilities_zero_allocator_h +#define FWCore_Utilities_zero_allocator_h +/* + Copyright (c) 2005-2020 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "tbb/tbb_allocator.h" +#include + +/* Copied from tbb_2020 branch's tbb/tbb_allocator linked here + https://github.com/oneapi-src/oneTBB/blob/tbb_2020/include/tbb/tbb_allocator.h + and renamed to edm namespace because it was removed from oneapi_2021 branch's + tbb/tbb_allocator. + */ + +namespace edm { + template class Allocator = tbb::tbb_allocator> + class zero_allocator : public Allocator { + public: + using value_type = T; + using base_allocator_type = Allocator; + template + struct rebind { + typedef zero_allocator other; + }; + + zero_allocator() throw() {} + zero_allocator(const zero_allocator &a) throw() : base_allocator_type(a) {} + template + zero_allocator(const zero_allocator &a) throw() : base_allocator_type(Allocator(a)) {} + + T *allocate(const std::size_t n, const void *hint = nullptr) { + //T* ptr = base_allocator_type::allocate( n, hint ); + T *ptr = base_allocator_type::allocate(n); + std::memset(static_cast(ptr), 0, n * sizeof(value_type)); + return ptr; + } + }; + + template class B1, typename T2, template class B2> + inline bool operator==(const zero_allocator &a, const zero_allocator &b) { + return static_cast >(a) == static_cast >(b); + } + template class B1, typename T2, template class B2> + inline bool operator!=(const zero_allocator &a, const zero_allocator &b) { + return static_cast >(a) != static_cast >(b); + } +} // namespace edm +#endif diff --git a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc index 0d1063be2bb4b..4d14f4b3e4338 100644 --- a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc +++ b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc @@ -230,17 +230,8 @@ bool AMPTHadronizer::get_particles(HepMC::GenEvent* evt) { bool AMPTHadronizer::call_amptset( double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt) { // initialize hydjet - AMPTSET(efrm, - frame.data(), - proj.data(), - targ.data(), - iap, - izp, - iat, - izt, - strlen(frame.data()), - strlen(proj.data()), - strlen(targ.data())); + AMPTSET( + efrm, frame.data(), proj.data(), targ.data(), iap, izp, iat, izt, frame.length(), proj.length(), targ.length()); return true; } //______________________________________________________________________ diff --git a/GeneratorInterface/Herwig7Interface/python/Herwig7_Standalone_DYLO_cff.py b/GeneratorInterface/Herwig7Interface/python/DYToLL_TuneCH3_13TeV_herwig7_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/Herwig7_Standalone_DYLO_cff.py rename to GeneratorInterface/Herwig7Interface/python/DYToLL_TuneCH3_13TeV_herwig7_cff.py diff --git a/GeneratorInterface/Herwig7Interface/python/Herwig7_Matchbox_ppToee_cff.py b/GeneratorInterface/Herwig7Interface/python/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/Herwig7_Matchbox_ppToee_cff.py rename to GeneratorInterface/Herwig7Interface/python/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py diff --git a/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py new file mode 100644 index 0000000000000..7450a6fdc2835 --- /dev/null +++ b/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py @@ -0,0 +1,264 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py --conditions auto:run2_mc -s LHE,GEN --datatier LHE,GEN -n 10 --eventcontent LHE,RAWSIM --no_exec +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('GEN') + +# 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.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_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("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(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.LHEoutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('LHE'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff_py_LHE_GEN.root'), + outputCommands = process.LHEEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.RAWSIMoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(1), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN'), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(20971520), + fileName = cms.untracked.string('DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff_py_LHE_GEN_inRAWSIM.root'), + outputCommands = process.RAWSIMEventContent.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:run2_mc', '') + +process.generator = cms.EDFilter("Herwig7GeneratorFilter", + configFiles = cms.vstring(), + crossSection = cms.untracked.double(-1), + dataLocation = cms.string('${HERWIGPATH:-6}'), + eventHandlers = cms.string('/Herwig/EventHandlers'), + filterEfficiency = cms.untracked.double(1.0), + generatorModule = cms.string('/Herwig/Generators/EventGenerator'), + herwig7CH3AlphaS = cms.vstring( + 'cd /Herwig/Shower', + 'set AlphaQCD:AlphaIn 0.118', + 'cd /' + ), + herwig7CH3MPISettings = cms.vstring( + 'set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.4712', + 'set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.04', + 'set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.284', + 'set /Herwig/UnderlyingEvent/MPIHandler:Power 0.1362' + ), + herwig7CH3PDF = cms.vstring( + 'cd /Herwig/Partons', + 'create ThePEG::LHAPDF PDFSet_nnlo ThePEGLHAPDF.so', + 'set PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118.LHgrid', + 'set PDFSet_nnlo:RemnantHandler HadronRemnants', + 'set /Herwig/Particles/p+:PDF PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB PDFSet_nnlo', + 'create ThePEG::LHAPDF PDFSet_lo ThePEGLHAPDF.so', + 'set PDFSet_lo:PDFName NNPDF31_lo_as_0130.LHgrid', + 'set PDFSet_lo:RemnantHandler HadronRemnants', + 'set /Herwig/Shower/ShowerHandler:PDFARemnant PDFSet_lo', + 'set /Herwig/Shower/ShowerHandler:PDFBRemnant PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:FirstPDF PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:SecondPDF PDFSet_lo', + 'cd /' + ), + herwig7StableParticlesForDetector = cms.vstring( + 'set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm', + 'set /Herwig/Decays/DecayHandler:LifeTimeOption Average' + ), + hw_mg_merging_settings = cms.vstring( + 'cd /Herwig/EventHandlers', + 'library HwFxFx.so', + 'create Herwig::FxFxEventHandler LesHouchesHandler', + 'set LesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor', + 'set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler', + 'set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler', + 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', + 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', + 'cd /Herwig/EventHandlers', + 'create Herwig::FxFxFileReader FxFxLHReader', + 'insert LesHouchesHandler:FxFxReaders[0] FxFxLHReader', + 'cd /Herwig/Shower', + 'library HwFxFxHandler.so', + 'create Herwig::FxFxHandler FxFxHandler', + 'set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator', + 'set /Herwig/Shower/FxFxHandler:KinematicsReconstructor /Herwig/Shower/KinematicsReconstructor', + 'set /Herwig/Shower/FxFxHandler:PartnerFinder /Herwig/Shower/PartnerFinder', + 'set /Herwig/EventHandlers/LesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler', + 'set /Herwig/Partons/PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118', + 'set /Herwig/Partons/RemnantDecayer:AllowTop Yes', + 'set /Herwig/Partons/PDFSet_nnlo:RemnantHandler /Herwig/Partons/HadronRemnants', + 'set /Herwig/Particles/p+:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:FileName cmsgrid_final.lhe', + 'set /Herwig/EventHandlers/FxFxLHReader:WeightWarnings false', + 'set /Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen No', + 'set /Herwig/EventHandlers/FxFxLHReader:InitPDFs 0', + 'set /Herwig/EventHandlers/FxFxLHReader:Cuts /Herwig/Cuts/NoCuts', + 'set /Herwig/EventHandlers/FxFxLHReader:MomentumTreatment RescaleEnergy', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes', + 'set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes', + 'set /Herwig/Shower/PartnerFinder:PartnerMethod Random', + 'set /Herwig/Shower/PartnerFinder:ScaleChoice Partner', + 'set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost', + 'set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General', + 'set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity', + 'set /Herwig/Shower/ShowerHandler:SpinCorrelations Yes', + 'cd /Herwig/Shower', + 'set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler', + 'set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer', + 'set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD', + 'set FxFxHandler:HeavyQVeto Yes', + 'set FxFxHandler:HardProcessDetection Automatic', + 'set FxFxHandler:drjmin 0', + 'cd /Herwig/Shower', + 'set FxFxHandler:VetoIsTurnedOff VetoingIsOn', + 'set FxFxHandler:ETClus 20*GeV', + 'set FxFxHandler:RClus 1.0', + 'set FxFxHandler:EtaClusMax 10', + 'set FxFxHandler:RClusFactor 1.5' + ), + hw_user_settings = cms.vstring( + 'set FxFxHandler:MergeMode TreeMG5', + 'set FxFxHandler:njetsmax 4' + ), + parameterSets = cms.vstring( + 'herwig7CH3PDF', + 'herwig7CH3AlphaS', + 'herwig7CH3MPISettings', + 'herwig7StableParticlesForDetector', + 'hw_mg_merging_settings', + 'hw_user_settings' + ), + repository = cms.string('${HERWIGPATH}/HerwigDefaults.rpo'), + run = cms.string('InterfaceMatchboxTest'), + runModeList = cms.untracked.string('read,run'), + seed = cms.untracked.int32(12345) +) + + +process.externalLHEProducer = cms.EDProducer("ExternalLHEProducer", + args = cms.vstring( + '/cvmfs/cms.cern.ch/phys_generator/gridpacks/UL/13TeV/madgraph/V5_2.6.5/dyellell01234j_5f_LO_MLM_v2/DYJets_HT-incl_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', + 'false', + 'slc6_amd64_gcc630', + 'CMSSW_9_3_16' + ), + nEvents = cms.untracked.uint32(10), + numberOfParameters = cms.uint32(4), + outputFile = cms.string('cmsgrid_final.lhe'), + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.lhe_step = cms.Path(process.externalLHEProducer) +process.generation_step = cms.Path(process.pgen) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.LHEoutput_step = cms.EndPath(process.LHEoutput) +process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,process.endjob_step,process.LHEoutput_step,process.RAWSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + if path in ['lhe_step']: continue + 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 diff --git a/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py new file mode 100644 index 0000000000000..52d0f5a028b83 --- /dev/null +++ b/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py @@ -0,0 +1,259 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py --conditions auto:run2_mc -s LHE,GEN --datatier LHE,GEN -n 10 --eventcontent LHE,RAWSIM --no_exec +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('GEN') + +# 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.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_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("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(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.LHEoutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('LHE'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff_py_LHE_GEN.root'), + outputCommands = process.LHEEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.RAWSIMoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(1), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN'), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(20971520), + fileName = cms.untracked.string('DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff_py_LHE_GEN_inRAWSIM.root'), + outputCommands = process.RAWSIMEventContent.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:run2_mc', '') + +process.generator = cms.EDFilter("Herwig7GeneratorFilter", + configFiles = cms.vstring(), + crossSection = cms.untracked.double(-1), + dataLocation = cms.string('${HERWIGPATH:-6}'), + eventHandlers = cms.string('/Herwig/EventHandlers'), + filterEfficiency = cms.untracked.double(1.0), + generatorModule = cms.string('/Herwig/Generators/EventGenerator'), + herwig7CH3AlphaS = cms.vstring( + 'cd /Herwig/Shower', + 'set AlphaQCD:AlphaIn 0.118', + 'cd /' + ), + herwig7CH3MPISettings = cms.vstring( + 'set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.4712', + 'set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.04', + 'set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.284', + 'set /Herwig/UnderlyingEvent/MPIHandler:Power 0.1362' + ), + herwig7CH3PDF = cms.vstring( + 'cd /Herwig/Partons', + 'create ThePEG::LHAPDF PDFSet_nnlo ThePEGLHAPDF.so', + 'set PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118.LHgrid', + 'set PDFSet_nnlo:RemnantHandler HadronRemnants', + 'set /Herwig/Particles/p+:PDF PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB PDFSet_nnlo', + 'create ThePEG::LHAPDF PDFSet_lo ThePEGLHAPDF.so', + 'set PDFSet_lo:PDFName NNPDF31_lo_as_0130.LHgrid', + 'set PDFSet_lo:RemnantHandler HadronRemnants', + 'set /Herwig/Shower/ShowerHandler:PDFARemnant PDFSet_lo', + 'set /Herwig/Shower/ShowerHandler:PDFBRemnant PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:FirstPDF PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:SecondPDF PDFSet_lo', + 'cd /' + ), + herwig7StableParticlesForDetector = cms.vstring( + 'set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm', + 'set /Herwig/Decays/DecayHandler:LifeTimeOption Average' + ), + hw_mg_merging_settings = cms.vstring( + 'cd /Herwig/EventHandlers', + 'library HwFxFx.so', + 'create Herwig::FxFxEventHandler LesHouchesHandler', + 'set LesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor', + 'set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler', + 'set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler', + 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', + 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', + 'cd /Herwig/EventHandlers', + 'create Herwig::FxFxFileReader FxFxLHReader', + 'insert LesHouchesHandler:FxFxReaders[0] FxFxLHReader', + 'cd /Herwig/Shower', + 'library HwFxFxHandler.so', + 'create Herwig::FxFxHandler FxFxHandler', + 'set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator', + 'set /Herwig/Shower/FxFxHandler:KinematicsReconstructor /Herwig/Shower/KinematicsReconstructor', + 'set /Herwig/Shower/FxFxHandler:PartnerFinder /Herwig/Shower/PartnerFinder', + 'set /Herwig/EventHandlers/LesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler', + 'set /Herwig/Partons/PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118', + 'set /Herwig/Partons/RemnantDecayer:AllowTop Yes', + 'set /Herwig/Partons/PDFSet_nnlo:RemnantHandler /Herwig/Partons/HadronRemnants', + 'set /Herwig/Particles/p+:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:FileName cmsgrid_final.lhe', + 'set /Herwig/EventHandlers/FxFxLHReader:WeightWarnings false', + 'set /Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen No', + 'set /Herwig/EventHandlers/FxFxLHReader:InitPDFs 0', + 'set /Herwig/EventHandlers/FxFxLHReader:Cuts /Herwig/Cuts/NoCuts', + 'set /Herwig/EventHandlers/FxFxLHReader:MomentumTreatment RescaleEnergy', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes', + 'set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes', + 'set /Herwig/Shower/PartnerFinder:PartnerMethod Random', + 'set /Herwig/Shower/PartnerFinder:ScaleChoice Partner', + 'set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost', + 'set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General', + 'set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity', + 'set /Herwig/Shower/ShowerHandler:SpinCorrelations Yes', + 'cd /Herwig/Shower', + 'set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler', + 'set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer', + 'set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD', + 'set FxFxHandler:HeavyQVeto Yes', + 'set FxFxHandler:HardProcessDetection Automatic', + 'set FxFxHandler:drjmin 0', + 'cd /Herwig/Shower', + 'set FxFxHandler:VetoIsTurnedOff VetoingIsOn', + 'set FxFxHandler:ETClus 20*GeV', + 'set FxFxHandler:RClus 1.0', + 'set FxFxHandler:EtaClusMax 10', + 'set FxFxHandler:RClusFactor 1.5' + ), + hw_user_settings = cms.vstring( + 'set FxFxHandler:MergeMode FxFx', + 'set FxFxHandler:njetsmax 2' + ), + parameterSets = cms.vstring( + 'herwig7CH3PDF', + 'herwig7CH3AlphaS', + 'herwig7CH3MPISettings', + 'herwig7StableParticlesForDetector', + 'hw_mg_merging_settings', + 'hw_user_settings' + ), + repository = cms.string('${HERWIGPATH}/HerwigDefaults.rpo'), + run = cms.string('InterfaceMatchboxTest'), + runModeList = cms.untracked.string('read,run'), + seed = cms.untracked.int32(12345) +) + + +process.externalLHEProducer = cms.EDProducer("ExternalLHEProducer", + args = cms.vstring('/cvmfs/cms.cern.ch/phys_generator/gridpacks/2017/13TeV/madgraph/V5_2.6.1/DYellell012j_5f_NLO_FXFX/dyellell012j_5f_NLO_FXFX_slc7_amd64_gcc700_CMSSW_10_6_4_tarball.tar.xz'), + nEvents = cms.untracked.uint32(10), + numberOfParameters = cms.uint32(1), + outputFile = cms.string('cmsgrid_final.lhe'), + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.lhe_step = cms.Path(process.externalLHEProducer) +process.generation_step = cms.Path(process.pgen) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.LHEoutput_step = cms.EndPath(process.LHEoutput) +process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,process.endjob_step,process.LHEoutput_step,process.RAWSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + if path in ['lhe_step']: continue + 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 diff --git a/GeneratorInterface/Herwig7Interface/test/Herwig7_Standalone_DYLO_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL_TuneCH3_13TeV_herwig7_cfg.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/test/Herwig7_Standalone_DYLO_cfg.py rename to GeneratorInterface/Herwig7Interface/test/DYToLL_TuneCH3_13TeV_herwig7_cfg.py diff --git a/GeneratorInterface/Herwig7Interface/test/Herwig7_Matchbox_ppToee_cfg.py b/GeneratorInterface/Herwig7Interface/test/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/test/Herwig7_Matchbox_ppToee_cfg.py rename to GeneratorInterface/Herwig7Interface/test/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index e6c8e6511e3e7..195af9f807e00 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -17,21 +17,22 @@ Description: [one line class summary] // // system include files +#include "tbb/task_arena.h" +#include "tbb/task_group.h" #include +#include #include #include #include #include #include #include +#include +#include +#include #include #include #include -#include -#include -#include -#include "tbb/task_arena.h" -#include "tbb/task_group.h" #include "boost/ptr_container/ptr_deque.hpp" @@ -330,10 +331,16 @@ void ExternalLHEProducer::beginRun(edm::Run const& run, edm::EventSetup const& e void ExternalLHEProducer::endRun(edm::Run const& run, edm::EventSetup const& es) { nextEvent(); if (partonLevel_) { - throw edm::Exception(edm::errors::EventGenerationFailure) - << "Error in ExternalLHEProducer::endRunProduce(). " - << "Event loop is over, but there are still lhe events to process." - << "This could happen if lhe file contains more events than requested. This is never expected to happen."; + // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT + if (std::getenv("VALIDATION_RUN") != nullptr) { + edm::LogWarning("ExternalLHEProducer") + << "Event loop is over, but there are still lhe events to process, ignoring..."; + } else { + throw edm::Exception(edm::errors::EventGenerationFailure) + << "Error in ExternalLHEProducer::endRunProduce(). " + << "Event loop is over, but there are still lhe events to process." + << "This could happen if lhe file contains more events than requested. This is never expected to happen."; + } } reader_.reset(); diff --git a/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h b/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h new file mode 100644 index 0000000000000..0f3ba7d035c1a --- /dev/null +++ b/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h @@ -0,0 +1,53 @@ +#ifndef Geometry_EcalCommonDatao_DDEcalEndcapTrapX_h +#define Geometry_EcalCommonDatao_DDEcalEndcapTrapX_h + +#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DetectorDescription/DDCMS/interface/DDRotationMatrix.h" +#include "DetectorDescription/DDCMS/interface/DDTranslation.h" + +// Define Endcap Supercrystal class + +class DDEcalEndcapTrapX { +public: + DDEcalEndcapTrapX(const int hand, const double front, const double rear, const double length); + DDEcalEndcapTrapX() = delete; + + void rotate(const DDRotationMatrix& rot); + void translate(const DDTranslation& trans); + + void rotateX(const double angle); + void rotateY(const double angle); + void translate(); + void moveto(const DDTranslation& frontCentre, const DDTranslation& rearCentre); + double elevationAngle(const DDTranslation& trans); + double polarAngle(const DDTranslation& trans); + double elevationAngle(); + double polarAngle(); + DDTranslation cornerPos(const int icorner); + void cornerPos(const int icorner, const DDTranslation& cc); + DDTranslation centrePos(); + DDTranslation fcentrePos(); + DDTranslation rcentrePos(); + void calculateCorners(); + void calculateCentres(); + DDRotationMatrix rotation() { return m_rotation; } + void print(); + +private: + DDRotationMatrix m_rotation; + DDTranslation m_translation; + + double m_centre[4]; + double m_fcentre[4]; + double m_rcentre[4]; + double m_corners[25]; + double m_front; + double m_rear; + double m_length; + + int m_hand; + int m_update; +}; + +#endif diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc index e8efe7e37608c..b612ed4406a08 100644 --- a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc @@ -4,7 +4,7 @@ #include "DetectorDescription/DDCMS/interface/DDutils.h" #include "DataFormats/Math/interface/angle_units.h" // Header files for endcap supercrystal geometry -#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrap.h" +#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h" #include #include @@ -12,9 +12,6 @@ using namespace angle_units::operators; -using DDTranslation = ROOT::Math::DisplacementVector3D >; -using DDRotation = ROOT::Math::Rotation3D; - //#define EDM_ML_DEBUG namespace { @@ -77,7 +74,7 @@ namespace { double zFront; }; - const DDRotation& myrot(cms::DDNamespace& ns, const std::string& nam, const DDRotation& r) { + const DDRotationMatrix& myrot(cms::DDNamespace& ns, const std::string& nam, const DDRotationMatrix& r) { ns.addRotation(nam, r); return ns.rotation(ns.prepend(nam)); } @@ -308,18 +305,18 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext const CLHEP::HepRotationZ cutm(ffived); - DDRotation cutRot(5 != iSCType ? DDRotation() - : myrot(ns, - "EECry5Rot", - DDRotation(cutm.xx(), - cutm.xy(), - cutm.xz(), - cutm.yx(), - cutm.yy(), - cutm.yz(), - cutm.zx(), - cutm.zy(), - cutm.zz()))); + DDRotationMatrix cutRot(5 != iSCType ? DDRotationMatrix() + : myrot(ns, + "EECry5Rot", + DDRotationMatrix(cutm.xx(), + cutm.xy(), + cutm.xz(), + cutm.yx(), + cutm.yy(), + cutm.yz(), + cutm.zx(), + cutm.zy(), + cutm.zz()))); dd4hep::Solid eeCutEnv = dd4hep::SubtractionSolid(ee.envName + std::to_string(iSCType), ns.solid(ee.envName + std::to_string(iSCType) + "Tmp"), @@ -390,9 +387,9 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext if (imax > 0) { // Loop over crystals in this row for (int irow(imin); irow <= imax; ++irow) { - // Create crystal as a DDEcalEndcapTrap object and calculate rotation and + // Create crystal as a DDEcalEndcapTrapX object and calculate rotation and // translation required to position it in the SC. - DDEcalEndcapTrap crystal(1, ee.crysFront, ee.crysRear, ee.crysLength); + DDEcalEndcapTrapX crystal(1, ee.crysFront, ee.crysRear, ee.crysLength); crystal.moveto(ee.cryFCtr[icol - 1][irow - 1], ee.cryRCtr[icol - 1][irow - 1]); @@ -434,9 +431,9 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext } } - // Create SC as a DDEcalEndcapTrap object and calculate rotation and + // Create SC as a DDEcalEndcapTrapX object and calculate rotation and // translation required to position it in the endcap. - DDEcalEndcapTrap scrys(1, ee.sCEFront, ee.sCERear, ee.sCELength); + DDEcalEndcapTrapX scrys(1, ee.sCEFront, ee.sCERear, ee.sCELength); scrys.moveto(ee.scrFCtr[icol - 1][irow - 1], ee.scrRCtr[icol - 1][irow - 1]); scrys.translate(DDTranslation(0., 0., -ee.zOff)); diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc index d8890fe61370f..6e8b2ba626315 100644 --- a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc @@ -7,6 +7,8 @@ #include "CLHEP/Geometry/Transform3D.h" #include "CLHEP/Vector/EulerAngles.h" +//#define EDM_ML_DEBUG + // Implementation of DDEcalEndcapTrap class DDEcalEndcapTrap::DDEcalEndcapTrap(const int hand, const double front, const double rear, const double length) { @@ -87,8 +89,7 @@ void DDEcalEndcapTrap::rotate(const DDTranslation& frontCentre, const DDTranslat // // Rotate supercrystal to bring front and rear face centres to specified points // - edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented" - << std::endl; + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented"; } void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { @@ -98,12 +99,18 @@ void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { int icorner; DDTranslation cc; - // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot; +#endif for (icorner = 1; icorner <= 8; icorner++) { cc = cornerPos(icorner); - // edm::LogInfo("EcalGeom") << " Corner (orig) " << icorner << cc << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc; +#endif cc = rot * cc; - // edm::LogInfo("EcalGeom") << " Corner (rot) " << icorner << cc << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc; +#endif cornerPos(icorner, cc); } m_rotation = rot * m_rotation; @@ -111,7 +118,9 @@ void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { } void DDEcalEndcapTrap::translate() { - // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented" << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented"; +#endif translate(-1. * centrePos()); } @@ -141,16 +150,22 @@ void DDEcalEndcapTrap::moveto(const DDTranslation& frontCentre, const DDTranslat double targetPhi = polarAngle(frontCentre - rearCentre); // Rotate to correct angle (X then Y) - // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: rearCentre " << rearCentre << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl + << "moveto: rearCentre " << rearCentre << std::endl + << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " + << targetTheta - currentTheta << std::endl + << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " + << " " << targetPhi - currentPhi; +#endif rotateX(targetTheta - currentTheta); rotateY(targetPhi - currentPhi); // Translate SC to final position DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); - // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos(); +#endif translate(targetCentre - centrePos()); } @@ -274,12 +289,12 @@ void DDEcalEndcapTrap::print() { // // Print SC coordinates for debugging // - edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl; + edm::LogVerbatim("EcalGeom") << "Endcap supercrystal"; for (int ic = 1; ic <= 8; ic++) { DDTranslation cc = cornerPos(ic); - edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl; + edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc; } - edm::LogInfo("EcalGeom") << " Centre " << centrePos() << std::endl; - edm::LogInfo("EcalGeom") << " fCentre " << fcentrePos() << std::endl; - edm::LogInfo("EcalGeom") << " rCentre " << rcentrePos() << std::endl; + edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); } diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc new file mode 100644 index 0000000000000..7473b7043d6b7 --- /dev/null +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc @@ -0,0 +1,279 @@ +#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h" +#include "CLHEP/Geometry/Transform3D.h" + +//#define EDM_ML_DEBUG +// Implementation of DDEcalEndcapTrapX class + +DDEcalEndcapTrapX::DDEcalEndcapTrapX(const int hand, const double front, const double rear, const double length) { + // + // Initialise corners of supercrystal. + + // Start out with bottom surface on (x,z) plane, front face in (x,y) plane. + + double xsign; + + if (hand == 2) { + xsign = -1.; + } else { + xsign = 1.; + } + + m_hand = hand; + m_front = front; + m_rear = rear; + m_length = length; + + int icorner; + icorner = 1; + m_corners[3 * icorner - 3] = xsign * front; + m_corners[3 * icorner - 2] = front; + m_corners[3 * icorner - 1] = 0.; + icorner = 2; + m_corners[3 * icorner - 3] = xsign * front; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = 0.; + icorner = 3; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = 0.; + icorner = 4; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = front; + m_corners[3 * icorner - 1] = 0.; + + icorner = 5; + m_corners[3 * icorner - 3] = xsign * rear; + m_corners[3 * icorner - 2] = rear; + m_corners[3 * icorner - 1] = length; + icorner = 6; + m_corners[3 * icorner - 3] = xsign * rear; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = length; + icorner = 7; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = length; + icorner = 8; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = rear; + m_corners[3 * icorner - 1] = length; + + calculateCentres(); + + // Move centre of SC to (0,0,0) + + translate(); + + // Rotate into standard position (face centres on z axis) + + // this->rotate(); + + calculateCentres(); +} + +void DDEcalEndcapTrapX::rotate(const DDRotationMatrix& rot) { + // + // Rotate supercrystal by specified rotation about (0,0,0) + // + + int icorner; + DDTranslation cc; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::rotate - rotation " << rot; +#endif + for (icorner = 1; icorner <= 8; icorner++) { + cc = cornerPos(icorner); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc; +#endif + cc = rot * cc; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc; +#endif + cornerPos(icorner, cc); + } + m_rotation = rot * m_rotation; + calculateCentres(); +} + +void DDEcalEndcapTrapX::translate() { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::translate() not yet implemented"; +#endif + translate(-1. * centrePos()); +} + +void DDEcalEndcapTrapX::translate(const DDTranslation& trans) { + // + // Translate supercrystal by specified amount + // + + DDTranslation tcorner; + for (int icorner = 1; icorner <= 8; icorner++) { + tcorner = cornerPos(icorner) + trans; + cornerPos(icorner, tcorner); + } + calculateCentres(); + m_translation = trans + m_translation; +} + +void DDEcalEndcapTrapX::moveto(const DDTranslation& frontCentre, const DDTranslation& rearCentre) { + // + // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points + // + + // Get azimuthal and polar angles of current axis and target axis + double currentTheta = elevationAngle(); + double currentPhi = polarAngle(); + double targetTheta = elevationAngle(frontCentre - rearCentre); + double targetPhi = polarAngle(frontCentre - rearCentre); + + // Rotate to correct angle (X then Y) +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl + << "moveto: rearCentre " << rearCentre << std::endl + << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " + << targetTheta - currentTheta << std::endl + << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " + << " " << targetPhi - currentPhi << std::endl; +#endif + rotateX(targetTheta - currentTheta); + rotateY(targetPhi - currentPhi); + + // Translate SC to final position + DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos(); +#endif + translate(targetCentre - centrePos()); +} + +void DDEcalEndcapTrapX::rotateX(const double angle) { + // + // Rotate SC through given angle about X axis + // + + const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(1., 0., 0.), angle); + + rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz())); +} + +void DDEcalEndcapTrapX::rotateY(const double angle) { + // + // Rotate SC through given angle about Y axis + // + const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(0., 1., 0.), angle); + + rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz())); +} + +void DDEcalEndcapTrapX::calculateCentres() { + // + // Calculate crystal centre and front & rear face centres + // + + int ixyz, icorner; + + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = 0; + m_fcentre[ixyz] = 0; + m_rcentre[ixyz] = 0; + } + + for (icorner = 1; icorner <= 4; icorner++) { + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz]; + m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz]; + } + } + for (icorner = 5; icorner <= 8; icorner++) { + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz]; + m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz]; + } + } +} + +DDTranslation DDEcalEndcapTrapX::cornerPos(const int icorner) { + // + // Return specified corner as a Translation + // + return DDTranslation(m_corners[3 * icorner - 3], m_corners[3 * icorner - 2], m_corners[3 * icorner - 1]); +} + +void DDEcalEndcapTrapX::cornerPos(const int icorner, const DDTranslation& cornerxyz) { + // + // Save position of specified corner. + // + for (int ixyz = 0; ixyz < 3; ixyz++) { + m_corners[3 * icorner - 3 + ixyz] = (0 == ixyz ? cornerxyz.x() : (1 == ixyz ? cornerxyz.y() : cornerxyz.z())); + ; + } +} + +DDTranslation DDEcalEndcapTrapX::centrePos() { + // + // Return SC centre as a Translation + // + return DDTranslation(m_centre[0], m_centre[1], m_centre[2]); +} + +DDTranslation DDEcalEndcapTrapX::fcentrePos() { + // + // Return SC front face centre as a Translation + // + return DDTranslation(m_fcentre[0], m_fcentre[1], m_fcentre[2]); +} + +DDTranslation DDEcalEndcapTrapX::rcentrePos() { + // + // Return SC rear face centre as a Translation + // + return DDTranslation(m_rcentre[0], m_rcentre[1], m_rcentre[2]); +} + +double DDEcalEndcapTrapX::elevationAngle(const DDTranslation& trans) { + // + // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin). + // + double sintheta = trans.y() / trans.r(); + return asin(sintheta); +} + +double DDEcalEndcapTrapX::elevationAngle() { + // + // Return elevation angle (out of x-z plane) of SC in current position. + // + DDTranslation current = fcentrePos() - rcentrePos(); + return elevationAngle(current); +} + +double DDEcalEndcapTrapX::polarAngle(const DDTranslation& trans) { + // + // Return polar angle (from x to z) of a given translation (seen as a vector from the origin). + // + double tanphi = trans.x() / trans.z(); + return atan(tanphi); +} + +double DDEcalEndcapTrapX::polarAngle() { + // + // Return elevation angle (out of x-z plane) of SC in current position. + // + DDTranslation current = fcentrePos() - rcentrePos(); + return polarAngle(current); +} + +void DDEcalEndcapTrapX::print() { + // + // Print SC coordinates for debugging + // + edm::LogVerbatim("EcalGeom") << "Endcap supercrystal"; + for (int ic = 1; ic <= 8; ic++) { + DDTranslation cc = cornerPos(ic); + edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc << std::endl; + } + edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); +} diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc index ac8293935be87..5c56fb58469aa 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc @@ -166,7 +166,7 @@ GEMEtaPartition* GEMGeometryBuilderFromCondDB::buildEtaPartition(const RecoIdeal float ti = convertMmToCm(*(shapeStart + 3)); float nstrip = *(shapeStart + 4); float npad = *(shapeStart + 5); - //float dphi = *(shapeStart + 6); + float dphi = (shapeStart + 6 < rgeo.shapeEnd(gid)) ? *(shapeStart + 6) : 0.17715; std::vector pars; pars.emplace_back(be); @@ -174,8 +174,7 @@ GEMEtaPartition* GEMGeometryBuilderFromCondDB::buildEtaPartition(const RecoIdeal pars.emplace_back(ap); pars.emplace_back(nstrip); pars.emplace_back(npad); - //pars.emplace_back(dphi); - pars.emplace_back(0.17715); //temporary input for PR + pars.emplace_back(dphi); RCPBoundPlane surf(boundPlane(rgeo, gid, detId)); GEMEtaPartitionSpecs* e_p_specs = new GEMEtaPartitionSpecs(GeomDetEnumerators::GEM, name, pars); diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc index 9ecf0e67a30e7..669a144a41cc5 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc @@ -116,8 +116,6 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { static constexpr double tol = 0.00001; static const double sqrt3 = std::sqrt(3.0); - double rM = 0.5 * (waferSize_ + waferSepar_); - double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize_; double R = 2.0 * r / sqrt3; std::string parentName = parent().name().name(); @@ -127,7 +125,7 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { // First the mother std::string mother = parentName + tags_[k]; std::vector > wxy = - HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); + HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, r, R, 0.0, 0.0); std::vector xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc index aaa5994645947..5ec648d2be8f1 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc @@ -25,8 +25,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext const auto& material = args.value("ModuleMaterial"); const auto& thick = args.value("ModuleThickness"); const auto& waferSize = args.value("WaferSize"); - const auto& waferSepar = args.value("SensorSeparation"); #ifdef EDM_ML_DEBUG + const auto& waferSepar = args.value("SensorSeparation"); edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: Module " << parentName << " made of " << material << " T " << cms::convert2mm(thick) << " Wafer 2r " << cms::convert2mm(waferSize) << " Half Separation " << cms::convert2mm(waferSepar); @@ -69,8 +69,6 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext static constexpr double tol = 0.00001 * dd4hep::mm; static const double sqrt3 = std::sqrt(3.0); - double rM = 0.5 * (waferSize + waferSepar); - double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize; double R = 2.0 * r / sqrt3; @@ -79,7 +77,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext // First the mother std::string mother = parentName + tags[k]; std::vector> wxy = - HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); + HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, r, R, 0.0, 0.0); std::vector xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); diff --git a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml index 1b433a94bc794..5ea8b0aa56f17 100644 --- a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml @@ -6,10 +6,10 @@ 4, 4, 4, 24 - 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 + 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 3, 1 - 22, 24, 16, 7, 0x1, 0x3, 0x3F, 0xFF, 24, 4, 2, 8 + 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 diff --git a/Geometry/MTDCommonData/data/etl/v5/etl.xml b/Geometry/MTDCommonData/data/etl/v5/etl.xml index 20289c645572d..d4a5d623bd35a 100644 --- a/Geometry/MTDCommonData/data/etl/v5/etl.xml +++ b/Geometry/MTDCommonData/data/etl/v5/etl.xml @@ -64,6 +64,43 @@ + + + 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, + 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510, 517 + + + + 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, + 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511, 517 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 8, 7, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 7, 8, 8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, + 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511, 514 + + + + 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, + 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504, 513 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 7, 8, 7, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 8, 7, 7, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + @@ -71,16 +108,16 @@ - + - + - + @@ -100,49 +137,6 @@ - - 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, - 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510 - - - - 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, - 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511 - - - - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset]+5*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+2*([SensorModule_X]+[DeltaX]), - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - - - - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset]+2*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+5*([SensorModule_X]+[DeltaX]), - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - - - - 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, - 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511 - - - - 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, - 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504 - - - - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset]+3*([SensorModule_X]+[DeltaX]), - [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+4*([SensorModule_X]+[DeltaX]), [x_offset],[x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset], [x_offset], [x_offset], [x_offset] - - - - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset]+4*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+3*([SensorModule_X]+[DeltaX]), [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - - - diff --git a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml index 1b433a94bc794..5ea8b0aa56f17 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml @@ -6,10 +6,10 @@ 4, 4, 4, 24 - 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 + 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 3, 1 - 22, 24, 16, 7, 0x1, 0x3, 0x3F, 0xFF, 24, 4, 2, 8 + 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 diff --git a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml index 77e8e6801a1a5..588d35ce11df0 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml @@ -8,10 +8,10 @@ - 3733, 1867, 112, 60, 0, 0, 0, 0, 1, 16, 3, 1 + 0, 0, 0, 0, 3733, 1867, 112, 60, 1, 16, 3, 1 - 50, 50, 50, 50, 0, 0, 0, 0, 16, 16, 2, 1 + 0, 0, 0, 0, 50, 50, 50, 50, 16, 16, 2, 1 diff --git a/Geometry/MTDCommonData/test/testMTDinDD4hep.py b/Geometry/MTDCommonData/test/testMTDinDD4hep.py index 3569a04c314a0..e82b232f69a39 100644 --- a/Geometry/MTDCommonData/test/testMTDinDD4hep.py +++ b/Geometry/MTDCommonData/test/testMTDinDD4hep.py @@ -7,58 +7,44 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.DD4hep_TestMTDIdealGeometry = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDNumbering = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDPath = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDPosition = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdCommonDataDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - cout = cms.untracked.PSet( - DD4hep_TestMTDIdealGeometry = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDNumbering = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDPath = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDPosition = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdCommonDataDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDCommonData/test/testMTDinDDD.py b/Geometry/MTDCommonData/test/testMTDinDDD.py index ba1b9147ce895..ff281408bcfac 100644 --- a/Geometry/MTDCommonData/test/testMTDinDDD.py +++ b/Geometry/MTDCommonData/test/testMTDinDDD.py @@ -7,58 +7,44 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.TestMTDIdealGeometry = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDNumbering = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDPath = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDPosition = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdCommonDataDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - TestMTDIdealGeometry = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDNumbering = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDPath = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDPosition = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdCommonDataDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load('Configuration.Geometry.GeometryExtended2026D76_cff') diff --git a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h b/Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h similarity index 79% rename from Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h rename to Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h index e8959c23ea644..98e569e15238e 100644 --- a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h +++ b/Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h @@ -1,5 +1,5 @@ -#ifndef Geometry_MTDGeometryBuilder_MTDTopologyBuilder_H -#define Geometry_MTDGeometryBuilder_MTDTopologyBuilder_H +#ifndef Geometry_MTDGeometryBuilder_MTDPixelTopologyBuilder_H +#define Geometry_MTDGeometryBuilder_MTDPixelTopologyBuilder_H #include class PixelTopology; @@ -9,9 +9,9 @@ class Bounds; * Called by GeomTopologyBuilder, chooses the right topology for Pixels. */ -class MTDTopologyBuilder { +class MTDPixelTopologyBuilder { public: - MTDTopologyBuilder(); + MTDPixelTopologyBuilder(); PixelTopology* build(const Bounds* bounds, int ROWS_PER_ROC, // Num of Rows per ROC diff --git a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc index 72fbbf82f6d1f..78263e7e226d7 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc @@ -3,7 +3,7 @@ #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetType.h" #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetUnit.h" -#include "Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h" #include "DataFormats/DetId/interface/DetId.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" @@ -106,20 +106,20 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( int GAPxInterpad(0), GAPxBorder(0), GAPyInterpad(0), GAPyBorder(0); switch (det) { case GeomDetType::SubDetector::TimingBarrel: - GAPxInterpad = ptp.vitems_[0].vpars_[0]; // Value given in microns - GAPxBorder = ptp.vitems_[0].vpars_[1]; // Value given in microns - GAPyInterpad = ptp.vitems_[0].vpars_[2]; // Value given in microns - GAPyBorder = ptp.vitems_[0].vpars_[3]; // Value given in microns + GAPxInterpad = ptp.vitems_[0].vpars_[4]; // Value given in microns + GAPxBorder = ptp.vitems_[0].vpars_[5]; // Value given in microns + GAPyInterpad = ptp.vitems_[0].vpars_[6]; // Value given in microns + GAPyBorder = ptp.vitems_[0].vpars_[7]; // Value given in microns ROCrows = ptp.vitems_[0].vpars_[8]; ROCcols = ptp.vitems_[0].vpars_[9]; ROCSx = ptp.vitems_[0].vpars_[10]; ROCSy = ptp.vitems_[0].vpars_[11]; break; case GeomDetType::SubDetector::TimingEndcap: - GAPxInterpad = ptp.vitems_[1].vpars_[0]; - GAPxBorder = ptp.vitems_[1].vpars_[1]; - GAPyInterpad = ptp.vitems_[1].vpars_[2]; - GAPyBorder = ptp.vitems_[1].vpars_[3]; + GAPxInterpad = ptp.vitems_[1].vpars_[4]; + GAPxBorder = ptp.vitems_[1].vpars_[5]; + GAPyInterpad = ptp.vitems_[1].vpars_[6]; + GAPyBorder = ptp.vitems_[1].vpars_[7]; ROCrows = ptp.vitems_[1].vpars_[8]; ROCcols = ptp.vitems_[1].vpars_[9]; ROCSx = ptp.vitems_[1].vpars_[10]; @@ -146,7 +146,7 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( if (theMTDDetTypeMap.find(detName) == theMTDDetTypeMap.end()) { std::unique_ptr bounds(i->bounds()); - PixelTopology* t = MTDTopologyBuilder().build( + PixelTopology* t = MTDPixelTopologyBuilder().build( &*bounds, ROCrows, ROCcols, ROCSx, ROCSy, GAPxInterpad, GAPxBorder, GAPyInterpad, GAPyBorder); theMTDDetTypeMap[detName] = new MTDGeomDetType(t, detName, det); diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index cefcd6eda4a17..09b112b61ea3a 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -1,3 +1,5 @@ +//#define EDM_ML_DEBUG + #include "Geometry/MTDGeometryBuilder/interface/MTDParametersFromDD.h" #include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" @@ -34,9 +36,11 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { for (const auto& name : mtdSubdet) { auto const& v = cvp->vector(name); if (!v.empty()) { - subdet += 1; + subdet++; std::vector subdetPars = dbl_to_int(v); putOne(subdet, subdetPars, ptp); + } else { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; } } @@ -46,14 +50,39 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { DDSpecificsHasNamedValueFilter filter1{attribute}; DDFilteredView fv1(*cvp, filter1); bool ok = fv1.firstChild(); + int topoMode(-1); if (ok) { DDsvalues_type sv(fv1.mergedSpecifics()); - int topoMode = getMTDTopologyMode("TopologyMode", sv); + topoMode = getMTDTopologyMode("TopologyMode", sv); ptp.topologyMode_ = topoMode; } else { throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } + if (topoMode >= static_cast(MTDTopologyMode::Mode::btlv1etlv5)) { + std::array etlLayout{{ + "StartCopyNo_Front_Left", + "StartCopyNo_Front_Right", + "StartCopyNo_Back_Left", + "StartCopyNo_Back_Right", + "Offset_Front_Left", + "Offset_Front_Right", + "Offset_Back_Left", + "Offset_Back_Right", + }}; + int sector(10); + for (const auto& name : etlLayout) { + auto const& v = cvp->vector(name); + if (!v.empty()) { + sector++; + std::vector ipos = dbl_to_int(v); + putOne(sector, ipos, ptp); + } else { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } + } + } + return true; } @@ -63,15 +92,21 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p std::array mtdSubdet{{"BTL", "ETL"}}; int subdet(0); for (const auto& name : mtdSubdet) { - subdet += 1; + bool found(false); for (auto const& it : vmap) { if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { + subdet++; std::vector subdetPars; for (const auto& i : it.second) subdetPars.emplace_back(std::round(i)); putOne(subdet, subdetPars, ptp); + found = true; + break; } } + if (!found) { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } } auto it = vmap.find("vPars"); @@ -88,8 +123,8 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p mypar.filter(ref, attribute, "MTD"); std::string topoModeS(mypar.specPar("mtdNumbering")->strValue("TopologyMode")); + int topoMode(-1); if (!topoModeS.empty()) { - int topoMode(-1); MTDTopologyMode::Mode eparser = MTDTopologyMode::MTDStringToEnumParser(topoModeS); topoMode = static_cast(eparser); ptp.topologyMode_ = topoMode; @@ -97,6 +132,37 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } + if (topoMode >= static_cast(MTDTopologyMode::Mode::btlv1etlv5)) { + std::array etlLayout{{ + "StartCopyNo_Front_Left", + "StartCopyNo_Front_Right", + "StartCopyNo_Back_Left", + "StartCopyNo_Back_Right", + "Offset_Front_Left", + "Offset_Front_Right", + "Offset_Back_Left", + "Offset_Back_Right", + }}; + int sector(10); // add vector index with offset, to distinguish from subdet + for (const auto& name : etlLayout) { + bool found(false); + for (auto const& it : vmap) { + if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { + sector++; + std::vector ipos; + for (const auto& i : it.second) + ipos.emplace_back(std::round(i)); + putOne(sector, ipos, ptp); + found = true; + break; + } + } + if (!found) { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } + } + } + return true; } @@ -105,4 +171,15 @@ void MTDParametersFromDD::putOne(int subdet, std::vector& vpars, PMTDParame item.id_ = subdet; item.vpars_ = vpars; ptp.vitems_.emplace_back(item); +#ifdef EDM_ML_DEBUG + auto print_item = [&]() { + std::stringstream ss; + ss << item.id_ << " with " << item.vpars_.size() << " elements:"; + for (const auto& thePar : item.vpars_) { + ss << " " << thePar; + } + return ss.str(); + }; + edm::LogInfo("MTDParametersFromDD") << "Adding PMTDParameters item: " << print_item(); +#endif } diff --git a/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc b/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc new file mode 100644 index 0000000000000..922569d0214b9 --- /dev/null +++ b/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc @@ -0,0 +1,62 @@ +//#define EDM_ML_DEBUG + +// Make the change for "big" pixels. 3/06 d.k. +#include "Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h" +#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" +#include "DataFormats/GeometrySurface/interface/Bounds.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +MTDPixelTopologyBuilder::MTDPixelTopologyBuilder(void) {} + +PixelTopology* MTDPixelTopologyBuilder::build(const Bounds* bs, + int pixelROCRows, // Num of Rows per ROC + int pixelROCCols, // Num of Cols per ROC + int pixelROCsInX, + int pixelROCsInY, + int GAPxInterpad, + int GAPxBorder, + int GAPyInterpad, + int GAPyBorder) { + float width = bs->width(); // module width = Xsize + float length = bs->length(); // module length = Ysize + + // Number of pixel rows (x) and columns (y) per module + int nrows = pixelROCRows * pixelROCsInX; + int ncols = pixelROCCols * pixelROCsInY; + + float pitchX = width / nrows; + float pitchY = length / ncols; + + float micronsTocm = 1e-4; + float gapxinterpad = float(GAPxInterpad) * micronsTocm; //Convert to cm + float gapyinterpad = float(GAPyInterpad) * micronsTocm; //Convert to cm + float gapxborder = float(GAPxBorder) * micronsTocm; //Convert to cm + float gapyborder = float(GAPyBorder) * micronsTocm; //Convert to cm + +#ifdef EDM_ML_DEBUG + edm::LogInfo("MTDPixelTopologyBuilder") + << std::fixed << "Building topology for module of width(X) = " << std::setw(10) << width + << " length(Y) = " << std::setw(10) << length << "\n Rows per ROC = " << std::setw(10) << pixelROCRows + << " Cols per ROC = " << std::setw(10) << pixelROCCols << "\n ROCs in X = " << std::setw(10) + << pixelROCsInX << " ROCs in Y = " << std::setw(10) << pixelROCsInY + << "\n # pixel rows X = " << std::setw(10) << nrows << " # pixel cols Y = " << std::setw(10) << ncols + << "\n pitch in X = " << std::setw(10) << pitchX << " # pitch in Y = " << std::setw(10) << pitchY + << "\n Interpad gap in X = " << std::setw(10) << gapxinterpad << " # Interpad gap in Y = " << std::setw(10) + << gapyinterpad << "\n Border gap in X = " << std::setw(10) << gapxborder + << " # Border gap in Y = " << std::setw(10) << gapyborder; +#endif + + return (new RectangularMTDTopology(nrows, + ncols, + pitchX, + pitchY, + pixelROCRows, // (int)rocRow + pixelROCCols, // (int)rocCol + pixelROCsInX, + pixelROCsInY, + gapxinterpad, + gapxborder, + gapyinterpad, + gapyborder)); +} diff --git a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc b/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc deleted file mode 100644 index 045803798e9ee..0000000000000 --- a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc +++ /dev/null @@ -1,66 +0,0 @@ -//#define EDM_ML_DEBUG - -// Make the change for "big" pixels. 3/06 d.k. -#include "Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h" -#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" -#include "DataFormats/GeometrySurface/interface/Bounds.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -MTDTopologyBuilder::MTDTopologyBuilder(void) {} - -PixelTopology* MTDTopologyBuilder::build(const Bounds* bs, - int pixelROCRows, // Num of Rows per ROC - int pixelROCCols, // Num of Cols per ROC - int pixelROCsInX, - int pixelROCsInY, - int GAPxInterpad, - int GAPxBorder, - int GAPyInterpad, - int GAPyBorder) { - float width = bs->width(); // module width = Xsize - float length = bs->length(); // module length = Ysize - - // Number of pixel rows (x) and columns (y) per module - int nrows = pixelROCRows * pixelROCsInX; - int ncols = pixelROCCols * pixelROCsInY; - - float pitchX = width / nrows; - float pitchY = length / ncols; - - float micronsTocm = 1e-4; - float gapxinterpad = float(GAPxInterpad) * micronsTocm; //Convert to cm - float gapyinterpad = float(GAPyInterpad) * micronsTocm; //Convert to cm - float gapxborder = float(GAPxBorder) * micronsTocm; //Convert to cm - float gapyborder = float(GAPyBorder) * micronsTocm; //Convert to cm - -#ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyBuilder") << std::fixed << "Building topology for module of width(X) = " << std::setw(10) - << width << " length(Y) = " << std::setw(10) << length - << "\n Rows per ROC = " << std::setw(10) << pixelROCRows - << " Cols per ROC = " << std::setw(10) << pixelROCCols - << "\n ROCs in X = " << std::setw(10) << pixelROCsInX - << " ROCs in Y = " << std::setw(10) << pixelROCsInY - << "\n # pixel rows X = " << std::setw(10) << nrows - << " # pixel cols Y = " << std::setw(10) << ncols - << "\n pitch in X = " << std::setw(10) << pitchX - << " # pitch in Y = " << std::setw(10) << pitchY - << "\n Interpad gap in X = " << std::setw(10) << gapxinterpad - << " # Interpad gap in Y = " << std::setw(10) << gapyinterpad - << "\n Border gap in X = " << std::setw(10) << gapxborder - << " # Border gap in Y = " << std::setw(10) << gapyborder; -#endif - - return (new RectangularMTDTopology(nrows, - ncols, - pitchX, - pitchY, - pixelROCRows, // (int)rocRow - pixelROCCols, // (int)rocCol - pixelROCsInX, - pixelROCsInY, - gapxinterpad, - gapxborder, - gapyinterpad, - gapyborder)); -} diff --git a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py index abc28919dc8ed..9475eabb5f39a 100644 --- a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py @@ -14,52 +14,38 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDDigiGeometryAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestBTLPixelTopology = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdGeometryDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDDigiGeometryAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestBTLPixelTopology = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdGeometryDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py index 3124914954e9d..a7c3d31a5da9b 100644 --- a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py @@ -13,49 +13,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDDigiGeometryAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdGeometryDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDDigiGeometryAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdGeometryDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load("Configuration.Geometry.GeometryExtended2026D76_cff") diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 363230df0ba37..d8a572e6acf14 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -4,18 +4,45 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/MTDDetId.h" +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" +#include #include #include class MTDTopology { public: - MTDTopology(const int &topologyMode); + struct ETLfaceLayout { + uint32_t idDiscSide_; // disc face identifier + uint32_t idDetType1_; // module type id identifier for first row + + std::array, 2> start_copy_; // start copy per row, first of type idDetType1_ + std::array, 2> offset_; // offset per row, first of type idDetType1_ + }; + + using ETLValues = std::vector; + + MTDTopology(const int& topologyMode, const ETLValues& etl); int getMTDTopologyMode() const { return mtdTopologyMode_; } + // ETL topology navigation is based on a predefined order of dets in sector + + static bool orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2); + + // navigation methods in ETL topology, provide the index of the det next to DetId for + // horizontal and vertical shifts in both directions, assuming the predefined order in a sector + + size_t hshiftETL(const uint32_t detid, const int horizontalShift) const; + size_t vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const; + private: const int mtdTopologyMode_; + + const ETLValues etlVals_; + + static constexpr size_t failIndex_ = + std::numeric_limits::max(); // return out-of-range value for any failure }; #endif diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index 977b21b15c006..e09488a7dfaac 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -1,3 +1,5 @@ +//#define EDM_ML_DEBUG + #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -5,12 +7,12 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESProducer.h" #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" #include "Geometry/Records/interface/MTDTopologyRcd.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" #include "Geometry/Records/interface/PMTDParametersRcd.h" #include -//#define EDM_ML_DEBUG class MTDTopologyEP : public edm::ESProducer { public: @@ -23,7 +25,7 @@ class MTDTopologyEP : public edm::ESProducer { ReturnType produce(const MTDTopologyRcd&); private: - void fillParameters(const PMTDParameters&, int& mtdTopologyMode); + void fillParameters(const PMTDParameters&, int& mtdTopologyMode, MTDTopology::ETLValues&); const edm::ESGetToken token_; }; @@ -38,18 +40,74 @@ void MTDTopologyEP::fillDescriptions(edm::ConfigurationDescriptions& description MTDTopologyEP::ReturnType MTDTopologyEP::produce(const MTDTopologyRcd& iRecord) { int mtdTopologyMode; + MTDTopology::ETLValues etlVals; - fillParameters(iRecord.get(token_), mtdTopologyMode); + fillParameters(iRecord.get(token_), mtdTopologyMode, etlVals); - return std::make_unique(mtdTopologyMode); + return std::make_unique(mtdTopologyMode, etlVals); } -void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode) { +void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode, MTDTopology::ETLValues& etlVals) { mtdTopologyMode = ptp.topologyMode_; -#ifdef EDM_ML_DEBUG + // for legacy geometry scenarios no topology informastion is stored, only for newer ETL 2-discs layout + + if (mtdTopologyMode <= static_cast(MTDTopologyMode::Mode::barphiflat)) { + return; + } + + // Check on the internal consistency of thr ETL layout information provided by parameters + + for (size_t it = 3; it <= 9; it++) { + if (ptp.vitems_[it].vpars_.size() != ptp.vitems_[2].vpars_.size()) { + throw cms::Exception("MTDTopologyEP") << "Inconsistent size of ETL structure arrays"; + } + } + + MTDTopology::ETLfaceLayout tmpFace; + + // Front Face (0), starting with type Right (2) - edm::LogInfo("MTDTopologyEP") << "Topology mode = " << mtdTopologyMode; + tmpFace.idDiscSide_ = 0; // ETL front side + tmpFace.idDetType1_ = 2; // ETL module type right + + tmpFace.start_copy_[0] = ptp.vitems_[3].vpars_; // start_copy_FR + tmpFace.start_copy_[1] = ptp.vitems_[2].vpars_; // start_copy_FL + tmpFace.offset_[0] = ptp.vitems_[7].vpars_; // offset_FR + tmpFace.offset_[1] = ptp.vitems_[6].vpars_; // offset_FL + + etlVals.emplace_back(tmpFace); + + // Back Face (1), starting with type Left (1) + + tmpFace.idDiscSide_ = 1; // ETL back side + tmpFace.idDetType1_ = 1; // ETL module type left + + tmpFace.start_copy_[0] = ptp.vitems_[4].vpars_; // start_copy_BL + tmpFace.start_copy_[1] = ptp.vitems_[5].vpars_; // start_copy_BR + tmpFace.offset_[0] = ptp.vitems_[8].vpars_; // offset_BL + tmpFace.offset_[1] = ptp.vitems_[9].vpars_; // offset_BR + + etlVals.emplace_back(tmpFace); + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MTDTopologyEP") << " Topology mode = " << mtdTopologyMode << "\n"; + auto print_array = [&](std::vector vector) { + std::stringstream ss; + for (auto const& elem : vector) { + ss << " " << elem; + } + ss << "\n"; + return ss.str(); + }; + + for (auto const& ilay : etlVals) { + edm::LogVerbatim("MTDTopologyEP") << " disc face = " << ilay.idDiscSide_ << " start det type = " << ilay.idDetType1_ + << "\n start_copy[0]= " << print_array(ilay.start_copy_[0]) + << "\n start_copy[1]= " << print_array(ilay.start_copy_[1]) + << "\n offset[0]= " << print_array(ilay.offset_[0]) + << "\n offset[1]= " << print_array(ilay.offset_[1]); + } #endif } diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 29cbf811a3412..f766a23df5913 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -1,3 +1,131 @@ #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" -MTDTopology::MTDTopology(const int &topologyMode) : mtdTopologyMode_(topologyMode) {} +MTDTopology::MTDTopology(const int& topologyMode, const ETLValues& etl) + : mtdTopologyMode_(topologyMode), etlVals_(etl) {} + +bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { + ETLDetId det1(gd1->geographicalId().rawId()); + ETLDetId det2(gd2->geographicalId().rawId()); + + if (det1.mtdRR() != det2.mtdRR()) { + return det1.mtdRR() < det2.mtdRR(); + } else if (det1.modType() != det2.modType()) { + return det1.modType() < det2.modType(); + } else { + return det1.module() < det2.module(); + } +} + +size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) const { + ETLDetId start_mod(detid); + + if (horizontalShift == 0) { + edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL"; + return failIndex_; + } + int hsh = horizontalShift > 0 ? 1 : -1; + + int module = start_mod.module(); + uint32_t modtyp = start_mod.modType(); + uint32_t discside = start_mod.discSide(); + + // ilayout number coincides at present with disc face, use this + + size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1; + size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1; + + // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added + + size_t nmodOffset = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; + + for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { + if (module >= etlVals_[discside].start_copy_[iHome][iloop] && + module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + if (module + hsh >= etlVals_[discside].start_copy_[iHome][iloop] && + module + hsh < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + return module + hsh - 1 + nmodOffset; + } + break; + } + } + + return failIndex_; +} + +size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const { + closest = failIndex_; + + ETLDetId start_mod(detid); + + if (verticalShift == 0) { + edm::LogWarning("MTDTopology") << "asking of a null verticalShift in ETL"; + return failIndex_; + } + int vsh = verticalShift > 0 ? 1 : -1; + + int module = start_mod.module(); + uint32_t modtyp = start_mod.modType(); + uint32_t discside = start_mod.discSide(); + + // ilayout number coincides at present with disc face, use this + + size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1; + size_t iOther = (iHome == 0) ? 1 : 0; + size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1; + + // for right type modules the offset of the total number of left modules needs to be added, + // what matters here is the other type, i.e. if the starting module is left the vertical shift moves towards a right type, and viceversa + + size_t nmodOffset = (modtyp == 1) ? etlVals_[discside].start_copy_[iLeft].back() - 1 : 0; + + size_t iBin(etlVals_[discside].start_copy_[iHome].size()); // never allowed + for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { + if (module >= etlVals_[discside].start_copy_[iHome][iloop] && + module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + iBin = iloop; + break; + } + } + + if (iBin == etlVals_[discside].start_copy_[iHome].size()) { + edm::LogWarning("MTDTopology") << "Module number not compatible with layout, abort"; + return failIndex_; + } + + // define the interval of interest for the other type according to the vertical shift sign + + int iBinOther(iBin); + if (iHome == 0 && vsh < 0) { + iBinOther = iBin - 1; + } + if (iHome == 1 && vsh > 0) { + iBinOther = iBin + 1; + } + if (iBinOther < 0 || iBinOther >= static_cast(etlVals_[discside].start_copy_[iOther].size()) - 1) { + return failIndex_; + } + + // determine the position of the other type corresponding to the same column of the home type + + int vpos = etlVals_[discside].offset_[iHome][iBin] + module - etlVals_[discside].start_copy_[iHome][iBin] + 1; + if (vpos <= etlVals_[discside].offset_[iOther][iBinOther]) { + closest = etlVals_[discside].start_copy_[iOther][iBinOther]; + } else if (vpos > etlVals_[discside].offset_[iOther][iBinOther] + + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] || + (vpos == etlVals_[discside].offset_[iOther][iBinOther] + + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] && + iBinOther + 1 == static_cast(etlVals_[discside].start_copy_[iOther].size()))) { + closest = etlVals_[discside].start_copy_[iOther][iBinOther + 1] - 1; + } + if (closest < failIndex_) { + closest = closest + nmodOffset - 1; + return failIndex_; + } else { + // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0) + return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 - + etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1; + } +} diff --git a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py index 0c584413b0025..7a06599034808 100644 --- a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py @@ -14,46 +14,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.GeometricTimingDetAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdNumberingDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - GeometricTimingDetAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdNumberingDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py index 86a0aa63c58fc..b0a83125af51b 100644 --- a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py @@ -13,49 +13,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.GeometricTimingDetAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdNumberingDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - GeometricTimingDetAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdNumberingDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load("Configuration.Geometry.GeometryExtended2026D76_cff") diff --git a/Geometry/TrackerGeometryBuilder/README.md b/Geometry/TrackerGeometryBuilder/README.md index 46e3fe3a0764a..49b3c35f13a23 100644 --- a/Geometry/TrackerGeometryBuilder/README.md +++ b/Geometry/TrackerGeometryBuilder/README.md @@ -14,20 +14,20 @@ helper methods are available (and other can be added if needed): `GeomDetEnumera `GeomDetEnumerators::isTrackerStrip(subdet)` and equivalent methods in the `GeomDetType` class. The present map between enumerators and the returned values of the above methods are summarized in the table below: -| `GeometricDet::GDEnumType` | `GeomDetEnumerators::SubDetector` | `GeomDetEnumerators::subDetGeom[id]` | `isTrackerPixel` | `isTrackerStrip` | `isBarrel` | `isEndcap` | -|-------|------|--------|------|------|-------|-------| -| `PixelBarrel` | `PixelBarrel` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelEndCap` | `PixelEndcap` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `TIB` | `TIB` | `TIB` | `false` | `true` | `true` | `false` | -| `TID` | `TID` | `TID` | `false` | `true` | `false` | `true` | -| `TOB` | `TOB` | `TOB` | `false` | `true` | `true` | `false` | -| `TEC` | `TEC` | `TEC` | `false` | `true` | `false` | `true` | -| `PixelPhase1Barrel` | `P1PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelPhase1EndCap` | `P1PXEC` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `PixelPhase2Barrel` | `P2PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelPhase2EndCap` | `P2PXEC` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `OTPhase2Barrel` | `P2OTB` | `TOB` | `true` | `false` | `true` | `false` | -| `OTPhase2EndCap` | `P2OTEC` | `TID` | `true` | `false` | `false` | `true` | +| `GeometricDet::GDEnumType` | `GeomDetEnumerators::SubDetector` | `GeomDetEnumerators::subDetGeom[id]` | `isTrackerPixel` | `isTrackerStrip` | `isInnerTracker` | `isOuterTracker` | `isBarrel` | `isEndcap` | +|-------|------|--------|------|------|-------|-------|-------|-------| +| `PixelBarrel` | `PixelBarrel` | `PixelBarrel` | `true` | `false` | `true` | `false` | `true` | `false` | +| `PixelEndCap` | `PixelEndcap` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `TIB` | `TIB` | `TIB` | `false` | `true` | `false` | `true` | `true` | `false` | +| `TID` | `TID` | `TID` | `false` | `true` | `false` | `true` | `false` | `true` | +| `TOB` | `TOB` | `TOB` | `false` | `true` | `false` | `true` |`true` | `false` | +| `TEC` | `TEC` | `TEC` | `false` | `true` | `false` | `true` |`false` | `true` | +| `PixelPhase1Barrel` | `P1PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | `true` | `false` | +| `PixelPhase1EndCap` | `P1PXEC` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `PixelPhase2Barrel` | `P2PXB` | `PixelBarrel` | `true` | `false` |`true` | `false` | `true` | `false` | +| `PixelPhase2EndCap` | `P2PXEC` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `OTPhase2Barrel` | `P2OTB` | `TOB` | `true` | `false` | `false` | `true` |`true` | `false` | +| `OTPhase2EndCap` | `P2OTEC` | `TID` | `true` | `false` | `false` | `true` | `false` | `true` | ### `TrackerGeometry` useful methods diff --git a/HLTrigger/Configuration/python/HLT_FULL_cff.py b/HLTrigger/Configuration/python/HLT_FULL_cff.py index 6578d3c322fde..4f024227f9e58 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_11_3_0/HLT --type FULL +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HLT --type FULL -# /dev/CMSSW_11_3_0/HLT/V19 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HLT/V2 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HLT/V19') + tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V2') ) fragment.transferSystem = cms.PSet( @@ -7577,10 +7577,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -7596,26 +7594,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -9051,6 +9052,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -9081,7 +9083,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -9432,7 +9433,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14963,10 +14963,12 @@ ncandcut = cms.int32( 2 ) ) fragment.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -18118,10 +18120,12 @@ rhoScale = cms.double( 1.0 ) ) fragment.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -36480,7 +36484,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -42188,7 +42191,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -50649,7 +50651,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -100371,7 +100372,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -108155,10 +108155,12 @@ offset = cms.uint32( 0 ) ) fragment.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -117371,7 +117373,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake1_cff.py b/HLTrigger/Configuration/python/HLT_Fake1_cff.py index 649cb8b36a99c..b2826068b36e3 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_11_3_0/Fake1 --type Fake1 +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake1 --type Fake1 -# /dev/CMSSW_11_3_0/Fake1/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake1/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake1/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V1') ) 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 f8c70b854983e..e915fdba218fe 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_11_3_0/Fake2 --type Fake2 +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake2 --type Fake2 -# /dev/CMSSW_11_3_0/Fake2/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake2/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V1') ) 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 7ccdf436d9ace..d7edf4914f8ad 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_11_3_0/Fake --type Fake +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake --type Fake -# /dev/CMSSW_11_3_0/Fake/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V1') ) 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 05eafb977746b..08cdd08be150b 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_11_3_0/GRun --type GRun +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/GRun --type GRun -# /dev/CMSSW_11_3_0/GRun/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/GRun/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/GRun/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V1') ) fragment.transferSystem = cms.PSet( @@ -6217,10 +6217,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -6236,26 +6234,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -7691,6 +7692,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -7721,7 +7723,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8072,7 +8073,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -13555,10 +13555,12 @@ ncandcut = cms.int32( 2 ) ) fragment.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -16710,10 +16712,12 @@ rhoScale = cms.double( 1.0 ) ) fragment.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -35048,7 +35052,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -40756,7 +40759,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -48833,7 +48835,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_HIon_cff.py b/HLTrigger/Configuration/python/HLT_HIon_cff.py index 074e2b36491d1..99f18df95317d 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_11_3_0/HIon --type HIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HIon --type HIon -# /dev/CMSSW_11_3_0/HIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V1') ) fragment.transferSystem = cms.PSet( @@ -5380,10 +5380,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5399,26 +5397,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6451,6 +6452,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6481,7 +6483,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -7821,7 +7822,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14700,10 +14700,12 @@ offset = cms.uint32( 0 ) ) fragment.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -23938,7 +23940,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_PIon_cff.py b/HLTrigger/Configuration/python/HLT_PIon_cff.py index 78b861ecc1f7c..9f2f1c519907f 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_11_3_0/PIon --type PIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PIon --type PIon -# /dev/CMSSW_11_3_0/PIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V1') ) fragment.transferSystem = cms.PSet( @@ -4851,10 +4851,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -4870,26 +4868,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), diff --git a/HLTrigger/Configuration/python/HLT_PRef_cff.py b/HLTrigger/Configuration/python/HLT_PRef_cff.py index f01b067180428..c172452e633b0 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_11_3_0/PRef --type PRef +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PRef --type PRef -# /dev/CMSSW_11_3_0/PRef/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PRef/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PRef/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V1') ) fragment.transferSystem = cms.PSet( @@ -4930,10 +4930,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -4949,26 +4947,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6169,6 +6170,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6199,7 +6201,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -6550,7 +6551,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py index d52f1a3bd4322..2a3014456bf92 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_11_3_0/GRun +# /dev/CMSSW_12_0_0/GRun import FWCore.ParameterSet.Config as cms @@ -10,15 +10,15 @@ streamParkingBPH1_datasetParkingBPH1_selector.l1tResults = cms.InputTag('') streamParkingBPH1_datasetParkingBPH1_selector.throw = cms.bool(False) streamParkingBPH1_datasetParkingBPH1_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part0_v2', - 'HLT_Mu7_IP4_part0_v2', - 'HLT_Mu8_IP3_part0_v3', - 'HLT_Mu8_IP5_part0_v2', - 'HLT_Mu8_IP6_part0_v2', - 'HLT_Mu9_IP0_part0_v2', - 'HLT_Mu9_IP3_part0_v2', - 'HLT_Mu9_IP4_part0_v2', - 'HLT_Mu9_IP5_part0_v2', + 'HLT_Mu12_IP6_part0_v2', + 'HLT_Mu7_IP4_part0_v2', + 'HLT_Mu8_IP3_part0_v3', + 'HLT_Mu8_IP5_part0_v2', + 'HLT_Mu8_IP6_part0_v2', + 'HLT_Mu9_IP0_part0_v2', + 'HLT_Mu9_IP3_part0_v2', + 'HLT_Mu9_IP4_part0_v2', + 'HLT_Mu9_IP5_part0_v2', 'HLT_Mu9_IP6_part0_v3' ) @@ -27,13 +27,13 @@ streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.l1tResults = cms.InputTag('') streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.throw = cms.bool(False) streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_ToCSCS_v1', - 'HLT_Mu7_IP4_ToCSCS_v1', - 'HLT_Mu8_IP3_ToCSCS_v1', - 'HLT_Mu8_IP5_ToCSCS_v1', - 'HLT_Mu8_IP6_ToCSCS_v1', - 'HLT_Mu9_IP4_ToCSCS_v1', - 'HLT_Mu9_IP5_ToCSCS_v1', + 'HLT_Mu12_IP6_ToCSCS_v1', + 'HLT_Mu7_IP4_ToCSCS_v1', + 'HLT_Mu8_IP3_ToCSCS_v1', + 'HLT_Mu8_IP5_ToCSCS_v1', + 'HLT_Mu8_IP6_ToCSCS_v1', + 'HLT_Mu9_IP4_ToCSCS_v1', + 'HLT_Mu9_IP5_ToCSCS_v1', 'HLT_Mu9_IP6_ToCSCS_v1' ) @@ -45,13 +45,13 @@ streamParkingBPH2_datasetParkingBPH2_selector.l1tResults = cms.InputTag('') streamParkingBPH2_datasetParkingBPH2_selector.throw = cms.bool(False) streamParkingBPH2_datasetParkingBPH2_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part1_v2', - 'HLT_Mu7_IP4_part1_v2', - 'HLT_Mu8_IP3_part1_v3', - 'HLT_Mu8_IP5_part1_v2', - 'HLT_Mu8_IP6_part1_v2', - 'HLT_Mu9_IP4_part1_v2', - 'HLT_Mu9_IP5_part1_v2', + 'HLT_Mu12_IP6_part1_v2', + 'HLT_Mu7_IP4_part1_v2', + 'HLT_Mu8_IP3_part1_v3', + 'HLT_Mu8_IP5_part1_v2', + 'HLT_Mu8_IP6_part1_v2', + 'HLT_Mu9_IP4_part1_v2', + 'HLT_Mu9_IP5_part1_v2', 'HLT_Mu9_IP6_part1_v3' ) @@ -63,13 +63,13 @@ streamParkingBPH3_datasetParkingBPH3_selector.l1tResults = cms.InputTag('') streamParkingBPH3_datasetParkingBPH3_selector.throw = cms.bool(False) streamParkingBPH3_datasetParkingBPH3_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part2_v2', - 'HLT_Mu7_IP4_part2_v2', - 'HLT_Mu8_IP3_part2_v3', - 'HLT_Mu8_IP5_part2_v2', - 'HLT_Mu8_IP6_part2_v2', - 'HLT_Mu9_IP4_part2_v2', - 'HLT_Mu9_IP5_part2_v2', + 'HLT_Mu12_IP6_part2_v2', + 'HLT_Mu7_IP4_part2_v2', + 'HLT_Mu8_IP3_part2_v3', + 'HLT_Mu8_IP5_part2_v2', + 'HLT_Mu8_IP6_part2_v2', + 'HLT_Mu9_IP4_part2_v2', + 'HLT_Mu9_IP5_part2_v2', 'HLT_Mu9_IP6_part2_v3' ) @@ -81,13 +81,13 @@ streamParkingBPH4_datasetParkingBPH4_selector.l1tResults = cms.InputTag('') streamParkingBPH4_datasetParkingBPH4_selector.throw = cms.bool(False) streamParkingBPH4_datasetParkingBPH4_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part3_v2', - 'HLT_Mu7_IP4_part3_v2', - 'HLT_Mu8_IP3_part3_v3', - 'HLT_Mu8_IP5_part3_v2', - 'HLT_Mu8_IP6_part3_v2', - 'HLT_Mu9_IP4_part3_v2', - 'HLT_Mu9_IP5_part3_v2', + 'HLT_Mu12_IP6_part3_v2', + 'HLT_Mu7_IP4_part3_v2', + 'HLT_Mu8_IP3_part3_v3', + 'HLT_Mu8_IP5_part3_v2', + 'HLT_Mu8_IP6_part3_v2', + 'HLT_Mu9_IP4_part3_v2', + 'HLT_Mu9_IP5_part3_v2', 'HLT_Mu9_IP6_part3_v3' ) @@ -99,13 +99,13 @@ streamParkingBPH5_datasetParkingBPH5_selector.l1tResults = cms.InputTag('') streamParkingBPH5_datasetParkingBPH5_selector.throw = cms.bool(False) streamParkingBPH5_datasetParkingBPH5_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part4_v2', - 'HLT_Mu7_IP4_part4_v2', - 'HLT_Mu8_IP3_part4_v3', - 'HLT_Mu8_IP5_part4_v2', - 'HLT_Mu8_IP6_part4_v2', - 'HLT_Mu9_IP4_part4_v2', - 'HLT_Mu9_IP5_part4_v2', + 'HLT_Mu12_IP6_part4_v2', + 'HLT_Mu7_IP4_part4_v2', + 'HLT_Mu8_IP3_part4_v3', + 'HLT_Mu8_IP5_part4_v2', + 'HLT_Mu8_IP6_part4_v2', + 'HLT_Mu9_IP4_part4_v2', + 'HLT_Mu9_IP5_part4_v2', 'HLT_Mu9_IP6_part4_v3' ) @@ -117,8 +117,8 @@ streamPhysicsCommissioning_datasetCommissioning_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetCommissioning_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetCommissioning_selector.triggerConditions = cms.vstring( - 'HLT_IsoTrackHB_v4', - 'HLT_IsoTrackHE_v4', + 'HLT_IsoTrackHB_v4', + 'HLT_IsoTrackHE_v4', 'HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2' ) @@ -139,7 +139,7 @@ streamPhysicsCommissioning_datasetHcalNZS_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetHcalNZS_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetHcalNZS_selector.triggerConditions = cms.vstring( - 'HLT_HcalNZS_v13', + 'HLT_HcalNZS_v13', 'HLT_HcalPhiSym_v15' ) @@ -148,7 +148,7 @@ streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.triggerConditions = cms.vstring( - 'HLT_SinglePhoton10_Eta3p1ForPPRef_v8', + 'HLT_SinglePhoton10_Eta3p1ForPPRef_v8', 'HLT_SinglePhoton20_Eta3p1ForPPRef_v9' ) @@ -169,29 +169,29 @@ streamPhysicsCommissioning_datasetMonteCarlo_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetMonteCarlo_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetMonteCarlo_selector.triggerConditions = cms.vstring( - 'MC_AK4CaloJetsFromPV_v8', - 'MC_AK4CaloJets_v9', - 'MC_AK4PFJets_v17', - 'MC_AK8CaloHT_v8', - 'MC_AK8PFHT_v16', - 'MC_AK8PFJets_v17', - 'MC_AK8TrimPFJets_v17', - 'MC_CaloBTagDeepCSV_v8', - 'MC_CaloHT_v8', - 'MC_CaloMET_JetIdCleaned_v9', - 'MC_CaloMET_v8', - 'MC_CaloMHT_v8', - 'MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v13', - 'MC_DoubleEle5_CaloIdL_MW_v15', - 'MC_DoubleMuNoFiltersNoVtx_v7', - 'MC_DoubleMu_TrkIsoVVL_DZ_v11', - 'MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'MC_Ele5_WPTight_Gsf_v8', - 'MC_IsoMu_v15', - 'MC_PFBTagDeepCSV_v10', - 'MC_PFHT_v16', - 'MC_PFMET_v17', - 'MC_PFMHT_v16', + 'MC_AK4CaloJetsFromPV_v8', + 'MC_AK4CaloJets_v9', + 'MC_AK4PFJets_v17', + 'MC_AK8CaloHT_v8', + 'MC_AK8PFHT_v16', + 'MC_AK8PFJets_v17', + 'MC_AK8TrimPFJets_v17', + 'MC_CaloBTagDeepCSV_v8', + 'MC_CaloHT_v8', + 'MC_CaloMET_JetIdCleaned_v9', + 'MC_CaloMET_v8', + 'MC_CaloMHT_v8', + 'MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v13', + 'MC_DoubleEle5_CaloIdL_MW_v15', + 'MC_DoubleMuNoFiltersNoVtx_v7', + 'MC_DoubleMu_TrkIsoVVL_DZ_v11', + 'MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'MC_Ele5_WPTight_Gsf_v8', + 'MC_IsoMu_v15', + 'MC_PFBTagDeepCSV_v10', + 'MC_PFHT_v16', + 'MC_PFMET_v17', + 'MC_PFMHT_v16', 'MC_ReducedIterativeTracking_v12' ) @@ -200,15 +200,15 @@ streamPhysicsCommissioning_datasetNoBPTX_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetNoBPTX_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetNoBPTX_selector.triggerConditions = cms.vstring( - 'HLT_CDC_L2cosmic_10_er1p0_v1', - 'HLT_CDC_L2cosmic_5p5_er1p0_v1', - 'HLT_L2Mu10_NoVertex_NoBPTX3BX_v5', - 'HLT_L2Mu10_NoVertex_NoBPTX_v6', - 'HLT_L2Mu40_NoVertex_3Sta_NoBPTX3BX_v5', - 'HLT_L2Mu45_NoVertex_3Sta_NoBPTX3BX_v4', - 'HLT_UncorrectedJetE30_NoBPTX3BX_v6', - 'HLT_UncorrectedJetE30_NoBPTX_v6', - 'HLT_UncorrectedJetE60_NoBPTX3BX_v6', + 'HLT_CDC_L2cosmic_10_er1p0_v1', + 'HLT_CDC_L2cosmic_5p5_er1p0_v1', + 'HLT_L2Mu10_NoVertex_NoBPTX3BX_v5', + 'HLT_L2Mu10_NoVertex_NoBPTX_v6', + 'HLT_L2Mu40_NoVertex_3Sta_NoBPTX3BX_v5', + 'HLT_L2Mu45_NoVertex_3Sta_NoBPTX3BX_v4', + 'HLT_UncorrectedJetE30_NoBPTX3BX_v6', + 'HLT_UncorrectedJetE30_NoBPTX_v6', + 'HLT_UncorrectedJetE60_NoBPTX3BX_v6', 'HLT_UncorrectedJetE70_NoBPTX3BX_v6' ) @@ -217,13 +217,13 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', - 'HLT_ZeroBias_Alignment_v1', - 'HLT_ZeroBias_FirstBXAfterTrain_v3', - 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', - 'HLT_ZeroBias_FirstCollisionInTrain_v4', - 'HLT_ZeroBias_IsolatedBunches_v5', - 'HLT_ZeroBias_LastCollisionInTrain_v3', + 'HLT_Random_v3', + 'HLT_ZeroBias_Alignment_v1', + 'HLT_ZeroBias_FirstBXAfterTrain_v3', + 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', + 'HLT_ZeroBias_FirstCollisionInTrain_v4', + 'HLT_ZeroBias_IsolatedBunches_v5', + 'HLT_ZeroBias_LastCollisionInTrain_v3', 'HLT_ZeroBias_v6' ) @@ -235,107 +235,107 @@ streamPhysicsEGamma_datasetEGamma_selector.l1tResults = cms.InputTag('') streamPhysicsEGamma_datasetEGamma_selector.throw = cms.bool(False) streamPhysicsEGamma_datasetEGamma_selector.triggerConditions = cms.vstring( - 'HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v4', - 'HLT_DiSC30_18_EIso_AND_HE_Mass70_v13', - 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v13', - 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v15', - 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_Mass55_v2', - 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_v2', - 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v13', - 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v13', - 'HLT_DoubleEle25_CaloIdL_MW_v4', - 'HLT_DoubleEle27_CaloIdL_MW_v4', - 'HLT_DoubleEle33_CaloIdL_MW_v17', - 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v20', - 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v20', - 'HLT_DoublePhoton33_CaloIdL_v6', - 'HLT_DoublePhoton70_v6', - 'HLT_DoublePhoton85_v14', - 'HLT_ECALHT800_v10', - 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', - 'HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', - 'HLT_Ele135_CaloIdVT_GsfTrkIdT_v7', - 'HLT_Ele145_CaloIdVT_GsfTrkIdT_v8', - 'HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v3', - 'HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v3', - 'HLT_Ele15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', - 'HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v16', - 'HLT_Ele15_IsoVVVL_PFHT450_v16', - 'HLT_Ele15_IsoVVVL_PFHT600_v20', - 'HLT_Ele15_WPLoose_Gsf_v3', - 'HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v9', - 'HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v16', - 'HLT_Ele17_WPLoose_Gsf_v3', - 'HLT_Ele200_CaloIdVT_GsfTrkIdT_v8', - 'HLT_Ele20_WPLoose_Gsf_v6', - 'HLT_Ele20_WPTight_Gsf_v6', - 'HLT_Ele20_eta2p1_WPLoose_Gsf_v6', - 'HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', - 'HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v18', - 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19', - 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v19', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v13', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele250_CaloIdVT_GsfTrkIdT_v13', - 'HLT_Ele27_Ele37_CaloIdL_MW_v4', - 'HLT_Ele27_WPTight_Gsf_v16', - 'HLT_Ele28_HighEta_SC20_Mass55_v13', - 'HLT_Ele28_WPTight_Gsf_v1', - 'HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v13', - 'HLT_Ele300_CaloIdVT_GsfTrkIdT_v13', - 'HLT_Ele30_WPTight_Gsf_v1', - 'HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v13', - 'HLT_Ele32_WPTight_Gsf_L1DoubleEG_v9', - 'HLT_Ele32_WPTight_Gsf_v15', - 'HLT_Ele35_WPTight_Gsf_L1EGMT_v5', - 'HLT_Ele35_WPTight_Gsf_v9', - 'HLT_Ele38_WPTight_Gsf_v9', - 'HLT_Ele40_WPTight_Gsf_v9', - 'HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v18', - 'HLT_Ele50_IsoVVVL_PFHT450_v16', - 'HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v16', - 'HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v18', - 'HLT_Photon100EBHE10_v2', - 'HLT_Photon100EB_TightID_TightIso_v2', - 'HLT_Photon100EEHE10_v2', - 'HLT_Photon100EE_TightID_TightIso_v2', - 'HLT_Photon110EB_TightID_TightIso_v2', - 'HLT_Photon120EB_TightID_TightIso_v2', - 'HLT_Photon120_R9Id90_HE10_IsoM_v14', - 'HLT_Photon120_v13', - 'HLT_Photon150_v6', - 'HLT_Photon165_R9Id90_HE10_IsoM_v15', - 'HLT_Photon175_v14', - 'HLT_Photon200_v13', - 'HLT_Photon20_HoverELoose_v10', - 'HLT_Photon20_v2', - 'HLT_Photon300_NoHE_v12', - 'HLT_Photon30_HoverELoose_v10', - 'HLT_Photon33_v5', - 'HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v5', - 'HLT_Photon50_R9Id90_HE10_IsoM_v14', - 'HLT_Photon50_v13', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v11', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v5', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_v14', - 'HLT_Photon75_v13', - 'HLT_Photon90_CaloIdL_PFHT700_v16', - 'HLT_Photon90_R9Id90_HE10_IsoM_v14', - 'HLT_Photon90_v13', - 'HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v3', - 'HLT_TriplePhoton_20_20_20_CaloIdLV2_v3', - 'HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v4', - 'HLT_TriplePhoton_30_30_10_CaloIdLV2_v4', + 'HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v4', + 'HLT_DiSC30_18_EIso_AND_HE_Mass70_v13', + 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v13', + 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v15', + 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_Mass55_v2', + 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_v2', + 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v13', + 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v13', + 'HLT_DoubleEle25_CaloIdL_MW_v4', + 'HLT_DoubleEle27_CaloIdL_MW_v4', + 'HLT_DoubleEle33_CaloIdL_MW_v17', + 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v20', + 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v20', + 'HLT_DoublePhoton33_CaloIdL_v6', + 'HLT_DoublePhoton70_v6', + 'HLT_DoublePhoton85_v14', + 'HLT_ECALHT800_v10', + 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', + 'HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', + 'HLT_Ele135_CaloIdVT_GsfTrkIdT_v7', + 'HLT_Ele145_CaloIdVT_GsfTrkIdT_v8', + 'HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v3', + 'HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v3', + 'HLT_Ele15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', + 'HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v16', + 'HLT_Ele15_IsoVVVL_PFHT450_v16', + 'HLT_Ele15_IsoVVVL_PFHT600_v20', + 'HLT_Ele15_WPLoose_Gsf_v3', + 'HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v9', + 'HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v16', + 'HLT_Ele17_WPLoose_Gsf_v3', + 'HLT_Ele200_CaloIdVT_GsfTrkIdT_v8', + 'HLT_Ele20_WPLoose_Gsf_v6', + 'HLT_Ele20_WPTight_Gsf_v6', + 'HLT_Ele20_eta2p1_WPLoose_Gsf_v6', + 'HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', + 'HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v18', + 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19', + 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v19', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v13', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele250_CaloIdVT_GsfTrkIdT_v13', + 'HLT_Ele27_Ele37_CaloIdL_MW_v4', + 'HLT_Ele27_WPTight_Gsf_v16', + 'HLT_Ele28_HighEta_SC20_Mass55_v13', + 'HLT_Ele28_WPTight_Gsf_v1', + 'HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v13', + 'HLT_Ele300_CaloIdVT_GsfTrkIdT_v13', + 'HLT_Ele30_WPTight_Gsf_v1', + 'HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v13', + 'HLT_Ele32_WPTight_Gsf_L1DoubleEG_v9', + 'HLT_Ele32_WPTight_Gsf_v15', + 'HLT_Ele35_WPTight_Gsf_L1EGMT_v5', + 'HLT_Ele35_WPTight_Gsf_v9', + 'HLT_Ele38_WPTight_Gsf_v9', + 'HLT_Ele40_WPTight_Gsf_v9', + 'HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v18', + 'HLT_Ele50_IsoVVVL_PFHT450_v16', + 'HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v16', + 'HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v18', + 'HLT_Photon100EBHE10_v2', + 'HLT_Photon100EB_TightID_TightIso_v2', + 'HLT_Photon100EEHE10_v2', + 'HLT_Photon100EE_TightID_TightIso_v2', + 'HLT_Photon110EB_TightID_TightIso_v2', + 'HLT_Photon120EB_TightID_TightIso_v2', + 'HLT_Photon120_R9Id90_HE10_IsoM_v14', + 'HLT_Photon120_v13', + 'HLT_Photon150_v6', + 'HLT_Photon165_R9Id90_HE10_IsoM_v15', + 'HLT_Photon175_v14', + 'HLT_Photon200_v13', + 'HLT_Photon20_HoverELoose_v10', + 'HLT_Photon20_v2', + 'HLT_Photon300_NoHE_v12', + 'HLT_Photon30_HoverELoose_v10', + 'HLT_Photon33_v5', + 'HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v5', + 'HLT_Photon50_R9Id90_HE10_IsoM_v14', + 'HLT_Photon50_v13', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v11', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v5', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_v14', + 'HLT_Photon75_v13', + 'HLT_Photon90_CaloIdL_PFHT700_v16', + 'HLT_Photon90_R9Id90_HE10_IsoM_v14', + 'HLT_Photon90_v13', + 'HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v3', + 'HLT_TriplePhoton_20_20_20_CaloIdLV2_v3', + 'HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v4', + 'HLT_TriplePhoton_30_30_10_CaloIdLV2_v4', 'HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v4' ) @@ -347,8 +347,8 @@ streamPhysicsEndOfFill_datasetEmptyBX_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetEmptyBX_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetEmptyBX_selector.triggerConditions = cms.vstring( - 'HLT_L1NotBptxOR_v3', - 'HLT_L1UnpairedBunchBptxMinus_v2', + 'HLT_L1NotBptxOR_v3', + 'HLT_L1UnpairedBunchBptxMinus_v2', 'HLT_L1UnpairedBunchBptxPlus_v2' ) @@ -357,7 +357,7 @@ streamPhysicsEndOfFill_datasetFSQJet1_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetFSQJet1_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetFSQJet1_selector.triggerConditions = cms.vstring( - 'HLT_DiPFJet15_NoCaloMatched_v16', + 'HLT_DiPFJet15_NoCaloMatched_v16', 'HLT_DiPFJet25_NoCaloMatched_v16' ) @@ -366,10 +366,10 @@ streamPhysicsEndOfFill_datasetFSQJet2_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetFSQJet2_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetFSQJet2_selector.triggerConditions = cms.vstring( - 'HLT_DiPFJet15_FBEta3_NoCaloMatched_v17', - 'HLT_DiPFJet25_FBEta3_NoCaloMatched_v17', - 'HLT_DiPFJetAve15_HFJEC_v17', - 'HLT_DiPFJetAve25_HFJEC_v17', + 'HLT_DiPFJet15_FBEta3_NoCaloMatched_v17', + 'HLT_DiPFJet25_FBEta3_NoCaloMatched_v17', + 'HLT_DiPFJetAve15_HFJEC_v17', + 'HLT_DiPFJetAve25_HFJEC_v17', 'HLT_DiPFJetAve35_HFJEC_v17' ) @@ -378,11 +378,11 @@ streamPhysicsEndOfFill_datasetHINCaloJets_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetHINCaloJets_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetHINCaloJets_selector.triggerConditions = cms.vstring( - 'HLT_AK4CaloJet100_v10', - 'HLT_AK4CaloJet120_v9', - 'HLT_AK4CaloJet30_v11', - 'HLT_AK4CaloJet40_v10', - 'HLT_AK4CaloJet50_v10', + 'HLT_AK4CaloJet100_v10', + 'HLT_AK4CaloJet120_v9', + 'HLT_AK4CaloJet30_v11', + 'HLT_AK4CaloJet40_v10', + 'HLT_AK4CaloJet50_v10', 'HLT_AK4CaloJet80_v10' ) @@ -391,10 +391,10 @@ streamPhysicsEndOfFill_datasetHINPFJets_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetHINPFJets_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetHINPFJets_selector.triggerConditions = cms.vstring( - 'HLT_AK4PFJet100_v19', - 'HLT_AK4PFJet120_v18', - 'HLT_AK4PFJet30_v19', - 'HLT_AK4PFJet50_v19', + 'HLT_AK4PFJet100_v19', + 'HLT_AK4PFJet120_v18', + 'HLT_AK4PFJet30_v19', + 'HLT_AK4PFJet50_v19', 'HLT_AK4PFJet80_v19' ) @@ -466,23 +466,23 @@ streamPhysicsHadronsTaus_datasetBTagMu_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetBTagMu_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetBTagMu_selector.triggerConditions = cms.vstring( - 'HLT_BTagMu_AK4DiJet110_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet110_Mu5_v13', - 'HLT_BTagMu_AK4DiJet170_Mu5_noalgo_v12', - 'HLT_BTagMu_AK4DiJet170_Mu5_v12', - 'HLT_BTagMu_AK4DiJet20_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet20_Mu5_v13', - 'HLT_BTagMu_AK4DiJet40_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet40_Mu5_v13', - 'HLT_BTagMu_AK4DiJet70_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet70_Mu5_v13', - 'HLT_BTagMu_AK4Jet300_Mu5_noalgo_v12', - 'HLT_BTagMu_AK4Jet300_Mu5_v12', - 'HLT_BTagMu_AK8DiJet170_Mu5_noalgo_v9', - 'HLT_BTagMu_AK8DiJet170_Mu5_v9', - 'HLT_BTagMu_AK8Jet170_DoubleMu5_noalgo_v2', - 'HLT_BTagMu_AK8Jet170_DoubleMu5_v2', - 'HLT_BTagMu_AK8Jet300_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4DiJet110_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet110_Mu5_v13', + 'HLT_BTagMu_AK4DiJet170_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4DiJet170_Mu5_v12', + 'HLT_BTagMu_AK4DiJet20_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet20_Mu5_v13', + 'HLT_BTagMu_AK4DiJet40_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet40_Mu5_v13', + 'HLT_BTagMu_AK4DiJet70_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet70_Mu5_v13', + 'HLT_BTagMu_AK4Jet300_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4Jet300_Mu5_v12', + 'HLT_BTagMu_AK8DiJet170_Mu5_noalgo_v9', + 'HLT_BTagMu_AK8DiJet170_Mu5_v9', + 'HLT_BTagMu_AK8Jet170_DoubleMu5_noalgo_v2', + 'HLT_BTagMu_AK8Jet170_DoubleMu5_v2', + 'HLT_BTagMu_AK8Jet300_Mu5_noalgo_v12', 'HLT_BTagMu_AK8Jet300_Mu5_v12' ) @@ -491,12 +491,12 @@ streamPhysicsHadronsTaus_datasetDisplacedJet_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetDisplacedJet_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetDisplacedJet_selector.triggerConditions = cms.vstring( - 'HLT_HT400_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT425_v9', - 'HLT_HT430_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT430_DisplacedDijet60_DisplacedTrack_v13', - 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT550_DisplacedDijet60_Inclusive_v13', + 'HLT_HT400_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT425_v9', + 'HLT_HT430_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT430_DisplacedDijet60_DisplacedTrack_v13', + 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT550_DisplacedDijet60_Inclusive_v13', 'HLT_HT650_DisplacedDijet60_Inclusive_v13' ) @@ -505,144 +505,144 @@ streamPhysicsHadronsTaus_datasetJetHT_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetJetHT_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetJetHT_selector.triggerConditions = cms.vstring( - 'HLT_AK8PFHT750_TrimMass50_v12', - 'HLT_AK8PFHT800_TrimMass50_v12', - 'HLT_AK8PFHT850_TrimMass50_v11', - 'HLT_AK8PFHT900_TrimMass50_v11', - 'HLT_AK8PFJet140_v15', - 'HLT_AK8PFJet15_v3', - 'HLT_AK8PFJet200_v15', - 'HLT_AK8PFJet25_v3', - 'HLT_AK8PFJet260_v16', - 'HLT_AK8PFJet320_v16', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p17_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p1_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np2_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np4_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v3', - 'HLT_AK8PFJet360_TrimMass30_v18', - 'HLT_AK8PFJet380_TrimMass30_v11', - 'HLT_AK8PFJet400_TrimMass30_v12', - 'HLT_AK8PFJet400_v16', - 'HLT_AK8PFJet40_v16', - 'HLT_AK8PFJet420_TrimMass30_v11', - 'HLT_AK8PFJet450_v16', - 'HLT_AK8PFJet500_v16', - 'HLT_AK8PFJet550_v11', - 'HLT_AK8PFJet60_v15', - 'HLT_AK8PFJet80_v15', - 'HLT_AK8PFJetFwd140_v14', - 'HLT_AK8PFJetFwd15_v3', - 'HLT_AK8PFJetFwd200_v14', - 'HLT_AK8PFJetFwd25_v3', - 'HLT_AK8PFJetFwd260_v15', - 'HLT_AK8PFJetFwd320_v15', - 'HLT_AK8PFJetFwd400_v15', - 'HLT_AK8PFJetFwd40_v15', - 'HLT_AK8PFJetFwd450_v15', - 'HLT_AK8PFJetFwd500_v15', - 'HLT_AK8PFJetFwd60_v14', - 'HLT_AK8PFJetFwd80_v14', - 'HLT_CaloJet500_NoJetID_v12', - 'HLT_CaloJet550_NoJetID_v7', - 'HLT_DiPFJetAve100_HFJEC_v16', - 'HLT_DiPFJetAve140_v13', - 'HLT_DiPFJetAve160_HFJEC_v16', - 'HLT_DiPFJetAve200_v13', - 'HLT_DiPFJetAve220_HFJEC_v16', - 'HLT_DiPFJetAve260_v14', - 'HLT_DiPFJetAve300_HFJEC_v16', - 'HLT_DiPFJetAve320_v14', - 'HLT_DiPFJetAve400_v14', - 'HLT_DiPFJetAve40_v14', - 'HLT_DiPFJetAve500_v14', - 'HLT_DiPFJetAve60_HFJEC_v15', - 'HLT_DiPFJetAve60_v14', - 'HLT_DiPFJetAve80_HFJEC_v16', - 'HLT_DiPFJetAve80_v13', - 'HLT_DoublePFJets100_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets200_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets350_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets40_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets100_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets200_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets350_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets40_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_PFHT1050_v18', - 'HLT_PFHT180_v17', - 'HLT_PFHT250_v17', - 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v3', - 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v9', - 'HLT_PFHT350MinPFJet15_v9', - 'HLT_PFHT350_v19', - 'HLT_PFHT370_v17', - 'HLT_PFHT400_FivePFJet_100_100_60_30_30_DoublePFBTagDeepCSV_4p5_v8', - 'HLT_PFHT400_FivePFJet_100_100_60_30_30_v8', - 'HLT_PFHT400_FivePFJet_120_120_60_30_30_DoublePFBTagDeepCSV_4p5_v8', - 'HLT_PFHT400_SixPFJet32_DoublePFBTagDeepCSV_2p94_v8', - 'HLT_PFHT400_SixPFJet32_v8', - 'HLT_PFHT430_v17', - 'HLT_PFHT450_SixPFJet36_PFBTagDeepCSV_1p59_v7', - 'HLT_PFHT450_SixPFJet36_v7', - 'HLT_PFHT500_PFMET100_PFMHT100_IDTight_v12', - 'HLT_PFHT500_PFMET110_PFMHT110_IDTight_v12', - 'HLT_PFHT510_v17', - 'HLT_PFHT590_v17', - 'HLT_PFHT680_v17', - 'HLT_PFHT700_PFMET85_PFMHT85_IDTight_v12', - 'HLT_PFHT700_PFMET95_PFMHT95_IDTight_v12', - 'HLT_PFHT780_v17', - 'HLT_PFHT800_PFMET75_PFMHT75_IDTight_v12', - 'HLT_PFHT800_PFMET85_PFMHT85_IDTight_v12', - 'HLT_PFHT890_v17', - 'HLT_PFJet140_v19', - 'HLT_PFJet15_v3', - 'HLT_PFJet200_v19', - 'HLT_PFJet25_v3', - 'HLT_PFJet260_v20', - 'HLT_PFJet320_v20', - 'HLT_PFJet400_v20', - 'HLT_PFJet40_v21', - 'HLT_PFJet450_v21', - 'HLT_PFJet500_v21', - 'HLT_PFJet550_v11', - 'HLT_PFJet60_v21', - 'HLT_PFJet80_v20', - 'HLT_PFJetFwd140_v18', - 'HLT_PFJetFwd15_v3', - 'HLT_PFJetFwd200_v18', - 'HLT_PFJetFwd25_v3', - 'HLT_PFJetFwd260_v19', - 'HLT_PFJetFwd320_v19', - 'HLT_PFJetFwd400_v19', - 'HLT_PFJetFwd40_v19', - 'HLT_PFJetFwd450_v19', - 'HLT_PFJetFwd500_v19', - 'HLT_PFJetFwd60_v19', - 'HLT_PFJetFwd80_v18', - 'HLT_QuadPFJet103_88_75_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet103_88_75_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet103_88_75_15_v5', - 'HLT_QuadPFJet105_88_76_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet105_88_76_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet105_88_76_15_v5', - 'HLT_QuadPFJet111_90_80_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet111_90_80_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet111_90_80_15_v5', - 'HLT_QuadPFJet98_83_71_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet98_83_71_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet98_83_71_15_v5', - 'HLT_Rsq0p35_v15', - 'HLT_Rsq0p40_v15', - 'HLT_RsqMR300_Rsq0p09_MR200_4jet_v15', - 'HLT_RsqMR300_Rsq0p09_MR200_v15', - 'HLT_RsqMR320_Rsq0p09_MR200_4jet_v15', - 'HLT_RsqMR320_Rsq0p09_MR200_v15', + 'HLT_AK8PFHT750_TrimMass50_v12', + 'HLT_AK8PFHT800_TrimMass50_v12', + 'HLT_AK8PFHT850_TrimMass50_v11', + 'HLT_AK8PFHT900_TrimMass50_v11', + 'HLT_AK8PFJet140_v15', + 'HLT_AK8PFJet15_v3', + 'HLT_AK8PFJet200_v15', + 'HLT_AK8PFJet25_v3', + 'HLT_AK8PFJet260_v16', + 'HLT_AK8PFJet320_v16', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p17_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p1_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np2_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np4_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v3', + 'HLT_AK8PFJet360_TrimMass30_v18', + 'HLT_AK8PFJet380_TrimMass30_v11', + 'HLT_AK8PFJet400_TrimMass30_v12', + 'HLT_AK8PFJet400_v16', + 'HLT_AK8PFJet40_v16', + 'HLT_AK8PFJet420_TrimMass30_v11', + 'HLT_AK8PFJet450_v16', + 'HLT_AK8PFJet500_v16', + 'HLT_AK8PFJet550_v11', + 'HLT_AK8PFJet60_v15', + 'HLT_AK8PFJet80_v15', + 'HLT_AK8PFJetFwd140_v14', + 'HLT_AK8PFJetFwd15_v3', + 'HLT_AK8PFJetFwd200_v14', + 'HLT_AK8PFJetFwd25_v3', + 'HLT_AK8PFJetFwd260_v15', + 'HLT_AK8PFJetFwd320_v15', + 'HLT_AK8PFJetFwd400_v15', + 'HLT_AK8PFJetFwd40_v15', + 'HLT_AK8PFJetFwd450_v15', + 'HLT_AK8PFJetFwd500_v15', + 'HLT_AK8PFJetFwd60_v14', + 'HLT_AK8PFJetFwd80_v14', + 'HLT_CaloJet500_NoJetID_v12', + 'HLT_CaloJet550_NoJetID_v7', + 'HLT_DiPFJetAve100_HFJEC_v16', + 'HLT_DiPFJetAve140_v13', + 'HLT_DiPFJetAve160_HFJEC_v16', + 'HLT_DiPFJetAve200_v13', + 'HLT_DiPFJetAve220_HFJEC_v16', + 'HLT_DiPFJetAve260_v14', + 'HLT_DiPFJetAve300_HFJEC_v16', + 'HLT_DiPFJetAve320_v14', + 'HLT_DiPFJetAve400_v14', + 'HLT_DiPFJetAve40_v14', + 'HLT_DiPFJetAve500_v14', + 'HLT_DiPFJetAve60_HFJEC_v15', + 'HLT_DiPFJetAve60_v14', + 'HLT_DiPFJetAve80_HFJEC_v16', + 'HLT_DiPFJetAve80_v13', + 'HLT_DoublePFJets100_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets200_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets350_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets40_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets100_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets200_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets350_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets40_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_PFHT1050_v18', + 'HLT_PFHT180_v17', + 'HLT_PFHT250_v17', + 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v3', + 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v9', + 'HLT_PFHT350MinPFJet15_v9', + 'HLT_PFHT350_v19', + 'HLT_PFHT370_v17', + 'HLT_PFHT400_FivePFJet_100_100_60_30_30_DoublePFBTagDeepCSV_4p5_v8', + 'HLT_PFHT400_FivePFJet_100_100_60_30_30_v8', + 'HLT_PFHT400_FivePFJet_120_120_60_30_30_DoublePFBTagDeepCSV_4p5_v8', + 'HLT_PFHT400_SixPFJet32_DoublePFBTagDeepCSV_2p94_v8', + 'HLT_PFHT400_SixPFJet32_v8', + 'HLT_PFHT430_v17', + 'HLT_PFHT450_SixPFJet36_PFBTagDeepCSV_1p59_v7', + 'HLT_PFHT450_SixPFJet36_v7', + 'HLT_PFHT500_PFMET100_PFMHT100_IDTight_v12', + 'HLT_PFHT500_PFMET110_PFMHT110_IDTight_v12', + 'HLT_PFHT510_v17', + 'HLT_PFHT590_v17', + 'HLT_PFHT680_v17', + 'HLT_PFHT700_PFMET85_PFMHT85_IDTight_v12', + 'HLT_PFHT700_PFMET95_PFMHT95_IDTight_v12', + 'HLT_PFHT780_v17', + 'HLT_PFHT800_PFMET75_PFMHT75_IDTight_v12', + 'HLT_PFHT800_PFMET85_PFMHT85_IDTight_v12', + 'HLT_PFHT890_v17', + 'HLT_PFJet140_v19', + 'HLT_PFJet15_v3', + 'HLT_PFJet200_v19', + 'HLT_PFJet25_v3', + 'HLT_PFJet260_v20', + 'HLT_PFJet320_v20', + 'HLT_PFJet400_v20', + 'HLT_PFJet40_v21', + 'HLT_PFJet450_v21', + 'HLT_PFJet500_v21', + 'HLT_PFJet550_v11', + 'HLT_PFJet60_v21', + 'HLT_PFJet80_v20', + 'HLT_PFJetFwd140_v18', + 'HLT_PFJetFwd15_v3', + 'HLT_PFJetFwd200_v18', + 'HLT_PFJetFwd25_v3', + 'HLT_PFJetFwd260_v19', + 'HLT_PFJetFwd320_v19', + 'HLT_PFJetFwd400_v19', + 'HLT_PFJetFwd40_v19', + 'HLT_PFJetFwd450_v19', + 'HLT_PFJetFwd500_v19', + 'HLT_PFJetFwd60_v19', + 'HLT_PFJetFwd80_v18', + 'HLT_QuadPFJet103_88_75_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet103_88_75_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet103_88_75_15_v5', + 'HLT_QuadPFJet105_88_76_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet105_88_76_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet105_88_76_15_v5', + 'HLT_QuadPFJet111_90_80_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet111_90_80_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet111_90_80_15_v5', + 'HLT_QuadPFJet98_83_71_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet98_83_71_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet98_83_71_15_v5', + 'HLT_Rsq0p35_v15', + 'HLT_Rsq0p40_v15', + 'HLT_RsqMR300_Rsq0p09_MR200_4jet_v15', + 'HLT_RsqMR300_Rsq0p09_MR200_v15', + 'HLT_RsqMR320_Rsq0p09_MR200_4jet_v15', + 'HLT_RsqMR320_Rsq0p09_MR200_v15', 'HLT_SingleJet30_Mu12_SinglePFJet40_v11' ) @@ -651,54 +651,54 @@ streamPhysicsHadronsTaus_datasetMET_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetMET_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetMET_selector.triggerConditions = cms.vstring( - 'HLT_CaloMET100_NotCleaned_v4', - 'HLT_CaloMET110_NotCleaned_v4', - 'HLT_CaloMET250_NotCleaned_v4', - 'HLT_CaloMET300_NotCleaned_v4', - 'HLT_CaloMET350_NotCleaned_v4', - 'HLT_CaloMET80_NotCleaned_v4', - 'HLT_CaloMET90_NotCleaned_v4', - 'HLT_CaloMHT90_v4', - 'HLT_DiJet110_35_Mjj650_PFMET110_v9', - 'HLT_DiJet110_35_Mjj650_PFMET120_v9', - 'HLT_DiJet110_35_Mjj650_PFMET130_v9', - 'HLT_L1ETMHadSeeds_v2', - 'HLT_MET105_IsoTrk50_v9', - 'HLT_MET120_IsoTrk50_v9', - 'HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', - 'HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', - 'HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', - 'HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', - 'HLT_PFMET100_PFMHT100_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET100_PFMHT100_IDTight_PFHT60_v9', - 'HLT_PFMET110_PFMHT110_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET110_PFMHT110_IDTight_v20', - 'HLT_PFMET120_PFMHT120_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET120_PFMHT120_IDTight_PFHT60_v9', - 'HLT_PFMET120_PFMHT120_IDTight_v20', - 'HLT_PFMET130_PFMHT130_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET130_PFMHT130_IDTight_v20', - 'HLT_PFMET140_PFMHT140_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET140_PFMHT140_IDTight_v20', - 'HLT_PFMET200_BeamHaloCleaned_v9', - 'HLT_PFMET200_NotCleaned_v9', - 'HLT_PFMET250_NotCleaned_v9', - 'HLT_PFMET300_NotCleaned_v9', - 'HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v9', - 'HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', - 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v9', - 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', - 'HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', - 'HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', - 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v9', - 'HLT_PFMETTypeOne110_PFMHT110_IDTight_v12', - 'HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v9', - 'HLT_PFMETTypeOne120_PFMHT120_IDTight_v12', - 'HLT_PFMETTypeOne130_PFMHT130_IDTight_v12', - 'HLT_PFMETTypeOne140_PFMHT140_IDTight_v11', - 'HLT_PFMETTypeOne200_BeamHaloCleaned_v9', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v9', - 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v9', + 'HLT_CaloMET100_NotCleaned_v4', + 'HLT_CaloMET110_NotCleaned_v4', + 'HLT_CaloMET250_NotCleaned_v4', + 'HLT_CaloMET300_NotCleaned_v4', + 'HLT_CaloMET350_NotCleaned_v4', + 'HLT_CaloMET80_NotCleaned_v4', + 'HLT_CaloMET90_NotCleaned_v4', + 'HLT_CaloMHT90_v4', + 'HLT_DiJet110_35_Mjj650_PFMET110_v9', + 'HLT_DiJet110_35_Mjj650_PFMET120_v9', + 'HLT_DiJet110_35_Mjj650_PFMET130_v9', + 'HLT_L1ETMHadSeeds_v2', + 'HLT_MET105_IsoTrk50_v9', + 'HLT_MET120_IsoTrk50_v9', + 'HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', + 'HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', + 'HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', + 'HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', + 'HLT_PFMET100_PFMHT100_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET100_PFMHT100_IDTight_PFHT60_v9', + 'HLT_PFMET110_PFMHT110_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET110_PFMHT110_IDTight_v20', + 'HLT_PFMET120_PFMHT120_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET120_PFMHT120_IDTight_PFHT60_v9', + 'HLT_PFMET120_PFMHT120_IDTight_v20', + 'HLT_PFMET130_PFMHT130_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET130_PFMHT130_IDTight_v20', + 'HLT_PFMET140_PFMHT140_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET140_PFMHT140_IDTight_v20', + 'HLT_PFMET200_BeamHaloCleaned_v9', + 'HLT_PFMET200_NotCleaned_v9', + 'HLT_PFMET250_NotCleaned_v9', + 'HLT_PFMET300_NotCleaned_v9', + 'HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v9', + 'HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', + 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v9', + 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', + 'HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', + 'HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', + 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v9', + 'HLT_PFMETTypeOne110_PFMHT110_IDTight_v12', + 'HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v9', + 'HLT_PFMETTypeOne120_PFMHT120_IDTight_v12', + 'HLT_PFMETTypeOne130_PFMHT130_IDTight_v12', + 'HLT_PFMETTypeOne140_PFMHT140_IDTight_v11', + 'HLT_PFMETTypeOne200_BeamHaloCleaned_v9', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v9', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v9', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v9' ) @@ -707,34 +707,34 @@ streamPhysicsHadronsTaus_datasetTau_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetTau_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetTau_selector.triggerConditions = cms.vstring( - 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', - 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', - 'HLT_DoubleMediumChargedIsoPFTauHPS30_L1MaxMass_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4', - 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', - 'HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', - 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', - 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v11', - 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v3', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v12', - 'HLT_Photon35_TwoProngs35_v1', - 'HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v3', - 'HLT_VBF_DoubleLooseChargedIsoPFTauHPS20_Trk1_eta2p1_v1', - 'HLT_VBF_DoubleMediumChargedIsoPFTauHPS20_Trk1_eta2p1_v1', + 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', + 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', + 'HLT_DoubleMediumChargedIsoPFTauHPS30_L1MaxMass_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4', + 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', + 'HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', + 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', + 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v11', + 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v3', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v12', + 'HLT_Photon35_TwoProngs35_v1', + 'HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v3', + 'HLT_VBF_DoubleLooseChargedIsoPFTauHPS20_Trk1_eta2p1_v1', + 'HLT_VBF_DoubleMediumChargedIsoPFTauHPS20_Trk1_eta2p1_v1', 'HLT_VBF_DoubleTightChargedIsoPFTauHPS20_Trk1_eta2p1_v1' ) @@ -746,37 +746,37 @@ streamPhysicsMuons_datasetCharmonium_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetCharmonium_selector.throw = cms.bool(False) streamPhysicsMuons_datasetCharmonium_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_Jpsi3p5_Muon2_v5', - 'HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v7', - 'HLT_Dimuon0_Jpsi_L1_NoOS_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_v8', - 'HLT_Dimuon0_Jpsi_v8', - 'HLT_Dimuon0_LowMass_L1_0er1p5R_v7', - 'HLT_Dimuon0_LowMass_L1_0er1p5_v8', - 'HLT_Dimuon0_LowMass_L1_4R_v7', - 'HLT_Dimuon0_LowMass_L1_4_v8', - 'HLT_Dimuon0_LowMass_v8', - 'HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v7', - 'HLT_Dimuon18_PsiPrime_noCorrL1_v6', - 'HLT_Dimuon18_PsiPrime_v14', - 'HLT_Dimuon20_Jpsi_Barrel_Seagulls_v7', - 'HLT_Dimuon25_Jpsi_noCorrL1_v6', - 'HLT_Dimuon25_Jpsi_v14', - 'HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v5', - 'HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v6', - 'HLT_DoubleMu4_3_Bs_v14', - 'HLT_DoubleMu4_3_Jpsi_v2', - 'HLT_DoubleMu4_JpsiTrkTrk_Displaced_v7', - 'HLT_DoubleMu4_JpsiTrk_Displaced_v15', - 'HLT_DoubleMu4_Jpsi_Displaced_v7', - 'HLT_DoubleMu4_Jpsi_NoVertexing_v7', - 'HLT_DoubleMu4_PsiPrimeTrk_Displaced_v15', - 'HLT_Mu30_TkMu0_Psi_v1', - 'HLT_Mu7p5_L2Mu2_Jpsi_v10', - 'HLT_Mu7p5_Track2_Jpsi_v11', - 'HLT_Mu7p5_Track3p5_Jpsi_v11', + 'HLT_Dimuon0_Jpsi3p5_Muon2_v5', + 'HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v7', + 'HLT_Dimuon0_Jpsi_L1_NoOS_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_v8', + 'HLT_Dimuon0_Jpsi_v8', + 'HLT_Dimuon0_LowMass_L1_0er1p5R_v7', + 'HLT_Dimuon0_LowMass_L1_0er1p5_v8', + 'HLT_Dimuon0_LowMass_L1_4R_v7', + 'HLT_Dimuon0_LowMass_L1_4_v8', + 'HLT_Dimuon0_LowMass_v8', + 'HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v7', + 'HLT_Dimuon18_PsiPrime_noCorrL1_v6', + 'HLT_Dimuon18_PsiPrime_v14', + 'HLT_Dimuon20_Jpsi_Barrel_Seagulls_v7', + 'HLT_Dimuon25_Jpsi_noCorrL1_v6', + 'HLT_Dimuon25_Jpsi_v14', + 'HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v5', + 'HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v6', + 'HLT_DoubleMu4_3_Bs_v14', + 'HLT_DoubleMu4_3_Jpsi_v2', + 'HLT_DoubleMu4_JpsiTrkTrk_Displaced_v7', + 'HLT_DoubleMu4_JpsiTrk_Displaced_v15', + 'HLT_DoubleMu4_Jpsi_Displaced_v7', + 'HLT_DoubleMu4_Jpsi_NoVertexing_v7', + 'HLT_DoubleMu4_PsiPrimeTrk_Displaced_v15', + 'HLT_Mu30_TkMu0_Psi_v1', + 'HLT_Mu7p5_L2Mu2_Jpsi_v10', + 'HLT_Mu7p5_Track2_Jpsi_v11', + 'HLT_Mu7p5_Track3p5_Jpsi_v11', 'HLT_Mu7p5_Track7_Jpsi_v11' ) @@ -785,61 +785,61 @@ streamPhysicsMuons_datasetDoubleMuon_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetDoubleMuon_selector.throw = cms.bool(False) streamPhysicsMuons_datasetDoubleMuon_selector.triggerConditions = cms.vstring( - 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_NoL2Matched_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_NoL2Matched_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_v2', - 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v2', - 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v2', - 'HLT_DoubleL2Mu50_v2', - 'HLT_DoubleMu33NoFiltersNoVtxDisplaced_v1', - 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v10', - 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v10', - 'HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v10', - 'HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v10', - 'HLT_DoubleMu40NoFiltersNoVtxDisplaced_v1', - 'HLT_DoubleMu43NoFiltersNoVtx_v4', - 'HLT_DoubleMu48NoFiltersNoVtx_v4', - 'HLT_DoubleMu4_Mass3p8_DZ_PFHT350_v8', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v5', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v5', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v15', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v14', - 'HLT_Mu17_TrkIsoVVL_v13', - 'HLT_Mu17_v13', - 'HLT_Mu18_Mu9_DZ_v4', - 'HLT_Mu18_Mu9_SameSign_DZ_v4', - 'HLT_Mu18_Mu9_SameSign_v4', - 'HLT_Mu18_Mu9_v4', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v3', - 'HLT_Mu19_TrkIsoVVL_v4', - 'HLT_Mu19_v4', - 'HLT_Mu20_Mu10_DZ_v4', - 'HLT_Mu20_Mu10_SameSign_DZ_v4', - 'HLT_Mu20_Mu10_SameSign_v4', - 'HLT_Mu20_Mu10_v4', - 'HLT_Mu23_Mu12_DZ_v4', - 'HLT_Mu23_Mu12_SameSign_DZ_v4', - 'HLT_Mu23_Mu12_SameSign_v4', - 'HLT_Mu23_Mu12_v4', - 'HLT_Mu37_TkMu27_v5', - 'HLT_Mu8_TrkIsoVVL_v12', - 'HLT_Mu8_v12', - 'HLT_TripleMu_10_5_5_DZ_v10', - 'HLT_TripleMu_12_10_5_v10', - 'HLT_TripleMu_5_3_3_Mass3p8_DCA_v3', - 'HLT_TripleMu_5_3_3_Mass3p8_DZ_v8', - 'HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v6', - 'HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v12', + 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_NoL2Matched_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_NoL2Matched_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_v2', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v2', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v2', + 'HLT_DoubleL2Mu50_v2', + 'HLT_DoubleMu33NoFiltersNoVtxDisplaced_v1', + 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v10', + 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v10', + 'HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v10', + 'HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v10', + 'HLT_DoubleMu40NoFiltersNoVtxDisplaced_v1', + 'HLT_DoubleMu43NoFiltersNoVtx_v4', + 'HLT_DoubleMu48NoFiltersNoVtx_v4', + 'HLT_DoubleMu4_Mass3p8_DZ_PFHT350_v8', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v5', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v5', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v15', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v14', + 'HLT_Mu17_TrkIsoVVL_v13', + 'HLT_Mu17_v13', + 'HLT_Mu18_Mu9_DZ_v4', + 'HLT_Mu18_Mu9_SameSign_DZ_v4', + 'HLT_Mu18_Mu9_SameSign_v4', + 'HLT_Mu18_Mu9_v4', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v3', + 'HLT_Mu19_TrkIsoVVL_v4', + 'HLT_Mu19_v4', + 'HLT_Mu20_Mu10_DZ_v4', + 'HLT_Mu20_Mu10_SameSign_DZ_v4', + 'HLT_Mu20_Mu10_SameSign_v4', + 'HLT_Mu20_Mu10_v4', + 'HLT_Mu23_Mu12_DZ_v4', + 'HLT_Mu23_Mu12_SameSign_DZ_v4', + 'HLT_Mu23_Mu12_SameSign_v4', + 'HLT_Mu23_Mu12_v4', + 'HLT_Mu37_TkMu27_v5', + 'HLT_Mu8_TrkIsoVVL_v12', + 'HLT_Mu8_v12', + 'HLT_TripleMu_10_5_5_DZ_v10', + 'HLT_TripleMu_12_10_5_v10', + 'HLT_TripleMu_5_3_3_Mass3p8_DCA_v3', + 'HLT_TripleMu_5_3_3_Mass3p8_DZ_v8', + 'HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v6', + 'HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v12', 'HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v13' ) @@ -848,14 +848,14 @@ streamPhysicsMuons_datasetDoubleMuonLowMass_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetDoubleMuonLowMass_selector.throw = cms.bool(False) streamPhysicsMuons_datasetDoubleMuonLowMass_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_LowMass_L1_TM530_v6', - 'HLT_DoubleMu3_TkMu_DsTau3Mu_v4', - 'HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v6', - 'HLT_DoubleMu3_Trk_Tau3mu_v12', - 'HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v15', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v4', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v4', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v4', + 'HLT_Dimuon0_LowMass_L1_TM530_v6', + 'HLT_DoubleMu3_TkMu_DsTau3Mu_v4', + 'HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v6', + 'HLT_DoubleMu3_Trk_Tau3mu_v12', + 'HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v15', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v4', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v4', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v4', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v4' ) @@ -864,30 +864,30 @@ streamPhysicsMuons_datasetMuOnia_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetMuOnia_selector.throw = cms.bool(False) streamPhysicsMuons_datasetMuOnia_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_Upsilon_L1_4p5NoOS_v8', - 'HLT_Dimuon0_Upsilon_L1_4p5_v9', - 'HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v7', - 'HLT_Dimuon0_Upsilon_L1_4p5er2p0_v9', - 'HLT_Dimuon0_Upsilon_L1_5M_v8', - 'HLT_Dimuon0_Upsilon_L1_5_v9', - 'HLT_Dimuon0_Upsilon_Muon_L1_TM0_v6', - 'HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v6', - 'HLT_Dimuon0_Upsilon_NoVertexing_v7', - 'HLT_Dimuon12_Upsilon_y1p4_v2', - 'HLT_Dimuon14_Phi_Barrel_Seagulls_v7', - 'HLT_Dimuon24_Phi_noCorrL1_v6', - 'HLT_Dimuon24_Upsilon_noCorrL1_v6', - 'HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v4', - 'HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v4', - 'HLT_Mu20_TkMu0_Phi_v8', - 'HLT_Mu25_TkMu0_Onia_v8', - 'HLT_Mu25_TkMu0_Phi_v8', - 'HLT_Mu30_TkMu0_Upsilon_v1', - 'HLT_Mu7p5_L2Mu2_Upsilon_v10', - 'HLT_Mu7p5_Track2_Upsilon_v11', - 'HLT_Mu7p5_Track3p5_Upsilon_v11', - 'HLT_Mu7p5_Track7_Upsilon_v11', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v5', + 'HLT_Dimuon0_Upsilon_L1_4p5NoOS_v8', + 'HLT_Dimuon0_Upsilon_L1_4p5_v9', + 'HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v7', + 'HLT_Dimuon0_Upsilon_L1_4p5er2p0_v9', + 'HLT_Dimuon0_Upsilon_L1_5M_v8', + 'HLT_Dimuon0_Upsilon_L1_5_v9', + 'HLT_Dimuon0_Upsilon_Muon_L1_TM0_v6', + 'HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v6', + 'HLT_Dimuon0_Upsilon_NoVertexing_v7', + 'HLT_Dimuon12_Upsilon_y1p4_v2', + 'HLT_Dimuon14_Phi_Barrel_Seagulls_v7', + 'HLT_Dimuon24_Phi_noCorrL1_v6', + 'HLT_Dimuon24_Upsilon_noCorrL1_v6', + 'HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v4', + 'HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v4', + 'HLT_Mu20_TkMu0_Phi_v8', + 'HLT_Mu25_TkMu0_Onia_v8', + 'HLT_Mu25_TkMu0_Phi_v8', + 'HLT_Mu30_TkMu0_Upsilon_v1', + 'HLT_Mu7p5_L2Mu2_Upsilon_v10', + 'HLT_Mu7p5_Track2_Upsilon_v11', + 'HLT_Mu7p5_Track3p5_Upsilon_v11', + 'HLT_Mu7p5_Track7_Upsilon_v11', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v5', 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v3' ) @@ -896,33 +896,33 @@ streamPhysicsMuons_datasetMuonEG_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetMuonEG_selector.throw = cms.bool(False) streamPhysicsMuons_datasetMuonEG_selector.triggerConditions = cms.vstring( - 'HLT_DiMu4_Ele9_CaloIdL_TrackIdL_DZ_Mass3p8_v17', - 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v17', - 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v17', - 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v8', - 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v7', - 'HLT_DoubleMu20_7_Mass0to30_Photon23_v8', - 'HLT_Mu12_DoublePhoton20_v5', - 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v7', - 'HLT_Mu17_Photon30_IsoCaloId_v6', - 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v7', - 'HLT_Mu27_Ele37_CaloIdL_MW_v5', - 'HLT_Mu37_Ele27_CaloIdL_MW_v5', - 'HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v1', - 'HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v1', - 'HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v5', - 'HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v5', - 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v18', - 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v18', - 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v19', - 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v19', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_CaloBtagDeepCSV_1p5_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBtagDeepCSV_1p5_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13', + 'HLT_DiMu4_Ele9_CaloIdL_TrackIdL_DZ_Mass3p8_v17', + 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v17', + 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v17', + 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v8', + 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v7', + 'HLT_DoubleMu20_7_Mass0to30_Photon23_v8', + 'HLT_Mu12_DoublePhoton20_v5', + 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v7', + 'HLT_Mu17_Photon30_IsoCaloId_v6', + 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v7', + 'HLT_Mu27_Ele37_CaloIdL_MW_v5', + 'HLT_Mu37_Ele27_CaloIdL_MW_v5', + 'HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v1', + 'HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v1', + 'HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v5', + 'HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v5', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v18', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v18', + 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v19', + 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v19', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_CaloBtagDeepCSV_1p5_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBtagDeepCSV_1p5_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13', 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v11' ) @@ -931,47 +931,47 @@ streamPhysicsMuons_datasetSingleMuon_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetSingleMuon_selector.throw = cms.bool(False) streamPhysicsMuons_datasetSingleMuon_selector.triggerConditions = cms.vstring( - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v12', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v4', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_v15', - 'HLT_IsoMu24_TwoProngs35_v1', - 'HLT_IsoMu24_eta2p1_v15', - 'HLT_IsoMu24_v13', - 'HLT_IsoMu27_v16', - 'HLT_IsoMu30_v4', - 'HLT_L1SingleMu18_v3', - 'HLT_L1SingleMu25_v2', - 'HLT_L2Mu10_v7', - 'HLT_L2Mu50_v2', - 'HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v15', - 'HLT_Mu12_v3', - 'HLT_Mu15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', - 'HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v15', - 'HLT_Mu15_IsoVVVL_PFHT450_v15', - 'HLT_Mu15_IsoVVVL_PFHT600_v19', - 'HLT_Mu15_v3', - 'HLT_Mu20_v12', - 'HLT_Mu27_v13', - 'HLT_Mu3_PFJet40_v16', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET100_PFMHT100_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu100_PFMHTNoMu100_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu70_PFMHTNoMu70_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu80_PFMHTNoMu80_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu90_PFMHTNoMu90_IDTight_v2', - 'HLT_Mu4_TrkIsoVVL_DiPFJet90_40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v15', - 'HLT_Mu50_IsoVVVL_PFHT450_v15', - 'HLT_Mu50_v13', - 'HLT_Mu55_v3', - 'HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v16', - 'HLT_OldMu100_v3', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v12', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v4', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_v15', + 'HLT_IsoMu24_TwoProngs35_v1', + 'HLT_IsoMu24_eta2p1_v15', + 'HLT_IsoMu24_v13', + 'HLT_IsoMu27_v16', + 'HLT_IsoMu30_v4', + 'HLT_L1SingleMu18_v3', + 'HLT_L1SingleMu25_v2', + 'HLT_L2Mu10_v7', + 'HLT_L2Mu50_v2', + 'HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v15', + 'HLT_Mu12_v3', + 'HLT_Mu15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', + 'HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v15', + 'HLT_Mu15_IsoVVVL_PFHT450_v15', + 'HLT_Mu15_IsoVVVL_PFHT600_v19', + 'HLT_Mu15_v3', + 'HLT_Mu20_v12', + 'HLT_Mu27_v13', + 'HLT_Mu3_PFJet40_v16', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET100_PFMHT100_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu100_PFMHTNoMu100_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu70_PFMHTNoMu70_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu80_PFMHTNoMu80_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu90_PFMHTNoMu90_IDTight_v2', + 'HLT_Mu4_TrkIsoVVL_DiPFJet90_40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v15', + 'HLT_Mu50_IsoVVVL_PFHT450_v15', + 'HLT_Mu50_v13', + 'HLT_Mu55_v3', + 'HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v16', + 'HLT_OldMu100_v3', 'HLT_TkMu100_v2' ) @@ -983,12 +983,12 @@ streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.l1tResults = cms.InputTag('') streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.throw = cms.bool(False) streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.triggerConditions = cms.vstring( - 'DST_Run3_PFScoutingPixelTracking_v16', - 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', - 'HLT_Ele35_WPTight_Gsf_v9', - 'HLT_IsoMu27_v16', - 'HLT_Mu50_v13', - 'HLT_PFHT1050_v18', + 'DST_Run3_PFScoutingPixelTracking_v16', + 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', + 'HLT_Ele35_WPTight_Gsf_v9', + 'HLT_IsoMu27_v16', + 'HLT_Mu50_v13', + 'HLT_PFHT1050_v18', 'HLT_Photon200_v13' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py index e1ffefa4d799d..d32b5a2c63310 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_11_3_0/HIon +# /dev/CMSSW_12_0_0/HIon import FWCore.ParameterSet.Config as cms @@ -10,7 +10,7 @@ streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part10_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part10_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part10_v1' ) @@ -22,7 +22,7 @@ streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part11_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part11_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part11_v1' ) @@ -34,7 +34,7 @@ streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part12_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part12_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part12_v1' ) @@ -46,7 +46,7 @@ streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part13_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part13_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part13_v1' ) @@ -58,7 +58,7 @@ streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part14_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part14_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part14_v1' ) @@ -70,7 +70,7 @@ streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part15_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part15_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part15_v1' ) @@ -82,7 +82,7 @@ streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part16_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part16_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part16_v1' ) @@ -94,7 +94,7 @@ streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part17_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part17_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part17_v1' ) @@ -106,7 +106,7 @@ streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part18_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part18_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part18_v1' ) @@ -118,7 +118,7 @@ streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part19_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part19_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part19_v1' ) @@ -130,7 +130,7 @@ streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part0_v1', + 'HLT_HIMinimumBiasRF_part0_v1', 'HLT_HIMinimumBiasRF_part1_v1' ) @@ -142,7 +142,7 @@ streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part2_v1', + 'HLT_HIMinimumBiasRF_part2_v1', 'HLT_HIMinimumBiasRF_part3_v1' ) @@ -154,7 +154,7 @@ streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part20_v1', + 'HLT_HIMinimumBiasRF_part20_v1', 'HLT_HIMinimumBiasRF_part21_v1' ) @@ -166,7 +166,7 @@ streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part22_v1', + 'HLT_HIMinimumBiasRF_part22_v1', 'HLT_HIMinimumBiasRF_part23_v1' ) @@ -178,7 +178,7 @@ streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part4_v1', + 'HLT_HIMinimumBiasRF_part4_v1', 'HLT_HIMinimumBiasRF_part5_v1' ) @@ -190,7 +190,7 @@ streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part6_v1', + 'HLT_HIMinimumBiasRF_part6_v1', 'HLT_HIMinimumBiasRF_part7_v1' ) @@ -202,7 +202,7 @@ streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part8_v1', + 'HLT_HIMinimumBiasRF_part8_v1', 'HLT_HIMinimumBiasRF_part9_v1' ) @@ -214,7 +214,7 @@ streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part10_v1', + 'HLT_HIMinimumBiasRF_part10_v1', 'HLT_HIMinimumBiasRF_part11_v1' ) @@ -226,7 +226,7 @@ streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part12_v1', + 'HLT_HIMinimumBiasRF_part12_v1', 'HLT_HIMinimumBiasRF_part13_v1' ) @@ -238,7 +238,7 @@ streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part14_v1', + 'HLT_HIMinimumBiasRF_part14_v1', 'HLT_HIMinimumBiasRF_part15_v1' ) @@ -250,7 +250,7 @@ streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part16_v1', + 'HLT_HIMinimumBiasRF_part16_v1', 'HLT_HIMinimumBiasRF_part17_v1' ) @@ -262,7 +262,7 @@ streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part18_v1', + 'HLT_HIMinimumBiasRF_part18_v1', 'HLT_HIMinimumBiasRF_part19_v1' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py index 85f8785107bfe..d9f1def779f35 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_11_3_0/PIon +# /dev/CMSSW_12_0_0/PIon import FWCore.ParameterSet.Config as cms @@ -16,7 +16,7 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', + 'HLT_Random_v3', 'HLT_ZeroBias_v6' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py index 8c499ed574c5d..da4a12b0ee026 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_11_3_0/PRef +# /dev/CMSSW_12_0_0/PRef import FWCore.ParameterSet.Config as cms @@ -16,8 +16,8 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', - 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', + 'HLT_Random_v3', + 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', 'HLT_ZeroBias_v6' ) @@ -29,8 +29,8 @@ streamPhysicsEndOfFill_datasetEmptyBX_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetEmptyBX_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetEmptyBX_selector.triggerConditions = cms.vstring( - 'HLT_HIL1NotBptxORForPPRef_v2', - 'HLT_HIL1UnpairedBunchBptxMinusForPPRef_v2', + 'HLT_HIL1NotBptxORForPPRef_v2', + 'HLT_HIL1UnpairedBunchBptxMinusForPPRef_v2', 'HLT_HIL1UnpairedBunchBptxPlusForPPRef_v2' ) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index b5499e80b4306..104df35b34944 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,35 +129,11 @@ def customiseFor2018Input(process): return process -def customizeFor33543(process): - """ Customize HLT menu to remove deprecated parameters for the CSCRecHitDProducer in RecoLocalMuon""" - for producer in producers_by_type(process, "CSCRecHitDProducer"): - if hasattr(producer, "CSCStripClusterSize"): - del producer.CSCStripClusterSize - - return process - -def customiseFor33495(process): - """Customize HLT menu to remove deprecated parameters for pixel Generic and Template CPE's """ - for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - if hasattr(producer, "useLAAlignmentOffsets"): - del producer.useLAAlignmentOffsets - - for producer in esproducers_by_type(process, "PixelCPETemplateRecoESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - return process - - # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): - + # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseFor33495(process) - process = customizeFor33543(process) return process diff --git a/HLTrigger/Configuration/tables/makeSubTables b/HLTrigger/Configuration/tables/makeSubTables index 76c0d795e1471..cfd09b91f2e3b 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_11_3_0/HLT" # no version, take the latest one -TARGET="/dev/CMSSW_11_3_0/TABLE" # directory where to store the sub-tables +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 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 7662d05eb98ad..c49dd2a4ad824 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_11_3_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_0_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run3_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root -# /dev/CMSSW_11_3_0/HLT/V19 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HLT/V2 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFULL" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HLT/V19') + tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V2') ) process.transferSystem = cms.PSet( @@ -7747,10 +7747,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -7766,26 +7764,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -9305,6 +9306,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -9335,7 +9337,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -9686,7 +9687,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -15217,10 +15217,12 @@ ncandcut = cms.int32( 2 ) ) process.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -18372,10 +18374,12 @@ rhoScale = cms.double( 1.0 ) ) process.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -36734,7 +36738,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -42442,7 +42445,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -50903,7 +50905,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -100625,7 +100626,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -108409,10 +108409,12 @@ offset = cms.uint32( 0 ) ) process.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -117625,7 +117627,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -126088,6 +126089,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = ( cms.vstring( '( HLT_Random_v3 OR HLT_HcalNZS_v13 OR HLT_HcalPhiSym_v15 OR HLT_L1SingleMu7_v1 OR HLT_L1DoubleMu0_v1 OR HLT_L1SingleEG10_v2 OR HLT_L1SingleEG18_v1 OR HLT_Photon22_v2 OR HLT_L1SingleJet35_v1 OR HLT_L1SingleJet200_v1 OR HLT_L1DoubleJetC50_v2 OR HLT_CaloJet10_NoJetID_v3 OR HLT_CaloJet20_NoJetID_v3 OR HLT_CaloJet50_NoJetID_v3 ) / 10', 'HLT_AK8PFJet360_TrimMass30_v18 / 3', @@ -126967,6 +126969,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -126986,6 +126989,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_DoublePhoton85_v14', 'HLT_L1SingleMu7_v1', @@ -127000,6 +127004,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele32_WPTight_Gsf_v15 / 5', 'HLT_PFJet260_v20', @@ -127051,6 +127056,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_IsoMu20_v15 OR HLT_IsoMu24_v13 OR HLT_IsoMu27_v16 OR FALSE ) / 25', '( HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19 OR FALSE ) / 3', @@ -127107,6 +127113,7 @@ process.hltPreExpressCosmicsOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_L1SingleMuOpen_v2', 'HLT_L1SingleMuCosmics_v1 / 10', @@ -127120,6 +127127,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -127240,6 +127248,7 @@ process.hltPrePhysicsScoutingMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele35_WPTight_Gsf_v9 / 200', 'HLT_IsoMu27_v16 / 150', @@ -127531,6 +127540,7 @@ process.hltPreHIHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -127542,6 +127552,7 @@ process.hltPreHIDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_HIRandom_v1 OR HLT_HIHcalNZS_v1 OR HLT_HIHcalPhiSym_v1 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_HIPhysics_v1', @@ -127557,6 +127568,7 @@ process.hltPreHIDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -127568,6 +127580,7 @@ process.hltPreHIDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_Beamspot_v1', 'HLT_HICsAK4PFJet100Eta1p5_Beamspot_v1' ), @@ -127580,6 +127593,7 @@ process.hltPreHIExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HIPhysics_v1', 'HLT_HIRandom_v1', @@ -127597,6 +127611,7 @@ process.hltPreHIExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_v1', 'HLT_HICsAK4PFJet100Eta1p5_v1' ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py index 0f3b446df9665..fb3e3becf7c51 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_11_3_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_0_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root -# /dev/CMSSW_11_3_0/Fake/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V1') ) 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 5ca28322afc46..4e93e97f12323 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_11_3_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_0_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root -# /dev/CMSSW_11_3_0/Fake1/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake1/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake1" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake1/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V1') ) 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 53bc127f15baa..f0725a4a41896 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_11_3_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_0_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root -# /dev/CMSSW_11_3_0/Fake2/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake2/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake2" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V1') ) 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 e6e1efaac0562..7b4a9188b6013 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_11_3_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_0_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run3_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root -# /dev/CMSSW_11_3_0/GRun/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/GRun/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTGRun" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/GRun/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V1') ) process.transferSystem = cms.PSet( @@ -6387,10 +6387,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -6406,26 +6404,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -7945,6 +7946,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -7975,7 +7977,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8326,7 +8327,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -13809,10 +13809,12 @@ ncandcut = cms.int32( 2 ) ) process.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -16964,10 +16966,12 @@ rhoScale = cms.double( 1.0 ) ) process.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -35302,7 +35306,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -41010,7 +41013,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -49087,7 +49089,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -89979,6 +89980,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = ( cms.vstring( '( HLT_Random_v3 OR HLT_HcalNZS_v13 OR HLT_HcalPhiSym_v15 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_AK8PFJet360_TrimMass30_v18 / 3', @@ -90563,6 +90565,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -90580,6 +90583,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_DoublePhoton85_v14', 'HLT_PFJet500_v21 / 3', @@ -90593,6 +90597,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele32_WPTight_Gsf_v15 / 5', 'HLT_PFJet260_v20', @@ -90644,6 +90649,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_IsoMu20_v15 OR HLT_IsoMu24_v13 OR HLT_IsoMu27_v16 OR FALSE ) / 25', '( HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19 OR FALSE ) / 3', @@ -90663,6 +90669,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -90748,6 +90755,7 @@ process.hltPrePhysicsScoutingMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele35_WPTight_Gsf_v9 / 200', 'HLT_IsoMu27_v16 / 150', diff --git a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py index eb6bee4de36f9..07e1d4217e0e6 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_11_3_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_0_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run3_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root -# /dev/CMSSW_11_3_0/HIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTHIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V1') ) process.transferSystem = cms.PSet( @@ -5550,10 +5550,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5569,26 +5567,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6705,6 +6706,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6735,7 +6737,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8075,7 +8076,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14954,10 +14954,12 @@ offset = cms.uint32( 0 ) ) process.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -24192,7 +24194,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -32215,6 +32216,7 @@ process.hltPreHIHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -32226,6 +32228,7 @@ process.hltPreHIDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_HIRandom_v1 OR HLT_HIHcalNZS_v1 OR HLT_HIHcalPhiSym_v1 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_HIPhysics_v1', @@ -32241,6 +32244,7 @@ process.hltPreHIDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -32252,6 +32256,7 @@ process.hltPreHIDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_Beamspot_v1', 'HLT_HICsAK4PFJet100Eta1p5_Beamspot_v1' ), @@ -32264,6 +32269,7 @@ process.hltPreHIExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HIPhysics_v1', 'HLT_HIRandom_v1', @@ -32281,6 +32287,7 @@ process.hltPreHIExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_v1', 'HLT_HICsAK4PFJet100Eta1p5_v1' ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py index b79b955142ba0..f11e1b5c4d1a3 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_11_3_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_0_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run3_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root -# /dev/CMSSW_11_3_0/PIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V1') ) process.transferSystem = cms.PSet( @@ -5021,10 +5021,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5040,26 +5038,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -5729,6 +5730,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_Random_v3 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_Physics_v7', diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py index 303d60afdbb9f..3a9d3a2e923b8 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_11_3_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_0_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root -# /dev/CMSSW_11_3_0/PRef/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PRef/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPRef" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PRef/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V1') ) process.transferSystem = cms.PSet( @@ -5100,10 +5100,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5119,26 +5117,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6423,6 +6424,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6453,7 +6455,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -6804,7 +6805,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -11174,6 +11174,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_Random_v3 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_Physics_v7', @@ -11204,6 +11205,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_ZeroBias_Beamspot_v4', 'HLT_HIHT80_Beamspot_ppRef5TeV_v3' ), @@ -11220,6 +11222,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -11231,6 +11234,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -11270,6 +11274,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Physics_v7', 'HLT_Random_v3', @@ -11284,6 +11289,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_ZeroBias_Beamspot_v4', 'HLT_HIHT80_Beamspot_ppRef5TeV_v3' ), diff --git a/HLTrigger/Configuration/test/getFrozenHLT.sh b/HLTrigger/Configuration/test/getFrozenHLT.sh index e15e4fd0ea646..7e402f7a0033f 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_11_3_0/Fake" -HLT_Fake1="/dev/CMSSW_11_3_0/Fake1" -HLT_Fake2="/dev/CMSSW_11_3_0/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" # print extra messages ? VERBOSE=false diff --git a/HLTrigger/Configuration/test/getHLT.sh b/HLTrigger/Configuration/test/getHLT.sh index d0d586f1aef0a..ecf99d55dcdfd 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_11_3_0/HLT" # no explicit version, take the most recent -TARGET="/dev/CMSSW_11_3_0/\$TABLE" # no explicit version, take the most recent +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 TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES diff --git a/HLTrigger/Timer/plugins/FastTimerService.cc b/HLTrigger/Timer/plugins/FastTimerService.cc index 223b90c8e2763..626fb774e0112 100644 --- a/HLTrigger/Timer/plugins/FastTimerService.cc +++ b/HLTrigger/Timer/plugins/FastTimerService.cc @@ -767,8 +767,7 @@ void FastTimerService::PlotsPerJob::fill_lumi(AtomicResources const& data, unsig /////////////////////////////////////////////////////////////////////////////// FastTimerService::FastTimerService(const edm::ParameterSet& config, edm::ActivityRegistry& registry) - : tbb::task_scheduler_observer(true), - // configuration + : // configuration callgraph_(), // job configuration concurrent_lumis_(0), diff --git a/IOPool/Output/src/PoolOutputModule.cc b/IOPool/Output/src/PoolOutputModule.cc index efc96009a25dd..b0cdd8a0bc3bb 100644 --- a/IOPool/Output/src/PoolOutputModule.cc +++ b/IOPool/Output/src/PoolOutputModule.cc @@ -15,7 +15,7 @@ #include "DataFormats/Provenance/interface/Parentage.h" #include "DataFormats/Provenance/interface/ParentageRegistry.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/SubProcessParentageHelper.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index a0c1e0be34f39..e085ea4d98844 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -9,6 +9,8 @@ #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" class CSCBaseboard { diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h index 31b38c3606c1c..c2d71efdd1fe2 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h @@ -181,19 +181,6 @@ class CSCGEMMotherboard : public CSCUpgradeMotherboard { void processGEMPads(const GEMPadDigiCollection* pads); void processGEMCoPads(); - enum LCT_QualityRun3 { - INVALID = 0, - CLCT_2GEM = 3, - ALCT_2GEM = 4, - ALCTCLCT = 5, - ALCTCLCT_1GEM = 6, - ALCTCLCT_2GEM = 7, - }; - - // quality of the LCT when you take into account max 2 GEM layers - CSCMotherboard::LCT_Quality findQualityGEMv1(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; - LCT_QualityRun3 findQualityGEMv2(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; - // print available trigger pads void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart); void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart); diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h index ae0b3cb8ee826..87f904bcbb75c 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h @@ -40,7 +40,6 @@ class CSCGEMMotherboardME11 : public CSCGEMMotherboard { /* access to the LUTs needed for matching */ const CSCGEMMotherboardLUTME11* getLUT() const override { return tmbLUT_.get(); } std::unique_ptr tmbLUT_; - std::unique_ptr cscTmbLUT_; /* readout the LCTs in a sector of ME11 */ std::vector readoutLCTsME11(enum CSCPart me1ab) const; @@ -52,12 +51,6 @@ class CSCGEMMotherboardME11 : public CSCGEMMotherboard { void sortLCTs(std::vector&, bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const; - /* check if an ALCT cross a CLCT in an ME11 sector */ - bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; - - /* does wiregroup cross halfstrip or not */ - bool doesWiregroupCrossStrip(int key_wg, int key_hs) const override; - /* correlate a pair of ALCTs and a pair of CLCTs with matched pads or copads the output is up to two LCTs in a sector of ME11 */ void correlateLCTsGEM(const CSCALCTDigi& bestALCT, diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index 7051e84e109ea..9cae9e38ca1fc 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -122,6 +122,9 @@ class CSCMotherboard : public CSCBaseboard { static const unsigned int def_match_trig_enable, def_match_trig_window_size; static const unsigned int def_tmb_l1a_window_size; + /* quality assignment */ + std::unique_ptr qualityAssignment_; + /* quality control */ std::unique_ptr qualityControl_; @@ -141,37 +144,6 @@ class CSCMotherboard : public CSCBaseboard { // CLCT pattern number: encodes the pattern number itself unsigned int encodePattern(const int clctPattern) const; - // 4-bit LCT quality number.Made by TMB lookup tables and used for MPC sorting. - enum class LCT_Quality : unsigned int { - INVALID = 0, - NO_CLCT = 1, - NO_ALCT = 2, - CLCT_LAYER_TRIGGER = 3, - LOW_QUALITY = 4, - MARGINAL_ANODE_CATHODE = 5, - HQ_ANODE_MARGINAL_CATHODE = 6, - HQ_CATHODE_MARGINAL_ANODE = 7, - HQ_ACCEL_ALCT = 8, - HQ_RESERVED_1 = 9, - HQ_RESERVED_2 = 10, - HQ_PATTERN_2_3 = 11, - HQ_PATTERN_4_5 = 12, - HQ_PATTERN_6_7 = 13, - HQ_PATTERN_8_9 = 14, - HQ_PATTERN_10 = 15 - }; - - enum class LCT_QualityRun3 : unsigned int { - INVALID = 0, - LowQ = 1, - MedQ = 2, - HighQ = 3, - }; - - LCT_Quality findQuality(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; - - LCT_QualityRun3 findQualityRun3(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; - /** Dump TMB/MPC configuration parameters. */ void dumpConfigParams() const; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h index b4cdd210adfca..bd3f278b1ada3 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h @@ -50,20 +50,14 @@ class CSCMotherboardME11 : public CSCUpgradeMotherboard { std::vector readoutLCTs(int me1ab) const; private: - std::unique_ptr cscTmbLUT_; - /** labels for ME1a and ME1B */ enum { ME1B = 1, ME1A = 4 }; - bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; - void correlateLCTsME11(const CSCALCTDigi& bestALCT, const CSCALCTDigi& secondALCT, const CSCCLCTDigi& bestCLCT, const CSCCLCTDigi& secondCLCT, CSCCorrelatedLCTDigi& lct1, CSCCorrelatedLCTDigi& lct2) const; - - bool ignoreAlctCrossClct; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h index b8eed0c0ecd40..4392387681a71 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h @@ -14,6 +14,7 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeAnodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h" // generic container type namespace { @@ -82,6 +83,9 @@ class CSCUpgradeMotherboard : public CSCMotherboard { CSCCorrelatedLCTDigi& lct1, CSCCorrelatedLCTDigi& lct2) const; + // special cases for ME1/1 (when GEMs are not used) + bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; + Parity theParity; void setPrefIndex(); @@ -105,8 +109,10 @@ class CSCUpgradeMotherboard : public CSCMotherboard { // debug gem matching bool debug_matching; - // check look-up-tables - bool debug_luts; + // ignore unphysical ALCT-CLCT matches + bool ignoreAlctCrossClct; + + std::unique_ptr cscOverlap_; }; template diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h index ca12f1cc83d52..0dbefe9857b45 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h @@ -11,26 +11,6 @@ enum CSCPart { ME1B = 1, ME1A = 4, ME21 = 21, ME1Ag, ME11, ME31, ME41 }; enum Parity { Even = 0, Odd = 1 }; -class CSCMotherboardLUTME11 { -public: - CSCMotherboardLUTME11(); - ~CSCMotherboardLUTME11() {} - bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c, int theEndcap, bool gangedME1a = false) const; - bool doesWiregroupCrossStrip(int wg, int keystrip, int theEndcap, bool gangedME1a = false) const; - -private: - // LUT for which ME1/1 wire group can cross which ME1/a halfstrip - // 1st index: WG number - // 2nd index: inclusive HS range - //with "ag" a modified LUT for ganged ME1a - std::vector > lut_wg_vs_hs_me1a; - std::vector > lut_wg_vs_hs_me1ag; - // LUT for which ME1/1 wire group can cross which ME1/b halfstrip - // 1st index: WG number - // 2nd index: inclusive HS range - std::vector > lut_wg_vs_hs_me1b; -}; - class CSCGEMMotherboardLUT { public: CSCGEMMotherboardLUT(); diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h index f22689c74b90d..877ec498248bc 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h @@ -11,16 +11,15 @@ #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 class GEMCoPadProcessor { public: /** Normal constructor. */ - GEMCoPadProcessor(unsigned region, unsigned station, unsigned chamber, const edm::ParameterSet& copad); - - /** Default constructor. Used for testing. */ - GEMCoPadProcessor(); + GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& conf); /** Clear copad vector */ void clear(); @@ -29,12 +28,8 @@ class GEMCoPadProcessor { a collection of pad digis. */ std::vector run(const GEMPadDigiCollection*); - /** Runs the CoPad processor code. Called in normal running -- gets info from - a collection of pad digi clusters. */ - std::vector run(const GEMPadDigiClusterCollection*); - - /** Maximum number of time bins. */ - enum { MAX_CoPad_BINS = 3 }; + /** Runs the CoPad processor code. */ + std::vector run(const GEMPadDigiClusterCollection*); /** Returns vector of CoPads in the read-out time window, if any. */ const std::vector& readoutCoPads() const; @@ -43,22 +38,78 @@ class GEMCoPadProcessor { void declusterize(const GEMPadDigiClusterCollection*, GEMPadDigiCollection&) const; private: + // put coincidence clusters in GEMInternalCluster vector + void addCoincidenceClusters(const GEMPadDigiClusterCollection*); + + // put single clusters in GEMInternalCluster vector who are not + // part of any coincidence cluster + void addSingleClusters(const GEMPadDigiClusterCollection*); + + // translate the cluster central pad numbers into 1/8-strip number, + // and roll numbers into min and max wiregroup numbers + // for matching with CSC trigger primitives + void doCoordinateConversion(); + /** Chamber id (trigger-type labels). */ const int theRegion; const int theStation; const int theChamber; + bool isEven_; - /** Verbosity level: 0: no print (default). - * 1: print only CoPads found. - * 2: info at every step of the algorithm. - * 3: add special-purpose prints. */ - unsigned int infoV; unsigned int maxDeltaPad_; unsigned int maxDeltaBX_; unsigned int maxDeltaRoll_; // output collection std::vector gemCoPadV; + 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_; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h index c50929a28a1b6..c5ad10b6ea3d6 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h @@ -28,8 +28,10 @@ class GEMInternalCluster { int layer1_size() const { return layer1_size_; } int layer2_pad() const { return layer2_pad_; } int layer2_size() const { return layer2_size_; } - int min_wg() const { return min_wg_; } - int max_wg() const { return max_wg_; } + int layer1_min_wg() const { return layer1_min_wg_; } + int layer1_max_wg() const { return layer1_max_wg_; } + int layer2_min_wg() const { return layer2_min_wg_; } + int layer2_max_wg() const { return layer2_max_wg_; } bool isCoincidence() const { return isCoincidence_; } // first and last 1/2-strips @@ -103,8 +105,10 @@ class GEMInternalCluster { void set_layer2_middle_es_me1a(const int es) { layer2_middle_es_me1a_ = es; } // set the corresponding wiregroup numbers - void set_min_wg(const int wg) { min_wg_ = wg; } - void set_max_wg(const int wg) { max_wg_ = wg; } + void set_layer1_min_wg(const int wg) { layer1_min_wg_ = wg; } + void set_layer1_max_wg(const int wg) { layer1_max_wg_ = wg; } + void set_layer2_min_wg(const int wg) { layer2_min_wg_ = wg; } + void set_layer2_max_wg(const int wg) { layer2_max_wg_ = wg; } bool has_cluster(const GEMPadDigiCluster& cluster) const; @@ -172,8 +176,10 @@ class GEMInternalCluster { int layer2_middle_es_me1a_; // corresponding min and max wiregroup - int min_wg_; - int max_wg_; + int layer1_min_wg_; + int layer1_max_wg_; + int layer2_min_wg_; + int layer2_max_wg_; // flag to signal if it is a coincidence bool isCoincidence_; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h index 5b90f0eaaad54..a87a9304435c4 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h @@ -57,7 +57,7 @@ class LCTQualityAssignment { }; // constructor - LCTQualityAssignment(bool isRun3, unsigned station); + LCTQualityAssignment(unsigned station); // quality for all LCTs in Run-1 and Run-2 unsigned findQualityRun2(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; @@ -72,7 +72,6 @@ class LCTQualityAssignment { unsigned findQualityGEMv2(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; private: - bool isRun3_; unsigned station_; }; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h index 91f9df3ac9d1b..ac81adcbd8c1e 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h @@ -3,7 +3,9 @@ /** \class * - * This class checks if ALCT, CLCT and LCT products are valid + * This class checks if ALCT, CLCT and LCT products are valid. + * It inherits from CSCBaseboard. Neither are physical boards at CMS + * But they are convenient classes in the trigger code. * * Author: Sven Dildick * @@ -56,28 +58,38 @@ class LCTQualityControl : public CSCBaseboard { void checkMultiplicityBX(const std::vector& lcts, unsigned nLCT) const; // for Phase-1 patterns - int getSlopePhase1(int pattern) const; - - // CSC max strip & max wire - unsigned get_csc_max_wire(int station, int ring) const; - unsigned get_csc_max_halfstrip(int station, int ring) const; - unsigned get_csc_max_quartstrip(int station, int ring) const; - unsigned get_csc_max_eighthstrip(int station, int ring) const; + int getSlopePhase1(unsigned pattern) const; + + /* + CSC max strip & max wire + Need to pass station and ring, because we want to reuse the LCTQualityControl in the + MPC where the station and ring are considered arguments, not data members. + */ + unsigned get_csc_max_wiregroup(unsigned station, unsigned ring) const; + unsigned get_csc_max_halfstrip(unsigned station, unsigned ring) const; + unsigned get_csc_max_quartstrip(unsigned station, unsigned ring) const; + unsigned get_csc_max_eighthstrip(unsigned station, unsigned ring) const; // slope values std::pair get_csc_clct_min_max_slope() const; // CLCT min, max CFEB numbers - std::pair get_csc_min_max_cfeb(int station, int ring) const; + std::pair get_csc_min_max_cfeb() const; // CSC min, max pattern - std::pair get_csc_min_max_pattern(bool isRun3) const; + std::pair get_csc_min_max_pattern() const; + std::pair get_csc_min_max_pattern_run3() const; std::pair get_csc_lct_min_max_pattern() const; - // CSC max quality - unsigned get_csc_alct_max_quality(int station, int ring, bool runGEMCSC) const; - unsigned get_csc_clct_max_quality() const; - unsigned get_csc_lct_max_quality() const; + /* + CSC min, max quality + Need to pass station and ring for the LCT implementation, because we want to + reuse the LCTQualityControl in the MPC where the station and ring are considered + arguments, not data members. + */ + std::pair get_csc_alct_min_max_quality() const; + std::pair get_csc_clct_min_max_quality() const; + std::pair get_csc_lct_min_max_quality(unsigned station, unsigned ring) const; private: // min number of layers for a CLCT diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py index 045c7c9b14f8e..5b41d80e50920 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py @@ -15,61 +15,61 @@ ## convert pad number to 1/2-strip in ME1a padToHsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1a_odd.txt", + "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/GEMCSCLUT_pad_hs_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1b_odd.txt", + "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/GEMCSCLUT_pad_hs_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME21_odd.txt", + "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/GEMCSCLUT_pad_es_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1a_odd.txt", + "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/GEMCSCLUT_pad_es_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1b_odd.txt", + "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/GEMCSCLUT_pad_es_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME21_odd.txt", + "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/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", + "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/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", + "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/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", + "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/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", + "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", ), ) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py index 4dc7d0d5bb788..019f8cf4b120f 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py @@ -62,7 +62,6 @@ ignoreAlctCrossClct = cms.bool(True), ## run in debug mode - debugLUTs = cms.bool(False), debugMatching = cms.bool(False), ) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 0bb5b22cc388c..0412b5fee0ecb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -222,7 +222,7 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* } } - if (numWireGroups <= 0 or (unsigned) numWireGroups > qualityControl_->get_csc_max_wire(theStation, theRing)) { + if (numWireGroups <= 0 or (unsigned) numWireGroups > qualityControl_->get_csc_max_wiregroup(theStation, theRing)) { edm::LogError("CSCAnodeLCTProcessor|SetupError") << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << "):" @@ -284,7 +284,7 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY if (!chamber_empty) { for (int i_wire = 0; i_wire < numWireGroups; i_wire++) { // extra check to make sure only valid wires are processed - const unsigned max_wire = qualityControl_->get_csc_max_wire(theStation, theRing); + const unsigned max_wire = qualityControl_->get_csc_max_wiregroup(theStation, theRing); if (unsigned(i_wire) >= max_wire) continue; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 8f2157fb98b07..209335138edcb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -16,9 +16,7 @@ CSCGEMMotherboard::CSCGEMMotherboard(unsigned endcap, // super chamber has layer=0! gemId = GEMDetId(theRegion, 1, theStation, 0, theChamber, 0).rawId(); - const edm::ParameterSet coPadParams(station == 1 ? conf.getParameter("copadParamGE11") - : conf.getParameter("copadParamGE21")); - coPadProcessor = std::make_unique(theRegion, theStation, theChamber, coPadParams); + coPadProcessor = std::make_unique(theRegion, theStation, theChamber, conf); maxDeltaPadL1_ = (theParity ? tmbParams_.getParameter("maxDeltaPadL1Even") : tmbParams_.getParameter("maxDeltaPadL1Odd")); @@ -130,9 +128,9 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct if (alct.isValid() and clct.isValid() and gem1.isValid() and not gem2.isValid()) { pattern = encodePattern(clct.getPattern()); if (runCCLUT_) { - quality = static_cast(findQualityGEMv2(alct, clct, 1)); + quality = qualityAssignment_->findQualityGEMv2(alct, clct, 1); } else { - quality = static_cast(findQualityGEMv1(alct, clct, 1)); + quality = qualityAssignment_->findQualityGEMv1(alct, clct, 1); } bx = alct.getBX(); keyStrip = clct.getKeyStrip(); @@ -154,9 +152,9 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct } else if (alct.isValid() and clct.isValid() and not gem1.isValid() and gem2.isValid()) { pattern = encodePattern(clct.getPattern()); if (runCCLUT_) { - quality = static_cast(findQualityGEMv2(alct, clct, 2)); + quality = qualityAssignment_->findQualityGEMv2(alct, clct, 2); } else { - quality = static_cast(findQualityGEMv1(alct, clct, 2)); + quality = qualityAssignment_->findQualityGEMv1(alct, clct, 2); } bx = alct.getBX(); keyStrip = clct.getKeyStrip(); @@ -371,119 +369,6 @@ void CSCGEMMotherboard::printGEMTriggerCoPads(int bx_start, int bx_stop, enum CS } } -CSCMotherboard::LCT_Quality CSCGEMMotherboard::findQualityGEMv1(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT, - int gemlayers) const { - // Either ALCT or CLCT is invalid - if (!(aLCT.isValid()) || !(cLCT.isValid())) { - // No CLCT - if (aLCT.isValid() && !(cLCT.isValid())) - return LCT_Quality::NO_CLCT; - - // No ALCT - else if (!(aLCT.isValid()) && cLCT.isValid()) - return LCT_Quality::NO_ALCT; - - // No ALCT and no CLCT - else - return LCT_Quality::INVALID; - } - // Both ALCT and CLCT are valid - else { - const int pattern(cLCT.getPattern()); - - // Layer-trigger in CLCT - if (pattern == 1) - return LCT_Quality::CLCT_LAYER_TRIGGER; - - // Multi-layer pattern in CLCT - else { - // ALCT quality is the number of layers hit minus 3. - bool a4 = false; - - // Case of ME11 with GEMs: require 4 layers for ALCT - if (theStation == 1) - a4 = aLCT.getQuality() >= 1; - - // Case of ME21 with GEMs: require 4 layers for ALCT+GEM - if (theStation == 2) - a4 = aLCT.getQuality() + gemlayers >= 1; - - // CLCT quality is the number of layers hit. - const bool c4((cLCT.getQuality() >= 4) or (cLCT.getQuality() >= 3 and gemlayers >= 1)); - - // quality = 4; "reserved for low-quality muons in future" - - // marginal anode and cathode - if (!a4 && !c4) - return LCT_Quality::MARGINAL_ANODE_CATHODE; - - // HQ anode, but marginal cathode - else if (a4 && !c4) - return LCT_Quality::HQ_ANODE_MARGINAL_CATHODE; - - // HQ cathode, but marginal anode - else if (!a4 && c4) - return LCT_Quality::HQ_CATHODE_MARGINAL_ANODE; - - // HQ muon, but accelerator ALCT - else if (a4 && c4) { - if (aLCT.getAccelerator()) - return LCT_Quality::HQ_ACCEL_ALCT; - - else { - // quality = 9; "reserved for HQ muons with future patterns - // quality = 10; "reserved for HQ muons with future patterns - - // High quality muons are determined by their CLCT pattern - if (pattern == 2 || pattern == 3) - return LCT_Quality::HQ_PATTERN_2_3; - - else if (pattern == 4 || pattern == 5) - return LCT_Quality::HQ_PATTERN_4_5; - - else if (pattern == 6 || pattern == 7) - return LCT_Quality::HQ_PATTERN_6_7; - - else if (pattern == 8 || pattern == 9) - return LCT_Quality::HQ_PATTERN_8_9; - - else if (pattern == 10) - return LCT_Quality::HQ_PATTERN_10; - - else { - edm::LogWarning("CSCGEMMotherboard") - << "findQualityGEMv1: Unexpected CLCT pattern id = " << pattern << " in " << theCSCName_; - return LCT_Quality::INVALID; - } - } - } - } - } - return LCT_Quality::INVALID; -} - -CSCGEMMotherboard::LCT_QualityRun3 CSCGEMMotherboard::findQualityGEMv2(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT, - int gemlayers) const { - // ALCT and CLCT invalid - if (!(aLCT.isValid()) and !(cLCT.isValid())) { - return LCT_QualityRun3::INVALID; - } else if (!aLCT.isValid() && cLCT.isValid() and gemlayers == 2) { - return LCT_QualityRun3::CLCT_2GEM; - } else if (aLCT.isValid() && !cLCT.isValid() and gemlayers == 2) { - return LCT_QualityRun3::ALCT_2GEM; - } else if (aLCT.isValid() && cLCT.isValid()) { - if (gemlayers == 0) - return LCT_QualityRun3::ALCTCLCT; - else if (gemlayers == 1) - return LCT_QualityRun3::ALCTCLCT_1GEM; - else if (gemlayers == 2) - return LCT_QualityRun3::ALCTCLCT_2GEM; - } - return LCT_QualityRun3::INVALID; -} - template <> const matchesBX& CSCGEMMotherboard::getPads() const { return pads_; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc index 917f0181ecde7..b18b0f217c0eb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc @@ -31,7 +31,6 @@ CSCGEMMotherboardME11::CSCGEMMotherboardME11(unsigned endcap, // set LUTs tmbLUT_ = std::make_unique(); - cscTmbLUT_ = std::make_unique(); } CSCGEMMotherboardME11::~CSCGEMMotherboardME11() {} @@ -484,14 +483,6 @@ void CSCGEMMotherboardME11::sortLCTs(std::vector& LCTs, } } -bool CSCGEMMotherboardME11::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { - return cscTmbLUT_->doesALCTCrossCLCT(a, c, theEndcap, gangedME1a_); -} - -bool CSCGEMMotherboardME11::doesWiregroupCrossStrip(int key_wg, int key_strip) const { - return cscTmbLUT_->doesWiregroupCrossStrip(key_wg, key_strip, theEndcap, gangedME1a_); -} - void CSCGEMMotherboardME11::correlateLCTsGEM(const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index fba66a7432d0e..76282679800eb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -51,6 +51,9 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, config_dumped = true; } + // quality assignment + qualityAssignment_ = std::make_unique(station); + // quality control of stubs qualityControl_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); @@ -387,9 +390,9 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, // LCT quality number unsigned int quality; if (runCCLUT_) { - quality = static_cast(findQualityRun3(aLCT, cLCT)); + quality = qualityAssignment_->findQualityRun3(aLCT, cLCT); } else { - quality = static_cast(findQuality(aLCT, cLCT)); + quality = qualityAssignment_->findQualityRun2(aLCT, cLCT); } // Bunch crossing: get it from cathode LCT if anode LCT is not there. @@ -438,115 +441,6 @@ unsigned int CSCMotherboard::encodePattern(const int ptn) const { return pattern; } -// 4-bit LCT quality number. -CSCMotherboard::LCT_Quality CSCMotherboard::findQuality(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const { - // Either ALCT or CLCT is invalid - if (!(aLCT.isValid()) || !(cLCT.isValid())) { - // No CLCT - if (aLCT.isValid() && !(cLCT.isValid())) - return LCT_Quality::NO_CLCT; - - // No ALCT - else if (!(aLCT.isValid()) && cLCT.isValid()) - return LCT_Quality::NO_ALCT; - - // No ALCT and no CLCT - else - return LCT_Quality::INVALID; - } - // Both ALCT and CLCT are valid - else { - const int pattern(cLCT.getPattern()); - - // Layer-trigger in CLCT - if (pattern == 1) - return LCT_Quality::CLCT_LAYER_TRIGGER; - - // Multi-layer pattern in CLCT - else { - // ALCT quality is the number of layers hit minus 3. - const bool a4(aLCT.getQuality() >= 1); - - // CLCT quality is the number of layers hit. - const bool c4(cLCT.getQuality() >= 4); - - // quality = 4; "reserved for low-quality muons in future" - - // marginal anode and cathode - if (!a4 && !c4) - return LCT_Quality::MARGINAL_ANODE_CATHODE; - - // HQ anode, but marginal cathode - else if (a4 && !c4) - return LCT_Quality::HQ_ANODE_MARGINAL_CATHODE; - - // HQ cathode, but marginal anode - else if (!a4 && c4) - return LCT_Quality::HQ_CATHODE_MARGINAL_ANODE; - - // HQ muon, but accelerator ALCT - else if (a4 && c4) { - if (aLCT.getAccelerator()) - return LCT_Quality::HQ_ACCEL_ALCT; - - else { - // quality = 9; "reserved for HQ muons with future patterns - // quality = 10; "reserved for HQ muons with future patterns - - // High quality muons are determined by their CLCT pattern - if (pattern == 2 || pattern == 3) - return LCT_Quality::HQ_PATTERN_2_3; - - else if (pattern == 4 || pattern == 5) - return LCT_Quality::HQ_PATTERN_4_5; - - else if (pattern == 6 || pattern == 7) - return LCT_Quality::HQ_PATTERN_6_7; - - else if (pattern == 8 || pattern == 9) - return LCT_Quality::HQ_PATTERN_8_9; - - else if (pattern == 10) - return LCT_Quality::HQ_PATTERN_10; - - else { - edm::LogWarning("CSCMotherboard") - << "findQuality: Unexpected CLCT pattern id = " << pattern << " in " << theCSCName_; - return LCT_Quality::INVALID; - } - } - } - } - } - return LCT_Quality::INVALID; -} - -// 2-bit LCT quality number for Run-3 -CSCMotherboard::LCT_QualityRun3 CSCMotherboard::findQualityRun3(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT) const { - // Run-3 definition - if (!(aLCT.isValid()) and !(cLCT.isValid())) { - return LCT_QualityRun3::INVALID; - } - // use number of layers on each as indicator - else { - bool a4 = (aLCT.getQuality() >= 1); - bool a5 = (aLCT.getQuality() >= 1); - bool a6 = (aLCT.getQuality() >= 1); - - bool c4 = (cLCT.getQuality() >= 4); - bool c5 = (cLCT.getQuality() >= 4); - bool c6 = (cLCT.getQuality() >= 4); - if (a6 or c6) - return LCT_QualityRun3::HighQ; - else if (a5 or c5) - return LCT_QualityRun3::MedQ; - else if (a4 or c4) - return LCT_QualityRun3::LowQ; - } - return LCT_QualityRun3::INVALID; -} - void CSCMotherboard::checkConfigParameters() { // Make sure that the parameter values are within the allowed range. diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc index 341806811086f..ee87ddbb160ca 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc @@ -26,11 +26,6 @@ CSCMotherboardME11::CSCMotherboardME11(unsigned endcap, if (!runME11Up_) edm::LogError("CSCMotherboardME11|SetupError") << "+++ TMB constructed while runME11Up_ is not set! +++\n"; - - cscTmbLUT_ = std::make_unique(); - - // ignore unphysical ALCT-CLCT matches - ignoreAlctCrossClct = tmbParams_.getParameter("ignoreAlctCrossClct"); } CSCMotherboardME11::~CSCMotherboardME11() {} @@ -273,10 +268,6 @@ std::vector CSCMotherboardME11::getLCTs1a() const { return tmpV; } -bool CSCMotherboardME11::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { - return cscTmbLUT_->doesALCTCrossCLCT(a, c, theEndcap, gangedME1a_); -} - void CSCMotherboardME11::correlateLCTsME11(const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc index a75d808e2e77c..8ba1923e7be18 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc @@ -41,9 +41,13 @@ CSCUpgradeMotherboard::CSCUpgradeMotherboard(unsigned endcap, tmb_cross_bx_algo = tmbParams_.getParameter("tmbCrossBxAlgorithm"); max_lcts = tmbParams_.getParameter("maxLCTs"); debug_matching = tmbParams_.getParameter("debugMatching"); - debug_luts = tmbParams_.getParameter("debugLUTs"); setPrefIndex(); + + // ignore unphysical ALCT-CLCT matches + ignoreAlctCrossClct = tmbParams_.getParameter("ignoreAlctCrossClct"); + const edm::ParameterSet me11luts(conf.getParameter("wgCrossHsME11Params")); + cscOverlap_ = std::make_unique(endcap, station, theRing, gangedME1a_, me11luts); } void CSCUpgradeMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc) { @@ -235,6 +239,10 @@ void CSCUpgradeMotherboard::correlateLCTs(const CSCALCTDigi& bALCT, } } +bool CSCUpgradeMotherboard::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { + return cscOverlap_->doesALCTCrossCLCT(a, c, ignoreAlctCrossClct); +} + //readout LCTs std::vector CSCUpgradeMotherboard::readoutLCTs() const { std::vector result; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc index 70c137c7defbb..05d3a2c795479 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc @@ -1,84 +1,6 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" -CSCMotherboardLUTME11::CSCMotherboardLUTME11() { - // Keep in mind that ME1A is considered an extension of ME1B - // This means that ME1A half-strips start at 128 and end at 223 - lut_wg_vs_hs_me1a = {{128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, - {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 205}, {128, 189}, {128, 167}, {128, 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}, - {-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}}; - // When the half-strips are triple-ganged, (Run-1) - // ME1A half-strips go from 128 to 159 - lut_wg_vs_hs_me1ag = {{128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, - {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 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}, - {-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}}; - // ME1B half-strips start at 0 and end at 127 - lut_wg_vs_hs_me1b = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {100, 127}, {73, 127}, {47, 127}, {22, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 105}, {0, 93}, {0, 78}, {0, 63}}; -} - -bool CSCMotherboardLUTME11::doesALCTCrossCLCT(const CSCALCTDigi &a, - const CSCCLCTDigi &c, - int theEndcap, - bool gangedME1a) const { - if (!c.isValid() || !a.isValid()) - return false; - int key_hs = c.getKeyStrip(); - int key_wg = a.getKeyWG(); - return doesWiregroupCrossStrip(key_wg, key_hs, theEndcap, gangedME1a); -} - -bool CSCMotherboardLUTME11::doesWiregroupCrossStrip(int key_wg, int key_hs, int theEndcap, bool gangedME1a) const { - // ME1/a half-strip starts at 128 - if (key_hs > CSCConstants::MAX_HALF_STRIP_ME1B) { - if (!gangedME1a) { - // wrap around ME11 HS number for -z endcap - if (theEndcap == 2) { - // first subtract 128 - key_hs -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - // flip the HS - key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - key_hs; - // then add 128 again - key_hs += 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - } - if (key_hs >= lut_wg_vs_hs_me1a[key_wg][0] && key_hs <= lut_wg_vs_hs_me1a[key_wg][1]) - return true; - return false; - } else { - // wrap around ME11 HS number for -z endcap - if (theEndcap == 2) { - // first subtract 128 - key_hs -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - // flip the HS - key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - key_hs; - // then add 128 again - key_hs += 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - } - if (key_hs >= lut_wg_vs_hs_me1ag[key_wg][0] && key_hs <= lut_wg_vs_hs_me1ag[key_wg][1]) - return true; - return false; - } - } - // ME1/b half-strip ends at 127 - if (key_hs <= CSCConstants::MAX_HALF_STRIP_ME1B) { - if (theEndcap == 2) - key_hs = CSCConstants::MAX_HALF_STRIP_ME1B - key_hs; - if (key_hs >= lut_wg_vs_hs_me1b[key_wg][0] && key_hs <= lut_wg_vs_hs_me1b[key_wg][1]) - return true; - } - return false; -} - CSCGEMMotherboardLUT::CSCGEMMotherboardLUT() : lut_wg_eta_odd(0), lut_wg_eta_even(0), diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc index 941f8740937d8..58f2383d603fa 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc @@ -8,23 +8,69 @@ // Constructors -- //---------------- -GEMCoPadProcessor::GEMCoPadProcessor(unsigned region, unsigned station, unsigned chamber, const edm::ParameterSet& copad) +GEMCoPadProcessor::GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& conf) : theRegion(region), theStation(station), theChamber(chamber) { - // Verbosity level, set to 0 (no print) by default. - infoV = copad.getParameter("verbosity"); + const edm::ParameterSet luts(conf.getParameter("gemcscParams")); + const edm::ParameterSet copad(station == 1 ? conf.getParameter("copadParamGE11") + : conf.getParameter("copadParamGE21")); + + isEven_ = theChamber % 2 == 0; maxDeltaPad_ = copad.getParameter("maxDeltaPad"); maxDeltaRoll_ = copad.getParameter("maxDeltaRoll"); maxDeltaBX_ = copad.getParameter("maxDeltaBX"); -} -GEMCoPadProcessor::GEMCoPadProcessor() : theRegion(1), theStation(1), theChamber(1) { - infoV = 0; - maxDeltaPad_ = 0; - maxDeltaRoll_ = 0; - maxDeltaBX_ = 0; + padToHsME1aFiles_ = luts.getParameter>("padToHsME1aFiles"); + padToHsME1bFiles_ = luts.getParameter>("padToHsME1bFiles"); + padToHsME21Files_ = luts.getParameter>("padToHsME21Files"); + + padToEsME1aFiles_ = luts.getParameter>("padToEsME1aFiles"); + padToEsME1bFiles_ = luts.getParameter>("padToEsME1bFiles"); + padToEsME21Files_ = luts.getParameter>("padToEsME21Files"); + + rollToMaxWgME11Files_ = luts.getParameter>("rollToMaxWgME11Files"); + rollToMinWgME11Files_ = luts.getParameter>("rollToMinWgME11Files"); + rollToMaxWgME21Files_ = luts.getParameter>("rollToMaxWgME21Files"); + rollToMinWgME21Files_ = luts.getParameter>("rollToMinWgME21Files"); + + 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_hs_ME21_even_ = std::make_unique(padToHsME21Files_[0]); + GEMCSCLUT_pad_hs_ME21_odd_ = std::make_unique(padToHsME21Files_[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_pad_es_ME21_even_ = std::make_unique(padToEsME21Files_[0]); + GEMCSCLUT_pad_es_ME21_odd_ = std::make_unique(padToEsME21Files_[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]); + + 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 GEMCoPadProcessor::clear() { gemCoPadV.clear(); } +void GEMCoPadProcessor::clear() { + gemCoPadV.clear(); + clusters_.clear(); +} std::vector GEMCoPadProcessor::run(const GEMPadDigiCollection* in_pads) { clear(); @@ -88,10 +134,348 @@ std::vector GEMCoPadProcessor::run(const GEMPadDigiCollection* in_ return gemCoPadV; } -std::vector GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) { - std::unique_ptr out_pads(new GEMPadDigiCollection()); - declusterize(in_clusters, *out_pads); - return run(out_pads.get()); +std::vector GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) { + // Step 1: clear the GEMInternalCluster vector + clear(); + + // Step 2: put coincidence clusters in GEMInternalCluster vector + addCoincidenceClusters(in_clusters); + + // Step 3: put single clusters in GEMInternalCluster vector who are not + // part of any coincidence cluster + addSingleClusters(in_clusters); + + // Step 4: translate the cluster central pad numbers into 1/8-strip number for matching with CSC trigger primitives + doCoordinateConversion(); + + // Step 5: return the vector with internal clusters + return clusters_; +} + +void GEMCoPadProcessor::addCoincidenceClusters(const GEMPadDigiClusterCollection* in_clusters) { + // Build coincidences + for (auto det_range = in_clusters->begin(); det_range != in_clusters->end(); ++det_range) { + const GEMDetId& id = (*det_range).first; + + // coincidence pads are not built for ME0 + if (id.isME0()) + continue; + + // same chamber (no restriction on the roll number) + if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber) + continue; + + // all coincidences detIDs will have layer=1 + if (id.layer() != 1) + continue; + + // find all corresponding ids with layer 2 and same roll that differs at most maxDeltaRoll_ + for (unsigned int roll = id.roll() - maxDeltaRoll_; roll <= id.roll() + maxDeltaRoll_; ++roll) { + GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll); + + auto co_clusters_range = in_clusters->get(co_id); + + // empty range = no possible coincidence pads + if (co_clusters_range.first == co_clusters_range.second) + continue; + + // now let's correlate the pads in two layers of this partition + const auto& pads_range = (*det_range).second; + for (auto p = pads_range.first; p != pads_range.second; ++p) { + // ignore 16-partition GE2/1 pads + if (id.isGE21() and p->nPartitions() == GEMPadDigi::GE21SplitStrip) + continue; + + // only consider valid pads + if (!p->isValid()) + continue; + + for (auto co_p = co_clusters_range.first; co_p != co_clusters_range.second; ++co_p) { + // only consider valid clusters + if (!co_p->isValid()) + continue; + + // check the match in BX + if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_) + continue; + + // check the match in pad + int cl1f = p->pads().front(); + int cl1b = p->pads().back(); + int cl2f = co_p->pads().front(); + int cl2b = co_p->pads().back(); + + unsigned deltaFF = std::abs(cl1f - cl2f); + unsigned deltaFB = std::abs(cl1f - cl2b); + unsigned deltaBF = std::abs(cl1b - cl2f); + unsigned deltaBB = std::abs(cl1b - cl2b); + + std::vector v{deltaFF, deltaFB, deltaBF, deltaBB}; + + if (*std::min_element(v.begin(), v.end()) > maxDeltaPad_) + continue; + + // make a new coincidence + clusters_.emplace_back(id, *p, *co_p); + } + } + } + } +} + +void GEMCoPadProcessor::addSingleClusters(const GEMPadDigiClusterCollection* in_clusters) { + // now start add single clusters + for (auto det_range = in_clusters->begin(); det_range != in_clusters->end(); ++det_range) { + const GEMDetId& id = (*det_range).first; + + // coincidence pads are not built for ME0 + if (id.isME0()) + continue; + + // same chamber (no restriction on the roll number) + if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber) + continue; + + const auto& clusters_range = (*det_range).second; + for (auto p = clusters_range.first; p != clusters_range.second; ++p) { + // only consider valid clusters + if (p->isValid()) + continue; + + // ignore 16-partition GE2/1 pads + if (id.isGE21() and p->nPartitions() == GEMPadDigiCluster::GE21SplitStrip) + continue; + + // ignore clusters already contained in a coincidence cluster + if (std::find_if(std::begin(clusters_), std::end(clusters_), [p](const GEMInternalCluster& q) { + return q.has_cluster(*p); + }) != std::end(clusters_)) + continue; + + // put the single clusters into the collection + if (id.layer() == 1) + clusters_.emplace_back(id, *p, GEMPadDigiCluster()); + else + clusters_.emplace_back(id, GEMPadDigiCluster(), *p); + } + } +} + +void GEMCoPadProcessor::doCoordinateConversion() { + // loop on clusters + for (auto& cluster : clusters_) { + // starting coordinates + const int layer1_first_pad = cluster.layer1_pad(); + const int layer2_first_pad = cluster.layer2_pad(); + const int layer1_last_pad = layer1_first_pad + cluster.layer1_size() - 1; + const int layer2_last_pad = layer2_first_pad + cluster.layer2_size() - 1; + + // calculate the 1/2-strip + int layer1_pad_to_first_hs = -1; + int layer1_pad_to_last_hs = -1; + + int layer2_pad_to_first_hs = -1; + int layer2_pad_to_last_hs = -1; + + int layer1_pad_to_first_hs_me1a = -1; + int layer1_pad_to_last_hs_me1a = -1; + + int layer2_pad_to_first_hs_me1a = -1; + int layer2_pad_to_last_hs_me1a = -1; + + if (theStation == 1) { + if (isEven_) { + // ME1/b + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_last_pad); + } else { + // ME1/b + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_last_pad); + } + } + + // ME2/1 + if (theStation == 2) { + if (isEven_) { + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_last_pad); + } else { + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_last_pad); + } + } + + // middle 1/2-strip + int layer1_middle_hs = 0.5 * (layer1_pad_to_first_hs + layer1_pad_to_last_hs); + int layer2_middle_hs = 0.5 * (layer2_pad_to_first_hs + layer2_pad_to_last_hs); + int layer1_middle_hs_me1a = 0.5 * (layer1_pad_to_first_hs_me1a + layer1_pad_to_last_hs_me1a); + int layer2_middle_hs_me1a = 0.5 * (layer2_pad_to_first_hs_me1a + layer2_pad_to_last_hs_me1a); + + // set the values + cluster.set_layer1_first_hs(layer1_pad_to_first_hs); + cluster.set_layer2_first_hs(layer2_pad_to_first_hs); + cluster.set_layer1_last_hs(layer1_pad_to_last_hs); + cluster.set_layer2_last_hs(layer2_pad_to_last_hs); + + // middle 1/2-strip + cluster.set_layer1_middle_hs(layer1_middle_hs); + cluster.set_layer2_middle_hs(layer2_middle_hs); + + if (theStation == 1) { + cluster.set_layer1_first_hs_me1a(layer1_pad_to_first_hs_me1a); + cluster.set_layer2_first_hs_me1a(layer2_pad_to_first_hs_me1a); + cluster.set_layer1_last_hs_me1a(layer1_pad_to_last_hs_me1a); + cluster.set_layer2_last_hs_me1a(layer2_pad_to_last_hs_me1a); + + // middle 1/2-strip + cluster.set_layer1_middle_hs_me1a(layer1_middle_hs_me1a); + cluster.set_layer2_middle_hs_me1a(layer2_middle_hs_me1a); + } + + // calculate the 1/8-strips + int layer1_pad_to_first_es = -1; + int layer1_pad_to_last_es = -1; + + int layer2_pad_to_first_es = -1; + int layer2_pad_to_last_es = -1; + + int layer1_pad_to_first_es_me1a = -1; + int layer1_pad_to_last_es_me1a = -1; + + int layer2_pad_to_first_es_me1a = -1; + int layer2_pad_to_last_es_me1a = -1; + + if (theStation == 1) { + if (isEven_) { + // ME1/b + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_last_pad); + } else { + // ME1/b + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_last_pad); + } + } + + // ME2/1 + if (theStation == 2) { + if (isEven_) { + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_last_pad); + } else { + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_last_pad); + } + } + + // middle 1/8-strip + int layer1_middle_es = 0.5 * (layer1_pad_to_first_es + layer1_pad_to_last_es); + int layer2_middle_es = 0.5 * (layer2_pad_to_first_es + layer2_pad_to_last_es); + int layer1_middle_es_me1a = 0.5 * (layer1_pad_to_first_es_me1a + layer1_pad_to_last_es_me1a); + int layer2_middle_es_me1a = 0.5 * (layer2_pad_to_first_es_me1a + layer2_pad_to_last_es_me1a); + + // set the values + cluster.set_layer1_first_es(layer1_pad_to_first_es); + cluster.set_layer2_first_es(layer2_pad_to_first_es); + cluster.set_layer1_last_es(layer1_pad_to_last_es); + cluster.set_layer2_last_es(layer2_pad_to_last_es); + + // middle 1/8-strip + cluster.set_layer1_middle_es(layer1_middle_es); + cluster.set_layer2_middle_es(layer2_middle_es); + + if (theStation == 1) { + cluster.set_layer1_first_es_me1a(layer1_pad_to_first_es_me1a); + cluster.set_layer2_first_es_me1a(layer2_pad_to_first_es_me1a); + cluster.set_layer1_last_es_me1a(layer1_pad_to_last_es_me1a); + cluster.set_layer2_last_es_me1a(layer2_pad_to_last_es_me1a); + + // middle 1/8-strip + cluster.set_layer1_middle_es_me1a(layer1_middle_es_me1a); + cluster.set_layer2_middle_es_me1a(layer2_middle_es_me1a); + } + + // calculate the wiregroups + const int roll = cluster.roll(); + + int roll_l1_to_min_wg = -1; + int roll_l1_to_max_wg = -1; + int roll_l2_to_min_wg = -1; + int roll_l2_to_max_wg = -1; + + // ME1/1 + if (theStation == 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_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); + } 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_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); + } + } + + // ME2/1 + if (theStation == 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_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); + } 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_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); + } + } + + // set the values + cluster.set_layer1_min_wg(roll_l1_to_min_wg); + cluster.set_layer1_max_wg(roll_l1_to_max_wg); + cluster.set_layer2_min_wg(roll_l2_to_min_wg); + cluster.set_layer2_max_wg(roll_l2_to_max_wg); + } } const std::vector& GEMCoPadProcessor::readoutCoPads() const { return gemCoPadV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc index 68fd1896e6d63..a0f08a90b8551 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc @@ -32,8 +32,10 @@ GEMInternalCluster::GEMInternalCluster(const GEMDetId& id, layer1_last_es_me1a_ = -1; layer2_first_es_me1a_ = -1; layer2_last_es_me1a_ = -1; - min_wg_ = -1; - max_wg_ = -1; + layer1_min_wg_ = -1; + layer1_max_wg_ = -1; + layer2_min_wg_ = -1; + layer2_max_wg_ = -1; } bool GEMInternalCluster::has_cluster(const GEMPadDigiCluster& cluster) const { diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc index 71d5027c1fced..412d4ae312e31 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc @@ -5,7 +5,7 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -LCTQualityAssignment::LCTQualityAssignment(bool isRun3, unsigned station) : isRun3_(isRun3), station_(station) {} +LCTQualityAssignment::LCTQualityAssignment(unsigned station) : station_(station) {} // 4-bit LCT quality number. unsigned LCTQualityAssignment::findQualityRun2(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const { diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc index a11025d0dfe13..bd1d62da9e1e8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc @@ -34,8 +34,8 @@ void LCTQualityControl::reportErrors(const T& lct, const unsigned errors) const // Check if the ALCT is valid void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) const { - const unsigned max_wire = get_csc_max_wire(theStation, theRing); - const unsigned max_quality = get_csc_alct_max_quality(theStation, theRing, runME21ILT_); + const unsigned max_wiregroup = get_csc_max_wiregroup(theStation, theRing); + const auto& [min_quality, max_quality] = get_csc_alct_min_max_quality(); unsigned errors = 0; @@ -47,10 +47,10 @@ void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) // ALCT quality must be valid // number of layers - 3 - checkRange(alct.getQuality(), 1, max_quality, "CSCALCTDigi with invalid quality: ", errors); + checkRange(alct.getQuality(), min_quality, max_quality, "CSCALCTDigi with invalid quality: ", errors); // ALCT key wire-group must be within bounds - checkRange(alct.getKeyWG(), 0, max_wire - 1, "CSCALCTDigi with invalid wire-group: ", errors); + checkRange(alct.getKeyWG(), 0, max_wiregroup - 1, "CSCALCTDigi with invalid wire-group: ", errors); // ALCT with out-of-time BX checkRange(alct.getBX(), 0, CSCConstants::MAX_ALCT_TBINS - 1, "CSCALCTDigi with invalid BX: ", errors); @@ -64,11 +64,12 @@ void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) // Check if the CLCT is valid void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) const { const unsigned max_strip = get_csc_max_halfstrip(theStation, theRing); - const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(false); - const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern(true); + const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(); + const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern_run3(); const auto& [min_slope, max_slope] = get_csc_clct_min_max_slope(); - const auto& [min_cfeb, max_cfeb] = get_csc_min_max_cfeb(theStation, theRing); - const unsigned max_quality = get_csc_clct_max_quality(); + const auto& [min_cfeb, max_cfeb] = get_csc_min_max_cfeb(); + const auto& [min_quality, max_quality] = get_csc_clct_min_max_quality(); + unsigned errors = 0; // CLCT must be valid @@ -81,7 +82,7 @@ void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) // CLCTs require at least 4 layers hit // Run-3: ME1/1 CLCTs require only 3 layers // Run-4: ME2/1 CLCTs require only 3 layers - checkRange(clct.getQuality(), nplanes_clct_hit_pattern, max_quality, "CSCCLCTDigi with invalid quality: ", errors); + checkRange(clct.getQuality(), min_quality, max_quality, "CSCCLCTDigi with invalid quality: ", errors); // CLCT half-strip must be within bounds checkRange( @@ -129,13 +130,14 @@ void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct) const { checkValid(lct, theStation, theRing); } -void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsigned station, const unsigned ring) const { +void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, unsigned station, unsigned ring) const { const unsigned max_strip = get_csc_max_halfstrip(station, ring); const unsigned max_quartstrip = get_csc_max_quartstrip(station, ring); const unsigned max_eighthstrip = get_csc_max_eighthstrip(station, ring); - const unsigned max_wire = get_csc_max_wire(station, ring); - const auto& [min_pattern, max_pattern] = get_csc_lct_min_max_pattern(); - const unsigned max_quality = get_csc_lct_max_quality(); + const unsigned max_wiregroup = get_csc_max_wiregroup(station, ring); + const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(); + const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern_run3(); + const auto& [min_quality, max_quality] = get_csc_lct_min_max_quality(station, ring); unsigned errors = 0; @@ -146,7 +148,7 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign checkRange(lct.getTrknmb(), 1, 2, "CSCCorrelatedLCTDigi with invalid track number: ", errors); // LCT quality must be valid - checkRange(lct.getQuality(), 0, max_quality, "CSCCorrelatedLCTDigi with invalid quality: ", errors); + checkRange(lct.getQuality(), min_quality, max_quality, "CSCCorrelatedLCTDigi with invalid quality: ", errors); // LCT key half-strip must be within bounds checkRange(lct.getStrip(), 0, max_strip - 1, "CSCCorrelatedLCTDigi with invalid key half-strip: ", errors); @@ -158,7 +160,7 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign checkRange(lct.getStrip(8), 0, max_eighthstrip - 1, "CSCCorrelatedLCTDigi with invalid key eighth-strip: ", errors); // LCT key wire-group must be within bounds - checkRange(lct.getKeyWG(), 0, max_wire - 1, "CSCCorrelatedLCTDigi with invalid wire-group: ", errors); + checkRange(lct.getKeyWG(), 0, max_wiregroup - 1, "CSCCorrelatedLCTDigi with invalid wire-group: ", errors); // LCT with out-of-time BX checkRange(lct.getBX(), 0, CSCConstants::MAX_LCT_TBINS - 1, "CSCCorrelatedLCTDigi with invalid BX: ", errors); @@ -177,7 +179,17 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign errors); // LCT with an invalid pattern ID - checkRange(lct.getPattern(), min_pattern, max_pattern, "CSCCorrelatedLCTDigi with invalid pattern ID: ", errors); + checkRange(lct.getPattern(), + min_pattern_run2, + max_pattern_run2, + "CSCCorrelatedLCTDigi with invalid Run-2 pattern ID: ", + errors); + + checkRange(lct.getRun3Pattern(), + min_pattern_run3, + max_pattern_run3, + "CSCCorrelatedLCTDigi with invalid Run-3 pattern ID: ", + errors); // simulated LCT type must be valid if (lct.getType() == CSCCorrelatedLCTDigi::CLCTALCT or lct.getType() == CSCCorrelatedLCTDigi::CLCTONLY or @@ -221,7 +233,7 @@ void LCTQualityControl::checkMultiplicityBX(const std::vector LCTQualityControl::get_csc_clct_min_max_slope() const { // 5-bit number (includes the L/R bending) if (runCCLUT_) { min_slope = 0; - max_slope = 31; + max_slope = 15; } // Run-1 or Run-2 case // Run-3 case without CCLUT @@ -260,84 +272,121 @@ std::pair LCTQualityControl::get_csc_clct_min_max_slope() const { // | ME2/2, ME3/2, ME4/2 | 160 | 64 | // +----------------------------+------------+------------+ -unsigned LCTQualityControl::get_csc_max_wire(int station, int ring) const { - unsigned max_wire = 0; // wiregroup +unsigned LCTQualityControl::get_csc_max_wiregroup(unsigned station, unsigned ring) const { + unsigned max_wiregroup = 0; if (station == 1 && ring == 4) { // ME1/1a - max_wire = 48; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME11; } else if (station == 1 && ring == 1) { // ME1/1b - max_wire = 48; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME11; } else if (station == 1 && ring == 2) { // ME1/2 - max_wire = 64; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME12; } else if (station == 1 && ring == 3) { // ME1/3 - max_wire = 32; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME13; } else if (station == 2 && ring == 1) { // ME2/1 - max_wire = 112; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME21; } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1 - max_wire = 96; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME31; } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2 - max_wire = 64; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME22; } - return max_wire; + return max_wiregroup; } -unsigned LCTQualityControl::get_csc_max_halfstrip(int station, int ring) const { - int max_strip = 0; // halfstrip - if (station == 1 && ring == 4) { // ME1/1a - max_strip = 96; - } else if (station == 1 && ring == 1) { // ME1/1b - // In the CSC local trigger - // ME1/a is taken together with ME1/b - max_strip = 128 + 96; - } else if (station == 1 && ring == 2) { // ME1/2 - max_strip = 160; - } else if (station == 1 && ring == 3) { // ME1/3 - max_strip = 128; - } else if (station == 2 && ring == 1) { // ME2/1 - max_strip = 160; - } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1 - max_strip = 160; - } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2 - max_strip = 160; +unsigned LCTQualityControl::get_csc_max_halfstrip(unsigned station, unsigned ring) const { + unsigned max_half_strip = 0; + // ME1/1a + if (station == 1 && ring == 4 and gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME1A_GANGED; + } else if (station == 1 && ring == 4 and !gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED; + } + // ME1/1b + // In the CSC local trigger + // ME1/a is taken together with ME1/b + else if (station == 1 && ring == 1 and gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME11_GANGED; + } else if (station == 1 && ring == 1 and !gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME11_UNGANGED; + } + // ME1/2 + else if (station == 1 && ring == 2) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME12; + } + // ME1/3 + else if (station == 1 && ring == 3) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME13; + } + // ME2/1 + else if (station == 2 && ring == 1) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME21; } - return max_strip; + // ME3/1, ME4/1 + else if (station >= 3 && ring == 1) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME31; + } + // ME2/2, ME3/2, ME4/2 + else if (station >= 2 && ring == 2) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME22; + } + return max_half_strip; } -unsigned LCTQualityControl::get_csc_max_quartstrip(int station, int ring) const { +unsigned LCTQualityControl::get_csc_max_quartstrip(unsigned station, unsigned ring) const { return get_csc_max_halfstrip(station, ring) * 2; } -unsigned LCTQualityControl::get_csc_max_eighthstrip(int station, int ring) const { +unsigned LCTQualityControl::get_csc_max_eighthstrip(unsigned station, unsigned ring) const { return get_csc_max_halfstrip(station, ring) * 4; } -std::pair LCTQualityControl::get_csc_min_max_cfeb(int station, int ring) const { - // 5 CFEBs [0,4] for non-ME1/1 chambers - int min_cfeb = 0; - int max_cfeb = CSCConstants::MAX_CFEBS_RUN1 - 1; // 4 - // 7 CFEBs [0,6] for ME1/1 chambers - if (station == 1 and ring == 1) { - max_cfeb = 6; - } - return std::make_pair(min_cfeb, max_cfeb); -} +std::pair LCTQualityControl::get_csc_min_max_cfeb() const { + // counts at 0! + unsigned min_cfeb = 0; + unsigned max_cfeb = 0; -std::pair LCTQualityControl::get_csc_min_max_pattern(bool runCCLUT) const { - int min_pattern, max_pattern; - // Run-1 or Run-2 case - if (!runCCLUT) { - min_pattern = 2; - max_pattern = 10; + // ME1/1a + if (theStation == 1 && theRing == 4 and gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME1A_GANGED; + } else if (theStation == 1 && theRing == 4 and !gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME1A_UNGANGED; } - // Run-3 case - else { - min_pattern = 0; - max_pattern = 4; + // ME1/1b + // In the CSC local trigger + // ME1/a is taken together with ME1/b + else if (theStation == 1 && theRing == 1 and gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME11_GANGED; + } else if (theStation == 1 && theRing == 1 and !gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME11_UNGANGED; } - return std::make_pair(min_pattern, max_pattern); + // ME1/2 + else if (theStation == 1 && theRing == 2) { + max_cfeb = CSCConstants::NUM_CFEBS_ME12; + } + // ME1/3 + else if (theStation == 1 && theRing == 3) { + max_cfeb = CSCConstants::NUM_CFEBS_ME13; + } + // ME2/1 + else if (theStation == 2 && theRing == 1) { + max_cfeb = CSCConstants::NUM_CFEBS_ME21; + } + // ME3/1, ME4/1 + else if (theStation >= 3 && theRing == 1) { + max_cfeb = CSCConstants::NUM_CFEBS_ME31; + } + // ME2/2, ME3/2, ME4/2 + else if (theStation >= 2 && theRing == 2) { + max_cfeb = CSCConstants::NUM_CFEBS_ME22; + } + return std::make_pair(min_cfeb, max_cfeb - 1); } +std::pair LCTQualityControl::get_csc_min_max_pattern() const { return std::make_pair(2, 10); } + +std::pair LCTQualityControl::get_csc_min_max_pattern_run3() const { return std::make_pair(0, 4); } + std::pair LCTQualityControl::get_csc_lct_min_max_pattern() const { - int min_pattern, max_pattern; + unsigned min_pattern, max_pattern; // Run-1 or Run-2 case if (!runCCLUT_) { min_pattern = 2; @@ -351,21 +400,48 @@ std::pair LCTQualityControl::get_csc_lct_min_max_pattern() c return std::make_pair(min_pattern, max_pattern); } -unsigned LCTQualityControl::get_csc_alct_max_quality(int station, int ring, bool runGEMCSC) const { - int max_quality = 3; - // GE2/1-ME2/1 ALCTs are allowed 3-layer ALCTs - if (runGEMCSC and station == 2 and ring == 1) { - max_quality = 4; +std::pair LCTQualityControl::get_csc_alct_min_max_quality() const { + // quality is number of layers - 3 + // at least 4 layers for CSC-only trigger + unsigned min_quality = 1; + if (isME21_ and runME21ILT_) { + // at least 3 layers for GEM-CSC trigger in ME2/1 + min_quality = 0; } - return max_quality; + return std::make_pair(min_quality, 3); } -unsigned LCTQualityControl::get_csc_clct_max_quality() const { - int max_quality = 6; - return max_quality; +std::pair LCTQualityControl::get_csc_clct_min_max_quality() const { + // quality is number of layers + unsigned min_quality = 4; + if ((runME11ILT_ and isME11_) or (runME21ILT_ and isME21_)) { + // at least 3 layers for GEM-CSC trigger in ME1/1 or ME2/1 + min_quality = 3; + } + return std::make_pair(min_quality, 6); } -unsigned LCTQualityControl::get_csc_lct_max_quality() const { - int max_quality = 15; - return max_quality; +std::pair LCTQualityControl::get_csc_lct_min_max_quality(unsigned station, unsigned ring) const { + // Run-1 or Run-2 + unsigned min_quality = static_cast(LCTQualityAssignment::LCT_QualityRun2::HQ_PATTERN_2_3); + unsigned max_quality = static_cast(LCTQualityAssignment::LCT_QualityRun2::HQ_PATTERN_10); + + // Run-3 with CCLUT on + if (runCCLUT_) { + min_quality = static_cast(LCTQualityAssignment::LCT_QualityRun3::LowQ); + max_quality = static_cast(LCTQualityAssignment::LCT_QualityRun3::HighQ); + } + + // Run-3 with GEM-CSC on (low-quality CLCTs are permitted, but use Run-2 data format) + const bool GEMCSC = (station == 1 and ring == 1 and runME11ILT_) or (station == 2 and ring == 1 and runME11ILT_); + if (GEMCSC) { + min_quality = static_cast(LCTQualityAssignment::LCT_QualityRun2::HQ_ANODE_MARGINAL_CATHODE); + } + + // Run-3 CSC with GEM-CSC on and CCLUT on: use Run-3 data format + if (GEMCSC and runCCLUT_) { + min_quality = static_cast(LCTQualityAssignment::LCT_QualityRun3GEM::ALCT_2GEM); + max_quality = static_cast(LCTQualityAssignment::LCT_QualityRun3GEM::ALCT_CLCT_2GEM_GEMCSCBend); + } + return std::make_pair(min_quality, max_quality); } diff --git a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml index 31bb9be6c7f7c..77ed0413ac851 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml +++ b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml @@ -1,7 +1,11 @@ + + + - - + + + diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp b/L1Trigger/CSCTriggerPrimitives/test/CCLUTLinearFitWriter.cpp similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp rename to L1Trigger/CSCTriggerPrimitives/test/CCLUTLinearFitWriter.cpp diff --git a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc new file mode 100644 index 0000000000000..8a2f0c0e15cf8 --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc @@ -0,0 +1,252 @@ +/** \class CSCTriggerPrimitivesAnalyzer + * + * Basic analyzer class which accesses ALCTs, CLCTs, and correlated LCTs + * and plot various quantities. This analyzer can currently load a DQM file + * and plot the data vs emulation of ALCTs, CLCTs, and correlated LCT properties. + * + * \author Sven Dildick (Rice University) + * + */ + +#include "FWCore/Utilities/interface/EDGetToken.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/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "TH1F.h" +#include "TPostScript.h" +#include "TCanvas.h" +#include "TFile.h" +#include "TText.h" +#include "TPaveLabel.h" +#include "TLegend.h" +#include "TStyle.h" +#include "TROOT.h" + +#include +#include + +class CSCTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer<> { +public: + /// Constructor + explicit CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet &conf); + + /// Destructor + ~CSCTriggerPrimitivesAnalyzer() override {} + + /// Does the job + void analyze(const edm::Event &event, const edm::EventSetup &setup) override; + + /// Write to ROOT file, make plots, etc. + void endJob() override; + +private: + void makePlot(TH1F *dataMon, + TH1F *emulMon, + TH1F *diffMon, + TString lcts, + TString lct, + TString var, + TString chamber, + TPostScript *ps, + TCanvas *c1) const; + + // plots of data vs emulator + std::string rootFileName_; + unsigned runNumber_; + std::string monitorDir_; + std::vector chambers_; + std::vector alctVars_; + std::vector clctVars_; + std::vector lctVars_; + bool dataVsEmulatorPlots_; + void makeDataVsEmulatorPlots(); + + // plots of efficiencies in MC + bool mcEfficiencyPlots_; + + // plots of resolution in MC + bool mcResolutionPlots_; +}; + +CSCTriggerPrimitivesAnalyzer::CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet &conf) + : rootFileName_(conf.getParameter("rootFileName")), + runNumber_(conf.getParameter("runNumber")), + monitorDir_(conf.getParameter("monitorDir")), + chambers_(conf.getParameter>("chambers")), + alctVars_(conf.getParameter>("alctVars")), + clctVars_(conf.getParameter>("clctVars")), + lctVars_(conf.getParameter>("lctVars")), + dataVsEmulatorPlots_(conf.getParameter("dataVsEmulatorPlots")), + mcEfficiencyPlots_(conf.getParameter("mcEfficiencyPlots")), + mcResolutionPlots_(conf.getParameter("mcResolutionPlots")) {} + +void CSCTriggerPrimitivesAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &setup) { + // efficiency and resolution analysis is done here +} + +void CSCTriggerPrimitivesAnalyzer::endJob() { + if (dataVsEmulatorPlots_) + makeDataVsEmulatorPlots(); +} + +void CSCTriggerPrimitivesAnalyzer::makeDataVsEmulatorPlots() { + // data vs emulator plots are created here + edm::Service fs; + + // split monitorDir_ into two substrings + std::string delimiter = "/"; + int pos = monitorDir_.find(delimiter); + std::string superDir = monitorDir_.substr(0, pos); + monitorDir_.erase(0, pos + delimiter.length()); + std::string subDir = monitorDir_; + std::string path = "DQMData/Run " + std::to_string(runNumber_) + "/" + superDir + "/Run summary/" + subDir + "/"; + + TFile *theFile = new TFile(rootFileName_.c_str()); + if (!theFile) { + edm::LogError("CSCTriggerPrimitivesAnalyzer") << "Unable to load DQM ROOT file: " << rootFileName_; + return; + } + + TDirectory *directory = theFile->GetDirectory(path.c_str()); + if (!directory) { + edm::LogError("CSCTriggerPrimitivesAnalyzer") << "Unable to navigate to directory: " << path; + return; + } + + TPostScript *ps = new TPostScript("CSC_data_vs_emulation.ps", 111); + TCanvas *c1 = new TCanvas("c1", "", 800, 800); + c1->Clear(); + c1->Divide(1, 2); + + // alct variable + for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("alct_" + alctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot( + dataMon, emulMon, diffMon, "ALCT", "alct_", TString(alctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + // clct variable + for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("clct_" + clctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot( + dataMon, emulMon, diffMon, "CLCT", "clct_", TString(clctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + // lct variable + for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("lct_" + lctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot(dataMon, emulMon, diffMon, "LCT", "lct_", TString(lctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + ps->Close(); + // close the DQM file + theFile->Close(); + delete c1; + delete ps; +} + +void CSCTriggerPrimitivesAnalyzer::makePlot(TH1F *dataMon, + TH1F *emulMon, + TH1F *diffMon, + TString lcts, + TString lct, + TString var, + TString chamber, + TPostScript *ps, + TCanvas *c1) const { + ps->NewPage(); + + const TString title(chamber + " " + lcts + " " + var + " (Run " + runNumber_ + ")"); + c1->cd(1); + gPad->SetGridx(); + gPad->SetGridy(); + gStyle->SetOptStat(1111); + dataMon->SetTitle(title); + dataMon->GetXaxis()->SetTitle(lcts + " " + var); + dataMon->GetYaxis()->SetTitle("Entries"); + dataMon->SetMarkerColor(kBlack); + dataMon->SetMarkerStyle(kPlus); + dataMon->SetMarkerSize(3); + // add 50% to make sure the legend does not overlap with the histograms + dataMon->SetMaximum(dataMon->GetBinContent(dataMon->GetMaximumBin()) * 1.5); + dataMon->Draw("histp"); + dataMon->GetXaxis()->SetLabelSize(0.05); + dataMon->GetYaxis()->SetLabelSize(0.05); + dataMon->GetXaxis()->SetTitleSize(0.05); + dataMon->GetYaxis()->SetTitleSize(0.05); + emulMon->SetLineColor(kRed); + emulMon->Draw("histsame"); + auto legend = new TLegend(0.7, 0.7, 0.9, 0.9); + legend->AddEntry(dataMon, "Data", "p"); + legend->AddEntry(emulMon, "Emulator", "l"); + legend->Draw(); + + c1->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + gStyle->SetOptStat(0); + diffMon->SetLineColor(kBlack); + diffMon->SetTitle(title); + diffMon->GetXaxis()->SetTitle(lcts + " " + var); + diffMon->GetYaxis()->SetTitle("Emul - Data"); + diffMon->GetXaxis()->SetLabelSize(0.05); + diffMon->GetYaxis()->SetLabelSize(0.05); + diffMon->GetXaxis()->SetTitleSize(0.05); + diffMon->GetYaxis()->SetTitleSize(0.05); + diffMon->Draw("ep"); + c1->Update(); +} + +DEFINE_FWK_MODULE(CSCTriggerPrimitivesAnalyzer); diff --git a/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc index 1c4a19470c5bc..69495374e627e 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc @@ -55,6 +55,9 @@ class GEMCSCLUTAnalyzer : public edm::one::EDAnalyzer<> { void cscEsToGemPadLUT( const CSCLayer*, const GEMEtaPartition*, int minH, int maxH, std::vector>&) const; + // create LUT: pad->HS + void gemPadToCscHsLUT(const CSCLayer*, const GEMEtaPartition*, std::vector&) const; + // create LUT: pad->ES void gemPadToCscEsLUT(const CSCLayer*, const GEMEtaPartition*, std::vector&) const; @@ -132,7 +135,10 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { std::vector> cscEsToGemPadME1b; std::vector gemPadToCscEsME1a; std::vector gemPadToCscEsME1b; - std::vector> gemRollToCscWg; + std::vector gemPadToCscHsME1a; + std::vector gemPadToCscHsME1b; + std::vector> gemRollL1ToCscWg; + std::vector> gemRollL2ToCscWg; gemRollToEtaLimitsLUT(gemChamber_l1, gemRollEtaLimits_l1); gemRollToEtaLimitsLUT(gemChamber_l2, gemRollEtaLimits_l2); @@ -141,14 +147,27 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2); cscEsToGemPadLUT(keyLayerME1a, randRoll, 2, 94, cscEsToGemPadME1a); cscEsToGemPadLUT(keyLayerME1b, randRoll, 4, 124, cscEsToGemPadME1b); + gemPadToCscHsLUT(keyLayerME1a, randRoll, gemPadToCscHsME1a); + gemPadToCscHsLUT(keyLayerME1b, randRoll, gemPadToCscHsME1b); gemPadToCscEsLUT(keyLayerME1a, randRoll, gemPadToCscEsME1a); gemPadToCscEsLUT(keyLayerME1b, randRoll, gemPadToCscEsME1b); - gemRollToCscWgLUT(keyLayerME1b, gemChamber_l1, gemRollToCscWg); + gemRollToCscWgLUT(keyLayerME1b, gemChamber_l1, gemRollL1ToCscWg); + gemRollToCscWgLUT(keyLayerME1b, gemChamber_l2, gemRollL2ToCscWg); const std::string oddeven(id.chamber() % 2 == 0 ? "_even" : "_odd"); std::ofstream ofos; // simulation LUTs + ofos.open("GEMCSCLUT_pad_hs_ME1a" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHsME1a) + ofos << p << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_pad_hs_ME1b" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHsME1b) + ofos << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME1a" + oddeven + ".txt"); for (const auto& p : gemPadToCscEsME1a) ofos << p << std::endl; @@ -159,17 +178,37 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { ofos << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME11" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME11" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.second << std::endl; ofos.close(); // firmware LUTs + ofos.open("GEMCSCLUT_pad_hs_ME1a" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHsME1a) + ofos << std::hex << p << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_pad_hs_ME1b" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHsME1b) + ofos << std::hex << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME1a" + oddeven + ".mem"); for (const auto& p : gemPadToCscEsME1a) ofos << std::hex << p << std::endl; @@ -180,13 +219,23 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { ofos << std::hex << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME11" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) ofos << std::hex << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME11" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) + ofos << std::hex << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) + ofos << std::hex << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) ofos << std::hex << p.second << std::endl; ofos.close(); } @@ -209,8 +258,10 @@ void GEMCSCLUTAnalyzer::generateLUTsME21(const CSCDetId& csc_id) const { std::vector> cscWgToGemRoll_l1; std::vector> cscWgToGemRoll_l2; std::vector> cscEsToGemPad; + std::vector gemPadToCscHs; std::vector gemPadToCscEs; - std::vector> gemRollToCscWg; + std::vector> gemRollL1ToCscWg; + std::vector> gemRollL2ToCscWg; gemRollToEtaLimitsLUT(gemChamber_l1, gemRollEtaLimits_l1); gemRollToEtaLimitsLUT(gemChamber_l2, gemRollEtaLimits_l2); @@ -218,41 +269,73 @@ void GEMCSCLUTAnalyzer::generateLUTsME21(const CSCDetId& csc_id) const { cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1); cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2); cscEsToGemPadLUT(keyLayer, randRoll, 4, 155, cscEsToGemPad); + gemPadToCscHsLUT(keyLayer, randRoll, gemPadToCscHs); gemPadToCscEsLUT(keyLayer, randRoll, gemPadToCscEs); - gemRollToCscWgLUT(keyLayer, gemChamber_l1, gemRollToCscWg); + gemRollToCscWgLUT(keyLayer, gemChamber_l1, gemRollL1ToCscWg); + gemRollToCscWgLUT(keyLayer, gemChamber_l2, gemRollL2ToCscWg); const std::string oddeven(csc_id.chamber() % 2 == 0 ? "_even" : "_odd"); std::ofstream ofos; // simulation LUTs + ofos.open("GEMCSCLUT_pad_hs_ME21" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHs) + ofos << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME21" + oddeven + ".txt"); for (const auto& p : gemPadToCscEs) ofos << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME21" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME21" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.second << std::endl; ofos.close(); // firmware LUTs + ofos.open("GEMCSCLUT_pad_hs_ME21" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHs) + ofos << std::hex << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME21" + oddeven + ".mem"); for (const auto& p : gemPadToCscEs) ofos << std::hex << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME21" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) ofos << std::hex << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME21" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) + ofos << std::hex << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) + ofos << std::hex << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) ofos << std::hex << p.second << std::endl; ofos.close(); } @@ -327,6 +410,23 @@ void GEMCSCLUTAnalyzer::cscEsToGemPadLUT(const CSCLayer* keyLayer, } } +void GEMCSCLUTAnalyzer::gemPadToCscHsLUT(const CSCLayer* keyLayer, + const GEMEtaPartition* randRoll, + std::vector& lut) const { + int offset(0); + if (keyLayer->id().ring() == 4) + offset = 64; + const int nGEMPads(randRoll->npads()); + const CSCLayerGeometry* keyLayerGeometry(keyLayer->geometry()); + for (int i = 0; i < nGEMPads; ++i) { + const LocalPoint lpGEM(randRoll->centreOfPad(i)); + const GlobalPoint gp(randRoll->toGlobal(lpGEM)); + const LocalPoint lpCSC(keyLayer->toLocal(gp)); + const float strip(keyLayerGeometry->strip(lpCSC)); + lut.push_back(int((strip + offset) * 2)); + } +} + void GEMCSCLUTAnalyzer::gemPadToCscEsLUT(const CSCLayer* keyLayer, const GEMEtaPartition* randRoll, std::vector& lut) const { @@ -360,15 +460,28 @@ void GEMCSCLUTAnalyzer::gemRollToCscWgLUT(const CSCLayer* keyLayer, const LocalPoint lp_csc_bottom(keyLayer->toLocal(gp_bottom)); const int wire_top(keyLayerGeometry->nearestWire(lp_csc_top)); - const int wg_top(keyLayerGeometry->wireGroup(wire_top)); - const int wire_bottom(keyLayerGeometry->nearestWire(lp_csc_bottom)); - const int wg_bottom(keyLayerGeometry->wireGroup(wire_bottom)); + int wg_top(keyLayerGeometry->wireGroup(wire_top)); + int wg_bottom(keyLayerGeometry->wireGroup(wire_bottom)); + + // override for cases when the function "wireGroup" fails to provide the + // wiregroup number + const int GEM_layer = roll->id().layer(); + const int GEM_roll = roll->id().roll(); + if (roll->isGE21() and GEM_layer == 1) { + // L1 - max + if (GEM_roll == 10) + wg_top = 45; + // L1 - min + if (GEM_roll == 4) + wg_bottom = 80; + if (GEM_roll == 9) + wg_bottom = 46; + } lut.emplace_back(wg_bottom, wg_top); } } - //define this as a plug-in #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(GEMCSCLUTAnalyzer); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/L1CSCTPEmulatorConfigAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/L1CSCTPEmulatorConfigAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/L1CSCTPEmulatorConfigAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/L1CSCTPEmulatorConfigAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/test/README.md b/L1Trigger/CSCTriggerPrimitives/test/README.md new file mode 100644 index 0000000000000..4a006db33c67a --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/README.md @@ -0,0 +1,95 @@ +CSC Trigger Primitives: Test Modules +=================================== + +runCSCTriggerPrimitiveProducer +------------------------------ + +Configuration to run the CSC trigger primitive producer. Option available to unpack RAW data - useful for data vs emulator comparisons. + + +runCSCL1TDQM +------------ + +Configuration to run the module `l1tdeCSCTPG` on a data file. Will produce a DQM file onto which the runCSCTriggerPrimitiveAnalyzer can be run + + +runCSCTriggerPrimitiveAnalyzer +------------------------------ + +Configuration to run analysis on CSC trigger primitives. Choose from options to analyze data vs emulator comparison (`l1tdeCSCTPGClient`), MC resolution or MC efficiency. + +For data vs emulator comparison, first run `DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py` to obtain the DQM file, then use it as input for the comparison. Alternatively, run runCSCL1TDQM. + + +runL1CSCTPEmulatorConfigAnalyzer +-------------------------------- + +Compare configuration from DB with Python for CSC trigger primitives. Typically not necessary to do; all configuration is by default loaded from Python, not the configuration DB. + + +runGEMCSCLUTAnalyzer +-------------------- + +Makes the lookup tables for the GEM-CSC integrated local trigger in simulation and firmware. Current lookup tables can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/GEMCSC + +CCLUTLinearFitWriter +-------------------- + +The macro CCLUTLinearFitWriter.cpp produces look-up tables for the Run-3 CSC trigger using the comparator code logic. + +* 10 LUTs will be created for CMSSW (5 for position offset, 5 for slope). 5 LUTs will be created for the Verilog firmware. 5 additional LUTs will be created that convert the Run-3 comparator code & pattern ID to a Run-1/2 pattern ID. The LUTs used in the simulation require at least 3 layers. The macro also produces fits with at least four layers. + +
+mkdir output_3layers
+mkdir output_4layers
+mkdir figures_3layers
+mkdir figures_4layers
+root -l -q -b CCLUTLinearFitWriter.cpp++(3)
+root -l -q -b CCLUTLinearFitWriter.cpp++(4)
+
+ +* Convention for 4-bit position offset word: + +| Value | Half-Strip Offset | Delta Half-Strip | Quarter-Strip Bit | Eighth-Strip Bit | +|-------|--------------------|-------------------|--------------------|------------------| +| 0 | -7/4 | -2 | 0 | 1 | +| 1 | -3/2 | -2 | 1 | 0 | +| 2 | -5/4 | -2 | 1 | 1 | +| 3 | -1 | -1 | 0 | 0 | +| 4 | -3/4 | -1 | 0 | 1 | +| 5 | -1/2 | -1 | 1 | 0 | +| 6 | -1/4 | -1 | 1 | 1 | +| 7 | 0 | 0 | 0 | 0 | +| 8 | 1/4 | 0 | 0 | 1 | +| 9 | 1/2 | 0 | 1 | 0 | +| 10 | 3/4 | 0 | 1 | 1 | +| 11 | 1 | 1 | 0 | 0 | +| 12 | 5/4 | 1 | 0 | 1 | +| 13 | 3/2 | 1 | 1 | 0 | +| 14 | 7/4 | 1 | 1 | 1 | +| 15 | 2 | 2 | 0 | 0 | + +* Convention for 4-bit slope: + +Slope is in units [half-strip offset/layer]. The sign of the bending is interpreted as in Run-1 and Run-2. + +| Value | Slope | +|-------|-------| +| 0 | 1/8 | +| 1 | 2/8 | +| 2 | 3/8 | +| 3 | 4/8 | +| 4 | 5/8 | +| 5 | 6/8 | +| 6 | 7/8 | +| 7 | 1 | +| 8 | 9/8 | +| 9 | 10/8 | +| 10 | 11/8 | +| 11 | 12/8 | +| 12 | 13/8 | +| 13 | 14/8 | +| 14 | 2 | +| 15 | 20/8 | + +The LUTs can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/CCLUT diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.h diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.h diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.h diff --git a/L1Trigger/CSCTriggerPrimitives/python/CSCTriggerPrimitivesReader_cfi.py b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader_cfi.py similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/python/CSCTriggerPrimitivesReader_cfi.py rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader_cfi.py diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md b/L1Trigger/CSCTriggerPrimitives/test/macros/README.md deleted file mode 100644 index 46f94a81ad1c3..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md +++ /dev/null @@ -1,33 +0,0 @@ -The macro CCLUTLinearFitWriter.cpp produces look-up tables for the Run-3 CSC trigger. - -* 10 LUTs will be created for CMSSW (5 for position offset, 5 for slope). 5 LUTs will be created for the Verilog firmware. These files are similar to the ones found here: https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives. 5 additional LUTs will be created that convert the Run-3 comparator code & pattern ID to a Run-1/2 pattern ID. The LUTs used in the simulation require at least 3 layers. For reference the macro also produces fits with at least four layers. - -
-mkdir output_3layers
-mkdir output_4layers
-mkdir figures_3layers
-mkdir figures_4layers
-root -l -q -b CCLUTLinearFitWriter.cpp++(3)
-root -l -q -b CCLUTLinearFitWriter.cpp++(4)
-
- -* Convention for 4-bit position offset word: - -| Value | Half-Strip Offset | Delta Half-Strip | Quarter-Strip Bit | Eighth-Strip Bit | -|-------|--------------------|-------------------|--------------------|------------------| -| 0 | -7/4 | -2 | 0 | 1 | -| 1 | -3/2 | -2 | 1 | 0 | -| 2 | -5/4 | -2 | 1 | 1 | -| 3 | -1 | -1 | 0 | 0 | -| 4 | -3/4 | -1 | 0 | 1 | -| 5 | -1/2 | -1 | 1 | 0 | -| 6 | -1/4 | -1 | 1 | 1 | -| 7 | 0 | 0 | 0 | 0 | -| 8 | 1/4 | 0 | 0 | 1 | -| 9 | 1/2 | 0 | 1 | 0 | -| 10 | 3/4 | 0 | 1 | 1 | -| 11 | 1 | 1 | 0 | 0 | -| 12 | 5/4 | 1 | 0 | 1 | -| 13 | 3/2 | 1 | 1 | 0 | -| 14 | 7/4 | 1 | 1 | 1 | -| 15 | 2 | 2 | 0 | 0 | diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py new file mode 100644 index 0000000000000..569d72ed9e45b --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py @@ -0,0 +1,43 @@ +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 + +process = cms.Process("CSCTPEmulator2", Run2_2018) +process.load("Configuration/StandardSequences/GeometryRecoDB_cff") +process.load("Configuration/StandardSequences/MagneticField_cff") +process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") +process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load("DQM.L1TMonitorClient.L1TdeCSCTPGClient_cfi") +process.load('DQMOffline.Configuration.DQMOfflineMC_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.options = cms.untracked.PSet( + SkipEvent = cms.untracked.vstring('ProductNotFound') +) + +process.source = cms.Source( + "DQMRootSource", + fileNames = cms.untracked.vstring("file:step_DQM.root") +) + +process.MessageLogger = cms.Service("MessageLogger") + +## global tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') + +## schedule and path definition +process.dqm_step = cms.Path(process.l1tdeCSCTPGClient) +process.dqmsave_step = cms.Path(process.DQMSaver) +process.endjob_step = cms.EndPath(process.endOfProcess) + +process.schedule = cms.Schedule( + process.dqm_step, + process.endjob_step, + process.dqmsave_step +) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py new file mode 100644 index 0000000000000..a3f46512c47e7 --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py @@ -0,0 +1,50 @@ +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing +from Configuration.Eras.Era_Run3_cff import Run3 + +options = VarParsing('analysis') +options.register ("dataVsEmulation", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("analyzeEffiency", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("analyzeResolution", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("dataVsEmulationFile", "empty", VarParsing.multiplicity.singleton, VarParsing.varType.string) +options.register ("runNumber", 0, VarParsing.multiplicity.singleton, VarParsing.varType.int) +options.parseArguments() + +process = cms.Process("ANALYSIS", Run3) +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.source = cms.Source( + "PoolSource", + fileNames = cms.untracked.vstring(options.inputFiles) +) + +## if dataVsEmulation and analyzeEffiency or analyzeResolution are true, +## pick dataVsEmulation +if options.dataVsEmulation and (options.analyzeEffiency or options.analyzeResolution): + options.analyzeEffiency = False + options.analyzeResolution = False + +if options.dataVsEmulation: + options.maxEvents = 1 + process.source = cms.Source("EmptySource") + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(options.maxEvents) +) + +## customize the data vs emulator module +from DQM.L1TMonitor.L1TdeCSCTPG_cfi import l1tdeCSCTPGCommon +process.cscTriggerPrimitivesAnalyzer = cms.EDAnalyzer( + "CSCTriggerPrimitivesAnalyzer", + l1tdeCSCTPGCommon, + ## file of the form "DQM_V0001_L1TEMU_R000334393" + rootFileName = cms.string(options.dataVsEmulationFile), + ## e.g. 334393 + runNumber = cms.uint32(options.runNumber), + dataVsEmulatorPlots = cms.bool(options.dataVsEmulation), + mcEfficiencyPlots = cms.bool(options.analyzeEffiency), + mcResolutionPlots = cms.bool(options.analyzeResolution), +) + +process.p = cms.Path(process.cscTriggerPrimitivesAnalyzer) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py index 8565c585b9c59..ddd59c7fb289d 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py @@ -1,23 +1,25 @@ import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 options = VarParsing('analysis') -options.register ("unpack", True, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("analyzeData", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("analyzeEmul", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("unpack", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("mc", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("FastSim", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("dqm", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.parseArguments() -process = cms.Process("CSCTPEmulator", Run3) +process = cms.Process("CSCTPEmulator", Run2_2018) process.load("Configuration/StandardSequences/GeometryRecoDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") +process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") -process.load("L1Trigger.CSCTriggerPrimitives.CSCTriggerPrimitivesReader_cfi") +process.load('Configuration.EventContent.EventContent_cff') process.load("EventFilter.CSCRawToDigi.cscUnpacker_cfi") +process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") +process.load("DQM.L1TMonitor.L1TdeCSCTPG_cfi") +process.load('DQMOffline.Configuration.DQMOfflineMC_cff') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) @@ -35,14 +37,12 @@ process.MessageLogger = cms.Service("MessageLogger", destinations = cms.untracked.vstring("debug"), debug = cms.untracked.PSet( - extension = cms.untracked.string(".txt"), - threshold = cms.untracked.string("DEBUG"), - # threshold = cms.untracked.string("WARNING"), - lineLength = cms.untracked.int32(132), - noLineBreaks = cms.untracked.bool(True) + extension = cms.untracked.string(".txt"), + threshold = cms.untracked.string("WARNING"), + lineLength = cms.untracked.int32(132), + noLineBreaks = cms.untracked.bool(True) ), - debugModules = cms.untracked.vstring("cscTriggerPrimitiveDigis", - "lctreader") + debugModules = cms.untracked.vstring("cscTriggerPrimitiveDigis") ) ## global tag @@ -50,40 +50,46 @@ if options.mc: process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') else: - process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run3_data', '') - options.FastSim = False - -## Process customization -analyze = options.analyzeData or options.analyzeEmul + #process.GlobalTag = GlobalTag(process.GlobalTag, '112X_dataRun3_Prompt_v5', '') + process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') -if options.unpack: +## running on unpacked data, or after running the unpacker +if not options.mc or options.unpack: process.cscTriggerPrimitiveDigis.CSCComparatorDigiProducer = "muonCSCDigis:MuonCSCComparatorDigi" process.cscTriggerPrimitiveDigis.CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi" -if options.analyzeEmul: - process.cscTriggerPrimitivesReader.emulLctsIn = True - -if options.analyzeData: - process.cscTriggerPrimitivesReader.dataLctsIn = True +## DQM monitor +if options.dqm: + process.l1tdeCSCTPG.emulALCT = "cscTriggerPrimitiveDigis" + process.l1tdeCSCTPG.emulCLCT = "cscTriggerPrimitiveDigis" + process.l1tdeCSCTPG.emulLCT = "cscTriggerPrimitiveDigis:MPCSORTED" -if options.FastSim: - process.cscTriggerPrimitivesReader.CSCSimHitProducer = "MuonSimHits:MuonCSCHits" # Output process.output = cms.OutputModule( "PoolOutputModule", - fileName = cms.untracked.string("lcts.root"), + outputCommands = cms.untracked.vstring( + ['keep *', + 'drop *_rawDataCollector_*_*', + ]), + fileName = cms.untracked.string("lcts2.root"), ) -process.TFileService = cms.Service( - "TFileService", - fileName = cms.string('TPEHists.root') +## DQM output +process.DQMoutput = cms.OutputModule("DQMRootOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('DQMIO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step_DQM.root'), + outputCommands = process.DQMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) ) ## schedule and path definition process.p1 = cms.Path(process.muonCSCDigis) process.p2 = cms.Path(process.cscTriggerPrimitiveDigis) -process.p3 = cms.Path(process.cscTriggerPrimitivesReader) +process.p3 = cms.EndPath(process.DQMoutput) process.endjob_step = cms.EndPath(process.output * process.endOfProcess) process.schedule = cms.Schedule() @@ -93,7 +99,8 @@ ## always add the trigger itself process.schedule.extend([process.p2]) -if options.analyze: +## add DQM step 1 +if options.dqm: process.schedule.extend([process.p3]) process.schedule.extend([process.endjob_step]) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py index ab9a7f8718b0f..a603837a00310 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py @@ -5,7 +5,7 @@ process.load('Configuration.StandardSequences.MagneticField_cff') process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.load('Configuration.Geometry.GeometryExtended2026D74Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D80Reco_cff') from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 9556312d0d146..4859ff3b4ef0b 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -115,6 +115,17 @@ def _appendStage2Digis(obj): stage2L1Trigger.toModify(L1TriggerAOD, func=_appendStage2Digis) stage2L1Trigger.toModify(L1TriggerFEVTDEBUG, func=_appendStage2Digis) +## Run-3 EMTF and GMT showers +def _appendRun3ShowerDigis(obj): + run3ShowerDigis = [ + "keep *_simEmtfShowers_*_*", + 'keep *_simGmtShowerDigis_*_*', + ] + obj.outputCommands += run3ShowerDigis + +from Configuration.Eras.Modifier_run3_common_cff import run3_common +(stage2L1Trigger & run3_common).toModify(L1TriggerFEVTDEBUG, func=_appendRun3ShowerDigis) + # adding HGCal L1 trigger digis def _appendHGCalDigis(obj): l1HGCalDigis = [ diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc new file mode 100644 index 0000000000000..d29032c46f497 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc @@ -0,0 +1,123 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1CaloJetHTTProducer +// +/**\class L1CaloJetHTTProducer L1CaloJetHTTProducer.cc + +Description: +Use the L1CaloJetProducer collections to calculate +HTT energy sum for CaloJets + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Fri Mar 22 2019 +// $Id$ +// +// + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include + +// Run2/PhaseI output formats +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +#include "DataFormats/L1Trigger/interface/Jet.h" +// GenJets if needed +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" + +class L1CaloJetHTTProducer : public edm::EDProducer { +public: + explicit L1CaloJetHTTProducer(const edm::ParameterSet&); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + double EtaMax; + double PtMin; + + edm::EDGetTokenT> bxvCaloJetsToken_; + edm::Handle> bxvCaloJetsHandle; + + // Gen jet collections are only loaded and used if requested + // (use_gen_jets == true) + edm::EDGetTokenT> genJetsToken_; + edm::Handle> genJetsHandle; + + bool debug; + + bool use_gen_jets; +}; + +L1CaloJetHTTProducer::L1CaloJetHTTProducer(const edm::ParameterSet& iConfig) + : EtaMax(iConfig.getParameter("EtaMax")), + PtMin(iConfig.getParameter("PtMin")), + bxvCaloJetsToken_(consumes>(iConfig.getParameter("BXVCaloJetsInputTag"))), + genJetsToken_(consumes>(iConfig.getParameter("genJets"))), + debug(iConfig.getParameter("debug")), + use_gen_jets(iConfig.getParameter("use_gen_jets")) + +{ + produces("CaloJetHTT"); +} + +void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Output collections + std::unique_ptr CaloJetHTT(new float); + + *CaloJetHTT = 0.; + + // CaloJet HTT for L1 collections + if (!use_gen_jets) { + iEvent.getByToken(bxvCaloJetsToken_, bxvCaloJetsHandle); + + if (bxvCaloJetsHandle.isValid()) { + for (const auto& caloJet : *bxvCaloJetsHandle.product()) { + if (caloJet.pt() < PtMin) + continue; + if (fabs(caloJet.eta()) > EtaMax) + continue; + *CaloJetHTT += float(caloJet.pt()); + } + } + + if (debug) { + LogDebug("L1CaloJetHTTProducer") << " BXV L1CaloJetCollection JetHTT = " << *CaloJetHTT << " for PtMin " << PtMin + << " and EtaMax " << EtaMax << "\n"; + } + } + + // CaloJet HTT for gen jets + if (use_gen_jets) { + iEvent.getByToken(genJetsToken_, genJetsHandle); + + if (genJetsHandle.isValid()) { + for (const auto& genJet : *genJetsHandle.product()) { + if (genJet.pt() < PtMin) + continue; + if (fabs(genJet.eta()) > EtaMax) + continue; + *CaloJetHTT += float(genJet.pt()); + } + } + + if (debug) { + LogDebug("L1CaloJetHTTProducer") << " Gen Jets HTT = " << *CaloJetHTT << " for PtMin " << PtMin << " and EtaMax " + << EtaMax << "\n"; + } + } + + iEvent.put(std::move(CaloJetHTT), "CaloJetHTT"); +} + +DEFINE_FWK_MODULE(L1CaloJetHTTProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc new file mode 100644 index 0000000000000..29f40d985b195 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc @@ -0,0 +1,1371 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1CaloJetProducer +// +/**\class L1CaloJetProducer L1CaloJetProducer.cc + +Description: +Beginning with HCAL TPs, create HCAL jet, then +take L1EG crystal clusters from L1EGammaCrystalsProducer.cc +and clusters them within fixed number of trigger towers + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Tue Aug 29 2018 +// $Id$ +// +// + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Math/interface/deltaPhi.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include + +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +//#include "DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h" +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h" +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h" +#include "DataFormats/L1THGCal/interface/HGCalTower.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" + +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" + +#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h" + +// For pT calibrations +#include "TF1.h" + +// Run2/PhaseI output formats +#include "DataFormats/L1Trigger/interface/Tau.h" +#include "DataFormats/L1Trigger/interface/Jet.h" + +class L1CaloJetProducer : public edm::EDProducer { +public: + explicit L1CaloJetProducer(const edm::ParameterSet &); + +private: + void produce(edm::Event &, const edm::EventSetup &) override; + //bool cluster_passes_base_cuts(float &cluster_pt, float &cluster_eta, float &iso, float &e2x5, float &e5x5) const; + int ecalXtal_diPhi(int &iPhi_1, int &iPhi_2) const; + int tower_diPhi(int &iPhi_1, int &iPhi_2) const; + int tower_diEta(int &iEta_1, int &iEta_2) const; + float get_deltaR(reco::Candidate::PolarLorentzVector &p4_1, reco::Candidate::PolarLorentzVector &p4_2) const; + float get_hcal_calibration(float &jet_pt, float &ecal_pt, float &ecal_L1EG_jet_pt, float &jet_eta) const; + float get_tau_pt_calibration(float &tau_pt, float &ecal_pt, float &l1EG_pt, float &n_L1EGs, float &tau_eta) const; + int loose_iso_tau_wp(float &tau_pt, float &tau_iso_et, float &tau_eta) const; + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double EtMinForSeedHit; + double EtMinForCollection; + double EtMinForTauCollection; + + // For fetching jet calibrations + std::vector jetPtBins; + std::vector emFractionBinsBarrel; + std::vector absEtaBinsBarrel; + std::vector jetCalibrationsBarrel; + std::vector emFractionBinsHGCal; + std::vector absEtaBinsHGCal; + std::vector jetCalibrationsHGCal; + std::vector emFractionBinsHF; + std::vector absEtaBinsHF; + std::vector jetCalibrationsHF; + + // For fetching tau calibrations + std::vector tauPtBins; + std::vector tauAbsEtaBinsBarrel; + std::vector tauCalibrationsBarrel; + std::vector tauL1egInfoBarrel; + std::vector tauAbsEtaBinsHGCal; + std::vector tauCalibrationsHGCal; + std::vector tauL1egInfoHGCal; + + // For storing jet calibrations + std::vector>> calibrationsBarrel; + std::vector>> calibrationsHGCal; + std::vector>> calibrationsHF; + + // For storing tau calibration info + std::map> tauL1egInfoMapBarrel; + std::map> tauL1egInfoMapHGCal; + std::vector tauL1egValuesBarrel; // To preserve ordering + std::vector tauL1egValuesHGCal; // To preserve ordering + std::vector>>> tauPtCalibrationsBarrel; + std::vector>>> tauPtCalibrationsHGCal; + + bool debug; + edm::EDGetTokenT l1TowerToken_; + edm::Handle l1CaloTowerHandle; + + // TF1s defining tau isolation thresholds + TF1 isoTauBarrel = TF1("isoTauBarrelFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + TF1 isoTauHGCal = TF1("isoTauHGCalFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + + class l1CaloJetObj { + public: + bool barrelSeeded = true; // default to barrel seeded + reco::Candidate::PolarLorentzVector jetCluster; + reco::Candidate::PolarLorentzVector hcalJetCluster; + reco::Candidate::PolarLorentzVector ecalJetCluster; + reco::Candidate::PolarLorentzVector seedTower; + //reco::Candidate::PolarLorentzVector leadingL1EG; + reco::Candidate::PolarLorentzVector l1egJetCluster; + float jetClusterET = 0.; + float hcalJetClusterET = 0.; + float ecalJetClusterET = 0.; + float seedTowerET = 0.; + float leadingL1EGET = 0.; + float l1egJetClusterET = 0.; + + // For decay mode related checks with CaloTaus + std::vector> associated_l1EGs_; + + int seed_iEta = -99; + int seed_iPhi = -99; + + float hcal_seed = 0.; + //float hcal_3x3 = 0.; + float hcal_3x5 = 0.; + //float hcal_5x5 = 0.; + //float hcal_5x7 = 0.; + float hcal_7x7 = 0.; + //float hcal_2x3 = 0.; + //float hcal_2x3_1 = 0.; + //float hcal_2x3_2 = 0.; + //float hcal_2x2 = 0.; + //float hcal_2x2_1 = 0.; + //float hcal_2x2_2 = 0.; + //float hcal_2x2_3 = 0.; + //float hcal_2x2_4 = 0.; + float hcal_nHits = 0.; + + float ecal_seed = 0.; + //float ecal_3x3 = 0.; + float ecal_3x5 = 0.; + //float ecal_5x5 = 0.; + //float ecal_5x7 = 0.; + float ecal_7x7 = 0.; + //float ecal_2x3 = 0.; + //float ecal_2x3_1 = 0.; + //float ecal_2x3_2 = 0.; + //float ecal_2x2 = 0.; + //float ecal_2x2_1 = 0.; + //float ecal_2x2_2 = 0.; + //float ecal_2x2_3 = 0.; + //float ecal_2x2_4 = 0.; + float ecal_nHits = 0.; + + float l1eg_seed = 0.; + //float l1eg_3x3 = 0.; + float l1eg_3x5 = 0.; + //float l1eg_5x5 = 0.; + //float l1eg_5x7 = 0.; + float l1eg_7x7 = 0.; + //float l1eg_2x3 = 0.; + //float l1eg_2x3_1 = 0.; + //float l1eg_2x3_2 = 0.; + //float l1eg_2x2 = 0.; + //float l1eg_2x2_1 = 0.; + //float l1eg_2x2_2 = 0.; + //float l1eg_2x2_3 = 0.; + //float l1eg_2x2_4 = 0.; + float l1eg_nHits = 0.; + float n_l1eg_HoverE_LessThreshold = 0.; + + float l1eg_nL1EGs = 0.; + float l1eg_nL1EGs_standaloneSS = 0.; + float l1eg_nL1EGs_standaloneIso = 0.; + float l1eg_nL1EGs_trkMatchSS = 0.; + float l1eg_nL1EGs_trkMatchIso = 0.; + + float total_seed = 0.; + //float total_3x3 = 0.; + float total_3x5 = 0.; + //float total_5x5 = 0.; + //float total_5x7 = 0.; + float total_7x7 = 0.; + //float total_2x3 = 0.; + //float total_2x3_1 = 0.; + //float total_2x3_2 = 0.; + //float total_2x2 = 0.; + //float total_2x2_1 = 0.; + //float total_2x2_2 = 0.; + //float total_2x2_3 = 0.; + //float total_2x2_4 = 0.; + float total_nHits = 0.; + + void Init() { + SetJetClusterP4(0., 0., 0., 0.); + SetHcalJetClusterP4(0., 0., 0., 0.); + SetEcalJetClusterP4(0., 0., 0., 0.); + SetSeedP4(0., 0., 0., 0.); + //SetLeadingL1EGP4( 0., 0., 0., 0. ); + SetL1EGJetP4(0., 0., 0., 0.); + } + + void SetJetClusterP4(double pt, double eta, double phi, double mass) { + this->jetCluster.SetPt(pt); + this->jetCluster.SetEta(eta); + this->jetCluster.SetPhi(phi); + this->jetCluster.SetM(mass); + } + void SetHcalJetClusterP4(double pt, double eta, double phi, double mass) { + this->hcalJetCluster.SetPt(pt); + this->hcalJetCluster.SetEta(eta); + this->hcalJetCluster.SetPhi(phi); + this->hcalJetCluster.SetM(mass); + } + void SetEcalJetClusterP4(double pt, double eta, double phi, double mass) { + this->ecalJetCluster.SetPt(pt); + this->ecalJetCluster.SetEta(eta); + this->ecalJetCluster.SetPhi(phi); + this->ecalJetCluster.SetM(mass); + } + void SetSeedP4(double pt, double eta, double phi, double mass) { + this->seedTower.SetPt(pt); + this->seedTower.SetEta(eta); + this->seedTower.SetPhi(phi); + this->seedTower.SetM(mass); + } + //void SetLeadingL1EGP4( double pt, double eta, double phi, double mass ) + //{ + // this->leadingL1EG.SetPt( pt ); + // this->leadingL1EG.SetEta( eta ); + // this->leadingL1EG.SetPhi( phi ); + // this->leadingL1EG.SetM( mass ); + //} + void SetL1EGJetP4(double pt, double eta, double phi, double mass) { + this->l1egJetCluster.SetPt(pt); + this->l1egJetCluster.SetEta(eta); + this->l1egJetCluster.SetPhi(phi); + this->l1egJetCluster.SetM(mass); + } + }; + + class simpleL1obj { + public: + bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool associated_with_tower = + false; // L1EGs become associated with a tower to find highest ET total for seeding jets + bool passesStandaloneSS = false; // Store whether any of the portions of a WP are passed + bool passesStandaloneIso = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchSS = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchIso = false; // Store whether any of the portions of a WP are passed + reco::Candidate::PolarLorentzVector p4; + + void SetP4(double pt, double eta, double phi, double mass) { + this->p4.SetPt(pt); + this->p4.SetEta(eta); + this->p4.SetPhi(phi); + this->p4.SetM(mass); + } + inline float pt() const { return p4.pt(); }; + inline float eta() const { return p4.eta(); }; + inline float phi() const { return p4.phi(); }; + inline float M() const { return p4.M(); }; + inline reco::Candidate::PolarLorentzVector GetP4() const { return p4; }; + }; + + class SimpleCaloHit { + public: + int towerIEta = -99; + int towerIPhi = -99; + float towerEta = -99; + float towerPhi = -99; + float ecalTowerEt = 0.; + float hcalTowerEt = 0.; + float l1egTowerEt = 0.; + float total_tower_et = 0.; + //float total_tower_plus_L1EGs_et=0.; + bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool isBarrel = true; // Defaults to a barrel hit + + // L1EG info + int nL1eg = 0; + int l1egTrkSS = 0; + int l1egTrkIso = 0; + int l1egStandaloneSS = 0; + int l1egStandaloneIso = 0; + }; +}; + +L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) + : HcalTpEtMin(iConfig.getParameter("HcalTpEtMin")), // Should default to 0 MeV + EcalTpEtMin(iConfig.getParameter("EcalTpEtMin")), // Should default to 0 MeV + HGCalHadTpEtMin(iConfig.getParameter("HGCalHadTpEtMin")), // Should default to 0 MeV + HGCalEmTpEtMin(iConfig.getParameter("HGCalEmTpEtMin")), // Should default to 0 MeV + HFTpEtMin(iConfig.getParameter("HFTpEtMin")), // Should default to 0 MeV + EtMinForSeedHit(iConfig.getParameter("EtMinForSeedHit")), // Should default to 2.5 GeV + EtMinForCollection(iConfig.getParameter("EtMinForCollection")), // Testing 10 GeV + EtMinForTauCollection(iConfig.getParameter("EtMinForTauCollection")), // Testing 10 GeV + jetPtBins(iConfig.getParameter>("jetPtBins")), + emFractionBinsBarrel(iConfig.getParameter>("emFractionBinsBarrel")), + absEtaBinsBarrel(iConfig.getParameter>("absEtaBinsBarrel")), + jetCalibrationsBarrel(iConfig.getParameter>("jetCalibrationsBarrel")), + emFractionBinsHGCal(iConfig.getParameter>("emFractionBinsHGCal")), + absEtaBinsHGCal(iConfig.getParameter>("absEtaBinsHGCal")), + jetCalibrationsHGCal(iConfig.getParameter>("jetCalibrationsHGCal")), + emFractionBinsHF(iConfig.getParameter>("emFractionBinsHF")), + absEtaBinsHF(iConfig.getParameter>("absEtaBinsHF")), + jetCalibrationsHF(iConfig.getParameter>("jetCalibrationsHF")), + tauPtBins(iConfig.getParameter>("tauPtBins")), + tauAbsEtaBinsBarrel(iConfig.getParameter>("tauAbsEtaBinsBarrel")), + tauCalibrationsBarrel(iConfig.getParameter>("tauCalibrationsBarrel")), + tauL1egInfoBarrel(iConfig.getParameter>("tauL1egInfoBarrel")), + tauAbsEtaBinsHGCal(iConfig.getParameter>("tauAbsEtaBinsHGCal")), + tauCalibrationsHGCal(iConfig.getParameter>("tauCalibrationsHGCal")), + tauL1egInfoHGCal(iConfig.getParameter>("tauL1egInfoHGCal")), + debug(iConfig.getParameter("debug")), + l1TowerToken_(consumes(iConfig.getParameter("l1CaloTowers"))) + +{ + produces("L1CaloJetsNoCuts"); + //produces("L1CaloJetsWithCuts"); + //produces("L1CaloClusterCollectionWithCuts"); + produces>("L1CaloJetCollectionBXV"); + produces>("L1CaloTauCollectionBXV"); + + if (debug) { + LogDebug("L1CaloJetProducer") << " HcalTpEtMin = " << HcalTpEtMin << " EcalTpEtMin = " << EcalTpEtMin << "\n"; + } + + // Fill the calibration 3D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is EM Fraction bin + // Dimension 3 is jet pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds + // Do Barrel, then HGCal, then HF + int index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsBarrel.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsBarrel.size() - 1; abs_eta++) { + std::vector> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsBarrel.size() - 1; em_frac++) { + std::vector pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + pt_bin_calibs.push_back(jetCalibrationsBarrel.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); + } + calibrationsBarrel.push_back(em_bins); + } + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading Barrel calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(jetCalibrationsBarrel.size()) << "\n"; + } + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHGCal.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsHGCal.size() - 1; abs_eta++) { + std::vector> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsHGCal.size() - 1; em_frac++) { + std::vector pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + pt_bin_calibs.push_back(jetCalibrationsHGCal.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); + } + calibrationsHGCal.push_back(em_bins); + } + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HGCal calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(jetCalibrationsHGCal.size()) << "\n"; + } + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHF.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsHF.size() - 1; abs_eta++) { + std::vector> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsHF.size() - 1; em_frac++) { + std::vector pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + pt_bin_calibs.push_back(jetCalibrationsHF.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); + } + calibrationsHF.push_back(em_bins); + } + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HF calibrations: Loaded " << index + << " values vs. size() of input calibration file: " << int(jetCalibrationsHF.size()) + << "\n"; + } + + // Load Tau L1EG-base calibration info into maps + for (auto &first : tauL1egInfoBarrel) { + if (debug) { + LogDebug("L1CaloJetProducer") << " barrel l1egCount = " << first.getParameter("l1egCount") << "\n"; + for (auto &em_frac : first.getParameter>("l1egEmFractions")) { + LogDebug("L1CaloJetProducer") << " - EM = " << em_frac << "\n"; + } + } + double l1egCount = first.getParameter("l1egCount"); + std::vector l1egEmFractions = first.getParameter>("l1egEmFractions"); + tauL1egInfoMapBarrel[l1egCount] = l1egEmFractions; + tauL1egValuesBarrel.push_back(l1egCount); + } + std::sort(tauL1egValuesBarrel.begin(), tauL1egValuesBarrel.end()); + for (auto &first : tauL1egInfoHGCal) { + if (debug) { + LogDebug("L1CaloJetProducer") << " hgcal l1egCount = " << first.getParameter("l1egCount") << "\n"; + for (auto &em_frac : first.getParameter>("l1egEmFractions")) { + LogDebug("L1CaloJetProducer") << " - EM = " << em_frac << "\n"; + } + } + double l1egCount = first.getParameter("l1egCount"); + std::vector l1egEmFractions = first.getParameter>("l1egEmFractions"); + tauL1egInfoMapHGCal[l1egCount] = l1egEmFractions; + tauL1egValuesHGCal.push_back(l1egCount); + } + std::sort(tauL1egValuesHGCal.begin(), tauL1egValuesHGCal.end()); + // Fill the calibration 4D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is L1EG count + // Dimension 3 is EM Fraction bin + // Dimension 4 is tau pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds (except L1EG b/c that is a cound) + // Do Barrel, then HGCal + // + // Note to future developers: be very concious of the order in which the calibrations are printed + // out in tool which makse the cfg files. You need to match that exactly when loading them and + // using the calibrations below. + index = 0; + for (unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsBarrel.size() - 1; abs_eta++) { + std::vector>> l1eg_bins; + for (auto &l1eg_info : tauL1egInfoMapBarrel) { + std::vector> em_bins; + for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { + std::vector pt_bin_calibs; + for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { + pt_bin_calibs.push_back(tauCalibrationsBarrel.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); + } + l1eg_bins.push_back(em_bins); + } + tauPtCalibrationsBarrel.push_back(l1eg_bins); + } + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading Barrel calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(tauCalibrationsBarrel.size()) << "\n"; + } + + index = 0; + for (unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsHGCal.size() - 1; abs_eta++) { + std::vector>> l1eg_bins; + for (const auto &l1eg_info : tauL1egInfoMapHGCal) { + std::vector> em_bins; + for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { + std::vector pt_bin_calibs; + for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { + pt_bin_calibs.push_back(tauCalibrationsHGCal.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); + } + l1eg_bins.push_back(em_bins); + } + tauPtCalibrationsHGCal.push_back(l1eg_bins); + } + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HGCal calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(tauCalibrationsHGCal.size()) << "\n"; + } + + isoTauBarrel.SetParameter(0, 0.25); + isoTauBarrel.SetParameter(1, 0.85); + isoTauBarrel.SetParameter(2, 0.094); + isoTauHGCal.SetParameter(0, 0.34); + isoTauHGCal.SetParameter(1, 0.35); + isoTauHGCal.SetParameter(2, 0.051); +} + +void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { + // Output collections + std::unique_ptr L1CaloJetsNoCuts(new l1tp2::CaloJetsCollection); + //std::unique_ptr L1CaloJetsWithCuts( new l1tp2::CaloJetsCollection ); + //std::unique_ptr L1CaloClusterCollectionWithCuts( new l1extra::L1JetParticleCollection ); + std::unique_ptr> L1CaloJetCollectionBXV(new l1t::JetBxCollection); + std::unique_ptr> L1CaloTauCollectionBXV(new l1t::TauBxCollection); + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + std::vector l1CaloTowers; + + iEvent.getByToken(l1TowerToken_, l1CaloTowerHandle); + for (auto &hit : *l1CaloTowerHandle.product()) { + SimpleCaloHit l1Hit; + l1Hit.ecalTowerEt = hit.ecalTowerEt(); + l1Hit.hcalTowerEt = hit.hcalTowerEt(); + l1Hit.l1egTowerEt = hit.l1egTowerEt(); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt < EcalTpEtMin) + l1Hit.ecalTowerEt = 0.0; + if (l1Hit.hcalTowerEt < HcalTpEtMin) + l1Hit.hcalTowerEt = 0.0; + l1Hit.total_tower_et = l1Hit.ecalTowerEt + l1Hit.hcalTowerEt + l1Hit.l1egTowerEt; + l1Hit.towerIEta = hit.towerIEta(); + l1Hit.towerIPhi = hit.towerIPhi(); + l1Hit.nL1eg = hit.nL1eg(); + l1Hit.l1egTrkSS = hit.l1egTrkSS(); + l1Hit.l1egTrkIso = hit.l1egTrkIso(); + l1Hit.l1egStandaloneSS = hit.l1egStandaloneSS(); + l1Hit.l1egStandaloneIso = hit.l1egStandaloneIso(); + l1Hit.isBarrel = hit.isBarrel(); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta == -1016 && (int)l1Hit.towerIPhi == -962) + continue; + + l1Hit.towerEta = hit.towerEta(); + l1Hit.towerPhi = hit.towerPhi(); + l1CaloTowers.push_back(l1Hit); + if (debug) { + LogDebug("L1CaloJetProducer") << " Tower iEta " << (int)l1Hit.towerIEta << " iPhi " << (int)l1Hit.towerIPhi + << " eta " << l1Hit.towerEta << " phi " << l1Hit.towerPhi << " ecal_et " + << l1Hit.ecalTowerEt << " hacl_et " << l1Hit.hcalTowerEt << " total_et " + << l1Hit.total_tower_et << "\n"; + } + } + + // Sort the ECAL+HCAL+L1EGs tower sums based on total ET + std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleCaloHit &a, SimpleCaloHit &b) { + return a.total_tower_et > b.total_tower_et; + }); + + /************************************************************************** + * Begin with making CaloJets in 9x9 grid based on all energy not included in L1EG Objs. + * For reference, Run-I used 12x12 grid and Stage-2/Phase-I used 9x9 grid. + * We plan to further study this choice and possibly move towards a more circular shape + * Create jetCluster within 9x9 of highest ET seed tower. + * 9 trigger towers contains all of an ak-0.4 jets, but overshoots on the corners. + ******************************************************************************/ + + // Experimental parameters, don't want to bother with hardcoding them in data format + std::map params; + + std::vector l1CaloJetObjs; + + // Count the number of unused HCAL TPs so we can stop while loop after done. + // Clustering can also stop once there are no seed hits >= EtMinForSeedHit + int n_towers = l1CaloTowers.size(); + int n_stale = 0; + bool caloJetClusteringFinished = false; + while (!caloJetClusteringFinished && n_towers != n_stale) { + l1CaloJetObj caloJetObj; + caloJetObj.Init(); + + // First find highest ET ECAL+HCAL+L1EGs tower and use to seed the 9x9 Jet + int cnt = 0; + for (auto &l1CaloTower : l1CaloTowers) { + cnt++; + if (l1CaloTower.stale) + continue; // skip l1CaloTowers which are already used + + if (caloJetObj.jetClusterET == 0.0) // this is the first l1CaloTower to seed the jet + { + // Check if the leading unused tower has ET < min for seeding a jet. + // If so, stop jet clustering + if (l1CaloTower.total_tower_et < EtMinForSeedHit) { + caloJetClusteringFinished = true; + continue; + } + l1CaloTower.stale = true; + n_stale++; + + // Set seed location needed for delta iEta/iPhi, eta/phi comparisons later + if (l1CaloTower.isBarrel) + caloJetObj.barrelSeeded = true; + else + caloJetObj.barrelSeeded = false; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( + l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( + l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( + l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( + l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; + } + if (ecalP4.pt() > 0) { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + if (l1CaloTower.isBarrel) { + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, dEta, dPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector l1EG_info = {float(l1egP4.pt()), + float(hcalP4.pt()), + float(ecalP4.pt()), + 0., + 0., + float(l1CaloTower.l1egTrkSS), + float(l1CaloTower.l1egTrkIso), + float(l1CaloTower.l1egStandaloneSS), + float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) { + caloJetObj.n_l1eg_HoverE_LessThreshold++; + } + caloJetObj.associated_l1EGs_.push_back(l1EG_info); + } + } + if (totalP4.pt() > 0) { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; + caloJetObj.seedTower += totalP4; + caloJetObj.seedTowerET += l1CaloTower.total_tower_et; + } + + caloJetObj.seed_iEta = l1CaloTower.towerIEta; + caloJetObj.seed_iPhi = l1CaloTower.towerIPhi; + + if (debug) { + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " , seeding input p4 pt " + << l1CaloTower.total_tower_et << " eta " << l1CaloTower.towerEta << " phi " + << l1CaloTower.towerPhi << "\n"; + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " , seeding input2 p4 pt " << totalP4.pt() << " eta " + << totalP4.eta() << " phi " << totalP4.phi() << "\n"; + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " seeding reslt tot p4 pt " << caloJetObj.jetClusterET + << " eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << "\n"; + } + + // Need to add the seed energy to the dR rings + caloJetObj.hcal_seed += hcalP4.pt(); + //caloJetObj.hcal_3x3 += hcalP4.pt(); + caloJetObj.hcal_3x5 += hcalP4.pt(); + //caloJetObj.hcal_5x5 += hcalP4.pt(); + //caloJetObj.hcal_5x7 += hcalP4.pt(); + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + //caloJetObj.ecal_3x3 += ecalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + //caloJetObj.ecal_5x5 += ecalP4.pt(); + //caloJetObj.ecal_5x7 += ecalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + //caloJetObj.l1eg_3x3 += l1egP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x7 += l1egP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + //caloJetObj.total_3x3 += totalP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + //caloJetObj.total_5x5 += totalP4.pt(); + //caloJetObj.total_5x7 += totalP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); + + // Some discrimination vars, 2x2s and 2x3 including central seed + //caloJetObj.hcal_2x3 += hcalP4.pt(); + //caloJetObj.hcal_2x3_1 += hcalP4.pt(); + //caloJetObj.hcal_2x3_2 += hcalP4.pt(); + //caloJetObj.ecal_2x3 += ecalP4.pt(); + //caloJetObj.ecal_2x3_1 += ecalP4.pt(); + //caloJetObj.ecal_2x3_2 += ecalP4.pt(); + //caloJetObj.l1eg_2x3 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + //caloJetObj.total_2x3 += totalP4.pt(); + //caloJetObj.total_2x3_1 += totalP4.pt(); + //caloJetObj.total_2x3_2 += totalP4.pt(); + + //caloJetObj.hcal_2x2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_1 += hcalP4.pt(); + //caloJetObj.hcal_2x2_2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_3 += hcalP4.pt(); + //caloJetObj.hcal_2x2_4 += hcalP4.pt(); + //caloJetObj.ecal_2x2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_1 += ecalP4.pt(); + //caloJetObj.ecal_2x2_2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_3 += ecalP4.pt(); + //caloJetObj.ecal_2x2_4 += ecalP4.pt(); + //caloJetObj.l1eg_2x2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + //caloJetObj.total_2x2 += totalP4.pt(); + //caloJetObj.total_2x2_1 += totalP4.pt(); + //caloJetObj.total_2x2_2 += totalP4.pt(); + //caloJetObj.total_2x2_3 += totalP4.pt(); + //caloJetObj.total_2x2_4 += totalP4.pt(); + continue; + } + + // Unused l1CaloTowers which are not the initial seed + // Depending on seed and tower locations calculate iEta/iPhi or eta/phi comparisons. + // The defaults of 99 will automatically fail comparisons for the incorrect regions. + int hit_iPhi = 99; + int d_iEta = 99; + int d_iPhi = 99; + float d_eta = 99; + float d_phi = 99; + if (caloJetObj.barrelSeeded && l1CaloTower.isBarrel) // use iEta/iPhi comparisons + { + hit_iPhi = l1CaloTower.towerIPhi; + d_iEta = tower_diEta(caloJetObj.seed_iEta, l1CaloTower.towerIEta); + d_iPhi = tower_diPhi(caloJetObj.seed_iPhi, hit_iPhi); + } else // either seed or tower are in HGCal or HF, use eta/phi + { + d_eta = caloJetObj.seedTower.eta() - l1CaloTower.towerEta; + d_phi = reco::deltaPhi(caloJetObj.seedTower.phi(), l1CaloTower.towerPhi); + } + + // 7x7 HCAL Trigger Towers + // If seeded in barrel and hit is barrel then we can compare iEta/iPhi, else need to use eta/phi + // in HGCal / transition region + if ((abs(d_iEta) <= 3 && abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) { + l1CaloTower.stale = true; + n_stale++; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( + l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( + l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( + l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( + l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; + } + if (ecalP4.pt() > 0) { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + } + if (totalP4.pt() > 0) { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; + } + + if (debug) { + LogDebug("L1CaloJetProducer") << " ---- hit " << cnt << " input p4 pt " << totalP4.pt() << " eta " + << totalP4.eta() << " phi " << totalP4.phi() << "\n"; + LogDebug("L1CaloJetProducer") << " ---- hit " << cnt << " resulting p4 pt " << caloJetObj.jetClusterET + << " eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << "\n"; + } + + if ((abs(d_iEta) == 0 && abs(d_iPhi) == 0) || (fabs(d_eta) < 0.043 && fabs(d_phi) < 0.043)) { + caloJetObj.hcal_seed += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + } + //if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 1) || + // ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.13 ) ) + //{ + // caloJetObj.hcal_3x3 += hcalP4.pt(); + // caloJetObj.ecal_3x3 += ecalP4.pt(); + // caloJetObj.l1eg_3x3 += l1egP4.pt(); + // caloJetObj.total_3x3 += totalP4.pt(); + //} + if ((abs(d_iEta) <= 1 && abs(d_iPhi) <= 2) || (fabs(d_eta) < 0.13 && fabs(d_phi) < 0.22)) { + caloJetObj.hcal_3x5 += hcalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + + // Do this for 3x5 only + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, d_iEta, d_iPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector l1EG_info = {float(l1egP4.pt()), + float(hcalP4.pt()), + float(ecalP4.pt()), + float(d_iEta), + float(d_iPhi), + float(l1CaloTower.l1egTrkSS), + float(l1CaloTower.l1egTrkIso), + float(l1CaloTower.l1egStandaloneSS), + float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) { + caloJetObj.n_l1eg_HoverE_LessThreshold++; + } + caloJetObj.associated_l1EGs_.push_back(l1EG_info); + } + } + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 2) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.22 ) ) + //{ + // caloJetObj.hcal_5x5 += hcalP4.pt(); + // caloJetObj.ecal_5x5 += ecalP4.pt(); + // caloJetObj.l1eg_5x5 += l1egP4.pt(); + // caloJetObj.total_5x5 += totalP4.pt(); + //} + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 3) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.3 ) ) + //{ + // caloJetObj.hcal_5x7 += hcalP4.pt(); + // caloJetObj.ecal_5x7 += ecalP4.pt(); + // caloJetObj.l1eg_5x7 += l1egP4.pt(); + // caloJetObj.total_5x7 += totalP4.pt(); + //} + if ((abs(d_iEta) <= 3 && abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) { + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); + } + + //// Some discrimination vars, 2x2s and 2x3s including central seed + //// Barrel first, 2x3 + //if ( ( d_iEta == 0 || d_iEta == 1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_1 += hcalP4.pt(); + // caloJetObj.ecal_2x3_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + // caloJetObj.total_2x3_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_2 += hcalP4.pt(); + // caloJetObj.ecal_2x3_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + // caloJetObj.total_2x3_2 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.13 ) + //{ + // caloJetObj.hcal_2x3 += hcalP4.pt(); + // caloJetObj.ecal_2x3 += ecalP4.pt(); + // caloJetObj.l1eg_2x3 += l1egP4.pt(); + // caloJetObj.total_2x3 += totalP4.pt(); + //} + + //// Now 2x2 Barrel first + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_1 += hcalP4.pt(); + // caloJetObj.ecal_2x2_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + // caloJetObj.total_2x2_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_2 += hcalP4.pt(); + // caloJetObj.ecal_2x2_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + // caloJetObj.total_2x2_2 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_3 += hcalP4.pt(); + // caloJetObj.ecal_2x2_3 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + // caloJetObj.total_2x2_3 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_4 += hcalP4.pt(); + // caloJetObj.ecal_2x2_4 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + // caloJetObj.total_2x2_4 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.087 ) + //{ + // caloJetObj.hcal_2x2 += hcalP4.pt(); + // caloJetObj.ecal_2x2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2 += l1egP4.pt(); + // caloJetObj.total_2x2 += totalP4.pt(); + //} + } + } + + if (caloJetObj.jetClusterET > 0.0) { + l1CaloJetObjs.push_back(caloJetObj); + } + + } // end while loop of HCAL TP clustering + + // Sort JetClusters so we can begin with the highest pt for next step of jet clustering + std::sort(begin(l1CaloJetObjs), end(l1CaloJetObjs), [](const l1CaloJetObj &a, const l1CaloJetObj &b) { + return a.jetClusterET > b.jetClusterET; + }); + + /************************************************************************** + * Progress to adding L1EGs built from ECAL TPs 9x9 grid. + * Recall, for 9x9 trigger towers gives diameter 0.78 + ******************************************************************************/ + + // Cluster together the L1EGs around existing HCAL Jet + // Cluster within dEta/dPhi 0.4 which is very close to 0.39 = 9x9/2 + //std::cout << " - Input L1EGs: " << crystalClustersVect.size() << std::endl; + for (auto &caloJetObj : l1CaloJetObjs) { + params["seed_pt"] = caloJetObj.seedTowerET; + params["seed_eta"] = caloJetObj.seedTower.eta(); + params["seed_phi"] = caloJetObj.seedTower.phi(); + params["seed_iEta"] = caloJetObj.seed_iEta; + params["seed_iPhi"] = caloJetObj.seed_iPhi; + params["seed_energy"] = caloJetObj.seedTower.energy(); + + params["hcal_pt"] = caloJetObj.hcalJetClusterET; + params["hcal_seed"] = caloJetObj.hcal_seed; + //params["hcal_3x3"] = caloJetObj.hcal_3x3; + params["hcal_3x5"] = caloJetObj.hcal_3x5; + //params["hcal_5x5"] = caloJetObj.hcal_5x5; + //params["hcal_5x7"] = caloJetObj.hcal_5x7; + params["hcal_7x7"] = caloJetObj.hcal_7x7; + //params["hcal_2x3"] = std::max( caloJetObj.hcal_2x3, std::max( caloJetObj.hcal_2x3_1, caloJetObj.hcal_2x3_2 )); + //params["hcal_2x2"] = std::max( caloJetObj.hcal_2x2, std::max( caloJetObj.hcal_2x2_1, std::max( caloJetObj.hcal_2x2_2, std::max( caloJetObj.hcal_2x2_3, caloJetObj.hcal_2x2_4 )))); + params["hcal_nHits"] = caloJetObj.hcal_nHits; + + params["ecal_pt"] = caloJetObj.ecalJetClusterET; + params["ecal_seed"] = caloJetObj.ecal_seed; + //params["ecal_3x3"] = caloJetObj.ecal_3x3; + params["ecal_3x5"] = caloJetObj.ecal_3x5; + //params["ecal_5x5"] = caloJetObj.ecal_5x5; + //params["ecal_5x7"] = caloJetObj.ecal_5x7; + params["ecal_7x7"] = caloJetObj.ecal_7x7; + //params["ecal_2x3"] = std::max( caloJetObj.ecal_2x3, std::max( caloJetObj.ecal_2x3_1, caloJetObj.ecal_2x3_2 )); + //params["ecal_2x2"] = std::max( caloJetObj.ecal_2x2, std::max( caloJetObj.ecal_2x2_1, std::max( caloJetObj.ecal_2x2_2, std::max( caloJetObj.ecal_2x2_3, caloJetObj.ecal_2x2_4 )))); + params["ecal_nHits"] = caloJetObj.ecal_nHits; + + params["l1eg_pt"] = caloJetObj.l1egJetClusterET; + params["l1eg_seed"] = caloJetObj.l1eg_seed; + //params["l1eg_3x3"] = caloJetObj.l1eg_3x3; + params["l1eg_3x5"] = caloJetObj.l1eg_3x5; + //params["l1eg_5x5"] = caloJetObj.l1eg_5x5; + //params["l1eg_5x7"] = caloJetObj.l1eg_5x7; + params["l1eg_7x7"] = caloJetObj.l1eg_7x7; + //params["l1eg_2x3"] = std::max( caloJetObj.l1eg_2x3, std::max( caloJetObj.l1eg_2x3_1, caloJetObj.l1eg_2x3_2 )); + //params["l1eg_2x2"] = std::max( caloJetObj.l1eg_2x2, std::max( caloJetObj.l1eg_2x2_1, std::max( caloJetObj.l1eg_2x2_2, std::max( caloJetObj.l1eg_2x2_3, caloJetObj.l1eg_2x2_4 )))); + params["l1eg_nHits"] = caloJetObj.l1eg_nHits; + params["l1eg_nL1EGs"] = caloJetObj.l1eg_nL1EGs; + params["l1eg_nL1EGs_standaloneSS"] = caloJetObj.l1eg_nL1EGs_standaloneSS; + params["l1eg_nL1EGs_standaloneIso"] = caloJetObj.l1eg_nL1EGs_standaloneIso; + params["l1eg_nL1EGs_trkMatchSS"] = caloJetObj.l1eg_nL1EGs_trkMatchSS; + params["l1eg_nL1EGs_trkMatchIso"] = caloJetObj.l1eg_nL1EGs_trkMatchIso; + + params["total_et"] = caloJetObj.jetClusterET; + params["total_seed"] = caloJetObj.total_seed; + //params["total_3x3"] = caloJetObj.total_3x3; + params["total_3x5"] = caloJetObj.total_3x5; + //params["total_5x5"] = caloJetObj.total_5x5; + //params["total_5x7"] = caloJetObj.total_5x7; + params["total_7x7"] = caloJetObj.total_7x7; + //params["total_2x3"] = std::max( caloJetObj.total_2x3, std::max( caloJetObj.total_2x3_1, caloJetObj.total_2x3_2 )); + //params["total_2x2"] = std::max( caloJetObj.total_2x2, std::max( caloJetObj.total_2x2_1, std::max( caloJetObj.total_2x2_2, std::max( caloJetObj.total_2x2_3, caloJetObj.total_2x2_4 )))); + params["total_nHits"] = caloJetObj.total_nHits; + //params["total_nTowers"] = total_nTowers; + + //// return -9 for energy and dR values for ecalJet as defaults + float hovere = -9; + if (caloJetObj.ecalJetClusterET > 0.0) { + hovere = caloJetObj.hcalJetClusterET / (caloJetObj.ecalJetClusterET + caloJetObj.l1egJetClusterET); + } + + params["jet_pt"] = caloJetObj.jetClusterET; + params["jet_eta"] = caloJetObj.jetCluster.eta(); + params["jet_phi"] = caloJetObj.jetCluster.phi(); + params["jet_mass"] = caloJetObj.jetCluster.mass(); + params["jet_energy"] = caloJetObj.jetCluster.energy(); + + // Calibrations + params["hcal_calibration"] = + get_hcal_calibration(params["jet_pt"], params["ecal_pt"], params["l1eg_pt"], params["jet_eta"]); + params["hcal_pt_calibration"] = params["hcal_pt"] * params["hcal_calibration"]; + params["jet_pt_calibration"] = params["hcal_pt_calibration"] + params["ecal_pt"] + params["l1eg_pt"]; + + // Tau Vars + // The tau pT calibration is applied as a SF to the total raw pT + // in contrast to the jet calibration above + params["tau_pt_calibration_value"] = get_tau_pt_calibration(params["total_3x5"], + params["ecal_3x5"], + params["l1eg_3x5"], + caloJetObj.n_l1eg_HoverE_LessThreshold, + params["jet_eta"]); + params["tau_pt"] = params["total_3x5"] * params["tau_pt_calibration_value"]; + params["n_l1eg_HoverE_LessThreshold"] = caloJetObj.n_l1eg_HoverE_LessThreshold; + // Currently, applying the tau_pt calibration to the isolation region as well... + // One could switch to using the calibrated jet_pt instead for the iso region... + // This should be revisited - FIXME? + params["tau_total_iso_et"] = params["jet_pt"] * params["tau_pt_calibration_value"]; + params["tau_iso_et"] = (params["jet_pt"] * params["tau_pt_calibration_value"]) - params["tau_pt"]; + params["loose_iso_tau_wp"] = float(loose_iso_tau_wp(params["tau_pt"], params["tau_iso_et"], params["jet_eta"])); + + float calibratedPt = -1; + float ECalIsolation = -1; // Need to loop over 7x7 crystals of unclustered energy + float totalPtPUcorr = -1; + l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr); + caloJet.setExperimentalParams(params); + caloJet.setAssociated_l1EGs(caloJetObj.associated_l1EGs_); + + // Only store jets passing ET threshold + if (params["jet_pt_calibration"] >= EtMinForCollection) { + L1CaloJetsNoCuts->push_back(caloJet); + //L1CaloJetsWithCuts->push_back( caloJet ); + reco::Candidate::PolarLorentzVector jet_p4 = reco::Candidate::PolarLorentzVector( + params["jet_pt_calibration"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M()); + L1CaloJetCollectionBXV->push_back(0, l1t::Jet(jet_p4)); + + if (debug) + LogDebug("L1CaloJetProducer") << " Made a Jet, eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << " pt " << caloJetObj.jetClusterET + << " calibrated pt " << params["jet_pt_calibration"] << "\n"; + } + + // Only store taus passing ET threshold + if (params["tau_pt"] >= EtMinForTauCollection) { + short int tau_ieta = caloJetObj.seed_iEta; + short int tau_iphi = caloJetObj.seed_iPhi; + short int raw_et = params["total_3x5"]; + short int iso_et = params["tau_iso_et"]; + bool hasEM = false; + if (params["l1eg_3x5"] > 0. || params["ecal_3x5"] > 0.) { + hasEM = true; + } + int tau_qual = int(params["loose_iso_tau_wp"]); + + reco::Candidate::PolarLorentzVector tau_p4 = reco::Candidate::PolarLorentzVector( + params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M()); + l1t::Tau l1Tau = l1t::Tau(tau_p4, params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), tau_qual, iso_et); + l1Tau.setTowerIEta(tau_ieta); + l1Tau.setTowerIPhi(tau_iphi); + l1Tau.setRawEt(raw_et); + l1Tau.setIsoEt(iso_et); + l1Tau.setHasEM(hasEM); + l1Tau.setIsMerged(false); + L1CaloTauCollectionBXV->push_back(0, l1Tau); + + if (debug) { + LogDebug("L1CaloJetProducer") << " Made a Jet, eta " << l1Tau.eta() << " phi " << l1Tau.phi() << " pt " + << l1Tau.rawEt() << " calibrated pt " << l1Tau.pt() << "\n"; + } + } + + } // end jetClusters loop + + iEvent.put(std::move(L1CaloJetsNoCuts), "L1CaloJetsNoCuts"); + //iEvent.put(std::move(L1CaloJetsWithCuts), "L1CaloJetsWithCuts" ); + //iEvent.put(std::move(L1CaloClusterCollectionWithCuts), "L1CaloClusterCollectionWithCuts" ); + iEvent.put(std::move(L1CaloJetCollectionBXV), "L1CaloJetCollectionBXV"); + iEvent.put(std::move(L1CaloTauCollectionBXV), "L1CaloTauCollectionBXV"); +} + +int L1CaloJetProducer::ecalXtal_diPhi(int &iPhi_1, int &iPhi_2) const { + // We shouldn't compare integer indices in endcap, the map is not linear + // Logic from EBDetId::distancePhi() without the abs() + int PI = 180; + int result = iPhi_1 - iPhi_2; + while (result > PI) + result -= 2 * PI; + while (result <= -PI) + result += 2 * PI; + return result; +} + +int L1CaloJetProducer::tower_diPhi(int &iPhi_1, int &iPhi_2) const { + // 360 Crystals in full, 72 towers, half way is 36 + int PI = 36; + int result = iPhi_1 - iPhi_2; + while (result > PI) + result -= 2 * PI; + while (result <= -PI) + result += 2 * PI; + return result; +} + +// Added b/c of the iEta jump from +1 to -1 across the barrel mid point +int L1CaloJetProducer::tower_diEta(int &iEta_1, int &iEta_2) const { + // On same side of barrel + if (iEta_1 * iEta_2 > 0) + return iEta_1 - iEta_2; + else + return iEta_1 - iEta_2 - 1; +} + +float L1CaloJetProducer::get_deltaR(reco::Candidate::PolarLorentzVector &p4_1, + reco::Candidate::PolarLorentzVector &p4_2) const { + // Check that pt is > 0 for both or else reco::deltaR returns bogus values + if (p4_1.pt() > 0 && p4_2.pt() > 0) { + return reco::deltaR(p4_1, p4_2); + } else + return -1; +} + +// Apply calibrations to HCAL energy based on EM Fraction, Jet Eta, Jet pT +float L1CaloJetProducer::get_hcal_calibration(float &jet_pt, + float &ecal_pt, + float &ecal_L1EG_jet_pt, + float &jet_eta) const { + float em_frac = (ecal_L1EG_jet_pt + ecal_pt) / jet_pt; + float abs_eta = fabs(jet_eta); + float tmp_jet_pt = jet_pt; + if (tmp_jet_pt > 499) + tmp_jet_pt = 499; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t pt_index = 0; + float calib = 1.0; + if (abs_eta <= 1.5) { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsBarrel.size(); i++) { + if (em_frac <= emFractionBinsBarrel.at(i)) + break; + em_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsBarrel.size(); i++) { + if (abs_eta <= absEtaBinsBarrel.at(i)) + break; + eta_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; + } + calib = calibrationsBarrel[eta_index][em_index][pt_index]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsHGCal.size(); i++) { + if (em_frac <= emFractionBinsHGCal.at(i)) + break; + em_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsHGCal.size(); i++) { + if (abs_eta <= absEtaBinsHGCal.at(i)) + break; + eta_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; + } + calib = calibrationsHGCal[eta_index][em_index][pt_index]; + } // end HGCal + else // HF + { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsHF.size(); i++) { + if (em_frac <= emFractionBinsHF.at(i)) + break; + em_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsHF.size(); i++) { + if (abs_eta <= absEtaBinsHF.at(i)) + break; + eta_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; + } + calib = calibrationsHF[eta_index][em_index][pt_index]; + } // end HF + + return calib; +} + +// Apply calibrations to tau pT based on L1EG info, EM Fraction, Tau Eta, Tau pT +float L1CaloJetProducer::get_tau_pt_calibration( + float &tau_pt, float &ecal_pt, float &l1EG_pt, float &n_L1EGs, float &tau_eta) const { + float em_frac = (l1EG_pt + ecal_pt) / tau_pt; + float abs_eta = fabs(tau_eta); + float tmp_tau_pt = tau_pt; + if (tmp_tau_pt > 199) + tmp_tau_pt = 199; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t n_L1EG_index = 0; + size_t pt_index = 0; + float calib = 1.0; + // HERE + if (abs_eta <= 1.5) { + // Start loop checking 1st value + for (unsigned int i = 0; i < tauL1egValuesBarrel.size(); i++) { + if (n_L1EGs == tauL1egValuesBarrel.at(i)) + break; + if (tauL1egValuesBarrel.at(i) == tauL1egValuesBarrel.back()) + break; // to preven incrementing on last one + n_L1EG_index++; + } + + // Find key value pair matching n L1EGs + for (auto &l1eg_info : tauL1egInfoMapBarrel) { + if (l1eg_info.first != double(n_L1EG_index)) + continue; + // Start loop checking 2nd value + for (unsigned int i = 1; i < l1eg_info.second.size(); i++) { + if (em_frac <= l1eg_info.second.at(i)) + break; + em_index++; + } + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauAbsEtaBinsBarrel.size(); i++) { + if (abs_eta <= tauAbsEtaBinsBarrel.at(i)) + break; + eta_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauPtBins.size(); i++) { + if (tmp_tau_pt <= tauPtBins.at(i)) + break; + pt_index++; + } + calib = tauPtCalibrationsBarrel[eta_index][n_L1EG_index][em_index][pt_index]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 1st value + for (unsigned int i = 0; i < tauL1egValuesHGCal.size(); i++) { + if (n_L1EGs == tauL1egValuesHGCal.at(i)) + break; + if (tauL1egValuesHGCal.at(i) == tauL1egValuesHGCal.back()) + break; // to preven incrementing on last one + n_L1EG_index++; + } + + // Find key value pair matching n L1EGs + for (auto &l1eg_info : tauL1egInfoMapHGCal) { + if (l1eg_info.first != double(n_L1EG_index)) + continue; + // Start loop checking 2nd value + for (unsigned int i = 1; i < l1eg_info.second.size(); i++) { + if (em_frac <= l1eg_info.second.at(i)) + break; + em_index++; + } + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauAbsEtaBinsHGCal.size(); i++) { + if (abs_eta <= tauAbsEtaBinsHGCal.at(i)) + break; + eta_index++; + } + + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauPtBins.size(); i++) { + if (tmp_tau_pt <= tauPtBins.at(i)) + break; + pt_index++; + } + calib = tauPtCalibrationsHGCal[eta_index][n_L1EG_index][em_index][pt_index]; + } // end HGCal + else + return calib; + + return calib; +} + +// Loose IsoTau WP +int L1CaloJetProducer::loose_iso_tau_wp(float &tau_pt, float &tau_iso_et, float &tau_eta) const { + // Fully relaxed above 100 GeV pT + if (tau_pt > 100) { + return 1; + } + // Split by barrel and HGCal + // with Barrel first + if (fabs(tau_eta) < 1.5) { + if (isoTauBarrel.Eval(tau_pt) >= (tau_iso_et / tau_pt)) { + return 1; + } else { + return 0; + } + } + // HGCal + if (fabs(tau_eta) < 3.0) { + if (isoTauHGCal.Eval(tau_pt) >= (tau_iso_et / tau_pt)) { + return 1; + } else { + return 0; + } + } + // Beyond HGCal + return 0; +} + +DEFINE_FWK_MODULE(L1CaloJetProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc index fc5693620355a..8d8ba03cadec4 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc @@ -240,14 +240,14 @@ class L1EGCrystalClusterEmulatorProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT ecalTPEBToken_; edm::EDGetTokenT > hcalTPToken_; - edm::ESHandle decoder_; + edm::ESGetToken decoderTag_; l1tp2::ParametricCalibration calib_; - edm::ESHandle caloGeometry_; + edm::ESGetToken caloGeometryTag_; const CaloSubdetectorGeometry* ebGeometry; const CaloSubdetectorGeometry* hbGeometry; - edm::ESHandle hbTopology; + edm::ESGetToken hbTopologyTag_; const HcalTopology* hcTopology_; struct mycluster { @@ -341,10 +341,13 @@ L1EGCrystalClusterEmulatorProducer::L1EGCrystalClusterEmulatorProducer(const edm : ecalTPEBToken_(consumes(iConfig.getParameter("ecalTPEB"))), hcalTPToken_( consumes >(iConfig.getParameter("hcalTP"))), - calib_(iConfig.getParameter("calib")) { + decoderTag_(esConsumes(edm::ESInputTag("", ""))), + calib_(iConfig.getParameter("calib")), + caloGeometryTag_(esConsumes(edm::ESInputTag("", ""))), + hbTopologyTag_(esConsumes(edm::ESInputTag("", ""))) { produces(); produces >(); - produces(); + produces("L1CaloTowerCollection"); } L1EGCrystalClusterEmulatorProducer::~L1EGCrystalClusterEmulatorProducer() {} @@ -355,13 +358,14 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: edm::Handle pcalohits; iEvent.getByToken(ecalTPEBToken_, pcalohits); - iSetup.get().get(caloGeometry_); - ebGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - hbGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - iSetup.get().get(hbTopology); - hcTopology_ = hbTopology.product(); + const auto& caloGeometry = iSetup.getData(caloGeometryTag_); + ebGeometry = caloGeometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + hbGeometry = caloGeometry.getSubdetectorGeometry(DetId::Hcal, HcalBarrel); + const auto& hbTopology = iSetup.getData(hbTopologyTag_); + hcTopology_ = &hbTopology; HcalTrigTowerGeometry theTrigTowerGeometry(hcTopology_); - iSetup.get().get(decoder_); + + const auto& decoder = iSetup.getData(decoderTag_); //**************************************************************** //******************* Get all the hits *************************** @@ -395,7 +399,7 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: edm::Handle > hbhecoll; iEvent.getByToken(hcalTPToken_, hbhecoll); for (const auto& hit : *hbhecoll.product()) { - float et = decoder_->hcaletValue(hit.id(), hit.t0()); + float et = decoder.hcaletValue(hit.id(), hit.t0()); if (et <= 0) continue; if (!(hcTopology_->validHT(hit.id()))) { @@ -1173,7 +1177,7 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: iEvent.put(std::move(L1EGXtalClusters)); iEvent.put(std::move(L1EGammas)); - iEvent.put(std::move(L1CaloTowers)); + iEvent.put(std::move(L1CaloTowers), "L1CaloTowerCollection"); } bool L1EGCrystalClusterEmulatorProducer::passes_iso(float pt, float iso) { diff --git a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc new file mode 100644 index 0000000000000..9054acca9739e --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc @@ -0,0 +1,579 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1TowerCalibrator +// +/**\class L1TowerCalibrator L1TowerCalibrator.cc + +Description: +Take the calibrated unclustered ECAL energy and total HCAL +energy associated with the L1CaloTower collection output +from L1EGammaCrystalsEmulatorProducer: l1CaloTowerCollection, "L1CaloTowerCollection" + +as well as HGCal Tower level inputs: +BXVector "hgcalTriggerPrimitiveDigiProducer" "tower" "HLT" + +and HCAL HF inputs from: +edm::SortedCollection > "simHcalTriggerPrimitiveDigis" "" "HLT" + + +Implement PU-based calibrations which scale down the ET +in the towers based on mapping nTowers with ECAL(HCAL) ET <= defined PU threshold. +This value has been shown to be similar between TTbar, QCD, and minBias samples. +This allows a prediction of nvtx. Which can be mapped to the total minBias +energy in an eta slice of the detector. Subtract the total estimated minBias energy +per eta slice divided by nTowers in that eta slice from each trigger tower in +that eta slice. + +This is all ECAL / HCAL specific or EM vs. Hadronic for HGCal. + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Thu Nov 15 2018 +// $Id$ +// +// + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include + +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h" +#include "DataFormats/L1THGCal/interface/HGCalTower.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" + +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" + +#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h" + +#include "TFile.h" +#include "TF1.h" + +class L1TowerCalibrator : public edm::EDProducer { +public: + explicit L1TowerCalibrator(const edm::ParameterSet&); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double puThreshold; + double puThresholdL1eg; + double puThresholdHcalMin; + double puThresholdHcalMax; + double puThresholdEcalMin; + double puThresholdEcalMax; + double puThresholdHGCalEMMin; + double puThresholdHGCalEMMax; + double puThresholdHGCalHadMin; + double puThresholdHGCalHadMax; + double puThresholdHFMin; + double puThresholdHFMax; + double barrelSF; + double hgcalSF; + double hfSF; + bool debug; + bool skipCalibrations; + + edm::EDGetTokenT l1TowerToken_; + edm::Handle l1CaloTowerHandle; + + edm::EDGetTokenT hgcalTowersToken_; + edm::Handle hgcalTowersHandle; + l1t::HGCalTowerBxCollection hgcalTowers; + + edm::EDGetTokenT hcalToken_; + edm::Handle hcalTowerHandle; + edm::ESGetToken decoderTag_; + + // nHits to nvtx functions + std::vector nHits_to_nvtx_params; + std::map nHits_to_nvtx_funcs; + + // nvtx to PU subtraction functions + std::vector nvtx_to_PU_sub_params; + std::map ecal_nvtx_to_PU_sub_funcs; + std::map hcal_nvtx_to_PU_sub_funcs; + std::map hgcalEM_nvtx_to_PU_sub_funcs; + std::map hgcalHad_nvtx_to_PU_sub_funcs; + std::map hf_nvtx_to_PU_sub_funcs; + std::map > all_nvtx_to_PU_sub_funcs; +}; + +L1TowerCalibrator::L1TowerCalibrator(const edm::ParameterSet& iConfig) + : HcalTpEtMin(iConfig.getParameter("HcalTpEtMin")), + EcalTpEtMin(iConfig.getParameter("EcalTpEtMin")), + HGCalHadTpEtMin(iConfig.getParameter("HGCalHadTpEtMin")), + HGCalEmTpEtMin(iConfig.getParameter("HGCalEmTpEtMin")), + HFTpEtMin(iConfig.getParameter("HFTpEtMin")), + puThreshold(iConfig.getParameter("puThreshold")), + puThresholdL1eg(iConfig.getParameter("puThresholdL1eg")), + puThresholdHcalMin(iConfig.getParameter("puThresholdHcalMin")), + puThresholdHcalMax(iConfig.getParameter("puThresholdHcalMax")), + puThresholdEcalMin(iConfig.getParameter("puThresholdEcalMin")), + puThresholdEcalMax(iConfig.getParameter("puThresholdEcalMax")), + puThresholdHGCalEMMin(iConfig.getParameter("puThresholdHGCalEMMin")), + puThresholdHGCalEMMax(iConfig.getParameter("puThresholdHGCalEMMax")), + puThresholdHGCalHadMin(iConfig.getParameter("puThresholdHGCalHadMin")), + puThresholdHGCalHadMax(iConfig.getParameter("puThresholdHGCalHadMax")), + puThresholdHFMin(iConfig.getParameter("puThresholdHFMin")), + puThresholdHFMax(iConfig.getParameter("puThresholdHFMax")), + barrelSF(iConfig.getParameter("barrelSF")), + hgcalSF(iConfig.getParameter("hgcalSF")), + hfSF(iConfig.getParameter("hfSF")), + debug(iConfig.getParameter("debug")), + skipCalibrations(iConfig.getParameter("skipCalibrations")), + l1TowerToken_(consumes(iConfig.getParameter("l1CaloTowers"))), + hgcalTowersToken_( + consumes(iConfig.getParameter("L1HgcalTowersInputTag"))), + hcalToken_(consumes(iConfig.getParameter("hcalDigis"))), + decoderTag_(esConsumes(edm::ESInputTag("", ""))), + nHits_to_nvtx_params(iConfig.getParameter >("nHits_to_nvtx_params")), + nvtx_to_PU_sub_params(iConfig.getParameter >("nvtx_to_PU_sub_params")) { + // Initialize the nHits --> nvtx functions + for (uint i = 0; i < nHits_to_nvtx_params.size(); i++) { + edm::ParameterSet* pset = &nHits_to_nvtx_params.at(i); + std::string calo = pset->getParameter("fit"); + nHits_to_nvtx_funcs[calo.c_str()] = TF1(calo.c_str(), "[0] + [1] * x"); + nHits_to_nvtx_funcs[calo.c_str()].SetParameter(0, pset->getParameter >("params").at(0)); + nHits_to_nvtx_funcs[calo.c_str()].SetParameter(1, pset->getParameter >("params").at(1)); + + if (debug) { + printf( + "nHits_to_nvtx_params[%i]\n \ + fit: %s \n \ + p1: %f \n \ + p2 %f \n", + i, + calo.c_str(), + nHits_to_nvtx_funcs[calo.c_str()].GetParameter(0), + nHits_to_nvtx_funcs[calo.c_str()].GetParameter(1)); + } + } + + // Initialize the nvtx --> PU subtraction functions + all_nvtx_to_PU_sub_funcs["ecal"] = ecal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hcal"] = hcal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hgcalEM"] = hgcalEM_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hgcalHad"] = hgcalHad_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hf"] = hf_nvtx_to_PU_sub_funcs; + + for (uint i = 0; i < nvtx_to_PU_sub_params.size(); i++) { + edm::ParameterSet* pset = &nvtx_to_PU_sub_params.at(i); + std::string calo = pset->getParameter("calo"); + std::string iEta = pset->getParameter("iEta"); + double p1 = pset->getParameter >("params").at(0); + double p2 = pset->getParameter >("params").at(1); + + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()] = TF1(calo.c_str(), "[0] + [1] * x"); + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()].SetParameter(0, p1); + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()].SetParameter(1, p2); + + if (debug) { + printf( + "nvtx_to_PU_sub_params[%i]\n \ + sub detector: %s \n \ + iEta: %s \n \ + p1: %f \n \ + p2 %f \n", + i, + calo.c_str(), + iEta.c_str(), + p1, + p2); + } + } + + // Our two outputs, calibrated towers and estimated nvtx for fun + produces("L1CaloTowerCalibratedCollection"); + produces("EstimatedNvtx"); +} + +void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Estimated number of vertices used for calibration estimattion + std::unique_ptr EstimatedNvtx(new double); + // Calibrated output collection + std::unique_ptr L1CaloTowerCalibratedCollection(new l1tp2::CaloTowerCollection); + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + iEvent.getByToken(l1TowerToken_, l1CaloTowerHandle); + + // HGCal info + iEvent.getByToken(hgcalTowersToken_, hgcalTowersHandle); + hgcalTowers = (*hgcalTowersHandle.product()); + + // HF Tower info + iEvent.getByToken(hcalToken_, hcalTowerHandle); + + // Barrel ECAL (unclustered) and HCAL + for (auto& hit : *l1CaloTowerHandle.product()) { + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(hit.ecalTowerEt()); + l1Hit.setHcalTowerEt(hit.hcalTowerEt()); + l1Hit.setL1egTowerEt(hit.l1egTowerEt()); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt() < EcalTpEtMin) + l1Hit.setEcalTowerEt(0.0); + if (l1Hit.hcalTowerEt() < HcalTpEtMin) + l1Hit.setHcalTowerEt(0.0); + l1Hit.setTowerIEta(hit.towerIEta()); + l1Hit.setTowerIPhi(hit.towerIPhi()); + l1Hit.setTowerEta(hit.towerEta()); + l1Hit.setTowerPhi(hit.towerPhi()); + l1Hit.setIsBarrel(hit.isBarrel()); + l1Hit.setNL1eg(hit.nL1eg()); + l1Hit.setL1egTrkSS(hit.l1egTrkSS()); + l1Hit.setL1egTrkIso(hit.l1egTrkIso()); + l1Hit.setL1egStandaloneSS(hit.l1egStandaloneSS()); + l1Hit.setL1egStandaloneIso(hit.l1egStandaloneIso()); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta() == -1016 && (int)l1Hit.towerIPhi() == -962) + continue; + + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + if (debug) + printf("Barrel tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // Loop over HGCalTowers and create L1CaloTowers for them and add to collection + // This iterator is taken from the PF P2 group + // https://github.com/p2l1pfp/cmssw/blob/170808db68038d53794bc65fdc962f8fc337a24d/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFCaloProducer.cc#L278-L289 + for (auto it = hgcalTowers.begin(0), ed = hgcalTowers.end(0); it != ed; ++it) { + // skip lowest ET towers + if (it->etEm() < HGCalEmTpEtMin && it->etHad() < HGCalHadTpEtMin) + continue; + + l1tp2::CaloTower l1Hit; + // Set energies normally, but need to zero if below threshold + if (it->etEm() < HGCalEmTpEtMin) + l1Hit.setEcalTowerEt(0.); + else + l1Hit.setEcalTowerEt(it->etEm()); + + if (it->etHad() < HGCalHadTpEtMin) + l1Hit.setHcalTowerEt(0.); + else + l1Hit.setHcalTowerEt(it->etHad()); + + l1Hit.setTowerEta(it->eta()); + l1Hit.setTowerPhi(it->phi()); + l1Hit.setTowerIEta(-98); // -98 mean HGCal + l1Hit.setTowerIPhi(-98); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + if (debug) + printf("HGCal tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // Loop over Hcal HF tower inputs and create L1CaloTowers and add to + // L1CaloTowerCalibratedCollection collection + const auto& decoder = iSetup.getData(decoderTag_); + for (const auto& hit : *hcalTowerHandle.product()) { + HcalTrigTowerDetId id = hit.id(); + double et = decoder.hcaletValue(hit.id(), hit.t0()); + if (et < HFTpEtMin) + continue; + // Only doing HF so skip outside range + if (abs(id.ieta()) < l1t::CaloTools::kHFBegin) + continue; + if (abs(id.ieta()) > l1t::CaloTools::kHFEnd) + continue; + + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(0.); + l1Hit.setHcalTowerEt(et); + l1Hit.setTowerEta(l1t::CaloTools::towerEta(id.ieta())); + l1Hit.setTowerPhi(l1t::CaloTools::towerPhi(id.ieta(), id.iphi())); + l1Hit.setTowerIEta(id.ieta()); + l1Hit.setTowerIPhi(id.iphi()); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + + if (debug) + printf("HCAL HF tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // N Tower totals + // For mapping to estimated nvtx in event + int i_ecal_hits_leq_threshold = 0; + int i_hgcalEM_hits_leq_threshold = 0; + int i_hcal_hits_leq_threshold = 0; + int i_hgcalHad_hits_leq_threshold = 0; + int i_hf_hits_leq_threshold = 0; + + // Loop over the collection containing all hits + // and calculate the number of hits falling into the + // "less than or equal" nTowers variable which maps to + // estimated number of vertices + for (auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) { + // Barrel ECAL + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) { + if (l1CaloTower.ecalTowerEt() <= puThresholdEcalMax && l1CaloTower.ecalTowerEt() >= puThresholdEcalMin) { + i_ecal_hits_leq_threshold++; + } + } + + // HGCal EM + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (l1CaloTower.ecalTowerEt() <= puThresholdHGCalEMMax && l1CaloTower.ecalTowerEt() >= puThresholdHGCalEMMin) { + i_hgcalEM_hits_leq_threshold++; + } + } + + // Barrel HCAL + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF + { + if (l1CaloTower.hcalTowerEt() <= puThresholdHcalMax && l1CaloTower.hcalTowerEt() >= puThresholdHcalMin) { + i_hcal_hits_leq_threshold++; + } + } + + // HGCal Had + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (l1CaloTower.hcalTowerEt() <= puThresholdHGCalHadMax && l1CaloTower.hcalTowerEt() >= puThresholdHGCalHadMin) { + i_hgcalHad_hits_leq_threshold++; + } + } + + // HF + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF + { + if (l1CaloTower.hcalTowerEt() <= puThresholdHFMax && l1CaloTower.hcalTowerEt() >= puThresholdHFMin) { + i_hf_hits_leq_threshold++; + } + } + } + + // For each subdetector, map to the estimated number of vertices + double ecal_nvtx = nHits_to_nvtx_funcs["ecal"].Eval(i_ecal_hits_leq_threshold); + double hcal_nvtx = nHits_to_nvtx_funcs["hcal"].Eval(i_hcal_hits_leq_threshold); + double hgcalEM_nvtx = nHits_to_nvtx_funcs["hgcalEM"].Eval(i_hgcalEM_hits_leq_threshold); + double hgcalHad_nvtx = nHits_to_nvtx_funcs["hgcalHad"].Eval(i_hgcalHad_hits_leq_threshold); + double hf_nvtx = nHits_to_nvtx_funcs["hf"].Eval(i_hf_hits_leq_threshold); + // Make sure all values are >= 0 + if (ecal_nvtx < 0) + ecal_nvtx = 0; + if (hcal_nvtx < 0) + hcal_nvtx = 0; + if (hgcalEM_nvtx < 0) + hgcalEM_nvtx = 0; + if (hgcalHad_nvtx < 0) + hgcalHad_nvtx = 0; + if (hf_nvtx < 0) + hf_nvtx = 0; + // Best estimate is avg of all except HF. + // This is b/c HF currently has such poor prediction power, it only degrades the avg result + // NEW, with 10_3_X, hgcal and HF has the best results based on the values I took... + // skip ECAL and HCAL + //*EstimatedNvtx = ( ecal_nvtx + hcal_nvtx + hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; + *EstimatedNvtx = (hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx) / 3.; + + if (debug) { + double lumi = iEvent.eventAuxiliary().luminosityBlock(); + double event = iEvent.eventAuxiliary().event(); + + printf( + "L1TowerCalibrater: lumi %.0f evt %.0f nTowers for subdetecters \ + \nECAL: %i --> nvtx = %.1f \ + \nHGCal EM: %i --> nvtx = %.1f \ + \nHCAL: %i --> nvtx = %.1f \ + \nHGCal Had: %i --> nvtx = %.1f \ + \nHCAL HF: %i --> nvtx = %.1f \ + \nEstimated Nvtx = %.1f\n", + lumi, + event, + i_ecal_hits_leq_threshold, + ecal_nvtx, + i_hgcalEM_hits_leq_threshold, + hgcalEM_nvtx, + i_hcal_hits_leq_threshold, + hcal_nvtx, + i_hgcalHad_hits_leq_threshold, + hgcalHad_nvtx, + i_hf_hits_leq_threshold, + hf_nvtx, + *EstimatedNvtx); + } + + // Use estimated number of vertices to subtract off PU contributions + // to each and every hit. In cases where the energy would go negative, + // limit this to zero. + if (!skipCalibrations) // skipCalibrations simply passes the towers through + { + for (auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) { + // Barrel ECAL eta slices + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) { + if (abs(l1CaloTower.towerIEta()) <= 3) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er1to3"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er4to6"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er7to9"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er10to12"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er13to15"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er16to18"].Eval(*EstimatedNvtx) * barrelSF); + } + } + + // HGCal EM eta slices + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (abs(l1CaloTower.towerEta()) <= 1.8) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er1p4to1p8"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er1p8to2p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p1to2p4"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p4to2p7"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p7to3p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + } + + // Barrel HCAL eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF + { + if (abs(l1CaloTower.towerIEta()) <= 3) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er1to3"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er4to6"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er7to9"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er10to12"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er13to15"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er16to18"].Eval(*EstimatedNvtx) * barrelSF); + } + } + + // HGCal Had eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (abs(l1CaloTower.towerEta()) <= 1.8) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er1p4to1p8"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er1p8to2p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p1to2p4"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p4to2p7"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p7to3p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + } + + // HF eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF + { + if (abs(l1CaloTower.towerIEta()) <= 33 && abs(l1CaloTower.towerIEta()) >= 29) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er29to33"].Eval(*EstimatedNvtx) * hfSF); + } + if (abs(l1CaloTower.towerIEta()) <= 37 && abs(l1CaloTower.towerIEta()) >= 34) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er34to37"].Eval(*EstimatedNvtx) * hfSF); + } + if (abs(l1CaloTower.towerIEta()) <= 41 && abs(l1CaloTower.towerIEta()) >= 38) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er38to41"].Eval(*EstimatedNvtx) * hfSF); + } + } + + // Make sure none are negative + if (l1CaloTower.ecalTowerEt() < 0.) + l1CaloTower.setEcalTowerEt(0.); + if (l1CaloTower.hcalTowerEt() < 0.) + l1CaloTower.setHcalTowerEt(0.); + } + } + + iEvent.put(std::move(EstimatedNvtx), "EstimatedNvtx"); + iEvent.put(std::move(L1CaloTowerCalibratedCollection), "L1CaloTowerCalibratedCollection"); +} + +DEFINE_FWK_MODULE(L1TowerCalibrator); diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 27630b94c17d6..ba5685517b2a8 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -5,7 +5,7 @@ // /**\class Phase1L1TJetProducer Phase1L1TJetProducer.cc L1Trigger/L1CaloTrigger/plugin/Phase1L1TJetProducer.cc -Description: Produces jets with a phase-1 like sliding window algorithm using a collection of reco::Candidates in input. +Description: Produces jets with a phase-1 like sliding window algorithm using a collection of reco::Candidates in input. Also calculates MET from the histogram used to find the jets. *** INPUT PARAMETERS *** * etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta) @@ -14,8 +14,14 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a * phiUp: double, max phi (typically +pi) * jetIEtaSize: uint32, jet cluster size in ieta * jetIPhiSize: uint32, jet cluster size in iphi + * trimmedGrid: Flag (bool) to remove three bins in each corner of grid in jet finding * seedPtThreshold: double, threshold of the seed tower + * pt/eta/philsb : lsb of quantities used in firmware implementation * puSubtraction: bool, runs chunky doughnut pile-up subtraction, 9x9 jet only + * eta/phiRegionEdges: Boundaries of the input (PF) regions + * maxInputsPerRegion: Truncate number of inputes per input (PF) region + * sin/cosPhi: Value of sin/cos phi in the middle of each bin of the grid. + * met{HF}AbsETaCut: Eta selection of input candidates for calculation of MET * outputCollectionName: string, tag for the output collection * vetoZeroPt: bool, controls whether jets with 0 pt should be save. It matters if PU is ON, as you can get negative or zero pt jets after it. @@ -25,6 +31,7 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a // // Original Simone Bologna // Created: Mon Jul 02 2018 +// Modified 2020 Emyr Clement // #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -41,7 +48,7 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" #include "TH2F.h" @@ -66,20 +73,62 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { /// Finds the seeds in the caloGrid, seeds are saved in a vector that contain the index in the TH2F of each seed std::vector> findSeeds(float seedThreshold) const; - std::vector _buildJetsFromSeedsWithPUSubtraction(const std::vector>& seeds, - bool killZeroPt) const; - std::vector _buildJetsFromSeeds(const std::vector>& seeds) const; + // Calculates the pt sum of the bins around the seeds + // And applies some PU mitigation + // Warning - not used for some time, so user beware + std::vector buildJetsFromSeedsWithPUSubtraction(const std::vector>& seeds, + bool killZeroPt) const; + // Calculates the pt sum of the bins around the seeds + std::vector buildJetsFromSeeds(const std::vector>& seeds) const; + + // Used by buildJetsFromSeedsWithPUSubtraction + // Implementation of pileup mitigation + // Warning - not used for some time, so user beware void subtract9x9Pileup(reco::CaloJet& jet) const; /// Get the energy of a certain tower while correctly handling phi periodicity in case of overflow float getTowerEnergy(int iEta, int iPhi) const; + // Implementation of pt sum of bins around one seed reco::CaloJet buildJetFromSeed(const std::tuple& seed) const; // <3 handy method to fill the calogrid with whatever type template - void fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives); + void fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives, const unsigned int regionIndex); + + // Digitise the eta and phi coordinates of input candidates + // This converts the quantities to integers to reduce precision + // And takes account of bin edge effects i.e. makes sure the + // candidate ends up in the correct (i.e. same behaviour as the firmware) bin of caloGrid_ + std::pair getCandidateDigiEtaPhi(const float eta, + const float phi, + const unsigned int regionIndex) const; + + // Sorts the input candidates into the PF regions they arrive in + // Truncates the inputs. Takes the first N candidates as they are provided, without any sorting (this may be needed in the future and/or provided in this way from emulation of layer 1) + template + std::vector> prepareInputsIntoRegions(const Handle triggerPrimitives); + + // Converts phi and eta (PF) region indices to a single index + unsigned int getRegionIndex(const unsigned int phiRegion, const unsigned int etaRegion) const; + // From the single index, calculated by getRegionIndex, provides the lower eta and phi boundaries of the input (PF) region index + std::pair regionEtaPhiLowEdges(const unsigned int regionIndex) const; + // From the single index, calculated by getRegionIndex, provides the upper eta and phi boundaries of the input (PF) region index + std::pair regionEtaPhiUpEdges(const unsigned int regionIndex) const; + + // computes MET + // Takes grid used by jet finder and projects to 1D histogram of phi, bin contents are total pt in that phi bin + // the phi bin index is used to retrieve the sin-cos value from the LUT emulator + // the pt of the input is multiplied by that sin cos value to obtain px and py that is added to the total event px & py + // after all the inputs have been processed we compute the total pt of the event, and set that as MET + l1t::EtSum computeMET(const double etaCut, l1t::EtSum::EtSumType sumType) const; + + // Determine if this tower should be trimmed or not + // Used only when trimmedGrid_ option is set to true + // Trim means removing 3 towers in each corner of the square grid + // giving a cross shaped grid, which is a bit more circular in shape than a square + bool trimTower(const int etaIndex, const int phiIndex) const; edm::EDGetTokenT> inputCollectionTag_; // histogram containing our clustered inputs @@ -92,10 +141,25 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { double phiUp_; unsigned int jetIEtaSize_; unsigned int jetIPhiSize_; + bool trimmedGrid_; double seedPtThreshold_; + double ptlsb_; + double philsb_; + double etalsb_; bool puSubtraction_; bool vetoZeroPt_; - + // Eta and phi edges of input PF regions + std::vector etaRegionEdges_; + std::vector phiRegionEdges_; + // Maximum number of candidates per input PF region + unsigned int maxInputsPerRegion_; + // LUT for sin and cos phi, to match that used in firmware + std::vector sinPhi_; + std::vector cosPhi_; + // input eta cut for met calculation + double metAbsEtaCut_; + // input eta cut for metHF calculation + double metHFAbsEtaCut_; std::string outputCollectionName_; }; @@ -110,15 +174,27 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) phiUp_(iConfig.getParameter("phiUp")), jetIEtaSize_(iConfig.getParameter("jetIEtaSize")), jetIPhiSize_(iConfig.getParameter("jetIPhiSize")), + trimmedGrid_(iConfig.getParameter("trimmedGrid")), seedPtThreshold_(iConfig.getParameter("seedPtThreshold")), + ptlsb_(iConfig.getParameter("ptlsb")), + philsb_(iConfig.getParameter("philsb")), + etalsb_(iConfig.getParameter("etalsb")), puSubtraction_(iConfig.getParameter("puSubtraction")), vetoZeroPt_(iConfig.getParameter("vetoZeroPt")), + etaRegionEdges_(iConfig.getParameter>("etaRegions")), + phiRegionEdges_(iConfig.getParameter>("phiRegions")), + maxInputsPerRegion_(iConfig.getParameter("maxInputsPerRegion")), + sinPhi_(iConfig.getParameter>("sinPhi")), + cosPhi_(iConfig.getParameter>("cosPhi")), + metAbsEtaCut_(iConfig.getParameter("metAbsEtaCut")), + metHFAbsEtaCut_(iConfig.getParameter("metHFAbsEtaCut")), outputCollectionName_(iConfig.getParameter("outputCollectionName")) { caloGrid_ = std::make_unique("caloGrid", "Calorimeter grid", nBinsEta_, etaBinning_.data(), nBinsPhi_, phiLow_, phiUp_); caloGrid_->GetXaxis()->SetTitle("#eta"); caloGrid_->GetYaxis()->SetTitle("#phi"); produces>(outputCollectionName_).setBranchAlias(outputCollectionName_); + produces>(outputCollectionName_ + "MET").setBranchAlias(outputCollectionName_ + "MET"); } Phase1L1TJetProducer::~Phase1L1TJetProducer() {} @@ -146,13 +222,21 @@ float Phase1L1TJetProducer::getTowerEnergy(int iEta, int iPhi) const { void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle> inputCollectionHandle; iEvent.getByToken(inputCollectionTag_, inputCollectionHandle); - // dumping the data + + // sort inputs into PF regions + std::vector> inputsInRegions = prepareInputsIntoRegions<>(inputCollectionHandle); + + // histogramming the data caloGrid_->Reset(); - fillCaloGrid<>(*(caloGrid_), *inputCollectionHandle); + for (unsigned int iInputRegion = 0; iInputRegion < inputsInRegions.size(); ++iInputRegion) { + fillCaloGrid<>(*(caloGrid_), inputsInRegions[iInputRegion], iInputRegion); + } - const auto& seedsVector = findSeeds(seedPtThreshold_); // seedPtThreshold = 6 - auto l1jetVector = puSubtraction_ ? _buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) - : _buildJetsFromSeeds(seedsVector); + // find the seeds + const auto& seedsVector = findSeeds(seedPtThreshold_); // seedPtThreshold = 5 + // build jets from the seeds + auto l1jetVector = + puSubtraction_ ? buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) : buildJetsFromSeeds(seedsVector); // sort by pt std::sort(l1jetVector.begin(), l1jetVector.end(), [](const reco::CaloJet& jet1, const reco::CaloJet& jet2) { @@ -162,6 +246,14 @@ void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS auto l1jetVectorPtr = std::make_unique>(l1jetVector); iEvent.put(std::move(l1jetVectorPtr), outputCollectionName_); + // calculate METs + l1t::EtSum lMET = computeMET(metAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEt); + l1t::EtSum lMETHF = computeMET(metHFAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEtHF); + std::unique_ptr> lSumVectorPtr(new std::vector(0)); + lSumVectorPtr->push_back(lMET); + lSumVectorPtr->push_back(lMETHF); + iEvent.put(std::move(lSumVectorPtr), this->outputCollectionName_ + "MET"); + return; } @@ -236,6 +328,11 @@ std::vector> Phase1L1TJetProducer::findSeeds(float seedThre // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { + if (trimmedGrid_) { + if (trimTower(etaIndex, phiIndex)) + continue; + } + if ((etaIndex == 0) && (phiIndex == 0)) continue; if (phiIndex > 0) { @@ -273,6 +370,10 @@ reco::CaloJet Phase1L1TJetProducer::buildJetFromSeed(const std::tuple& // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { + if (trimmedGrid_) { + if (trimTower(etaIndex, phiIndex)) + continue; + } ptSum += getTowerEnergy(iEta + etaIndex, iPhi + phiIndex); } } @@ -287,7 +388,7 @@ reco::CaloJet Phase1L1TJetProducer::buildJetFromSeed(const std::tuple& return jet; } -std::vector Phase1L1TJetProducer::_buildJetsFromSeedsWithPUSubtraction( +std::vector Phase1L1TJetProducer::buildJetsFromSeedsWithPUSubtraction( const std::vector>& seeds, bool killZeroPt) const { // For each seed take a grid centered on the seed of the size specified by the user // Sum the pf in the grid, that will be the pt of the l1t jet. Eta and phi of the jet is taken from the seed. @@ -303,7 +404,7 @@ std::vector Phase1L1TJetProducer::_buildJetsFromSeedsWithPUSubtra return jets; } -std::vector Phase1L1TJetProducer::_buildJetsFromSeeds( +std::vector Phase1L1TJetProducer::buildJetsFromSeeds( const std::vector>& seeds) const { // For each seed take a grid centered on the seed of the size specified by the user // Sum the pf in the grid, that will be the pt of the l1t jet. Eta and phi of the jet is taken from the seed. @@ -316,15 +417,75 @@ std::vector Phase1L1TJetProducer::_buildJetsFromSeeds( } template -void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives) { +void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, + const Container& triggerPrimitives, + const unsigned int regionIndex) { //Filling the calo grid with the primitives for (const auto& primitiveIterator : triggerPrimitives) { - caloGrid.Fill(static_cast(primitiveIterator.eta()), - static_cast(primitiveIterator.phi()), - static_cast(primitiveIterator.pt())); + // Get digitised (floating point with reduced precision) eta and phi + std::pair digi_EtaPhi = + getCandidateDigiEtaPhi(primitiveIterator->eta(), primitiveIterator->phi(), regionIndex); + + caloGrid.Fill(static_cast(digi_EtaPhi.first), + static_cast(digi_EtaPhi.second), + static_cast(primitiveIterator->pt())); } } +std::pair Phase1L1TJetProducer::getCandidateDigiEtaPhi(const float eta, + const float phi, + const unsigned int regionIndex) const { + std::pair regionLowEdges = regionEtaPhiLowEdges(regionIndex); + + int digitisedEta = floor((eta - regionLowEdges.second) / etalsb_); + int digitisedPhi = floor((phi - regionLowEdges.first) / philsb_); + + // If eta or phi is on a bin edge + // Put in bin above, to match behaviour of HLS + // Unless it's on the last bin of this pf region + // Then it is placed in the last bin, not the overflow + TAxis* etaAxis = caloGrid_->GetXaxis(); + std::pair regionUpEdges = regionEtaPhiUpEdges(regionIndex); + int digiEtaEdgeLastBinUp = floor((regionUpEdges.second - regionLowEdges.second) / etalsb_); + // If the digi eta is outside the last bin of this pf region + // Set the digitised quantity so it would be in the last bin + // These cases could be avoided by sorting input candidates based on digitised eta/phi + if (digitisedEta >= digiEtaEdgeLastBinUp) { + digitisedEta = digiEtaEdgeLastBinUp - 1; + } else { + for (int i = 0; i < etaAxis->GetNbins(); ++i) { + if (etaAxis->GetBinUpEdge(i) < regionLowEdges.second) + continue; + int digiEdgeBinUp = floor((etaAxis->GetBinUpEdge(i) - regionLowEdges.second) / etalsb_); + if (digiEdgeBinUp == digitisedEta) { + digitisedEta += 1; + } + } + } + + // Similar for phi + TAxis* phiAxis = caloGrid_->GetYaxis(); + int digiPhiEdgeLastBinUp = floor((regionUpEdges.first - regionLowEdges.first) / philsb_); + if (digitisedPhi >= digiPhiEdgeLastBinUp) { + digitisedPhi = digiPhiEdgeLastBinUp - 1; + } else { + for (int i = 0; i < phiAxis->GetNbins(); ++i) { + if (phiAxis->GetBinUpEdge(i) < regionLowEdges.first) + continue; + int digiEdgeBinUp = floor((phiAxis->GetBinUpEdge(i) - regionLowEdges.first) / philsb_); + if (digiEdgeBinUp == digitisedPhi) { + digitisedPhi += 1; + } + } + } + + // Convert digitised eta and phi back to floating point quantities with reduced precision + float floatDigitisedEta = (digitisedEta + 0.5) * etalsb_ + regionLowEdges.second; + float floatDigitisedPhi = (digitisedPhi + 0.5) * philsb_ + regionLowEdges.first; + + return std::pair{floatDigitisedEta, floatDigitisedPhi}; +} + void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("inputCollectionTag", edm::InputTag("l1pfCandidates", "Puppi")); @@ -334,11 +495,117 @@ void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("phiUp", M_PI); desc.add("jetIEtaSize", 7); desc.add("jetIPhiSize", 7); + desc.add("trimmedGrid", false); desc.add("seedPtThreshold", 5); - desc.add("puSubtraction", false); + desc.add("ptlsb", 0.25), desc.add("philsb", 0.0043633231), desc.add("etalsb", 0.0043633231), + desc.add("puSubtraction", false); desc.add("outputCollectionName", "UncalibratedPhase1L1TJetFromPfCandidates"); desc.add("vetoZeroPt", true); + desc.add>("etaRegions"); + desc.add>("phiRegions"); + desc.add("maxInputsPerRegion", 18); + desc.add>("sinPhi"); + desc.add>("cosPhi"); + desc.add("metAbsEtaCut", 3); + desc.add("metHFAbsEtaCut", 5); descriptions.add("Phase1L1TJetProducer", desc); } +template +std::vector>> Phase1L1TJetProducer::prepareInputsIntoRegions( + const Handle triggerPrimitives) { + std::vector> inputsInRegions{etaRegionEdges_.size() * (phiRegionEdges_.size() - 1)}; + + for (unsigned int i = 0; i < triggerPrimitives->size(); ++i) { + reco::CandidatePtr tp(triggerPrimitives, i); + + if (tp->phi() < phiRegionEdges_.front() || tp->phi() >= phiRegionEdges_.back() || + tp->eta() < etaRegionEdges_.front() || tp->eta() >= etaRegionEdges_.back()) + continue; + + // Which phi region does this tp belong to + auto it_phi = phiRegionEdges_.begin(); + it_phi = std::upper_bound(phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; + + // Which eta region does this tp belong to + auto it_eta = etaRegionEdges_.begin(); + it_eta = std::upper_bound(etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; + + if (it_phi != phiRegionEdges_.end() && it_eta != etaRegionEdges_.end()) { + auto phiRegion = it_phi - phiRegionEdges_.begin(); + auto etaRegion = it_eta - etaRegionEdges_.begin(); + inputsInRegions[getRegionIndex(phiRegion, etaRegion)].emplace_back(tp); + } + } + + // Truncate number of inputs in each pf region + for (auto& inputs : inputsInRegions) { + if (inputs.size() > maxInputsPerRegion_) { + inputs.resize(maxInputsPerRegion_); + } + } + + return inputsInRegions; +} + +unsigned int Phase1L1TJetProducer::getRegionIndex(const unsigned int phiRegion, const unsigned int etaRegion) const { + return etaRegion * (phiRegionEdges_.size() - 1) + phiRegion; +} + +std::pair Phase1L1TJetProducer::regionEtaPhiLowEdges(const unsigned int regionIndex) const { + unsigned int phiRegion = regionIndex % (phiRegionEdges_.size() - 1); + unsigned int etaRegion = (regionIndex - phiRegion) / (phiRegionEdges_.size() - 1); + return std::pair{phiRegionEdges_.at(phiRegion), etaRegionEdges_.at(etaRegion)}; +} + +std::pair Phase1L1TJetProducer::regionEtaPhiUpEdges(const unsigned int regionIndex) const { + unsigned int phiRegion = regionIndex % (phiRegionEdges_.size() - 1); + unsigned int etaRegion = (regionIndex - phiRegion) / (phiRegionEdges_.size() - 1); + if (phiRegion == phiRegionEdges_.size() - 1) { + return std::pair{phiRegionEdges_.at(phiRegion), etaRegionEdges_.at(etaRegion + 1)}; + } else if (etaRegion == etaRegionEdges_.size() - 1) { + return std::pair{phiRegionEdges_.at(phiRegion + 1), etaRegionEdges_.at(etaRegion)}; + } + + return std::pair{phiRegionEdges_.at(phiRegion + 1), etaRegionEdges_.at(etaRegion + 1)}; +} + +l1t::EtSum Phase1L1TJetProducer::computeMET(const double etaCut, l1t::EtSum::EtSumType sumType) const { + const auto lowEtaBin = caloGrid_->GetXaxis()->FindBin(-1.0 * etaCut); + const auto highEtaBin = caloGrid_->GetXaxis()->FindBin(etaCut) - 1; + const auto phiProjection = caloGrid_->ProjectionY("temp", lowEtaBin, highEtaBin); + + // Use digitised quantities when summing to improve agreement with firmware + int totalDigiPx{0}; + int totalDigiPy{0}; + + for (int i = 1; i < phiProjection->GetNbinsX() + 1; ++i) { + double pt = phiProjection->GetBinContent(i); + totalDigiPx += trunc(floor(pt / ptlsb_) * cosPhi_[i - 1]); + totalDigiPy += trunc(floor(pt / ptlsb_) * sinPhi_[i - 1]); + } + + double lMET = floor(sqrt(totalDigiPx * totalDigiPx + totalDigiPy * totalDigiPy)) * ptlsb_; + + math::PtEtaPhiMLorentzVector lMETVector(lMET, 0, acos(totalDigiPx / (lMET / ptlsb_)), 0); + l1t::EtSum lMETSum(lMETVector, sumType, 0, 0, 0, 0); + return lMETSum; +} + +bool Phase1L1TJetProducer::trimTower(const int etaIndex, const int phiIndex) const { + int etaHalfSize = jetIEtaSize_ / 2; + int phiHalfSize = jetIPhiSize_ / 2; + + if (etaIndex == -etaHalfSize || etaIndex == etaHalfSize) { + if (phiIndex <= -phiHalfSize + 1 || phiIndex >= phiHalfSize - 1) { + return true; + } + } else if (etaIndex == -etaHalfSize + 1 || etaIndex == etaHalfSize - 1) { + if (phiIndex == -phiHalfSize || phiIndex == phiHalfSize) { + return true; + } + } + + return false; +} DEFINE_FWK_MODULE(Phase1L1TJetProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc new file mode 100644 index 0000000000000..5806141fd2e06 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc @@ -0,0 +1,203 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: Phase1L1TJetSumsProducer +// +/**\class Phase1L1TJetSumsProducer Phase1L1TJetSumsProducer.cc L1Trigger/L1CaloTrigger/plugin/Phase1L1TJetSumsProducer.cc + +Description: Computes HT and MHT from phase-1-like jets + +*** INPUT PARAMETERS *** + * sin/cosPhi: Value of sin/cos phi in the middle of each bin of the grid. + * etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta) + * nBinsPhi: uint32, number of bins in phi + * phiLow: double, min phi (typically -pi) + * phiUp: double, max phi (typically +pi) + * {m}htPtThreshold: Minimum jet pt for HT/MHT calculation + * {m}htAbsEtaCut: + * pt/eta/philsb : lsb of quantities used in firmware implementation + * outputCollectionName: string, tag for the output collection + * inputCollectionTag: tag for input jet collection + +*/ +// +// Original Simone Bologna +// + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/Candidate.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include + +class Phase1L1TJetSumsProducer : public edm::one::EDProducer { +public: + explicit Phase1L1TJetSumsProducer(const edm::ParameterSet&); + ~Phase1L1TJetSumsProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + // computes ht, adds jet pt to ht only if the pt of the jet is above the ht calculation threshold + l1t::EtSum computeHT(const edm::Handle > inputJets) const; + + // computes MHT + // adds jet pt to mht only if the pt of the jet is above the mht calculation threshold + // performs some calculations with digitised/integer quantities to ensure agreement with firmware + l1t::EtSum computeMHT(const edm::Handle > inputJets) const; + + edm::EDGetTokenT > inputJetCollectionTag_; + + // holds the sin and cos for HLs LUT emulation + std::vector sinPhi_; + std::vector cosPhi_; + unsigned int nBinsPhi_; + + // lower phi value + double phiLow_; + // higher phi value + double phiUp_; + // size of a phi bin + double phiStep_; + // threshold for ht calculation + double htPtThreshold_; + // threshold for ht calculation + double mhtPtThreshold_; + // jet eta cut for ht calculation + double htAbsEtaCut_; + // jet eta cut for mht calculation + double mhtAbsEtaCut_; + // LSB of pt quantity + double ptlsb_; + // label of sums + std::string outputCollectionName_; +}; + +// initialises plugin configuration and prepares ROOT file for saving the sums +Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer(const edm::ParameterSet& iConfig) + : inputJetCollectionTag_{consumes >( + iConfig.getParameter("inputJetCollectionTag"))}, + sinPhi_(iConfig.getParameter >("sinPhi")), + cosPhi_(iConfig.getParameter >("cosPhi")), + nBinsPhi_(iConfig.getParameter("nBinsPhi")), + phiLow_(iConfig.getParameter("phiLow")), + phiUp_(iConfig.getParameter("phiUp")), + htPtThreshold_(iConfig.getParameter("htPtThreshold")), + mhtPtThreshold_(iConfig.getParameter("mhtPtThreshold")), + htAbsEtaCut_(iConfig.getParameter("htAbsEtaCut")), + mhtAbsEtaCut_(iConfig.getParameter("mhtAbsEtaCut")), + ptlsb_(iConfig.getParameter("ptlsb")), + outputCollectionName_(iConfig.getParameter("outputCollectionName")) { + phiStep_ = (phiUp_ - phiLow_) / nBinsPhi_; + produces >(outputCollectionName_).setBranchAlias(outputCollectionName_); +} + +Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer() {} + +void Phase1L1TJetSumsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle > jetCollectionHandle; + iEvent.getByToken(inputJetCollectionTag_, jetCollectionHandle); + + // computing sums and storing them in sum object + l1t::EtSum lHT = computeHT(jetCollectionHandle); + l1t::EtSum lMHT = computeMHT(jetCollectionHandle); + + //packing sums in vector for event saving + std::unique_ptr > lSumVectorPtr(new std::vector(0)); + lSumVectorPtr->push_back(lHT); + lSumVectorPtr->push_back(lMHT); + iEvent.put(std::move(lSumVectorPtr), outputCollectionName_); + + return; +} + +l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle > inputJets) const { + double lHT = 0; + for (const auto& jet : *inputJets) { + double lJetPt = jet.pt(); + double lJetPhi = jet.phi(); + double lJetEta = jet.eta(); + if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) + continue; + + lHT += (lJetPt >= htPtThreshold_ && std::fabs(lJetEta) < htAbsEtaCut_) ? lJetPt : 0; + } + + reco::Candidate::PolarLorentzVector lHTVector; + lHTVector.SetPt(lHT); + lHTVector.SetEta(0); + lHTVector.SetPhi(0); + l1t::EtSum lHTSum(lHTVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + return lHTSum; +} + +l1t::EtSum Phase1L1TJetSumsProducer::computeMHT(const edm::Handle > inputJets) const { + int lTotalJetPx = 0; + int lTotalJetPy = 0; + + std::vector jetPtInPhiBins(nBinsPhi_, 0); + + for (const auto& jet : *inputJets) { + double lJetPhi = jet.phi(); + + if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) + continue; + + unsigned int iPhi = (lJetPhi - phiLow_) / phiStep_; + + if (jet.pt() >= mhtPtThreshold_ && std::fabs(jet.eta()) < mhtAbsEtaCut_) { + unsigned int digiJetPt = floor(jet.pt() / ptlsb_); + jetPtInPhiBins[iPhi] += digiJetPt; + } + } + + for (unsigned int iPhi = 0; iPhi < jetPtInPhiBins.size(); ++iPhi) { + unsigned int digiJetPtSum = jetPtInPhiBins[iPhi]; + + // retrieving sin cos from LUT emulator + double lSinPhi = sinPhi_[iPhi]; + double lCosPhi = cosPhi_[iPhi]; + + // checking if above threshold + lTotalJetPx += trunc(digiJetPtSum * lCosPhi); + lTotalJetPy += trunc(digiJetPtSum * lSinPhi); + } + + double lMHT = floor(sqrt(lTotalJetPx * lTotalJetPx + lTotalJetPy * lTotalJetPy)) * ptlsb_; + math::PtEtaPhiMLorentzVector lMHTVector(lMHT, 0, acos(lTotalJetPx / (lMHT / ptlsb_)), 0); + l1t::EtSum lMHTSum(lMHTVector, l1t::EtSum::EtSumType::kMissingHt, 0, 0, 0, 0); + + return lMHTSum; +} + +void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("inputJetCollectionTag", + edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates")); + desc.add >("sinPhi"); + desc.add >("cosPhi"); + desc.add("nBinsPhi", 72); + desc.add("phiLow", -M_PI); + desc.add("phiUp", M_PI); + desc.add("htPtThreshold", 30); + desc.add("mhtPtThreshold", 30); + desc.add("htAbsEtaCut", 3); + desc.add("mhtAbsEtaCut", 3); + desc.add("ptlsb", 0.25), desc.add("outputCollectionName", "Sums"); + descriptions.add("Phase1L1TJetSumsProducer", desc); +} + +// creates the plugin for later use in python +DEFINE_FWK_MODULE(Phase1L1TJetSumsProducer); diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py new file mode 100644 index 0000000000000..11650c362daf3 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +L1CaloJetHTTProducer = cms.EDProducer("L1CaloJetHTTProducer", + EtaMax = cms.double(2.4), + PtMin = cms.double(30.0), + BXVCaloJetsInputTag = cms.InputTag("L1CaloJetProducer","L1CaloJetCollectionBXV"), + genJets = cms.InputTag("ak4GenJetsNoNu", "", "HLT"), + debug = cms.bool(False), + use_gen_jets = cms.bool(False), +) diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py new file mode 100644 index 0000000000000..3e839133f18ca --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py @@ -0,0 +1,164 @@ +import FWCore.ParameterSet.Config as cms + +L1CaloJetProducer = cms.EDProducer("L1CaloJetProducer", + debug = cms.bool(False), + HcalTpEtMin = cms.double(0.5), + EcalTpEtMin = cms.double(0.5), + HGCalHadTpEtMin = cms.double(0.5), + HGCalEmTpEtMin = cms.double(0.5), + HFTpEtMin = cms.double(0.5), + EtMinForSeedHit = cms.double(2.5), # was 2.5 + EtMinForCollection = cms.double(10), + EtMinForTauCollection = cms.double(10), + l1CaloTowers = cms.InputTag("L1TowerCalibrationProducer","L1CaloTowerCalibratedCollection"), + L1CrystalClustersInputTag = cms.InputTag("L1EGammaClusterEmuProducer", "L1EGXtalClusterEmulator"), + #L1HgcalTowersInputTag = cms.InputTag("hgcalTriggerPrimitiveDigiProducer","tower"), + #hcalDigis = cms.InputTag("simHcalTriggerPrimitiveDigis"), + + # Calibrations derived 18 April 2019 on 10_3_X MTD QCD sample + jetPtBins = cms.vdouble([ 0.0,5.0,7.5,10.0,12.5,15.0,17.5,20.0,22.5,25.0,27.5,30.0,35.0,40.0,45.0,50.0,55.0,60.0,65.0,70.0,75.0,80.0,85.0,90.0,95.0,100.0,110.0,120.0,130.0,140.0,150.0,160.0,170.0,180.0,190.0,200.0,225.0,250.0,275.0,300.0,325.0,400.0,500.0]), + emFractionBinsBarrel = cms.vdouble([ 0.00,0.31,0.40,0.47,0.53,0.58,0.63,0.69,0.76,0.84,1.05]), + absEtaBinsBarrel = cms.vdouble([ 0.00,0.30,0.60,1.00,1.50]), + jetCalibrationsBarrel = cms.vdouble([ + 1.640, 1.626, 1.617, 1.608, 1.599, 1.591, 1.583, 1.574, 1.566, 1.559, 1.551, 1.540, 1.525, 1.512, 1.498, 1.486, 1.474, 1.462, 1.451, 1.441, 1.431, 1.421, 1.412, 1.404, 1.396, 1.385, 1.372, 1.360, 1.350, 1.341, 1.334, 1.329, 1.325, 1.322, 1.320, 1.320, 1.325, 1.336, 1.352, 1.373, 1.428, 1.553, + 1.855, 1.839, 1.829, 1.819, 1.809, 1.800, 1.790, 1.781, 1.771, 1.762, 1.753, 1.740, 1.723, 1.706, 1.690, 1.674, 1.659, 1.645, 1.631, 1.617, 1.604, 1.591, 1.579, 1.568, 1.556, 1.540, 1.520, 1.501, 1.484, 1.469, 1.454, 1.441, 1.430, 1.419, 1.410, 1.396, 1.382, 1.374, 1.370, 1.372, 1.386, 1.443, + 1.993, 1.978, 1.967, 1.957, 1.947, 1.937, 1.927, 1.918, 1.908, 1.898, 1.889, 1.875, 1.857, 1.839, 1.822, 1.805, 1.789, 1.773, 1.757, 1.742, 1.727, 1.713, 1.699, 1.685, 1.672, 1.653, 1.629, 1.606, 1.584, 1.564, 1.545, 1.527, 1.511, 1.495, 1.481, 1.459, 1.434, 1.414, 1.400, 1.392, 1.391, 1.431, + 2.155, 2.135, 2.123, 2.110, 2.097, 2.085, 2.073, 2.061, 2.049, 2.037, 2.026, 2.009, 1.987, 1.965, 1.944, 1.924, 1.905, 1.885, 1.867, 1.849, 1.832, 1.815, 1.798, 1.783, 1.767, 1.745, 1.717, 1.691, 1.666, 1.643, 1.622, 1.602, 1.583, 1.566, 1.550, 1.525, 1.495, 1.470, 1.451, 1.437, 1.422, 1.424, + 2.305, 2.284, 2.271, 2.257, 2.244, 2.231, 2.218, 2.205, 2.193, 2.180, 2.168, 2.150, 2.126, 2.103, 2.081, 2.059, 2.037, 2.017, 1.996, 1.976, 1.957, 1.938, 1.920, 1.902, 1.884, 1.859, 1.827, 1.797, 1.768, 1.741, 1.715, 1.691, 1.668, 1.647, 1.627, 1.595, 1.556, 1.523, 1.497, 1.477, 1.451, 1.446, + 2.555, 2.528, 2.510, 2.492, 2.474, 2.457, 2.440, 2.423, 2.406, 2.390, 2.373, 2.349, 2.318, 2.288, 2.258, 2.229, 2.201, 2.174, 2.148, 2.122, 2.097, 2.072, 2.049, 2.026, 2.004, 1.971, 1.930, 1.892, 1.856, 1.822, 1.790, 1.761, 1.733, 1.707, 1.683, 1.645, 1.600, 1.563, 1.535, 1.515, 1.493, 1.505, + 2.850, 2.815, 2.792, 2.770, 2.747, 2.725, 2.703, 2.682, 2.661, 2.640, 2.619, 2.589, 2.549, 2.511, 2.473, 2.437, 2.401, 2.367, 2.334, 2.301, 2.270, 2.239, 2.209, 2.181, 2.153, 2.112, 2.062, 2.014, 1.969, 1.927, 1.888, 1.852, 1.818, 1.787, 1.758, 1.712, 1.658, 1.616, 1.585, 1.563, 1.544, 1.576, + 3.386, 3.325, 3.286, 3.248, 3.210, 3.174, 3.138, 3.103, 3.069, 3.036, 3.004, 2.956, 2.896, 2.838, 2.783, 2.730, 2.680, 2.632, 2.586, 2.543, 2.501, 2.461, 2.423, 2.387, 2.352, 2.303, 2.242, 2.187, 2.136, 2.090, 2.047, 2.008, 1.973, 1.940, 1.910, 1.863, 1.806, 1.760, 1.721, 1.688, 1.636, 1.572, + 4.450, 4.344, 4.276, 4.210, 4.146, 4.083, 4.022, 3.962, 3.904, 3.847, 3.792, 3.712, 3.610, 3.513, 3.420, 3.333, 3.250, 3.171, 3.096, 3.025, 2.958, 2.894, 2.833, 2.776, 2.721, 2.645, 2.552, 2.468, 2.393, 2.325, 2.265, 2.210, 2.162, 2.118, 2.079, 2.021, 1.956, 1.908, 1.873, 1.849, 1.822, 1.818, + 6.912, 6.764, 6.667, 6.571, 6.477, 6.384, 6.293, 6.203, 6.114, 6.027, 5.941, 5.814, 5.650, 5.491, 5.336, 5.187, 5.042, 4.903, 4.767, 4.637, 4.511, 4.389, 4.272, 4.159, 4.050, 3.894, 3.700, 3.522, 3.359, 3.210, 3.076, 2.954, 2.846, 2.750, 2.667, 2.549, 2.438, 2.390, 2.400, 2.463, 2.731, 3.577, + 1.536, 1.527, 1.521, 1.515, 1.509, 1.503, 1.497, 1.491, 1.486, 1.480, 1.475, 1.467, 1.457, 1.447, 1.437, 1.428, 1.419, 1.411, 1.403, 1.395, 1.388, 1.380, 1.374, 1.367, 1.361, 1.353, 1.342, 1.333, 1.325, 1.319, 1.313, 1.309, 1.305, 1.303, 1.302, 1.302, 1.307, 1.317, 1.333, 1.354, 1.409, 1.544, + 1.740, 1.730, 1.723, 1.716, 1.709, 1.702, 1.696, 1.689, 1.683, 1.676, 1.670, 1.661, 1.648, 1.636, 1.624, 1.613, 1.602, 1.590, 1.580, 1.569, 1.559, 1.549, 1.539, 1.530, 1.521, 1.507, 1.490, 1.474, 1.459, 1.445, 1.432, 1.420, 1.409, 1.399, 1.389, 1.375, 1.360, 1.350, 1.345, 1.346, 1.363, 1.439, + 1.869, 1.858, 1.851, 1.843, 1.836, 1.829, 1.822, 1.815, 1.808, 1.801, 1.795, 1.785, 1.771, 1.758, 1.746, 1.733, 1.721, 1.709, 1.697, 1.686, 1.674, 1.663, 1.652, 1.642, 1.631, 1.616, 1.597, 1.578, 1.560, 1.543, 1.527, 1.512, 1.498, 1.485, 1.472, 1.452, 1.427, 1.408, 1.393, 1.383, 1.377, 1.407, + 2.010, 1.997, 1.988, 1.980, 1.971, 1.963, 1.954, 1.946, 1.938, 1.930, 1.922, 1.910, 1.894, 1.879, 1.864, 1.849, 1.834, 1.820, 1.806, 1.792, 1.779, 1.766, 1.753, 1.740, 1.728, 1.709, 1.686, 1.664, 1.642, 1.622, 1.603, 1.584, 1.567, 1.550, 1.534, 1.509, 1.478, 1.451, 1.430, 1.414, 1.396, 1.407, + 2.171, 2.155, 2.144, 2.134, 2.123, 2.113, 2.103, 2.093, 2.083, 2.073, 2.063, 2.049, 2.030, 2.012, 1.994, 1.976, 1.959, 1.942, 1.925, 1.909, 1.893, 1.877, 1.862, 1.847, 1.833, 1.812, 1.785, 1.759, 1.734, 1.710, 1.688, 1.667, 1.646, 1.627, 1.609, 1.579, 1.542, 1.509, 1.482, 1.459, 1.426, 1.401, + 2.366, 2.345, 2.332, 2.319, 2.306, 2.293, 2.280, 2.268, 2.255, 2.243, 2.231, 2.213, 2.189, 2.166, 2.144, 2.122, 2.100, 2.079, 2.058, 2.038, 2.018, 1.999, 1.980, 1.962, 1.944, 1.918, 1.884, 1.853, 1.822, 1.794, 1.766, 1.741, 1.716, 1.693, 1.671, 1.636, 1.591, 1.554, 1.522, 1.497, 1.461, 1.441, + 2.680, 2.647, 2.626, 2.605, 2.584, 2.564, 2.544, 2.525, 2.506, 2.487, 2.469, 2.442, 2.407, 2.373, 2.340, 2.309, 2.278, 2.249, 2.221, 2.193, 2.167, 2.142, 2.117, 2.093, 2.070, 2.038, 1.996, 1.958, 1.922, 1.888, 1.857, 1.828, 1.801, 1.775, 1.751, 1.713, 1.666, 1.626, 1.592, 1.563, 1.516, 1.459, + 3.093, 3.051, 3.023, 2.995, 2.969, 2.942, 2.916, 2.890, 2.865, 2.840, 2.816, 2.780, 2.733, 2.688, 2.644, 2.602, 2.561, 2.522, 2.484, 2.447, 2.411, 2.376, 2.343, 2.311, 2.280, 2.235, 2.178, 2.126, 2.077, 2.031, 1.988, 1.949, 1.912, 1.878, 1.846, 1.796, 1.735, 1.685, 1.646, 1.614, 1.571, 1.543, + 4.080, 3.996, 3.941, 3.888, 3.836, 3.785, 3.735, 3.686, 3.638, 3.591, 3.546, 3.479, 3.393, 3.312, 3.233, 3.159, 3.087, 3.019, 2.953, 2.891, 2.831, 2.774, 2.720, 2.668, 2.618, 2.548, 2.462, 2.383, 2.312, 2.247, 2.188, 2.134, 2.086, 2.042, 2.003, 1.943, 1.875, 1.825, 1.788, 1.763, 1.738, 1.747, + 6.659, 6.494, 6.387, 6.282, 6.179, 6.078, 5.978, 5.881, 5.785, 5.691, 5.599, 5.463, 5.289, 5.122, 4.961, 4.806, 4.657, 4.514, 4.378, 4.246, 4.121, 4.001, 3.886, 3.776, 3.671, 3.522, 3.341, 3.177, 3.030, 2.899, 2.783, 2.682, 2.594, 2.519, 2.456, 2.373, 2.311, 2.307, 2.355, 2.447, 2.743, 3.536, + 1.519, 1.512, 1.507, 1.502, 1.498, 1.493, 1.488, 1.484, 1.479, 1.475, 1.471, 1.464, 1.456, 1.448, 1.440, 1.433, 1.425, 1.418, 1.412, 1.405, 1.399, 1.393, 1.387, 1.381, 1.376, 1.369, 1.359, 1.351, 1.344, 1.337, 1.332, 1.327, 1.323, 1.320, 1.318, 1.317, 1.319, 1.326, 1.339, 1.356, 1.404, 1.530, + 1.719, 1.710, 1.705, 1.699, 1.693, 1.688, 1.682, 1.677, 1.671, 1.666, 1.661, 1.653, 1.642, 1.632, 1.622, 1.613, 1.603, 1.594, 1.584, 1.575, 1.567, 1.558, 1.550, 1.541, 1.533, 1.522, 1.507, 1.492, 1.479, 1.466, 1.454, 1.443, 1.432, 1.422, 1.413, 1.399, 1.382, 1.369, 1.361, 1.356, 1.359, 1.401, + 1.860, 1.851, 1.844, 1.838, 1.832, 1.826, 1.820, 1.814, 1.808, 1.802, 1.796, 1.787, 1.775, 1.764, 1.753, 1.742, 1.731, 1.720, 1.710, 1.699, 1.689, 1.679, 1.669, 1.660, 1.650, 1.636, 1.618, 1.601, 1.584, 1.568, 1.553, 1.538, 1.524, 1.511, 1.498, 1.478, 1.451, 1.428, 1.410, 1.394, 1.374, 1.373, + 1.993, 1.982, 1.974, 1.967, 1.960, 1.953, 1.946, 1.938, 1.931, 1.924, 1.917, 1.907, 1.894, 1.880, 1.867, 1.854, 1.841, 1.828, 1.816, 1.804, 1.792, 1.780, 1.768, 1.757, 1.746, 1.729, 1.708, 1.687, 1.667, 1.648, 1.629, 1.612, 1.595, 1.578, 1.563, 1.537, 1.504, 1.475, 1.451, 1.430, 1.402, 1.388, + 2.146, 2.131, 2.122, 2.113, 2.104, 2.095, 2.086, 2.077, 2.068, 2.059, 2.051, 2.038, 2.021, 2.004, 1.988, 1.972, 1.957, 1.941, 1.926, 1.911, 1.897, 1.883, 1.869, 1.855, 1.842, 1.822, 1.797, 1.773, 1.749, 1.727, 1.706, 1.685, 1.665, 1.647, 1.629, 1.599, 1.561, 1.527, 1.497, 1.472, 1.431, 1.389, + 2.336, 2.319, 2.307, 2.296, 2.285, 2.273, 2.262, 2.251, 2.240, 2.230, 2.219, 2.203, 2.182, 2.162, 2.142, 2.122, 2.103, 2.084, 2.065, 2.047, 2.029, 2.012, 1.994, 1.978, 1.961, 1.937, 1.906, 1.876, 1.848, 1.820, 1.794, 1.769, 1.745, 1.722, 1.700, 1.665, 1.618, 1.578, 1.543, 1.512, 1.465, 1.420, + 2.594, 2.571, 2.556, 2.541, 2.526, 2.511, 2.497, 2.482, 2.468, 2.453, 2.439, 2.419, 2.391, 2.364, 2.338, 2.312, 2.287, 2.262, 2.238, 2.214, 2.191, 2.168, 2.146, 2.124, 2.103, 2.072, 2.032, 1.993, 1.957, 1.922, 1.889, 1.857, 1.827, 1.799, 1.772, 1.728, 1.672, 1.625, 1.585, 1.552, 1.507, 1.482, + 3.016, 2.982, 2.959, 2.937, 2.915, 2.893, 2.872, 2.851, 2.830, 2.809, 2.788, 2.758, 2.718, 2.679, 2.641, 2.604, 2.568, 2.533, 2.499, 2.465, 2.432, 2.400, 2.369, 2.339, 2.309, 2.266, 2.211, 2.160, 2.111, 2.064, 2.020, 1.979, 1.940, 1.904, 1.870, 1.815, 1.749, 1.694, 1.651, 1.618, 1.580, 1.590, + 4.054, 3.966, 3.909, 3.854, 3.800, 3.747, 3.696, 3.646, 3.597, 3.549, 3.503, 3.435, 3.348, 3.266, 3.187, 3.112, 3.041, 2.974, 2.909, 2.848, 2.790, 2.734, 2.681, 2.631, 2.583, 2.516, 2.434, 2.360, 2.292, 2.232, 2.178, 2.128, 2.084, 2.045, 2.009, 1.955, 1.895, 1.850, 1.817, 1.794, 1.769, 1.766, + 6.752, 6.570, 6.452, 6.337, 6.224, 6.113, 6.004, 5.898, 5.795, 5.693, 5.594, 5.449, 5.263, 5.085, 4.915, 4.752, 4.597, 4.449, 4.308, 4.173, 4.045, 3.923, 3.808, 3.697, 3.593, 3.446, 3.269, 3.110, 2.969, 2.846, 2.738, 2.644, 2.564, 2.497, 2.442, 2.372, 2.323, 2.327, 2.374, 2.459, 2.718, 3.371, + 1.615, 1.605, 1.599, 1.593, 1.587, 1.581, 1.575, 1.570, 1.564, 1.558, 1.553, 1.545, 1.534, 1.524, 1.514, 1.504, 1.494, 1.485, 1.476, 1.468, 1.460, 1.452, 1.444, 1.437, 1.429, 1.419, 1.407, 1.395, 1.385, 1.375, 1.367, 1.360, 1.353, 1.348, 1.344, 1.339, 1.336, 1.340, 1.349, 1.364, 1.410, 1.537, + 1.867, 1.856, 1.849, 1.841, 1.834, 1.827, 1.820, 1.813, 1.806, 1.799, 1.792, 1.782, 1.768, 1.755, 1.742, 1.730, 1.718, 1.705, 1.694, 1.682, 1.671, 1.660, 1.649, 1.638, 1.628, 1.613, 1.594, 1.575, 1.558, 1.542, 1.526, 1.512, 1.498, 1.485, 1.474, 1.455, 1.433, 1.417, 1.406, 1.401, 1.404, 1.458, + 2.037, 2.025, 2.017, 2.009, 2.001, 1.993, 1.985, 1.977, 1.970, 1.962, 1.954, 1.943, 1.928, 1.914, 1.899, 1.885, 1.871, 1.858, 1.844, 1.831, 1.818, 1.805, 1.793, 1.781, 1.769, 1.751, 1.728, 1.707, 1.686, 1.666, 1.647, 1.629, 1.612, 1.596, 1.580, 1.555, 1.524, 1.498, 1.477, 1.462, 1.445, 1.461, + 2.206, 2.192, 2.183, 2.174, 2.165, 2.156, 2.148, 2.139, 2.130, 2.122, 2.113, 2.101, 2.084, 2.068, 2.052, 2.037, 2.021, 2.006, 1.992, 1.977, 1.963, 1.949, 1.935, 1.922, 1.908, 1.889, 1.864, 1.840, 1.817, 1.795, 1.773, 1.753, 1.733, 1.714, 1.696, 1.666, 1.628, 1.593, 1.562, 1.536, 1.492, 1.444, + 2.401, 2.385, 2.375, 2.365, 2.355, 2.346, 2.336, 2.326, 2.317, 2.307, 2.298, 2.284, 2.265, 2.247, 2.229, 2.212, 2.195, 2.178, 2.161, 2.144, 2.128, 2.112, 2.097, 2.081, 2.066, 2.044, 2.015, 1.988, 1.961, 1.935, 1.910, 1.886, 1.862, 1.840, 1.818, 1.782, 1.735, 1.692, 1.653, 1.618, 1.559, 1.487, + 2.637, 2.620, 2.609, 2.599, 2.588, 2.577, 2.567, 2.556, 2.546, 2.536, 2.525, 2.510, 2.490, 2.470, 2.451, 2.432, 2.413, 2.394, 2.376, 2.357, 2.339, 2.322, 2.304, 2.287, 2.270, 2.245, 2.213, 2.182, 2.151, 2.122, 2.093, 2.065, 2.038, 2.012, 1.986, 1.944, 1.887, 1.835, 1.787, 1.742, 1.665, 1.561, + 2.952, 2.935, 2.924, 2.913, 2.902, 2.891, 2.879, 2.868, 2.858, 2.847, 2.836, 2.820, 2.798, 2.777, 2.756, 2.736, 2.715, 2.695, 2.675, 2.655, 2.635, 2.616, 2.597, 2.578, 2.559, 2.531, 2.495, 2.459, 2.424, 2.390, 2.357, 2.325, 2.293, 2.262, 2.233, 2.182, 2.114, 2.050, 1.992, 1.938, 1.844, 1.721, + 3.403, 3.388, 3.378, 3.368, 3.359, 3.349, 3.339, 3.330, 3.320, 3.311, 3.301, 3.287, 3.268, 3.249, 3.231, 3.213, 3.194, 3.176, 3.158, 3.140, 3.123, 3.105, 3.088, 3.070, 3.053, 3.028, 2.994, 2.961, 2.928, 2.896, 2.865, 2.834, 2.803, 2.773, 2.743, 2.692, 2.621, 2.554, 2.488, 2.425, 2.307, 2.120, + 4.386, 4.363, 4.347, 4.332, 4.317, 4.302, 4.287, 4.272, 4.258, 4.243, 4.229, 4.208, 4.180, 4.153, 4.127, 4.101, 4.075, 4.051, 4.026, 4.003, 3.979, 3.956, 3.934, 3.912, 3.891, 3.860, 3.821, 3.783, 3.747, 3.712, 3.680, 3.649, 3.620, 3.592, 3.566, 3.524, 3.471, 3.427, 3.390, 3.361, 3.323, 3.312, + 6.918, 6.864, 6.829, 6.794, 6.759, 6.724, 6.690, 6.656, 6.623, 6.589, 6.556, 6.507, 6.443, 6.380, 6.319, 6.258, 6.199, 6.142, 6.085, 6.030, 5.976, 5.923, 5.872, 5.821, 5.773, 5.702, 5.612, 5.528, 5.449, 5.376, 5.308, 5.245, 5.189, 5.138, 5.092, 5.027, 4.964, 4.939, 4.953, 5.005, 5.233, 6.041, + ]), + emFractionBinsHGCal = cms.vdouble([ 0.00,0.55,0.67,0.77,1.05]), + absEtaBinsHGCal = cms.vdouble([ 1.50,1.90,2.40,3.00]), + jetCalibrationsHGCal = cms.vdouble([ + 1.395, 1.394, 1.394, 1.394, 1.394, 1.394, 1.393, 1.393, 1.393, 1.393, 1.393, 1.393, 1.392, 1.392, 1.392, 1.391, 1.391, 1.391, 1.390, 1.390, 1.390, 1.389, 1.389, 1.389, 1.388, 1.388, 1.387, 1.387, 1.386, 1.385, 1.385, 1.384, 1.383, 1.383, 1.382, 1.381, 1.379, 1.378, 1.376, 1.374, 1.371, 1.365, + 1.575, 1.574, 1.574, 1.574, 1.574, 1.574, 1.573, 1.573, 1.573, 1.573, 1.572, 1.572, 1.572, 1.571, 1.571, 1.570, 1.570, 1.569, 1.569, 1.569, 1.568, 1.568, 1.567, 1.567, 1.566, 1.566, 1.565, 1.564, 1.563, 1.562, 1.561, 1.560, 1.559, 1.559, 1.558, 1.556, 1.554, 1.552, 1.549, 1.547, 1.543, 1.535, + 1.846, 1.845, 1.845, 1.844, 1.844, 1.843, 1.843, 1.842, 1.842, 1.841, 1.841, 1.840, 1.839, 1.839, 1.838, 1.837, 1.836, 1.835, 1.834, 1.833, 1.832, 1.831, 1.830, 1.829, 1.829, 1.827, 1.825, 1.824, 1.822, 1.820, 1.818, 1.816, 1.814, 1.813, 1.811, 1.808, 1.803, 1.799, 1.794, 1.790, 1.780, 1.765, + 3.377, 3.355, 3.341, 3.326, 3.312, 3.298, 3.283, 3.269, 3.255, 3.242, 3.228, 3.207, 3.180, 3.154, 3.128, 3.102, 3.077, 3.051, 3.027, 3.002, 2.979, 2.955, 2.932, 2.909, 2.886, 2.853, 2.811, 2.769, 2.729, 2.691, 2.654, 2.618, 2.584, 2.551, 2.519, 2.467, 2.400, 2.341, 2.291, 2.248, 2.186, 2.149, + 1.085, 1.087, 1.088, 1.089, 1.090, 1.091, 1.092, 1.093, 1.094, 1.095, 1.097, 1.098, 1.100, 1.103, 1.105, 1.107, 1.109, 1.111, 1.113, 1.116, 1.118, 1.120, 1.122, 1.124, 1.126, 1.130, 1.134, 1.138, 1.143, 1.147, 1.151, 1.156, 1.160, 1.164, 1.169, 1.176, 1.187, 1.198, 1.209, 1.220, 1.242, 1.280, + 61.559, 11.087, 4.083, 1.971, 1.335, 1.145, 1.090, 1.074, 1.072, 1.072, 1.074, 1.078, 1.083, 1.088, 1.093, 1.098, 1.103, 1.108, 1.112, 1.117, 1.122, 1.127, 1.132, 1.137, 1.142, 1.149, 1.159, 1.169, 1.179, 1.189, 1.199, 1.209, 1.218, 1.228, 1.238, 1.255, 1.280, 1.305, 1.329, 1.354, 1.403, 1.490, + 89.821, 15.567, 5.416, 2.387, 1.485, 1.218, 1.140, 1.119, 1.115, 1.116, 1.118, 1.123, 1.129, 1.135, 1.141, 1.147, 1.153, 1.159, 1.165, 1.171, 1.178, 1.184, 1.190, 1.196, 1.202, 1.211, 1.223, 1.236, 1.248, 1.260, 1.272, 1.284, 1.297, 1.309, 1.321, 1.342, 1.373, 1.403, 1.434, 1.464, 1.525, 1.632, + 83.760, 19.529, 8.102, 3.961, 2.461, 1.918, 1.721, 1.650, 1.624, 1.615, 1.612, 1.611, 1.611, 1.611, 1.612, 1.612, 1.613, 1.613, 1.614, 1.614, 1.615, 1.616, 1.616, 1.617, 1.617, 1.618, 1.619, 1.620, 1.621, 1.622, 1.623, 1.624, 1.625, 1.626, 1.628, 1.629, 1.632, 1.635, 1.637, 1.640, 1.645, 1.655, + 1.262, 1.261, 1.260, 1.259, 1.259, 1.258, 1.257, 1.256, 1.256, 1.255, 1.254, 1.253, 1.252, 1.250, 1.249, 1.247, 1.246, 1.244, 1.243, 1.242, 1.240, 1.239, 1.237, 1.236, 1.234, 1.232, 1.229, 1.226, 1.223, 1.221, 1.218, 1.215, 1.212, 1.209, 1.206, 1.201, 1.194, 1.186, 1.179, 1.172, 1.157, 1.132, + 1.328, 1.327, 1.326, 1.326, 1.325, 1.325, 1.324, 1.324, 1.323, 1.323, 1.322, 1.322, 1.321, 1.320, 1.319, 1.318, 1.317, 1.316, 1.315, 1.314, 1.313, 1.312, 1.311, 1.310, 1.309, 1.308, 1.306, 1.304, 1.302, 1.300, 1.298, 1.296, 1.294, 1.292, 1.290, 1.287, 1.282, 1.277, 1.272, 1.267, 1.257, 1.240, + 1.463, 1.461, 1.460, 1.459, 1.458, 1.457, 1.456, 1.455, 1.454, 1.453, 1.452, 1.451, 1.449, 1.447, 1.445, 1.443, 1.440, 1.438, 1.436, 1.434, 1.432, 1.430, 1.428, 1.426, 1.424, 1.421, 1.417, 1.413, 1.409, 1.405, 1.401, 1.397, 1.393, 1.389, 1.385, 1.377, 1.367, 1.357, 1.347, 1.337, 1.316, 1.281, + 44.899, 14.731, 7.692, 4.568, 3.180, 2.562, 2.285, 2.159, 2.101, 2.072, 2.057, 2.043, 2.031, 2.021, 2.011, 2.001, 1.991, 1.982, 1.972, 1.962, 1.952, 1.942, 1.932, 1.922, 1.912, 1.897, 1.878, 1.858, 1.838, 1.818, 1.798, 1.779, 1.759, 1.739, 1.719, 1.685, 1.635, 1.586, 1.536, 1.487, 1.387, 1.214, + ]), + emFractionBinsHF = cms.vdouble([ 0.00,1.05]), + absEtaBinsHF = cms.vdouble([ 3.00,3.60,6.00]), + jetCalibrationsHF = cms.vdouble([ + 3.223, 2.140, 1.683, 1.364, 1.142, 0.987, 0.879, 0.804, 0.752, 0.716, 0.691, 0.667, 0.651, 0.644, 0.641, 0.641, 0.641, 0.642, 0.644, 0.645, 0.647, 0.648, 0.650, 0.651, 0.653, 0.655, 0.658, 0.662, 0.665, 0.668, 0.671, 0.674, 0.677, 0.681, 0.684, 0.689, 0.697, 0.705, 0.713, 0.721, 0.736, 0.764, + 2.598, 1.813, 1.462, 1.206, 1.019, 0.883, 0.783, 0.711, 0.658, 0.620, 0.592, 0.564, 0.543, 0.532, 0.526, 0.524, 0.523, 0.524, 0.524, 0.525, 0.526, 0.527, 0.528, 0.529, 0.530, 0.532, 0.534, 0.536, 0.538, 0.541, 0.543, 0.545, 0.547, 0.549, 0.552, 0.556, 0.561, 0.567, 0.572, 0.578, 0.589, 0.608, + ]), + + # Testing tau calibrations derived for March workshop, 20 March 2019 + tauPtBins = cms.vdouble([ 0.0,5.0,7.5,10.0,12.5,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0,55.0,60.0,70.0,80.0,100.0,150.0,200.0]), + tauAbsEtaBinsBarrel = cms.vdouble([ 0.00,0.30,0.60,1.00,1.50]), + tauL1egInfoBarrel = cms.VPSet( + cms.PSet( + l1egCount = cms.double( 0.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.091, 0.317, 1.05]), + ), + cms.PSet( + l1egCount = cms.double( 1.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.634, 0.888, 1.05]), + ), + cms.PSet( + l1egCount = cms.double( 2.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.821, 0.957, 1.05]), + ), + ), + tauCalibrationsBarrel = cms.vdouble([ + 1.917, 1.714, 1.605, 1.514, 1.437, 1.344, 1.252, 1.188, 1.142, 1.110, 1.087, 1.071, 1.059, 1.051, 1.044, 1.038, 1.034, 1.032, 1.032, + 1.856, 1.729, 1.655, 1.589, 1.530, 1.453, 1.369, 1.301, 1.248, 1.205, 1.170, 1.143, 1.121, 1.103, 1.084, 1.066, 1.050, 1.037, 1.034, + 2.053, 1.884, 1.788, 1.702, 1.627, 1.530, 1.426, 1.345, 1.282, 1.233, 1.194, 1.164, 1.141, 1.122, 1.102, 1.084, 1.070, 1.059, 1.057, + 1.783, 1.659, 1.588, 1.524, 1.466, 1.391, 1.309, 1.244, 1.191, 1.149, 1.116, 1.089, 1.068, 1.050, 1.031, 1.013, 0.998, 0.986, 0.983, + 1.896, 1.713, 1.613, 1.527, 1.453, 1.362, 1.270, 1.202, 1.152, 1.115, 1.088, 1.069, 1.054, 1.044, 1.033, 1.024, 1.018, 1.015, 1.014, + 1.936, 1.677, 1.544, 1.437, 1.350, 1.249, 1.156, 1.095, 1.055, 1.028, 1.011, 1.000, 0.992, 0.987, 0.983, 0.980, 0.978, 0.978, 0.978, + 1.850, 1.683, 1.590, 1.509, 1.439, 1.351, 1.258, 1.188, 1.135, 1.096, 1.065, 1.043, 1.025, 1.012, 0.999, 0.987, 0.979, 0.973, 0.972, + 2.066, 1.784, 1.638, 1.517, 1.418, 1.301, 1.189, 1.114, 1.063, 1.029, 1.006, 0.990, 0.979, 0.972, 0.965, 0.961, 0.958, 0.957, 0.957, + 1.074, 1.063, 1.056, 1.050, 1.043, 1.034, 1.022, 1.011, 1.001, 0.992, 0.983, 0.974, 0.966, 0.959, 0.949, 0.937, 0.921, 0.895, 0.874, + 2.053, 1.757, 1.609, 1.489, 1.394, 1.285, 1.186, 1.123, 1.083, 1.057, 1.040, 1.029, 1.022, 1.018, 1.014, 1.012, 1.010, 1.010, 1.010, + 1.733, 1.628, 1.567, 1.513, 1.463, 1.399, 1.328, 1.270, 1.224, 1.187, 1.157, 1.133, 1.114, 1.098, 1.081, 1.064, 1.050, 1.038, 1.035, + 2.009, 1.852, 1.762, 1.682, 1.611, 1.518, 1.417, 1.337, 1.274, 1.224, 1.184, 1.153, 1.128, 1.108, 1.086, 1.066, 1.049, 1.036, 1.033, + 1.806, 1.669, 1.591, 1.522, 1.461, 1.382, 1.296, 1.230, 1.177, 1.136, 1.103, 1.078, 1.058, 1.043, 1.025, 1.010, 0.998, 0.988, 0.986, + 1.944, 1.725, 1.609, 1.512, 1.431, 1.334, 1.239, 1.173, 1.126, 1.094, 1.071, 1.056, 1.045, 1.037, 1.030, 1.024, 1.021, 1.019, 1.019, + 1.900, 1.631, 1.496, 1.389, 1.304, 1.208, 1.122, 1.068, 1.034, 1.012, 0.999, 0.990, 0.984, 0.981, 0.978, 0.976, 0.975, 0.975, 0.975, + 1.682, 1.577, 1.516, 1.460, 1.409, 1.342, 1.266, 1.203, 1.152, 1.109, 1.075, 1.046, 1.022, 1.003, 0.980, 0.958, 0.937, 0.918, 0.913, + 1.928, 1.693, 1.569, 1.466, 1.381, 1.280, 1.183, 1.116, 1.070, 1.038, 1.016, 1.001, 0.991, 0.984, 0.977, 0.973, 0.970, 0.969, 0.969, + 1.067, 1.058, 1.052, 1.047, 1.041, 1.033, 1.023, 1.014, 1.005, 0.997, 0.989, 0.981, 0.974, 0.968, 0.959, 0.948, 0.933, 0.908, 0.886, + 1.883, 1.663, 1.548, 1.453, 1.375, 1.282, 1.193, 1.133, 1.091, 1.063, 1.044, 1.031, 1.022, 1.016, 1.010, 1.006, 1.004, 1.003, 1.003, + 1.688, 1.595, 1.541, 1.492, 1.448, 1.390, 1.325, 1.271, 1.228, 1.193, 1.164, 1.140, 1.121, 1.105, 1.087, 1.070, 1.055, 1.041, 1.037, + 2.251, 2.020, 1.891, 1.779, 1.682, 1.561, 1.434, 1.339, 1.267, 1.213, 1.173, 1.142, 1.119, 1.102, 1.084, 1.069, 1.058, 1.051, 1.050, + 1.799, 1.654, 1.572, 1.501, 1.438, 1.359, 1.275, 1.211, 1.162, 1.125, 1.096, 1.074, 1.057, 1.044, 1.030, 1.019, 1.009, 1.003, 1.002, + 1.780, 1.630, 1.547, 1.475, 1.413, 1.335, 1.254, 1.193, 1.148, 1.114, 1.089, 1.070, 1.056, 1.045, 1.034, 1.025, 1.018, 1.014, 1.013, + 1.750, 1.549, 1.445, 1.359, 1.288, 1.205, 1.126, 1.072, 1.036, 1.012, 0.995, 0.984, 0.976, 0.971, 0.966, 0.963, 0.961, 0.960, 0.960, + 1.736, 1.610, 1.537, 1.472, 1.414, 1.339, 1.257, 1.192, 1.141, 1.100, 1.067, 1.041, 1.021, 1.005, 0.986, 0.970, 0.956, 0.945, 0.942, + 1.961, 1.712, 1.582, 1.474, 1.386, 1.281, 1.181, 1.114, 1.068, 1.036, 1.015, 1.001, 0.991, 0.984, 0.978, 0.974, 0.971, 0.970, 0.970, + 1.065, 1.056, 1.051, 1.046, 1.040, 1.033, 1.023, 1.014, 1.005, 0.997, 0.989, 0.982, 0.974, 0.968, 0.958, 0.946, 0.930, 0.900, 0.872, + 2.047, 1.810, 1.683, 1.575, 1.485, 1.375, 1.266, 1.188, 1.133, 1.094, 1.066, 1.046, 1.032, 1.022, 1.012, 1.005, 1.000, 0.998, 0.997, + 2.022, 1.861, 1.768, 1.686, 1.613, 1.519, 1.418, 1.338, 1.275, 1.226, 1.187, 1.157, 1.133, 1.114, 1.093, 1.074, 1.059, 1.047, 1.045, + 2.503, 2.236, 2.087, 1.956, 1.843, 1.699, 1.548, 1.434, 1.347, 1.281, 1.231, 1.192, 1.164, 1.142, 1.118, 1.099, 1.084, 1.074, 1.072, + 2.253, 2.007, 1.872, 1.755, 1.654, 1.529, 1.401, 1.305, 1.235, 1.182, 1.143, 1.115, 1.093, 1.078, 1.061, 1.048, 1.039, 1.033, 1.033, + 2.228, 2.010, 1.888, 1.782, 1.690, 1.574, 1.453, 1.361, 1.292, 1.239, 1.200, 1.170, 1.147, 1.130, 1.112, 1.097, 1.085, 1.078, 1.077, + 2.527, 2.136, 1.934, 1.769, 1.633, 1.475, 1.326, 1.226, 1.159, 1.114, 1.084, 1.064, 1.051, 1.042, 1.034, 1.028, 1.025, 1.024, 1.024, + 2.097, 1.908, 1.801, 1.706, 1.622, 1.514, 1.398, 1.308, 1.238, 1.183, 1.140, 1.106, 1.080, 1.060, 1.038, 1.018, 1.002, 0.991, 0.988, + 2.479, 2.106, 1.912, 1.753, 1.623, 1.470, 1.326, 1.229, 1.163, 1.120, 1.090, 1.070, 1.057, 1.048, 1.040, 1.034, 1.031, 1.029, 1.029, + 2.097, 1.906, 1.796, 1.699, 1.612, 1.500, 1.378, 1.281, 1.205, 1.145, 1.098, 1.060, 1.031, 1.007, 0.981, 0.958, 0.939, 0.923, 0.920, + ]), + tauAbsEtaBinsHGCal = cms.vdouble([ 1.50,1.90,2.40,3.00]), + tauL1egInfoHGCal = cms.VPSet( + cms.PSet( + l1egCount = cms.double( 0.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.473, 0.72, 0.894, 1.05]), + ), + ), + tauCalibrationsHGCal = cms.vdouble([ + 1.665, 1.556, 1.495, 1.443, 1.398, 1.342, 1.285, 1.242, 1.211, 1.188, 1.170, 1.158, 1.148, 1.141, 1.134, 1.128, 1.124, 1.122, 1.121, + 1.646, 1.525, 1.459, 1.402, 1.353, 1.293, 1.231, 1.186, 1.153, 1.129, 1.112, 1.099, 1.089, 1.082, 1.075, 1.069, 1.065, 1.063, 1.063, + 1.826, 1.630, 1.528, 1.444, 1.376, 1.294, 1.218, 1.166, 1.130, 1.107, 1.091, 1.080, 1.072, 1.067, 1.063, 1.060, 1.058, 1.057, 1.057, + 2.031, 1.762, 1.624, 1.514, 1.424, 1.321, 1.226, 1.164, 1.124, 1.098, 1.081, 1.069, 1.062, 1.057, 1.053, 1.050, 1.049, 1.048, 1.048, + 1.396, 1.328, 1.291, 1.259, 1.232, 1.198, 1.164, 1.139, 1.120, 1.107, 1.097, 1.089, 1.084, 1.080, 1.076, 1.073, 1.071, 1.070, 1.070, + 1.242, 1.214, 1.197, 1.182, 1.168, 1.149, 1.128, 1.111, 1.097, 1.085, 1.075, 1.067, 1.060, 1.055, 1.048, 1.042, 1.036, 1.030, 1.029, + 1.491, 1.368, 1.305, 1.253, 1.211, 1.161, 1.115, 1.084, 1.064, 1.050, 1.041, 1.035, 1.031, 1.028, 1.026, 1.024, 1.023, 1.023, 1.023, + 1.348, 1.289, 1.255, 1.225, 1.199, 1.165, 1.127, 1.098, 1.075, 1.057, 1.043, 1.031, 1.022, 1.016, 1.008, 1.001, 0.995, 0.991, 0.990, + 1.422, 1.373, 1.345, 1.320, 1.297, 1.266, 1.232, 1.205, 1.183, 1.165, 1.150, 1.138, 1.128, 1.120, 1.111, 1.102, 1.095, 1.088, 1.086, + 1.350, 1.322, 1.304, 1.288, 1.272, 1.250, 1.224, 1.201, 1.180, 1.162, 1.146, 1.132, 1.119, 1.108, 1.093, 1.078, 1.061, 1.038, 1.026, + 1.440, 1.373, 1.334, 1.300, 1.270, 1.231, 1.189, 1.155, 1.129, 1.108, 1.092, 1.079, 1.069, 1.061, 1.053, 1.045, 1.038, 1.033, 1.032, + 1.356, 1.317, 1.293, 1.271, 1.250, 1.221, 1.186, 1.156, 1.129, 1.105, 1.085, 1.067, 1.051, 1.037, 1.019, 1.000, 0.980, 0.954, 0.941, + ]), +) + diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py b/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py new file mode 100644 index 0000000000000..a138f4093e7f4 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms + +# This cff file is based off of the L1T Phase-2 Menu group using +# the process name "REPR" + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the L1EGCrystal clusters using Emulator + +from L1Trigger.L1CaloTrigger.L1EGammaCrystalsEmulatorProducer_cfi import * +L1EGammaClusterEmuProducer.ecalTPEB = cms.InputTag("simEcalEBTriggerPrimitiveDigis","","") + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the calibrated tower collection combining Barrel, HGCal, HF + +from L1Trigger.L1CaloTrigger.L1TowerCalibrationProducer_cfi import * +L1TowerCalibrationProducer.L1HgcalTowersInputTag = cms.InputTag("hgcalTowerProducer","HGCalTowerProcessor","") +L1TowerCalibrationProducer.l1CaloTowers = cms.InputTag("L1EGammaClusterEmuProducer","L1CaloTowerCollection","") + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the L1CaloJets + +from L1Trigger.L1CaloTrigger.L1CaloJetProducer_cfi import * +L1CaloJetProducer.l1CaloTowers = cms.InputTag("L1TowerCalibrationProducer","L1CaloTowerCalibratedCollection","") +L1CaloJetProducer.L1CrystalClustersInputTag = cms.InputTag("L1EGammaClusterEmuProducer", "L1EGXtalClusterEmulator","") + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the CaloJet HTT Sums + +from L1Trigger.L1CaloTrigger.L1CaloJetHTTProducer_cfi import * + + + +l1CaloJetsSequence = cms.Sequence( + L1EGammaClusterEmuProducer * + L1TowerCalibrationProducer * + L1CaloJetProducer * + L1CaloJetHTTProducer +) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py new file mode 100644 index 0000000000000..61769a9d24c97 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py @@ -0,0 +1,783 @@ +import FWCore.ParameterSet.Config as cms +calibration = cms.VPSet( + cms.PSet( + etaMax = cms.double(0.435), + etaMin = cms.double(0), + l1tCalibrationFactors = cms.vdouble( + 1.26146717329, 1.26146717329, 1.26146717329, 1.26146717329, 1.26146717329, + 1.26146717329, 1.26146717329, 1.24623228894, 1.22774013608, 1.20864472626, + 1.18983620186, 1.17220606581, 1.1583247683, 1.14631058894, 1.13609994066, + 1.12752496855, 1.12089178748, 1.11699447611, 1.11526653347, 1.11555762523, + 1.09853049091, 1.09683531526, 1.09514972072, 1.09326684356, 1.09162970037, + 1.08995375793, 1.08825706983, 1.08670271417, 1.08475374607, 1.08288456528, + 1.0811741799, 1.07928109805, 1.07818965233, 1.07651502479, 1.07449932258, + 1.07285243919, 1.0707178513, 1.06924419003, 1.06772074029, 1.06611812413, + 1.0648425894, 1.06246808088, 1.06156200302, 1.0592770589, 1.05752747574, + 1.0562094913, 1.05403560794, 1.05239347578, 1.0505342996, 1.04819572369, + 1.04813853787, 1.04508846408, 1.04554414394, 1.04558937184, 1.04582193656, + 1.04620801277, 1.04629403559, 1.04678402565, 1.04693513867, 1.04707997811, + 1.04729707852, 1.04761924239, 1.04814409297, 1.04817625354, 1.04827738829, + 1.04862435571, 1.04899633011, 1.04928518739, 1.04948410793, 1.04953664235, + 1.05003438124, 1.05022255911, 1.05079418764, 1.05080587637, 1.0509830576, + 1.05107821919, 1.05138802599, 1.05180619558, 1.05197881611, 1.05212175371, + 1.05264782037, 1.05296283034, 1.05308910042, 1.05374518535, 1.05502979799, + 1.0565958427, 1.057764105, 1.0588840728, 1.06031846417, 1.06116441033, + 1.06276845969, 1.06379817554, 1.06450339465, 1.0661557688, 1.06662936414, + 1.06836012995, 1.06997205086, 1.07041209892, 1.07169696027, 1.07258808631, + 1.07293155402, 1.07354286066, 1.07463205829, 1.07708654714, 1.07781843344, + 1.07822325122, 1.07846301946, 1.07932205225, 1.0808090032, 1.08141472035, + 1.08181938516, 1.08304678146, 1.08314137081, 1.08365386745, 1.08384051114, + 1.08474353214, 1.08568646733 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.8924070115, 15.5860038298, 18.0893326776, 20.9564367755, + 23.9770832376, 27.0624635982, 30.5728737338, 34.0912004568, 37.5058618916, + 41.28259481, 45.3408244209, 49.3133175961, 53.093074924, 56.9139697296, + 60.8674434948, 65.0370376256, 69.1457997754, 72.9170868064, 76.9300170371, + 80.9502314594, 84.7098877358, 88.5948271577, 92.6954597315, 96.7404154687, + 100.547576625, 104.423162547, 108.159029626, 112.184798836, 116.572342591, + 120.685724144, 124.826571081, 128.2561768, 131.43475045, 135.675413589, + 139.884195127, 144.229591592, 148.375933576, 151.819999288, 155.412250741, + 158.71961599, 162.913984762, 166.683800103, 170.350694444, 174.986884782, + 178.511914168, 182.524519011, 186.909611243, 190.93306449, 195.756821106, + 198.509859211, 201.441789801, 207.652012822, 211.327924084, 213.366505054, + 217.906400994, 221.370899319, 225.597969342, 230.302703785, 232.47455073, + 235.130646041, 239.088036491, 245.303851371, 249.391477266, 250.369664834, + 253.658062256, 258.934016204, 263.783528944, 267.363086105, 269.208388119, + 273.246568362, 278.280167959, 283.856006586, 288.136679844, 289.522701901, + 291.521289472, 294.493149718, 299.835403885, 304.170916706, 306.486639748, + 311.396126928, 317.568367117, 320.80670045, 326.54801202, 340.789819604, + 361.709366349, 381.775076142, 398.567250891, 417.312413581, 434.046668715, + 452.025958872, 471.353842702, 484.085661524, 501.386857761, 516.988283156, + 533.164985739, 557.695289505, 572.753662147, 585.411908484, 601.380390144, + 610.440455386, 617.447066221, 629.926215437, 655.931555782, 679.314767255, + 687.656469243, 692.386763225, 700.450313755, 717.666313573, 733.02335672, + 740.43804395, 752.41492308, 762.116313664, 766.571413729, 771.702054536, + 779.698558007, 793.245106025, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(0.783), + etaMin = cms.double(0.435), + l1tCalibrationFactors = cms.vdouble( + 1.27440254712, 1.27440254712, 1.27440254712, 1.27440254712, 1.27440254712, + 1.27440254712, 1.27440254712, 1.26237861784, 1.23951156915, 1.21936711031, + 1.20113175263, 1.18314392239, 1.16741650703, 1.1532578472, 1.14251404461, + 1.13200827803, 1.12427897706, 1.11860055115, 1.11471654207, 1.11309371657, + 1.1035823547, 1.10196181856, 1.10027074608, 1.09833277227, 1.09643569091, + 1.09479603469, 1.09254753293, 1.0910773106, 1.08944340405, 1.08705077883, + 1.08537639048, 1.08421015427, 1.08256687333, 1.07995863059, 1.07902607265, + 1.07655905818, 1.07503735031, 1.07301389635, 1.07165575749, 1.06929921168, + 1.06821092927, 1.06616199123, 1.06487780021, 1.06328778675, 1.0601816044, + 1.05917489441, 1.05866746046, 1.05722684059, 1.05413790801, 1.05293443771, + 1.05073793986, 1.05074440903, 1.05156882707, 1.05163408963, 1.05181488861, + 1.05200189767, 1.05217943685, 1.05254100206, 1.05307882377, 1.05386936932, + 1.05395003667, 1.0542087993, 1.05432475605, 1.05494245045, 1.05517112014, + 1.05525094335, 1.0557115483, 1.05594207892, 1.05625830743, 1.05696698354, + 1.05725628851, 1.05743196571, 1.05751284882, 1.05781632022, 1.05799531513, + 1.05839650856, 1.05904363259, 1.05904762922, 1.05949497688, 1.05993791442, + 1.06013251385, 1.06028823516, 1.06060327995, 1.06148490738, 1.0633070629, + 1.06449096664, 1.06670714728, 1.06801525532, 1.06985663341, 1.07108256509, + 1.07206439709, 1.0740254986, 1.07557580148, 1.07619628328, 1.07858299527, + 1.07945640742, 1.08120547417, 1.08132667522, 1.0830354305, 1.08433727452, + 1.08550593118, 1.08573737565, 1.08856278526, 1.08898559663, 1.09085721249, + 1.09115172941, 1.09275835574, 1.09276976832, 1.09444259455, 1.09563540181, + 1.09592154537, 1.09651685067, 1.0973090816, 1.09896312764, 1.09908156772, + 1.0999610622, 1.10120919691 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.5166014072, 15.373411826, 17.8203160866, 20.5214351446, + 23.7435311152, 26.9752802487, 30.159287011, 33.795645223, 37.5316299794, + 41.1721803568, 44.9660370105, 48.902377368, 52.876112172, 56.6808679777, + 60.5654106611, 64.6237707464, 68.5221021533, 72.5227681626, 76.5042056448, + 80.2180681472, 83.8258362025, 87.532675527, 91.5948377827, 95.8875954562, + 99.8464322114, 104.198630369, 108.361173199, 111.835770689, 116.342857134, + 120.895256769, 124.074901486, 127.219726204, 131.978656674, 135.94204146, + 139.747342798, 144.212107373, 148.180373794, 151.965549722, 156.12357104, + 159.979529336, 163.491167779, 167.222095949, 170.439328244, 175.696001155, + 180.29975505, 181.994607597, 184.175155894, 189.245297056, 194.049985541, + 198.340003157, 201.321048531, 206.218215217, 211.461904271, 212.912166551, + 215.079990584, 217.228601695, 220.406029412, 225.706926541, 233.536191247, + 238.671033554, 240.671600092, 242.880158901, 247.204225898, 252.192611789, + 254.010838342, 257.196068218, 261.26955259, 264.492096592, 270.532782577, + 276.414783911, 279.155342625, 280.667483589, 282.932830907, 285.776439406, + 289.196011843, 295.374690785, 299.212331303, 301.872509758, 307.119762288, + 310.877341827, 312.94209744, 315.716746046, 322.769813223, 338.705641346, + 356.423056004, 376.462815601, 397.234622991, 415.797381365, 433.875800387, + 446.888140191, 464.233497952, 484.92936658, 497.723755857, 515.447857308, + 534.662705108, 550.119335237, 561.142507879, 571.928088666, 589.672261866, + 604.233147494, 612.485204409, 630.501998671, 649.646690452, 663.169816605, + 675.936788044, 687.141937495, 696.678498096, 706.605234297, 723.494993391, + 732.211782606, 737.406954657, 745.584955357, 760.003068783, 770.449925926, + 776.331653061, 788.871688149, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.131), + etaMin = cms.double(0.783), + l1tCalibrationFactors = cms.vdouble( + 1.28877882208, 1.28877882208, 1.28877882208, 1.28877882208, 1.28877882208, + 1.28877882208, 1.28877882208, 1.27694835829, 1.25297836741, 1.23044531865, + 1.20855235448, 1.1893282309, 1.1725504389, 1.159203929, 1.14569587541, + 1.13380083086, 1.12771359895, 1.12132733429, 1.11801327984, 1.1164039178, + 1.09801792847, 1.09588518489, 1.09370961881, 1.09201093419, 1.09011871384, + 1.08808881147, 1.08571111049, 1.0844474359, 1.0816414337, 1.07974691293, + 1.07795760075, 1.07551422323, 1.07375791565, 1.07236983191, 1.07058218311, + 1.06770191716, 1.06603119504, 1.06362972852, 1.06219040348, 1.05951643702, + 1.05780511343, 1.05549894379, 1.05456596784, 1.05183218447, 1.04998506398, + 1.04777908115, 1.04555637855, 1.04371561533, 1.04114340237, 1.0397345442, + 1.03703721093, 1.0370020161, 1.03697403511, 1.03684016386, 1.03681653914, + 1.03674288479, 1.03673045853, 1.03669821954, 1.03660261509, 1.03654890521, + 1.03647824831, 1.03641370002, 1.03638368584, 1.0363474327, 1.03626689773, + 1.0362274515, 1.03612736074, 1.03606484142, 1.03601160822, 1.0359745858, + 1.03591575182, 1.03585836866, 1.03576558282, 1.03572050093, 1.03570445277, + 1.03564801105, 1.03564340833, 1.03559278773, 1.03548525195, 1.03540543085, + 1.03537311338, 1.035353379, 1.03531268737, 1.03509757281, 1.03481844747, + 1.03460188756, 1.03436873742, 1.03404872284, 1.03382849525, 1.03352709651, + 1.03339139385, 1.03316615269, 1.03281524483, 1.03254783724, 1.0322983399, + 1.03220214395, 1.03198001329, 1.03179532519, 1.03149961876, 1.03119032511, + 1.03108787294, 1.03084032788, 1.03073682524, 1.03031711785, 1.03026374639, + 1.03000361434, 1.02980821858, 1.02966151075, 1.02953728147, 1.0295357024, + 1.02913791337, 1.02909523261, 1.0288898051, 1.02885866633, 1.02866419809, + 1.02857281869, 1.02854490374 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.5223180803, 15.3157792118, 17.7207146184, 20.4619302345, + 23.3867043945, 26.6674195508, 30.0148453856, 33.5181156442, 37.2034564252, + 41.0654706777, 45.0242304428, 48.9215289734, 52.6171619736, 56.4669723943, + 60.8532828285, 64.6431610877, 68.2511806135, 72.1165788509, 75.9507576219, + 80.178753144, 84.4601989805, 88.7755810919, 92.6561916984, 96.2529914483, + 100.18155266, 104.59639146, 108.243744657, 112.320102165, 117.028341441, + 120.718221713, 124.957859738, 129.164438975, 132.313992074, 135.494937852, + 140.170515382, 144.728974276, 148.807847754, 152.654944304, 156.774988123, + 161.167476996, 165.191565276, 168.436028198, 172.108806818, 176.697230616, + 180.756987451, 185.192942943, 189.263079284, 193.683299739, 197.670906127, + 200.669569599, 203.481912923, 205.680557963, 211.313340235, 216.794515892, + 220.180022472, 223.175800166, 224.730240575, 229.17944849, 234.375886398, + 238.704099822, 243.409511328, 246.700474731, 249.00671039, 253.071170975, + 257.246757399, 262.102924202, 267.762080987, 271.790500732, 274.931577111, + 278.267572043, 282.312161533, 287.538343865, 292.336417173, 294.463865342, + 296.986658469, 299.111127436, 301.033009752, 306.537168829, 313.057563733, + 316.96021075, 318.771719474, 320.874665805, 329.777234102, 346.977773204, + 364.228613586, 379.879425057, 399.130666101, 417.932176338, 436.085818382, + 451.29782338, 463.859392071, 483.910533029, 505.429149973, 523.418477617, + 535.449297178, 546.527701523, 560.68580979, 577.404502376, 598.459717959, + 612.789297808, 624.969903015, 637.187066993, 655.395825055, 671.859917095, + 682.770467826, 698.623748975, 710.529639449, 719.958794038, 724.337177101, + 738.235987456, 753.565219085, 762.199884396, 770.432864923, 778.284440936, + 788.232511997, 792.384194735, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.305), + etaMin = cms.double(1.131), + l1tCalibrationFactors = cms.vdouble( + 1.30464904899, 1.30464904899, 1.30464904899, 1.30464904899, 1.30464904899, + 1.30464904899, 1.30464904899, 1.28753966966, 1.26184241946, 1.23615743701, + 1.21112716928, 1.18830854051, 1.16922129671, 1.15162104151, 1.13926988997, + 1.12013893675, 1.11315074529, 1.10421726948, 1.09857786941, 1.08796490485, + 1.08552778022, 1.08306838599, 1.08021288693, 1.07781388228, 1.07524586684, + 1.07202146179, 1.07155192888, 1.06803593019, 1.0650691697, 1.0625137133, + 1.05970398098, 1.05913981338, 1.05484331908, 1.05247891606, 1.04987962874, + 1.04909722507, 1.04389372917, 1.04368102591, 1.0422637752, 1.0370645451, + 1.03592014765, 1.03435988683, 1.03031862795, 1.02680188551, 1.02408943242, + 1.02282610293, 1.02225324386, 1.01840036238, 0.989241976704, 0.98936641432, + 0.989446855212, 0.98951480633, 0.989647898182, 0.989701958582, 0.989706514106, + 0.989820263437, 0.989821771034, 0.989943716755, 0.990074385744, 0.990085628723, + 0.990095337335, 0.990197326453, 0.990412605548, 0.990427287837, 0.990488988094, + 0.99062322091, 0.990637873057, 0.990783650663, 0.99080168294, 0.990822418393, + 0.990869793135, 0.991049950613, 0.991105067801, 0.991109415833, 0.991144130522, + 0.991182618547, 0.991221896221, 0.991348588885, 0.991390279742, 0.991508569063, + 0.991561035644, 0.991706459406, 0.991709328176, 0.991771803291, 0.992203832104, + 0.992607250874, 0.992961331312, 0.993424404998, 0.993474148563, 0.993704249848, + 0.994181954878, 0.994342287962, 0.994860595811, 0.994943125569, 0.99513621193, + 0.995791648606, 0.995861005306, 0.996071614139, 0.996576493061, 0.996769080865, + 0.99717703025, 0.997283342352, 0.997320725972, 0.997392435524, 0.997393456879, + 0.997724128794, 0.9983288294, 0.998396228241, 0.998558386961, 0.99871575569, + 0.998740910223, 0.998767733861, 0.998828447311, 0.998932961763, 0.999586369087, + 0.99979063868, 0.999822861843 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.7762473951, 15.5332882685, 17.7177050482, 20.5318058753, + 23.6984819534, 26.8528548618, 30.4115268065, 34.1183239417, 37.9102526851, + 41.9771903896, 46.1951438026, 50.2953206763, 54.3412175936, 58.0533034892, + 62.7880145798, 67.2857005426, 70.9603292709, 75.2703501199, 79.2421638597, + 83.2352443262, 87.3871418906, 91.8937910264, 96.3492341157, 100.560911672, + 105.4724697, 108.604664727, 111.984110281, 117.481026109, 122.163470824, + 126.712766881, 129.573592546, 133.695085969, 139.343050191, 143.551904358, + 146.4193363, 151.494950739, 156.0875, 157.469584309, 163.079886507, + 168.458828671, 170.752185315, 175.501873127, 181.910517332, 187.192429336, + 190.563608433, 192.12056492, 195.873276157, 200.366441748, 205.180843606, + 211.088590075, 215.367527804, 221.164675131, 226.561278527, 228.251490056, + 231.662853692, 234.986329234, 238.546150662, 245.830387931, 249.922471264, + 250.526618005, 253.747462754, 262.89600735, 269.527027681, 271.729546239, + 277.379347826, 281.6725, 286.29855042, 291.022068119, 292.139949738, + 294.103932039, 300.664906542, 307.449137311, 309.163838612, 310.2902264, + 312.401053339, 314.643455616, 319.429270833, 324.284671053, 328.897757787, + 333.821566464, 339.527806653, 343.803875892, 345.688090636, 359.947291667, + 384.037727273, 405.880493053, 429.443430116, 444.230702504, 452.300130761, + 472.709983897, 491.10804551, 510.676904206, 528.002275641, 535.9497669, + 560.417237991, 581.316919192, 589.389827419, 610.021177686, 630.132884972, + 647.449593726, 662.278511184, 666.422029703, 669.567771084, 671.664993307, + 681.229489664, 708.201297293, 727.581529851, 734.200905797, 743.414596273, + 748.677721088, 750.176530612, 752.700694444, 757.465101224, 779.320051941, + 804.051478495, 810.870833333, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.479), + etaMin = cms.double(1.305), + l1tCalibrationFactors = cms.vdouble( + 1.49402222179, 1.49402222179, 1.49402222179, 1.49402222179, 1.49402222179, + 1.49402222179, 1.49402222179, 1.49402222179, 1.47291221879, 1.44067526904, + 1.411205428, 1.3790606936, 1.35626109444, 1.32763245033, 1.30702937763, + 1.29039880276, 1.2769964355, 1.26383930097, 1.25651331227, 1.24922145017, + 1.24848514467, 1.25017146805, 1.26970714471, 1.26829421131, 1.2655539554, + 1.26351627994, 1.26218918978, 1.26008701808, 1.25872051661, 1.25553057705, + 1.25531916062, 1.25231191618, 1.25098985677, 1.25092649727, 1.24631095309, + 1.24491550742, 1.24463699336, 1.24089920022, 1.23818713652, 1.23797504425, + 1.23762209646, 1.2357981512, 1.22994667174, 1.22918782752, 1.2288766297, + 1.22661112186, 1.22335120944, 1.2222374654, 1.21863915082, 1.21627578407, + 1.21531079011, 1.21316997355, 1.21159701937, 1.20973271047, 1.20822352112, + 1.20808119953, 1.20712941377, 1.21601638464, 1.21449875865, 1.2128657327, + 1.2125648381, 1.2109969654, 1.21095095908, 1.20763240272, 1.20752194607, + 1.20715412726, 1.20339192426, 1.20316452215, 1.19908630242, 1.19856391893, + 1.19711998156, 1.19710976017, 1.19697659596, 1.19693795887, 1.19237829632, + 1.19185381308, 1.19110119575, 1.19056500802, 1.18847825696, 1.1856511587, + 1.18562060063, 1.17851535013, 1.17823027895, 1.17742187998, 1.17067824059, + 1.16493911336, 1.16357145785, 1.1500930073, 1.14923508822, 1.13766740107, + 1.13594359689, 1.12975025424, 1.12340048965, 1.11872349781, 1.11766570258, + 1.1029557049, 1.09804762317, 1.09571573203, 1.08638808459, 1.08507723903, + 1.08354390779, 1.08218176765, 1.07784354968, 1.07131903088, 1.05973674136, + 1.05896743969, 1.0508941418, 1.04895873762, 1.04534850219, 1.03661916912, + 1.0363330056, 1.03616346044, 1.03608676144, 1.03173422477, 1.02442109082, + 1.01944146354, 1.01859650582 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.6732940885, 14.0822469238, 16.0351992264, 18.533035159, + 21.4040329809, 24.2413122912, 27.0941591248, 30.3228808559, 33.4579112263, + 36.5410985835, 39.9175328544, 43.2085508359, 46.7155207753, 50.4991283112, + 53.856301359, 57.0602265701, 60.6020503279, 64.0753510179, 68.3166558302, + 72.2444890811, 75.2333861985, 78.6940353936, 81.7003273087, 85.6517013971, + 90.1974595599, 93.3987216924, 96.661346018, 99.961466543, 104.296497204, + 107.53257168, 110.594828706, 114.713759425, 116.03185691, 120.483399419, + 126.202298261, 127.794915554, 131.616059028, 137.752499071, 140.534562021, + 141.072145181, 143.143256833, 150.445710948, 156.734820295, 157.752865961, + 160.204362204, 165.461286653, 169.622414766, 174.105501125, 179.777487488, + 182.944113735, 185.899004129, 189.432312233, 192.70254897, 195.912119398, + 197.483378752, 198.524320323, 202.308928058, 207.324072464, 211.758643892, + 214.480654762, 217.110961838, 219.382511317, 224.118164062, 228.94453125, + 229.617708333, 235.430751812, 241.046157513, 247.106359649, 253.581750769, + 256.34936537, 258.396107129, 258.597923681, 258.839735591, 265.311884405, + 272.467866122, 274.265396862, 276.079401776, 279.771212121, 286.6875, + 290.709677419, 300.753393266, 311.155338654, 312.694407895, 323.323970985, + 340.893579208, 350.896440929, 371.792471042, 391.971042471, 409.460196929, + 428.168092588, 439.311549189, 456.966087393, 472.486347955, 480.558113227, + 502.751426025, 530.364052288, 540.554380342, 556.965287579, 571.939063803, + 575.942268669, 580.017671131, 588.040977328, 603.330378727, 628.815877093, + 646.200854701, 658.646894491, 672.734234234, 680.539772727, 697.907828283, + 710.597222222, 711.238636364, 711.585227273, 717.819416996, 734.238955119, + 751.541129032, 759.739285714, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.653), + etaMin = cms.double(1.479), + l1tCalibrationFactors = cms.vdouble( + 1.42596303316, 1.42596303316, 1.42596303316, 1.42596303316, 1.42596303316, + 1.42596303316, 1.42596303316, 1.42596303316, 1.4177466629, 1.3995618494, + 1.38276766283, 1.36931683062, 1.35471035569, 1.34046255312, 1.32941184468, + 1.3200455296, 1.30948382237, 1.30681144426, 1.29825728374, 1.29404806931, + 1.29165391765, 1.29030779607, 1.29083243576, 1.27396085005, 1.2718551659, + 1.26738255058, 1.26670434297, 1.26318102804, 1.26166765764, 1.25786412703, + 1.25518057962, 1.2530501746, 1.25083737691, 1.24869400501, 1.24550511467, + 1.24178608904, 1.24042240626, 1.23648242831, 1.23493825442, 1.2342084223, + 1.23053562244, 1.22893151286, 1.22377063054, 1.22034488227, 1.2189599762, + 1.21777849227, 1.21430917685, 1.21153741107, 1.20889147869, 1.20688285726, + 1.20338743284, 1.20096161619, 1.19672737216, 1.19202941837, 1.19004800954, + 1.18746316629, 1.18655348217, 1.18312435414, 1.2078909264, 1.20650658231, + 1.20582228539, 1.20537671722, 1.2049862715, 1.20476513856, 1.20105971422, + 1.19989656052, 1.19785505378, 1.19710626467, 1.19676963305, 1.19462529476, + 1.19282384753, 1.19154278626, 1.1900948274, 1.18954891892, 1.18914968595, + 1.18716610868, 1.18495727793, 1.18196604297, 1.18192678954, 1.17969476053, + 1.17965050907, 1.17895360889, 1.17527559787, 1.1706607414, 1.16483173896, + 1.15823552842, 1.14819433249, 1.14213524047, 1.13251935285, 1.12815142061, + 1.12191024514, 1.11085417981, 1.10484148389, 1.09826582928, 1.0895403454, + 1.0769799347, 1.07350817324, 1.06670957019, 1.06226444487, 1.05723223376, + 1.0482595789, 1.04499468512, 1.03683454016, 1.025456056, 1.02167918917, + 1.01487166026, 1.01290550623, 1.01098880941, 0.986266161192, 0.982622683842, + 0.982314921628, 0.97851685144, 0.969837554507, 0.968857319337, 0.963060466121, + 0.961712306729, 0.936251542713 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.685246952, 14.2020094702, 16.2454279268, 18.4570790339, + 21.1373272484, 24.0711882608, 27.0820591121, 30.0028435266, 32.9840363303, + 36.1993781266, 39.2042073033, 42.2602760673, 45.7316358924, 49.1357169678, + 52.2647120658, 55.8647436347, 58.5356962906, 61.5291305064, 65.6115998363, + 68.7852077001, 72.1760839599, 75.8652500891, 79.0593559025, 81.8557422467, + 86.158418801, 89.527423993, 92.275519088, 95.5698701527, 99.0475022401, + 103.290513469, 106.439181353, 109.279945377, 112.129190662, 115.616870088, + 120.135139319, 123.45959276, 126.928564758, 130.515590803, 132.002952756, + 134.882587759, 138.33406251, 142.758849213, 148.375117414, 151.521628111, + 153.200230026, 156.242184166, 160.324295949, 163.867856555, 166.912266376, + 170.512304528, 174.385218076, 178.741372283, 184.583666075, 188.952445129, + 191.939099333, 194.224769217, 197.062661499, 202.978632479, 208.439765991, + 211.111679147, 212.571043719, 213.650862069, 214.440793754, 219.512442241, + 225.800830439, 229.940057283, 233.544079516, 234.946038538, 238.150526944, + 243.247011145, 247.228463203, 250.753340051, 253.328673501, 254.549443975, + 257.627146678, 263.04217524, 269.75872195, 273.67298341, 276.606633772, + 279.546739719, 280.504031385, 286.154786036, 296.866079896, 310.35565294, + 326.40439696, 347.893724986, 368.689296081, 388.935527359, 406.997410523, + 420.700423425, 443.042011475, 465.088489103, 481.347946019, 501.111313869, + 528.604755931, 549.312346814, 562.577829768, 577.100536021, 589.341722273, + 607.430789179, 623.237140805, 637.994032486, 663.23065883, 682.805723566, + 696.47681781, 707.809146027, 712.824342105, 747.232446809, 783.870908347, + 788.974437148, 794.277642276, 810.39375, 822.870265152, 831.623737374, + 840.852430556, 875.479567308, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.83), + etaMin = cms.double(1.653), + l1tCalibrationFactors = cms.vdouble( + 1.28436707004, 1.28436707004, 1.28436707004, 1.28436707004, 1.28436707004, + 1.28436707004, 1.28436707004, 1.27860218313, 1.26114748386, 1.24471548932, + 1.23270424679, 1.2176463909, 1.20808675984, 1.19869392953, 1.1936775499, + 1.18744907855, 1.18433575975, 1.18260381979, 1.18295019864, 1.18491560081, + 1.18809316262, 1.18172024138, 1.18097131001, 1.17918745502, 1.17764940709, + 1.17688881581, 1.17504482963, 1.17248725691, 1.17129302591, 1.17004602745, + 1.1693666084, 1.16756409321, 1.16526063859, 1.16417855306, 1.16338089054, + 1.16187070953, 1.16019586336, 1.15840088317, 1.15626975454, 1.15472336309, + 1.15277251156, 1.15246623852, 1.15140593602, 1.1487970247, 1.14747602274, + 1.14638703449, 1.14512379243, 1.14247008702, 1.14113527821, 1.14044553287, + 1.1383875885, 1.1362425234, 1.13472903282, 1.13376714195, 1.13369814816, + 1.13350729029, 1.16282574417, 1.15866607792, 1.1571074204, 1.15511734699, + 1.15296938865, 1.14945591442, 1.14546738724, 1.14533339505, 1.14012295605, + 1.13927325429, 1.13750627088, 1.13378322433, 1.13171236291, 1.1286109126, + 1.12546123624, 1.12353248187, 1.12272791593, 1.12206079073, 1.11242790976, + 1.11158955611, 1.10975128919, 1.10808940983, 1.10614764171, 1.10457082693, + 1.10456528268, 1.0898943432, 1.08474469459, 1.08098903788, 1.07264937986, + 1.05568600919, 1.04193743035, 1.02564328415, 1.02145534312, 0.999803345141, + 0.98600256732, 0.975181807318, 0.953065655597, 0.948568657631, 0.92718714575, + 0.917282051972, 0.912089302025, 0.91014768072, 0.881521878237, 0.859430480658, + 0.847000750016, 0.835921402493, 0.828394647755, 0.805581771714, 0.80323037479, + 0.777498864082, 0.772467852877, 0.763114519703, 0.753840438847, 0.744731491356, + 0.737491553318, 0.717291473065, 0.715629958029, 0.701675695843, 0.695798790437, + 0.681716394464, 0.677915256402 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.7634866136, 15.6328013015, 17.7753080392, 20.3849274482, + 23.5230630809, 26.6159799854, 29.5849918302, 32.8058836317, 36.3551255626, + 39.6586540788, 43.2891715395, 47.0457162843, 50.5748804671, 53.7537486235, + 57.0903993284, 60.7800647992, 64.3406024724, 68.0650146493, 71.4916076649, + 74.644158805, 78.7362044271, 82.2255472682, 85.2770231354, 89.2792188034, + 92.0485965047, 95.1865655713, 100.489520051, 105.009655946, 107.950824978, + 110.271753676, 113.261963412, 118.208795089, 122.287660256, 124.55236204, + 127.332829028, 131.170118167, 135.350530522, 140.080667464, 144.511307162, + 148.724750804, 151.444112084, 153.090548725, 157.511181119, 162.245901639, + 165.149433932, 167.98337766, 172.702477093, 177.507799446, 179.946962191, + 183.257351475, 188.321095571, 192.72888715, 195.711202161, 196.953201763, + 197.266268454, 202.700189394, 210.834895833, 214.863790761, 217.364080113, + 220.279566498, 224.268378227, 229.553978798, 232.458535806, 236.224001452, + 240.493726516, 242.337334893, 246.205383427, 250.287531857, 253.93172923, + 258.336015088, 261.914067782, 263.839852462, 264.876745306, 272.133704557, + 279.511304302, 281.397140688, 283.863199301, 286.40218059, 288.881228885, + 289.99609375, 300.336538462, 314.301306801, 320.575617396, 329.097476964, + 346.924946684, 368.563318777, 389.730182927, 404.16101626, 422.366770833, + 447.345333473, 464.692652854, 487.898641496, 506.649168399, 524.882098391, + 546.92534949, 557.562667068, 562.589250605, 584.12579584, 619.859041826, + 644.181204029, 660.744730248, 673.853821998, 695.22987368, 712.959581843, + 732.745639535, 754.419642857, 764.554258242, 777.678365385, 790.630288462, + 802.149038462, 821.482142857, 836.884920635, 847.887152778, 861.859375, + 875.921875, 888.521875, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.93), + etaMin = cms.double(1.83), + l1tCalibrationFactors = cms.vdouble( + 1.2075501775, 1.2075501775, 1.2075501775, 1.2075501775, 1.2075501775, + 1.2075501775, 1.2075501775, 1.20133355605, 1.19530708945, 1.1903774073, + 1.18470031348, 1.17981636403, 1.17466612498, 1.17013138415, 1.16570649395, + 1.16262296754, 1.15961379695, 1.1567798582, 1.15461512052, 1.15166019705, + 1.15059363693, 1.14781934175, 1.1468890285, 1.14439368656, 1.1401875604, + 1.13984882528, 1.13572729329, 1.13486154989, 1.13303702319, 1.12825443539, + 1.12724956215, 1.12465904179, 1.12162552813, 1.12147167362, 1.12055227448, + 1.11576929423, 1.11397531519, 1.11305961492, 1.10776036523, 1.10688504821, + 1.1049969562, 1.10395365658, 1.1004820424, 1.10020941695, 1.09364390424, + 1.09317323804, 1.09263618254, 1.08730605402, 1.08462991715, 1.08438007388, + 1.08214472159, 1.08209582567, 1.07713798478, 1.06280435801, 1.06125183068, + 1.06112183264, 1.06039791195, 1.06008868406, 1.05691560019, 1.0565842396, + 1.05634385411, 1.05575454385, 1.0537213763, 1.05344424321, 1.05312642297, + 1.05270479117, 1.05177723394, 1.05040270302, 1.04838541277, 1.04816948872, + 1.04767671633, 1.04649582963, 1.04631815897, 1.04547121251, 1.04486369542, + 1.04344015331, 1.04328394209, 1.04310709983, 1.04295802389, 1.03991666934, + 1.03829941334, 1.03817848315, 1.0372602046, 1.03498791406, 1.02967074065, + 1.02645904098, 1.02456252935, 1.02028571289, 1.01532132205, 1.00708648081, + 1.00557866056, 1.00227921875, 0.998369858075, 0.990255818748, 0.989183194449, + 0.98548744733, 0.978667289452, 0.977142200594, 0.967587781957, 0.966301554612, + 0.96164692143, 0.961353555121, 0.959804877641, 0.958874784431, 0.956874521799, + 0.948352201413, 0.947703706372, 0.947132960055, 0.945451349391, 0.944535445859, + 0.94373366214, 0.934967051729, 0.93335906675, 0.927113925719, 0.924216523587, + 0.919275945565 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.1553016676, 16.2664390716, 18.850560812, 21.4525843899, + 24.2848068147, 27.54630177, 31.3476954248, 35.0449062766, 38.2354125974, + 41.5290770126, 45.0155066897, 48.5944191332, 52.3320360328, 56.1346401629, + 59.6217196328, 62.7708486989, 66.1328716295, 69.3619089373, 73.3173162311, + 76.8510115304, 81.249183365, 85.3190875777, 88.0806578066, 93.4830038621, + 97.1468149946, 100.742431072, 104.762891529, 106.931635726, 112.25791923, + 116.923444288, 119.821848062, 124.355627455, 126.925104108, 127.79030074, + 132.387237762, 137.68921183, 139.873602642, 144.883745186, 149.86133302, + 152.089037698, 154.452160494, 158.091829657, 161.110224719, 166.622746479, + 172.294917532, 173.107285995, 177.837079228, 184.291279354, 186.650039706, + 188.653464364, 190.494896589, 194.531045752, 199.945492662, 205.024103774, + 208.991538462, 211.005099068, 213.441287879, 221.652661483, 229.916224533, + 231.264415323, 233.220857558, 239.404722354, 244.852465986, 246.255380037, + 247.999025468, 251.180445151, 256.608823529, 264.606818182, 269.872790404, + 271.543913399, 275.490441176, 278.693951613, 281.110023041, 284.53968254, + 289.328968254, 293.054064039, 293.839412025, 294.607934858, 302.131045519, + 313.116159539, 317.21484375, 319.665322581, 327.188760081, 345.084895833, + 365.196180556, 377.241463795, 391.79831766, 413.58930336, 444.713405239, + 467.686831812, 479.022469636, 496.020996641, 524.372458629, 546.03482906, + 557.278761808, 582.075514874, 601.753804348, 627.879545455, 653.442045455, + 667.450735294, 679.118235294, 683.461818182, 689.306818182, 696.216666667, + 721.029166667, 742.654166667, 745.529166667, 750.840277778, 756.965277778, + 761.015625, 783.578125, 808.041666667, 826.55952381, 848.117857143, + 866.6, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.043), + etaMin = cms.double(1.93), + l1tCalibrationFactors = cms.vdouble( + 1.2042309243, 1.2042309243, 1.2042309243, 1.2042309243, 1.2042309243, + 1.2042309243, 1.2036640024, 1.19524481612, 1.18325954566, 1.17368692683, + 1.16506130726, 1.15388106163, 1.14598632447, 1.13983893861, 1.13173200239, + 1.12546585042, 1.11919443175, 1.11241946353, 1.10679191353, 1.10277852463, + 1.11490627601, 1.11335120331, 1.11096141728, 1.1100935654, 1.10764450009, + 1.10624839945, 1.10429555791, 1.10156835063, 1.09955747398, 1.09789752189, + 1.09641249383, 1.09381679019, 1.09212245543, 1.09111912485, 1.08977982989, + 1.08630997483, 1.08401046173, 1.08083468198, 1.08080770014, 1.07993240947, + 1.07653702393, 1.07631811434, 1.07301303878, 1.07283358668, 1.07001112188, + 1.06715409534, 1.0655999551, 1.06480464407, 1.06127745288, 1.06095399959, + 1.0595969905, 0.984257510274, 0.984200634859, 0.98372269169, 0.98276381661, + 0.98266206775, 0.982472890781, 0.98197300242, 0.981690492126, 0.981228789794, + 0.980704442874, 0.980684026587, 0.979800102722, 0.979593434658, 0.979151401752, + 0.978667991619, 0.978456340039, 0.97838130467, 0.977422760752, 0.977354967521, + 0.977290768842, 0.977152281231, 0.976393403414, 0.976162511198, 0.975933603237, + 0.975769076539, 0.975703772172, 0.975379887997, 0.974640979874, 0.974534324589, + 0.973636260808, 0.972439925244, 0.972186024592, 0.97169810365, 0.969210446816, + 0.967673923531, 0.964817552461, 0.963418429289, 0.961590054487, 0.960059426291, + 0.957463919289, 0.957075193291, 0.95355179413, 0.952130925316, 0.949695436177, + 0.948922486673, 0.94612010092, 0.945132832372, 0.943722360083, 0.942093889524, + 0.940692364001, 0.939819564434, 0.936657595081, 0.935648076104, 0.933290760148, + 0.932922673767, 0.932487858551, 0.929229710674, 0.928871233299, 0.927770557843, + 0.924947493401, 0.924880802499, 0.924463019827, 0.921416182608, 0.918224719831, + 0.917399847078 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.774327423, 16.7467039494, 19.3220519597, 21.9668153648, + 24.8434771127, 28.3182127012, 31.5913687934, 35.0924952038, 38.9535281293, + 42.3917608897, 46.3696188172, 50.4144256002, 53.5857932878, 57.0301456325, + 60.7164859952, 64.1946035834, 68.1349803463, 72.2419874509, 75.7665473847, + 79.6012507013, 83.4598320886, 87.4613764276, 90.7658249374, 94.1304045289, + 98.0308235506, 101.427888328, 106.175187062, 110.981354838, 114.704931512, + 117.895103426, 122.034473158, 126.386157219, 129.122586641, 131.498874511, + 136.377129554, 142.229400591, 147.783370605, 151.032154249, 151.947391963, + 156.279435613, 159.945666315, 163.520289331, 167.054887874, 170.099940784, + 175.861043525, 180.335596527, 182.718808205, 187.103422578, 191.009398855, + 192.714008621, 197.379894037, 200.976387994, 203.864313553, 211.622877431, + 217.350058724, 218.921006636, 222.641837284, 226.866651348, 230.885267621, + 236.209758809, 239.151383574, 244.034660107, 249.923663227, 253.426533491, + 258.423761872, 262.176971925, 263.725030637, 269.306175595, 274.848214286, + 275.560947205, 276.655417251, 281.501031508, 286.845614257, 289.328453717, + 291.452931141, 292.693978162, 294.795527307, 300.534417344, 305.100309876, + 310.525614754, 321.835, 329.666018519, 333.671723647, 349.739316239, + 371.469175627, 395.190026541, 418.168941192, 435.596858199, 453.734879032, + 476.015277778, 492.129607046, 513.254389509, 539.952560241, 560.776209677, + 578.101209677, 597.407386364, 617.870847902, 630.818223443, 647.22797619, + 663.589417989, 675.87037037, 697.657407407, 720.182705026, 738.363016917, + 753.079706478, 757.415232794, 777.356578947, 796.885714286, 804.764880952, + 825.952380952, 841.556547619, 844.172619048, 862.880952381, 896.566666667, + 918.254166667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.172), + etaMin = cms.double(2.043), + l1tCalibrationFactors = cms.vdouble( + 1.2157935489, 1.2157935489, 1.2157935489, 1.2157935489, 1.2157935489, + 1.2157935489, 1.2131670386, 1.19252693905, 1.16613128795, 1.14891680382, + 1.13585884458, 1.11956017752, 1.10976982201, 1.10285725152, 1.09763906728, + 1.09602675736, 1.09773310507, 1.10102752345, 1.10591456862, 1.12056604454, + 1.09024831793, 1.0866258585, 1.08397193938, 1.08121891991, 1.07860560959, + 1.07354275531, 1.06972453158, 1.06917647609, 1.06336781577, 1.06252684817, + 1.05814049533, 1.05375938581, 1.04843010939, 1.04614697071, 1.04491970624, + 1.0411245951, 1.03745844809, 1.03489726734, 1.03360755376, 1.02882103269, + 1.02188125281, 1.02178616775, 1.01439480032, 1.01409606035, 1.01341880324, + 1.00827791468, 1.00542136086, 0.998511182345, 0.994448442251, 1.04477728911, + 1.04421248637, 1.04392479755, 1.04274630788, 1.04272994051, 1.04168658376, + 1.04135777469, 1.03965139823, 1.03957385755, 1.03896194302, 1.03828897643, + 1.03719007928, 1.03617088577, 1.03571879048, 1.03499873182, 1.0346382378, + 1.03177687804, 1.03176555727, 1.03159294818, 1.03108256137, 1.03015878893, + 1.02995488679, 1.02899017097, 1.02649853162, 1.02628818447, 1.02560062889, + 1.02505812439, 1.02504298404, 1.02401015146, 1.0238655626, 1.0238353063, + 1.02376716185, 1.02349302901, 1.01992907169, 1.01735550261, 1.01183126604, + 1.00598039495, 1.00503085618, 1.00325705789, 0.997956898494, 0.994701643546, + 0.994616268066, 0.988149085989, 0.986924650126, 0.984155654984, 0.978759764732, + 0.97776008685, 0.972914253171, 0.9716143493, 0.961266323588, 0.959651973391, + 0.957930376835, 0.957798054327, 0.953759936411, 0.952946229034, 0.949084679396, + 0.947113174765, 0.943899628142, 0.939131455009, 0.934865194838, 0.930798559139, + 0.928294697889, 0.902970907566, 0.902468994604 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.5720423979, 16.5824805021, 19.0934145429, 22.0784007761, + 25.1490151046, 28.497403927, 31.9362849912, 35.7593269258, 39.7393275631, + 42.9558645787, 46.7338248946, 50.7967533731, 54.2877761449, 58.0901293351, + 62.2284810254, 66.2495543993, 69.6790156787, 72.5465787405, 76.7862415377, + 81.6681494869, 85.8291480655, 89.4707953394, 92.6079807459, 95.7216043282, + 100.175428087, 105.328360356, 107.861739865, 111.55, 115.408212058, + 118.441180371, 123.528191168, 129.162300109, 133.579135466, 135.615923077, + 138.529979381, 142.85911125, 146.472298535, 148.706644144, 152.232164977, + 159.0359375, 163.117669753, 167.461419753, 171.923333333, 172.489621212, + 175.865395022, 180.505628882, 186.17243083, 192.539079823, 197.591920732, + 201.834787736, 204.170204403, 208.186827957, 211.46016129, 214.363295455, + 218.122369529, 223.697798564, 228.584873138, 230.473648649, 233.993604651, + 238.847658705, 244.6502079, 248.680831266, 251.891969086, 254.852163462, + 263.678492485, 271.548254836, 272.052134146, 273.923214286, 277.852120536, + 280.94140625, 284.142857143, 293.611607143, 301.01375, 303.473571429, + 306.843344156, 308.371022727, 311.241964286, 314.467532468, 314.946524064, + 315.216094771, 316.153769841, 326.668290043, 343.482159091, 365.66625, + 396.828571429, 415.458422175, 422.919055292, 442.298295455, 465.736013986, + 474.887733888, 492.838588589, 513.909920635, 524.85, 547.217857143, + 564.738636364, 580.752525253, 597.588888889, 629.498611111, 662.269764957, + 671.408653846, 676.4875, 687.9125, 701.204166667, 714.012121212, + 729.991883117, 744.196428571, 766.0625, 790.8125, 813.640625, + 831.640625, 907.875, 978.625, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.322), + etaMin = cms.double(2.172), + l1tCalibrationFactors = cms.vdouble( + 1.27175839461, 1.27175839461, 1.27175839461, 1.27175839461, 1.27175839461, + 1.27175839461, 1.27175839461, 1.25215773409, 1.22958887764, 1.20467102121, + 1.18331005838, 1.16118964804, 1.14659600623, 1.13536255747, 1.12227110191, + 1.11136706147, 1.10575962446, 1.10196633526, 1.10080589724, 1.10257943107, + 1.0895166152, 1.08712811776, 1.08506891006, 1.08334188412, 1.07944257634, + 1.07931511022, 1.07630099342, 1.07361351611, 1.07140563288, 1.06922569703, + 1.06658310837, 1.06465192235, 1.06420654338, 1.06188411668, 1.05901973065, + 1.05528665699, 1.05300137798, 1.051994328, 1.05135284213, 1.04907816509, + 1.04583953913, 1.04219906506, 1.04019715537, 1.03946927527, 1.03680516372, + 1.03482472473, 1.03422230477, 1.0290706971, 1.02587253395, 1.04189050346, + 1.04062098834, 1.03935940395, 1.03844770162, 1.03554348618, 1.03344374769, + 1.03259309389, 1.03096624127, 1.03091664154, 1.0307058552, 1.02970686067, + 1.02797665766, 1.02297895874, 1.0225585419, 1.02255209792, 1.02200274202, + 1.01925034359, 1.01836955561, 1.01481130761, 1.01304746603, 1.0125551422, + 1.01159949029, 1.0101101956, 1.009911649, 1.00887160684, 1.00769969245, + 1.00576601578, 1.00232319829, 1.00190642009, 1.00161081362, 1.00153977401, + 0.999733338201, 0.991799358109, 0.990838727914, 0.988553070499, 0.979019416267, + 0.972596120228, 0.965820586276, 0.961922937946, 0.95947715169, 0.938855080551, + 0.935398002383, 0.930922826071, 0.917969221694, 0.913373875384, 0.905540501267, + 0.903909529794, 0.891888232267, 0.890539229272, 0.886803191571, 0.874256627624, + 0.868131613929, 0.865423598775, 0.854669607728, 0.85255321933, 0.849689435029, + 0.842563274095, 0.832262530564, 0.825380568291, 0.819209002123, 0.812060641311, + 0.807167788133, 0.799199511816, 0.777177232542, 0.768504480086 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.8611374939, 16.0113120701, 18.5774916373, 21.1920554612, + 24.1752187507, 27.0444032168, 30.4197485207, 34.1362264284, 37.630227696, + 41.3788405138, 45.3845868193, 49.2170575261, 52.3470983693, 55.8753769944, + 60.2185652965, 64.1891998797, 67.746979597, 71.9226859348, 76.0177144871, + 79.2426623888, 82.8780435994, 86.9768023638, 90.4659856164, 95.6509032122, + 99.3617550597, 102.256863911, 107.511137313, 112.022430505, 116.066001586, + 120.510173128, 124.725110598, 126.915221292, 129.465877728, 134.245757114, + 140.325610632, 145.871791188, 148.905819269, 150.425018615, 153.112392871, + 158.193147611, 164.532545265, 169.732253692, 172.247876799, 175.373748474, + 179.653909058, 182.034128838, 187.336722065, 195.031408476, 200.278290307, + 204.364974552, 207.927915687, 210.987176147, 216.358711473, 223.402604167, + 227.555769231, 231.043269231, 233.403153153, 233.769689611, 235.47265625, + 239.314453125, 248.785087719, 256.411981659, 257.012858852, 257.795239106, + 262.443004352, 267.557315064, 273.805992313, 281.29771353, 284.473639456, + 286.511904762, 289.953571429, 292.329487179, 294.073005698, 297.186700337, + 301.558333333, 309.126638002, 314.559657218, 315.562456446, 316.078571429, + 318.721428571, 332.432674772, 344.953309693, 349.522996357, 366.160632113, + 388.622678491, 407.202214452, 422.226483586, 431.155916807, 463.627740925, + 497.523125651, 508.689085624, 533.222976718, 557.926026958, 575.421506352, + 588.744137931, 607.961964286, 626.782873377, 633.940909091, 656.861363636, + 683.14469697, 695.578645833, 714.528645833, 732.645833333, 739.65625, + 753.71875, 778.25, 802.4375, 820.8125, 839.5625, + 856.5125, 874.616666667, 916.833333333, 960.041666667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.5), + etaMin = cms.double(2.322), + l1tCalibrationFactors = cms.vdouble( + 1.52098890483, 1.52098890483, 1.52098890483, 1.52098890483, 1.52098890483, + 1.52098890483, 1.52098890483, 1.52098890483, 1.51895546826, 1.46136782786, + 1.41340180478, 1.35573588879, 1.31548728533, 1.2660316752, 1.24305402297, + 1.20796926099, 1.18988784161, 1.17884713219, 1.17592060458, 1.17998100319, + 1.20630819302, 1.20702059628, 1.16461440063, 1.1627843218, 1.15462180385, + 1.14998530406, 1.14403998714, 1.14283512108, 1.13526703393, 1.13059271226, + 1.12854192667, 1.11889321097, 1.11775202034, 1.1054171342, 1.10277511289, + 1.09594837096, 1.0913309999, 1.08820170399, 1.07970532444, 1.07452255879, + 1.06815095029, 1.0610340945, 1.05826841645, 1.05159167139, 1.04828178929, + 1.04695109923, 1.040946783, 1.03753240119, 1.03143269275, 1.01975938867, + 1.01717478622, 1.01699522985, 1.01689154612, 1.01658655876, 1.01575891227, + 1.01298629449, 1.01236640909, 1.01165960029, 1.00992588245, 1.00974364973, + 1.0092096141, 1.0091517754, 1.00820583884, 1.00643626079, 1.00571818371, + 1.00528017329, 1.0050951432, 1.00493058446, 1.00347528251, 1.00215164281, + 1.00202838906, 0.999594624288, 0.998682402719, 0.99802438797, 0.997853420087, + 0.997793406637, 0.997477519847, 0.9948799271, 0.993917034924, 0.992918147191, + 0.992749818395, 0.99256051789, 0.992049160684, 0.990263478702, 0.984112026821, + 0.978946943439, 0.977244896076, 0.970657922256, 0.966699455759, 0.963014448433, + 0.957912516057, 0.956213356451, 0.947912641797, 0.944214889997, 0.939896603289, + 0.932799639357, 0.930035262422, 0.920920793695, 0.917125860352, 0.915876952158, + 0.915867590189, 0.915004674903, 0.901780409368, 0.896212297563, 0.891688206722, + 0.889600164796, 0.887412692301, 0.860715584811 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.3465412359, 13.9372836782, 15.8932447157, 17.9567741799, + 20.2201934345, 22.1859464929, 24.7687444772, 28.3358498854, 31.553573754, + 34.3379949843, 37.4578756454, 40.6769264758, 44.1823241936, 47.422092709, + 50.849889017, 54.8346440435, 58.3587018402, 61.9463616926, 65.3145012856, + 70.0209069248, 73.199696694, 77.0267305735, 81.5382115009, 85.589096942, + 90.7776736182, 95.0674221357, 97.9660252463, 101.522481012, 106.485414746, + 109.211696977, 113.95454215, 118.328647842, 123.791696575, 129.863165046, + 133.701694304, 138.34100796, 141.481418919, 146.194335938, 151.739706308, + 156.423718585, 161.891789075, 165.898056245, 169.725907519, 173.774372943, + 175.655608281, 178.629136668, 182.447370065, 186.304274383, 193.50925215, + 202.982657241, 208.175298886, 208.887454356, 209.914983165, 212.762784091, + 221.814990942, 230.344820487, 233.680550699, 239.816809117, 244.634116809, + 246.435042735, 247.923202614, 250.447012138, 257.274677579, 263.529431997, + 266.43620283, 268.002724359, 268.881701632, 272.954545455, 279.941686603, + 283.579635863, 290.008791832, 298.421663279, 302.369735663, 304.45406106, + 305.034821429, 305.979953917, 313.305366005, 322.257554945, 327.190092166, + 330.124844913, 331.024038462, 332.785714286, 338.561199723, 358.517672937, + 386.971033654, 404.237179487, 425.078409091, 451.592992424, 470.811111111, + 492.904265873, 510.004369301, 535.147226444, 565.315178571, 585.470043103, + 614.171605603, 638.966145833, 668.833333333, 701.291666667, 713.973484848, + 717.137175325, 719.330357143, 754.75, 802.0, 827.375, + 844.0, 854.75, 927.375, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.964), + etaMin = cms.double(2.5), + l1tCalibrationFactors = cms.vdouble( + 1.3918486761, 1.3918486761, 1.3918486761, 1.3918486761, 1.3918486761, + 1.3918486761, 1.3918486761, 1.3918486761, 1.36703547997, 1.31736470956, + 1.26434084266, 1.21404966543, 1.17272244317, 1.12964733287, 1.09922572696, + 1.07489413214, 1.04575625838, 1.03614621508, 1.0189580814, 0.986964784102, + 0.982458030641, 0.978031042361, 0.974273380329, 0.971371999377, 0.96837697535, + 0.964571949947, 0.959066324787, 0.954816960611, 0.951051733139, 0.947034095561, + 0.943943667589, 0.938609460085, 0.937019169869, 0.932068478426, 0.928858927549, + 0.926316705707, 0.920620507742, 0.917363382195, 0.913676796538, 0.913073182723, + 0.90574749251, 0.900207435866, 0.894934151475, 0.910472072588, 0.910358697956, + 0.909635081259, 0.908573398308, 0.90826193476, 0.907612137329, 0.905710315215, + 0.90469219147, 0.90441181284, 0.904047558298, 0.903685516587, 0.902896006391, + 0.900438172704, 0.900210427796, 0.899854579435, 0.899045004048, 0.898129764354, + 0.897823164358, 0.89675805585, 0.895325000445, 0.893395983258, 0.893215118042, + 0.893140210389, 0.891265616092, 0.890965233319, 0.890412121542, 0.890372676695, + 0.888807907347, 0.887953767739, 0.887495255962, 0.886434140358, 0.885443967903, + 0.883245786048, 0.882202319982, 0.881358584844, 0.881034970476, 0.880334968579, + 0.878047857587, 0.877560128555, 0.875956745243, 0.875620944741, 0.870531125372, + 0.866385311313, 0.861266229338, 0.859959502058, 0.853992060055, 0.848393476744, + 0.84511718603, 0.843056740086, 0.839164575537, 0.837340755606, 0.835467151152, + 0.83475709971, 0.816664565995, 0.811494584033, 0.810888989616, 0.808659504987, + 0.802552720798, 0.797094894576, 0.794851952293, 0.792773492445 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.9280984166, 15.5184273833, 16.4023808425, 18.0557795913, + 20.1991457662, 22.7308290002, 25.8917360906, 29.6875539525, 33.7956696286, + 38.015162488, 42.6730248745, 47.2635724398, 52.0970691846, 56.9054288356, + 61.1308154962, 66.3128316967, 70.8061386875, 75.9997818499, 81.2539330218, + 85.4687663551, 91.0077784091, 96.0823460483, 100.211021404, 103.866853328, + 108.082954136, 113.855653548, 119.903847585, 124.872977098, 129.69843373, + 134.105507709, 139.328868627, 143.622128658, 147.677604774, 152.737039207, + 156.303197637, 161.411102918, 166.962255873, 171.267428462, 173.927396399, + 178.843646708, 186.820542503, 193.524925513, 199.719612493, 202.960729245, + 205.293021006, 210.267791371, 214.09408939, 216.772660819, 223.882795699, + 232.019278639, 235.637579431, 237.433861643, 239.457699535, 242.666520144, + 251.715303709, 259.198717949, 260.824911348, 264.072386095, 268.878615098, + 272.283293909, 276.105584931, 283.066764706, 292.435241935, 298.314468126, + 299.027183937, 304.459507042, 310.520120724, 312.898399015, 314.549568966, + 319.019741379, 325.760075758, 329.41780303, 333.652272727, 339.3682247, + 348.252632734, 357.285544397, 362.544265328, 365.797106237, 368.649431818, + 376.973076923, 384.70521978, 390.532142857, 395.935714286, 411.054304029, + 436.789566755, 462.60637027, 480.512006162, 500.781612903, 533.010555556, + 557.740555556, 572.611470588, 589.198529412, 605.12622549, 615.429166667, + 622.628571429, 675.022321429, 739.84375, 755.9375, 763.8375, + 787.066666667, 819.291666667, 840.75, 852.791666667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(3.489), + etaMin = cms.double(2.964), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 26.2286936937, 25.0883854167, 21.5503612231, 19.2925423089, + 21.3457232423, 22.8334014207, 23.9319267237, 26.6239039363, 30.3986741142, + 33.7250755974, 37.8195972328, 42.1978424806, 52.2604512363, 80.2692022114, + 122.67241995, 166.87206295, 199.54597288, 226.44949301, 245.655374, + 257.034237337, 257.866298241, 287.3217783, 347.484176974, 307.774717514, + 272.791666667, 304.614583333, 366.880208333, 406.911458333, 296.145833333, + 209.0, 217.875, 211.25, 178.5, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(4.191), + etaMin = cms.double(3.489), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 22.5440519958, 20.5700369268, 18.940228544, 19.656022303, + 21.0931801845, 23.113990869, 26.3227763633, 30.3817638115, 35.043540285, + 39.4982579153, 43.4506655731, 48.6407605324, 59.5995676838, 82.7690755527, + 114.280107948, 142.242281862, 162.02662341, 183.956841939, 210.824209207, + 229.926842684, 227.643518519, 238.016534392, 247.125, 298.946428571, + 271.65625, 243.03125, 326.625, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(5.191), + etaMin = cms.double(4.191), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 20.1275528907, 18.8347289263, 19.1060971818, 20.3123157733, + 21.92154214, 24.441478902, 27.4055129042, 30.8574386517, 34.6682463198, + 39.247933023, 43.9824249801, 47.9520354357, 57.1837291686, 77.2409768212, + 102.910275424, 131.248104371, 147.631578947, 175.0, 199.875, + float('inf') + ) + ) +) + +Phase1L1TJetCalibrator = cms.EDProducer('Phase1L1TJetCalibrator', + inputCollectionTag = cms.InputTag("Phase1L1TJetProducer", "UncalibratedPhase1L1TJetFromPfCandidates", ""), + absEtaBinning = cms.vdouble([p.etaMin.value() for p in calibration] + [calibration[-1].etaMax.value()]), + calibration = calibration, + outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") +) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index 93e5841d8bfcd..345d0f6217454 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -1,6 +1,8 @@ import FWCore.ParameterSet.Config as cms from math import pi +from Phase1L1TJets_sincosLUT_cff import sinPhi, cosPhi + caloEtaSegmentation = cms.vdouble( -5.0, -4.917, -4.833, -4.75, -4.667, -4.583, -4.5, -4.417, -4.333, -4.25, -4.167, -4.083, -4.0, -3.917, -3.833, -3.75, -3.667, -3.583, -3.5, -3.417, @@ -22,8 +24,19 @@ phiUp = cms.double(pi), jetIEtaSize = cms.uint32(7), jetIPhiSize = cms.uint32(7), + trimmedGrid = cms.bool(False), seedPtThreshold = cms.double(5), # GeV puSubtraction = cms.bool(False), + ptlsb = cms.double(0.25), + philsb = cms.double(0.0043633231), + etalsb = cms.double(0.0043633231), outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates"), - vetoZeroPt = cms.bool(True) + vetoZeroPt = cms.bool(True), + etaRegions = cms.vdouble( -5., -4.5, -4., -3.5, -3., -2.5, -1.5, -0.75, 0, 0.75, 1.5, 2.5, 3., 3.5, 4., 4.5, 5. ), + phiRegions = cms.vdouble( -3.5, -2.8, -2.1, -1.4, -0.7, 0, 0.7, 1.4, 2.1, 2.8, 3.5 ),#, 4.2, 4.9, 5.6, 6.3 ), + maxInputsPerRegion = cms.uint32( 18 ), + sinPhi = sinPhi, + cosPhi = cosPhi, + metAbsEtaCut = cms.double(3), + metHFAbsEtaCut = cms.double(5), ) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py new file mode 100644 index 0000000000000..d48f3cd5e4448 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +from Phase1L1TJets_sincosLUT_cff import sinPhi, cosPhi + +Phase1L1TJetSumsProducer = cms.EDProducer('Phase1L1TJetSumsProducer', + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates"), + nBinsPhi = cms.uint32(72), + phiLow = cms.double(-pi), + phiUp = cms.double(pi), + sinPhi = sinPhi, + cosPhi = cosPhi, + htPtThreshold = cms.double(30), + htAbsEtaCut = cms.double(2.4), + mhtPtThreshold = cms.double(30), + mhtAbsEtaCut = cms.double(2.4), + ptlsb = cms.double(0.25), + outputCollectionName = cms.string("Sums"), +) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py new file mode 100644 index 0000000000000..c0f2891eacc5b --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer +from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_9x9Jets_cfi import Phase1L1TJetCalibrator as Phase1L1TJetCalibrator9x9 +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer + +Phase1L1TJetProducer9x9 = Phase1L1TJetProducer.clone( + jetIEtaSize = cms.uint32(9), + jetIPhiSize = cms.uint32(9), + outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates") +) + +Phase1L1TJetCalibrator9x9.inputCollectionTag = cms.InputTag("Phase1L1TJetProducer9x9", "UncalibratedPhase1L1TJetFromPfCandidates", "") +Phase1L1TJetCalibrator9x9.outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") + +Phase1L1TJetSumsProducer9x9 = Phase1L1TJetSumsProducer.clone( + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator9x9", "Phase1L1TJetFromPfCandidates"), +) + +Phase1L1TJetsSequence9x9 = cms.Sequence( + Phase1L1TJetProducer9x9 + + Phase1L1TJetCalibrator9x9 + + Phase1L1TJetSumsProducer9x9 +) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py new file mode 100644 index 0000000000000..6348fdc643d0c --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer +from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_9x9Jets_cfi import Phase1L1TJetCalibrator as Phase1L1TJetCalibrator9x9 +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer + +Phase1L1TJetProducer9x9trimmed = Phase1L1TJetProducer.clone( + jetIEtaSize = cms.uint32(9), + jetIPhiSize = cms.uint32(9), + trimmedGrid = cms.bool(True), + outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates") +) + +Phase1L1TJetCalibrator9x9trimmed = Phase1L1TJetCalibrator9x9.clone( + inputCollectionTag = cms.InputTag("Phase1L1TJetProducer9x9trimmed", "UncalibratedPhase1L1TJetFromPfCandidates", ""), + outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") + ) + +Phase1L1TJetSumsProducer9x9trimmed = Phase1L1TJetSumsProducer.clone( + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator9x9trimmed", "Phase1L1TJetFromPfCandidates"), +) + +Phase1L1TJetsSequence9x9trimmed = cms.Sequence( + Phase1L1TJetProducer9x9trimmed + + Phase1L1TJetCalibrator9x9trimmed + + Phase1L1TJetSumsProducer9x9trimmed +) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py index 054ecd7280c0d..cc6bed4bd06ab 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py @@ -2,8 +2,10 @@ from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_cfi import Phase1L1TJetCalibrator +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer Phase1L1TJetsSequence = cms.Sequence( Phase1L1TJetProducer + - Phase1L1TJetCalibrator + Phase1L1TJetCalibrator + + Phase1L1TJetSumsProducer ) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py new file mode 100644 index 0000000000000..f71656b1d13b7 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +sinPhi = cms.vdouble( + -0.0353352962792, -0.122533930843, -0.208795013406, -0.293458528818, -0.375876685504, -0.455418871948, -0.531476481737, -0.603467570232, -0.670841307236, -0.733082191603, -0.789713995522, -0.840303408309, -0.884463351833, -0.921855942186, -0.952195074957, -0.975248614326, -0.990840169216, -0.998850442928, -0.999218145922, -0.99194046477, -0.977073083675, -0.954729758418, -0.925081445966, -0.888354996422, -0.844831417308, -0.794843723474, -0.738774389082, -0.677052421152, -0.610150077076, -0.538579251202, -0.462887558141, -0.383654142772, -0.301485248985, -0.217009581095, -0.130873493387, -0.0437360446299, 0.0437360446299, 0.130873493387, 0.217009581095, 0.301485248985, 0.383654142772, 0.462887558141, 0.538579251202, 0.610150077076, 0.677052421152, 0.738774389082, 0.794843723474, 0.844831417308, 0.888354996422, 0.925081445966, 0.954729758418, 0.977073083675, 0.99194046477, 0.999218145922, 0.998850442928, 0.990840169216, 0.975248614326, 0.952195074957, 0.921855942186, 0.884463351833, 0.840303408309, 0.789713995522, 0.733082191603, 0.670841307236, 0.603467570232, 0.531476481737, 0.455418871948, 0.375876685504, 0.293458528818, 0.208795013406, 0.122533930843, 0.0353352962792 ) + +cosPhi = cms.vdouble( -0.999375513427, -0.992464324695, -0.977959427777, -0.955971804952, -0.926669691581, -0.890277288868, -0.847073048421, -0.797387541713, -0.741600930761, -0.680140059366, -0.613475187173, -0.542116391547, -0.466609664777, -0.387532736497, -0.305490653258, -0.2211111491, -0.135039842524, -0.0479352966351, 0.039536019772, 0.126704831606, 0.212904178348, 0.297474517214, 0.379768769555, 0.459157271892, 0.535032593708, 0.606814185113, 0.673952818851, 0.735934792636, 0.792285859677, 0.842574857312, 0.886417005995, 0.923476853383, 0.953470841004, 0.976169473869, 0.991399076421, 0.999043121392, 0.999043121392, 0.991399076421, 0.976169473869, 0.953470841004, 0.923476853383, 0.886417005995, 0.842574857312, 0.792285859677, 0.735934792636, 0.673952818851, 0.606814185113, 0.535032593708, 0.459157271892, 0.379768769555, 0.297474517214, 0.212904178348, 0.126704831606, 0.039536019772, -0.0479352966351, -0.135039842524, -0.2211111491, -0.305490653258, -0.387532736497, -0.466609664777, -0.542116391547, -0.613475187173, -0.680140059366, -0.741600930761, -0.797387541713, -0.847073048421, -0.890277288868, -0.926669691581, -0.955971804952, -0.977959427777, -0.992464324695, -0.999375513427 ) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py new file mode 100644 index 0000000000000..498aa095642cc --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py @@ -0,0 +1,102 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.StandardSequences.Eras import eras + +process = cms.Process('REPR',eras.Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D41_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.MessageLogger.categories = cms.untracked.vstring('L1CaloJets', 'FwkReport') +process.MessageLogger.cerr.FwkReport = cms.untracked.PSet( + reportEvery = cms.untracked.int32(1) +) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) ) +#process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.source = cms.Source("PoolSource", + # dasgoclient --query="dataset dataset=/VBFHToTauTau*/Phase2HLTTDR*/FEVT" + #fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/PhaseIIMTDTDRAutumn18DR/VBFHToTauTau_M125_14TeV_powheg_pythia8/FEVT/PU200_103X_upgrade2023_realistic_v2-v1/280000/EFC8271A-8026-6A43-AF18-4CB7609B3348.root'), + fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/Phase2HLTTDRSummer20ReRECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/FEVT/PU200_111X_mcRun4_realistic_T15_v1-v1/120000/084C8B72-BC64-DE46-801F-D971D5A34F62.root'), + inputCommands = cms.untracked.vstring( + "keep *", + "drop l1tEMTFHitExtras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHitExtras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFTrackExtras_simEmtfDigis__HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFHit2016s_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016s_simEmtfDigis__HLT", + ) +) + +# All this stuff just runs the various EG algorithms that we are studying + +# ---- Global Tag : +from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, '103X_upgrade2023_realistic_v2', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +# Add HCAL Transcoder +process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') +process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') + + +process.L1simulation_step = cms.Path(process.SimL1Emulator) + + + +### Based on: L1Trigger/L1TCommon/test/reprocess_test_10_4_0_mtd5.py +### This code is a portion of what is imported and excludes the 'schedule' portion +### of the two lines below. It makes the test script run! +### from L1Trigger.Configuration.customiseUtils import L1TrackTriggerTracklet +### process = L1TrackTriggerTracklet(process) +process.load('L1Trigger.TrackFindingTracklet.L1HybridEmulationTracks_cff') +process.L1TrackTriggerTracklet_step = cms.Path(process.L1HybridTracksWithAssociators) + + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Load the L1CaloJet sequence designed to accompany process named "REPR" + +process.load('L1Trigger.L1CaloTrigger.L1CaloJets_cff') +process.l1CaloJets = cms.Path(process.l1CaloJetsSequence) + + + +process.Out = cms.OutputModule( "PoolOutputModule", + fileName = cms.untracked.string( "l1caloJetTest.root" ), + fastCloning = cms.untracked.bool( False ), + outputCommands = cms.untracked.vstring( + "keep *_L1EGammaClusterEmuProducer_*_*", + "keep *_L1CaloJetProducer_*_*", + "keep *_L1CaloJetHTTProducer_*_*", + "keep *_TriggerResults_*_*", + "keep *_simHcalTriggerPrimitiveDigis_*_*", + "keep *_EcalEBTrigPrimProducer_*_*", + "keep *_hgcalTowerProducer_*_*" + ) +) + +process.end = cms.EndPath( process.Out ) + + + +#dump_file = open("dump_file.py", "w") +#dump_file.write(process.dumpPython()) + + diff --git a/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py b/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py index 9ef8f23e607a6..8e606b032564a 100644 --- a/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py +++ b/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py @@ -18,18 +18,34 @@ #) ) +# Loads 7x7 sequence process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_cff') +# Load 9x9 sequence +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_9x9_cff') + +# Load trimmed 9x9 sequence +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_9x9trimmed_cff') + +# AK4 PF jets +process.load('L1Trigger.Phase2L1ParticleFlow.l1pfJetMet_cff') +process.l1PFJets = cms.Sequence( process.ak4PFL1Puppi + process.ak4PFL1PuppiCorrected ) + + process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('myOutputFile.root'), outputCommands = cms.untracked.vstring( "drop *", - "keep *_Phase1L1TJetProducer_*_*", + "keep *_Phase1L1TJetProducer*_*_*", + "keep *_Phase1L1TJetSumsProducer*_*_*", "keep *_ak4GenJetsNoNu_*_*", - "keep *_Phase1L1TJetCalibrator_*_*", + "keep *_Phase1L1TJetCalibrator*_*_*", + "keep *_ak4PFL1Puppi*_*_*", + "keep *_l1PFMetPuppi*_*_*", + "keep *_genMetTrue_*_*" ), ) -process.p = cms.Path(process.Phase1L1TJetsSequence) +process.p = cms.Path(process.Phase1L1TJetsSequence * process.Phase1L1TJetsSequence9x9 * process.Phase1L1TJetsSequence9x9trimmed * process.l1PFJets * process.l1PFMetPuppi ) process.e = cms.EndPath(process.out) diff --git a/L1Trigger/L1TGlobal/interface/GlobalScales.h b/L1Trigger/L1TGlobal/interface/GlobalScales.h index d401e7d3a570a..151a7d644c84f 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalScales.h +++ b/L1Trigger/L1TGlobal/interface/GlobalScales.h @@ -38,6 +38,12 @@ namespace l1t { double etStep; std::vector> etBins; + // Added displaced muons + double uptMin; + double uptMax; + double uptStep; + std::vector> uptBins; + double phiMin; double phiMax; double phiStep; @@ -67,6 +73,9 @@ namespace l1t { virtual void setLUT_DeltaEta(const std::string& lutName, std::vector lut, unsigned int precision); virtual void setLUT_DeltaPhi(const std::string& lutName, std::vector lut, unsigned int precision); virtual void setLUT_Pt(const std::string& lutName, std::vector lut, unsigned int precision); + virtual void setLUT_Upt(const std::string& lutName, + std::vector lut, + unsigned int precision); // Added for displaced muons virtual void setLUT_Cosh(const std::string& lutName, std::vector lut, unsigned int precision); virtual void setLUT_Cos(const std::string& lutName, std::vector lut, unsigned int precision); virtual void setLUT_Sin(const std::string& lutName, std::vector lut, unsigned int precision); @@ -90,6 +99,7 @@ namespace l1t { long long getLUT_DeltaEta(std::string lutName, int element) const; long long getLUT_DeltaPhi(std::string lutName, int element) const; long long getLUT_Pt(const std::string& lutName, int element) const; + long long getLUT_Upt(const std::string& lutName, int element) const; // Added for displaced muons long long getLUT_DeltaEta_Cosh(std::string lutName, int element) const; long long getLUT_DeltaPhi_Cos(std::string lutName, int element) const; long long getLUT_Cos(const std::string& lutName, int element) const; @@ -98,6 +108,7 @@ namespace l1t { unsigned int getPrec_DeltaEta(const std::string& lutName) const; unsigned int getPrec_DeltaPhi(const std::string& lutName) const; unsigned int getPrec_Pt(const std::string& lutName) const; + unsigned int getPrec_Upt(const std::string& lutName) const; // Added for displaced muons unsigned int getPrec_DeltaEta_Cosh(const std::string& lutName) const; unsigned int getPrec_DeltaPhi_Cos(const std::string& lutName) const; unsigned int getPrec_Cos(const std::string& lutName) const; @@ -131,6 +142,7 @@ namespace l1t { std::map> m_lut_DeltaEta; std::map> m_lut_DeltaPhi; std::map> m_lut_Pt; + std::map> m_lut_Upt; // Added for displaced muons std::map> m_lut_Cosh; std::map> m_lut_Cos; std::map> m_lut_Sin; @@ -139,6 +151,7 @@ namespace l1t { std::map m_Prec_DeltaEta; std::map m_Prec_DeltaPhi; std::map m_Prec_Pt; + std::map m_Prec_Upt; // Added for displaced muons std::map m_Prec_Cosh; std::map m_Prec_Cos; std::map m_Prec_Sin; diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index 099d05ec48eb1..6f632881570fd 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -12,6 +12,7 @@ * \new features: Vladimir Rekovic * - indexing * - correlations with overlap object removal + * - displaced muons by R.Cavanaugh * * $Date$ * $Revision$ @@ -297,7 +298,8 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) condition.getType() == esConditionType::CaloCaloCorrelation || condition.getType() == esConditionType::CaloEsumCorrelation || condition.getType() == esConditionType::InvariantMass || - condition.getType() == esConditionType::TransverseMass) { + condition.getType() == esConditionType::TransverseMass || + condition.getType() == esConditionType::InvariantMassUpt) { // Added for displaced muons parseCorrelation(condition, chipNr); //parse Externals @@ -588,6 +590,19 @@ bool l1t::TriggerMenuParser::parseScales(std::mapuptMin = scale.getMinimum(); + scaleParam->uptMax = scale.getMaximum(); + scaleParam->uptStep = scale.getStep(); + + //Get bin edges + const std::vector& binsV = scale.getBins(); + for (unsigned int i = 0; i < binsV.size(); i++) { + const esBin& bin = binsV.at(i); + std::pair binLimits(bin.minimum, bin.maximum); + scaleParam->uptBins.push_back(binLimits); + } + } break; case esScaleType::EtaScale: { scaleParam->etaMin = scale.getMinimum(); scaleParam->etaMax = scale.getMaximum(); @@ -664,6 +679,7 @@ bool l1t::TriggerMenuParser::parseScales(std::map scaleMap, + std::string lutpfx, + std::string obj1, + unsigned int prec) { + using namespace tmeventsetup; + + // First Delta Eta for this set + std::string scLabel1 = obj1; + scLabel1 += "-UPT"; + + //This LUT does not exist in L1 Menu file, don't fill it + if (scaleMap.find(scLabel1) == scaleMap.end()) + return; + + const esScale* scale1 = &scaleMap.find(scLabel1)->second; + + std::vector lut_pt; + getLut(lut_pt, scale1, prec); + + m_gtScales.setLUT_Upt(lutpfx + "_" + scLabel1, lut_pt, prec); +} + void l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS(std::map scaleMap, std::string obj1, std::string obj2, @@ -1300,6 +1339,11 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, relativeBx = corrMu->getBxOffset(); // Loop over the cuts for this object + int upperUnconstrainedPtInd = -1; // Added for displaced muons + int lowerUnconstrainedPtInd = 0; // Added for displaced muons + int upperImpactParameterInd = -1; // Added for displaced muons + int lowerImpactParameterInd = 0; // Added for displaced muons + int impactParameterLUT = 0xF; // Added for displaced muons, default is to ignore unless specified int upperThresholdInd = -1; int lowerThresholdInd = 0; int upperIndexInd = -1; @@ -1317,6 +1361,17 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, const esCut cut = cuts.at(kk); switch (cut.getCutType()) { + case esCutType::UnconstrainedPt: // Added for displaced muons + lowerUnconstrainedPtInd = cut.getMinimum().index; + upperUnconstrainedPtInd = cut.getMaximum().index; + break; + + case esCutType::ImpactParameter: // Added for displaced muons + lowerImpactParameterInd = cut.getMinimum().index; + upperImpactParameterInd = cut.getMaximum().index; + impactParameterLUT = l1tstr2int(cut.getData()); + break; + case esCutType::Threshold: lowerThresholdInd = cut.getMinimum().index; upperThresholdInd = cut.getMaximum().index; @@ -1383,6 +1438,12 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, } //end loop over cuts // Set the parameter cuts + objParameter[0].unconstrainedPtHigh = upperUnconstrainedPtInd; // Added for displacd muons + objParameter[0].unconstrainedPtLow = lowerUnconstrainedPtInd; // Added for displacd muons + objParameter[0].impactParameterHigh = upperImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLow = lowerImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLUT = impactParameterLUT; // Added for displacd muons + objParameter[0].ptHighThreshold = upperThresholdInd; objParameter[0].ptLowThreshold = lowerThresholdInd; @@ -2576,14 +2637,20 @@ bool l1t::TriggerMenuParser::parseCorrelation(tmeventsetup::esCondition corrCond // cutType = cutType | 0x8; if (corrCond.getType() == esConditionType::TransverseMass) { cutType = cutType | 0x10; - //std::cout << "CCLA running Transverse mass cutType= " << cutType << std::endl; } else { cutType = cutType | 0x8; - //std::cout << "CCLA running Invarient mass cutType= " << cutType << std::endl; } - } - } - } + } else if (cut.getCutType() == esCutType::MassUpt) { // Added for displaced muons + LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV + << " Max = " << maxV << " precMin = " << cut.getMinimum().index + << " precMax = " << cut.getMaximum().index << std::endl; + corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index)); + corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index)); + corrParameter.precMassCut = cut.getMinimum().index; + cutType = cutType | 0x40; // Note: 0x40 (MassUpt) is next available bit after 0x20 (TwoBodyPt) + } // Careful: cutType carries same info as esCutType, but is hard coded!! + } // This seems like a historical hack, which may be error prone. + } // cutType is defined here, for use later in CorrCondition.cc corrParameter.corrCutType = cutType; // Get the two objects that form the legs diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h index e851103687885..11538263d9827 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h @@ -15,6 +15,8 @@ * \author Vladimir Rekovic * - indexing * - correlations with overlap object removal + * \author R. Cavanaugh + * - displaced muons * * $Date$ * $Revision$ @@ -294,6 +296,12 @@ namespace l1t { std::string obj1, unsigned int prec); + // Parse LUT for Upt LUT in Mass calculation for displaced muons + void parseUpt_LUTS(std::map scaleMap, + std::string lutpfx, + std::string obj1, + unsigned int prec); + // Parse LUT for Delta Eta and Cosh void parseDeltaEta_Cosh_LUTS(std::map scaleMap, std::string obj1, diff --git a/L1Trigger/L1TGlobal/src/CorrCondition.cc b/L1Trigger/L1TGlobal/src/CorrCondition.cc index 864971ae73f7f..98f698b2e1151 100644 --- a/L1Trigger/L1TGlobal/src/CorrCondition.cc +++ b/L1Trigger/L1TGlobal/src/CorrCondition.cc @@ -321,6 +321,13 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { int etBin1 = 0; double et1Phy = 0.; + int uptIndex0 = 0; // Added displaced muons + int uptBin0 = 0; // Added displaced muons + double upt0Phy = 0.0; // Added displaced muons + int uptIndex1 = 0; // Added displaced muons + int uptBin1 = 0; // Added displaced muons + double upt1Phy = 0.0; // Added displaced muons + int chrg0 = -1; int chrg1 = -1; @@ -370,13 +377,14 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwEtaAtVtx(); etIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPt(); + uptIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPtUnconstrained(); // Added for displaced muons chrg0 = (candMuVec->at(cond0bx, obj0Index))->hwCharge(); int etaBin0 = etaIndex0; if (etaBin0 < 0) etaBin0 = m_gtScales->getMUScales().etaBins.size() + etaBin0; //twos complement - // LogDebug("L1TGlobal") << "Muon phi" << phiIndex0 << " eta " << etaIndex0 << " etaBin0 = " << etaBin0 << " et " << etIndex0 << std::endl; etBin0 = etIndex0; + uptBin0 = uptIndex0; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin0 >= ssize) { etBin0 = ssize - 1; @@ -390,7 +398,11 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta0Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin0); et0Phy = 0.5 * (binEdges.second + binEdges.first); - + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin0); + upt0Phy = 0.5 * (binEdges.second + binEdges.first); + } LogDebug("L1TGlobal") << "Found all quantities for the muon 0" << std::endl; } break; @@ -646,6 +658,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwEtaAtVtx(); etIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPt(); + uptIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPtUnconstrained(); // Added for displaced muons chrg1 = (candMuVec->at(cond1bx, obj1Index))->hwCharge(); etaBin1 = etaIndex1; if (etaBin1 < 0) @@ -653,6 +666,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { // LogDebug("L1TGlobal") << "Muon phi" << phiIndex1 << " eta " << etaIndex1 << " etaBin1 = " << etaBin1 << " et " << etIndex1 << std::endl; etBin1 = etIndex1; + uptBin1 = uptIndex1; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin1 >= ssize) { LogTrace("L1TGlobal") << "muon2 hw et" << etBin1 << " out of scale range. Setting to maximum."; @@ -666,7 +680,12 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta1Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin1); et1Phy = 0.5 * (binEdges.second + binEdges.first); - + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin1); + upt1Phy = 0.5 * (binEdges.second + binEdges.first); + } + LogDebug("L1TGlobal") << "Found all quantities for the muon 1" << std::endl; } break; case CondCalo: { switch (cndObjTypeVec[1]) { @@ -1149,7 +1168,8 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { } } - if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10) { + if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10 || + corrPar.corrCutType & 0x40) { // added 0x40 for massUpt //invariant mass calculation based on // M = sqrt(2*p1*p2(cosh(eta1-eta2) - cos(phi1 - phi2))) // but we calculate (1/2)M^2 @@ -1159,6 +1179,8 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { if (corrPar.corrCutType & 0x10) coshDeltaEtaPhy = 1.; double massSqPhy = et0Phy * et1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); + if (corrPar.corrCutType & 0x40) // Added for displaced muons + massSqPhy = upt0Phy * upt1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); long long cosDeltaPhiLUT = m_gtScales->getLUT_DeltaPhi_Cos(lutName, deltaPhiFW); unsigned int precCosLUT = m_gtScales->getPrec_DeltaPhi_Cos(lutName); @@ -1184,6 +1206,19 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { long long ptObj1 = m_gtScales->getLUT_Pt("Mass_" + lutName, etIndex1); unsigned int precPtLUTObj1 = m_gtScales->getPrec_Pt("Mass_" + lutName); + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + lutName = lutObj0; + lutName += "-UPT"; + ptObj0 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex0); + precPtLUTObj0 = m_gtScales->getPrec_Upt("Mass_" + lutName); + + lutName = lutObj1; + lutName += "-UPT"; + ptObj1 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex1); + precPtLUTObj1 = m_gtScales->getPrec_Upt("Mass_" + lutName); + } + // Pt and Angles are at different precission. long long massSq = ptObj0 * ptObj1 * (coshDeltaEtaLUT - cosDeltaPhiLUT); @@ -1214,7 +1249,6 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { LogDebug("L1TGlobal") << " Passed Invariant Mass Cut [" << (long long)(corrPar.minMassCutValue * pow(10, preShift)) << "," << (long long)(corrPar.maxMassCutValue * pow(10, preShift)) << "]" << std::endl; - } else { LogDebug("L1TGlobal") << " Failed Invariant Mass Cut [" << (long long)(corrPar.minMassCutValue * pow(10, preShift)) << "," diff --git a/L1Trigger/L1TGlobal/src/GlobalScales.cc b/L1Trigger/L1TGlobal/src/GlobalScales.cc index 38d1513e34a17..94e24f483044c 100644 --- a/L1Trigger/L1TGlobal/src/GlobalScales.cc +++ b/L1Trigger/L1TGlobal/src/GlobalScales.cc @@ -98,6 +98,21 @@ void l1t::GlobalScales::setLUT_Pt(const std::string& lutName, std::vector lut, unsigned int precision) { + if (m_lut_Upt.count(lutName) != 0) { + LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!" + << std::endl; + return; + } + + // Insert this LUT into the Table + m_lut_Upt.insert(std::map>::value_type(lutName, lut)); + m_Prec_Upt.insert(std::map::value_type(lutName, precision)); + + return; +} + void l1t::GlobalScales::setLUT_Cosh(const std::string& lutName, std::vector lut, unsigned int precision) { if (m_lut_Cosh.count(lutName) != 0) { LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!" @@ -303,6 +318,33 @@ unsigned int l1t::GlobalScales::getPrec_Pt(const std::string& lutName) const { return value; } +// Added for displaced muons +long long l1t::GlobalScales::getLUT_Upt(const std::string& lutName, int element) const { + long long value = 0; + + if (element < 0) { + edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Upt LUT ( " << lutName + << ")" << std::endl; + } else if (element >= (int)m_lut_Upt.find(lutName)->second.size()) { + edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Upt LUT (" << lutName + << ") size = " << m_lut_Upt.find(lutName)->second.size() << std::endl; + } else { + value = m_lut_Upt.find(lutName)->second.at(element); + } + return value; +} +// Added for displaced muons +unsigned int l1t::GlobalScales::getPrec_Upt(const std::string& lutName) const { + unsigned int value = 0; + + if (m_Prec_Upt.find(lutName) != m_Prec_Upt.end()) { + value = m_Prec_Upt.find(lutName)->second; + } else { + edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Upt not found" << std::endl; + } + return value; +} + long long l1t::GlobalScales::getLUT_DeltaEta_Cosh(std::string lutName, int element) const { long long value = 0; @@ -520,6 +562,11 @@ void l1t::GlobalScales::dumpAllLUTs(std::ostream& myCout) const { itr++) { dumpLUT(myCout, 8, itr->first); } + // Added for displaced muons + for (std::map>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end(); + itr++) { + dumpLUT(myCout, 8, itr->first); + } } void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string name) const { @@ -573,6 +620,12 @@ void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string n type = "Pt"; break; } + case 9: { // Added for displaced muons + dumpV = m_lut_Upt.find(name)->second; + prec = m_Prec_Upt.find(name)->second; + type = "Upt"; + break; + } } myCout << "=========================================" << std::endl; @@ -672,6 +725,14 @@ void l1t::GlobalScales::print(std::ostream& myCout) const { myCout << " " << itr->first; } myCout << std::endl; + + // Added for displaced muons + myCout << " Upt: "; + for (std::map>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end(); + itr++) { + myCout << " " << itr->first; + } + myCout << std::endl; } void l1t::GlobalScales::printScale(ScaleParameters scale, std::ostream& myCout) const { myCout << " Pt Min = " << std::setw(10) << scale.etMin << " Pt Max = " << std::setw(10) << scale.etMax diff --git a/L1Trigger/L1TGlobal/src/MuonTemplate.cc b/L1Trigger/L1TGlobal/src/MuonTemplate.cc index 880f4ea03ac2a..32166135c25f0 100644 --- a/L1Trigger/L1TGlobal/src/MuonTemplate.cc +++ b/L1Trigger/L1TGlobal/src/MuonTemplate.cc @@ -9,6 +9,7 @@ * * \author: Vasile Mihai Ghete - HEPHY Vienna * Vladimir Rekovic - extend for indexing + * Rick Cavanaugh - extend for displaced muons * * $Date$ * $Revision$ @@ -79,6 +80,8 @@ void MuonTemplate::print(std::ostream& myCout) const { myCout << " Template for object " << i << " [ hex ]" << std::endl; myCout << " ptHighThreshold = " << std::hex << m_objectParameter[i].ptHighThreshold << std::endl; myCout << " ptLowThreshold = " << std::hex << m_objectParameter[i].ptLowThreshold << std::endl; + myCout << " uptHighCut = " << std::hex << m_objectParameter[i].unconstrainedPtHigh << std::endl; + myCout << " uptLowCut = " << std::hex << m_objectParameter[i].unconstrainedPtLow << std::endl; myCout << " indexHigh = " << std::hex << m_objectParameter[i].indexHigh << std::endl; myCout << " indexLow = " << std::hex << m_objectParameter[i].indexLow << std::endl; myCout << " enableMip = " << std::hex << m_objectParameter[i].enableMip << std::endl; @@ -87,6 +90,7 @@ void MuonTemplate::print(std::ostream& myCout) const { myCout << " charge =" << std::dec << m_objectParameter[i].charge << std::endl; myCout << " qualityLUT = " << std::hex << m_objectParameter[i].qualityLUT << std::endl; myCout << " isolationLUT = " << std::hex << m_objectParameter[i].isolationLUT << std::endl; + myCout << " impactParameterLUT= " << std::hex << m_objectParameter[i].impactParameterLUT << std::endl; // myCout << " etaRange = " // << std::hex << m_objectParameter[i].etaRange << std::endl; // myCout << " phiHigh = " diff --git a/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h b/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h index 2dc5b0dd4cdc0..03519dc76dad6 100644 --- a/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h +++ b/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h @@ -151,6 +151,8 @@ class HGCalHistoSeedingImpl { unsigned nBins2_ = 216; std::vector binsSumsHisto_; double histoThreshold_ = 20.; + static constexpr double area_per_triggercell_ = + 4.91E-05; // Hex_Wafer_Area (x/z units)/N_TC (per wafer) = (0.866*((hexWafer_minimal_diameter)*(1./319.))^2 / 48) std::vector neighbour_weights_; std::vector smoothing_ecal_; std::vector smoothing_hcal_; diff --git a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py index af1a76ee9aaf4..e46620486bbd5 100644 --- a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py @@ -105,7 +105,7 @@ # (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf # for more details) phase2_hgcalV10.toModify(histoMax_C3d_seeding_params, - threshold_histo_multicluster=7.5, # MipT + threshold_histo_multicluster=8.5, # MipT ) diff --git a/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc b/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc index 01f34ffcf18fb..2353c592070be 100644 --- a/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc +++ b/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc @@ -166,12 +166,12 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoCluste for (int z_side : {-1, 1}) { for (unsigned bin1 = 0; bin1 < nBins1_; bin1++) { int nBinsSide = (binSums[bin1] - 1) / 2; - float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_); - float R2 = R1 + (kROverZMax_ - kROverZMin_); + float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_) / nBins1_; + float R2 = R1 + ((kROverZMax_ - kROverZMin_) / nBins1_); double area = - 0.5 * (pow(R2, 2) - pow(R1, 2)) * + ((M_PI * (pow(R2, 2) - pow(R1, 2))) / nBins2_) * (1 + - 0.5 * + 2.0 * (1 - pow(0.5, nBinsSide))); // Takes into account different area of bins in different R-rings + sum of quadratic weights used @@ -196,7 +196,7 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoCluste } auto& bin = histoSumPhiClusters.at(z_side, bin1, bin2); - bin.values[Bin::Content::Sum] = content / area; + bin.values[Bin::Content::Sum] = (content / area) * area_per_triggercell_; bin.weighted_x = bin_orig.weighted_x; bin.weighted_y = bin_orig.weighted_y; } diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc new file mode 100644 index 0000000000000..d47251b1c748f --- /dev/null +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -0,0 +1,112 @@ +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" + +using namespace l1t; + +class L1TMuonShowerProducer : public edm::stream::EDProducer<> { +public: + explicit L1TMuonShowerProducer(const edm::ParameterSet&); + ~L1TMuonShowerProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + edm::InputTag showerInputTag_; + edm::EDGetTokenT showerInputToken_; + int bxMin_; + int bxMax_; + unsigned minNominalShowers_; + unsigned minTwoLooseShowers_; +}; + +L1TMuonShowerProducer::L1TMuonShowerProducer(const edm::ParameterSet& iConfig) + : showerInputTag_(iConfig.getParameter("showerInput")), + showerInputToken_(consumes(showerInputTag_)), + bxMin_(iConfig.getParameter("bxMin")), + bxMax_(iConfig.getParameter("bxMax")), + minNominalShowers_(iConfig.getParameter("minNominalShowers")), + minTwoLooseShowers_(iConfig.getParameter("minTwoLooseShowers")) { + produces(); +} + +L1TMuonShowerProducer::~L1TMuonShowerProducer() {} + +// ------------ method called to produce the data ------------ +void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + std::unique_ptr outShowers(new MuonShowerBxCollection()); + + Handle emtfShowers; + iEvent.getByToken(showerInputToken_, emtfShowers); + outShowers->setBXRange(bxMin_, bxMax_); + + /* + Check each sector for a valid EMTF shower. A valid EMTF shower + can either be in-time or out-of-time. The minimal implementation + only considers the "at least 1-nominal shower" case. + */ + unsigned nNominalInTime = 0; + unsigned nNominalOutOfTime = 0; + unsigned nTwoLooseInTime = 0; + unsigned nTwoLooseOutOfTime = 0; + for (size_t i = 0; i < emtfShowers->size(0); ++i) { + auto shower = emtfShowers->at(0, i); + if (shower.isValid()) { + // nominal + if (shower.isOneNominalInTime()) + nNominalInTime++; + if (shower.isOneNominalOutOfTime()) + nNominalOutOfTime++; + // two loose + if (shower.isTwoLooseInTime()) + nTwoLooseInTime++; + if (shower.isTwoLooseOutOfTime()) + nTwoLooseOutOfTime++; + } + } + + const bool isOneNominalInTime(nNominalInTime >= minNominalShowers_); + const bool isOneNominalOutOfTime(nNominalOutOfTime >= minNominalShowers_); + const bool isTwoLooseInTime(nTwoLooseInTime >= minTwoLooseShowers_); + const bool isTwoLooseOutOfTime(nTwoLooseOutOfTime >= minTwoLooseShowers_); + + // Check for at least one nominal shower + const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime); + if (acceptCondition) { + MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime); + outShowers->push_back(0, outShower); + } + iEvent.put(std::move(outShowers)); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void L1TMuonShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("showerInput", edm::InputTag("simEmtfShowers", "EMTF")); + desc.add("bxMin", 0); + desc.add("bxMax", 0); + desc.add("minNominalShowers", 1); + desc.add("minTwoLooseShowers", 0); + descriptions.add("simGmtShowerDigisDef", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonShowerProducer); diff --git a/L1Trigger/L1TMuon/python/simDigis_cff.py b/L1Trigger/L1TMuon/python/simDigis_cff.py index d52e32d4d41ea..449f97b61965e 100644 --- a/L1Trigger/L1TMuon/python/simDigis_cff.py +++ b/L1Trigger/L1TMuon/python/simDigis_cff.py @@ -77,6 +77,7 @@ from L1Trigger.L1TMuonBarrel.simKBmtfStubs_cfi import * from L1Trigger.L1TMuonBarrel.simKBmtfDigis_cfi import * from L1Trigger.L1TMuonEndCap.simEmtfDigis_cfi import * +from L1Trigger.L1TMuonEndCap.simEmtfShowers_cfi import * from L1Trigger.L1TMuonOverlap.simOmtfDigis_cfi import * from L1Trigger.L1TMuon.simGmtCaloSumDigis_cfi import * from L1Trigger.L1TMuon.simGmtStage2Digis_cfi import * diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index 25385e675f480..e0daa3580ffd4 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -20,6 +20,10 @@ emtfCancelMode = cms.string("coordinate") # 'tracks' or 'coordinate' ) +# Muon shower trigger +from L1Trigger.L1TMuon.simGmtShowerDigisDef_cfi import simGmtShowerDigisDef +simGmtShowerDigis = simGmtShowerDigisDef.clone() + from CondCore.CondDB.CondDB_cfi import CondDB CondDB.connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") l1ugmtdb = cms.ESSource("PoolDBESSource", diff --git a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h new file mode 100644 index 0000000000000..b5c76daedf305 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h @@ -0,0 +1,41 @@ +#ifndef L1Trigger_L1TMuonEndCap_SectorProcessorShower_h +#define L1Trigger_L1TMuonEndCap_SectorProcessorShower_h + +/* + This class executes the trigger logic for the EMTF shower trigger. + In the basic mode, the EMTF shower sector processor will find any valid + CSC shower and send a trigger to the uGMT. In a possible extension, the + EMTF shower sector processor can also trigger on two loose showers - to + enhance the sensitivity to long-lived particles that produce multiple + smaller showers, instead of a single large shower. + */ + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + +#include + +class SectorProcessorShower { +public: + explicit SectorProcessorShower() {} + ~SectorProcessorShower() {} + + void configure(const edm::ParameterSet&, int endcap, int sector); + + void process(const CSCShowerDigiCollection& showers, l1t::RegionalMuonShowerBxCollection& out_showers) const; + +private: + int select_shower(const CSCDetId&, const CSCShowerDigi&) const; + int get_index_shower(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const; + bool is_in_sector_csc(int tp_endcap, int tp_sector) const; + + int verbose_, endcap_, sector_; + bool enableOneNominalShower_; + bool enableTwoLooseShowers_; + unsigned nNominalShowers_; + unsigned nLooseShowers_; +}; + +#endif diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc new file mode 100644 index 0000000000000..63f987a3e8d1b --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc @@ -0,0 +1,54 @@ +#include "L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h" +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + +L1TMuonEndCapShowerProducer::L1TMuonEndCapShowerProducer(const edm::ParameterSet& iConfig) + : config_(iConfig), + tokenCSCShower_(consumes(iConfig.getParameter("CSCShowerInput"))), + sector_processors_shower_() { + // Make output products + produces("EMTF"); +} + +L1TMuonEndCapShowerProducer::~L1TMuonEndCapShowerProducer() {} + +void L1TMuonEndCapShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Create pointers to output products + auto out_showers = std::make_unique(); + out_showers->clear(); + out_showers->setBXRange(0, 0); + + edm::Handle showersH; + iEvent.getByToken(tokenCSCShower_, showersH); + const CSCShowerDigiCollection& showers = *showersH.product(); + + // ___________________________________________________________________________ + // Run the sector processors + + for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) { + for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) { + const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) + + (sector - emtf::MIN_TRIGSECTOR); + + sector_processors_shower_.at(es).configure(config_, endcap, sector); + sector_processors_shower_.at(es).process(showers, *out_showers); + } + } + + // Fill the output products + iEvent.put(std::move(out_showers), "EMTF"); +} + +void L1TMuonEndCapShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + // these are different shower selections that can be enabled + desc.add("enableOneNominalShowers", true); + desc.add("enableTwoLooseShowers", false); + desc.add("nLooseShowers", 2); + desc.add("nNominalShowers", 1); + desc.add("CSCShowerInput", edm::InputTag("simCscTriggerPrimitiveDigis")); + descriptions.add("simEmtfShowersDef", desc); + descriptions.setComment("This is the generic cfi file for the EMTF shower producer"); +} + +// Define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonEndCapShowerProducer); diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h new file mode 100644 index 0000000000000..722750baaca47 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h @@ -0,0 +1,41 @@ +#ifndef L1Trigger_L1TMuonEndCap_L1TMuonEndCapShowerProducer_h +#define L1Trigger_L1TMuonEndCap_L1TMuonEndCapShowerProducer_h + +/* + This EDProducer produces EMTF showers from showers in the CSC local trigger. + These showers could indicate the passage of a long-lived particle decaying + in the endcap muon system. + + The logic is executed in the SectorProcessorShower class. Multiple options + are defined: "OneNominal", "TwoLoose" + */ + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/stream/EDProducer.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 "L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h" + +// Class declaration +class L1TMuonEndCapShowerProducer : public edm::stream::EDProducer<> { +public: + explicit L1TMuonEndCapShowerProducer(const edm::ParameterSet&); + ~L1TMuonEndCapShowerProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + const edm::ParameterSet& config_; + edm::EDGetToken tokenCSCShower_; + emtf::sector_array sector_processors_shower_; +}; + +#endif diff --git a/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py b/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py new file mode 100644 index 0000000000000..836e5c6c50203 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.L1TMuonEndCap.simEmtfShowersDef_cfi import simEmtfShowersDef + +## producer for simulation +simEmtfShowers = simEmtfShowersDef.clone() + +## producer for re-emulation on unpacked CSC shower data +simEmtfShowersData = simEmtfShowers.clone() diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc new file mode 100644 index 0000000000000..dd855674fa8fa --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -0,0 +1,113 @@ +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" + +void SectorProcessorShower::configure(const edm::ParameterSet& pset, int endcap, int sector) { + emtf_assert(emtf::MIN_ENDCAP <= endcap && endcap <= emtf::MAX_ENDCAP); + emtf_assert(emtf::MIN_TRIGSECTOR <= sector && sector <= emtf::MAX_TRIGSECTOR); + + endcap_ = endcap; + sector_ = sector; + + enableTwoLooseShowers_ = pset.getParameter("enableTwoLooseShowers"); + enableOneNominalShower_ = pset.getParameter("enableOneNominalShowers"); + nLooseShowers_ = pset.getParameter("nLooseShowers"); + nNominalShowers_ = pset.getParameter("nNominalShowers"); +} + +void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, + l1t::RegionalMuonShowerBxCollection& out_showers) const { + // reset + std::vector selected_showers; + + // shower selection + auto chamber = in_showers.begin(); + auto chend = in_showers.end(); + for (; chamber != chend; ++chamber) { + auto digi = (*chamber).second.first; + auto dend = (*chamber).second.second; + for (; digi != dend; ++digi) { + // Returns CSC "link" index (0 - 45) + int selected_shower = select_shower((*chamber).first, *digi); + + // index is valid + if (selected_shower >= 0) { + // 18 in ME1; 9x3 in ME2,3,4 + emtf_assert(selected_shower < CSCConstants::MAX_CSCS_PER_EMTF_SP_NO_OVERLAP); + + // shower is valid + if (digi->isValid()) { + selected_showers.emplace_back(*digi); + } + } + } + } + + // Shower recognition logic: at least one nominal shower (see DN-20-033, section 5.2) + const unsigned nLooseInTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseInTime(); })); + const unsigned nNominalInTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalInTime(); })); + const unsigned nLooseOutOfTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseOutTime(); })); + const unsigned nNominalOutOfTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalOutTime(); })); + + const bool hasTwoLooseInTime(nLooseInTime >= nLooseShowers_); + const bool hasOneNominalInTime(nNominalInTime >= nNominalShowers_); + const bool hasTwoLooseOutOfTime(nLooseOutOfTime >= nLooseShowers_); + const bool hasOneNominalOutOfTime(nNominalOutOfTime >= nNominalShowers_); + + const bool acceptLoose(enableTwoLooseShowers_ and (hasTwoLooseInTime or hasTwoLooseOutOfTime)); + const bool acceptNominal(enableOneNominalShower_ and (hasOneNominalInTime or hasOneNominalOutOfTime)); + // trigger condition + const bool accept(acceptLoose or acceptNominal); + + if (accept) { + // shower output + l1t::RegionalMuonShower out_shower( + hasOneNominalInTime, hasOneNominalOutOfTime, hasTwoLooseInTime, hasTwoLooseOutOfTime); + out_shower.setEndcap(endcap_); + out_shower.setSector(sector_); + out_showers.push_back(0, out_shower); + } +} + +// shower selection +int SectorProcessorShower::select_shower(const CSCDetId& tp_detId, const CSCShowerDigi& shower) const { + int selected = -1; + + int tp_endcap = tp_detId.endcap(); + int tp_sector = tp_detId.triggerSector(); + int tp_station = tp_detId.station(); + int tp_chamber = tp_detId.chamber(); + int tp_csc_ID = shower.getCSCID(); + + // station 1 --> subsector 1 or 2 + // station 2,3,4 --> subsector 0 + int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2); + + // Check if the chamber belongs to this sector processor at this BX. + selected = get_index_shower(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID); + return selected; +} + +int SectorProcessorShower::get_index_shower( + int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const { + int selected = -1; + + // shower trigger does not considers overlaps + if (is_in_sector_csc(tp_endcap, tp_sector)) { + if (tp_station == 1) { // ME1: 0 - 8, 9 - 17 + selected = (tp_subsector - 1) * 9 + (tp_csc_ID - 1); + } else { // ME2,3,4: 18 - 26, 27 - 35, 36 - 44 + selected = (tp_station)*9 + (tp_csc_ID - 1); + } + } + + emtf_assert(selected != -1); + return selected; +} + +bool SectorProcessorShower::is_in_sector_csc(int tp_endcap, int tp_sector) const { + return ((endcap_ == tp_endcap) && (sector_ == tp_sector)); +} diff --git a/L1Trigger/L1TTrackMatch/BuildFile.xml b/L1Trigger/L1TTrackMatch/BuildFile.xml index 596dc6c8f3683..7b5913dda03b6 100644 --- a/L1Trigger/L1TTrackMatch/BuildFile.xml +++ b/L1Trigger/L1TTrackMatch/BuildFile.xml @@ -8,6 +8,11 @@ + + + + + diff --git a/L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h b/L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h new file mode 100644 index 0000000000000..7d7340d585389 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include +#include +#include +#include + +//Each individual box in the eta and phi dimension. +// Also used to store final cluster data for each zbin. +struct EtaPhiBin { + float pTtot; + int numtracks; + int numttrks; + int numtdtrks; + int numttdtrks; + bool used; + float phi; //average phi value (halfway b/t min and max) + float eta; //average eta value +}; + +//store important information for plots +struct MaxZBin { + int znum; //Numbered from 0 to nzbins (16, 32, or 64) in order + int nclust; //number of clusters in this bin + float zbincenter; + EtaPhiBin *clusters; //list of all the clusters in this bin + float ht; //sum of all cluster pTs--only the zbin with the maximum ht is stored +}; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc new file mode 100644 index 0000000000000..099c03ecfe9e2 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -0,0 +1,241 @@ +// Original Author: Emmanuelle Perez,40 1-A28,+41227671915, +// Created: Tue Nov 12 17:03:19 CET 2013 + +// 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/Math/interface/LorentzVector.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMissFwd.h" + +using namespace l1t; + +class L1TkHTMissProducer : public edm::EDProducer { +public: + explicit L1TkHTMissProducer(const edm::ParameterSet&); + ~L1TkHTMissProducer() override; + +private: + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + float jetMinPt_; // [GeV] + float jetMaxEta_; // [rad] + bool doVtxConstrain_; // require vertex constraint + bool primaryVtxConstrain_; // use event primary vertex instead of leading jet (if doVtxConstrain) + bool useCaloJets_; // Determines whether or not calo jets are used + float deltaZ_; // for jets [cm] (if DoTvxConstrain) + float minJetEtLowPt_; // for track jets, minimum et required, depending on number of low pT tracks + float minJetEtHighPt_; + bool displaced_; // Use prompt/displaced tracks + unsigned int minNtracksHighPt_; + unsigned int minNtracksLowPt_; + const edm::EDGetTokenT pvToken_; + const edm::EDGetTokenT jetToken_; +}; + +L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) + : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), + jetToken_(consumes(iConfig.getParameter("L1TkJetInputTag"))) { + jetMinPt_ = (float)iConfig.getParameter("jet_minPt"); + jetMaxEta_ = (float)iConfig.getParameter("jet_maxEta"); + doVtxConstrain_ = iConfig.getParameter("doVtxConstrain"); + useCaloJets_ = iConfig.getParameter("useCaloJets"); + primaryVtxConstrain_ = iConfig.getParameter("primaryVtxConstrain"); + deltaZ_ = (float)iConfig.getParameter("deltaZ"); + minNtracksHighPt_ = iConfig.getParameter("jet_minNtracksHighPt"); + minNtracksLowPt_ = iConfig.getParameter("jet_minNtracksLowPt"); + minJetEtLowPt_ = iConfig.getParameter("jet_minJetEtLowPt"); + minJetEtHighPt_ = iConfig.getParameter("jet_minJetEtHighPt"); + displaced_ = iConfig.getParameter("displaced"); + + if (useCaloJets_) + produces("TkCaloHTMiss"); + else if (displaced_) + produces("L1TrackerHTMissExtended"); + else + produces("L1TrackerHTMiss"); +} + +L1TkHTMissProducer::~L1TkHTMissProducer() {} + +void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + std::unique_ptr MHTCollection(new TkHTMissCollection); + + // L1 primary vertex + edm::Handle L1VertexHandle; + iEvent.getByToken(pvToken_, L1VertexHandle); + + // L1 track-trigger jets + edm::Handle L1TkJetsHandle; + iEvent.getByToken(jetToken_, L1TkJetsHandle); + std::vector::const_iterator jetIter; + + if (!L1TkJetsHandle.isValid() && !displaced_) { + LogError("TkHTMissProducer") << "\nWarning: TkJetCollection not found in the event. Exit\n"; + return; + } + + if (!L1TkJetsHandle.isValid() && displaced_) { + LogError("TkHTMissProducer") << "\nWarning: TkJetExtendedCollection not found in the event. Exit\n"; + return; + } + + // ---------------------------------------------------------------------------------------------- + // if primaryVtxConstrain_, use the primary vertex instead of z position from leading jet + // ---------------------------------------------------------------------------------------------- + float evtZVtx = 999; + bool foundVtx = false; + edm::Ref L1VtxRef; // null reference + + if (useCaloJets_) { + if (doVtxConstrain_ && primaryVtxConstrain_) { + if (!L1VertexHandle.isValid()) { + LogError("L1TkHTMissProducer") << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + return; + } else { + std::vector::const_iterator vtxIter = L1VertexHandle->begin(); + // by convention, the first vertex in the collection is the one that should + // be used by default + evtZVtx = vtxIter->zvertex(); + foundVtx = true; + int ivtx = 0; + edm::Ref vtxRef(L1VertexHandle, ivtx); + L1VtxRef = vtxRef; + } + } //endif primaryVtxConstrain_ + + // ---------------------------------------------------------------------------------------------- + // using z position of leading jet to define "event vertex" + // ---------------------------------------------------------------------------------------------- + float zvtx_jetpt = -1.0; //pt of jet determining the event vertex + float jetVtxMax = 99.; //find z position of leading jet that has a z vertex! + + if (doVtxConstrain_ && !primaryVtxConstrain_) { + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) + continue; + + float tmp_jet_vtx = jetIter->jetVtx(); + float tmp_jet_pt = jetIter->pt(); + float tmp_jet_eta = jetIter->eta(); + if (tmp_jet_pt < jetMinPt_) + continue; + if (fabs(tmp_jet_eta) > jetMaxEta_) + continue; + if (fabs(tmp_jet_vtx) > jetVtxMax) + continue; + + // find vertex position of leading jet + if (tmp_jet_pt > zvtx_jetpt) { + evtZVtx = tmp_jet_vtx; + zvtx_jetpt = tmp_jet_pt; + foundVtx = true; + } + } //end loop over jets + } //endif z position from leading jet + + float sumPx_calo = 0; + float sumPy_calo = 0; + float HT_calo = 0; + + if (doVtxConstrain_ && !foundVtx) + LogWarning("L1TkHTMissProducer") << "Didn't find any z vertex (based on jet vertices) for this event!\n"; + + // loop over jets + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) + continue; + + float tmp_jet_px = jetIter->px(); + float tmp_jet_py = jetIter->py(); + float tmp_jet_et = jetIter->et(); + float tmp_jet_vtx = jetIter->jetVtx(); + if (jetIter->pt() < jetMinPt_) + continue; + if (fabs(jetIter->eta()) > jetMaxEta_) + continue; + + // vertex consistency requirement + bool VtxRequirement = false; + if (foundVtx) + VtxRequirement = fabs(tmp_jet_vtx - evtZVtx) < deltaZ_; + + if (!doVtxConstrain_ || VtxRequirement) { + sumPx_calo += tmp_jet_px; + sumPy_calo += tmp_jet_py; + HT_calo += tmp_jet_et; + } + } //end loop over jets + + // define missing HT + float et = sqrt(sumPx_calo * sumPx_calo + sumPy_calo * sumPy_calo); + math::XYZTLorentzVector missingEt(-sumPx_calo, -sumPy_calo, 0, et); + edm::RefProd jetCollRef(L1TkJetsHandle); + TkHTMiss tkHTM(missingEt, HT_calo, jetCollRef, L1VtxRef); + + if (doVtxConstrain_ && !primaryVtxConstrain_) { + tkHTM.setVtx(evtZVtx); + } + + MHTCollection->push_back(tkHTM); + iEvent.put(std::move(MHTCollection), "L1TkCaloHTMiss"); + } + + else { // Using standalone jets + float sumPx = 0; + float sumPy = 0; + float HT = 0; + + // loop over jets + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + float tmp_jet_px = jetIter->px(); + float tmp_jet_py = jetIter->py(); + float tmp_jet_et = jetIter->et(); + float tmp_jet_pt = jetIter->pt(); + if (tmp_jet_pt < jetMinPt_) + continue; + if (fabs(jetIter->eta()) > jetMaxEta_) + continue; + if (jetIter->ntracks() < minNtracksLowPt_ && tmp_jet_et > minJetEtLowPt_) + continue; + if (jetIter->ntracks() < minNtracksHighPt_ && tmp_jet_et > minJetEtHighPt_) + continue; + sumPx += tmp_jet_px; + sumPy += tmp_jet_py; + HT += tmp_jet_pt; + } // end jet loop + + // define missing HT + float et = sqrt(sumPx * sumPx + sumPy * sumPy); + math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et); + edm::RefProd jetCollRef(L1TkJetsHandle); + TkHTMiss tkHTM(missingEt, HT, jetCollRef, L1VtxRef); + + MHTCollection->push_back(tkHTM); + if (displaced_) + iEvent.put(std::move(MHTCollection), "L1TrackerHTMissExtended"); + else + iEvent.put(std::move(MHTCollection), "L1TrackerHTMiss"); + } +} //end producer + +void L1TkHTMissProducer::beginJob() {} + +void L1TkHTMissProducer::endJob() {} + +DEFINE_FWK_MODULE(L1TkHTMissProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc new file mode 100644 index 0000000000000..8449bc6377c30 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -0,0 +1,227 @@ +/////////////////////////////////////////////////////////////////////////// +// // +// Producer of TkJet, // +// Cluster L1 tracks using fastjet // +// // +/////////////////////////////////////////////////////////////////////////// + +// 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 "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +// L1 objects +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +// geometry +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "RecoJets/JetProducers/plugins/VirtualJetProducer.h" + +#include +#include "TMath.h" +#include "TH1.h" + +using namespace l1t; +using namespace edm; +using namespace std; + +////////////////////////////// +// // +// CLASS DEFINITION // +// // +////////////////////////////// + +class L1TrackFastJetProducer : public edm::EDProducer { +public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollectionType; + + explicit L1TrackFastJetProducer(const edm::ParameterSet&); + ~L1TrackFastJetProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // track selection criteria + float trkZMax_; // in [cm] + float trkChi2dofMax_; // maximum track chi2dof + double trkBendChi2Max_; // maximum track bendchi2 + float trkPtMin_; // in [GeV] + float trkEtaMax_; // in [rad] + int trkNStubMin_; // minimum number of stubs + int trkNPSStubMin_; // minimum number of PS stubs + double deltaZ0Cut_; // save with |L1z-z0| < maxZ0 + double coneSize_; // Use anti-kt with this cone size + bool doTightChi2_; + bool displaced_; //use prompt/displaced tracks + + const edm::EDGetTokenT > > trackToken_; + edm::EDGetTokenT pvToken_; +}; + +// constructor +L1TrackFastJetProducer::L1TrackFastJetProducer(const edm::ParameterSet& iConfig) + : trackToken_(consumes > >( + iConfig.getParameter("L1TrackInputTag"))), + pvToken_(consumes(iConfig.getParameter("L1PrimaryVertexTag"))) { + trkZMax_ = (float)iConfig.getParameter("trk_zMax"); + trkChi2dofMax_ = (float)iConfig.getParameter("trk_chi2dofMax"); + trkBendChi2Max_ = iConfig.getParameter("trk_bendChi2Max"); + trkPtMin_ = (float)iConfig.getParameter("trk_ptMin"); + trkEtaMax_ = (float)iConfig.getParameter("trk_etaMax"); + trkNStubMin_ = (int)iConfig.getParameter("trk_nStubMin"); + trkNPSStubMin_ = (int)iConfig.getParameter("trk_nPSStubMin"); + deltaZ0Cut_ = (float)iConfig.getParameter("deltaZ0Cut"); + coneSize_ = (float)iConfig.getParameter("coneSize"); + doTightChi2_ = iConfig.getParameter("doTightChi2"); + displaced_ = iConfig.getParameter("displaced"); + if (displaced_) + produces("L1TrackFastJetsExtended"); + else + produces("L1TrackFastJets"); +} + +// destructor +L1TrackFastJetProducer::~L1TrackFastJetProducer() {} + +// producer +void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + std::unique_ptr L1TrackFastJets(new TkJetCollection); + + // L1 tracks + edm::Handle > > TTTrackHandle; + iEvent.getByToken(trackToken_, TTTrackHandle); + std::vector >::const_iterator iterL1Track; + + // Tracker Topology + edm::ESHandle tTopoHandle_; + iSetup.get().get(tTopoHandle_); + const TrackerTopology* tTopo = tTopoHandle_.product(); + ESHandle tGeomHandle; + iSetup.get().get(tGeomHandle); + + edm::Handle TkPrimaryVertexHandle; + iEvent.getByToken(pvToken_, TkPrimaryVertexHandle); + + fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize_); + std::vector JetInputs; + + float recoVtx = TkPrimaryVertexHandle->begin()->zvertex(); + unsigned int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + this_l1track++; + float trk_pt = iterL1Track->momentum().perp(); + float trk_z0 = iterL1Track->z0(); + float trk_chi2dof = iterL1Track->chi2Red(); + float trk_bendchi2 = iterL1Track->stubPtConsistency(); + std::vector >, TTStub > > + theStubs = iterL1Track->getStubRefs(); + int trk_nstub = (int)theStubs.size(); + + if (fabs(trk_z0) > trkZMax_) + continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) + continue; + if (trk_pt < trkPtMin_) + continue; + if (trk_nstub < trkNStubMin_) + continue; + if (trk_chi2dof > trkChi2dofMax_) + continue; + if (trk_bendchi2 > trkBendChi2Max_) + continue; + if (doTightChi2_ && (trk_pt > 20.0 && trk_chi2dof > 5.0)) + continue; + + int trk_nPS = 0; + for (int istub = 0; istub < trk_nstub; istub++) { + DetId detId(theStubs.at(istub)->getDetId()); + bool tmp_isPS = false; + if (detId.det() == DetId::Detector::Tracker) { + if (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) + tmp_isPS = true; + else if (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) + tmp_isPS = true; + } + if (tmp_isPS) + trk_nPS++; + } + if (trk_nPS < trkNPSStubMin_) + continue; + if (fabs(recoVtx - trk_z0) > deltaZ0Cut_) + continue; + + fastjet::PseudoJet psuedoJet(iterL1Track->momentum().x(), + iterL1Track->momentum().y(), + iterL1Track->momentum().z(), + iterL1Track->momentum().mag()); + JetInputs.push_back(psuedoJet); // input tracks for clustering + JetInputs.back().set_user_index(this_l1track - 1); // save track index in the collection + } // end loop over tracks + + fastjet::ClusterSequence cs(JetInputs, jet_def); // define the output jet collection + std::vector JetOutputs = + fastjet::sorted_by_pt(cs.inclusive_jets(0)); // output jet collection, pT-ordered + + for (unsigned int ijet = 0; ijet < JetOutputs.size(); ++ijet) { + math::XYZTLorentzVector jetP4( + JetOutputs[ijet].px(), JetOutputs[ijet].py(), JetOutputs[ijet].pz(), JetOutputs[ijet].modp()); + float sumpt = 0; + float avgZ = 0; + std::vector > L1TrackPtrs; + std::vector fjConstituents = fastjet::sorted_by_pt(cs.constituents(JetOutputs[ijet])); + + for (unsigned int i = 0; i < fjConstituents.size(); ++i) { + auto index = fjConstituents[i].user_index(); + edm::Ptr trkPtr(TTTrackHandle, index); + L1TrackPtrs.push_back(trkPtr); // L1Tracks in the jet + sumpt = sumpt + trkPtr->momentum().perp(); + avgZ = avgZ + trkPtr->momentum().perp() * trkPtr->z0(); + } + avgZ = avgZ / sumpt; + edm::Ref jetRef; + TkJet trkJet(jetP4, jetRef, L1TrackPtrs, avgZ); + L1TrackFastJets->push_back(trkJet); + } //end loop over Jet Outputs + + if (displaced_) + iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); + else + iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJets"); +} + +void L1TrackFastJetProducer::beginJob() {} + +void L1TrackFastJetProducer::endJob() {} + +void L1TrackFastJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TrackFastJetProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc new file mode 100644 index 0000000000000..7cc773ea687cd --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -0,0 +1,668 @@ +// Original Author: Rishi Patel +// Created: Wed, 01 Aug 2018 14:01:41 GMT +// +// Track jets are clustered in a two-layer process, first by clustering in phi, +// then by clustering in eta +// Introduction to object (p10-13): +// https://indico.cern.ch/event/791517/contributions/3341650/attachments/1818736/2973771/TrackBasedAlgos_L1TMadrid_MacDonald.pdf + +// system include files + +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" +// 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/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include "L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h" +#include "TH1D.h" +#include "TH2D.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace edm; +using namespace l1t; +class L1TrackJetProducer : public stream::EDProducer<> { +public: + explicit L1TrackJetProducer(const ParameterSet &); + ~L1TrackJetProducer() override; + typedef TTTrack L1TTTrackType; + typedef vector L1TTTrackCollectionType; + + static void fillDescriptions(ConfigurationDescriptions &descriptions); + bool trackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0); + void L2_cluster( + vector > L1TrkPtrs_, vector ttrk_, vector tdtrk_, vector ttdtrk_, MaxZBin &mzb); + virtual EtaPhiBin *L1_cluster(EtaPhiBin *phislice); + +private: + void beginStream(StreamID) override; + void produce(Event &, const EventSetup &) override; + void endStream() override; + + // ----------member data --------------------------- + + const EDGetTokenT > > trackToken_; + vector > L1TrkPtrs_; + vector zBinCount_; + vector ttrk_; + vector tdtrk_; + vector ttdtrk_; + float trkZMax_; + float trkPtMax_; + float trkPtMin_; + float trkEtaMax_; + float trkChi2dofMax_; + float trkBendChi2Max_; + int trkNPSStubMin_; + int lowpTJetMinTrackMultiplicity_; + int highpTJetMinTrackMultiplicity_; + int zBins_; + int etaBins_; + int phiBins_; + double minTrkJetpT_; + double minJetEtLowPt_; + double minJetEtHighPt_; + float zStep_; + float etaStep_; + float phiStep_; + bool displaced_; + float d0CutNStubs4_; + float d0CutNStubs5_; + float nStubs4DisplacedChi2Loose_; + float nStubs5DisplacedChi2Loose_; + float nStubs4DisplacedBendLoose_; + float nStubs5DisplacedBendLoose_; + float nStubs4DisplacedChi2Tight_; + float nStubs5DisplacedChi2Tight_; + float nStubs4DisplacedBendTight_; + float nStubs5DisplacedBendTight_; +}; + +L1TrackJetProducer::L1TrackJetProducer(const ParameterSet &iConfig) + : trackToken_( + consumes > >(iConfig.getParameter("L1TrackInputTag"))) { + trkZMax_ = (float)iConfig.getParameter("trk_zMax"); + trkPtMax_ = (float)iConfig.getParameter("trk_ptMax"); + trkPtMin_ = (float)iConfig.getParameter("trk_ptMin"); + trkEtaMax_ = (float)iConfig.getParameter("trk_etaMax"); + trkChi2dofMax_ = (float)iConfig.getParameter("trk_chi2dofMax"); + trkBendChi2Max_ = (float)iConfig.getParameter("trk_bendChi2Max"); + trkNPSStubMin_ = (int)iConfig.getParameter("trk_nPSStubMin"); + minTrkJetpT_ = iConfig.getParameter("minTrkJetpT"); + minJetEtLowPt_ = iConfig.getParameter("minJetEtLowPt"); + minJetEtHighPt_ = iConfig.getParameter("minJetEtHighPt"); + etaBins_ = (int)iConfig.getParameter("etaBins"); + phiBins_ = (int)iConfig.getParameter("phiBins"); + zBins_ = (int)iConfig.getParameter("zBins"); + d0CutNStubs4_ = (float)iConfig.getParameter("d0_cutNStubs4"); + d0CutNStubs5_ = (float)iConfig.getParameter("d0_cutNStubs5"); + lowpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter("lowpTJetMinTrackMultiplicity"); + highpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter("highpTJetMinTrackMultiplicity"); + displaced_ = iConfig.getParameter("displaced"); + nStubs4DisplacedChi2Loose_ = (float)iConfig.getParameter("nStubs4DisplacedChi2_Loose"); + nStubs5DisplacedChi2Loose_ = (float)iConfig.getParameter("nStubs5DisplacedChi2_Loose"); + nStubs4DisplacedBendLoose_ = (float)iConfig.getParameter("nStubs4Displacedbend_Loose"); + nStubs5DisplacedBendLoose_ = (float)iConfig.getParameter("nStubs5Displacedbend_Loose"); + nStubs4DisplacedChi2Tight_ = (float)iConfig.getParameter("nStubs4DisplacedChi2_Tight"); + nStubs5DisplacedChi2Tight_ = (float)iConfig.getParameter("nStubs5DisplacedChi2_Tight"); + nStubs4DisplacedBendTight_ = (float)iConfig.getParameter("nStubs4Displacedbend_Tight"); + nStubs5DisplacedBendTight_ = (float)iConfig.getParameter("nStubs5Displacedbend_Tight"); + + zStep_ = 2.0 * trkZMax_ / zBins_; + etaStep_ = 2.0 * trkEtaMax_ / etaBins_; //etaStep is the width of an etabin + phiStep_ = 2 * M_PI / phiBins_; ////phiStep is the width of a phibin + + if (displaced_) + produces("L1TrackJetsExtended"); + else + produces("L1TrackJets"); +} + +L1TrackJetProducer::~L1TrackJetProducer() {} + +void L1TrackJetProducer::produce(Event &iEvent, const EventSetup &iSetup) { + unique_ptr L1L1TrackJetProducer(new TkJetCollection); + + // For TTStubs + ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + ESHandle tGeomHandle; + iSetup.get().get(tGeomHandle); + const TrackerTopology *const tTopo = tTopoHandle.product(); + + edm::Handle > > TTTrackHandle; + iEvent.getByToken(trackToken_, TTTrackHandle); + vector >::const_iterator iterL1Track; + + L1TrkPtrs_.clear(); + zBinCount_.clear(); + ttrk_.clear(); + tdtrk_.clear(); + ttdtrk_.clear(); + + unsigned int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + edm::Ptr trkPtr(TTTrackHandle, this_l1track); + this_l1track++; + float trk_pt = trkPtr->momentum().perp(); + int trk_nstubs = (int)trkPtr->getStubRefs().size(); + float trk_chi2dof = trkPtr->chi2Red(); + float trk_d0 = trkPtr->d0(); + float trk_bendchi2 = trkPtr->stubPtConsistency(); + + int trk_nPS = 0; + for (int istub = 0; istub < trk_nstubs; istub++) { // loop over the stubs + DetId detId(trkPtr->getStubRefs().at(istub)->getDetId()); + if (detId.det() == DetId::Detector::Tracker) { + if ((detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || + (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9)) + trk_nPS++; + } + } + + if (trk_nPS < trkNPSStubMin_) + continue; + if (!trackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) + continue; + if (fabs(iterL1Track->z0()) > trkZMax_) + continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) + continue; + if (trk_pt < trkPtMin_) + continue; + L1TrkPtrs_.push_back(trkPtr); + zBinCount_.push_back(0); + + if ((fabs(trk_d0) > d0CutNStubs5_ && trk_nstubs >= 5) || (trk_nstubs == 4 && fabs(trk_d0) > d0CutNStubs4_)) + tdtrk_.push_back(1); + else + tdtrk_.push_back(0); //displaced track + if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_) || + (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_)) + ttrk_.push_back(1); + else + ttrk_.push_back(0); + if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_ && + fabs(trk_d0) > d0CutNStubs5_) || + (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_ && + fabs(trk_d0) > d0CutNStubs4_)) + ttdtrk_.push_back(1); + else + ttdtrk_.push_back(0); + } + + if (!L1TrkPtrs_.empty()) { + MaxZBin mzb; + + L2_cluster(L1TrkPtrs_, ttrk_, tdtrk_, ttdtrk_, mzb); + edm::Ref jetRef; //null, no Calo Jet Ref + vector > L1TrackAssocJet; + if (mzb.clusters != nullptr) { + for (int j = 0; j < mzb.nclust; ++j) { + //FILL Two Layer Jets for Jet Collection + if (mzb.clusters[j].pTtot <= trkPtMin_) + continue; //protects against reading bad memory + if (mzb.clusters[j].numtracks < 1) + continue; + if (mzb.clusters[j].numtracks > 5000) + continue; + float jetEta = mzb.clusters[j].eta; + float jetPhi = mzb.clusters[j].phi; + float jetPt = mzb.clusters[j].pTtot; + float jetPx = jetPt * cos(jetPhi); + float jetPy = jetPt * sin(jetPhi); + float jetPz = jetPt * sinh(jetEta); + float jetP = jetPt * cosh(jetEta); + int totalTighttrk_ = mzb.clusters[j].numttrks; + int totalDisptrk = mzb.clusters[j].numtdtrks; + int totalTightDisptrk = mzb.clusters[j].numttdtrks; + + math::XYZTLorentzVector jetP4(jetPx, jetPy, jetPz, jetP); + L1TrackAssocJet.clear(); + for (unsigned int t = 0; t < L1TrkPtrs_.size(); ++t) { + if (L1TrackAssocJet.size() == (unsigned int)mzb.clusters[j].numtracks) + break; + float deta = L1TrkPtrs_[t]->momentum().eta() - jetEta; + float dphi = L1TrkPtrs_[t]->momentum().phi() - jetPhi; + float dZ = fabs(mzb.zbincenter - L1TrkPtrs_[t]->z0()); + if (dZ < zStep_ && fabs(deta) < etaStep_ * 2.0 && fabs(dphi) < phiStep_ * 2.0) { + L1TrackAssocJet.push_back(L1TrkPtrs_[t]); + } + } + TkJet trkJet(jetP4, + L1TrackAssocJet, + mzb.zbincenter, + mzb.clusters[j].numtracks, + totalTighttrk_, + totalDisptrk, + totalTightDisptrk); + //trkJet.setDispCounters(DispCounters); + if (!L1TrackAssocJet.empty()) + L1L1TrackJetProducer->push_back(trkJet); + } + } + //free(mzb.clusters); + if (displaced_) + iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); + else + iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets"); + delete[] mzb.clusters; + } +} + +void L1TrackJetProducer::L2_cluster( + vector > L1TrkPtrs_, vector ttrk_, vector tdtrk_, vector ttdtrk_, MaxZBin &mzb) { + const int nz = zBins_; + MaxZBin all_zBins[nz]; + MaxZBin mzbtemp; + for (int z = 0; z < nz; ++z) + all_zBins[z] = mzbtemp; + + float zmin = -1.0 * trkZMax_; + float zmax = zmin + 2 * zStep_; + + EtaPhiBin epbins[phiBins_][etaBins_]; // create grid of phiBins + float phi = -1.0 * M_PI; + float eta; + float etamin, etamax, phimin, phimax; + for (int i = 0; i < phiBins_; ++i) { + eta = -1.0 * trkEtaMax_; + for (int j = 0; j < etaBins_; ++j) { + phimin = phi; + phimax = phi + phiStep_; + etamin = eta; + eta = eta + etaStep_; + etamax = eta; + epbins[i][j].phi = (phimin + phimax) / 2.0; + epbins[i][j].eta = (etamin + etamax) / 2.0; + } // for each etabin + phi = phi + phiStep_; + } // for each phibin (finished creating epbins) + mzb = all_zBins[0]; + int ntracks = L1TrkPtrs_.size(); + // uninitalized arrays + EtaPhiBin *L1clusters[phiBins_]; + EtaPhiBin L2cluster[ntracks]; + + for (int zbin = 0; zbin < zBins_ - 1; ++zbin) { + for (int i = 0; i < phiBins_; ++i) { //First initialize pT, numtracks, used to 0 (or false) + for (int j = 0; j < etaBins_; ++j) { + epbins[i][j].pTtot = 0; + epbins[i][j].used = false; + epbins[i][j].numtracks = 0; + epbins[i][j].numttrks = 0; + epbins[i][j].numtdtrks = 0; + epbins[i][j].numttdtrks = 0; + } //for each etabin + L1clusters[i] = epbins[i]; + } //for each phibin + + for (unsigned int k = 0; k < L1TrkPtrs_.size(); ++k) { + float trkpt = L1TrkPtrs_[k]->momentum().perp(); + float trketa = L1TrkPtrs_[k]->momentum().eta(); + float trkphi = L1TrkPtrs_[k]->momentum().phi(); + float trkZ = L1TrkPtrs_[k]->z0(); + + for (int i = 0; i < phiBins_; ++i) { + for (int j = 0; j < etaBins_; ++j) { + L2cluster[k] = epbins[i][j]; + if ((zmin <= trkZ && zmax >= trkZ) && + ((epbins[i][j].eta - etaStep_ / 2.0 <= trketa && epbins[i][j].eta + etaStep_ / 2.0 >= trketa) && + epbins[i][j].phi - phiStep_ / 2.0 <= trkphi && epbins[i][j].phi + phiStep_ / 2.0 >= trkphi && + (zBinCount_[k] != 2))) { + zBinCount_.at(k) = zBinCount_.at(k) + 1; + if (trkpt < trkPtMax_) + epbins[i][j].pTtot += trkpt; + else + epbins[i][j].pTtot += trkPtMax_; + epbins[i][j].numttrks += ttrk_[k]; + epbins[i][j].numtdtrks += tdtrk_[k]; + epbins[i][j].numttdtrks += ttdtrk_[k]; + ++epbins[i][j].numtracks; + } // if right bin + } // for each phibin: j loop + } // for each phibin: i loop + } // end loop over tracks + + for (int phislice = 0; phislice < phiBins_; ++phislice) { + L1clusters[phislice] = L1_cluster(epbins[phislice]); + for (int ind = 0; L1clusters[phislice][ind].pTtot != 0; ++ind) { + L1clusters[phislice][ind].used = false; + } + } + + //Create clusters array to hold output cluster data for Layer2; can't have more clusters than tracks. + //Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used. + float hipT = 0; + int nclust = 0; + int phibin = 0; + int imax = -1; + int index1; //index of clusters array for each phislice + float E1 = 0; + float E0 = 0; + float E2 = 0; + int trx1, trx2; + int ttrk1, ttrk2; + int tdtrk1, tdtrk2; + int ttdtrk1, ttdtrk2; + int used1, used2, used3, used4; + + for (phibin = 0; phibin < phiBins_; ++phibin) { //Find eta-phibin with highest pT + while (true) { + hipT = 0; + for (index1 = 0; L1clusters[phibin][index1].pTtot > 0; ++index1) { + if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) { + hipT = L1clusters[phibin][index1].pTtot; + imax = index1; + } + } // for each index within the phibin + + if (hipT == 0) + break; // If highest pT is 0, all bins are used + E0 = hipT; // E0 is pT of first phibin of the cluster + E1 = 0; + E2 = 0; + trx1 = 0; + trx2 = 0; + ttrk1 = 0; + ttrk2 = 0; + tdtrk1 = 0; + tdtrk2 = 0; + ttdtrk1 = 0; + ttdtrk2 = 0; + L2cluster[nclust] = L1clusters[phibin][imax]; + L1clusters[phibin][imax].used = true; + // Add pT of upper neighbor + // E1 is pT of the middle phibin (should be highest pT) + if (phibin != phiBins_ - 1) { + used1 = -1; + used2 = -1; + for (index1 = 0; L1clusters[phibin + 1][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin + 1][index1].used) + continue; + if (fabs(L1clusters[phibin + 1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) { + E1 += L1clusters[phibin + 1][index1].pTtot; + trx1 += L1clusters[phibin + 1][index1].numtracks; + ttrk1 += L1clusters[phibin + 1][index1].numttrks; + tdtrk1 += L1clusters[phibin + 1][index1].numtdtrks; + ttdtrk1 += L1clusters[phibin + 1][index1].numttdtrks; + if (used1 < 0) + used1 = index1; + else + used2 = index1; + } // if cluster is within one phibin + } // for each cluster in above phibin + + if (E1 < E0) { // if E1 isn't higher, E0 and E1 are their own cluster + L2cluster[nclust].pTtot += E1; + L2cluster[nclust].numtracks += trx1; + L2cluster[nclust].numttrks += ttrk1; + L2cluster[nclust].numtdtrks += tdtrk1; + L2cluster[nclust].numttdtrks += ttdtrk1; + if (used1 >= 0) + L1clusters[phibin + 1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin + 1][used2].used = true; + nclust++; + continue; + } + + if (phibin != phiBins_ - 2) { // E2 will be the pT of the third phibin (should be lower than E1) + used3 = -1; + used4 = -1; + for (index1 = 0; L1clusters[phibin + 2][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin + 2][index1].used) + continue; + if (fabs(L1clusters[phibin + 2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) { + E2 += L1clusters[phibin + 2][index1].pTtot; + trx2 += L1clusters[phibin + 2][index1].numtracks; + ttrk2 += L1clusters[phibin + 2][index1].numttrks; + tdtrk2 += L1clusters[phibin + 2][index1].numtdtrks; + ttdtrk2 += L1clusters[phibin + 2][index1].numttdtrks; + if (used3 < 0) + used3 = index1; + else + used4 = index1; + } + } + // if indeed E2 < E1, add E1 and E2 to E0, they're all a cluster together + // otherwise, E0 is its own cluster + if (E2 < E1) { + L2cluster[nclust].pTtot += E1 + E2; + L2cluster[nclust].numtracks += trx1 + trx2; + L2cluster[nclust].numttrks += ttrk1 + ttrk2; + L2cluster[nclust].numtdtrks += tdtrk1 + tdtrk2; + L2cluster[nclust].numttdtrks += ttdtrk1 + ttdtrk2; + L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi; + if (used1 >= 0) + L1clusters[phibin + 1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin + 1][used2].used = true; + if (used3 >= 0) + L1clusters[phibin + 2][used3].used = true; + if (used4 >= 0) + L1clusters[phibin + 2][used4].used = true; + } + nclust++; + continue; + } // end Not phiBins-2 + else { + L2cluster[nclust].pTtot += E1; + L2cluster[nclust].numtracks += trx1; + L2cluster[nclust].numttrks += ttrk1; + L2cluster[nclust].numtdtrks += tdtrk1; + L2cluster[nclust].numttdtrks += ttdtrk1; + L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi; + if (used1 >= 0) + L1clusters[phibin + 1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin + 1][used2].used = true; + nclust++; + continue; + } + } //End not last phibin(23) + else { //if it is phibin 23 + L1clusters[phibin][imax].used = true; + nclust++; + } + } // while hipT not 0 + } // for each phibin + + for (phibin = 0; phibin < phiBins_; ++phibin) + delete[] L1clusters[phibin]; + + // Now merge clusters, if necessary + for (int m = 0; m < nclust - 1; ++m) { + for (int n = m + 1; n < nclust; ++n) + if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5 * phiStep_ || + fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { + if (L2cluster[n].pTtot > L2cluster[m].pTtot) + L2cluster[m].phi = L2cluster[n].phi; + L2cluster[m].pTtot += L2cluster[n].pTtot; + L2cluster[m].numtracks += L2cluster[n].numtracks; + L2cluster[m].numttrks += L2cluster[n].numttrks; + L2cluster[m].numtdtrks += L2cluster[n].numtdtrks; + L2cluster[m].numttdtrks += L2cluster[n].numttdtrks; + for (int m1 = n; m1 < nclust - 1; ++m1) + L2cluster[m1] = L2cluster[m1 + 1]; + nclust--; + m = -1; + break; //????? + } // end if clusters neighbor in eta + } // end for (m) loop + + // sum up all pTs in this zbin to find ht + float ht = 0; + for (int k = 0; k < nclust; ++k) { + if (L2cluster[k].pTtot > minJetEtLowPt_ && L2cluster[k].numtracks < lowpTJetMinTrackMultiplicity_) + continue; + if (L2cluster[k].pTtot > minJetEtHighPt_ && L2cluster[k].numtracks < highpTJetMinTrackMultiplicity_) + continue; + if (L2cluster[k].pTtot > minTrkJetpT_) + ht += L2cluster[k].pTtot; + } + + // if ht is larger than previous max, this is the new vertex zbin + all_zBins[zbin].znum = zbin; + all_zBins[zbin].clusters = new EtaPhiBin[nclust]; + all_zBins[zbin].nclust = nclust; + all_zBins[zbin].zbincenter = (zmin + zmax) / 2.0; + for (int k = 0; k < nclust; ++k) { + all_zBins[zbin].clusters[k].phi = L2cluster[k].phi; + all_zBins[zbin].clusters[k].eta = L2cluster[k].eta; + all_zBins[zbin].clusters[k].pTtot = L2cluster[k].pTtot; + all_zBins[zbin].clusters[k].numtracks = L2cluster[k].numtracks; + all_zBins[zbin].clusters[k].numttrks = L2cluster[k].numttrks; + all_zBins[zbin].clusters[k].numtdtrks = L2cluster[k].numtdtrks; + all_zBins[zbin].clusters[k].numttdtrks = L2cluster[k].numttdtrks; + } + all_zBins[zbin].ht = ht; + if (ht >= mzb.ht) { + mzb = all_zBins[zbin]; + mzb.zbincenter = (zmin + zmax) / 2.0; + } + // Prepare for next zbin! + zmin = zmin + zStep_; + zmax = zmax + zStep_; + } // for each zbin + for (int zbin = 0; zbin < zBins_ - 1; ++zbin) { + if (zbin == mzb.znum) + continue; + delete[] all_zBins[zbin].clusters; + } +} + +EtaPhiBin *L1TrackJetProducer::L1_cluster(EtaPhiBin *phislice) { + EtaPhiBin *clusters = new EtaPhiBin[etaBins_ / 2]; + if (clusters == nullptr) + edm::LogWarning("L1TrackJetProducer") << "Clusters memory not assigned!\n"; + + // Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used + float my_pt, left_pt, right_pt, right2pt; + int nclust = 0; + right2pt = 0; + for (int etabin = 0; etabin < etaBins_; ++etabin) { + // assign values for my pT and neighbors' pT + if (phislice[etabin].used) + continue; + my_pt = phislice[etabin].pTtot; + if (etabin > 0 && !phislice[etabin - 1].used) { + left_pt = phislice[etabin - 1].pTtot; + } else + left_pt = 0; + if (etabin < etaBins_ - 1 && !phislice[etabin + 1].used) { + right_pt = phislice[etabin + 1].pTtot; + if (etabin < etaBins_ - 2 && !phislice[etabin + 2].used) { + right2pt = phislice[etabin + 2].pTtot; + } else + right2pt = 0; + } else + right_pt = 0; + + // if I'm not a cluster, move on + if (my_pt < left_pt || my_pt <= right_pt) { + // if unused pT in the left neighbor, spit it out as a cluster + if (left_pt > 0) { + clusters[nclust] = phislice[etabin - 1]; + phislice[etabin - 1].used = true; + nclust++; + } + continue; + } + + // I guess I'm a cluster-- should I use my right neighbor? + // Note: left neighbor will definitely be used because if it + // didn't belong to me it would have been used already + clusters[nclust] = phislice[etabin]; + phislice[etabin].used = true; + if (left_pt > 0) { + clusters[nclust].pTtot += left_pt; + clusters[nclust].numtracks += phislice[etabin - 1].numtracks; + clusters[nclust].numttrks += phislice[etabin - 1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin - 1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin - 1].numttdtrks; + } + if (my_pt >= right2pt && right_pt > 0) { + clusters[nclust].pTtot += right_pt; + clusters[nclust].numtracks += phislice[etabin + 1].numtracks; + clusters[nclust].numttrks += phislice[etabin + 1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin + 1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin + 1].numttdtrks; + phislice[etabin + 1].used = true; + } + nclust++; + } // for each etabin + + // Now merge clusters, if necessary + for (int m = 0; m < nclust - 1; ++m) { + if (fabs(clusters[m + 1].eta - clusters[m].eta) < 1.5 * etaStep_) { + if (clusters[m + 1].pTtot > clusters[m].pTtot) { + clusters[m].eta = clusters[m + 1].eta; + } + clusters[m].pTtot += clusters[m + 1].pTtot; + clusters[m].numtracks += clusters[m + 1].numtracks; // Previous version didn't add tracks when merging + clusters[m].numttrks += clusters[m + 1].numttrks; + clusters[m].numtdtrks += clusters[m + 1].numtdtrks; + clusters[m].numttdtrks += clusters[m + 1].numttdtrks; + for (int m1 = m + 1; m1 < nclust - 1; ++m1) + clusters[m1] = clusters[m1 + 1]; + nclust--; + m = -1; + } // end if clusters neighbor in eta + } // end for (m) loop + + for (int i = nclust; i < etaBins_ / 2; ++i) // zero out remaining unused clusters + clusters[i].pTtot = 0; + return clusters; +} + +void L1TrackJetProducer::beginStream(StreamID) {} + +void L1TrackJetProducer::endStream() {} + +bool L1TrackJetProducer::trackQualityCuts( + float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0) { + bool PassQuality = false; + if (trk_bendchi2 < trkBendChi2Max_ && trk_chi2 < trkChi2dofMax_ && trk_nstub >= 4 && !displaced_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendTight_ && trk_chi2 < nStubs4DisplacedChi2Tight_ && + trk_nstub == 4 && trk_d0 <= d0CutNStubs4_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendLoose_ && trk_chi2 < nStubs4DisplacedChi2Loose_ && + trk_nstub == 4 && trk_d0 > d0CutNStubs4_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs5DisplacedBendLoose_ && trk_chi2 < nStubs5DisplacedChi2Loose_ && trk_nstub > 4) + PassQuality = true; + return PassQuality; +} + +void L1TrackJetProducer::fillDescriptions(ConfigurationDescriptions &descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TrackJetProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc new file mode 100644 index 0000000000000..e577ac4c380d5 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc @@ -0,0 +1,2236 @@ +////////////////////////////////////////////////////////////////////// +// // +// Analyzer for making mini-ntuple for L1 track performance plots // +// // +////////////////////////////////////////////////////////////////////// + +//////////////////// +// FRAMEWORK HEADERS +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +/////////////////////// +// DATA FORMATS HEADERS +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" + +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TrackTrigger/interface/TTCluster.h" +#include "DataFormats/L1TrackTrigger/interface/TTStub.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/TrackingHit/interface/PSimHit.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTClusterAssociationMap.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTStubAssociationMap.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTTrackAssociationMap.h" +#include "Geometry/Records/interface/StackedTrackerGeometryRecord.h" + +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" + +//////////////////////////// +// DETECTOR GEOMETRY HEADERS +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" + +#include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h" +#include "Geometry/Records/interface/StackedTrackerGeometryRecord.h" + +//////////////// +// PHYSICS TOOLS +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +//My additions +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +/////////////// +// ROOT HEADERS +#include +#include +#include +#include +#include +#include +#include +#include + +////////////// +// STD HEADERS +#include +#include +#include + +////////////// +// NAMESPACES +using namespace std; +using namespace edm; + +////////////////////////////// +// // +// CLASS DEFINITION // +// // +////////////////////////////// + +class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { +public: + // Constructor/destructor + explicit L1TrackObjectNtupleMaker(const edm::ParameterSet& iConfig); + ~L1TrackObjectNtupleMaker() override; + + // Mandatory methods + void beginJob() override; + void endJob() override; + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; + +protected: +private: + //----------------------------------------------------------------------------------------------- + // Containers of parameters passed by python configuration file + edm::ParameterSet config; + + int MyProcess; // 11/13/211 for single electrons/muons/pions, 6/15 for pions from ttbar/taus, 1 for inclusive + bool DebugMode; // lots of debug printout statements + bool SaveAllTracks; // store in ntuples not only truth-matched tracks but ALL tracks + bool SaveStubs; // option to save also stubs in the ntuples (makes them large...) + string Displaced; // "Prompt", "Displaced", "Both" + int TP_minNStub; // require TPs to have >= minNStub (defining efficiency denominator) (==0 means to only require >= 1 cluster) + int TP_minNStubLayer; // require TPs to have stubs in >= minNStubLayer layers/disks (defining efficiency denominator) + double TP_minPt; // save TPs with pt > minPt + double TP_maxEta; // save TPs with |eta| < maxEta + double TP_maxZ0; // save TPs with |z0| < maxZ0 + int L1Tk_minNStub; // require L1 tracks to have >= minNStub (this is mostly for tracklet purposes) + bool TrackingInJets; // do tracking in jets? + bool SaveTrackJets; + bool SaveTrackMET; + + edm::InputTag L1TrackInputTag; // L1 track collection + edm::InputTag MCTruthTrackInputTag; // MC truth collection + edm::InputTag L1TrackExtendedInputTag; // L1 track collection + edm::InputTag MCTruthTrackExtendedInputTag; // MC truth collection + edm::InputTag MCTruthClusterInputTag; + edm::InputTag L1StubInputTag; + edm::InputTag MCTruthStubInputTag; + edm::InputTag TrackingParticleInputTag; + edm::InputTag TrackingVertexInputTag; + edm::InputTag GenJetInputTag; + edm::InputTag RecoVertexInputTag; + edm::InputTag GenParticleInputTag; + + edm::InputTag TrackFastJetsInputTag; + edm::InputTag TrackJetsInputTag; + edm::InputTag TrackMETInputTag; + edm::InputTag TrackMHTInputTag; + + edm::InputTag TrackFastJetsExtendedInputTag; + edm::InputTag TrackJetsExtendedInputTag; + edm::InputTag TrackMETExtendedInputTag; + edm::InputTag TrackMHTExtendedInputTag; + + edm::EDGetTokenT > > ttClusterToken_; + edm::EDGetTokenT > > ttStubToken_; + edm::EDGetTokenT > ttClusterMCTruthToken_; + edm::EDGetTokenT > ttStubMCTruthToken_; + + edm::EDGetTokenT > > ttTrackToken_; + edm::EDGetTokenT > ttTrackMCTruthToken_; + edm::EDGetTokenT > > ttTrackExtendedToken_; + edm::EDGetTokenT > ttTrackMCTruthExtendedToken_; + + edm::EDGetTokenT > TrackingParticleToken_; + edm::EDGetTokenT > TrackingVertexToken_; + + edm::EDGetTokenT > GenJetToken_; + edm::EDGetTokenT > GenParticleToken_; + edm::EDGetTokenT L1VertexToken_; + + edm::EDGetTokenT > TrackFastJetsToken_; + edm::EDGetTokenT > TrackFastJetsExtendedToken_; + edm::EDGetTokenT > TrackMETToken_; + edm::EDGetTokenT > TrackMETExtendedToken_; + edm::EDGetTokenT TrackMHTToken_; + edm::EDGetTokenT TrackMHTExtendedToken_; + edm::EDGetTokenT TrackJetsToken_; + edm::EDGetTokenT TrackJetsExtendedToken_; + + //----------------------------------------------------------------------------------------------- + // tree & branches for mini-ntuple + + bool available_; // ROOT file for histograms is open. + + TTree* eventTree; + + // primary vertex + // std::vector* m_pv_L1recotruesumpt; + // std::vector* m_pv_L1recosumpt; + std::vector* m_pv_L1reco; + // std::vector* m_pv_L1TP; + // std::vector* m_pv_L1TPsumpt; + std::vector* m_pv_MC; + // std::vector* m_pv_MCChgSumpT; + std::vector* m_MC_lep; + + // all L1 tracks (prompt) + std::vector* m_trk_pt; + std::vector* m_trk_eta; + std::vector* m_trk_phi; + std::vector* m_trk_d0; // (filled if nFitPar==5, else 999) + std::vector* m_trk_z0; + std::vector* m_trk_chi2; + std::vector* m_trk_chi2dof; + std::vector* m_trk_chi2rphi; + std::vector* m_trk_chi2rz; + std::vector* m_trk_bendchi2; + std::vector* m_trk_nstub; + std::vector* m_trk_lhits; + std::vector* m_trk_dhits; + std::vector* m_trk_seed; + std::vector* m_trk_hitpattern; + std::vector* m_trk_phiSector; + std::vector* m_trk_genuine; + std::vector* m_trk_loose; + std::vector* m_trk_unknown; + std::vector* m_trk_combinatoric; + std::vector* m_trk_fake; //0 fake, 1 track from primary interaction, 2 secondary track + std::vector* m_trk_matchtp_pdgid; + std::vector* m_trk_matchtp_pt; + std::vector* m_trk_matchtp_eta; + std::vector* m_trk_matchtp_phi; + std::vector* m_trk_matchtp_z0; + std::vector* m_trk_matchtp_dxy; + + // all L1 tracks (extended) + std::vector* m_trkExt_pt; + std::vector* m_trkExt_eta; + std::vector* m_trkExt_phi; + std::vector* m_trkExt_d0; // (filled if nFitPar==5, else 999) + std::vector* m_trkExt_z0; + std::vector* m_trkExt_chi2; + std::vector* m_trkExt_chi2dof; + std::vector* m_trkExt_chi2rphi; + std::vector* m_trkExt_chi2rz; + std::vector* m_trkExt_bendchi2; + std::vector* m_trkExt_nstub; + std::vector* m_trkExt_lhits; + std::vector* m_trkExt_dhits; + std::vector* m_trkExt_seed; + std::vector* m_trkExt_hitpattern; + std::vector* m_trkExt_phiSector; + std::vector* m_trkExt_genuine; + std::vector* m_trkExt_loose; + std::vector* m_trkExt_unknown; + std::vector* m_trkExt_combinatoric; + std::vector* m_trkExt_fake; //0 fake, 1 track from primary interaction, 2 secondary track + std::vector* m_trkExt_matchtp_pdgid; + std::vector* m_trkExt_matchtp_pt; + std::vector* m_trkExt_matchtp_eta; + std::vector* m_trkExt_matchtp_phi; + std::vector* m_trkExt_matchtp_z0; + std::vector* m_trkExt_matchtp_dxy; + + // all tracking particles + std::vector* m_tp_pt; + std::vector* m_tp_eta; + std::vector* m_tp_phi; + std::vector* m_tp_dxy; + std::vector* m_tp_d0; + std::vector* m_tp_z0; + std::vector* m_tp_d0_prod; + std::vector* m_tp_z0_prod; + std::vector* m_tp_pdgid; + std::vector* m_tp_nmatch; + std::vector* m_tp_nstub; + std::vector* m_tp_eventid; + std::vector* m_tp_charge; + + // *L1 track* properties if m_tp_nmatch > 0 (prompt) + std::vector* m_matchtrk_pt; + std::vector* m_matchtrk_eta; + std::vector* m_matchtrk_phi; + std::vector* m_matchtrk_d0; //this variable is only filled if nFitPar==5 + std::vector* m_matchtrk_z0; + std::vector* m_matchtrk_chi2; + std::vector* m_matchtrk_chi2dof; + std::vector* m_matchtrk_chi2rphi; + std::vector* m_matchtrk_chi2rz; + std::vector* m_matchtrk_bendchi2; + std::vector* m_matchtrk_nstub; + std::vector* m_matchtrk_lhits; + std::vector* m_matchtrk_dhits; + std::vector* m_matchtrk_seed; + std::vector* m_matchtrk_hitpattern; + + // *L1 track* properties if m_tp_nmatch > 0 (extended) + std::vector* m_matchtrkExt_pt; + std::vector* m_matchtrkExt_eta; + std::vector* m_matchtrkExt_phi; + std::vector* m_matchtrkExt_d0; //this variable is only filled if nFitPar==5 + std::vector* m_matchtrkExt_z0; + std::vector* m_matchtrkExt_chi2; + std::vector* m_matchtrkExt_chi2dof; + std::vector* m_matchtrkExt_chi2rphi; + std::vector* m_matchtrkExt_chi2rz; + std::vector* m_matchtrkExt_bendchi2; + std::vector* m_matchtrkExt_nstub; + std::vector* m_matchtrkExt_lhits; + std::vector* m_matchtrkExt_dhits; + std::vector* m_matchtrkExt_seed; + std::vector* m_matchtrkExt_hitpattern; + + // ALL stubs + std::vector* m_allstub_x; + std::vector* m_allstub_y; + std::vector* m_allstub_z; + std::vector* m_allstub_isBarrel; // stub is in barrel (1) or in disk (0) + std::vector* m_allstub_layer; + std::vector* m_allstub_isPSmodule; + std::vector* m_allstub_trigDisplace; + std::vector* m_allstub_trigOffset; + std::vector* m_allstub_trigPos; + std::vector* m_allstub_trigBend; + + // stub associated with tracking particle ? + std::vector* m_allstub_matchTP_pdgid; // -999 if not matched + std::vector* m_allstub_matchTP_pt; // -999 if not matched + std::vector* m_allstub_matchTP_eta; // -999 if not matched + std::vector* m_allstub_matchTP_phi; // -999 if not matched + std::vector* m_allstub_genuine; + + // // track jet variables (for each gen jet, store the sum of pt of TPs / tracks inside jet cone) + // std::vector* m_jet_eta; + // std::vector* m_jet_phi; + // std::vector* m_jet_pt; + // std::vector* m_jet_tp_sumpt; + // std::vector* m_jet_trk_sumpt; + // std::vector* m_jet_matchtrk_sumpt; + + float trueMET = 0; + float trkMET = 0; + float trkMHT = 0; + float trkHT = 0; + + float trkMETExt = 0; + float trkMHTExt = 0; + float trkHTExt = 0; + + std::vector* m_2ltrkjet_vz; + std::vector* m_2ltrkjet_p; + std::vector* m_2ltrkjet_phi; + std::vector* m_2ltrkjet_eta; + std::vector* m_2ltrkjet_pt; + std::vector* m_2ltrkjet_ntracks; + std::vector* m_2ltrkjet_nDisplaced; + std::vector* m_2ltrkjet_nTight; + std::vector* m_2ltrkjet_nTightDisplaced; + std::vector* m_2ltrkjet_ntdtrk; + + std::vector* m_trkjet_vz; + std::vector* m_trkjet_p; + std::vector* m_trkjet_phi; + std::vector* m_trkjet_eta; + std::vector* m_trkjet_pt; + std::vector* m_trkjet_ntracks; + std::vector* m_trkjet_tp_sumpt; + std::vector* m_trkjet_truetp_sumpt; + + std::vector* m_2ltrkjetExt_vz; + std::vector* m_2ltrkjetExt_p; + std::vector* m_2ltrkjetExt_phi; + std::vector* m_2ltrkjetExt_eta; + std::vector* m_2ltrkjetExt_pt; + std::vector* m_2ltrkjetExt_ntracks; + std::vector* m_2ltrkjetExt_nDisplaced; + std::vector* m_2ltrkjetExt_nTight; + std::vector* m_2ltrkjetExt_nTightDisplaced; + std::vector* m_2ltrkjetExt_ntdtrk; + + std::vector* m_trkjetExt_vz; + std::vector* m_trkjetExt_p; + std::vector* m_trkjetExt_phi; + std::vector* m_trkjetExt_eta; + std::vector* m_trkjetExt_pt; + std::vector* m_trkjetExt_ntracks; + std::vector* m_trkjetExt_tp_sumpt; + std::vector* m_trkjetExt_truetp_sumpt; +}; + +////////////////////////////////// +// // +// CLASS IMPLEMENTATION // +// // +////////////////////////////////// + +////////////// +// CONSTRUCTOR +L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iConfig) : config(iConfig) { + MyProcess = iConfig.getParameter("MyProcess"); + DebugMode = iConfig.getParameter("DebugMode"); + SaveAllTracks = iConfig.getParameter("SaveAllTracks"); + SaveStubs = iConfig.getParameter("SaveStubs"); + Displaced = iConfig.getParameter("Displaced"); + TP_minNStub = iConfig.getParameter("TP_minNStub"); + TP_minNStubLayer = iConfig.getParameter("TP_minNStubLayer"); + TP_minPt = iConfig.getParameter("TP_minPt"); + TP_maxEta = iConfig.getParameter("TP_maxEta"); + TP_maxZ0 = iConfig.getParameter("TP_maxZ0"); + L1Tk_minNStub = iConfig.getParameter("L1Tk_minNStub"); + + TrackingInJets = iConfig.getParameter("TrackingInJets"); + SaveTrackJets = iConfig.getParameter("SaveTrackJets"); + SaveTrackMET = iConfig.getParameter("SaveTrackMET"); + + L1StubInputTag = iConfig.getParameter("L1StubInputTag"); + MCTruthClusterInputTag = iConfig.getParameter("MCTruthClusterInputTag"); + MCTruthStubInputTag = iConfig.getParameter("MCTruthStubInputTag"); + TrackingParticleInputTag = iConfig.getParameter("TrackingParticleInputTag"); + TrackingVertexInputTag = iConfig.getParameter("TrackingVertexInputTag"); + GenJetInputTag = iConfig.getParameter("GenJetInputTag"); + RecoVertexInputTag = iConfig.getParameter("RecoVertexInputTag"); + GenParticleInputTag = iConfig.getParameter("GenParticleInputTag"); + + if (Displaced == "Prompt" || Displaced == "Both") { + L1TrackInputTag = iConfig.getParameter("L1TrackInputTag"); + MCTruthTrackInputTag = iConfig.getParameter("MCTruthTrackInputTag"); + TrackFastJetsInputTag = iConfig.getParameter("TrackFastJetsInputTag"); + TrackJetsInputTag = iConfig.getParameter("TrackJetsInputTag"); + TrackMETInputTag = iConfig.getParameter("TrackMETInputTag"); + TrackMHTInputTag = iConfig.getParameter("TrackMHTInputTag"); + + ttTrackToken_ = consumes > >(L1TrackInputTag); + ttTrackMCTruthToken_ = consumes >(MCTruthTrackInputTag); + TrackFastJetsToken_ = consumes >(TrackFastJetsInputTag); + TrackJetsToken_ = consumes(TrackJetsInputTag); + TrackMETToken_ = consumes >(TrackMETInputTag); + TrackMHTToken_ = consumes(TrackMHTInputTag); + } + + if (Displaced == "Displaced" || Displaced == "Both") { + L1TrackExtendedInputTag = iConfig.getParameter("L1TrackExtendedInputTag"); + MCTruthTrackExtendedInputTag = iConfig.getParameter("MCTruthTrackExtendedInputTag"); + TrackFastJetsExtendedInputTag = iConfig.getParameter("TrackFastJetsExtendedInputTag"); + TrackJetsExtendedInputTag = iConfig.getParameter("TrackJetsExtendedInputTag"); + TrackMETExtendedInputTag = iConfig.getParameter("TrackMETExtendedInputTag"); + TrackMHTExtendedInputTag = iConfig.getParameter("TrackMHTExtendedInputTag"); + + ttTrackExtendedToken_ = consumes > >(L1TrackExtendedInputTag); + ttTrackMCTruthExtendedToken_ = + consumes >(MCTruthTrackExtendedInputTag); + TrackFastJetsExtendedToken_ = consumes >(TrackFastJetsExtendedInputTag); + TrackJetsExtendedToken_ = consumes(TrackJetsExtendedInputTag); + TrackMETExtendedToken_ = consumes >(TrackMETExtendedInputTag); + TrackMHTExtendedToken_ = consumes(TrackMHTExtendedInputTag); + } + + ttStubToken_ = consumes > >(L1StubInputTag); + ttClusterMCTruthToken_ = consumes >(MCTruthClusterInputTag); + ttStubMCTruthToken_ = consumes >(MCTruthStubInputTag); + TrackingParticleToken_ = consumes >(TrackingParticleInputTag); + TrackingVertexToken_ = consumes >(TrackingVertexInputTag); + GenJetToken_ = consumes >(GenJetInputTag); + GenParticleToken_ = consumes >(GenParticleInputTag); + L1VertexToken_ = consumes(RecoVertexInputTag); +} + +///////////// +// DESTRUCTOR +L1TrackObjectNtupleMaker::~L1TrackObjectNtupleMaker() {} + +////////// +// END JOB +void L1TrackObjectNtupleMaker::endJob() { + // things to be done at the exit of the event Loop + // edm::LogVerbatim("Tracklet") << "L1TrackObjectNtupleMaker::endJob"; +} + +//////////// +// BEGIN JOB +void L1TrackObjectNtupleMaker::beginJob() { + // things to be done before entering the event Loop + // edm::LogVerbatim("Tracklet") << "L1TrackObjectNtupleMaker::beginJob"; + + //----------------------------------------------------------------------------------------------- + // book histograms / make ntuple + edm::Service fs; + available_ = fs.isAvailable(); + if (not available_) + return; // No ROOT file open. + + // initilize + m_trk_pt = new std::vector; + m_trk_eta = new std::vector; + m_trk_phi = new std::vector; + m_trk_z0 = new std::vector; + m_trk_d0 = new std::vector; + m_trk_chi2 = new std::vector; + m_trk_chi2dof = new std::vector; + m_trk_chi2rphi = new std::vector; + m_trk_chi2rz = new std::vector; + m_trk_bendchi2 = new std::vector; + m_trk_nstub = new std::vector; + m_trk_lhits = new std::vector; + m_trk_dhits = new std::vector; + m_trk_seed = new std::vector; + m_trk_hitpattern = new std::vector; + m_trk_phiSector = new std::vector; + m_trk_genuine = new std::vector; + m_trk_loose = new std::vector; + m_trk_unknown = new std::vector; + m_trk_combinatoric = new std::vector; + m_trk_fake = new std::vector; + m_trk_matchtp_pdgid = new std::vector; + m_trk_matchtp_pt = new std::vector; + m_trk_matchtp_eta = new std::vector; + m_trk_matchtp_phi = new std::vector; + m_trk_matchtp_z0 = new std::vector; + m_trk_matchtp_dxy = new std::vector; + + m_trkExt_pt = new std::vector; + m_trkExt_eta = new std::vector; + m_trkExt_phi = new std::vector; + m_trkExt_z0 = new std::vector; + m_trkExt_d0 = new std::vector; + m_trkExt_chi2 = new std::vector; + m_trkExt_chi2dof = new std::vector; + m_trkExt_chi2rphi = new std::vector; + m_trkExt_chi2rz = new std::vector; + m_trkExt_bendchi2 = new std::vector; + m_trkExt_nstub = new std::vector; + m_trkExt_lhits = new std::vector; + m_trkExt_dhits = new std::vector; + m_trkExt_seed = new std::vector; + m_trkExt_hitpattern = new std::vector; + m_trkExt_phiSector = new std::vector; + m_trkExt_genuine = new std::vector; + m_trkExt_loose = new std::vector; + m_trkExt_unknown = new std::vector; + m_trkExt_combinatoric = new std::vector; + m_trkExt_fake = new std::vector; + m_trkExt_matchtp_pdgid = new std::vector; + m_trkExt_matchtp_pt = new std::vector; + m_trkExt_matchtp_eta = new std::vector; + m_trkExt_matchtp_phi = new std::vector; + m_trkExt_matchtp_z0 = new std::vector; + m_trkExt_matchtp_dxy = new std::vector; + + m_tp_pt = new std::vector; + m_tp_eta = new std::vector; + m_tp_phi = new std::vector; + m_tp_dxy = new std::vector; + m_tp_d0 = new std::vector; + m_tp_z0 = new std::vector; + m_tp_d0_prod = new std::vector; + m_tp_z0_prod = new std::vector; + m_tp_pdgid = new std::vector; + m_tp_nmatch = new std::vector; + m_tp_nstub = new std::vector; + m_tp_eventid = new std::vector; + m_tp_charge = new std::vector; + + m_matchtrk_pt = new std::vector; + m_matchtrk_eta = new std::vector; + m_matchtrk_phi = new std::vector; + m_matchtrk_z0 = new std::vector; + m_matchtrk_d0 = new std::vector; + m_matchtrk_chi2 = new std::vector; + m_matchtrk_chi2dof = new std::vector; + m_matchtrk_chi2rphi = new std::vector; + m_matchtrk_chi2rz = new std::vector; + m_matchtrk_bendchi2 = new std::vector; + m_matchtrk_nstub = new std::vector; + m_matchtrk_dhits = new std::vector; + m_matchtrk_lhits = new std::vector; + m_matchtrk_seed = new std::vector; + m_matchtrk_hitpattern = new std::vector; + + m_matchtrkExt_pt = new std::vector; + m_matchtrkExt_eta = new std::vector; + m_matchtrkExt_phi = new std::vector; + m_matchtrkExt_z0 = new std::vector; + m_matchtrkExt_d0 = new std::vector; + m_matchtrkExt_chi2 = new std::vector; + m_matchtrkExt_chi2dof = new std::vector; + m_matchtrkExt_chi2rphi = new std::vector; + m_matchtrkExt_chi2rz = new std::vector; + m_matchtrkExt_bendchi2 = new std::vector; + m_matchtrkExt_nstub = new std::vector; + m_matchtrkExt_dhits = new std::vector; + m_matchtrkExt_lhits = new std::vector; + m_matchtrkExt_seed = new std::vector; + m_matchtrkExt_hitpattern = new std::vector; + + m_allstub_x = new std::vector; + m_allstub_y = new std::vector; + m_allstub_z = new std::vector; + m_allstub_isBarrel = new std::vector; + m_allstub_layer = new std::vector; + m_allstub_isPSmodule = new std::vector; + m_allstub_trigDisplace = new std::vector; + m_allstub_trigOffset = new std::vector; + m_allstub_trigPos = new std::vector; + m_allstub_trigBend = new std::vector; + m_allstub_matchTP_pdgid = new std::vector; + m_allstub_matchTP_pt = new std::vector; + m_allstub_matchTP_eta = new std::vector; + m_allstub_matchTP_phi = new std::vector; + m_allstub_genuine = new std::vector; + + // m_jet_eta = new std::vector; + // m_jet_phi = new std::vector; + // m_jet_pt = new std::vector; + // m_jet_tp_sumpt = new std::vector; + // m_jet_trk_sumpt = new std::vector; + // m_jet_matchtrk_sumpt = new std::vector; + + // m_pv_L1recotruesumpt = new std::vector; + // m_pv_L1recosumpt = new std::vector; + m_pv_L1reco = new std::vector; + // m_pv_L1TP = new std::vector; + // m_pv_L1TPsumpt = new std::vector; + m_pv_MC = new std::vector; + // m_pv_MCChgSumpT = new std::vector; + m_MC_lep = new std::vector; + + m_2ltrkjet_eta = new std::vector; + m_2ltrkjet_vz = new std::vector; + m_2ltrkjet_phi = new std::vector; + m_2ltrkjet_p = new std::vector; + m_2ltrkjet_pt = new std::vector; + m_2ltrkjet_ntracks = new std::vector; + m_2ltrkjet_nDisplaced = new std::vector; + m_2ltrkjet_nTight = new std::vector; + m_2ltrkjet_nTightDisplaced = new std::vector; + m_2ltrkjet_ntdtrk = new std::vector; + + m_trkjet_eta = new std::vector; + m_trkjet_vz = new std::vector; + m_trkjet_phi = new std::vector; + m_trkjet_p = new std::vector; + m_trkjet_pt = new std::vector; + m_trkjet_ntracks = new std::vector; + m_trkjet_tp_sumpt = new std::vector; + m_trkjet_truetp_sumpt = new std::vector; + + m_2ltrkjetExt_eta = new std::vector; + m_2ltrkjetExt_vz = new std::vector; + m_2ltrkjetExt_phi = new std::vector; + m_2ltrkjetExt_p = new std::vector; + m_2ltrkjetExt_pt = new std::vector; + m_2ltrkjetExt_ntracks = new std::vector; + m_2ltrkjetExt_nDisplaced = new std::vector; + m_2ltrkjetExt_nTight = new std::vector; + m_2ltrkjetExt_nTightDisplaced = new std::vector; + m_2ltrkjetExt_ntdtrk = new std::vector; + + m_trkjetExt_eta = new std::vector; + m_trkjetExt_vz = new std::vector; + m_trkjetExt_phi = new std::vector; + m_trkjetExt_p = new std::vector; + m_trkjetExt_pt = new std::vector; + m_trkjetExt_ntracks = new std::vector; + m_trkjetExt_tp_sumpt = new std::vector; + m_trkjetExt_truetp_sumpt = new std::vector; + + // ntuple + eventTree = fs->make("eventTree", "Event tree"); + + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { + eventTree->Branch("trk_pt", &m_trk_pt); + eventTree->Branch("trk_eta", &m_trk_eta); + eventTree->Branch("trk_phi", &m_trk_phi); + eventTree->Branch("trk_d0", &m_trk_d0); + eventTree->Branch("trk_z0", &m_trk_z0); + eventTree->Branch("trk_chi2", &m_trk_chi2); + eventTree->Branch("trk_chi2dof", &m_trk_chi2dof); + eventTree->Branch("trk_chi2rphi", &m_trk_chi2rphi); + eventTree->Branch("trk_chi2rz", &m_trk_chi2rz); + eventTree->Branch("trk_bendchi2", &m_trk_bendchi2); + eventTree->Branch("trk_nstub", &m_trk_nstub); + eventTree->Branch("trk_lhits", &m_trk_lhits); + eventTree->Branch("trk_dhits", &m_trk_dhits); + eventTree->Branch("trk_seed", &m_trk_seed); + eventTree->Branch("trk_hitpattern", &m_trk_hitpattern); + eventTree->Branch("trk_phiSector", &m_trk_phiSector); + eventTree->Branch("trk_genuine", &m_trk_genuine); + eventTree->Branch("trk_loose", &m_trk_loose); + eventTree->Branch("trk_unknown", &m_trk_unknown); + eventTree->Branch("trk_combinatoric", &m_trk_combinatoric); + eventTree->Branch("trk_fake", &m_trk_fake); + eventTree->Branch("trk_matchtp_pdgid", &m_trk_matchtp_pdgid); + eventTree->Branch("trk_matchtp_pt", &m_trk_matchtp_pt); + eventTree->Branch("trk_matchtp_eta", &m_trk_matchtp_eta); + eventTree->Branch("trk_matchtp_phi", &m_trk_matchtp_phi); + eventTree->Branch("trk_matchtp_z0", &m_trk_matchtp_z0); + eventTree->Branch("trk_matchtp_dxy", &m_trk_matchtp_dxy); + // if (TrackingInJets) { + // eventTree->Branch("trk_injet", &m_trk_injet); + // eventTree->Branch("trk_injet_highpt", &m_trk_injet_highpt); + // eventTree->Branch("trk_injet_vhighpt", &m_trk_injet_vhighpt); + // } + } + + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { + eventTree->Branch("trkExt_pt", &m_trkExt_pt); + eventTree->Branch("trkExt_eta", &m_trkExt_eta); + eventTree->Branch("trkExt_phi", &m_trkExt_phi); + eventTree->Branch("trkExt_d0", &m_trkExt_d0); + eventTree->Branch("trkExt_z0", &m_trkExt_z0); + eventTree->Branch("trkExt_chi2", &m_trkExt_chi2); + eventTree->Branch("trkExt_chi2dof", &m_trkExt_chi2dof); + eventTree->Branch("trkExt_chi2rphi", &m_trkExt_chi2rphi); + eventTree->Branch("trkExt_chi2rz", &m_trkExt_chi2rz); + eventTree->Branch("trkExt_bendchi2", &m_trkExt_bendchi2); + eventTree->Branch("trkExt_nstub", &m_trkExt_nstub); + eventTree->Branch("trkExt_lhits", &m_trkExt_lhits); + eventTree->Branch("trkExt_dhits", &m_trkExt_dhits); + eventTree->Branch("trkExt_seed", &m_trkExt_seed); + eventTree->Branch("trkExt_hitpattern", &m_trkExt_hitpattern); + eventTree->Branch("trkExt_phiSector", &m_trkExt_phiSector); + eventTree->Branch("trkExt_genuine", &m_trkExt_genuine); + eventTree->Branch("trkExt_loose", &m_trkExt_loose); + eventTree->Branch("trkExt_unknown", &m_trkExt_unknown); + eventTree->Branch("trkExt_combinatoric", &m_trkExt_combinatoric); + eventTree->Branch("trkExt_fake", &m_trkExt_fake); + eventTree->Branch("trkExt_matchtp_pdgid", &m_trkExt_matchtp_pdgid); + eventTree->Branch("trkExt_matchtp_pt", &m_trkExt_matchtp_pt); + eventTree->Branch("trkExt_matchtp_eta", &m_trkExt_matchtp_eta); + eventTree->Branch("trkExt_matchtp_phi", &m_trkExt_matchtp_phi); + eventTree->Branch("trkExt_matchtp_z0", &m_trkExt_matchtp_z0); + eventTree->Branch("trkExt_matchtp_dxy", &m_trkExt_matchtp_dxy); + // if (TrackingInJets) { + // eventTree->Branch("trk_injet", &m_trk_injet); + // eventTree->Branch("trk_injet_highpt", &m_trk_injet_highpt); + // eventTree->Branch("trk_injet_vhighpt", &m_trk_injet_vhighpt); + // } + } + eventTree->Branch("tp_pt", &m_tp_pt); + eventTree->Branch("tp_eta", &m_tp_eta); + eventTree->Branch("tp_phi", &m_tp_phi); + eventTree->Branch("tp_dxy", &m_tp_dxy); + eventTree->Branch("tp_d0", &m_tp_d0); + eventTree->Branch("tp_z0", &m_tp_z0); + eventTree->Branch("tp_d0_prod", &m_tp_d0_prod); + eventTree->Branch("tp_z0_prod", &m_tp_z0_prod); + eventTree->Branch("tp_pdgid", &m_tp_pdgid); + eventTree->Branch("tp_nmatch", &m_tp_nmatch); + eventTree->Branch("tp_nstub", &m_tp_nstub); + eventTree->Branch("tp_eventid", &m_tp_eventid); + eventTree->Branch("tp_charge", &m_tp_charge); + // if (TrackingInJets) { + // eventTree->Branch("tp_injet", &m_tp_injet); + // eventTree->Branch("tp_injet_highpt", &m_tp_injet_highpt); + // eventTree->Branch("tp_injet_vhighpt", &m_tp_injet_vhighpt); + // } + + if (Displaced == "Prompt" || Displaced == "Both") { + eventTree->Branch("matchtrk_pt", &m_matchtrk_pt); + eventTree->Branch("matchtrk_eta", &m_matchtrk_eta); + eventTree->Branch("matchtrk_phi", &m_matchtrk_phi); + eventTree->Branch("matchtrk_z0", &m_matchtrk_z0); + eventTree->Branch("matchtrk_d0", &m_matchtrk_d0); + eventTree->Branch("matchtrk_chi2", &m_matchtrk_chi2); + eventTree->Branch("matchtrk_chi2dof", &m_matchtrk_chi2dof); + eventTree->Branch("matchtrk_chi2rphi", &m_matchtrk_chi2rphi); + eventTree->Branch("matchtrk_chi2rz", &m_matchtrk_chi2rz); + eventTree->Branch("matchtrk_bendchi2", &m_matchtrk_bendchi2); + eventTree->Branch("matchtrk_nstub", &m_matchtrk_nstub); + eventTree->Branch("matchtrk_lhits", &m_matchtrk_lhits); + eventTree->Branch("matchtrk_dhits", &m_matchtrk_dhits); + eventTree->Branch("matchtrk_seed", &m_matchtrk_seed); + eventTree->Branch("matchtrk_hitpattern", &m_matchtrk_hitpattern); + // if (TrackingInJets) { + // eventTree->Branch("matchtrk_injet", &m_matchtrk_injet); + // eventTree->Branch("matchtrk_injet_highpt", &m_matchtrk_injet_highpt); + // eventTree->Branch("matchtrk_injet_vhighpt", &m_matchtrk_injet_vhighpt); + // } + } + + if (Displaced == "Displaced" || Displaced == "Both") { + eventTree->Branch("matchtrkExt_pt", &m_matchtrkExt_pt); + eventTree->Branch("matchtrkExt_eta", &m_matchtrkExt_eta); + eventTree->Branch("matchtrkExt_phi", &m_matchtrkExt_phi); + eventTree->Branch("matchtrkExt_z0", &m_matchtrkExt_z0); + eventTree->Branch("matchtrkExt_d0", &m_matchtrkExt_d0); + eventTree->Branch("matchtrkExt_chi2", &m_matchtrkExt_chi2); + eventTree->Branch("matchtrkExt_chi2dof", &m_matchtrkExt_chi2dof); + eventTree->Branch("matchtrkExt_chi2rphi", &m_matchtrkExt_chi2rphi); + eventTree->Branch("matchtrkExt_chi2rz", &m_matchtrkExt_chi2rz); + eventTree->Branch("matchtrkExt_bendchi2", &m_matchtrkExt_bendchi2); + eventTree->Branch("matchtrkExt_nstub", &m_matchtrkExt_nstub); + eventTree->Branch("matchtrkExt_lhits", &m_matchtrkExt_lhits); + eventTree->Branch("matchtrkExt_dhits", &m_matchtrkExt_dhits); + eventTree->Branch("matchtrkExt_seed", &m_matchtrkExt_seed); + eventTree->Branch("matchtrkExt_hitpattern", &m_matchtrkExt_hitpattern); + // if (TrackingInJets) { + // eventTree->Branch("matchtrk_injet", &m_matchtrk_injet); + // eventTree->Branch("matchtrk_injet_highpt", &m_matchtrk_injet_highpt); + // eventTree->Branch("matchtrk_injet_vhighpt", &m_matchtrk_injet_vhighpt); + // } + } + + if (SaveStubs) { + eventTree->Branch("allstub_x", &m_allstub_x); + eventTree->Branch("allstub_y", &m_allstub_y); + eventTree->Branch("allstub_z", &m_allstub_z); + eventTree->Branch("allstub_isBarrel", &m_allstub_isBarrel); + eventTree->Branch("allstub_layer", &m_allstub_layer); + eventTree->Branch("allstub_isPSmodule", &m_allstub_isPSmodule); + eventTree->Branch("allstub_trigDisplace", &m_allstub_trigDisplace); + eventTree->Branch("allstub_trigOffset", &m_allstub_trigOffset); + eventTree->Branch("allstub_trigPos", &m_allstub_trigPos); + eventTree->Branch("allstub_trigBend", &m_allstub_trigBend); + eventTree->Branch("allstub_matchTP_pdgid", &m_allstub_matchTP_pdgid); + eventTree->Branch("allstub_matchTP_pt", &m_allstub_matchTP_pt); + eventTree->Branch("allstub_matchTP_eta", &m_allstub_matchTP_eta); + eventTree->Branch("allstub_matchTP_phi", &m_allstub_matchTP_phi); + eventTree->Branch("allstub_genuine", &m_allstub_genuine); + } + + if (SaveTrackJets) { + // eventTree->Branch("pv_L1recotruesumpt", &m_pv_L1recotruesumpt); + // eventTree->Branch("pv_L1recosumpt", &m_pv_L1recosumpt); + eventTree->Branch("pv_L1reco", &m_pv_L1reco); + // eventTree->Branch("pv_L1TP", &m_pv_L1TP); + // eventTree->Branch("pv_L1TPsumpt", &m_pv_L1TPsumpt); + eventTree->Branch("MC_lep", &m_MC_lep); + // eventTree->Branch("pv_MCChgSumpT", &m_pv_MCChgSumpT); + eventTree->Branch("pv_MC", &m_pv_MC); + + if (Displaced == "Prompt" || Displaced == "Both") { + eventTree->Branch("2ltrkjet_eta", &m_2ltrkjet_eta); + eventTree->Branch("2ltrkjet_vz", &m_2ltrkjet_vz); + eventTree->Branch("2ltrkjet_p", &m_2ltrkjet_p); + eventTree->Branch("2ltrkjet_pt", &m_2ltrkjet_pt); + eventTree->Branch("2ltrkjet_phi", &m_2ltrkjet_phi); + eventTree->Branch("2ltrkjet_ntracks", &m_2ltrkjet_ntracks); + eventTree->Branch("2ltrkjet_nDisplaced", &m_2ltrkjet_nDisplaced); + eventTree->Branch("2ltrkjet_nTight", &m_2ltrkjet_nTight); + eventTree->Branch("2ltrkjet_nTightDisplaced", &m_2ltrkjet_nTightDisplaced); + eventTree->Branch("trkjet_eta", &m_trkjet_eta); + eventTree->Branch("trkjet_vz", &m_trkjet_vz); + eventTree->Branch("trkjet_p", &m_trkjet_p); + eventTree->Branch("trkjet_pt", &m_trkjet_pt); + eventTree->Branch("trkjet_phi", &m_trkjet_phi); + eventTree->Branch("trkjet_ntracks", &m_trkjet_ntracks); + eventTree->Branch("trkjet_truetp_sumpt", m_trkjet_truetp_sumpt); + } + if (Displaced == "Displaced" || Displaced == "Both") { + eventTree->Branch("2ltrkjetExt_eta", &m_2ltrkjetExt_eta); + eventTree->Branch("2ltrkjetExt_vz", &m_2ltrkjetExt_vz); + eventTree->Branch("2ltrkjetExt_p", &m_2ltrkjetExt_p); + eventTree->Branch("2ltrkjetExt_pt", &m_2ltrkjetExt_pt); + eventTree->Branch("2ltrkjetExt_phi", &m_2ltrkjetExt_phi); + eventTree->Branch("2ltrkjetExt_ntracks", &m_2ltrkjetExt_ntracks); + eventTree->Branch("2ltrkjetExt_nDisplaced", &m_2ltrkjetExt_nDisplaced); + eventTree->Branch("2ltrkjetExt_nTight", &m_2ltrkjetExt_nTight); + eventTree->Branch("2ltrkjetExt_nTightDisplaced", &m_2ltrkjetExt_nTightDisplaced); + eventTree->Branch("trkjetExt_eta", &m_trkjetExt_eta); + eventTree->Branch("trkjetExt_vz", &m_trkjetExt_vz); + eventTree->Branch("trkjetExt_p", &m_trkjetExt_p); + eventTree->Branch("trkjetExt_pt", &m_trkjetExt_pt); + eventTree->Branch("trkjetExt_phi", &m_trkjetExt_phi); + eventTree->Branch("trkjetExt_ntracks", &m_trkjetExt_ntracks); + eventTree->Branch("trkjetExt_truetp_sumpt", m_trkjetExt_truetp_sumpt); + } + } + + if (SaveTrackMET) { + eventTree->Branch("trueMET", &trueMET, "trueMET/F"); + + if (Displaced == "Prompt" || Displaced == "Both") { + eventTree->Branch("trkMET", &trkMET, "trkMET/F"); + eventTree->Branch("trkMHT", &trkMHT, "trkMHT/F"); + eventTree->Branch("trkHT", &trkHT, "trkHT/F"); + } + if (Displaced == "Displaced" || Displaced == "Both") { + eventTree->Branch("trkMETExt", &trkMETExt, "trkMETExt/F"); + eventTree->Branch("trkMHTExt", &trkMHTExt, "trkMHTExt/F"); + eventTree->Branch("trkHTExt", &trkHTExt, "trkHTExt/F"); + } + } +} + +////////// +// ANALYZE +void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (not available_) + return; // No ROOT file open. + + if (!(MyProcess == 13 || MyProcess == 11 || MyProcess == 211 || MyProcess == 6 || MyProcess == 15 || + MyProcess == 1)) { + edm::LogVerbatim("Tracklet") << "The specified MyProcess is invalid! Exiting..."; + return; + } + + // clear variables + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { + m_trk_pt->clear(); + m_trk_eta->clear(); + m_trk_phi->clear(); + m_trk_d0->clear(); + m_trk_z0->clear(); + m_trk_chi2->clear(); + m_trk_chi2dof->clear(); + m_trk_chi2rphi->clear(); + m_trk_chi2rz->clear(); + m_trk_bendchi2->clear(); + m_trk_nstub->clear(); + m_trk_lhits->clear(); + m_trk_dhits->clear(); + m_trk_seed->clear(); + m_trk_hitpattern->clear(); + m_trk_phiSector->clear(); + m_trk_genuine->clear(); + m_trk_loose->clear(); + m_trk_unknown->clear(); + m_trk_combinatoric->clear(); + m_trk_fake->clear(); + m_trk_matchtp_pdgid->clear(); + m_trk_matchtp_pt->clear(); + m_trk_matchtp_eta->clear(); + m_trk_matchtp_phi->clear(); + m_trk_matchtp_z0->clear(); + m_trk_matchtp_dxy->clear(); + } + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { + m_trkExt_pt->clear(); + m_trkExt_eta->clear(); + m_trkExt_phi->clear(); + m_trkExt_d0->clear(); + m_trkExt_z0->clear(); + m_trkExt_chi2->clear(); + m_trkExt_chi2dof->clear(); + m_trkExt_chi2rphi->clear(); + m_trkExt_chi2rz->clear(); + m_trkExt_bendchi2->clear(); + m_trkExt_nstub->clear(); + m_trkExt_lhits->clear(); + m_trkExt_dhits->clear(); + m_trkExt_seed->clear(); + m_trkExt_hitpattern->clear(); + m_trkExt_phiSector->clear(); + m_trkExt_genuine->clear(); + m_trkExt_loose->clear(); + m_trkExt_unknown->clear(); + m_trkExt_combinatoric->clear(); + m_trkExt_fake->clear(); + m_trkExt_matchtp_pdgid->clear(); + m_trkExt_matchtp_pt->clear(); + m_trkExt_matchtp_eta->clear(); + m_trkExt_matchtp_phi->clear(); + m_trkExt_matchtp_z0->clear(); + m_trkExt_matchtp_dxy->clear(); + } + m_tp_pt->clear(); + m_tp_eta->clear(); + m_tp_phi->clear(); + m_tp_dxy->clear(); + m_tp_d0->clear(); + m_tp_z0->clear(); + m_tp_d0_prod->clear(); + m_tp_z0_prod->clear(); + m_tp_pdgid->clear(); + m_tp_nmatch->clear(); + m_tp_nstub->clear(); + m_tp_eventid->clear(); + m_tp_charge->clear(); + + if (Displaced == "Prompt" || Displaced == "Both") { + m_matchtrk_pt->clear(); + m_matchtrk_eta->clear(); + m_matchtrk_phi->clear(); + m_matchtrk_z0->clear(); + m_matchtrk_d0->clear(); + m_matchtrk_chi2->clear(); + m_matchtrk_chi2dof->clear(); + m_matchtrk_chi2rphi->clear(); + m_matchtrk_chi2rz->clear(); + m_matchtrk_bendchi2->clear(); + m_matchtrk_nstub->clear(); + m_matchtrk_lhits->clear(); + m_matchtrk_dhits->clear(); + m_matchtrk_seed->clear(); + m_matchtrk_hitpattern->clear(); + } + + if (Displaced == "Displaced" || Displaced == "Both") { + m_matchtrkExt_pt->clear(); + m_matchtrkExt_eta->clear(); + m_matchtrkExt_phi->clear(); + m_matchtrkExt_z0->clear(); + m_matchtrkExt_d0->clear(); + m_matchtrkExt_chi2->clear(); + m_matchtrkExt_chi2dof->clear(); + m_matchtrkExt_chi2rphi->clear(); + m_matchtrkExt_chi2rz->clear(); + m_matchtrkExt_bendchi2->clear(); + m_matchtrkExt_nstub->clear(); + m_matchtrkExt_lhits->clear(); + m_matchtrkExt_dhits->clear(); + m_matchtrkExt_seed->clear(); + m_matchtrkExt_hitpattern->clear(); + } + + if (SaveStubs) { + m_allstub_x->clear(); + m_allstub_y->clear(); + m_allstub_z->clear(); + m_allstub_isBarrel->clear(); + m_allstub_layer->clear(); + m_allstub_isPSmodule->clear(); + m_allstub_trigDisplace->clear(); + m_allstub_trigOffset->clear(); + m_allstub_trigPos->clear(); + m_allstub_trigBend->clear(); + m_allstub_matchTP_pdgid->clear(); + m_allstub_matchTP_pt->clear(); + m_allstub_matchTP_eta->clear(); + m_allstub_matchTP_phi->clear(); + m_allstub_genuine->clear(); + } + + // m_jet_eta->clear(); + // m_jet_phi->clear(); + // m_jet_pt->clear(); + // m_jet_tp_sumpt->clear(); + // m_jet_trk_sumpt->clear(); + // m_jet_matchtrk_sumpt->clear(); + + if (SaveTrackJets) { + if (Displaced == "Prompt" || Displaced == "Both") { + m_2ltrkjet_eta->clear(); + m_2ltrkjet_pt->clear(); + m_2ltrkjet_vz->clear(); + m_2ltrkjet_phi->clear(); + m_2ltrkjet_p->clear(); + m_2ltrkjet_ntracks->clear(); + m_2ltrkjet_nDisplaced->clear(); + m_2ltrkjet_nTight->clear(); + m_2ltrkjet_nTightDisplaced->clear(); + m_2ltrkjet_ntdtrk->clear(); + m_trkjet_eta->clear(); + m_trkjet_pt->clear(); + m_trkjet_vz->clear(); + m_trkjet_phi->clear(); + m_trkjet_p->clear(); + m_trkjet_ntracks->clear(); + m_trkjet_truetp_sumpt->clear(); + m_trkjet_tp_sumpt->clear(); + } + if (Displaced == "Displaced" || Displaced == "Both") { + m_2ltrkjetExt_eta->clear(); + m_2ltrkjetExt_pt->clear(); + m_2ltrkjetExt_vz->clear(); + m_2ltrkjetExt_phi->clear(); + m_2ltrkjetExt_p->clear(); + m_2ltrkjetExt_ntracks->clear(); + m_2ltrkjetExt_nDisplaced->clear(); + m_2ltrkjetExt_nTight->clear(); + m_2ltrkjetExt_nTightDisplaced->clear(); + m_2ltrkjetExt_ntdtrk->clear(); + m_trkjetExt_eta->clear(); + m_trkjetExt_pt->clear(); + m_trkjetExt_vz->clear(); + m_trkjetExt_phi->clear(); + m_trkjetExt_p->clear(); + m_trkjetExt_ntracks->clear(); + m_trkjetExt_truetp_sumpt->clear(); + m_trkjetExt_tp_sumpt->clear(); + } + + // m_pv_L1recotruesumpt->clear(); + // m_pv_L1recosumpt->clear(); + m_pv_L1reco->clear(); + // m_pv_L1TPsumpt->clear(); + // m_pv_L1TP->clear(); + m_pv_MC->clear(); + m_MC_lep->clear(); + // m_pv_MCChgSumpT->clear(); + } + + // ----------------------------------------------------------------------------------------------- + // retrieve various containers + // ----------------------------------------------------------------------------------------------- + + // L1 stubs + edm::Handle > > TTStubHandle; + if (SaveStubs) + iEvent.getByToken(ttStubToken_, TTStubHandle); + + // MC truth association maps + edm::Handle > MCTruthTTClusterHandle; + iEvent.getByToken(ttClusterMCTruthToken_, MCTruthTTClusterHandle); + edm::Handle > MCTruthTTStubHandle; + iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle); + + // tracking particles + edm::Handle > TrackingParticleHandle; + edm::Handle > TrackingVertexHandle; + iEvent.getByToken(TrackingParticleToken_, TrackingParticleHandle); + iEvent.getByToken(TrackingVertexToken_, TrackingVertexHandle); + + // ----------------------------------------------------------------------------------------------- + // more for TTStubs + edm::ESHandle geometryHandle; + iSetup.get().get(geometryHandle); + + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + + edm::ESHandle tGeomHandle; + iSetup.get().get(tGeomHandle); + + const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerGeometry* const theTrackerGeom = tGeomHandle.product(); + + //Gen particles + edm::Handle > GenParticleHandle; + iEvent.getByToken(GenParticleToken_, GenParticleHandle); + + //Vertex + edm::Handle L1TkPrimaryVertexHandle; + iEvent.getByToken(L1VertexToken_, L1TkPrimaryVertexHandle); + + // Track jets + edm::Handle > TrackFastJetsHandle; + edm::Handle > TrackFastJetsExtendedHandle; + edm::Handle TrackJetsHandle; + edm::Handle TrackJetsExtendedHandle; + std::vector::const_iterator jetIter; + + // Track MET + edm::Handle > L1TkMETHandle; + edm::Handle > L1TkMETExtendedHandle; + edm::Handle > L1TkMHTHandle; + edm::Handle > L1TkMHTExtendedHandle; + + // L1 tracks + edm::Handle > > TTTrackHandle; + edm::Handle > > TTTrackExtendedHandle; + edm::Handle > MCTruthTTTrackHandle; + edm::Handle > MCTruthTTTrackExtendedHandle; + std::vector >::const_iterator iterL1Track; + + if (Displaced == "Prompt" || Displaced == "Both") { + iEvent.getByToken(TrackFastJetsToken_, TrackFastJetsHandle); + iEvent.getByToken(TrackJetsToken_, TrackJetsHandle); + iEvent.getByToken(TrackMETToken_, L1TkMETHandle); + iEvent.getByToken(TrackMHTToken_, L1TkMHTHandle); + iEvent.getByToken(ttTrackToken_, TTTrackHandle); + iEvent.getByToken(ttTrackMCTruthToken_, MCTruthTTTrackHandle); + } + if (Displaced == "Displaced" || Displaced == "Both") { + iEvent.getByToken(TrackFastJetsExtendedToken_, TrackFastJetsExtendedHandle); + iEvent.getByToken(TrackJetsExtendedToken_, TrackJetsExtendedHandle); + iEvent.getByToken(TrackMETExtendedToken_, L1TkMETExtendedHandle); + iEvent.getByToken(TrackMHTExtendedToken_, L1TkMHTExtendedHandle); + iEvent.getByToken(ttTrackExtendedToken_, TTTrackExtendedHandle); + iEvent.getByToken(ttTrackMCTruthExtendedToken_, MCTruthTTTrackExtendedHandle); + } + + //Loop over gen particles + if (GenParticleHandle.isValid()) { + vector::const_iterator genpartIter; + + float zvtx_gen = -999; + for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) { + int status = genpartIter->status(); + if (status != 1) + continue; + zvtx_gen = genpartIter->vz(); + } + m_pv_MC->push_back(zvtx_gen); + + float trueMETx = 0; + float trueMETy = 0; + trueMET = 0; + for (size_t i = 0; i < GenParticleHandle->size(); ++i) { + const reco::GenParticle& p = (*GenParticleHandle)[i]; + int id = p.pdgId(); + bool isNeutrino = false; + if ((fabs(id) == 12 || fabs(id) == 14 || fabs(id) == 16)) + isNeutrino = true; + if ((isNeutrino || id == 1000022) && p.status() == 1) { + trueMETx += p.pt() * cos(p.phi()); + trueMETy += p.pt() * sin(p.phi()); + } + } + trueMET = sqrt(trueMETx * trueMETx + trueMETy * trueMETy); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: GenParticleHandle not found in the event" << std::endl; + } + + // ---------------------------------------------------------------------------------------------- + // loop over L1 stubs + // ---------------------------------------------------------------------------------------------- + if (SaveStubs) { + for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) { + DetId detid = (*gd)->geographicalId(); + if (detid.subdetId() != StripSubdetector::TOB && detid.subdetId() != StripSubdetector::TID) + continue; + if (!tTopo->isLower(detid)) + continue; // loop on the stacks: choose the lower arbitrarily + DetId stackDetid = tTopo->stack(detid); // Stub module detid + + if (TTStubHandle->find(stackDetid) == TTStubHandle->end()) + continue; + + // Get the DetSets of the Clusters + edmNew::DetSet > stubs = (*TTStubHandle)[stackDetid]; + const GeomDetUnit* det0 = theTrackerGeom->idToDetUnit(detid); + const auto* theGeomDet = dynamic_cast(det0); + const PixelTopology* topol = dynamic_cast(&(theGeomDet->specificTopology())); + + // loop over stubs + for (auto stubIter = stubs.begin(); stubIter != stubs.end(); ++stubIter) { + edm::Ref >, TTStub > tempStubPtr = + edmNew::makeRefTo(TTStubHandle, stubIter); + + int isBarrel = 0; + int layer = -999999; + if (detid.subdetId() == StripSubdetector::TOB) { + isBarrel = 1; + layer = static_cast(tTopo->layer(detid)); + } else if (detid.subdetId() == StripSubdetector::TID) { + isBarrel = 0; + layer = static_cast(tTopo->layer(detid)); + } else { + edm::LogVerbatim("Tracklet") << "WARNING -- neither TOB or TID stub, shouldn't happen..."; + layer = -1; + } + + int isPSmodule = 0; + if (topol->nrows() == 960) + isPSmodule = 1; + + MeasurementPoint coords = tempStubPtr->clusterRef(0)->findAverageLocalCoordinatesCentered(); + LocalPoint clustlp = topol->localPosition(coords); + GlobalPoint posStub = theGeomDet->surface().toGlobal(clustlp); + + double tmp_stub_x = posStub.x(); + double tmp_stub_y = posStub.y(); + double tmp_stub_z = posStub.z(); + + float trigDisplace = tempStubPtr->rawBend(); + float trigOffset = tempStubPtr->bendOffset(); + float trigPos = tempStubPtr->innerClusterPosition(); + float trigBend = tempStubPtr->bendFE(); + + m_allstub_x->push_back(tmp_stub_x); + m_allstub_y->push_back(tmp_stub_y); + m_allstub_z->push_back(tmp_stub_z); + m_allstub_isBarrel->push_back(isBarrel); + m_allstub_layer->push_back(layer); + m_allstub_isPSmodule->push_back(isPSmodule); + m_allstub_trigDisplace->push_back(trigDisplace); + m_allstub_trigOffset->push_back(trigOffset); + m_allstub_trigPos->push_back(trigPos); + m_allstub_trigBend->push_back(trigBend); + + // matched to tracking particle? + edm::Ptr my_tp = MCTruthTTStubHandle->findTrackingParticlePtr(tempStubPtr); + + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + + if (my_tp.isNull() == false) { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + continue; // this means stub from pileup track + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + } + int tmp_stub_genuine = 0; + if (MCTruthTTStubHandle->isGenuine(tempStubPtr)) + tmp_stub_genuine = 1; + + m_allstub_matchTP_pdgid->push_back(myTP_pdgid); + m_allstub_matchTP_pt->push_back(myTP_pt); + m_allstub_matchTP_eta->push_back(myTP_eta); + m_allstub_matchTP_phi->push_back(myTP_phi); + m_allstub_genuine->push_back(tmp_stub_genuine); + } + } + } + + // ---------------------------------------------------------------------------------------------- + // loop over (prompt) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } + + int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + edm::Ptr > l1track_ptr(TTTrackHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); + } + + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + + std::vector >, TTStub > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); + + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); + + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- + + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackHandle->isLooselyGenuine(l1track_ptr)) + tmp_trk_loose = 1; + if (MCTruthTTTrackHandle->isGenuine(l1track_ptr)) + tmp_trk_genuine = 1; + if (MCTruthTTTrackHandle->isUnknown(l1track_ptr)) + tmp_trk_unknown = 1; + if (MCTruthTTTrackHandle->isCombinatoric(l1track_ptr)) + tmp_trk_combinatoric = 1; + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (is genuine)"; + if (tmp_trk_unknown) + edm::LogVerbatim("Tracklet") << " (is unknown)"; + if (tmp_trk_combinatoric) + edm::LogVerbatim("Tracklet") << " (is combinatoric)"; + } + + 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_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) + m_trk_d0->push_back(tmp_trk_d0); + else + m_trk_d0->push_back(999.); + m_trk_chi2->push_back(tmp_trk_chi2); + m_trk_chi2dof->push_back(tmp_trk_chi2dof); + m_trk_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trk_chi2rz->push_back(tmp_trk_chi2rz); + m_trk_bendchi2->push_back(tmp_trk_bendchi2); + m_trk_nstub->push_back(tmp_trk_nstub); + m_trk_dhits->push_back(tmp_trk_dhits); + m_trk_lhits->push_back(tmp_trk_lhits); + m_trk_seed->push_back(tmp_trk_seed); + m_trk_hitpattern->push_back(tmp_trk_hitpattern); + m_trk_phiSector->push_back(tmp_trk_phiSector); + m_trk_genuine->push_back(tmp_trk_genuine); + m_trk_loose->push_back(tmp_trk_loose); + m_trk_unknown->push_back(tmp_trk_unknown); + m_trk_combinatoric->push_back(tmp_trk_combinatoric); + + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(l1track_ptr); + + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; + + if (my_tp.isNull()) + myFake = 0; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + myFake = 2; + else + myFake = 1; + + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); + + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; + } + } + + m_trk_fake->push_back(myFake); + m_trk_matchtp_pdgid->push_back(myTP_pdgid); + m_trk_matchtp_pt->push_back(myTP_pt); + m_trk_matchtp_eta->push_back(myTP_eta); + m_trk_matchtp_phi->push_back(myTP_phi); + m_trk_matchtp_z0->push_back(myTP_z0); + m_trk_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks + + // ---------------------------------------------------------------------------------------------- + // loop over (extended) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } + + int this_l1track = 0; + for (iterL1Track = TTTrackExtendedHandle->begin(); iterL1Track != TTTrackExtendedHandle->end(); iterL1Track++) { + edm::Ptr > l1track_ptr(TTTrackExtendedHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); + } + + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + + std::vector >, TTStub > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); + + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); + + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- + + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(l1track_ptr)) + tmp_trk_loose = 1; + if (MCTruthTTTrackExtendedHandle->isGenuine(l1track_ptr)) + tmp_trk_genuine = 1; + if (MCTruthTTTrackExtendedHandle->isUnknown(l1track_ptr)) + tmp_trk_unknown = 1; + if (MCTruthTTTrackExtendedHandle->isCombinatoric(l1track_ptr)) + tmp_trk_combinatoric = 1; + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (is genuine)"; + if (tmp_trk_unknown) + edm::LogVerbatim("Tracklet") << " (is unknown)"; + if (tmp_trk_combinatoric) + edm::LogVerbatim("Tracklet") << " (is combinatoric)"; + } + + 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_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) + m_trkExt_d0->push_back(tmp_trk_d0); + else + m_trkExt_d0->push_back(999.); + m_trkExt_chi2->push_back(tmp_trk_chi2); + m_trkExt_chi2dof->push_back(tmp_trk_chi2dof); + m_trkExt_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trkExt_chi2rz->push_back(tmp_trk_chi2rz); + m_trkExt_bendchi2->push_back(tmp_trk_bendchi2); + m_trkExt_nstub->push_back(tmp_trk_nstub); + m_trkExt_dhits->push_back(tmp_trk_dhits); + m_trkExt_lhits->push_back(tmp_trk_lhits); + m_trkExt_seed->push_back(tmp_trk_seed); + m_trkExt_hitpattern->push_back(tmp_trk_hitpattern); + m_trkExt_phiSector->push_back(tmp_trk_phiSector); + m_trkExt_genuine->push_back(tmp_trk_genuine); + m_trkExt_loose->push_back(tmp_trk_loose); + m_trkExt_unknown->push_back(tmp_trk_unknown); + m_trkExt_combinatoric->push_back(tmp_trk_combinatoric); + + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(l1track_ptr); + + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; + + if (my_tp.isNull()) + myFake = 0; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + myFake = 2; + else + myFake = 1; + + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); + + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; + } + } + + m_trkExt_fake->push_back(myFake); + m_trkExt_matchtp_pdgid->push_back(myTP_pdgid); + m_trkExt_matchtp_pt->push_back(myTP_pt); + m_trkExt_matchtp_eta->push_back(myTP_eta); + m_trkExt_matchtp_phi->push_back(myTP_phi); + m_trkExt_matchtp_z0->push_back(myTP_z0); + m_trkExt_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks (displaced) + + // ---------------------------------------------------------------------------------------------- + // loop over tracking particles + // ---------------------------------------------------------------------------------------------- + if (DebugMode) + edm::LogVerbatim("Tracklet") << "\n Loop over tracking particles!"; + + int this_tp = 0; + std::vector::const_iterator iterTP; + for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); ++iterTP) { + edm::Ptr tp_ptr(TrackingParticleHandle, this_tp); + this_tp++; + + int tmp_eventid = iterTP->eventId().event(); + if (MyProcess != 1 && tmp_eventid > 0) + continue; //only care about tracking particles from the primary interaction (except for MyProcess==1, i.e. looking at all TPs) + + float tmp_tp_pt = iterTP->pt(); + float tmp_tp_eta = iterTP->eta(); + float tmp_tp_phi = iterTP->phi(); + float tmp_tp_vz = iterTP->vz(); + float tmp_tp_vx = iterTP->vx(); + float tmp_tp_vy = iterTP->vy(); + int tmp_tp_pdgid = iterTP->pdgId(); + float tmp_tp_z0_prod = tmp_tp_vz; + float tmp_tp_d0_prod = tmp_tp_vx * sin(tmp_tp_phi) - tmp_tp_vy * cos(tmp_tp_phi); + + if (MyProcess == 13 && abs(tmp_tp_pdgid) != 13) + continue; + if (MyProcess == 11 && abs(tmp_tp_pdgid) != 11) + continue; + if ((MyProcess == 6 || MyProcess == 15 || MyProcess == 211) && abs(tmp_tp_pdgid) != 211) + continue; + + if (tmp_tp_pt < TP_minPt) + continue; + if (std::abs(tmp_tp_eta) > TP_maxEta) + continue; + + // ---------------------------------------------------------------------------------------------- + // get d0/z0 propagated back to the IP + + float tmp_tp_t = tan(2.0 * atan(1.0) - 2.0 * atan(exp(-tmp_tp_eta))); + float delx = -tmp_tp_vx; + float dely = -tmp_tp_vy; + + float A = 0.01 * 0.5696; + float Kmagnitude = A / tmp_tp_pt; + float tmp_tp_charge = tp_ptr->charge(); + float K = Kmagnitude * tmp_tp_charge; + float d = 0; + float tmp_tp_x0p = delx - (d + 1. / (2. * K) * sin(tmp_tp_phi)); + float tmp_tp_y0p = dely + (d + 1. / (2. * K) * cos(tmp_tp_phi)); + float tmp_tp_rp = sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p); + float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K)); + tmp_tp_d0 = tmp_tp_d0 * (-1); //fix d0 sign + static double pi = 4.0 * atan(1.0); + float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p); + if (delphi < -pi) + delphi += 2.0 * pi; + if (delphi > pi) + delphi -= 2.0 * pi; + float tmp_tp_z0 = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K); + // ---------------------------------------------------------------------------------------------- + + if (std::abs(tmp_tp_z0) > TP_maxZ0) + continue; + + // for pions in ttbar, only consider TPs coming from near the IP! + float dxy = sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy); + float tmp_tp_dxy = dxy; + if (MyProcess == 6 && (dxy > 1.0)) + continue; + + if (DebugMode && (Displaced == "Prompt" || Displaced == "Both")) + edm::LogVerbatim("Tracklet") << "Tracking particle, pt: " << tmp_tp_pt << " eta: " << tmp_tp_eta + << " phi: " << tmp_tp_phi << " z0: " << tmp_tp_z0 << " d0: " << tmp_tp_d0 + << " z_prod: " << tmp_tp_z0_prod << " d_prod: " << tmp_tp_d0_prod + << " pdgid: " << tmp_tp_pdgid << " eventID: " << iterTP->eventId().event() + << " ttclusters " << MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).size() + << " ttstubs " << MCTruthTTStubHandle->findTTStubRefs(tp_ptr).size() << " tttracks " + << MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr).size(); + + // ---------------------------------------------------------------------------------------------- + // only consider TPs associated with >= 1 cluster, or >= X stubs, or have stubs in >= X layers (configurable options) + if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty()) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "No matching TTClusters for TP, continuing..."; + continue; + } + + std::vector >, TTStub > > + theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr); + int nStubTP = (int)theStubRefs.size(); + + // how many layers/disks have stubs? + int hasStubInLayer[11] = {0}; + for (auto& theStubRef : theStubRefs) { + DetId detid(theStubRef->getDetId()); + + int layer = -1; + if (detid.subdetId() == StripSubdetector::TOB) { + layer = static_cast(tTopo->layer(detid)) - 1; //fill in array as entries 0-5 + } else if (detid.subdetId() == StripSubdetector::TID) { + layer = static_cast(tTopo->layer(detid)) + 5; //fill in array as entries 6-10 + } + + //treat genuine stubs separately (==2 is genuine, ==1 is not) + if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[layer] < 2) + hasStubInLayer[layer] = 1; + else + hasStubInLayer[layer] = 2; + } + + int nStubLayerTP = 0; + int nStubLayerTP_g = 0; + for (int isum : hasStubInLayer) { + if (isum >= 1) + nStubLayerTP += 1; + if (isum == 2) + nStubLayerTP_g += 1; + } + + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP is associated with " << nStubTP << " stubs, and has stubs in " << nStubLayerTP + << " different layers/disks, and has GENUINE stubs in " << nStubLayerTP_g + << " layers "; + + if (TP_minNStub > 0) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "Only consider TPs with >= " << TP_minNStub << " stubs"; + if (nStubTP < TP_minNStub) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP fails minimum nbr stubs requirement! Continuing..."; + continue; + } + } + if (TP_minNStubLayer > 0) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "Only consider TPs with stubs in >= " << TP_minNStubLayer << " layers/disks"; + if (nStubLayerTP < TP_minNStubLayer) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP fails stubs in minimum nbr of layers/disks requirement! Continuing..."; + continue; + } + } + + m_tp_pt->push_back(tmp_tp_pt); + m_tp_eta->push_back(tmp_tp_eta); + m_tp_phi->push_back(tmp_tp_phi); + m_tp_dxy->push_back(tmp_tp_dxy); + m_tp_z0->push_back(tmp_tp_z0); + m_tp_d0->push_back(tmp_tp_d0); + m_tp_z0_prod->push_back(tmp_tp_z0_prod); + m_tp_d0_prod->push_back(tmp_tp_d0_prod); + m_tp_pdgid->push_back(tmp_tp_pdgid); + m_tp_nstub->push_back(nStubTP); + m_tp_eventid->push_back(tmp_eventid); + m_tp_charge->push_back(tmp_tp_charge); + + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (prompt) matched to the tracking particle + if (Displaced == "Prompt" || Displaced == "Both") { + std::vector > > matchedTracks = + MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr); + + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; + + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) + edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; + + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackHandle->isGenuine(matchedTracks.at(it))) + tmp_trk_genuine = true; + if (MCTruthTTTrackHandle->isLooselyGenuine(matchedTracks.at(it))) + tmp_trk_loosegenuine = true; + if (!tmp_trk_loosegenuine) + continue; + + if (DebugMode) { + if (MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } else { + edm::Ptr my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() + << " phi = " << my_tp->momentum().phi() << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " + << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (genuine!) "; + if (tmp_trk_loosegenuine) + edm::LogVerbatim("Tracklet") << " (loose genuine!) "; + } + + std::vector >, TTStub > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); + + if (tmp_trk_nstub < L1Tk_minNStub) + continue; + + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; + } + } + + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- + + float tmp_matchtrk_pt = -999; + float tmp_matchtrk_eta = -999; + float tmp_matchtrk_phi = -999; + float tmp_matchtrk_z0 = -999; + float tmp_matchtrk_d0 = -999; + float tmp_matchtrk_chi2 = -999; + float tmp_matchtrk_chi2dof = -999; + float tmp_matchtrk_chi2rphi = -999; + float tmp_matchtrk_chi2rz = -999; + float tmp_matchtrk_bendchi2 = -999; + int tmp_matchtrk_nstub = -999; + int tmp_matchtrk_dhits = -999; + int tmp_matchtrk_lhits = -999; + int tmp_matchtrk_seed = -999; + int tmp_matchtrk_hitpattern = -999; + int tmp_matchtrk_nFitPars = -999; + + if (nMatch > 1 && DebugMode) + edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; + + if (nMatch > 0) { + tmp_matchtrk_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrk_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrk_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrk_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrk_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrk_nFitPars == 5) { + float tmp_matchtrk_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrk_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrk_d0 = -tmp_matchtrk_x0 * sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 * cos(tmp_matchtrk_phi); + // tmp_matchtrk_d0 = matchedTracks.at(i_track)->d0(); + } + + tmp_matchtrk_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrk_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrk_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrk_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrk_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrk_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrk_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrk_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + + // ------------------------------------------------------------------------------------------ + tmp_matchtrk_dhits = 0; + tmp_matchtrk_lhits = 0; + + std::vector >, TTStub > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); + + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast(tTopo->layer(detIdStub)); + tmp_matchtrk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast(tTopo->layer(detIdStub)); + tmp_matchtrk_dhits += pow(10, layer - 1); + } + } + } + + m_tp_nmatch->push_back(nMatch); + + m_matchtrk_pt->push_back(tmp_matchtrk_pt); + m_matchtrk_eta->push_back(tmp_matchtrk_eta); + m_matchtrk_phi->push_back(tmp_matchtrk_phi); + m_matchtrk_z0->push_back(tmp_matchtrk_z0); + m_matchtrk_d0->push_back(tmp_matchtrk_d0); + m_matchtrk_chi2->push_back(tmp_matchtrk_chi2); + m_matchtrk_chi2dof->push_back(tmp_matchtrk_chi2dof); + m_matchtrk_chi2rphi->push_back(tmp_matchtrk_chi2rphi); + m_matchtrk_chi2rz->push_back(tmp_matchtrk_chi2rz); + m_matchtrk_bendchi2->push_back(tmp_matchtrk_bendchi2); + m_matchtrk_nstub->push_back(tmp_matchtrk_nstub); + m_matchtrk_dhits->push_back(tmp_matchtrk_dhits); + m_matchtrk_lhits->push_back(tmp_matchtrk_lhits); + m_matchtrk_seed->push_back(tmp_matchtrk_seed); + m_matchtrk_hitpattern->push_back(tmp_matchtrk_hitpattern); + } + + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (extended) matched to the tracking particle + if (Displaced == "Displaced" || Displaced == "Both") { + std::vector > > matchedTracks = + MCTruthTTTrackExtendedHandle->findTTTrackPtrs(tp_ptr); + + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; + + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) + edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; + + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackExtendedHandle->isGenuine(matchedTracks.at(it))) + tmp_trk_genuine = true; + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(matchedTracks.at(it))) + tmp_trk_loosegenuine = true; + if (!tmp_trk_loosegenuine) + continue; + + if (DebugMode) { + if (MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } else { + edm::Ptr my_tp = + MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() + << " phi = " << my_tp->momentum().phi() << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " + << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (genuine!) "; + if (tmp_trk_loosegenuine) + edm::LogVerbatim("Tracklet") << " (loose genuine!) "; + } + + std::vector >, TTStub > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); + + if (tmp_trk_nstub < L1Tk_minNStub) + continue; + + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr my_tp = + MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; + } + } + + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- + + float tmp_matchtrkExt_pt = -999; + float tmp_matchtrkExt_eta = -999; + float tmp_matchtrkExt_phi = -999; + float tmp_matchtrkExt_z0 = -999; + float tmp_matchtrkExt_d0 = -999; + float tmp_matchtrkExt_chi2 = -999; + float tmp_matchtrkExt_chi2dof = -999; + float tmp_matchtrkExt_chi2rphi = -999; + float tmp_matchtrkExt_chi2rz = -999; + float tmp_matchtrkExt_bendchi2 = -999; + int tmp_matchtrkExt_nstub = -999; + int tmp_matchtrkExt_dhits = -999; + int tmp_matchtrkExt_lhits = -999; + int tmp_matchtrkExt_seed = -999; + int tmp_matchtrkExt_hitpattern = -999; + int tmp_matchtrkExt_nFitPars = -999; + + if (nMatch > 1 && DebugMode) + edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; + + if (nMatch > 0) { + tmp_matchtrkExt_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrkExt_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrkExt_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrkExt_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrkExt_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrkExt_nFitPars == 5) { + float tmp_matchtrkExt_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrkExt_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrkExt_d0 = + -tmp_matchtrkExt_x0 * sin(tmp_matchtrkExt_phi) + tmp_matchtrkExt_y0 * cos(tmp_matchtrkExt_phi); + // tmp_matchtrkExt_d0 = matchedTracks.at(i_track)->d0(); + } + + tmp_matchtrkExt_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrkExt_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrkExt_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrkExt_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrkExt_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrkExt_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrkExt_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrkExt_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + + // ------------------------------------------------------------------------------------------ + tmp_matchtrkExt_dhits = 0; + tmp_matchtrkExt_lhits = 0; + + std::vector >, TTStub > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); + + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast(tTopo->layer(detIdStub)); + tmp_matchtrkExt_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast(tTopo->layer(detIdStub)); + tmp_matchtrkExt_dhits += pow(10, layer - 1); + } + } + } + + // m_tp_nmatch->push_back(nMatch); //modify to be matches for ext + m_matchtrkExt_pt->push_back(tmp_matchtrkExt_pt); + m_matchtrkExt_eta->push_back(tmp_matchtrkExt_eta); + m_matchtrkExt_phi->push_back(tmp_matchtrkExt_phi); + m_matchtrkExt_z0->push_back(tmp_matchtrkExt_z0); + m_matchtrkExt_d0->push_back(tmp_matchtrkExt_d0); + m_matchtrkExt_chi2->push_back(tmp_matchtrkExt_chi2); + m_matchtrkExt_chi2dof->push_back(tmp_matchtrkExt_chi2dof); + m_matchtrkExt_chi2rphi->push_back(tmp_matchtrkExt_chi2rphi); + m_matchtrkExt_chi2rz->push_back(tmp_matchtrkExt_chi2rz); + m_matchtrkExt_bendchi2->push_back(tmp_matchtrkExt_bendchi2); + m_matchtrkExt_nstub->push_back(tmp_matchtrkExt_nstub); + m_matchtrkExt_dhits->push_back(tmp_matchtrkExt_dhits); + m_matchtrkExt_lhits->push_back(tmp_matchtrkExt_lhits); + m_matchtrkExt_seed->push_back(tmp_matchtrkExt_seed); + m_matchtrkExt_hitpattern->push_back(tmp_matchtrkExt_hitpattern); + } + + } //end loop tracking particles + + if (SaveTrackMET) { + if (Displaced == "Prompt" || Displaced == "Both") { + if (L1TkMETHandle.isValid()) { + trkMET = L1TkMETHandle->begin()->etMiss(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMET handle not found in the event" << std::endl; + } + + if (L1TkMHTHandle.isValid()) { + trkMHT = L1TkMHTHandle->begin()->EtMiss(); + trkHT = L1TkMHTHandle->begin()->etTotal(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMHT handle not found in the event" << std::endl; + } + } //end prompt-track quantities + + if (Displaced == "Displaced" || Displaced == "Both") { + if (L1TkMETExtendedHandle.isValid()) { + trkMETExt = L1TkMETExtendedHandle->begin()->etMiss(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMETExtended handle not found in the event" << std::endl; + } + + if (L1TkMHTExtendedHandle.isValid()) { + trkMHTExt = L1TkMHTExtendedHandle->begin()->EtMiss(); + trkHTExt = L1TkMHTExtendedHandle->begin()->etTotal(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMHTExtended handle not found in the event" << std::endl; + } + } //end displaced-track quantities + } + + if (SaveTrackJets) { + if (TrackFastJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + for (jetIter = TrackFastJetsHandle->begin(); jetIter != TrackFastJetsHandle->end(); ++jetIter) { + m_trkjet_vz->push_back(jetIter->jetVtx()); + m_trkjet_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjet_phi->push_back(jetIter->phi()); + m_trkjet_eta->push_back(jetIter->eta()); + m_trkjet_pt->push_back(jetIter->pt()); + m_trkjet_p->push_back(jetIter->p()); + } + } + if (TrackFastJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + for (jetIter = TrackFastJetsExtendedHandle->begin(); jetIter != TrackFastJetsExtendedHandle->end(); ++jetIter) { + m_trkjetExt_vz->push_back(jetIter->jetVtx()); + m_trkjetExt_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjetExt_phi->push_back(jetIter->phi()); + m_trkjetExt_eta->push_back(jetIter->eta()); + m_trkjetExt_pt->push_back(jetIter->pt()); + m_trkjetExt_p->push_back(jetIter->p()); + } + } + if (!TrackJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + edm::LogWarning("DataNotFound") << "\nWarning: TrackJetsHandle not found in the event" << std::endl; + } + if (!TrackJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + edm::LogWarning("DataNotFound") << "\nWarning: TrackJetsExtendedHandle not found in the event" << std::endl; + } + if (TrackJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + for (jetIter = TrackJetsHandle->begin(); jetIter != TrackJetsHandle->end(); ++jetIter) { + m_2ltrkjet_vz->push_back(jetIter->jetVtx()); + m_2ltrkjet_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjet_phi->push_back(jetIter->phi()); + m_2ltrkjet_eta->push_back(jetIter->eta()); + m_2ltrkjet_pt->push_back(jetIter->pt()); + m_2ltrkjet_p->push_back(jetIter->p()); + m_2ltrkjet_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjet_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjet_nTightDisplaced->push_back(jetIter->nTightDisptracks()); + } + } + + if (TrackJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + for (jetIter = TrackJetsExtendedHandle->begin(); jetIter != TrackJetsExtendedHandle->end(); ++jetIter) { + m_2ltrkjetExt_vz->push_back(jetIter->jetVtx()); + m_2ltrkjetExt_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjetExt_phi->push_back(jetIter->phi()); + m_2ltrkjetExt_eta->push_back(jetIter->eta()); + m_2ltrkjetExt_pt->push_back(jetIter->pt()); + m_2ltrkjetExt_p->push_back(jetIter->p()); + m_2ltrkjetExt_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjetExt_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjetExt_nTightDisplaced->push_back(jetIter->nTightDisptracks()); + } + } + + if (L1TkPrimaryVertexHandle.isValid()) { + m_pv_L1reco->push_back(L1TkPrimaryVertexHandle->begin()->zvertex()); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: L1TkPrimaryVertexHandle not found in the event" << std::endl; + } + } // end track jets + + eventTree->Fill(); +} // end of analyze() + +/////////////////////////// +// DEFINE THIS AS A PLUG-IN +DEFINE_FWK_MODULE(L1TrackObjectNtupleMaker); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc new file mode 100644 index 0000000000000..eff795b02fb6a --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -0,0 +1,209 @@ +// Original Author: Emmanuelle Perez,40 1-A28,+41227671915, +// Created: Tue Nov 12 17:03:19 CET 2013 +//Modified by Emily MacDonald, 30 Nov 2018 + +// 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/Math/interface/LorentzVector.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +// detector geometry +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" + +using namespace l1t; + +class L1TrackerEtMissProducer : public edm::EDProducer { +public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollectionType; + + explicit L1TrackerEtMissProducer(const edm::ParameterSet&); + ~L1TrackerEtMissProducer() override; + +private: + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + float maxZ0_; // in cm + float deltaZ_; // in cm + float maxEta_; + float chi2dofMax_; + float bendChi2Max_; + float minPt_; // in GeV + int nStubsmin_; + int nPSStubsMin_; // minimum number of stubs in PS modules + float maxPt_; // in GeV + int highPtTracks_; // saturate or truncate + bool displaced_; //prompt/displaced tracks + + const edm::EDGetTokenT pvToken_; + const edm::EDGetTokenT > > trackToken_; +}; + +//constructor// +L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) + : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), + trackToken_(consumes > >( + iConfig.getParameter("L1TrackInputTag"))) { + maxZ0_ = (float)iConfig.getParameter("maxZ0"); + deltaZ_ = (float)iConfig.getParameter("deltaZ"); + chi2dofMax_ = (float)iConfig.getParameter("chi2dofMax"); + bendChi2Max_ = (float)iConfig.getParameter("bendChi2Max"); + minPt_ = (float)iConfig.getParameter("minPt"); + nStubsmin_ = iConfig.getParameter("nStubsmin"); + nPSStubsMin_ = iConfig.getParameter("nPSStubsMin"); + maxPt_ = (float)iConfig.getParameter("maxPt"); + maxEta_ = (float)iConfig.getParameter("maxEta"); + highPtTracks_ = iConfig.getParameter("highPtTracks"); + displaced_ = iConfig.getParameter("displaced"); + + if (displaced_) + produces("L1TrackerEtMissExtended"); + else + produces("L1TrackerEtMiss"); +} + +L1TrackerEtMissProducer::~L1TrackerEtMissProducer() {} + +void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + std::unique_ptr METCollection(new TkEtMissCollection); + + // Tracker Topology + edm::ESHandle tTopoHandle_; + iSetup.get().get(tTopoHandle_); + const TrackerTopology* tTopo = tTopoHandle_.product(); + + edm::Handle L1VertexHandle; + iEvent.getByToken(pvToken_, L1VertexHandle); + + edm::Handle L1TTTrackHandle; + iEvent.getByToken(trackToken_, L1TTTrackHandle); + L1TTTrackCollectionType::const_iterator trackIter; + + if (!L1VertexHandle.isValid()) { + LogError("L1TrackerEtMissProducer") << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + return; + } + + if (!L1TTTrackHandle.isValid()) { + LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackCollection not found in the event. Exit\n"; + return; + } + + float sumPx = 0; + float sumPy = 0; + float etTot = 0; + double sumPx_PU = 0; + double sumPy_PU = 0; + double etTot_PU = 0; + float zVTX = L1VertexHandle->begin()->zvertex(); + + for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) { + float pt = trackIter->momentum().perp(); + float phi = trackIter->momentum().phi(); + float eta = trackIter->momentum().eta(); + float chi2dof = trackIter->chi2Red(); + float bendChi2 = trackIter->stubPtConsistency(); + float z0 = trackIter->z0(); + std::vector >, TTStub > > + theStubs = trackIter->getStubRefs(); + int nstubs = (int)theStubs.size(); + + if (pt < minPt_) + continue; + if (fabs(z0) > maxZ0_) + continue; + if (fabs(eta) > maxEta_) + continue; + if (chi2dof > chi2dofMax_) + continue; + if (bendChi2 > bendChi2Max_) + continue; + + if (maxPt_ > 0 && pt > maxPt_) { + if (highPtTracks_ == 0) + continue; // ignore these very high PT tracks: truncate + if (highPtTracks_ == 1) + pt = maxPt_; // saturate + } + + int nPS = 0; // number of stubs in PS modules + // loop over the stubs + for (unsigned int istub = 0; istub < (unsigned int)theStubs.size(); istub++) { + DetId detId(theStubs.at(istub)->getDetId()); + if (detId.det() == DetId::Detector::Tracker) { + if ((detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || + (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9)) + nPS++; + } + } + + if (nstubs < nStubsmin_) + continue; + if (nPS < nPSStubsMin_) + continue; + + if (!displaced_) { // if displaced, deltaZ = 3.0 cm, very loose + // construct deltaZ cut to be based on track eta + if (fabs(eta) >= 0 && fabs(eta) < 0.7) + deltaZ_ = 0.4; + else if (fabs(eta) >= 0.7 && fabs(eta) < 1.0) + deltaZ_ = 0.6; + else if (fabs(eta) >= 1.0 && fabs(eta) < 1.2) + deltaZ_ = 0.76; + else if (fabs(eta) >= 1.2 && fabs(eta) < 1.6) + deltaZ_ = 1.0; + else if (fabs(eta) >= 1.6 && fabs(eta) < 2.0) + deltaZ_ = 1.7; + else if (fabs(eta) >= 2.0 && fabs(eta) <= 2.4) + deltaZ_ = 2.2; + } + + if (fabs(z0 - zVTX) <= deltaZ_) { + sumPx += pt * cos(phi); + sumPy += pt * sin(phi); + etTot += pt; + } else { // PU sums + sumPx_PU += pt * cos(phi); + sumPy_PU += pt * sin(phi); + etTot_PU += pt; + } + } // end loop over tracks + + float et = sqrt(sumPx * sumPx + sumPy * sumPy); + double etmiss_PU = sqrt(sumPx_PU * sumPx_PU + sumPy_PU * sumPy_PU); + + math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et); + int ibx = 0; + METCollection->push_back(TkEtMiss(missingEt, TkEtMiss::kMET, etTot, etmiss_PU, etTot_PU, ibx)); + + if (displaced_) + iEvent.put(std::move(METCollection), "L1TrackerEtMissExtended"); + else + iEvent.put(std::move(METCollection), "L1TrackerEtMiss"); +} // end producer + +void L1TrackerEtMissProducer::beginJob() {} + +void L1TrackerEtMissProducer::endJob() {} + +DEFINE_FWK_MODULE(L1TrackerEtMissProducer); diff --git a/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py new file mode 100644 index 0000000000000..e3124647b245b --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py @@ -0,0 +1,52 @@ +import FWCore.ParameterSet.Config as cms + +L1TkCaloHTMiss = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TkCaloJets", "L1TkCaloJets"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.2), # maximum eta of jets for HT + jet_minPt = cms.double(15.0), # minimum pt of jets for HT [GeV] + jet_minNtracksHighPt=cms.int32(0), #Add track jet quality criteria pT>100 + jet_minNtracksLowPt=cms.int32(0), #Add track jet quality criteria pT>50 + jet_minJetEtLowPt=cms.double(0.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(0.0), + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # require jets to have |z_jet - z_ref| below deltaZ [cm] + primaryVtxConstrain = cms.bool(False), # use primary vertex instead of leading jet as reference z position + useCaloJets = cms.bool(True), # determines whether matched jets or standalone jets are used for MHT + displaced = cms.bool(False) #Run with prompt/displaced jets - only useful for track jets +) + +L1TkCaloHTMissVtx = L1TkCaloHTMiss.clone() +L1TkCaloHTMiss.doVtxConstrain = cms.bool(True) + +L1TrackerHTMiss = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TrackJets", "L1TrackJets"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.4), + jet_minPt = cms.double(5.0), + jet_minNtracksLowPt=cms.int32(2), + jet_minNtracksHighPt=cms.int32(3), + jet_minJetEtLowPt=cms.double(50.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(100.0), + useCaloJets = cms.bool(False), + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # This is a dummy value for track only jets + primaryVtxConstrain = cms.bool(False), # primary vertex already applied to track jet collections + displaced = cms.bool(False) # Run with prompt/displaced jets +) + +L1TrackerHTMissExtended = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TrackJetsExtended", "L1TrackJetsExtended"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.4), + jet_minPt = cms.double(5.0), + jet_minNtracksLowPt=cms.int32(2), + jet_minNtracksHighPt=cms.int32(3), + jet_minJetEtLowPt=cms.double(50.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(100.0), + useCaloJets = cms.bool(False), + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # This is a dummy value for track only jets + primaryVtxConstrain = cms.bool(False), # primary vertex already applied to track jet collections + displaced = cms.bool(True) # Run with prompt/displaced jets +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py new file mode 100644 index 0000000000000..49f7ce2de4632 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackFastJets = cms.EDProducer("L1TrackFastJetProducer", + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + L1PrimaryVertexTag=cms.InputTag("L1TkPrimaryVertex"), + trk_zMax = cms.double(15.), # max track z0 [cm] + trk_chi2dofMax = cms.double(10.), # max track chi2/dof + trk_bendChi2Max = cms.double(2.2),# max bendChi2 cut + trk_ptMin = cms.double(2.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.5), # maximum track eta + trk_nStubMin = cms.int32(4), # minimum number of stubs in track + trk_nPSStubMin = cms.int32(-1), # minimum number of PS stubs in track + deltaZ0Cut=cms.double(0.5), # cluster tracks within |dz| 20 + coneSize=cms.double(0.4), #cone size for anti-kt fast jet + displaced = cms.bool(False) # use prompt/displaced tracks +) + +L1TrackFastJetsExtended = cms.EDProducer("L1TrackFastJetProducer", + L1TrackInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + L1PrimaryVertexTag=cms.InputTag("L1TkPrimaryVertex"), + trk_zMax = cms.double(15.), # max track z0 [cm] + trk_chi2dofMax = cms.double(40.), # max track chi2 for extended tracks + trk_bendChi2Max = cms.double(2.4),#Bendchi2 cut for extended tracks + trk_ptMin = cms.double(3.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.5), # maximum track eta + trk_nStubMin = cms.int32(4), # minimum number of stubs on track + trk_nPSStubMin = cms.int32(-1), # minimum number of stubs in PS modules on track + deltaZ0Cut=cms.double(3.0), #cluster tracks within |dz| 20 + coneSize=cms.double(0.4), #cone size for anti-kt fast jet + displaced = cms.bool(True) # use prompt/displaced tracks +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py new file mode 100644 index 0000000000000..c649e504af3da --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackJets = cms.EDProducer('L1TrackJetProducer', + L1TrackInputTag= cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + trk_zMax = cms.double (15.) , # maximum track z + trk_ptMax = cms.double(200.), # maximumum track pT before saturation [GeV] + trk_ptMin = cms.double(2.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.4), # maximum track eta + trk_chi2dofMax=cms.double(10.), # maximum track chi2/dof + trk_bendChi2Max=cms.double(2.2), # maximum track bendchi2 + trk_nPSStubMin=cms.int32(-1), # minimum PS stubs, -1 means no cut + minTrkJetpT=cms.double(5.), # minimum track pt to be considered for track jet + etaBins=cms.int32(24), + phiBins=cms.int32(27), + zBins=cms.int32(60), + d0_cutNStubs4=cms.double(0.15), + d0_cutNStubs5=cms.double(0.5), + lowpTJetMinTrackMultiplicity=cms.int32(2), + highpTJetMinTrackMultiplicity=cms.int32(3), + minJetEtLowPt=cms.double(50.0), + minJetEtHighPt=cms.double(100.0), + displaced=cms.bool(False), #Flag for displaced tracks + nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight + nStubs4Displacedbend_Loose=cms.double(1.7), + nStubs5DisplacedChi2_Loose=cms.double(2.75), + nStubs5Displacedbend_Loose=cms.double(3.5), + nStubs4DisplacedChi2_Tight=cms.double(12.0), + nStubs4Displacedbend_Tight=cms.double(1.0), + nStubs5DisplacedChi2_Tight=cms.double(2.75), + nStubs5Displacedbend_Tight=cms.double(3.5) +) + +L1TrackJetsExtended = cms.EDProducer('L1TrackJetProducer', + L1TrackInputTag= cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + trk_zMax = cms.double (15.) , # maximum track z + trk_ptMax = cms.double(200.), # maximumum track pT before saturation [GeV] + trk_ptMin = cms.double(3.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.4), # maximum track eta + trk_chi2dofMax=cms.double(40.), # maximum track chi2/dof + trk_bendChi2Max=cms.double(2.4), # maximum track bendchi2 + trk_nPSStubMin=cms.int32(-1), # minimum # PS stubs, -1 means no cut + minTrkJetpT=cms.double(5.), # minimum track pt to be considered for track jet + etaBins=cms.int32(24), + phiBins=cms.int32(27), + zBins=cms.int32(10), + d0_cutNStubs4=cms.double(0.15), + d0_cutNStubs5=cms.double(0.5), + lowpTJetMinTrackMultiplicity=cms.int32(2), + highpTJetMinTrackMultiplicity=cms.int32(3), + minJetEtLowPt=cms.double(50.0), + minJetEtHighPt=cms.double(100.0), + displaced=cms.bool(True), #Flag for displaced tracks + nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight + nStubs4Displacedbend_Loose=cms.double(1.7), + nStubs5DisplacedChi2_Loose=cms.double(2.75), + nStubs5Displacedbend_Loose=cms.double(3.5), + nStubs4DisplacedChi2_Tight=cms.double(12.0), + nStubs4Displacedbend_Tight=cms.double(1.0), + nStubs5DisplacedChi2_Tight=cms.double(2.75), + nStubs5Displacedbend_Tight=cms.double(3.5) +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/L1TTrackMatch/python/L1TrackObjectNtupleMaker_cfg.py new file mode 100644 index 0000000000000..5d6e6d2b60aea --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackObjectNtupleMaker_cfg.py @@ -0,0 +1,185 @@ +############################################################ +# define basic process +############################################################ + +import FWCore.ParameterSet.Config as cms +import FWCore.Utilities.FileUtils as FileUtils +import os + +############################################################ +# edit options here +############################################################ +L1TRK_INST ="L1TrackJets" ### if not in input DIGRAW then we make them in the above step +process = cms.Process(L1TRK_INST) + +L1TRKALGO = 'HYBRID' #baseline, 4par fit +# L1TRKALGO = 'HYBRID_DISPLACED' #extended, 5par fit +#L1TRKALGO = 'HYBRID_PROMPTANDDISP' + +DISPLACED = '' + +############################################################ +# import standard configurations +############################################################ + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +############################################################ +# input and output +############################################################ + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(50)) + +readFiles = cms.untracked.vstring( + "/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/F7BF4AED-51F1-9D47-B86D-6C3DDA134AB9.root" +) +secFiles = cms.untracked.vstring() + +process.source = cms.Source ("PoolSource", + fileNames = readFiles, + secondaryFileNames = secFiles, + duplicateCheckMode = cms.untracked.string('noDuplicateCheck'), + ) + + +process.TFileService = cms.Service("TFileService", fileName = cms.string('CheckingJets_CMSSW11_CMS.root'), closeFileFast = cms.untracked.bool(True)) + + +############################################################ +# L1 tracking: remake stubs? +############################################################ + +#process.load('L1Trigger.TrackTrigger.TrackTrigger_cff') +#from L1Trigger.TrackTrigger.TTStubAlgorithmRegister_cfi import * +#process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff") + +#from SimTracker.TrackTriggerAssociation.TTClusterAssociation_cfi import * +#TTClusterAssociatorFromPixelDigis.digiSimLinks = cms.InputTag("simSiPixelDigis","Tracker") + +#process.TTClusterStub = cms.Path(process.TrackTriggerClustersStubs) +#process.TTClusterStubTruth = cms.Path(process.TrackTriggerAssociatorClustersStubs) + + +process.load("L1Trigger.TrackFindingTracklet.L1HybridEmulationTracks_cff") +process.load("L1Trigger.L1TTrackMatch.L1TrackJetProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TrackFastJetProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TrackerEtMissProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TkHTMissProducer_cfi") + + +# HYBRID: prompt tracking +if (L1TRKALGO == 'HYBRID'): + process.TTTracksEmulation = cms.Path(process.L1HybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1HybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJets) + process.pL1TrackFastJets=cms.Path(process.L1TrackFastJets) + process.pTkMET = cms.Path(process.L1TrackerEtMiss) + process.pTkMHT = cms.Path(process.L1TrackerHTMiss) + DISPLACED = 'Prompt' + +# HYBRID: extended tracking +elif (L1TRKALGO == 'HYBRID_DISPLACED'): + process.TTTracksEmulation = cms.Path(process.L1ExtendedHybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1ExtendedHybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJetsExtended) + process.pL1TrackFastJets = cms.Path(process.L1TrackFastJetsExtended) + process.pTkMET = cms.Path(process.L1TrackerEtMissExtended) + process.pTkMHT = cms.Path(process.L1TrackerHTMissExtended) + DISPLACED = 'Displaced'# + +# HYBRID: extended tracking +elif (L1TRKALGO == 'HYBRID_PROMPTANDDISP'): + process.TTTracksEmulation = cms.Path(process.L1PromptExtendedHybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1PromptExtendedHybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJets*process.L1TrackJetsExtended) + process.pL1TrackFastJets = cms.Path(process.L1TrackFastJets*process.L1TrackFastJetsExtended) + process.pTkMET = cms.Path(process.L1TrackerEtMiss*process.L1TrackerEtMissExtended) + process.pTkMHT = cms.Path(process.L1TrackerHTMiss*process.L1TrackerHTMissExtended) + DISPLACED = 'Both' + + +############################################################ +# Primary vertex +############################################################ +process.load("L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi") +process.pPV = cms.Path(process.L1TkPrimaryVertex) + + +############################################################ +# Define the track ntuple process, MyProcess is the (unsigned) PDGID corresponding to the process which is run +# e.g. single electron/positron = 11 +# single pion+/pion- = 211 +# single muon+/muon- = 13 +# pions in jets = 6 +# taus = 15 +# all TPs = 1 +############################################################ + +process.L1TrackNtuple = cms.EDAnalyzer('L1TrackObjectNtupleMaker', + MyProcess = cms.int32(1), + DebugMode = cms.bool(False), # printout lots of debug statements + SaveAllTracks = cms.bool(True), # save *all* L1 tracks, not just truth matched to primary particle + SaveStubs = cms.bool(False), # save some info for *all* stubs + Displaced = cms.string(DISPLACED),# "Prompt", "Displaced", "Both" + L1Tk_minNStub = cms.int32(4), # L1 tracks with >= 4 stubs + TP_minNStub = cms.int32(4), # require TP to have >= X number of stubs associated with it + TP_minNStubLayer = cms.int32(4), # require TP to have stubs in >= X layers/disks + TP_minPt = cms.double(2.0), # only save TPs with pt > X GeV + TP_maxEta = cms.double(2.5), # only save TPs with |eta| < X + TP_maxZ0 = cms.double(30.0), # only save TPs with |z0| < X cm + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), # TTTracks, prompt + L1TrackExtendedInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), # TTTracks, extended + MCTruthTrackInputTag = cms.InputTag("TTTrackAssociatorFromPixelDigis", "Level1TTTracks"), # MCTruth track, prompt + MCTruthTrackExtendedInputTag = cms.InputTag("TTTrackAssociatorFromPixelDigisExtended", "Level1TTTracks"), # MCTruth track, extended + L1StubInputTag = cms.InputTag("TTStubsFromPhase2TrackerDigis","StubAccepted"), + MCTruthClusterInputTag = cms.InputTag("TTClusterAssociatorFromPixelDigis", "ClusterAccepted"), + MCTruthStubInputTag = cms.InputTag("TTStubAssociatorFromPixelDigis", "StubAccepted"), + TrackingParticleInputTag = cms.InputTag("mix", "MergedTrackTruth"), + TrackingVertexInputTag = cms.InputTag("mix", "MergedTrackTruth"), + ## tracking in jets stuff (--> requires AK4 genjet collection present!) + TrackingInJets = cms.bool(False), + GenJetInputTag = cms.InputTag("ak4GenJets", ""), + ##track jets and track MET + SaveTrackJets = cms.bool(True), + SaveTrackMET = cms.bool(True), + TrackFastJetsInputTag = cms.InputTag("L1TrackFastJets","L1TrackFastJets"), + TrackFastJetsExtendedInputTag = cms.InputTag("L1TrackFastJetsExtended","L1TrackFastJetsExtended"), + TrackJetsInputTag=cms.InputTag("L1TrackJets", "L1TrackJets"), + TrackJetsExtendedInputTag=cms.InputTag("L1TrackJetsExtended", "L1TrackJetsExtended"), + TrackMETInputTag = cms.InputTag("L1TrackerEtMiss","L1TrackerEtMiss","L1TrackJets"), + TrackMETExtendedInputTag = cms.InputTag("L1TrackerEtMissExtended","L1TrackerEtMissExtended"), + TrackMHTInputTag = cms.InputTag("L1TrackerHTMiss","L1TrackerHTMiss","L1TrackJets"), + TrackMHTExtendedInputTag = cms.InputTag("L1TrackerHTMissExtended","L1TrackerHTMiss"), + GenParticleInputTag = cms.InputTag("genParticles",""), + RecoVertexInputTag=cms.InputTag("L1TkPrimaryVertex"), +) + +process.ntuple = cms.Path(process.L1TrackNtuple) + +process.out = cms.OutputModule( "PoolOutputModule", + fastCloning = cms.untracked.bool( False ), + fileName = cms.untracked.string("test.root" ) + ) +process.pOut = cms.EndPath(process.out) + + + +# use this if you want to re-run the stub making +# process.schedule = cms.Schedule(process.TTClusterStub,process.TTClusterStubTruth,process.TTTracksEmulationWithTruth,process.ntuple) + +# use this if cluster/stub associators not available +# process.schedule = cms.Schedule(process.TTClusterStubTruth,process.TTTracksEmulationWithTruth,process.ntuple) + +#process.schedule = cms.Schedule(process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT,process.pOut) +#process.schedule = cms.Schedule(process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT, process.ntuple) +#process.schedule = cms.Schedule(process.ntuple) +process.schedule = cms.Schedule(process.TTTracksEmulationWithTruth, process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT, process.ntuple) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py new file mode 100644 index 0000000000000..18dbf558c3e68 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + maxZ0 = cms.double ( 15. ) , # in cm + maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks + chi2dofMax = cms.double( 10. ), # max chi2/dof allowed for chosen tracks + bendChi2Max = cms.double( 2.2 ),# max bendchi2 allowed for chosen tracks + minPt = cms.double( 2. ), # in GeV + deltaZ = cms.double( 3. ), # in cm + nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks + nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules + maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + # mismeasured and are treated according to highPtTracks below. + # When maxPt < 0, no special treatment is done for high PT tracks. + highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored + # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. + # When maxPt < 0, no special treatment is done for high PT tracks. + displaced = cms.bool(False) # Use promt/displaced tracks +) + +L1TrackerEtMissExtended = cms.EDProducer('L1TrackerEtMissProducer', + L1TrackInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + maxZ0 = cms.double ( 15. ) , # in cm + maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks + chi2dofMax = cms.double( 40. ), # max chi2/dof allowed for chosen tracks + bendChi2Max = cms.double( 2.4 ),# max bendchi2 allowed for chosen tracks + minPt = cms.double( 3. ), # in GeV + deltaZ = cms.double( 3.0 ), # in cm + nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks + nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules + maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + # mismeasured and are treated according to highPtTracks below. + # When maxPt < 0, no special treatment is done for high PT tracks. + highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored + # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. + # When maxPt < 0, no special treatment is done for high PT tracks. + displaced = cms.bool(True) # Use promt/displaced tracks +) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc new file mode 100644 index 0000000000000..4ccff7bcb6d21 --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc @@ -0,0 +1,239 @@ +#include +#include +#include +#include + +#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/L1TParticleFlow/interface/PFCandidate.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace l1t; + +class L1METPFProducer : public edm::global::EDProducer<> { +public: + explicit L1METPFProducer(const edm::ParameterSet&); + ~L1METPFProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + edm::EDGetTokenT> _l1PFToken; + + int maxCands_ = 128; + + // quantization controllers + typedef ap_ufixed<14, 12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 + const float ptLSB_ = 0.25; // GeV + const float phiLSB_ = M_PI / 720; // rad + + // derived, helper types + typedef ap_fixed pxy_t; + typedef ap_fixed<2 * pt_t::width, 2 * pt_t::iwidth, AP_RND, AP_SAT> pt2_t; + // derived, helper constants + const float maxPt_ = ((1 << pt_t::width) - 1) * ptLSB_; + const phi_t hwPi_ = round(M_PI / phiLSB_); + const phi_t hwPiOverTwo_ = round(M_PI / (2 * phiLSB_)); + + typedef ap_ufixed inv_t; // can't easily use the MAXPT/pt trick with ap_fixed + + // to make configurable... + const int dropBits_ = 2; + const int dropFactor_ = (1 << dropBits_); + const int invTableBits_ = 10; + const int invTableSize_ = (1 << invTableBits_); + + void Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug = false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug = false) const; + + void CalcMetHLS(const std::vector& pt, + const std::vector& phi, + reco::Candidate::PolarLorentzVector& metVector) const; +}; + +L1METPFProducer::L1METPFProducer(const edm::ParameterSet& cfg) + : _l1PFToken(consumes>(cfg.getParameter("L1PFObjects"))), + maxCands_(cfg.getParameter("maxCands")) { + produces>(); +} + +void L1METPFProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + edm::Handle l1PFCandidates; + iEvent.getByToken(_l1PFToken, l1PFCandidates); + + std::vector pt; + std::vector phi; + + for (int i = 0; i < int(l1PFCandidates->size()) && (i < maxCands_ || maxCands_ < 0); i++) { + const auto& l1PFCand = l1PFCandidates->at(i); + pt.push_back(l1PFCand.pt()); + phi.push_back(l1PFCand.phi()); + } + + reco::Candidate::PolarLorentzVector metVector; + + CalcMetHLS(pt, phi, metVector); + + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + + std::unique_ptr> metCollection(new std::vector(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); +} + +void L1METPFProducer::CalcMetHLS(const std::vector& pt, + const std::vector& phi, + reco::Candidate::PolarLorentzVector& metVector) const { + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; + + for (uint i = 0; i < pt.size(); i++) { + pt_t hw_pt = min(pt[i], maxPt_); + phi_t hw_phi = float(TVector2::Phi_mpi_pi(phi[i]) / phiLSB_); + + Project(hw_pt, hw_phi, hw_px, true); + Project(hw_pt, hw_phi, hw_py, false); + + hw_sumx = hw_sumx - hw_px; + hw_sumy = hw_sumy - hw_py; + } + + pt2_t hw_met = pt2_t(hw_sumx) * pt2_t(hw_sumx) + pt2_t(hw_sumy) * pt2_t(hw_sumy); + hw_met = sqrt(int(hw_met)); // stand-in for HLS::sqrt + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx, hw_sumy, hw_met_phi); + + metVector.SetPt(hw_met.to_double()); + metVector.SetPhi(hw_met_phi.to_double() * phiLSB_); + metVector.SetEta(0); +} + +void L1METPFProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug) const { + /* + Convert pt and phi to px (py) + 1) Map phi to the first quadrant to reduce LUT size + 2) Lookup sin(phiQ1), where the result is in [0,maxPt] + which is used to encode [0,1]. + 3) Multiply pt by sin(phiQ1) to get px. Result will be px*maxPt, but + wrapping multiplication is 'mod maxPt' so the correct value is returned. + 4) Check px=-|px|. + */ + + // set phi to first quadrant + phi_t phiQ1 = (phi > 0) ? phi : phi_t(-phi); // Q1/Q4 + if (phiQ1 >= hwPiOverTwo_) + phiQ1 = hwPi_ - phiQ1; + + if (phiQ1 > hwPiOverTwo_) { + edm::LogWarning("L1METPFProducer") << "unexpected phi (high)"; + phiQ1 = hwPiOverTwo_; + } else if (phiQ1 < 0) { + edm::LogWarning("L1METPFProducer") << "unexpected phi (low)"; + phiQ1 = 0; + } + if (isX) { + typedef ap_ufixed<14, 12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + ap_ufixed cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI / 2); + pxy = pt * cosPhi; + if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) + pxy = -pxy; + } else { + ap_ufixed sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI / 2); + pxy = pt * sinPhi; + if (phi < 0) + pxy = -pxy; + } +} + +void L1METPFProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) const { + if (px == 0 && py == 0) { + phi = 0; + return; + } + if (px == 0) { + phi = py > 0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); + return; + } + if (py == 0) { + phi = px > 0 ? phi_t(0) : phi_t(-hwPi_); + return; + } + + // get q1 coordinates + pt_t x = px > 0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; + pt_t y = py > 0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; + // transform so a maxPt_ / dropFactor_) + b = maxPt_ / dropFactor_; + // map [0,max/4) to inv table size + int index = round((b.to_double() / (maxPt_ / dropFactor_)) * invTableSize_); + float bcheck = (float(index) / invTableSize_) * (maxPt_ / dropFactor_); + inv_t inv_b = 1. / ((float(index) / invTableSize_) * (maxPt_ / dropFactor_)); + + inv_t a_over_b = a * inv_b; + + if (debug) { + LogDebug("L1METPFProducer") << " a, b = \n " << a.to_double() << " , " << b.to_double() + << "; index, inv = " << index << ", " << inv_b.to_double() + << "; ratio= " << a_over_b.to_double() << " \n" + << std::endl; + LogDebug("L1METPFProducer") << "bcheck, 1/bc = " << bcheck << ", " << 1. / bcheck << " -- " << invTableSize_ << " " + << maxPt_ << " " << dropFactor_ << " \n" + << std::endl; + } + + const int atanTableBits_ = 7; + const int atanTableSize_ = (1 << atanTableBits_); + index = round(a_over_b.to_double() * atanTableSize_); + phi = atan(float(index) / atanTableSize_) / phiLSB_; + + if (debug) { + LogDebug("L1METPFProducer") << " atan index, phi = " << index << ", " << phi.to_double() << " (" + << phi.to_double() * (M_PI / hwPi_.to_double()) + << " rad) real atan(a/b)= " << atan(a.to_double() / b.to_double()) << " \n" + << std::endl; + } + + // rotate from (0,pi/4) to full quad1 + if (y > x) + phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi + // other quadrants + if (px < 0 && py > 0) + phi = hwPi_ - phi; // Q2 phi = pi - phi + if (px > 0 && py < 0) + phi = -phi; // Q4 phi = -phi + if (px < 0 && py < 0) + phi = -(hwPi_ - phi); // Q3 composition of both + + if (debug) { + LogDebug("L1METPFProducer") << " phi hw, float, real = " << phi.to_double() << ", " + << phi.to_double() * (M_PI / hwPi_.to_double()) << " (" + << atan2(py.to_double(), px.to_double()) << " rad from x,y = " << px.to_double() << ", " + << py.to_double() << ") \n" + << std::endl; + } +} + +void L1METPFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("maxCandidates", 128); + desc.add("L1PFObjects", edm::InputTag("L1PFProducer", "l1pfCandidates")); + descriptions.add("L1METPFProducer", desc); +} + +L1METPFProducer::~L1METPFProducer() {} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(L1METPFProducer); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py index 1e3c3f2bc8612..15cbb2308957f 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py @@ -6,7 +6,7 @@ hcalDigis = cms.VInputTag(cms.InputTag('simHcalTriggerPrimitiveDigis')), hcalDigisBarrel = cms.bool(False), hcalDigisHF = cms.bool(True), - phase2barrelCaloTowers = cms.VInputTag(cms.InputTag("L1EGammaClusterEmuProducer",)), + phase2barrelCaloTowers = cms.VInputTag(cms.InputTag("L1EGammaClusterEmuProducer","L1CaloTowerCollection","")), hcalHGCTowers = cms.VInputTag(cms.InputTag("hgcalTowerProducer:HGCalTowerProcessor") ), hcalHGCTowersHadOnly = cms.bool(False), # take also EM part from towers emCorrector = cms.string(""), # no need to correct further diff --git a/L1Trigger/Phase2L1Taus/BuildFile.xml b/L1Trigger/Phase2L1Taus/BuildFile.xml new file mode 100644 index 0000000000000..fe08b469b894c --- /dev/null +++ b/L1Trigger/Phase2L1Taus/BuildFile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h new file mode 100644 index 0000000000000..0dca7074803d6 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h @@ -0,0 +1,100 @@ +#ifndef L1Trigger_Phase2L1Taus_L1HPSPFTauBuilder_h +#define L1Trigger_Phase2L1Taus_L1HPSPFTauBuilder_h + +#include "FWCore/ParameterSet/interface/ParameterSet.h" // edm::ParameterSet +#include "DataFormats/Provenance/interface/ProductID.h" // edm::ProductID +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "CommonTools/Utils/interface/FormulaEvaluator.h" +#include + +class L1HPSPFTauBuilder { +public: + L1HPSPFTauBuilder(const edm::ParameterSet& cfg); + ~L1HPSPFTauBuilder() = default; + + void reset(); + void setL1PFCandProductID(const edm::ProductID& l1PFCandProductID); + void setVertex(const l1t::TkPrimaryVertexRef& primaryVertex); + void setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed); + //void setL1PFTauSeed(const reco::CaloJetRef& l1Jet_seed); + void setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed, const std::vector& l1PFCands); + void addL1PFCandidates(const std::vector& l1PFCands); + void buildL1PFTau(); + + l1t::HPSPFTau getL1PFTau() const { return l1PFTau_; } + +private: + l1t::PFCandidateRefVector convertToRefVector(const std::vector& l1PFCands); + + bool isWithinSignalCone(const l1t::PFCandidate& l1PFCand); + bool isWithinStrip(const l1t::PFCandidate& l1PFCand); + bool isWithinIsolationCone(const l1t::PFCandidate& l1PFCand); + + reco::FormulaEvaluator signalConeSizeFormula_; + + double signalConeSize_; + double signalConeSize2_; + double minSignalConeSize_; + double maxSignalConeSize_; + + bool useStrips_; + double stripSizeEta_; + double stripSizePhi_; + + double isolationConeSize_; + double isolationConeSize2_; + + std::vector signalQualityCutsDzCutDisabled_; + std::vector signalQualityCutsDzCutEnabledPrimary_; + std::vector isolationQualityCutsDzCutDisabled_; + std::vector isolationQualityCutsDzCutEnabledPrimary_; + std::vector isolationQualityCutsDzCutEnabledPileup_; + edm::ProductID l1PFCandProductID_; + bool isPFCandSeeded_; + l1t::PFCandidateRef l1PFCandSeed_; + bool isJetSeeded_; + reco::CaloJetRef l1JetSeed_; + double l1PFTauSeedEta_; + double l1PFTauSeedPhi_; + double l1PFTauSeedZVtx_; + double sumAllL1PFCandidatesPt_; + l1t::TkPrimaryVertexRef primaryVertex_; + l1t::HPSPFTau l1PFTau_; + + reco::Particle::LorentzVector stripP4_; + + std::vector signalAllL1PFCandidates_; + std::vector signalChargedHadrons_; + std::vector signalElectrons_; + std::vector signalNeutralHadrons_; + std::vector signalPhotons_; + std::vector signalMuons_; + + std::vector stripAllL1PFCandidates_; + std::vector stripElectrons_; + std::vector stripPhotons_; + + std::vector isoAllL1PFCandidates_; + std::vector isoChargedHadrons_; + std::vector isoElectrons_; + std::vector isoNeutralHadrons_; + std::vector isoPhotons_; + std::vector isoMuons_; + + std::vector sumAllL1PFCandidates_; + std::vector sumChargedHadrons_; + std::vector sumElectrons_; + std::vector sumNeutralHadrons_; + std::vector sumPhotons_; + std::vector sumMuons_; + + double sumChargedIsoPileup_; + + bool debug_; +}; + +#endif diff --git a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h new file mode 100644 index 0000000000000..6b997da64c4a7 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h @@ -0,0 +1,46 @@ +#ifndef L1Trigger_Phase2L1Taus_L1HPSPFTauQualityCut_h +#define L1Trigger_Phase2L1Taus_L1HPSPFTauQualityCut_h + +#include "FWCore/ParameterSet/interface/ParameterSet.h" // edm::ParameterSet +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate +#include // std::string +#include // std::vector + +class L1HPSPFTauQualityCut { +public: + /// constructor + L1HPSPFTauQualityCut(const edm::ParameterSet& cfg); + + /// destructor + ~L1HPSPFTauQualityCut() = default; + + /// returns true (false) if PFCandidate passes (fails) quality cuts + bool operator()(const l1t::PFCandidate& pfCand, float_t primaryVertexZ) const; + + /// accessor functions + l1t::PFCandidate::ParticleType pfCandType() const; + enum { kDisabled, kEnabledPrimary, kEnabledPileup }; + int dzCut() const; + float_t minPt() const; + float_t maxDz() const; + +private: + l1t::PFCandidate::ParticleType pfCandType_; + + int dzCut_; // flag to invert dz cut in order to compute charged isolation from pileup for delta-beta corrections + + float_t minPt_; + float_t maxDz_; + + bool debug_; +}; + +std::vector readL1PFTauQualityCuts(const edm::ParameterSet& cfg, + const std::string& dzCut, + bool debug = false); + +bool isSelected(const std::vector& qualityCuts, + const l1t::PFCandidate& pfCand, + float_t primaryVertexZ); + +#endif diff --git a/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml b/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml new file mode 100644 index 0000000000000..cdb152f65a767 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc new file mode 100644 index 0000000000000..dd909fe71505e --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc @@ -0,0 +1,280 @@ +#include "L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include // std::fabs + +HPSPFTauProducer::HPSPFTauProducer(const edm::ParameterSet& cfg) + : moduleLabel_(cfg.getParameter("@module_label")), + tauBuilder_(cfg), + useChargedPFCandSeeds_(cfg.getParameter("useChargedPFCandSeeds")), + minSeedChargedPFCandPt_(cfg.getParameter("minSeedChargedPFCandPt")), + maxSeedChargedPFCandEta_(cfg.getParameter("maxSeedChargedPFCandEta")), + maxSeedChargedPFCandDz_(cfg.getParameter("maxSeedChargedPFCandDz")), + useJetSeeds_(cfg.getParameter("useJetSeeds")), + minSeedJetPt_(cfg.getParameter("minSeedJetPt")), + maxSeedJetEta_(cfg.getParameter("maxSeedJetEta")), + minPFTauPt_(cfg.getParameter("minPFTauPt")), + maxPFTauEta_(cfg.getParameter("maxPFTauEta")), + minLeadChargedPFCandPt_(cfg.getParameter("minLeadChargedPFCandPt")), + maxLeadChargedPFCandEta_(cfg.getParameter("maxLeadChargedPFCandEta")), + maxLeadChargedPFCandDz_(cfg.getParameter("maxLeadChargedPFCandDz")), + maxChargedIso_(cfg.getParameter("maxChargedIso")), + maxChargedRelIso_(cfg.getParameter("maxChargedRelIso")), + deltaRCleaning_(cfg.getParameter("deltaRCleaning")), + applyPreselection_(cfg.getParameter("applyPreselection")), + debug_(cfg.getUntrackedParameter("debug", false)) { + srcL1PFCands_ = cfg.getParameter("srcL1PFCands"); + tokenL1PFCands_ = consumes(srcL1PFCands_); + srcL1Jets_ = cfg.getParameter("srcL1Jets"); + if (useJetSeeds_) { + tokenL1Jets_ = consumes>(srcL1Jets_); + } + srcL1Vertices_ = cfg.getParameter("srcL1Vertices"); + if (!srcL1Vertices_.label().empty()) { + tokenL1Vertices_ = consumes>(srcL1Vertices_); + } + deltaR2Cleaning_ = deltaRCleaning_ * deltaRCleaning_; + + edm::ParameterSet cfg_signalQualityCuts = cfg.getParameter("signalQualityCuts"); + signalQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "disabled"); + edm::ParameterSet cfg_isolationQualityCuts = cfg.getParameter("isolationQualityCuts"); + isolationQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "disabled"); + + produces(); +} + +namespace { + bool isHigherPt_pfCandRef(const l1t::PFCandidateRef& l1PFCand1, const l1t::PFCandidateRef& l1PFCand2) { + return l1PFCand1->pt() > l1PFCand2->pt(); + } + + bool isHigherPt_pfTau(const l1t::HPSPFTau& l1PFTau1, const l1t::HPSPFTau& l1PFTau2) { + return l1PFTau1.pt() > l1PFTau2.pt(); + } +} // namespace + +void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) { + std::unique_ptr l1PFTauCollectionCleaned(new l1t::HPSPFTauCollection()); + + edm::Handle l1PFCands; + evt.getByToken(tokenL1PFCands_, l1PFCands); + + l1t::TkPrimaryVertexRef primaryVertex; + float primaryVertex_z = 0.; + if (!srcL1Vertices_.label().empty()) { + edm::Handle> vertices; + evt.getByToken(tokenL1Vertices_, vertices); + if (!vertices->empty()) { + primaryVertex = l1t::TkPrimaryVertexRef(vertices, 0); + primaryVertex_z = primaryVertex->zvertex(); + } + } + + // build collection of selected PFCandidates + std::vector selectedL1PFCandsSignalQualityCuts; + std::vector selectedL1PFCandsSignalOrIsolationQualityCuts; + size_t numL1PFCands = l1PFCands->size(); + for (size_t idxL1PFCand = 0; idxL1PFCand < numL1PFCands; ++idxL1PFCand) { + l1t::PFCandidateRef l1PFCand(l1PFCands, idxL1PFCand); + bool passesSignalQualityCuts = isSelected(signalQualityCutsDzCutDisabled_, *l1PFCand, primaryVertex_z); + bool passesIsolationQualityCuts = isSelected(isolationQualityCutsDzCutDisabled_, *l1PFCand, primaryVertex_z); + if (passesSignalQualityCuts) { + selectedL1PFCandsSignalQualityCuts.push_back(l1PFCand); + } + if (passesSignalQualityCuts || passesIsolationQualityCuts) { + selectedL1PFCandsSignalOrIsolationQualityCuts.push_back(l1PFCand); + } + } + + // sort PFCandidate collection by decreasing pT + std::sort(selectedL1PFCandsSignalQualityCuts.begin(), selectedL1PFCandsSignalQualityCuts.end(), isHigherPt_pfCandRef); + std::sort(selectedL1PFCandsSignalOrIsolationQualityCuts.begin(), + selectedL1PFCandsSignalOrIsolationQualityCuts.end(), + isHigherPt_pfCandRef); + + l1t::HPSPFTauCollection l1PFTauCollectionUncleaned; + + if (useChargedPFCandSeeds_) { + for (const auto& l1PFCand : selectedL1PFCandsSignalQualityCuts) { + if (l1PFCand->charge() != 0 && l1PFCand->pt() > minSeedChargedPFCandPt_ && + std::fabs(l1PFCand->eta()) < maxSeedChargedPFCandEta_) { + bool isFromPrimaryVertex = false; + if (primaryVertex.get()) { + l1t::PFTrackRef l1PFTrack = l1PFCand->pfTrack(); + double dz = std::fabs(l1PFTrack->vertex().z() - primaryVertex_z); + if (dz < maxSeedChargedPFCandDz_) { + isFromPrimaryVertex = true; + } + } else { + isFromPrimaryVertex = true; + } + if (isFromPrimaryVertex) { + tauBuilder_.reset(); + tauBuilder_.setL1PFCandProductID(l1PFCands.id()); + tauBuilder_.setVertex(primaryVertex); + tauBuilder_.setL1PFTauSeed(l1PFCand); + tauBuilder_.addL1PFCandidates(selectedL1PFCandsSignalOrIsolationQualityCuts); + tauBuilder_.buildL1PFTau(); + l1t::HPSPFTau l1PFTau = tauBuilder_.getL1PFTau(); + if (l1PFTau.pt() > isPFTauPt_) + l1PFTauCollectionUncleaned.push_back(l1PFTau); + } + } + } + } + + if (useJetSeeds_) { + edm::Handle> l1Jets; + evt.getByToken(tokenL1Jets_, l1Jets); + + size_t numL1Jets = l1Jets->size(); + for (size_t idxL1Jet = 0; idxL1Jet < numL1Jets; ++idxL1Jet) { + reco::CaloJetRef l1Jet(l1Jets, idxL1Jet); + if (l1Jet->pt() > minSeedJetPt_ && std::fabs(l1Jet->eta()) < maxSeedJetEta_) { + tauBuilder_.reset(); + tauBuilder_.setL1PFCandProductID(l1PFCands.id()); + tauBuilder_.setVertex(primaryVertex); + //tauBuilder_.setL1PFTauSeed(l1Jet); + tauBuilder_.setL1PFTauSeed(l1Jet, selectedL1PFCandsSignalQualityCuts); + tauBuilder_.addL1PFCandidates(selectedL1PFCandsSignalOrIsolationQualityCuts); + tauBuilder_.buildL1PFTau(); + l1t::HPSPFTau l1PFTau = tauBuilder_.getL1PFTau(); + if (l1PFTau.pt() > isPFTauPt_) + l1PFTauCollectionUncleaned.push_back(l1PFTau); + } + } + } + + // sort PFTau candidate collection by decreasing pT + std::sort(l1PFTauCollectionUncleaned.begin(), l1PFTauCollectionUncleaned.end(), isHigherPt_pfTau); + + for (const auto& l1PFTau : l1PFTauCollectionUncleaned) { + if (applyPreselection_ && + !(l1PFTau.pt() > minPFTauPt_ && std::fabs(l1PFTau.eta()) < maxPFTauEta_ && + l1PFTau.leadChargedPFCand().isNonnull() && l1PFTau.leadChargedPFCand()->pt() > minLeadChargedPFCandPt_ && + std::fabs(l1PFTau.leadChargedPFCand()->eta()) < maxLeadChargedPFCandEta_ && + (srcL1Vertices_.label().empty() || + (primaryVertex.isNonnull() && l1PFTau.leadChargedPFCand()->pfTrack().isNonnull() && + std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->zvertex()) < + maxLeadChargedPFCandDz_)) && + l1PFTau.sumChargedIso() < maxChargedIso_ && l1PFTau.sumChargedIso() < maxChargedRelIso_ * l1PFTau.pt())) + continue; + + bool isOverlap = false; + for (const auto& l1PFTau2 : *l1PFTauCollectionCleaned) { + double deltaEta = l1PFTau.eta() - l1PFTau2.eta(); + double deltaPhi = l1PFTau.phi() - l1PFTau2.phi(); + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < deltaR2Cleaning_) { + isOverlap = true; + } + } + if (!isOverlap) { + l1PFTauCollectionCleaned->push_back(l1PFTau); + } + } + + evt.put(std::move(l1PFTauCollectionCleaned)); +} + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // HPSPFTauProducerPF + edm::ParameterSetDescription desc; + desc.add("useJetSeeds", true); + desc.add("minPFTauPt", 20.0); + desc.add("minSignalConeSize", 0.05); + { + edm::ParameterSetDescription psd0; + { + edm::ParameterSetDescription psd1; + psd1.add("minPt", 0.0); + psd0.add("neutralHadron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("muon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("electron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("minPt", 0.0); + psd0.add("photon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("chargedHadron", psd1); + } + desc.add("isolationQualityCuts", psd0); + } + desc.add("stripSizePhi", 0.2); + desc.add("minSeedJetPt", 30.0); + desc.add("maxChargedRelIso", 1.0); + desc.add("minSeedChargedPFCandPt", 5.0); + desc.add("srcL1PFCands", edm::InputTag("l1pfCandidates", "PF")); + desc.add("stripSizeEta", 0.05); + desc.add("maxLeadChargedPFCandEta", 2.4); + desc.add("deltaRCleaning", 0.4); + desc.add("useStrips", true); + desc.add("maxSeedChargedPFCandDz", 1000.0); + desc.add("minLeadChargedPFCandPt", 1.0); + desc.add("maxSeedChargedPFCandEta", 2.4); + desc.add("applyPreselection", false); + desc.add("isolationConeSize", 0.4); + desc.add("srcL1Vertices", edm::InputTag("L1TkPrimaryVertex")); + desc.add("maxChargedIso", 1000.0); + { + edm::ParameterSetDescription psd0; + { + edm::ParameterSetDescription psd1; + psd1.add("minPt", 0.0); + psd0.add("neutralHadron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("muon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("electron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("minPt", 0.0); + psd0.add("photon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add("maxDz", 0.4); + psd1.add("minPt", 0.0); + psd0.add("chargedHadron", psd1); + } + desc.add("signalQualityCuts", psd0); + } + desc.add("useChargedPFCandSeeds", true); + desc.add("maxLeadChargedPFCandDz", 1000.0); + desc.add("maxSeedJetEta", 2.4); + desc.add("signalConeSize", "2.8/max(1., pt)"); + desc.add("srcL1Jets", + edm::InputTag("Phase1L1TJetProducer", "UncalibratedPhase1L1TJetFromPfCandidates")); + desc.addUntracked("debug", false); + desc.add("maxPFTauEta", 2.4); + desc.add("maxSignalConeSize", 0.1); + descriptions.addWithDefaultLabel(desc); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HPSPFTauProducer); diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h new file mode 100644 index 0000000000000..c75d41d6b6552 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h @@ -0,0 +1,72 @@ +#ifndef L1Trigger_Phase2L1Taus_HPSPFTauProducer_h +#define L1Trigger_Phase2L1Taus_HPSPFTauProducer_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 "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h" // L1HPSPFTauBuilder +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau +#include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" // l1t::HPSPFTauCollection +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +#include +#include + +class HPSPFTauProducer : public edm::stream::EDProducer<> { +public: + explicit HPSPFTauProducer(const edm::ParameterSet& cfg); + ~HPSPFTauProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + std::string moduleLabel_; + + L1HPSPFTauBuilder tauBuilder_; + + edm::InputTag srcL1PFCands_; + edm::EDGetTokenT tokenL1PFCands_; + edm::InputTag srcL1Jets_; + edm::EDGetTokenT> tokenL1Jets_; + edm::InputTag srcL1Vertices_; + edm::EDGetTokenT> tokenL1Vertices_; + + std::vector signalQualityCutsDzCutDisabled_; + std::vector isolationQualityCutsDzCutDisabled_; + + bool useChargedPFCandSeeds_; + double minSeedChargedPFCandPt_; + double maxSeedChargedPFCandEta_; + double maxSeedChargedPFCandDz_; + + bool useJetSeeds_; + double minSeedJetPt_; + double maxSeedJetEta_; + + double minPFTauPt_; + double maxPFTauEta_; + double minLeadChargedPFCandPt_; + double maxLeadChargedPFCandEta_; + double maxLeadChargedPFCandDz_; + double maxChargedIso_; + double maxChargedRelIso_; + + double deltaRCleaning_; + double deltaR2Cleaning_; + + bool applyPreselection_; + + bool debug_; + const double isPFTauPt_ = 1.; +}; + +#endif diff --git a/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py new file mode 100644 index 0000000000000..d1c58ccb4131c --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.Phase2L1Taus.hpspfTauProducer_cfi import hpspfTauProducer as _hpspfTauProducer +HPSPFTauProducerPF = _hpspfTauProducer.clone( + srcL1PFCands = "l1pfCandidates:PF" +) diff --git a/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py new file mode 100644 index 0000000000000..a7ab48a6ce6a2 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.Phase2L1Taus.hpspfTauProducer_cfi import hpspfTauProducer as _hpspfTauProducer +HPSPFTauProducerPuppi = _hpspfTauProducer.clone( + srcL1PFCands = "l1pfCandidates:Puppi", + signalQualityCuts = dict( + chargedHadron = dict( + maxDz = 1.e+3 + ), + muon = dict( + maxDz = 1.e+3 + ), + electron = dict( + maxDz = 1.e+3 + ) + ), + isolationQualityCuts = dict( + chargedHadron = dict( + maxDz = 1.e+3 + ), + muon = dict( + maxDz = 1.e+3 + ), + electron = dict( + maxDz = 1.e+3 + ) + ) +) diff --git a/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py new file mode 100644 index 0000000000000..f79f1cf2e177e --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +l1emulator = cms.Sequence() + +from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff import * +from CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi import * + +from L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff import * +l1emulator += hgcalTriggerPrimitives + +from SimCalorimetry.EcalEBTrigPrimProducers.ecalEBTriggerPrimitiveDigis_cff import * +l1emulator += simEcalEBTriggerPrimitiveDigis + +from L1Trigger.TrackFindingTracklet.Tracklet_cfi import * +L1TRK_NAME = "TTTracksFromTrackletEmulation" +L1TRK_LABEL = "Level1TTTracks" + +from RecoVertex.BeamSpotProducer.BeamSpot_cfi import * +l1emulator += offlineBeamSpot + +l1emulator += TTTracksFromTrackletEmulation + +from SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff import * +TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( cms.InputTag(L1TRK_NAME, L1TRK_LABEL) ) +l1emulator += TrackTriggerAssociatorTracks + +from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import * +l1emulator += L1TkPrimaryVertex + +from Configuration.StandardSequences.SimL1Emulator_cff import * +l1emulator += SimL1Emulator + +from L1Trigger.Phase2L1ParticleFlow.pfTracksFromL1Tracks_cfi import * +l1emulator += pfTracksFromL1Tracks + +from L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff import * +l1emulator += l1ParticleFlow + +from L1Trigger.L1CaloTrigger.Phase1L1TJets_cff import * +l1emulator += Phase1L1TJetsSequence + + + + + + + diff --git a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc new file mode 100644 index 0000000000000..285ea3fecec33 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc @@ -0,0 +1,437 @@ +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h" +#include "FWCore/Utilities/interface/Exception.h" // cms::Exception +#include "DataFormats/Math/interface/deltaR.h" // reco::deltaR +#include // sd::regex_replace +#include // TMath::Pi() +#include // std::string +#include // std::max(), std::sort() +#include // std::fabs + +L1HPSPFTauBuilder::L1HPSPFTauBuilder(const edm::ParameterSet& cfg) + : signalConeSizeFormula_( + std::regex_replace(cfg.getParameter("signalConeSize"), std::regex("pt"), "x")), + minSignalConeSize_(cfg.getParameter("minSignalConeSize")), + maxSignalConeSize_(cfg.getParameter("maxSignalConeSize")), + useStrips_(cfg.getParameter("useStrips")), + stripSizeEta_(cfg.getParameter("stripSizeEta")), + stripSizePhi_(cfg.getParameter("stripSizePhi")), + isolationConeSize_(cfg.getParameter("isolationConeSize")), + debug_(cfg.getUntrackedParameter("debug", false)) { + assert(maxSignalConeSize_ >= minSignalConeSize_); + + isolationConeSize2_ = isolationConeSize_ * isolationConeSize_; + + if (debug_) { + std::cout << "setting Quality cuts for signal PFCands:" << std::endl; + } + edm::ParameterSet cfg_signalQualityCuts = cfg.getParameter("signalQualityCuts"); + signalQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "disabled", debug_); + signalQualityCutsDzCutEnabledPrimary_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "enabled_primary", debug_); + if (debug_) { + std::cout << "setting Quality cuts for isolation PFCands:" << std::endl; + } + edm::ParameterSet cfg_isolationQualityCuts = cfg.getParameter("isolationQualityCuts"); + isolationQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "disabled", debug_); + isolationQualityCutsDzCutEnabledPrimary_ = + readL1PFTauQualityCuts(cfg_isolationQualityCuts, "enabled_primary", debug_); + isolationQualityCutsDzCutEnabledPileup_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "enabled_pileup", debug_); +} + +void L1HPSPFTauBuilder::reset() { + signalConeSize_ = 0.; + signalConeSize2_ = 0.; + + l1PFCandProductID_ = edm::ProductID(); + isPFCandSeeded_ = false; + l1PFCandSeed_ = l1t::PFCandidateRef(); + isJetSeeded_ = false; + l1JetSeed_ = reco::CaloJetRef(); + l1PFTauSeedEta_ = 0.; + l1PFTauSeedPhi_ = 0.; + l1PFTauSeedZVtx_ = 0.; + sumAllL1PFCandidatesPt_ = 0.; + primaryVertex_ = l1t::TkPrimaryVertexRef(); + l1PFTau_ = l1t::HPSPFTau(); + + stripP4_ = reco::Particle::LorentzVector(0., 0., 0., 0.); + + signalAllL1PFCandidates_.clear(); + signalChargedHadrons_.clear(); + signalElectrons_.clear(); + signalNeutralHadrons_.clear(); + signalPhotons_.clear(); + signalMuons_.clear(); + + stripAllL1PFCandidates_.clear(); + stripElectrons_.clear(); + stripPhotons_.clear(); + + isoAllL1PFCandidates_.clear(); + isoChargedHadrons_.clear(); + isoElectrons_.clear(); + isoNeutralHadrons_.clear(); + isoPhotons_.clear(); + isoMuons_.clear(); + + sumAllL1PFCandidates_.clear(); + sumChargedHadrons_.clear(); + sumElectrons_.clear(); + sumNeutralHadrons_.clear(); + sumPhotons_.clear(); + sumMuons_.clear(); + + sumChargedIsoPileup_ = 0.; +} + +void L1HPSPFTauBuilder::setL1PFCandProductID(const edm::ProductID& l1PFCandProductID) { + l1PFCandProductID_ = l1PFCandProductID; +} + +void L1HPSPFTauBuilder::setVertex(const l1t::TkPrimaryVertexRef& primaryVertex) { primaryVertex_ = primaryVertex; } + +void L1HPSPFTauBuilder::setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed) { + if (debug_) { + std::cout << ":" << std::endl; + std::cout << "seeding HPSPFTau with ChargedPFCand:"; + printPFCand(std::cout, *l1PFCandSeed, primaryVertex_); + } + + l1PFCandSeed_ = l1PFCandSeed; + l1PFTauSeedEta_ = l1PFCandSeed->eta(); + l1PFTauSeedPhi_ = l1PFCandSeed->phi(); + if (l1PFCandSeed->charge() != 0 && l1PFCandSeed->pfTrack().isNonnull()) { + l1PFTauSeedZVtx_ = l1PFCandSeed->pfTrack()->vertex().z(); + isPFCandSeeded_ = true; + } +} +// This is commented as l1JetSeed->numberOfDaughters() = 0 +// Alternative way is used below for the moment +/* +void L1HPSPFTauBuilder::setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed) { + if (debug_) { + std::cout << ":" << std::endl; + std::cout << "seeding HPSPFTau with Jet:"; + std::cout << " pT = " << l1JetSeed->pt() << ", eta = " << l1JetSeed->eta() << ", phi = " << l1JetSeed->phi() + << std::endl; + } + + l1JetSeed_ = l1JetSeed; + reco::Candidate::LorentzVector l1PFTauSeed_p4; + float l1PFTauSeedZVtx = 0.; + bool l1PFTauSeed_hasVtx = false; + float max_chargedPFCand_pt = -1.; + size_t numConstituents = l1JetSeed->numberOfDaughters(); + for (size_t idxConstituent = 0; idxConstituent < numConstituents; ++idxConstituent) { + const l1t::PFCandidate* l1PFCand = dynamic_cast(l1JetSeed->daughter(idxConstituent)); + if (!l1PFCand) { + throw cms::Exception("L1HPSPFTauBuilder") << "Jet was not built from l1t::PFCandidates !!\n"; + } + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon || l1PFCand->id() == l1t::PFCandidate::Muon) { + l1PFTauSeed_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && l1PFCand->pfTrack().isNonnull() && l1PFCand->pt() > max_chargedPFCand_pt) { + l1PFTauSeedZVtx = l1PFCand->pfTrack()->vertex().z(); + l1PFTauSeed_hasVtx = true; + max_chargedPFCand_pt = l1PFCand->pt(); + } + } + } + if (l1PFTauSeed_p4.pt() > 1. && l1PFTauSeed_hasVtx) { + l1PFTauSeedEta_ = l1PFTauSeed_p4.eta(); + l1PFTauSeedPhi_ = l1PFTauSeed_p4.phi(); + l1PFTauSeedZVtx_ = l1PFTauSeedZVtx; + isJetSeeded_ = true; + } +} +*/ +void L1HPSPFTauBuilder::setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed, + const std::vector& l1PFCands) { + if (debug_) { + std::cout << ":" << std::endl; + std::cout << "seeding HPSPFTau with Jet:"; + std::cout << " pT = " << l1JetSeed->pt() << ", eta = " << l1JetSeed->eta() << ", phi = " << l1JetSeed->phi() + << std::endl; + } + + l1JetSeed_ = l1JetSeed; + reco::Candidate::LorentzVector l1PFTauSeed_p4; + float l1PFTauSeedZVtx = 0.; + bool l1PFTauSeed_hasVtx = false; + float max_chargedPFCand_pt = -1.; + for (const auto& l1PFCand : l1PFCands) { + double dR = reco::deltaR(l1PFCand->eta(), l1PFCand->phi(), l1JetSeed->eta(), l1JetSeed->phi()); + if (dR > 0.4) + continue; + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon || l1PFCand->id() == l1t::PFCandidate::Muon) { + l1PFTauSeed_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && l1PFCand->pfTrack().isNonnull() && l1PFCand->pt() > max_chargedPFCand_pt) { + l1PFTauSeedZVtx = l1PFCand->pfTrack()->vertex().z(); + l1PFTauSeed_hasVtx = true; + max_chargedPFCand_pt = l1PFCand->pt(); + } + } + } + if (l1PFTauSeed_p4.pt() > 1. && l1PFTauSeed_hasVtx) { + l1PFTauSeedEta_ = l1PFTauSeed_p4.eta(); + l1PFTauSeedPhi_ = l1PFTauSeed_p4.phi(); + l1PFTauSeedZVtx_ = l1PFTauSeedZVtx; + isJetSeeded_ = true; + } +} + +void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector& l1PFCands) { + if (debug_) { + std::cout << ":" << std::endl; + } + + // do not build tau candidates for which no reference z-position exists, + // as in this case charged PFCands originating from the primary (hard-scatter) interaction + // cannot be distinguished from charged PFCands originating from pileup + if (!(isPFCandSeeded_ || isJetSeeded_)) + return; + + for (const auto& l1PFCand : l1PFCands) { + if (!isWithinIsolationCone(*l1PFCand)) + continue; + sumAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + sumChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + sumElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + sumNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + sumPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + sumMuons_.push_back(l1PFCand); + } + } + + for (const auto& l1PFCand : sumAllL1PFCandidates_) { + sumAllL1PFCandidatesPt_ += l1PFCand->pt(); + } + std::vector emptyV; + std::vector sumAllL1PFCandidatesPt(1); + sumAllL1PFCandidatesPt[0] = sumAllL1PFCandidatesPt_; + + signalConeSize_ = signalConeSizeFormula_.evaluate(sumAllL1PFCandidatesPt, emptyV); + + if (signalConeSize_ < minSignalConeSize_) + signalConeSize_ = minSignalConeSize_; + if (signalConeSize_ > maxSignalConeSize_) + signalConeSize_ = maxSignalConeSize_; + signalConeSize2_ = signalConeSize_ * signalConeSize_; + + for (const auto& l1PFCand : sumAllL1PFCandidates_) { + if (debug_) { + printPFCand(std::cout, *l1PFCand, primaryVertex_); + } + + bool isSignalPFCand = false; + bool isStripPFCand = false; + bool isElectron_or_Photon = + l1PFCand->id() == l1t::PFCandidate::Electron || l1PFCand->id() == l1t::PFCandidate::Photon; + bool isChargedHadron = l1PFCand->id() == l1t::PFCandidate::ChargedHadron; + if (isWithinSignalCone(*l1PFCand) && !(isChargedHadron && signalChargedHadrons_.size() > 3)) { + isSignalPFCand = true; + } + if (isElectron_or_Photon && isWithinStrip(*l1PFCand)) { + if (useStrips_) { + isSignalPFCand = true; + } + isStripPFCand = true; + } + bool passesSignalQualityCuts = isSelected(signalQualityCutsDzCutEnabledPrimary_, *l1PFCand, l1PFTauSeedZVtx_); + if (isSignalPFCand && passesSignalQualityCuts) { + signalAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + signalChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + signalElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + signalNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + signalPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + signalMuons_.push_back(l1PFCand); + } + } + if (isStripPFCand && passesSignalQualityCuts) { + stripAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::Electron) { + stripElectrons_.push_back(l1PFCand); + stripP4_ += l1PFCand->p4(); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + stripPhotons_.push_back(l1PFCand); + stripP4_ += l1PFCand->p4(); + } else + assert(0); + } + + bool isIsolationPFCand = isWithinIsolationCone(*l1PFCand) && !isSignalPFCand; + bool passesIsolationQualityCuts = isSelected(isolationQualityCutsDzCutEnabledPrimary_, *l1PFCand, l1PFTauSeedZVtx_); + if (isIsolationPFCand && passesIsolationQualityCuts) { + isoAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + isoChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + isoElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + isoNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + isoPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + isoMuons_.push_back(l1PFCand); + } + } + + if (debug_) { + std::cout << "dR = " << reco::deltaR(l1PFCand->eta(), l1PFCand->phi(), l1PFTauSeedEta_, l1PFTauSeedPhi_) << ":" + << " isSignalPFCand = " << isSignalPFCand << ", isStripPFCand = " << isStripPFCand + << " (passesSignalQualityCuts = " << passesSignalQualityCuts << ")," + << " isIsolationPFCand = " << isIsolationPFCand + << " (passesIsolationQualityCuts = " << passesIsolationQualityCuts << ")" << std::endl; + } + } + + for (const auto& l1PFCand : l1PFCands) { + if (!isWithinIsolationCone(*l1PFCand)) + continue; + + if (l1PFCand->charge() != 0 && isSelected(isolationQualityCutsDzCutEnabledPileup_, *l1PFCand, l1PFTauSeedZVtx_)) { + sumChargedIsoPileup_ += l1PFCand->pt(); + } + } +} + +//void L1HPSPFTauBuilder::setRho(double rho) { rho_ = rho; } + +bool L1HPSPFTauBuilder::isWithinSignalCone(const l1t::PFCandidate& l1PFCand) { + if (isPFCandSeeded_ || isJetSeeded_) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < signalConeSize2_) + return true; + } + return false; +} + +bool L1HPSPFTauBuilder::isWithinStrip(const l1t::PFCandidate& l1PFCand) { + if (isPFCandSeeded_ || isJetSeeded_) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if (std::fabs(deltaEta) < stripSizeEta_ && std::fabs(deltaPhi) < stripSizePhi_) + return true; + } + return false; +} + +bool L1HPSPFTauBuilder::isWithinIsolationCone(const l1t::PFCandidate& l1PFCand) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < isolationConeSize2_) + return true; + else + return false; +} + +void L1HPSPFTauBuilder::buildL1PFTau() { + reco::Particle::LorentzVector l1PFTau_p4; + for (const auto& l1PFCand : signalAllL1PFCandidates_) { + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon) { + l1PFTau_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && + (l1PFTau_.leadChargedPFCand().isNull() || l1PFCand->pt() > l1PFTau_.leadChargedPFCand()->pt())) { + l1PFTau_.setLeadChargedPFCand(l1PFCand); + } + } + } + l1PFTau_.setP4(l1PFTau_p4); + + l1PFTau_.setSeedChargedPFCand(l1PFCandSeed_); + l1PFTau_.setSeedJet(l1JetSeed_); + + l1PFTau_.setSignalAllL1PFCandidates(convertToRefVector(signalAllL1PFCandidates_)); + l1PFTau_.setSignalChargedHadrons(convertToRefVector(signalChargedHadrons_)); + l1PFTau_.setSignalElectrons(convertToRefVector(signalElectrons_)); + l1PFTau_.setSignalNeutralHadrons(convertToRefVector(signalNeutralHadrons_)); + l1PFTau_.setSignalPhotons(convertToRefVector(signalPhotons_)); + l1PFTau_.setSignalMuons(convertToRefVector(signalMuons_)); + + l1PFTau_.setStripAllL1PFCandidates(convertToRefVector(stripAllL1PFCandidates_)); + l1PFTau_.setStripElectrons(convertToRefVector(stripElectrons_)); + l1PFTau_.setStripPhotons(convertToRefVector(stripPhotons_)); + + l1PFTau_.setIsoAllL1PFCandidates(convertToRefVector(isoAllL1PFCandidates_)); + l1PFTau_.setIsoChargedHadrons(convertToRefVector(isoChargedHadrons_)); + l1PFTau_.setIsoElectrons(convertToRefVector(isoElectrons_)); + l1PFTau_.setIsoNeutralHadrons(convertToRefVector(isoNeutralHadrons_)); + l1PFTau_.setIsoPhotons(convertToRefVector(isoPhotons_)); + l1PFTau_.setIsoMuons(convertToRefVector(isoMuons_)); + + l1PFTau_.setSumAllL1PFCandidates(convertToRefVector(sumAllL1PFCandidates_)); + l1PFTau_.setSumChargedHadrons(convertToRefVector(sumChargedHadrons_)); + l1PFTau_.setSumElectrons(convertToRefVector(sumElectrons_)); + l1PFTau_.setSumNeutralHadrons(convertToRefVector(sumNeutralHadrons_)); + l1PFTau_.setSumPhotons(convertToRefVector(sumPhotons_)); + l1PFTau_.setSumMuons(convertToRefVector(sumMuons_)); + + l1PFTau_.setPrimaryVertex(primaryVertex_); + + if (l1PFTau_.signalChargedHadrons().size() > 1) { + if (stripP4_.pt() < 5.) + l1PFTau_.setTauType(l1t::HPSPFTau::kThreeProng0Pi0); + else + l1PFTau_.setTauType(l1t::HPSPFTau::kThreeProng1Pi0); + } else { + if (stripP4_.pt() < 5.) + l1PFTau_.setTauType(l1t::HPSPFTau::kOneProng0Pi0); + else + l1PFTau_.setTauType(l1t::HPSPFTau::kOneProng1Pi0); + } + + l1PFTau_.setStripP4(stripP4_); + + l1PFTau_.setSumAllL1PFCandidatesPt(sumAllL1PFCandidatesPt_); + l1PFTau_.setSignalConeSize(signalConeSize_); + l1PFTau_.setisolationConeSize(isolationConeSize_); + + double sumChargedIso = 0.; + double sumNeutralIso = 0.; + for (const auto& l1PFCand : isoAllL1PFCandidates_) { + if (l1PFCand->charge() != 0) { + sumChargedIso += l1PFCand->pt(); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + sumNeutralIso += l1PFCand->pt(); + } + } + l1PFTau_.setSumChargedIso(sumChargedIso); + l1PFTau_.setSumNeutralIso(sumNeutralIso); + const double weightNeutralIso = 1.; + const double offsetNeutralIso = 0.; + l1PFTau_.setSumCombinedIso(sumChargedIso + weightNeutralIso * (sumNeutralIso - offsetNeutralIso)); + l1PFTau_.setSumChargedIsoPileup(sumChargedIsoPileup_); + + if (l1PFTau_.sumChargedIso() < 20.0) { + l1PFTau_.setPassVLooseIso(true); + } + if (l1PFTau_.sumChargedIso() < 10.0) { + l1PFTau_.setPassLooseIso(true); + } + if (l1PFTau_.sumChargedIso() < 5.0) { + l1PFTau_.setPassMediumIso(true); + } + if (l1PFTau_.sumChargedIso() < 2.5) { + l1PFTau_.setPassTightIso(true); + } +} + +l1t::PFCandidateRefVector L1HPSPFTauBuilder::convertToRefVector(const std::vector& l1PFCands) { + l1t::PFCandidateRefVector l1PFCandsRefVector(l1PFCandProductID_); + for (const auto& l1PFCand : l1PFCands) { + l1PFCandsRefVector.push_back(l1PFCand); + } + return l1PFCandsRefVector; +} diff --git a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc new file mode 100644 index 0000000000000..e2ba4cbf2cf99 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc @@ -0,0 +1,98 @@ +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" +#include "FWCore/Utilities/interface/Exception.h" // cms::Exception + +L1HPSPFTauQualityCut::L1HPSPFTauQualityCut(const edm::ParameterSet& cfg) + : debug_(cfg.getUntrackedParameter("debug", false)) { + std::string pfCandTypeString = cfg.getParameter("pfCandType"); + if (pfCandTypeString == "chargedHadron") + pfCandType_ = l1t::PFCandidate::ChargedHadron; + else if (pfCandTypeString == "electron") + pfCandType_ = l1t::PFCandidate::Electron; + else if (pfCandTypeString == "muon") + pfCandType_ = l1t::PFCandidate::Muon; + else if (pfCandTypeString == "neutralHadron") + pfCandType_ = l1t::PFCandidate::NeutralHadron; + else if (pfCandTypeString == "photon") + pfCandType_ = l1t::PFCandidate::Photon; + else + throw cms::Exception("L1HPSPFTauQualityCut") + << "Invalid Configuration parameter 'pfCandType' = '" << pfCandTypeString << "' !!\n"; + + std::string dzCutString = cfg.getParameter("dzCut"); + if (dzCutString == "disabled") + dzCut_ = kDisabled; + else if (dzCutString == "enabled_primary") + dzCut_ = kEnabledPrimary; + else if (dzCutString == "enabled_pileup") + dzCut_ = kEnabledPileup; + else + throw cms::Exception("L1HPSPFTauQualityCut") + << "Invalid Configuration parameter 'dzCut' = '" << dzCutString << "' !!\n"; + + minPt_ = cfg.getParameter("minPt"); + maxDz_ = (cfg.exists("maxDz")) ? cfg.getParameter("maxDz") : 1.e+3; +} + +bool L1HPSPFTauQualityCut::operator()(const l1t::PFCandidate& pfCand, float_t primaryVertex_z) const { + if (pfCand.id() == pfCandType_) { + if (pfCand.pt() < minPt_) { + return false; + } + + if (pfCand.charge() != 0) { + if (dzCut_ == kEnabledPrimary || dzCut_ == kEnabledPileup) { + const l1t::PFTrackRef& pfCand_track = pfCand.pfTrack(); + double dz = std::fabs(pfCand_track->vertex().z() - primaryVertex_z); + if (dzCut_ == kEnabledPrimary && dz > maxDz_) + return false; + if (dzCut_ == kEnabledPileup && dz <= maxDz_) + return false; + } + } else if (dzCut_ == kEnabledPileup) { + return false; // CV: only consider charged PFCands as originating from pileup + } + } + return true; +} + +l1t::PFCandidate::ParticleType L1HPSPFTauQualityCut::pfCandType() const { return pfCandType_; } + +int L1HPSPFTauQualityCut::dzCut() const { return dzCut_; } + +float_t L1HPSPFTauQualityCut::minPt() const { return minPt_; } + +float_t L1HPSPFTauQualityCut::maxDz() const { return maxDz_; } + +L1HPSPFTauQualityCut readL1PFTauQualityCut(const edm::ParameterSet& cfg, + const std::string& pfCandType, + const std::string& dzCut, + bool debug) { + edm::ParameterSet cfg_pfCandType = cfg.getParameter(pfCandType); + cfg_pfCandType.addParameter("pfCandType", pfCandType); + cfg_pfCandType.addParameter("dzCut", dzCut); + cfg_pfCandType.addUntrackedParameter("debug", debug); + L1HPSPFTauQualityCut qualityCut(cfg_pfCandType); + return qualityCut; +} + +std::vector readL1PFTauQualityCuts(const edm::ParameterSet& cfg, + const std::string& dzCut, + bool debug) { + std::vector qualityCuts; + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "chargedHadron", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "electron", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "muon", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "photon", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "neutralHadron", dzCut, debug)); + return qualityCuts; +} + +bool isSelected(const std::vector& qualityCuts, + const l1t::PFCandidate& pfCand, + float_t primaryVertex_z) { + for (auto qualityCut : qualityCuts) { + if (!qualityCut(pfCand, primaryVertex_z)) + return false; + } + return true; +} diff --git a/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py new file mode 100644 index 0000000000000..e1b28ad03d45d --- /dev/null +++ b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py @@ -0,0 +1,207 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras +from Configuration.ProcessModifiers.convertHGCalDigisSim_cff import convertHGCalDigisSim +from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 +process = cms.Process('Produce',Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_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( + '/store/mc/Phase2HLTTDRSummer20ReRECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/FEVT/PU200_111X_mcRun4_realistic_T15_v1-v1/120000/084C8B72-BC64-DE46-801F-D971D5A34F62.root' + ), + inputCommands = cms.untracked.vstring("keep *", + "drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFHit2016s_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016s_simEmtfDigis__HLT", + 'drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT', + 'drop l1tEMTFHit2016s_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT', + ), +) + +process.options = cms.untracked.PSet( + +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('step2 nevts:1'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +# Sequence, Path and EndPath definitions +process.productionSequence = cms.Sequence() + +process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') +process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') + +process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff') +process.productionSequence += process.hgcalTriggerPrimitives + +process.load('SimCalorimetry.EcalEBTrigPrimProducers.ecalEBTriggerPrimitiveDigis_cff') +process.productionSequence += process.simEcalEBTriggerPrimitiveDigis + +process.load("L1Trigger.TrackFindingTracklet.Tracklet_cfi") +L1TRK_PROC = process.TTTracksFromTrackletEmulation +L1TRK_NAME = "TTTracksFromTrackletEmulation" +L1TRK_LABEL = "Level1TTTracks" + +process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi") +process.productionSequence += process.offlineBeamSpot + +process.productionSequence += process.TTTracksFromTrackletEmulation + +process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff") +process.TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( cms.InputTag(L1TRK_NAME, L1TRK_LABEL) ) +process.productionSequence += process.TrackTriggerAssociatorTracks + +process.load("L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi") +process.productionSequence += process.L1TkPrimaryVertex + +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.productionSequence += process.SimL1Emulator + +process.load("L1Trigger.Phase2L1ParticleFlow.pfTracksFromL1Tracks_cfi") +process.productionSequence += process.pfTracksFromL1Tracks + +process.load("L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff") +process.productionSequence += process.l1ParticleFlow + +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_cff') +process.productionSequence += process.Phase1L1TJetsSequence + +############################################################ +# Generator-level (visible) hadronic taus +############################################################ + +process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") +process.tauGenJets.GenParticles = cms.InputTag("genParticles") +process.load("PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi") +process.genTaus = cms.Sequence(process.tauGenJets + process.tauGenJetsSelectorAllHadrons) +process.productionSequence += process.genTaus + +############################################################ +# produce L1 HPS PF Tau objects +############################################################ + +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPF_cfi import HPSPFTauProducerPF +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPuppi_cfi import HPSPFTauProducerPuppi +for useStrips in [ True, False ]: + for applyPreselection in [ True, False ]: + moduleNameBase = "HPSPFTauProducer" + if useStrips and applyPreselection: + moduleNameBase += "WithStripsAndPreselection" + elif useStrips and not applyPreselection: + moduleNameBase += "WithStripsWithoutPreselection" + elif not useStrips and applyPreselection: + moduleNameBase += "WithoutStripsWithPreselection" + elif not useStrips and not applyPreselection: + moduleNameBase += "WithoutStripsAndPreselection" + else: + raise ValueError("Invalid Combination of 'useStrips' and 'applyPreselection' Configuration parameters !!") + + moduleNamePF = moduleNameBase + "PF" + modulePF = HPSPFTauProducerPF.clone( + useStrips = cms.bool(useStrips), + applyPreselection = cms.bool(applyPreselection), + debug = cms.untracked.bool(False) + ) + setattr(process, moduleNamePF, modulePF) + process.productionSequence += getattr(process, moduleNamePF) + + moduleNamePuppi = moduleNameBase + "Puppi" + modulePuppi = HPSPFTauProducerPuppi.clone( + useStrips = cms.bool(useStrips), + applyPreselection = cms.bool(applyPreselection), + debug = cms.untracked.bool(False) + ) + setattr(process, moduleNamePuppi, modulePuppi) + process.productionSequence += getattr(process, moduleNamePuppi) + + +process.production_step = cms.Path(process.productionSequence) + +############################################################ +# write output file +############################################################ + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("NTuple_HPSPFTauProducer_part_1.root"), + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('production_step') + ), + outputCommands = cms.untracked.vstring( + 'drop *_*_*_*', + 'keep *_l1pfCandidates_PF_*', + 'keep *_l1pfCandidates_Puppi_*', + 'keep *_l1pfProducer*_z0_*', + 'keep *_pfTracksFromL1Tracks*_*_*', + 'keep *_pfClustersFrom*_*_*', + 'keep *_TTTracksFromTracklet_*_*', + 'keep *_VertexProducer_*_*', + 'keep *_L1TkPrimaryVertex_*_*', + 'keep *_slimmedTaus_*_*', + 'keep *_packedPFCandidates_*_*', + 'keep *_generator_*_*', + 'keep *_caloStage2Digis_*_*', + 'keep *_HPSPFTauProducer*PF_*_*', + 'keep *_HPSPFTauProducer*Puppi_*_*', + 'keep *_prunedGenParticles_*_*', + 'keep *_tauGenJetsSelectorAllHadrons_*_*', + 'keep *_particleFlow_*_*', + 'keep *_generalTracks_*_*', + 'keep *_electronGsfTracks_*_*', + 'keep *_offlineSlimmedPrimaryVertices_*_*', + 'keep *_L1PFTauProducer_*_*', + 'keep *_slimmedAddPileupInfo_*_*', + "keep *_Phase1L1TJetProducer_*_*", + ) +) +process.outpath = cms.EndPath(process.out) + +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.production_step, process.outpath, process.endjob_step) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(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 + +# Enable module run-time report +#process.options = cms.untracked.PSet( +# wantSummary = cms.untracked.bool(True) +#) + +dump_file = open('dump.py','w') +dump_file.write(process.dumpPython()) + +process.options.numberOfThreads = cms.untracked.uint32(2) diff --git a/PhysicsTools/MXNet/test/test_mxnet.py b/PhysicsTools/MXNet/test/test_mxnet.py index fd4c3ec59de04..16886f777a555 100755 --- a/PhysicsTools/MXNet/test/test_mxnet.py +++ b/PhysicsTools/MXNet/test/test_mxnet.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import mxnet as mx a = mx.nd.ones((2, 3)) b = a * 2 + 1 diff --git a/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc b/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc index a78b3cfc4bb59..9cd410cc78c74 100644 --- a/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc +++ b/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc @@ -64,6 +64,9 @@ class L1TriggerResultsConverter : public edm::stream::EDProducer<> { const edm::EDGetTokenT tokenLegacy_; const edm::EDGetTokenT token_; const edm::EDGetTokenT token_ext_; + edm::ESGetToken l1gtmenuToken_; + edm::ESGetToken l1gtalgoMaskToken_; + edm::ESGetToken l1utmTrigToken_; std::vector names_; std::vector mask_; std::vector indices_; @@ -83,7 +86,10 @@ L1TriggerResultsConverter::L1TriggerResultsConverter(const edm::ParameterSet& pa : edm::EDGetTokenT()), token_ext_(store_unprefireable_bit_ ? consumes(params.getParameter("src_ext")) - : edm::EDGetTokenT()) { + : edm::EDGetTokenT()), + l1gtmenuToken_(esConsumes()), + l1gtalgoMaskToken_(esConsumes()), + l1utmTrigToken_(esConsumes()) { produces(); } @@ -101,20 +107,14 @@ void L1TriggerResultsConverter::beginRun(edm::Run const&, edm::EventSetup const& names_.clear(); indices_.clear(); if (legacyL1_) { - edm::ESHandle handleMenu; - edm::ESHandle handleAlgoMask; - setup.get().get(handleMenu); - auto const& mapping = handleMenu->gtAlgorithmAliasMap(); + auto const& mapping = setup.getHandle(l1gtmenuToken_)->gtAlgorithmAliasMap(); for (auto const& keyval : mapping) { names_.push_back(keyval.first); indices_.push_back(keyval.second.algoBitNumber()); } - setup.get().get(handleAlgoMask); - mask_ = handleAlgoMask->gtTriggerMask(); + mask_ = setup.getHandle(l1gtalgoMaskToken_)->gtTriggerMask(); } else { - edm::ESHandle menu; - setup.get().get(menu); - auto const& mapping = menu->getAlgorithmMap(); + auto const& mapping = setup.getHandle(l1utmTrigToken_)->getAlgorithmMap(); for (auto const& keyval : mapping) { names_.push_back(keyval.first); indices_.push_back(keyval.second.getIndex()); diff --git a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc index ffc6ffa734dad..c40477c2cf74a 100644 --- a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc @@ -50,7 +50,7 @@ class LHCInfoProducer : public edm::global::EDProducer { public: - LHCInfoProducer(edm::ParameterSet const&) { + LHCInfoProducer(edm::ParameterSet const&) : lhcinfoToken_(esConsumes()) { produces(); } ~LHCInfoProducer() override {} @@ -59,13 +59,11 @@ class LHCInfoProducer : public edm::global::EDProducer lhcInfo; - iSetup.get().get(lhcInfo); - const LHCInfo* info = lhcInfo.product(); + const auto& info = iSetup.getData(lhcinfoToken_); auto out = std::make_unique(); - out->addFloat("crossingAngle", "LHC crossing angle", info->crossingAngle()); - out->addFloat("betaStar", "LHC beta star", info->betaStar()); - out->addFloat("energy", "LHC beam energy", info->energy()); + out->addFloat("crossingAngle", "LHC crossing angle", info.crossingAngle()); + out->addFloat("betaStar", "LHC beta star", info.betaStar()); + out->addFloat("energy", "LHC beam energy", info.energy()); iLumi.put(std::move(out)); } @@ -75,6 +73,7 @@ class LHCInfoProducer : public edm::global::EDProducer lhcinfoToken_; }; DEFINE_FWK_MODULE(LHCInfoProducer); diff --git a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py new file mode 100644 index 0000000000000..5ca520e9ad7e1 --- /dev/null +++ b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py @@ -0,0 +1,74 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * + +##################### Import reusable funtions and objects from std taus ######## +from PhysicsTools.NanoAOD.taus_cff import _tauId2WPMask,_tauId5WPMask,_tauId7WPMask,tausMCMatchLepTauForTable,tausMCMatchHadTauForTable,tauMCTable + +##################### User floats producers, selectors ########################## + + +finalBoostedTaus = cms.EDFilter("PATTauRefSelector", + src = cms.InputTag("slimmedTausBoostedNewID"), + cut = cms.string("pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017'))") +) + +boostedTauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", + src = cms.InputTag("finalBoostedTaus"), + cut = cms.string(""), #we should not filter on cross linked collections + name= cms.string("boostedTau"), + doc = cms.string("slimmedBoostedTaus after basic selection (" + finalBoostedTaus.cut.value()+")"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the taus + variables = cms.PSet() # PSet defined below in era dependent way +) +_boostedTauVarsBase = cms.PSet(P4Vars, + charge = Var("charge", int, doc="electric charge"), + jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), + decayMode = Var("decayMode()",int), + leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10), + leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8), + leadTkDeltaPhi = Var("deltaPhi(leadChargedHadrCand.phi, phi) ",float, doc="phi of the leading track, minus tau phi",precision=8), + + rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10), + rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10), + chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10), + neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10), + puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10), + photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10), + idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), + #MVA 2017 v2 variables + rawMVAoldDM2017v2=Var("tauID('byIsolationMVArun2017v2DBoldDMwLTraw2017')",float, doc="byIsolationMVArun2017v2DBoldDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBnewDMwLTraw2017')",float,doc='byIsolationMVArun2017v2DBnewDMwLT raw output discriminator (2017v2)',precision=10), + rawMVAoldDMdR032017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017')",float,doc='byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)'), + idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", doc="IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2=_tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017",doc="IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2)"), + idMVAoldDMdR032017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017",doc="IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2)"), + rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), + rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), + idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"), +) + +boostedTauTable.variables = _boostedTauVarsBase + + +boostedTausMCMatchLepTauForTable = tausMCMatchLepTauForTable.clone( + src = boostedTauTable.src +) + +#This requires genVisTaus in taus_cff.py +boostedTausMCMatchHadTauForTable = tausMCMatchHadTauForTable.clone( + src = boostedTauTable.src +) + +boostedTauMCTable = tauMCTable.clone( + src = boostedTauTable.src, + mcMap = cms.InputTag("boostedTausMCMatchLepTauForTable"), + mcMapVisTau = cms.InputTag("boostedTausMCMatchHadTauForTable"), + objName = boostedTauTable.name, +) + + +boostedTauSequence = cms.Sequence(finalBoostedTaus) +boostedTauTables = cms.Sequence(boostedTauTable) +boostedTauMC = cms.Sequence(boostedTausMCMatchLepTauForTable + boostedTausMCMatchHadTauForTable + boostedTauMCTable) + diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 83449e50d95a4..5a8b732701fef 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -362,15 +362,6 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): eInvMinusPInv = Var("(1-eSuperClusterOverP())/ecalEnergy()",float,doc="1/E_SC - 1/p_trk",precision=10), scEtOverPt = Var("(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc="(supercluster transverse energy)/pt-1",precision=8), - mvaFall17V1Iso = Var("userFloat('mvaFall17V1Iso')",float,doc="MVA Iso ID V1 score"), - mvaFall17V1Iso_WP80 = Var("userInt('mvaFall17V1Iso_WP80')",bool,doc="MVA Iso ID V1 WP80"), - mvaFall17V1Iso_WP90 = Var("userInt('mvaFall17V1Iso_WP90')",bool,doc="MVA Iso ID V1 WP90"), - mvaFall17V1Iso_WPL = Var("userInt('mvaFall17V1Iso_WPL')",bool,doc="MVA Iso ID V1 loose WP"), - mvaFall17V1noIso = Var("userFloat('mvaFall17V1noIso')",float,doc="MVA noIso ID V1 score"), - mvaFall17V1noIso_WP80 = Var("userInt('mvaFall17V1noIso_WP80')",bool,doc="MVA noIso ID V1 WP80"), - mvaFall17V1noIso_WP90 = Var("userInt('mvaFall17V1noIso_WP90')",bool,doc="MVA noIso ID V1 WP90"), - mvaFall17V1noIso_WPL = Var("userInt('mvaFall17V1noIso_WPL')",bool,doc="MVA noIso ID V1 loose WP"), - mvaFall17V2Iso = Var("userFloat('mvaFall17V2Iso')",float,doc="MVA Iso ID V2 score"), mvaFall17V2Iso_WP80 = Var("userInt('mvaFall17V2Iso_WP80')",bool,doc="MVA Iso ID V2 WP80"), mvaFall17V2Iso_WP90 = Var("userInt('mvaFall17V2Iso_WP90')",bool,doc="MVA Iso ID V2 WP90"), @@ -381,7 +372,6 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): mvaFall17V2noIso_WPL = Var("userInt('mvaFall17V2noIso_WPL')",bool,doc="MVA noIso ID V2 loose WP"), cutBased = Var("userInt('cutbasedID_Fall17_V2_veto')+userInt('cutbasedID_Fall17_V2_loose')+userInt('cutbasedID_Fall17_V2_medium')+userInt('cutbasedID_Fall17_V2_tight')",int,doc="cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), - cutBased_Fall17_V1 = Var("userInt('cutbasedID_Fall17_V1_veto')+userInt('cutbasedID_Fall17_V1_loose')+userInt('cutbasedID_Fall17_V1_medium')+userInt('cutbasedID_Fall17_V1_tight')",int,doc="cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForEle_docstring), vidNestedWPBitmapHEEP = Var("userInt('VIDNestedWPBitmapHEEP')",int,doc=_bitmapVIDForEleHEEP_docstring), cutBased_HEEP = Var("userInt('cutbasedID_HEEP')",bool,doc="cut-based HEEP ID"), @@ -421,6 +411,18 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): dEsigmaDown=Var("userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaDownNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8), ) +##Keeping the possibilty of using V1 working points in older eras +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1).toModify(electronTable.variables, + mvaFall17V1Iso = Var("userFloat('mvaFall17V1Iso')",float,doc="MVA Iso ID V1 score"), + mvaFall17V1Iso_WP80 = Var("userInt('mvaFall17V1Iso_WP80')",bool,doc="MVA Iso ID V1 WP80"), + mvaFall17V1Iso_WP90 = Var("userInt('mvaFall17V1Iso_WP90')",bool,doc="MVA Iso ID V1 WP90"), + mvaFall17V1Iso_WPL = Var("userInt('mvaFall17V1Iso_WPL')",bool,doc="MVA Iso ID V1 loose WP"), + mvaFall17V1noIso = Var("userFloat('mvaFall17V1noIso')",float,doc="MVA noIso ID V1 score"), + mvaFall17V1noIso_WP80 = Var("userInt('mvaFall17V1noIso_WP80')",bool,doc="MVA noIso ID V1 WP80"), + mvaFall17V1noIso_WP90 = Var("userInt('mvaFall17V1noIso_WP90')",bool,doc="MVA noIso ID V1 WP90"), + mvaFall17V1noIso_WPL = Var("userInt('mvaFall17V1noIso_WPL')",bool,doc="MVA noIso ID V1 loose WP"), + cutBased_Fall17_V1 = Var("userInt('cutbasedID_Fall17_V1_veto')+userInt('cutbasedID_Fall17_V1_loose')+userInt('cutbasedID_Fall17_V1_medium')+userInt('cutbasedID_Fall17_V1_tight')",int,doc="cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), +) #the94X miniAOD V2 had a bug in the scale and smearing for electrons in the E/p comb #therefore we redo it but but we need use a new name for the userFloat as we cant override existing userfloats # scale and smearing only when available#ONLY needed for this era diff --git a/PhysicsTools/NanoAOD/python/genparticles_cff.py b/PhysicsTools/NanoAOD/python/genparticles_cff.py index 086ca196288fb..552912c12b230 100644 --- a/PhysicsTools/NanoAOD/python/genparticles_cff.py +++ b/PhysicsTools/NanoAOD/python/genparticles_cff.py @@ -41,7 +41,7 @@ pt = Var("pt", float, precision=8), phi = Var("phi", float,precision=8), eta = Var("eta", float,precision=8), - mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?(abs(pdgId)==6 && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."), + mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?((abs(pdgId)==6 || abs(pdgId)>1000000) && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."), pdgId = Var("pdgId", int, doc="PDG id"), status = Var("status", int, doc="Particle status. 1=stable"), genPartIdxMother = Var("?numberOfMothers>0?motherRef(0).key():-1", int, doc="index of the mother particle"), diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index fd5e00b2695b5..bd24929463915 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -465,6 +465,7 @@ particleNet_HccvsQCD = Var("bDiscriminator('pfParticleNetDiscriminatorsJetTags:HccvsQCD')",float,doc="ParticleNet tagger H(->cc) vs QCD discriminator",precision=10), particleNet_H4qvsQCD = Var("bDiscriminator('pfParticleNetDiscriminatorsJetTags:H4qvsQCD')",float,doc="ParticleNet tagger H(->VV->qqqq) vs QCD discriminator",precision=10), particleNet_QCD = Var("bDiscriminator('pfParticleNetJetTags:probQCDbb')+bDiscriminator('pfParticleNetJetTags:probQCDcc')+bDiscriminator('pfParticleNetJetTags:probQCDb')+bDiscriminator('pfParticleNetJetTags:probQCDc')+bDiscriminator('pfParticleNetJetTags:probQCDothers')",float,doc="ParticleNet tagger QCD(bb,cc,b,c,others) sum",precision=10), + particleNet_mass = Var("bDiscriminator('pfParticleNetMassRegressionJetTags:mass')",float,doc="ParticleNet mass regression",precision=10), particleNetMD_Xbb = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXbb')",float,doc="Mass-decorrelated ParticleNet tagger raw X->bb score. For X->bb vs QCD tagging, use Xbb/(Xbb+QCD)",precision=10), particleNetMD_Xcc = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXcc')",float,doc="Mass-decorrelated ParticleNet tagger raw X->cc score. For X->cc vs QCD tagging, use Xcc/(Xcc+QCD)",precision=10), particleNetMD_Xqq = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXqq')",float,doc="Mass-decorrelated ParticleNet tagger raw X->qq (uds) score. For X->qq vs QCD tagging, use Xqq/(Xqq+QCD). For W vs QCD tagging, use (Xcc+Xqq)/(Xcc+Xqq+QCD)",precision=10), diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 8705561ba5ded..1772e9d76f736 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -3,6 +3,7 @@ from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * +from PhysicsTools.NanoAOD.nano_eras_cff import * ## Modify plots accordingly to era _vplots80X = nanoDQM.vplots.clone() @@ -17,10 +18,38 @@ _tauPlots80X.append(Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator')) _tauPlots80X.append(Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator')) _vplots80X.Tau.plots = _tauPlots80X -from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy run2_miniAOD_80XLegacy.toModify(nanoDQM, vplots = _vplots80X ) +_tauPlotsPreV9 = cms.VPSet() +for plot in nanoDQM.vplots.Tau.plots: + if plot.name.value()!="idDecayModeOldDMs": + _tauPlotsPreV9.append(plot) +_tauPlotsPreV9.extend([ + Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), + Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), + Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), + Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), + Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category (2018)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), + Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)') +]) +from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 +from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 +from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 +from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoDQM.vplots.Tau, plots = _tauPlotsPreV9) _METFixEE2017_DQMentry = nanoDQM.vplots.MET.clone() _METFixEE2017_plots = cms.VPSet() @@ -28,8 +57,6 @@ if plot.name.value().find("fiducial")>-1: continue _METFixEE2017_plots.append(plot) _METFixEE2017_DQMentry.plots = _METFixEE2017_plots -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(nanoDQM.vplots, METFixEE2017 = _METFixEE2017_DQMentry) @@ -43,6 +70,18 @@ _Electron_plots_2016.append(Plot1D('mvaSpring16HZZ_WPL', 'mvaSpring16HZZ_WPL', 2, -0.5, 1.5, 'MVA Spring16 HZZ ID loose WP')) _Electron_plots_2016.append(NoPlot('vidNestedWPBitmapSpring15')) +#putting back the fall17V1 plots for non v9 case +_Electron_plots_withFall17V1 = copy.deepcopy(nanoDQM.vplots.Electron.plots) +_Electron_plots_withFall17V1.append(Plot1D('cutBased_Fall17_V1', 'cutBased_Fall17_V1', 5, -0.5, 4.5, 'cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WPL', 'mvaFall17V1Iso_WPL', 2, -0.5, 1.5, 'MVA Iso ID V1 loose WP')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso', 'mvaFall17V1noIso', 20, -1, 1, 'MVA noIso ID V1 score')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP80', 'mvaFall17V1noIso_WP80', 2, -0.5, 1.5, 'MVA noIso ID V1 WP80')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP90', 'mvaFall17V1noIso_WP90', 2, -0.5, 1.5, 'MVA noIso ID V1 WP90')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WPL', 'mvaFall17V1noIso_WPL', 2, -0.5, 1.5, 'MVA noIso ID V1 loose WP')) + _Photon_plots_2016 = copy.deepcopy(nanoDQM.vplots.Photon.plots) _Photon_plots_2016.append(Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5, 'cut-based Spring16-V2p2 ID (0:fail, 1::loose, 2:medium, 3:tight)')) _Photon_plots_2016.append(Plot1D('cutBased17Bitmap', 'cutBased17Bitmap', 8, -0.5, 7.5, 'cut-based Fall17-94X-V1 ID bitmap, 2^(0:loose, 1:medium, 2:tight)')) @@ -57,12 +96,12 @@ _Flag_plots_80x.append(Plot1D('BadGlobalMuon', 'BadGlobalMuon', 2, -0.5, 1.5, 'Bad muon flag')) _Flag_plots_80x.append(Plot1D('CloneGlobalMuon', 'CloneGlobalMuon', 2, -0.5, 1.5, 'Clone muon flag')) -from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: modifier.toModify(nanoDQM.vplots.Electron, plots = _Electron_plots_2016) modifier.toModify(nanoDQM.vplots.Photon, plots = _Photon_plots_2016) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.FatJet, plots = _FatJet_plots_80x) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.Flag, plots = _Flag_plots_80x) +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1).toModify(nanoDQM.vplots.Electron, plots=_Electron_plots_withFall17V1) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots, IsoTrack = None) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 31584ec78caa1..4cf71b39336ed 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -56,7 +56,6 @@ Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'), Plot1D('convVeto', 'convVeto', 2, -0.5, 1.5, 'pass conversion veto'), Plot1D('cutBased', 'cutBased', 5, -0.5, 4.5, 'cut-based ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'), - Plot1D('cutBased_Fall17_V1', 'cutBased_Fall17_V1', 5, -0.5, 4.5, 'cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'), Plot1D('cutBased_HEEP', 'cutBased_HEEP', 2, -0.5, 1.5, 'cut-based HEEP ID'), Plot1D('deltaEtaSC', 'deltaEtaSC', 20, -0.2, 0.2, 'delta eta (SC,ele) with sign'), Plot1D('dr03EcalRecHitSumEt', 'dr03EcalRecHitSumEt', 20, 0, 30, 'Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV'), @@ -84,14 +83,6 @@ NoPlot('mass'), Plot1D('miniPFRelIso_all', 'miniPFRelIso_all', 20, 0, 1, 'mini PF relative isolation, total (with scaled rho*EA PU corrections)'), Plot1D('miniPFRelIso_chg', 'miniPFRelIso_chg', 20, 0, 1, 'mini PF relative isolation, charged component'), - Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score'), - Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80'), - Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90'), - Plot1D('mvaFall17V1Iso_WPL', 'mvaFall17V1Iso_WPL', 2, -0.5, 1.5, 'MVA Iso ID V1 loose WP'), - Plot1D('mvaFall17V1noIso', 'mvaFall17V1noIso', 20, -1, 1, 'MVA noIso ID V1 score'), - Plot1D('mvaFall17V1noIso_WP80', 'mvaFall17V1noIso_WP80', 2, -0.5, 1.5, 'MVA noIso ID V1 WP80'), - Plot1D('mvaFall17V1noIso_WP90', 'mvaFall17V1noIso_WP90', 2, -0.5, 1.5, 'MVA noIso ID V1 WP90'), - Plot1D('mvaFall17V1noIso_WPL', 'mvaFall17V1noIso_WPL', 2, -0.5, 1.5, 'MVA noIso ID V1 loose WP'), Plot1D('mvaFall17V2Iso', 'mvaFall17V2Iso', 20, -1, 1, 'MVA Iso ID V2 score'), Plot1D('mvaFall17V2Iso_WP80', 'mvaFall17V2Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V2 WP80'), Plot1D('mvaFall17V2Iso_WP90', 'mvaFall17V2Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V2 WP90'), @@ -180,6 +171,7 @@ Plot1D('particleNet_TvsQCD', 'particleNet_TvsQCD', 20, 0, 1, 'ParticleNet tagger top vs QCD discriminator'), Plot1D('particleNet_WvsQCD', 'particleNet_WvsQCD', 20, 0, 1, 'ParticleNet tagger W vs QCD discriminator'), Plot1D('particleNet_ZvsQCD', 'particleNet_ZvsQCD', 20, 0, 1, 'ParticleNet tagger Z vs QCD discriminator'), + Plot1D('particleNet_mass', 'particleNet_mass', 25, 0, 250, 'ParticleNet mass regression'), Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), Plot1D('pt', 'pt', 20, 0, 800, 'pt'), Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'), @@ -732,16 +724,10 @@ Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), Plot1D('idAntiEleDeadECal', 'idAntiEleDeadECal', 2, -0.5, 1.5, "tauID('againstElectronDeadECAL')"), Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), - Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), - Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), + Plot1D('idDecayModeOldDMs', 'idDecayModeOldDMs', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDeepTau2017v2p1VSe', 'idDeepTau2017v2p1VSe', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), Plot1D('idDeepTau2017v2p1VSjet', 'idDeepTau2017v2p1VSjet', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), Plot1D('idDeepTau2017v2p1VSmu', 'idDeepTau2017v2p1VSmu', 16, -0.5, 15.5, 'byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight'), - Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), @@ -752,20 +738,11 @@ Plot1D('photonsOutsideSignalCone', 'photonsOutsideSignalCone', 20, 0, 30, 'sum of photons outside signal cone'), Plot1D('pt', 'pt', 20, 0, 200, 'pt'), Plot1D('puCorr', 'puCorr', 20, 0, 90, 'pileup correction'), - Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), - Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), - Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), - Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category (2018)'), Plot1D('rawDeepTau2017v2p1VSe', 'rawDeepTau2017v2p1VSe', 20, 0, 1, 'byDeepTau2017v2p1VSe raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSjet', 'rawDeepTau2017v2p1VSjet', 20, 0, 1, 'byDeepTau2017v2p1VSjet raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSmu', 'rawDeepTau2017v2p1VSmu', 20, 0, 1, 'byDeepTau2017v2p1VSmu raw output discriminator (deepTau2017v2p1)'), Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), - Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), - Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), - Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), - Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), - Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)'), ) ), TkMET = cms.PSet( @@ -801,5 +778,39 @@ Plot1D('pt', 'pt', 40, 0, 400, 'pt'), ) ), + boostedTau = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 7, -0.5, 6.5, "slimmedBoostedTaus after basic selection (pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017')))"), + Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'), + Plot1D('chargedIso', 'chargedIso', 20, 0, 200, 'charged isolation'), + Plot1D('decayMode', 'decayMode', 12, -0.5, 11.5, 'decayMode()'), + Plot1D('eta', 'eta', 20, -3, 3, 'eta'), + Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), + NoPlot('genPartIdx'), + Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), + Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + NoPlot('jetIdx'), + Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), + Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), + Plot1D('leadTkPtOverTauPt', 'leadTkPtOverTauPt', 20, 0, 2, 'pt of the leading track divided by tau pt'), + Plot1D('mass', 'mass', 20, 0, 5, 'mass'), + Plot1D('neutralIso', 'neutralIso', 20, 0, 200, 'neutral (photon) isolation'), + Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), + Plot1D('photonsOutsideSignalCone', 'photonsOutsideSignalCone', 20, 0, 30, 'sum of photons outside signal cone'), + Plot1D('pt', 'pt', 20, 0, 200, 'pt'), + Plot1D('puCorr', 'puCorr', 20, 0, 90, 'pileup correction'), + Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), + Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 category (2018)'), + Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), + Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBnewDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)'), + ) + ), ) ) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index fdba88878d652..54d614355fa4d 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -5,6 +5,7 @@ from PhysicsTools.NanoAOD.jets_cff import * from PhysicsTools.NanoAOD.muons_cff import * from PhysicsTools.NanoAOD.taus_cff import * +from PhysicsTools.NanoAOD.boostedTaus_cff import * from PhysicsTools.NanoAOD.electrons_cff import * from PhysicsTools.NanoAOD.photons_cff import * from PhysicsTools.NanoAOD.globals_cff import * @@ -105,22 +106,28 @@ (run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(l1bits, storeUnprefireableBit=False) nanoSequenceCommon = cms.Sequence( - nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+ + nanoMetadata + jetSequence + muonSequence + tauSequence + boostedTauSequence + electronSequence+photonSequence+vertexSequence+ isoTrackSequence + jetLepSequence + # must be after all the leptons linkedObjects + - jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables + jetTables + muonTables + tauTables + boostedTauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables ) +#remove boosted tau from previous eras +(run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toReplaceWith(nanoSequenceCommon, nanoSequenceCommon.copyAndExclude([boostedTauSequence, boostedTauTables])) + nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTables + l1bits) nanoSequenceOnlyData = cms.Sequence(protonTables + lhcInfoTable) nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim) -nanoSequenceFS = cms.Sequence(genParticleSequence + genVertexTables + particleLevelSequence + nanoSequenceCommon + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genVertexTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable ) +nanoSequenceFS = cms.Sequence(genParticleSequence + genVertexTables + particleLevelSequence + nanoSequenceCommon + jetMC + muonMC + electronMC + photonMC + tauMC + boostedTauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genVertexTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable ) (run2_nanoAOD_92X | run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94X2016 | \ run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | \ run2_nanoAOD_102Xv1).toReplaceWith(nanoSequenceFS, nanoSequenceFS.copyAndExclude([genVertexTable, genVertexT0Table])) +#remove boosted tau from previous eras +(run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toReplaceWith(nanoSequenceFS, nanoSequenceFS.copyAndExclude([boostedTauMC])) + # GenVertex only stored in newer MiniAOD nanoSequenceMC = nanoSequenceFS.copy() nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim) @@ -141,6 +148,23 @@ def nanoAOD_addTauIds(process): process.rerunMvaIsolationSequence) return process +def nanoAOD_addBoostedTauIds(process): + updatedBoostedTauName = "slimmedTausBoostedNewID" + boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug=False, + originalTauName = "slimmedTausBoosted", + updatedTauName = updatedBoostedTauName, + postfix="Boosted", + toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018",]) + boostedTauIdEmbedder.runTauID() + process.boostedTauSequence.insert(process.boostedTauSequence.index(process.finalBoostedTaus), + process.rerunMvaIsolationSequenceBoosted) + + process.boostedTauSequence.insert(process.boostedTauSequence.index(process.finalBoostedTaus), + getattr(process, updatedBoostedTauName)) + + return process + + from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour): _btagDiscriminators=[] @@ -269,7 +293,7 @@ def nanoAOD_activateVID(process): modifier.toModify(process.egmPhotonIDs, physicsObjectSrc = "slimmedPhotonsTo106X") return process -def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, jecPayload): +def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload): _btagDiscriminators=[] if addDeepBTag: print("Updating process to run DeepCSV btag to AK8 jets") @@ -282,6 +306,9 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl print("Updating process to run ParticleNet before it's included in MiniAOD") from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll _btagDiscriminators += pfParticleNetJetTagsAll + if addParticleNetMass: + from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs + _btagDiscriminators += _pfParticleNetMassRegressionOutputs if addDeepDoubleX: print("Updating process to run DeepDoubleX on datasets before 104X") _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \ @@ -343,6 +370,7 @@ def nanoAOD_customizeCommon(process): nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False), nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False), nanoAOD_addParticleNet_switch = cms.untracked.bool(False), + nanoAOD_addParticleNetMass_switch = cms.untracked.bool(True), jecPayload = cms.untracked.string('AK8PFPuppi') ) # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets @@ -369,8 +397,10 @@ def nanoAOD_customizeCommon(process): addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch, addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch, addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch, + addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch, jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload) (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p)) + (~(run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)).toModify(process, lambda p : nanoAOD_addBoostedTauIds(p)) return process def nanoAOD_customizeData(process): diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 92cba74a9478c..bcbb2431faa13 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -55,6 +55,7 @@ def nanoGenCommonCustomize(process): setGenPtPrecision(process, CandVars.pt.precision) setGenEtaPrecision(process, CandVars.eta.precision) setGenPhiPrecision(process, CandVars.phi.precision) + setGenMassPrecision(process, CandVars.mass.precision) def customizeNanoGENFromMini(process): process.nanogenSequence.insert(0, process.genParticles2HepMCHiggsVtx) @@ -126,9 +127,11 @@ def pruneGenParticlesMini(process): return process def setGenFullPrecision(process): - setGenPtPrecision(process, 23) - setGenEtaPrecision(process, 23) - setGenPhiPrecision(process, 23) + process = setGenPtPrecision(process, 23) + process = setGenEtaPrecision(process, 23) + process = setGenPhiPrecision(process, 23) + process = setGenMassPrecision(process, 23) + return process def setGenPtPrecision(process, precision): process.genParticleTable.variables.pt.precision = precision @@ -147,6 +150,11 @@ def setGenPhiPrecision(process, precision): process.metMCTable.variables.phi.precision = precision return process +def setGenMassPrecision(process, precision): + process.genParticleTable.variables.mass.precision = precision + process.genJetTable.variables.mass.precision = precision + return process + def setLHEFullPrecision(process): process.lheInfoTable.precision = 23 return process diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 1f6fdb3e11a96..1b601a8d15e29 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -12,9 +12,13 @@ finalTaus = cms.EDFilter("PATTauRefSelector", src = cms.InputTag("slimmedTausUpdated"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || (tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum'))<2.5) || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") ) +for era in [run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: + era.toModify(finalTaus, + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") + ) for era in [run2_nanoAOD_94XMiniAODv1,]: era.toModify(finalTaus, cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") @@ -56,8 +60,7 @@ def _tauId8WPMask(pattern,doc): charge = Var("charge", int, doc="electric charge"), jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), decayMode = Var("decayMode()",int), - idDecayMode = Var("tauID('decayModeFinding')", bool), - idDecayModeNewDMs = Var("tauID('decayModeFindingNewDMs')", bool), + idDecayModeOldDMs = Var("tauID('decayModeFinding')", bool), leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10), leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8), @@ -106,14 +109,6 @@ def _tauId8WPMask(pattern,doc): idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") ) -_mvaAntiEVars = cms.PSet( - rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), - rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), - idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"), - rawAntiEle = Var("tauID('againstElectronMVA6Raw2015')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), - rawAntiEleCat = Var("tauID('againstElectronMVA6category2015')", int, doc="Anti-electron MVA discriminator V6 category (2015"), - idAntiEle = _tauId5WPMask("againstElectron%sMVA62015", doc= "Anti-electron MVA discriminator V6 (2015)"), -) _mvaAntiEVars2015 = cms.PSet( rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2015"), @@ -130,13 +125,12 @@ def _tauId8WPMask(pattern,doc): _variablesMiniV2 = cms.PSet( _tauVarsBase, - _mvaAntiEVars, - _mvaIsoVars2015Reduced, - _mvaIsoVars2017v1, - _mvaIsoVars2017v2, _deepTauVars2017v2p1 ) -_variablesMiniV1 = _variablesMiniV2.clone() +_variablesMiniV1 = cms.PSet( + _variablesMiniV2, + _mvaIsoVars2017v2 +) _variablesMiniV1.rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10) _variablesMiniV1.rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10) _variablesMiniV1.idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") @@ -149,6 +143,9 @@ def _tauId8WPMask(pattern,doc): tauTable.variables = _variablesMiniV2 +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(tauTable, + variables = cms.PSet(tauTable.variables, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) + ) for era in [run2_nanoAOD_94XMiniAODv1,]: era.toModify(tauTable, variables = _variablesMiniV1 @@ -167,6 +164,13 @@ def _tauId8WPMask(pattern,doc): idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2015)") ) +for era in [run2_miniAOD_80XLegacy, run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ + run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: + era.toModify(tauTable.variables, + idDecayMode = Var("tauID('decayModeFinding')", bool), + idDecayModeNewDMs = Var("tauID('decayModeFindingNewDMs')", bool), + idDecayModeOldDMs = None + ) run2_miniAOD_80XLegacy.toModify(tauTable.variables, idAntiEleDeadECal = None) for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ diff --git a/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py b/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py index 8e6d3e39e9329..7231fb8196915 100644 --- a/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py +++ b/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py @@ -252,9 +252,10 @@ # ----------------------------------- # setup ParticleNet AK8 from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsProbs, _pfParticleNetJetTagsMetaDiscrs, \ - _pfMassDecorrelatedParticleNetJetTagsProbs, _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs + _pfMassDecorrelatedParticleNetJetTagsProbs, _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs, \ + _pfParticleNetMassRegressionOutputs # update supportedBtagDiscr -for disc in _pfParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsProbs: +for disc in _pfParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsProbs + _pfParticleNetMassRegressionOutputs: supportedBtagDiscr[disc] = [["pfParticleNetTagInfos"]] # update supportedMetaDiscr for disc in _pfParticleNetJetTagsMetaDiscrs: diff --git a/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py b/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py index ac0a1227abee8..b0d9a21a4127e 100644 --- a/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py @@ -46,6 +46,7 @@ def applyDeepBtagging( process, postfix="" ) : from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll from RecoBTag.ONNXRuntime.pfHiggsInteractionNet_cff import _pfHiggsInteractionNetTagsProbs as pfHiggsInteractionNetTagsProbs from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll + from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs # update slimmed jets to include particle-based deep taggers (keep same name) # make clone for DeepTags-less slimmed AK8 jets, so output name is preserved @@ -57,7 +58,7 @@ def applyDeepBtagging( process, postfix="" ) : 'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc', 'pfMassIndependentDeepDoubleCvBV2JetTags:probHbb', 'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc', - ) + pfDeepBoostedJetTagsAll + pfParticleNetJetTagsAll + pfHiggsInteractionNetTagsProbs + ) + pfDeepBoostedJetTagsAll + pfParticleNetJetTagsAll + pfHiggsInteractionNetTagsProbs + _pfParticleNetMassRegressionOutputs ) updateJetCollection( process, diff --git a/PhysicsTools/PythonAnalysis/test/BuildFile.xml b/PhysicsTools/PythonAnalysis/test/BuildFile.xml index dbc3a8e952760..d4c584bffe3de 100644 --- a/PhysicsTools/PythonAnalysis/test/BuildFile.xml +++ b/PhysicsTools/PythonAnalysis/test/BuildFile.xml @@ -2,7 +2,6 @@ - @@ -117,8 +116,6 @@ - - @@ -154,5 +151,4 @@ - diff --git a/PhysicsTools/PythonAnalysis/test/testNumExpr.py b/PhysicsTools/PythonAnalysis/test/testNumExpr.py index 3db3cf569a343..f68854063d670 100755 --- a/PhysicsTools/PythonAnalysis/test/testNumExpr.py +++ b/PhysicsTools/PythonAnalysis/test/testNumExpr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #https://github.com/pydata/numexpr/wiki/Numexpr-Users-Guide from __future__ import print_function diff --git a/PhysicsTools/PythonAnalysis/test/testRootNumpy.py b/PhysicsTools/PythonAnalysis/test/testRootNumpy.py deleted file mode 100755 index 80f9e15f1f793..0000000000000 --- a/PhysicsTools/PythonAnalysis/test/testRootNumpy.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 -#taken from root_numpy examples -#https://rootpy.github.io/root_numpy/auto_examples/tmva/plot_regression.html -import matplotlib -matplotlib.use('Agg') - -import numpy as np -import matplotlib.pyplot as plt -from root_numpy.tmva import add_regression_events, evaluate_reader -from root_numpy import ROOT_VERSION -from ROOT import TMVA, TFile, TCut -from array import array - -plt.style.use('ggplot') -RNG = np.random.RandomState(1) - -# Create an example regression dataset -X = np.linspace(0, 6, 100)[:, np.newaxis] -y = np.sin(X).ravel() + \ - np.sin(6 * X).ravel() + \ - RNG.normal(0, 0.1, X.shape[0]) - -# Fit a regression model -output = TFile('tmva_output.root', 'recreate') -factory = TMVA.Factory('regressor', output, - 'AnalysisType=Regression:' - '!V:Silent:!DrawProgressBar') - -if ROOT_VERSION >= '6.07/04': - data = TMVA.DataLoader('.') -else: - data = factory -data.AddVariable('x', 'F') -data.AddTarget('y', 'F') - -add_regression_events(data, X, y) -add_regression_events(data, X, y, test=True) -# The following line is necessary if events have been added individually: -data.PrepareTrainingAndTestTree(TCut('1'), '') - - -if ROOT_VERSION >= '6.07/04': - BookMethod = factory.BookMethod -else: - BookMethod = TMVA.Factory.BookMethod -BookMethod(data, 'BDT', 'BDT1', - 'nCuts=20:NTrees=1:MaxDepth=4:BoostType=AdaBoostR2:' - 'SeparationType=RegressionVariance') -BookMethod(data, 'BDT', 'BDT2', - 'nCuts=20:NTrees=300:MaxDepth=4:BoostType=AdaBoostR2:' - 'SeparationType=RegressionVariance') -factory.TrainAllMethods() - -# Predict the regression target -reader = TMVA.Reader() -reader.AddVariable('x', array('f', [0.])) -reader.BookMVA('BDT1', 'weights/regressor_BDT1.weights.xml') -reader.BookMVA('BDT2', 'weights/regressor_BDT2.weights.xml') -y_1 = evaluate_reader(reader, 'BDT1', X) -y_2 = evaluate_reader(reader, 'BDT2', X) - -# Plot the results -plt.figure() -plt.scatter(X, y, c="k", label="training samples") -plt.plot(X, y_1, c="g", label="1 tree", linewidth=2) -plt.plot(X, y_2, c="r", label="300 trees", linewidth=2) -plt.xlabel("data") -plt.ylabel("target") -plt.title("Boosted Decision Tree Regression") -plt.legend() -plt.savefig('RootNumpy') diff --git a/PhysicsTools/PythonAnalysis/test/testTheano.sh b/PhysicsTools/PythonAnalysis/test/testTheano.sh index 287a516b26d01..dceabec41e878 100755 --- a/PhysicsTools/PythonAnalysis/test/testTheano.sh +++ b/PhysicsTools/PythonAnalysis/test/testTheano.sh @@ -8,7 +8,7 @@ echo ">>> Change default behaviour for Theano" export THEANO_FLAGS="device=cpu,force_device=True,base_compiledir=$TEST_TMPDIR" echo ">>> Theano configuration for testing:" -python -c 'import theano; print(theano.config)' || ERR=1 +python3 -c 'import theano; print(theano.config)' || ERR=1 echo ">>> Cleaning compile cache" theano-cache clear || ERR=1 diff --git a/PhysicsTools/PythonAnalysis/test/testhep_ml.py b/PhysicsTools/PythonAnalysis/test/testhep_ml.py index d8f3563e7647a..783ea18b0edb9 100755 --- a/PhysicsTools/PythonAnalysis/test/testhep_ml.py +++ b/PhysicsTools/PythonAnalysis/test/testhep_ml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ diff --git a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h index 498c5c43fe763..dceada3b0f199 100644 --- a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h +++ b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h @@ -13,9 +13,9 @@ #include "tensorflow/core/lib/core/threadpool.h" -#include "tbb/task_scheduler_init.h" #include "tbb/task_arena.h" #include "tbb/task_group.h" +#include "tbb/global_control.h" namespace tensorflow { @@ -27,7 +27,9 @@ namespace tensorflow { } explicit TBBThreadPool(int nThreads = -1) - : nThreads_(nThreads > 0 ? nThreads : tbb::task_scheduler_init::default_num_threads()), numScheduleCalled_(0) { + : nThreads_(nThreads > 0 ? nThreads + : tbb::global_control::active_value(tbb::global_control::max_allowed_parallelism)), + numScheduleCalled_(0) { // when nThreads is zero or smaller, use the default value determined by tbb } diff --git a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py index 6b6938cb98070..d60b42b44c057 100644 --- a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py @@ -26,12 +26,20 @@ "probQCDb", "probQCDc", "probQCDothers"], ) +pfParticleNetMassRegressionJetTags = boostedJetONNXJetTagsProducer.clone( + src = 'pfParticleNetTagInfos', + preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK8/MassRegression/V01/preprocess.json', + model_path = 'RecoBTag/Combined/data/ParticleNetAK8/MassRegression/V01/particle-net.onnx', + flav_names = ["mass"], +) + from CommonTools.PileupAlgos.Puppi_cff import puppi from PhysicsTools.PatAlgos.slimming.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, - pfParticleNetJetTags, pfMassDecorrelatedParticleNetJetTags, pfParticleNetDiscriminatorsJetTags) + pfParticleNetJetTags, pfMassDecorrelatedParticleNetJetTags, pfParticleNetMassRegressionJetTags, + pfParticleNetDiscriminatorsJetTags, pfMassDecorrelatedParticleNetDiscriminatorsJetTags) # declare all the discriminators # nominal: probs @@ -47,5 +55,8 @@ _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs = ['pfMassDecorrelatedParticleNetDiscriminatorsJetTags:' + disc.name.value() for disc in pfMassDecorrelatedParticleNetDiscriminatorsJetTags.discriminators] +_pfParticleNetMassRegressionOutputs = ['pfParticleNetMassRegressionJetTags:' + flav_name + for flav_name in pfParticleNetMassRegressionJetTags.flav_names] + _pfParticleNetJetTagsAll = _pfParticleNetJetTagsProbs + _pfParticleNetJetTagsMetaDiscrs + \ _pfMassDecorrelatedParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs diff --git a/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py b/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py index f2b28be2f6dcb..b5376280bd65c 100644 --- a/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py +++ b/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py @@ -1,51 +1,34 @@ import FWCore.ParameterSet.Config as cms +import RecoEcal.EgammaClusterProducers.IslandClusterProducer_cfi as _mod # Island BasicCluster producer -islandBasicClusters = cms.EDProducer("IslandClusterProducer", - barrelHits = cms.InputTag('ecalRecHit','EcalRecHitsEB'), - endcapHits = cms.InputTag('ecalRecHit','EcalRecHitsEE'), - barrelClusterCollection = cms.string('islandBarrelBasicClusters'), - IslandEndcapSeedThr = cms.double(0.18), - barrelShapeAssociation = cms.string('islandBarrelShapeAssoc'), - clustershapecollectionEE = cms.string('islandEndcapShape'), - clustershapecollectionEB = cms.string('islandBarrelShape'), - VerbosityLevel = cms.string('ERROR'), - endcapShapeAssociation = cms.string('islandEndcapShapeAssoc'), - endcapClusterCollection = cms.string('islandEndcapBasicClusters'), - IslandBarrelSeedThr = cms.double(0.5), - posCalcParameters = cms.PSet( T0_barl = cms.double(7.4), - T0_endc = cms.double(3.1), - T0_endcPresh = cms.double(1.2), - LogWeighted = cms.bool(True), - W0 = cms.double(4.2), - X0 = cms.double(0.89) - ), +islandBasicClusters = _mod.IslandClusterProducer.clone( + endcapShapeAssociation = 'islandEndcapShapeAssoc', + posCalcParameters = dict(), # recHit flags to be excluded from seeding - SeedRecHitFlagToBeExcludedEB = cms.vstring( + SeedRecHitFlagToBeExcludedEB = [ 'kFaultyHardware', 'kTowerRecovered', 'kDead' - ), - SeedRecHitFlagToBeExcludedEE = cms.vstring( + ], + SeedRecHitFlagToBeExcludedEE = [ 'kFaultyHardware', 'kNeighboursRecovered', 'kTowerRecovered', 'kDead', 'kWeird' - ), + ], # recHit flags to be excluded from clustering - RecHitFlagToBeExcludedEB = cms.vstring( + RecHitFlagToBeExcludedEB = [ 'kWeird', 'kDiWeird', 'kOutOfTime', 'kTowerRecovered' - ), - RecHitFlagToBeExcludedEE = cms.vstring( + ], + RecHitFlagToBeExcludedEE = [ 'kWeird', 'kDiWeird', 'kOutOfTime', 'kTowerRecovered' - ) + ] ) - - diff --git a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py index 0510628e02c25..cac511e28063d 100644 --- a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py +++ b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py @@ -1,76 +1,66 @@ import FWCore.ParameterSet.Config as cms +import RecoEcal.EgammaClusterProducers.particleFlowSuperClusterECALMustache_cfi as _mod -particleFlowSuperClusterECALBox = cms.EDProducer("PFECALSuperClusterProducer", +particleFlowSuperClusterECALBox = _mod.particleFlowSuperClusterECALMustache.clone( # verbosity - verbose = cms.untracked.bool(False), + verbose = False, # clustering type: "Box" or "Mustache" - ClusteringType = cms.string("Box"), + ClusteringType = "Box", # energy weighting: "Raw", "CalibratedNoPS", "CalibratedTotal" - EnergyWeight = cms.string("Raw"), + EnergyWeight = "Raw", # this overrides both dphi cuts below if true! - useDynamicDPhiWindow = cms.bool(False), + useDynamicDPhiWindow = False, # PFClusters collection - PFClusters = cms.InputTag("particleFlowClusterECAL"), - ESAssociation = cms.InputTag("particleFlowClusterECAL"), - BeamSpot = cms.InputTag("offlineBeamSpot"), + PFClusters = "particleFlowClusterECAL", + ESAssociation = "particleFlowClusterECAL", + BeamSpot = "offlineBeamSpot", - PFBasicClusterCollectionBarrel = cms.string("particleFlowBasicClusterECALBarrel"), - PFSuperClusterCollectionBarrel = cms.string("particleFlowSuperClusterECALBarrel"), - PFBasicClusterCollectionEndcap = cms.string("particleFlowBasicClusterECALEndcap"), - PFSuperClusterCollectionEndcap = cms.string("particleFlowSuperClusterECALEndcap"), - PFBasicClusterCollectionPreshower = cms.string("particleFlowBasicClusterECALPreshower"), - PFSuperClusterCollectionEndcapWithPreshower = cms.string("particleFlowSuperClusterECALEndcapWithPreshower"), + PFBasicClusterCollectionBarrel = "particleFlowBasicClusterECALBarrel", + PFSuperClusterCollectionBarrel = "particleFlowSuperClusterECALBarrel", + PFBasicClusterCollectionEndcap = "particleFlowBasicClusterECALEndcap", + PFSuperClusterCollectionEndcap = "particleFlowSuperClusterECALEndcap", + PFBasicClusterCollectionPreshower = "particleFlowBasicClusterECALPreshower", + PFSuperClusterCollectionEndcapWithPreshower = "particleFlowSuperClusterECALEndcapWithPreshower", # use preshower ? - use_preshower = cms.bool(True), + use_preshower = True, # are the seed thresholds Et or Energy? - seedThresholdIsET = cms.bool(True), + seedThresholdIsET = True, # regression setup - useRegression = cms.bool(False), # regressions are mustache only - regressionConfig = cms.PSet( - regressionKeyEB = cms.string('pfscecal_EBCorrection_offline_v2'), - uncertaintyKeyEB = cms.string('pfscecal_EBUncertainty_offline_v2'), - regressionKeyEE = cms.string('pfscecal_EECorrection_offline_v2'), - uncertaintyKeyEE = cms.string('pfscecal_EEUncertainty_offline_v2'), - vertexCollection = cms.InputTag("offlinePrimaryVertices"), - ecalRecHitsEB = cms.InputTag('ecalRecHit','EcalRecHitsEB'), - ecalRecHitsEE = cms.InputTag('ecalRecHit','EcalRecHitsEE'), - applySigmaIetaIphiBug = cms.bool(False) - ), + useRegression = False, # regressions are mustache only + regressionConfig = dict(), # threshold for final SuperCluster Et - thresh_SCEt = cms.double(4.0), + thresh_SCEt = 4.0, # threshold in ECAL - thresh_PFClusterSeedBarrel = cms.double(3.0), - thresh_PFClusterBarrel = cms.double(0.5), + thresh_PFClusterSeedBarrel = 3.0, + thresh_PFClusterBarrel = 0.5, - thresh_PFClusterSeedEndcap = cms.double(5.0), - thresh_PFClusterEndcap = cms.double(0.5), + thresh_PFClusterSeedEndcap = 5.0, + thresh_PFClusterEndcap = 0.5, # window width in ECAL - phiwidth_SuperClusterBarrel = cms.double(0.28), - etawidth_SuperClusterBarrel = cms.double(0.04), + phiwidth_SuperClusterBarrel = 0.28, + etawidth_SuperClusterBarrel = 0.04, - phiwidth_SuperClusterEndcap = cms.double(0.28), - etawidth_SuperClusterEndcap = cms.double(0.04), + phiwidth_SuperClusterEndcap = 0.28, + etawidth_SuperClusterEndcap = 0.04, # threshold in preshower - thresh_PFClusterES = cms.double(0.), + thresh_PFClusterES = 0., # turn on merging of the seed cluster to its nearest neighbors # that share a rechit - doSatelliteClusterMerge = cms.bool(False), - satelliteClusterSeedThreshold = cms.double(50.0), - satelliteMajorityFraction = cms.double(0.5), - dropUnseedable = cms.bool(False), - #thresh_PFClusterMustacheOutBarrel = cms.double(0.), - #thresh_PFClusterMustacheOutEndcap = cms.double(0.), + doSatelliteClusterMerge = False, + satelliteClusterSeedThreshold = 50.0, + satelliteMajorityFraction = 0.5, + dropUnseedable = False, # corrections - applyCrackCorrections = cms.bool(False) + applyCrackCorrections = False ) diff --git a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc index 64946dfcc2ffa..7624d7de8f52c 100644 --- a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc @@ -94,9 +94,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet& double phiwidthSuperClusterEndcap = iConfig.getParameter("phiwidth_SuperClusterEndcap"); double etawidthSuperClusterEndcap = iConfig.getParameter("etawidth_SuperClusterEndcap"); - //double threshPFClusterMustacheOutBarrel = iConfig.getParameter("thresh_PFClusterMustacheOutBarrel"); - //double threshPFClusterMustacheOutEndcap = iConfig.getParameter("thresh_PFClusterMustacheOutEndcap"); - double doSatelliteClusterMerge = iConfig.getParameter("doSatelliteClusterMerge"); double satelliteClusterSeedThreshold = iConfig.getParameter("satelliteClusterSeedThreshold"); double satelliteMajorityFraction = iConfig.getParameter("satelliteMajorityFraction"); @@ -124,8 +121,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet& superClusterAlgo_.setSatelliteThreshold(satelliteClusterSeedThreshold); superClusterAlgo_.setMajorityFraction(satelliteMajorityFraction); superClusterAlgo_.setDropUnseedable(dropUnseedable); - //superClusterAlgo_.setThreshPFClusterMustacheOutBarrel( threshPFClusterMustacheOutBarrel ); - //superClusterAlgo_.setThreshPFClusterMustacheOutEndcap( threshPFClusterMustacheOutEndcap ); //Load the ECAL energy calibration thePFEnergyCalibration_ = std::make_shared(); diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h index ac12a0e0efbd6..58160aa29d35a 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h @@ -35,7 +35,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" #include class CaloTopology; diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h index 1a33b998444bd..456039cb98e60 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h @@ -57,7 +57,7 @@ #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class DetId; class CaloTopology; diff --git a/RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h b/RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h similarity index 55% rename from RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h rename to RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h index d5b9d4cfad95a..4e9f41e583fea 100644 --- a/RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h +++ b/RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h @@ -1,5 +1,5 @@ -#ifndef RecoEgamma_EgammaTools_interface_EgammaLocalCovParamDefaults_h -#define RecoEgamma_EgammaTools_interface_EgammaLocalCovParamDefaults_h +#ifndef RecoEcal_EgammaCoreTools_interface_EgammaLocalCovParamDefaults_h +#define RecoEcal_EgammaCoreTools_interface_EgammaLocalCovParamDefaults_h struct EgammaLocalCovParamDefaults { static constexpr float kRelEnCut = 4.7; diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index ce0e65664d260..d85d7efd0bea0 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -25,7 +25,7 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h" #include "RecoEgamma/EgammaElectronAlgos/interface/ecalClusterEnergyUncertaintyElectronSpecific.h" #include "CommonTools/Egamma/interface/ConversionTools.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" #include #include diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index baec0e950e422..6272f867fde43 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -21,7 +21,7 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/EgAmbiguityTools.h" #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronUtilities.h" #include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" using namespace reco; diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc index 33c34ab4c7021..a15560c443e00 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc @@ -24,7 +24,7 @@ #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class EgammaHLTClusterShapeProducer : public edm::global::EDProducer<> { public: diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 7db97f369c5c5..72ee92135f557 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -47,7 +47,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class GEDPhotonProducer : public edm::stream::EDProducer<> { public: diff --git a/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py b/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py index 2ae67fe9d5ac6..0f033a38a50b5 100644 --- a/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py +++ b/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py @@ -27,6 +27,20 @@ import mvaEleID_Fall17_iso_V2_producer_config mvaConfigsForEleProducer.append( mvaEleID_Fall17_iso_V2_producer_config ) + +# HZZ4l Run2 (Ultra)Legacy +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer16UL_ID_ISO_cff \ + import mvaEleID_Summer16UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append(mvaEleID_Summer16UL_ID_ISO_producer_config) + +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer17UL_ID_ISO_cff \ + import mvaEleID_Summer17UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append(mvaEleID_Summer17UL_ID_ISO_producer_config) + +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff \ + import mvaEleID_Summer18UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append( mvaEleID_Summer18UL_ID_ISO_producer_config ) + electronMVAValueMapProducer = cms.EDProducer('ElectronMVAValueMapProducer', src = cms.InputTag('slimmedElectrons'), mvaConfigurations = mvaConfigsForEleProducer diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..51abb6e23b173 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer16ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_16UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer16UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer16UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.8949071018", # EB1_5 + cutCategory1 = "1.80714210202", # EB2_5 + cutCategory2 = "1.64751528517", # EE_5 + cutCategory3 = "0.339697782473", # EB1_10 + cutCategory4 = "0.252039219555", # EB2_10 + cutCategory5 = "-0.686263559006", # EE_10 + ) + + +mvaEleID_Summer16UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer16UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer16UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer16UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..0de6ea8170844 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer17ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_17UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer17UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer17UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.54440585808", # EB1_5 + cutCategory1 = "1.50294621563", # EB2_5 + cutCategory2 = "1.77306202112", # EE_5 + cutCategory3 = "0.157262554087", # EB1_10 + cutCategory4 = "0.0273932225081", # EB2_10 + cutCategory5 = "-0.623050463489", # EE_10 + ) + + +mvaEleID_Summer17UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer17UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer17UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer17UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..abc002ac45086 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer18ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_18UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer18UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer18UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.49603193295", # EB1_5 + cutCategory1 = "1.52414154008", # EB2_5 + cutCategory2 = "1.77694249574", # EE_5 + cutCategory3 = "0.199463934736", # EB1_10 + cutCategory4 = "0.076063564084", # EB2_10 + cutCategory5 = "-0.572118857519", # EE_10 + ) + + +mvaEleID_Summer18UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer18UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer18UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer18UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index 62ae794e85ecc..55d60d58037c1 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -1,35 +1,24 @@ import FWCore.ParameterSet.Config as cms +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabelsMerge + +trackstersIters = ['keep *_ticlTracksters'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] #AOD content TICL_AOD = cms.PSet( - # 13/04/2021 Felice: MultiClusters will be deprecated soon - outputCommands = cms.untracked.vstring( - 'keep *_ticlMultiClustersFromTrackstersEM_*_*', - 'keep *_ticlMultiClustersFromTrackstersHAD_*_*', - 'keep *_ticlMultiClustersFromTrackstersTrk_*_*', - 'keep *_ticlMultiClustersFromTrackstersTrkEM_*_*', - 'keep *_ticlMultiClustersFromTrackstersMIP_*_*', - 'keep *_ticlMultiClustersFromTrackstersMerge_*_*', - 'keep *_ticlMultiClustersFromSimTracksters_*_*', - ) + outputCommands = cms.untracked.vstring() ) #RECO content TICL_RECO = cms.PSet( outputCommands = cms.untracked.vstring( - 'keep *_ticlTrackstersTrkEM_*_*', - 'keep *_ticlTrackstersEM_*_*', - 'keep *_ticlTrackstersHAD_*_*', - 'keep *_ticlTrackstersTrk_*_*', - 'keep *_ticlTrackstersMIP_*_*', - 'keep *_ticlTrackstersMerge_*_*', - 'keep *_ticlTrackstersHFNoseTrkEM_*_*', - 'keep *_ticlTrackstersHFNoseEM_*_*', - 'keep *_ticlTrackstersHFNoseMIP_*_*', - 'keep *_ticlTrackstersHFNoseHAD_*_*', - 'keep *_ticlTrackstersHFNoseMerge_*_*', - 'keep *_pfTICL_*_*' + trackstersIters + + ['keep *_ticlTrackstersHFNoseTrkEM_*_*', + 'keep *_ticlTrackstersHFNoseEM_*_*', + 'keep *_ticlTrackstersHFNoseMIP_*_*', + 'keep *_ticlTrackstersHFNoseHAD_*_*', + 'keep *_ticlTrackstersHFNoseMerge_*_*',] + + ['keep *_pfTICL_*_*'] ) ) TICL_RECO.outputCommands.extend(TICL_AOD.outputCommands) @@ -41,4 +30,3 @@ ) ) TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands) - diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index 3b0a75ee1a283..fe65620d1da10 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -19,6 +19,9 @@ #include "DataFormats/Common/interface/ValueMap.h" #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" +#include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" @@ -72,11 +75,15 @@ class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { const edm::EDGetTokenT> filtered_layerclusters_mask_token_; edm::EDGetTokenT> simclusters_token_; + edm::EDGetTokenT> caloparticles_token_; edm::InputTag associatorLayerClusterSimCluster_; - edm::EDGetTokenT associatorMapSimToReco_token_; + edm::EDGetTokenT associatorMapSimClusterToReco_token_; + edm::InputTag associatorLayerClusterCaloParticle_; + edm::EDGetTokenT associatorMapCaloParticleToReco_token_; edm::ESGetToken geom_token_; hgcal::RecHitTools rhtools_; + const double fractionCut_; }; DEFINE_FWK_MODULE(TrackstersFromSimClustersProducer); @@ -88,10 +95,15 @@ TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm:: consumes>>(ps.getParameter("time_layerclusters"))), filtered_layerclusters_mask_token_(consumes>(ps.getParameter("filtered_mask"))), simclusters_token_(consumes>(ps.getParameter("simclusters"))), + caloparticles_token_(consumes>(ps.getParameter("caloparticles"))), associatorLayerClusterSimCluster_(ps.getUntrackedParameter("layerClusterSimClusterAssociator")), - associatorMapSimToReco_token_( + associatorMapSimClusterToReco_token_( consumes(associatorLayerClusterSimCluster_)), - geom_token_(esConsumes()) { + associatorLayerClusterCaloParticle_( + ps.getUntrackedParameter("layerClusterCaloParticleAssociator")), + associatorMapCaloParticleToReco_token_(consumes(associatorLayerClusterCaloParticle_)), + geom_token_(esConsumes()), + fractionCut_(ps.getParameter("fractionCut")) { produces>(); produces>(); } @@ -104,8 +116,13 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr desc.add("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster")); desc.add("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); desc.add("simclusters", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("caloparticles", edm::InputTag("mix", "MergedCaloTruth")); desc.addUntracked("layerClusterSimClusterAssociator", edm::InputTag("layerClusterSimClusterAssociationProducer")); + desc.addUntracked("layerClusterCaloParticleAssociator", + edm::InputTag("layerClusterCaloParticleAssociationProducer")); + desc.add("fractionCut", 0.); + descriptions.add("trackstersFromSimClustersProducer", desc); } @@ -118,34 +135,77 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even output_mask->resize(layerClusters.size(), 1.f); const auto& simclusters = evt.get(simclusters_token_); - const auto& simToRecoColl = evt.get(associatorMapSimToReco_token_); + const auto& caloparticles = evt.get(caloparticles_token_); + + const auto& simClustersToRecoColl = evt.get(associatorMapSimClusterToReco_token_); + const auto& caloParticlesToRecoColl = evt.get(associatorMapCaloParticleToReco_token_); const auto& geom = es.getData(geom_token_); rhtools_.setGeometry(geom); auto num_simclusters = simclusters.size(); result->reserve(num_simclusters); - for (const auto& [key, values] : simToRecoColl) { - auto const& sc = *(key); - auto simClusterIndex = &sc - &simclusters[0]; - Trackster tmpTrackster; - tmpTrackster.zeroProbabilities(); - tmpTrackster.vertices().reserve(values.size()); - tmpTrackster.vertex_multiplicity().reserve(values.size()); - - for (auto const& [lc, energyScorePair] : values) { - if (inputClusterMask[lc.index()] > 0) { - tmpTrackster.vertices().push_back(lc.index()); - double fraction = energyScorePair.first / lc->energy(); - (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(static_cast(std::clamp(1. / fraction, 0., 255.))); + + for (const auto& [key, values] : caloParticlesToRecoColl) { + auto const& cp = *(key); + auto cpIndex = &cp - &caloparticles[0]; + if (cp.g4Tracks()[0].crossedBoundary()) { + if (values.empty()) + continue; + Trackster tmpTrackster; + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(values.size()); + tmpTrackster.vertex_multiplicity().reserve(values.size()); + for (auto const& [lc, energyScorePair] : values) { + if (inputClusterMask[lc.index()] > 0) { + double fraction = energyScorePair.first / lc->energy(); + if (fraction < fractionCut_) + continue; + tmpTrackster.vertices().push_back(lc.index()); + (*output_mask)[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(1. / fraction); + } + } + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(cp.pdgId(), cp.charge()), 1.f); + + tmpTrackster.setSeed(key.id(), cpIndex); + result->emplace_back(tmpTrackster); + } else { + for (const auto& scRef : cp.simClusters()) { + const auto& it = simClustersToRecoColl.find(scRef); + if (it == simClustersToRecoColl.end()) + continue; + const auto& lcVec = it->val; + if (lcVec.empty()) + continue; + auto const& sc = *(scRef); + auto simClusterIndex = &sc - &simclusters[0]; + Trackster tmpTrackster; + + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(lcVec.size()); + tmpTrackster.vertex_multiplicity().reserve(lcVec.size()); + + for (auto const& [lc, energyScorePair] : lcVec) { + if (inputClusterMask[lc.index()] > 0) { + double fraction = energyScorePair.first / lc->energy(); + if (fraction < fractionCut_) + continue; + tmpTrackster.vertices().push_back(lc.index()); + (*output_mask)[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(1. / fraction); + } + } + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); + tmpTrackster.setSeed(scRef.id(), simClusterIndex); + result->emplace_back(tmpTrackster); } } - tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); - tmpTrackster.setSeed(key.id(), simClusterIndex); - result->emplace_back(tmpTrackster); } + 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/EMStep_cff.py b/RecoHGCal/TICL/python/EMStep_cff.py index be4ee499fddc8..ebf67e0f971ce 100644 --- a/RecoHGCal/TICL/python/EMStep_cff.py +++ b/RecoHGCal/TICL/python/EMStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingGlobal, ticlSeedingGlobalHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -38,16 +37,9 @@ algo_verbosity = 0, ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersEM = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersEM" -) - ticlEMStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersEM - ,ticlTrackstersEM - ,ticlMultiClustersFromTrackstersEM) + ,ticlTrackstersEM) filteredLayerClustersHFNoseEM = filteredLayerClustersEM.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/HADStep_cff.py b/RecoHGCal/TICL/python/HADStep_cff.py index 655fadae45f3a..9c9dc17259555 100644 --- a/RecoHGCal/TICL/python/HADStep_cff.py +++ b/RecoHGCal/TICL/python/HADStep_cff.py @@ -4,7 +4,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer as _ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -33,16 +32,9 @@ itername = "HAD" ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersHAD = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersHAD" - ) - ticlHADStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersHAD - ,ticlTrackstersHAD - ,ticlMultiClustersFromTrackstersHAD) + ,ticlTrackstersHAD) filteredLayerClustersHFNoseHAD = _filteredLayerClustersProducer.clone( min_cluster_size = 2, # inclusive diff --git a/RecoHGCal/TICL/python/MIPStep_cff.py b/RecoHGCal/TICL/python/MIPStep_cff.py index f7e5234b3aa9c..ccccf6b30b201 100644 --- a/RecoHGCal/TICL/python/MIPStep_cff.py +++ b/RecoHGCal/TICL/python/MIPStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingGlobal, ticlSeedingGlobalHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -29,16 +28,9 @@ max_delta_time = -1 ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersMIP = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersMIP" -) - ticlMIPStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersMIP - ,ticlTrackstersMIP - ,ticlMultiClustersFromTrackstersMIP) + ,ticlTrackstersMIP) filteredLayerClustersHFNoseMIP = filteredLayerClustersMIP.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index 8aa9d1a9fd8c7..7951277a710e2 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.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer @@ -20,12 +19,8 @@ from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(ticlSimTracksters, - simclusters = "mixData:MergedCaloTruth" + simclusters = "mixData:MergedCaloTruth", + caloparticles = "mixData:MergedCaloTruth", ) -ticlMultiClustersFromSimTracksters = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlSimTracksters" -) - -ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters, ticlMultiClustersFromSimTracksters) - +ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters) diff --git a/RecoHGCal/TICL/python/TrkEMStep_cff.py b/RecoHGCal/TICL/python/TrkEMStep_cff.py index 826e194f6f7ff..65d754f0101eb 100644 --- a/RecoHGCal/TICL/python/TrkEMStep_cff.py +++ b/RecoHGCal/TICL/python/TrkEMStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingTrk, ticlSeedingTrkHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -37,17 +36,9 @@ algo_verbosity = 0, ) - -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersTrkEM = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersTrkEM" -) - ticlTrkEMStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrkEM - ,ticlTrackstersTrkEM - ,ticlMultiClustersFromTrackstersTrkEM) + ,ticlTrackstersTrkEM) filteredLayerClustersHFNoseTrkEM = filteredLayerClustersTrkEM.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/TrkStep_cff.py b/RecoHGCal/TICL/python/TrkStep_cff.py index 2529264542862..b24737bb2adcc 100644 --- a/RecoHGCal/TICL/python/TrkStep_cff.py +++ b/RecoHGCal/TICL/python/TrkStep_cff.py @@ -4,7 +4,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer as _ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -35,15 +34,8 @@ itername = "Trk" ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersTrk = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersTrk" -) - ticlTrkStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrk - ,ticlTrackstersTrk - ,ticlMultiClustersFromTrackstersTrk) + ,ticlTrackstersTrk) diff --git a/RecoHGCal/TICL/python/iterativeTICL_cff.py b/RecoHGCal/TICL/python/iterativeTICL_cff.py index 7ea82224b5611..0fd86d3c70ff1 100644 --- a/RecoHGCal/TICL/python/iterativeTICL_cff.py +++ b/RecoHGCal/TICL/python/iterativeTICL_cff.py @@ -9,15 +9,11 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer as _pfTICLProducer from RecoHGCal.TICL.trackstersMergeProducer_cfi import trackstersMergeProducer as _trackstersMergeProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer ticlLayerTileTask = cms.Task(ticlLayerTileProducer) ticlTrackstersMerge = _trackstersMergeProducer.clone() -ticlMultiClustersFromTrackstersMerge = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersMerge" -) -ticlTracksterMergeTask = cms.Task(ticlTrackstersMerge, ticlMultiClustersFromTrackstersMerge) +ticlTracksterMergeTask = cms.Task(ticlTrackstersMerge) pfTICL = _pfTICLProducer.clone() diff --git a/RecoHGCal/TICL/python/ticl_iterations.py b/RecoHGCal/TICL/python/ticl_iterations.py index 6266c07807603..61b7cfbe8ecb4 100644 --- a/RecoHGCal/TICL/python/ticl_iterations.py +++ b/RecoHGCal/TICL/python/ticl_iterations.py @@ -14,7 +14,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer from RecoHGCal.TICL.ticlCandidateFromTrackstersProducer_cfi import ticlCandidateFromTrackstersProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer from Validation.HGCalValidation.ticlPFValidationDefault_cfi import ticlPFValidationDefault as ticlPFValidation @@ -22,7 +21,7 @@ ## withReco: requires full reco of the event to run this part ## i.e. collections of generalTracks can be accessed def TICL_iterations_withReco(process): - process.FEVTDEBUGHLTEventContent.outputCommands.extend(['keep *_multiClustersFromTracksters*_*_*', + process.FEVTDEBUGHLTEventContent.outputCommands.extend([ 'keep *_ticlCandidateFromTrackstersProducer*_*_*', 'keep *_pfTICLProducer*_*_*']) @@ -47,11 +46,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.9 ) - process.multiClustersFromTrackstersTrk = multiClustersFromTrackstersProducer.clone( - label = "TrkMultiClustersFromTracksterByCA", - Tracksters = "trackstersTrk" - ) - process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( algoId = 2 ) @@ -73,11 +67,6 @@ def TICL_iterations_withReco(process): out_in_dfs = False, ) - process.multiClustersFromTrackstersMIP = multiClustersFromTrackstersProducer.clone( - label = "MIPMultiClustersFromTracksterByCA", - Tracksters = "trackstersMIP" - ) - process.filteredLayerClusters = filteredLayerClustersProducer.clone( clusterFilter = "ClusterFilterByAlgoAndSize", min_cluster_size = 2, @@ -97,11 +86,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.9 # ~26 degrees ) - process.multiClustersFromTrackstersEM = multiClustersFromTrackstersProducer.clone( - Tracksters = "trackstersEM" - ) - - process.trackstersHAD = trackstersProducer.clone( filtered_mask = "filteredLayerClusters:algo8", seeding_regions = "ticlSeedingGlobal", @@ -111,10 +95,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.7 ) - process.multiClustersFromTrackstersHAD = multiClustersFromTrackstersProducer.clone( - Tracksters = "trackstersHAD" - ) - process.ticlCandidateFromTrackstersProducer = ticlCandidateFromTrackstersProducer.clone() process.pfTICLProducer = pfTICLProducer.clone() @@ -125,16 +105,12 @@ def TICL_iterations_withReco(process): process.ticlSeedingTrk, process.filteredLayerClustersTrk, process.trackstersTrk, - process.multiClustersFromTrackstersTrk, process.ticlSeedingGlobal, process.filteredLayerClustersMIP, process.trackstersMIP, - process.multiClustersFromTrackstersMIP, process.filteredLayerClusters, process.trackstersEM, - process.multiClustersFromTrackstersEM, process.trackstersHAD, - process.multiClustersFromTrackstersHAD, process.ticlCandidateFromTrackstersProducer, process.pfTICLProducer) @@ -154,8 +130,6 @@ def TICL_iterations_withReco(process): ## TICL_iterations: to be run with local HGCAL reco only ## i.e. collections of generalTracks (track-seeded iteration) NOT available def TICL_iterations(process): - process.FEVTDEBUGHLTEventContent.outputCommands.extend(['keep *_multiClustersFromTracksters*_*_*']) - process.ticlLayerTileProducer = ticlLayerTileProducer.clone() process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( @@ -177,11 +151,6 @@ def TICL_iterations(process): min_cos_theta = 0.99, # ~10 degrees ) - process.multiClustersFromTrackstersMIP = multiClustersFromTrackstersProducer.clone( - label = "MIPMultiClustersFromTracksterByCA", - Tracksters = "trackstersMIP" - ) - process.filteredLayerClusters = filteredLayerClustersProducer.clone( clusterFilter = "ClusterFilterByAlgoAndSize", min_cluster_size = 2, @@ -199,10 +168,6 @@ def TICL_iterations(process): min_cos_pointing = 0.7 ) - process.multiClustersFromTracksters = multiClustersFromTrackstersProducer.clone( - Tracksters = "tracksters" - ) - process.HGCalUncalibRecHit = HGCalUncalibRecHit process.HGCalRecHit = HGCalRecHit process.hgcalLayerClusters = hgcalLayerClusters @@ -214,10 +179,8 @@ def TICL_iterations(process): process.ticlLayerTileProducer, process.ticlSeedingGlobal, process.trackstersMIP, - process.multiClustersFromTrackstersMIP, process.filteredLayerClusters, process.tracksters, - process.multiClustersFromTracksters, process.hgcalMultiClusters) process.schedule = cms.Schedule(process.raw2digi_step,process.FEVTDEBUGHLToutput_step) process.schedule.associate(process.TICL_Task) diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py index 40718749c65db..25b8fed436ae2 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py @@ -19,23 +19,20 @@ # sequence CaloLocalReco # -def hbheCosmic(module): - return module.clone( - tsFromDB = False, - recoParamsFromDB = False, - algorithm = dict( - useMahi = False, - useM2 = False, - useM3 = False, - firstSampleShift = -1000, - samplesToAdd = 10, - correctForPhaseContainment = False, - ), - sipmQTSShift = -100, - sipmQNTStoSum = 200, - ) - -hbhereco = hbheCosmic(_hcalLocalReco_cff.hbheprereco) +hbhereco = _hcalLocalReco_cff.hbheprereco.cpu.clone( + tsFromDB = False, + recoParamsFromDB = False, + algorithm = dict( + useMahi = False, + useM2 = False, + useM3 = False, + firstSampleShift = -1000, + samplesToAdd = 10, + correctForPhaseContainment = False, + ), + sipmQTSShift = -100, + sipmQNTStoSum = 200, +) hfreco = _hcalLocalReco_cff._default_hfreco.clone( firstSample = 0, samplesToAdd = 10, ### min(10,size) in the algo diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py index ce74351bc8c33..bf6c8896b3823 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py @@ -12,14 +12,10 @@ #ECAL reconstruction from RecoLocalCalo.EcalRecProducers.ecalWeightUncalibRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalFixedAlphaBetaFitUncalibRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * -ecalLocalRecoTaskCosmics = cms.Task(ecalFixedAlphaBetaFitUncalibRecHit,ecalWeightUncalibRecHit,ecalDetIdToBeRecovered,ecalRecHit,ecalPreshowerRecHit) -ecalLocalRecoSequenceCosmics = cms.Sequence(ecalLocalRecoTaskCosmics) -ecalRecHit.EBuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEB' -ecalRecHit.EEuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEE' -ecalRecHit.ChannelStatusToBeExcluded = [ +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cff import * +ecalRecHit.cpu.EBuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEB' +ecalRecHit.cpu.EEuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEE' +ecalRecHit.cpu.ChannelStatusToBeExcluded = [ 'kDAC', 'kNoLaser', 'kNoisy', @@ -32,3 +28,14 @@ 'kDeadFE', 'kNoDataNoTP' ] +from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * +from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * + +ecalLocalRecoTaskCosmics = cms.Task( + ecalFixedAlphaBetaFitUncalibRecHit, + ecalWeightUncalibRecHit, + ecalDetIdToBeRecovered, + ecalCalibratedRecHitTask, + ecalPreshowerRecHit +) +ecalLocalRecoSequenceCosmics = cms.Sequence(ecalLocalRecoTaskCosmics) diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py index 75ae5fc0c202f..e49aae13d365b 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py @@ -1,12 +1,11 @@ import FWCore.ParameterSet.Config as cms -from Configuration.ProcessModifiers.gpu_cff import gpu # TPG condition needed by ecalRecHit producer if TT recovery is ON from RecoLocalCalo.EcalRecProducers.ecalRecHitTPGConditions_cff import * # ECAL reconstruction from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cff import * -from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import * +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cff import * from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * from RecoLocalCalo.EcalRecProducers.ecalCompactTrigPrim_cfi import * @@ -20,7 +19,7 @@ ecalUncalibRecHitSequence = cms.Sequence(ecalUncalibRecHitTask) ecalRecHitNoTPTask = cms.Task( - ecalRecHit, + ecalCalibratedRecHitTask, ecalPreshowerRecHit) ecalRecHitNoTPSequence = cms.Sequence(ecalRecHitNoTPTask) @@ -44,61 +43,6 @@ ecalOnlyLocalRecoSequence = cms.Sequence(ecalOnlyLocalRecoTask) -# ECAL rechit calibrations on GPU -from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi import ecalRecHitParametersGPUESProducer - -# ECAL rechits running on GPU -from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU -ecalRecHitGPU = _ecalRecHitGPU.clone( - uncalibrecHitsInLabelEB = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), - uncalibrecHitsInLabelEE = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE') -) - -# copy the rechits from GPU to CPU -from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer -ecalRecHitSoA = _ecalCPURecHitProducer.clone( - recHitsInLabelEB = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEB'), - recHitsInLabelEE = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEE') -) - -# convert the rechits from SoA to legacy format -from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitConvertGPU2CPUFormat -_ecalRecHit_gpu = _ecalRecHitConvertGPU2CPUFormat.clone( - recHitsLabelGPUEB = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEB'), - recHitsLabelGPUEE = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEE') -) -# TODO: the ECAL calibrated rechits produced on the GPU are not correct, yet. -# When they are working and validated, remove this comment and uncomment the next line: -#gpu.toReplaceWith(ecalRecHit, _ecalRecHit_gpu) - -# ECAL reconstruction on GPU -gpu.toReplaceWith(ecalRecHitNoTPTask, cms.Task( - # ECAL rechit calibrations on GPU - ecalRechitADCToGeVConstantGPUESProducer, - ecalRechitChannelStatusGPUESProducer, - ecalIntercalibConstantsGPUESProducer, - ecalLaserAPDPNRatiosGPUESProducer, - ecalLaserAPDPNRatiosRefGPUESProducer, - ecalLaserAlphasGPUESProducer, - ecalLinearCorrectionsGPUESProducer, - ecalRecHitParametersGPUESProducer, - # ECAL rechits running on GPU - ecalRecHitGPU, - # copy the rechits from GPU to CPU - ecalRecHitSoA, - # convert the rechits from SoA to legacy format - ecalRecHit, - # ECAL preshower rechit legacy module - ecalPreshowerRecHit -)) - # Phase 2 modifications from RecoLocalCalo.EcalRecProducers.ecalDetailedTimeRecHit_cfi import * _phase2_timing_ecalRecHitTask = cms.Task( ecalRecHitTask.copy() , ecalDetailedTimeRecHit ) diff --git a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py index fbb4c53f9f28b..c876f79eb5422 100644 --- a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py @@ -1,21 +1,30 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * +#--- for Run 1 and Run 2 +from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import hbhereco as _phase0_hbhereco +hbhereco = SwitchProducerCUDA( + cpu = _phase0_hbhereco.clone() +) hcalGlobalRecoTask = cms.Task(hbhereco) hcalGlobalRecoSequence = cms.Sequence(hcalGlobalRecoTask) +hcalOnlyGlobalRecoTask = cms.Task() +hcalOnlyGlobalRecoSequence = cms.Sequence(hcalOnlyGlobalRecoTask) + #--- for Run 3 and later from Configuration.Eras.Modifier_run3_HB_cff import run3_HB from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco as _phase1_hbheprereco -run3_HB.toReplaceWith(hbhereco, _phase1_hbheprereco) +run3_HB.toReplaceWith(hbhereco.cpu, _phase1_hbheprereco) +run3_HB.toReplaceWith(hcalOnlyGlobalRecoTask, cms.Task(hbhereco)) #--- for Run 3 on GPU from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer -gpu.toReplaceWith(hbhereco, _hcalCPURecHitsProducer.clone( - recHitsM0LabelIn = "hbheRecHitProducerGPU", - recHitsM0LabelOut = "", - recHitsLegacyLabelOut = "" -)) +from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hbherecoFromCUDA +(run3_HB & gpu).toModify(hbhereco, + cuda = _hbherecoFromCUDA.clone( + produceSoA = False + ) +) diff --git a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py index a7bdce3b916af..45b3e511c6874 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py @@ -1,15 +1,18 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoLocalCalo.HcalRecAlgos.hcalRecAlgoESProd_cfi import * from RecoLocalCalo.HcalRecAlgos.hcalChannelPropertiesESProd_cfi import * hcalOOTPileupESProducer = cms.ESProducer('OOTPileupDBCompatibilityESProducer') from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco as _phase1_hbheprereco -hbheprereco = _phase1_hbheprereco.clone( - processQIE11 = False, - tsFromDB = True, - pulseShapeParametersQIE8 = dict( - TrianglePeakTS = 4, +hbheprereco = SwitchProducerCUDA( + cpu = _phase1_hbheprereco.clone( + processQIE11 = False, + tsFromDB = True, + pulseShapeParametersQIE8 = dict( + TrianglePeakTS = 4, + ) ) ) @@ -31,10 +34,12 @@ _phase1_hcalLocalRecoTask.add(hfprereco) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 -run2_HF_2017.toReplaceWith( hcalLocalRecoTask, _phase1_hcalLocalRecoTask ) -run2_HF_2017.toReplaceWith( hfreco, _phase1_hfreco ) +run2_HF_2017.toReplaceWith(hcalLocalRecoTask, _phase1_hcalLocalRecoTask) +run2_HF_2017.toReplaceWith(hfreco, _phase1_hfreco) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toReplaceWith(hbheprereco, _phase1_hbheprereco) +run2_HCAL_2017.toModify(hbheprereco, + cpu = _phase1_hbheprereco.clone() +) _plan1_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() _plan1_hcalLocalRecoTask.add(hbheplan1) @@ -57,27 +62,20 @@ from Configuration.ProcessModifiers.gpu_cff import gpu from RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPUTask_cff import * -_run3_hcalLocalRecoGPUTask = _run3_hcalLocalRecoTask.copy() +_run3_hcalLocalRecoGPUTask = hcalLocalRecoTask.copy() _run3_hcalLocalRecoGPUTask.add(hbheRecHitProducerGPUTask) gpu.toReplaceWith(hcalLocalRecoTask, _run3_hcalLocalRecoGPUTask) -#--- HCAL-only workflow for Run 3 -# FIXME rename `hbheprereco` to `hbhereco` and use it from hcalGlobalRecoTask -hcalOnlyLocalRecoTask = cms.Task(hbheprereco, hfprereco, hfreco, horeco) - -#--- HCAL-only workflow for Run 3 on GPU -from Configuration.ProcessModifiers.gpu_cff import gpu - -_hcalOnlyLocalRecoGPUTask = hcalOnlyLocalRecoTask.copy() -_hcalOnlyLocalRecoGPUTask.add(hbheRecHitProducerGPUTask) -gpu.toReplaceWith(hcalOnlyLocalRecoTask, _hcalOnlyLocalRecoGPUTask) +#--- HCAL-only workflow +hcalOnlyLocalRecoTask = hcalLocalRecoTask.copyAndExclude([zdcreco]) -from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer -gpu.toReplaceWith(hbheprereco, _hcalCPURecHitsProducer.clone( - recHitsM0LabelIn = "hbheRecHitProducerGPU", - recHitsM0LabelOut = "", - recHitsLegacyLabelOut = "" -)) +#--- HCAL-only workflow for Run 2 on GPU +from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hbheprerecoFromCUDA +(gpu & ~run3_HB).toModify(hbheprereco, + cuda = _hbheprerecoFromCUDA.clone( + produceSoA = False + ) +) #--- for FastSim _fastSim_hcalLocalRecoTask = hcalLocalRecoTask.copyAndExclude([zdcreco]) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py b/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py index ba84f7779a0d9..137c97ac7765a 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py @@ -1,17 +1,16 @@ - import FWCore.ParameterSet.Config as cms def configureEcalLocal25ns(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [-5,-4,-3,-2,-1,0,1,2,3,4], - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [-5,-4,-3,-2,-1,0,1,2,3,4], + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process def configureEcalLocal50ns(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [-4,-2,0,2,4] - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [-4,-2,0,2,4] + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process def configureEcalLocalNoOOTPU(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [0] - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [0] + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py index 72a3efaae38ba..81c0a71986c78 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py @@ -1,10 +1,17 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # ECAL multifit running on CPU -from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit +from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit as _ecalMultiFitUncalibRecHit +ecalMultiFitUncalibRecHit = SwitchProducerCUDA( + cpu = _ecalMultiFitUncalibRecHit.clone() +) -ecalMultiFitUncalibRecHitTask = cms.Task(ecalMultiFitUncalibRecHit) +ecalMultiFitUncalibRecHitTask = cms.Task( + # ECAL multifit running on CPU + ecalMultiFitUncalibRecHit +) # ECAL conditions used by the multifit running on GPU from RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi import ecalPedestalsGPUESProducer @@ -32,11 +39,12 @@ # convert the uncalibrated rechits from SoA to legacy format from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat -_ecalMultiFitUncalibRecHit_gpu = _ecalUncalibRecHitConvertGPU2CPUFormat.clone( - recHitsLabelGPUEB = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEB'), - recHitsLabelGPUEE = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEE'), +gpu.toModify(ecalMultiFitUncalibRecHit, + cuda = _ecalUncalibRecHitConvertGPU2CPUFormat.clone( + recHitsLabelGPUEB = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEB'), + recHitsLabelGPUEE = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEE'), + ) ) -gpu.toReplaceWith(ecalMultiFitUncalibRecHit, _ecalMultiFitUncalibRecHit_gpu) gpu.toReplaceWith(ecalMultiFitUncalibRecHitTask, cms.Task( # ECAL conditions used by the multifit running on GPU @@ -48,10 +56,10 @@ ecalTimeBiasCorrectionsGPUESProducer, ecalTimeCalibConstantsGPUESProducer, ecalMultifitParametersGPUESProducer, - # ECAL multifit running on GP + # ECAL multifit running on GPU ecalMultiFitUncalibRecHitGPU, # copy the uncalibrated rechits from GPU to CPU ecalMultiFitUncalibRecHitSoA, - # convert the uncalibrated rechits legacy format + # ECAL multifit running on CPU, or convert the uncalibrated rechits from SoA to legacy format ecalMultiFitUncalibRecHit, )) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py deleted file mode 100644 index 84a0c6f9cbe8a..0000000000000 --- a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py +++ /dev/null @@ -1,83 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoLocalCalo.EcalRecProducers.ecalPulseShapeParameters_cff import * - -ecalMultiFitUncalibRecHitgpu = cms.EDProducer("EcalUncalibRecHitProducerGPUNew", - EBdigiCollection = cms.InputTag("ecalDigis","ebDigis"), - EEdigiCollection = cms.InputTag("ecalDigis","eeDigis"), - EBhitCollection = cms.string("EcalUncalibRecHitsEBgpunew"), - EBhitCollection_soa = cms.string("EcalUncalibRecHitsEBgpunew"), - EEhitCollection = cms.string('EcalUncalibRecHitsEEgpunew'), - EEhitCollection_soa = cms.string('EcalUncalibRecHitsEEgpunew'), - algo = cms.string("EcalUncalibRecHitWorkerMultiFitGPUNew"), - algoPSet = cms.PSet( - # for multifit method - EcalPulseShapeParameters = cms.PSet( ecal_pulse_shape_parameters ), - activeBXs = cms.vint32(-5,-4,-3,-2,-1,0,1,2,3,4), - ampErrorCalculation = cms.bool(True), - useLumiInfoRunHeader = cms.bool(True), - - doPrefitEB = cms.bool(False), - doPrefitEE = cms.bool(False), - prefitMaxChiSqEB = cms.double(25.), - prefitMaxChiSqEE = cms.double(10.), - - dynamicPedestalsEB = cms.bool(False), - dynamicPedestalsEE = cms.bool(False), - mitigateBadSamplesEB = cms.bool(False), - mitigateBadSamplesEE = cms.bool(False), - gainSwitchUseMaxSampleEB = cms.bool(True), - gainSwitchUseMaxSampleEE = cms.bool(False), - selectiveBadSampleCriteriaEB = cms.bool(False), - selectiveBadSampleCriteriaEE = cms.bool(False), - simplifiedNoiseModelForGainSwitch = cms.bool(True), - addPedestalUncertaintyEB = cms.double(0.), - addPedestalUncertaintyEE = cms.double(0.), - - # decide which algorithm to be use to calculate the jitter - timealgo = cms.string("RatioMethod"), - - # for ratio method - EBtimeFitParameters = cms.vdouble(-2.015452e+00, 3.130702e+00, -1.234730e+01, 4.188921e+01, -8.283944e+01, 9.101147e+01, -5.035761e+01, 1.105621e+01), - EEtimeFitParameters = cms.vdouble(-2.390548e+00, 3.553628e+00, -1.762341e+01, 6.767538e+01, -1.332130e+02, 1.407432e+02, -7.541106e+01, 1.620277e+01), - EBamplitudeFitParameters = cms.vdouble(1.138,1.652), - EEamplitudeFitParameters = cms.vdouble(1.890,1.400), - EBtimeFitLimits_Lower = cms.double(0.2), - EBtimeFitLimits_Upper = cms.double(1.4), - EEtimeFitLimits_Lower = cms.double(0.2), - EEtimeFitLimits_Upper = cms.double(1.4), - # for time error - EBtimeConstantTerm= cms.double(.6), - EEtimeConstantTerm= cms.double(1.0), - - # for kOutOfTime flag - EBtimeNconst = cms.double(28.5), - EEtimeNconst = cms.double(31.8), - outOfTimeThresholdGain12pEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain12mEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain61pEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain61mEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain12pEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain12mEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain61pEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain61mEE = cms.double(1000), # times estimated precision - amplitudeThresholdEB = cms.double(10), - amplitudeThresholdEE = cms.double(10), - - ebSpikeThreshold = cms.double(1.042), - - # these are now taken from DB. Here the MC parameters for backward compatibility - ebPulseShape = cms.vdouble( 5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194 ), - eePulseShape = cms.vdouble( 5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194 ), - - # for kPoorReco flag - kPoorRecoFlagEB = cms.bool(True), - kPoorRecoFlagEE = cms.bool(False), - chi2ThreshEB_ = cms.double(65.0), - chi2ThreshEE_ = cms.double(50.0), - - # threads/blocks config - threads = cms.vint32(256, 1, 1), - runV1 = cms.bool(True), - ) -) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py new file mode 100644 index 0000000000000..71247d33d6063 --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py @@ -0,0 +1,67 @@ +import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu + +# ECAL calibrated rechit reconstruction on CPU +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import ecalRecHit as _ecalRecHit +ecalRecHit = SwitchProducerCUDA( + cpu = _ecalRecHit.clone() +) + +ecalCalibratedRecHitTask = cms.Task( + ecalRecHit +) + +# ECAL rechit calibrations on GPU +from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi import ecalRecHitParametersGPUESProducer + +# ECAL rechits running on GPU +from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU +ecalRecHitGPU = _ecalRecHitGPU.clone( + uncalibrecHitsInLabelEB = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), + uncalibrecHitsInLabelEE = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE') +) + +# copy the rechits from GPU to CPU +from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer +ecalRecHitSoA = _ecalCPURecHitProducer.clone( + recHitsInLabelEB = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEB'), + recHitsInLabelEE = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEE') +) + +# TODO: the ECAL calibrated rechits produced on the GPU are not correct, yet. +# When they are working and validated, remove this comment and uncomment the next lines: +# convert the rechits from SoA to legacy format +#from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitFromSoA +#gpu.toModify(ecalRecHit, +# cuda = _ecalRecHitFromSoA.clone( +# recHitsLabelGPUEB = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEB'), +# recHitsLabelGPUEE = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEE') +# ) +#) + +# ECAL calibrated rechit reconstruction on GPU +gpu.toReplaceWith(ecalCalibratedRecHitTask, cms.Task( + # ECAL rechit calibrations on GPU + ecalRechitADCToGeVConstantGPUESProducer, + ecalRechitChannelStatusGPUESProducer, + ecalIntercalibConstantsGPUESProducer, + ecalLaserAPDPNRatiosGPUESProducer, + ecalLaserAPDPNRatiosRefGPUESProducer, + ecalLaserAlphasGPUESProducer, + ecalLinearCorrectionsGPUESProducer, + ecalRecHitParametersGPUESProducer, + # ECAL rechits running on GPU + ecalRecHitGPU, + # copy the rechits from GPU to CPU + ecalRecHitSoA, + # convert the rechits from SoA to legacy format + ecalRecHit +)) diff --git a/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py b/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py index e993a7573b689..262fdf259ac83 100644 --- a/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py +++ b/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py @@ -1,3 +1,4 @@ +import os, glob import FWCore.ParameterSet.Config as cms # input @@ -26,6 +27,7 @@ outputAdler32Recheck = cms.untracked.bool( False ), ) +prefix = '/data/store/data/Run2018D/EphemeralHLTPhysics/FED/v1/run323775/' source = cms.Source( "FedRawDataInputSource", runNumber = cms.untracked.uint32( 321177 ), getLSFromFilename = cms.untracked.bool(True), @@ -42,110 +44,6 @@ fileListMode = cms.untracked.bool( True ), # False fileNames = cms.untracked.vstring( - #'/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000004.raw', + ("file:{}".format(f) for f in glob.glob(os.path.join(prefix,'*raw'))) ), -) \ No newline at end of file +) diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py index c70572ff3b89d..192eb1fd2cb90 100644 --- a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py @@ -1,32 +1,20 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECO', eras.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('HeterogeneousCore.CUDAServices.CUDAService_cfi') -#process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') -#process.load('Configuration.StandardSequences.RawToDigi_Data_cff') -#process.load('Configuration.StandardSequences.Reconstruction_Data_cff') -#process.load('DQMOffline.Configuration.DQMOffline_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - - - - # Other statements from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '102X_dataRun2_HLT_v2', '') - +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) @@ -312,10 +300,6 @@ wantSummary = cms.untracked.bool(True) ) -# report CUDAService messages -process.MessageLogger.categories.append("CUDAService") - - # #process.DependencyGraph = cms.Service("DependencyGraph") diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py index ffb665d7bc96a..5684e30e330b8 100644 --- a/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECO', eras.Run2_2018) diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py b/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py index 455f3df9178f2..988a4b4a2b3cc 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py @@ -2,11 +2,11 @@ def customise_HBHE_Method1(process): if hasattr(process,'hbheprereco'): - process.hbheprereco.puCorrMethod = cms.int32(1) + process.hbheprereco.cpu.puCorrMethod = cms.int32(1) return process def customise_HBHE_Method0(process): if hasattr(process,'hbheprereco'): - process.hbheprereco.puCorrMethod = cms.int32(0) + process.hbheprereco.cpu.puCorrMethod = cms.int32(0) return process diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc index 714ec8b7de5af..742662eac2dd9 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc @@ -15,7 +15,8 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer { public: explicit HcalCPURecHitsProducer(edm::ParameterSet const& ps); - ~HcalCPURecHitsProducer() override; + ~HcalCPURecHitsProducer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions&); private: @@ -23,11 +24,15 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer void produce(edm::Event&, edm::EventSetup const&) override; private: + const bool produceSoA_; + const bool produceLegacy_; + using IProductType = cms::cuda::Product>; - edm::EDGetTokenT recHitsM0TokenIn_; + const edm::EDGetTokenT recHitsM0TokenIn_; + using OProductType = hcal::RecHitCollection>; - edm::EDPutTokenT recHitsM0TokenOut_; - edm::EDPutTokenT recHitsLegacyTokenOut_; + const edm::EDPutTokenT recHitsM0TokenOut_; + const edm::EDPutTokenT recHitsLegacyTokenOut_; // to pass from acquire to produce OProductType tmpRecHits_; @@ -36,19 +41,25 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer void HcalCPURecHitsProducer::fillDescriptions(edm::ConfigurationDescriptions& confDesc) { edm::ParameterSetDescription desc; - desc.add("recHitsM0LabelIn", edm::InputTag{"hbheRecHitProducerGPU", "recHitsM0HBHE"}); - desc.add("recHitsM0LabelOut", "recHitsM0HBHE"); - desc.add("recHitsLegacyLabelOut", "recHitsLegacyHBHE"); + desc.add("recHitsM0LabelIn", edm::InputTag{"hbheRecHitProducerGPU"}); + desc.add("recHitsM0LabelOut", ""); + desc.add("recHitsLegacyLabelOut", ""); + desc.add("produceSoA", true); + desc.add("produceLegacy", true); confDesc.addWithDefaultLabel(desc); } HcalCPURecHitsProducer::HcalCPURecHitsProducer(const edm::ParameterSet& ps) - : recHitsM0TokenIn_{consumes(ps.getParameter("recHitsM0LabelIn"))}, - recHitsM0TokenOut_{produces(ps.getParameter("recHitsM0LabelOut"))}, - recHitsLegacyTokenOut_{produces(ps.getParameter("recHitsLegacyLabelOut"))} {} - -HcalCPURecHitsProducer::~HcalCPURecHitsProducer() {} + : produceSoA_{ps.getParameter("produceSoA")}, + produceLegacy_{ps.getParameter("produceLegacy")}, + recHitsM0TokenIn_{consumes(ps.getParameter("recHitsM0LabelIn"))}, + recHitsM0TokenOut_{produceSoA_ ? produces(ps.getParameter("recHitsM0LabelOut")) + : edm::EDPutTokenT{}}, // empty token if disabled + recHitsLegacyTokenOut_{produceLegacy_ + ? produces(ps.getParameter("recHitsLegacyLabelOut")) + : edm::EDPutTokenT{}} // empty token if disabled +{} void HcalCPURecHitsProducer::acquire(edm::Event const& event, edm::EventSetup const& setup, @@ -81,26 +92,32 @@ void HcalCPURecHitsProducer::acquire(edm::Event const& event, } void HcalCPURecHitsProducer::produce(edm::Event& event, edm::EventSetup const& setup) { - // populate the legacy collection - auto recHitsLegacy = std::make_unique(); - // did not set size with ctor as there is no setter for did - recHitsLegacy->reserve(tmpRecHits_.did.size()); - for (uint32_t i = 0; i < tmpRecHits_.did.size(); i++) { - recHitsLegacy->emplace_back(HcalDetId{tmpRecHits_.did[i]}, - tmpRecHits_.energy[i], - 0 // timeRising - ); - - // update newly pushed guy - (*recHitsLegacy)[i].setChiSquared(tmpRecHits_.chi2[i]); - (*recHitsLegacy)[i].setRawEnergy(tmpRecHits_.energyM0[i]); + if (produceLegacy_) { + // populate the legacy collection + auto recHitsLegacy = std::make_unique(); + // did not set size with ctor as there is no setter for did + recHitsLegacy->reserve(tmpRecHits_.did.size()); + for (uint32_t i = 0; i < tmpRecHits_.did.size(); i++) { + recHitsLegacy->emplace_back(HcalDetId{tmpRecHits_.did[i]}, + tmpRecHits_.energy[i], + 0 // timeRising + ); + + // update newly pushed guy + (*recHitsLegacy)[i].setChiSquared(tmpRecHits_.chi2[i]); + (*recHitsLegacy)[i].setRawEnergy(tmpRecHits_.energyM0[i]); + } + + // put the legacy collection + event.put(recHitsLegacyTokenOut_, std::move(recHitsLegacy)); } - // put a legacy format - event.put(recHitsLegacyTokenOut_, std::move(recHitsLegacy)); - - // put a new format - event.emplace(recHitsM0TokenOut_, std::move(tmpRecHits_)); + if (produceSoA_) { + // put the SoA collection + event.emplace(recHitsM0TokenOut_, std::move(tmpRecHits_)); + } + // clear the temporary collection for the next event + tmpRecHits_.resize(0); } DEFINE_FWK_MODULE(HcalCPURecHitsProducer); diff --git a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py index 32d4104a842ef..0ce9caf13fa88 100644 --- a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py +++ b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECOgpu', eras.Run2_2018) @@ -60,32 +59,32 @@ #process.hbheprereco.algorithm.correctForPhaseContainment = cms.bool(False) ## do always 8 pulse -process.hbheprereco.algorithm.chiSqSwitch = cms.double(-1) +process.hbheprereco.cpu.algorithm.chiSqSwitch = cms.double(-1) ## to match hard coded setting (will be fixed on CPU) -process.hbheprereco.algorithm.nMaxItersMin = cms.int32(50) +process.hbheprereco.cpu.algorithm.nMaxItersMin = cms.int32(50) #----------------------------------------- # Final Custmization for Run3 #----------------------------------------- # we will not run arrival Time at HLT -process.hbheprereco.algorithm.calculateArrivalTime = cms.bool(False) +process.hbheprereco.cpu.algorithm.calculateArrivalTime = cms.bool(False) ## we do not need this -process.hbheprereco.algorithm.applyLegacyHBMCorrection = cms.bool(False) +process.hbheprereco.cpu.algorithm.applyLegacyHBMCorrection = cms.bool(False) # we only run Mahi at HLT -process.hbheprereco.algorithm.useM3 = cms.bool(False) +process.hbheprereco.cpu.algorithm.useM3 = cms.bool(False) # we will not have the HPD noise flags in Run3, as will be all siPM -process.hbheprereco.setLegacyFlagsQIE8 = cms.bool(False) -process.hbheprereco.setNegativeFlagsQIE8 = cms.bool(False) -process.hbheprereco.setNoiseFlagsQIE8 = cms.bool(False) -process.hbheprereco.setPulseShapeFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setLegacyFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setNegativeFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setNoiseFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setPulseShapeFlagsQIE8 = cms.bool(False) # for testing M0 only -##process.hbheprereco.algorithm.useMahi = cms.bool(False) +##process.hbheprereco.cpu.algorithm.useMahi = cms.bool(False) #----------------------------------------- # OUTPUT @@ -149,4 +148,4 @@ # report CUDAService messages process.MessageLogger.cerr.FwkReport.reportEvery = 100 -process.MessageLogger.categories.append("CUDAService") +process.MessageLogger.CUDAService = cms.untracked.PSet() diff --git a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py index 35a72f0edb08f..809c440effb53 100644 --- a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py +++ b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py @@ -1,9 +1,7 @@ import FWCore.ParameterSet.Config as cms -# # Tracker Local Reco -# Initialize magnetic field -# + from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import * from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import * @@ -13,9 +11,19 @@ from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SubCollectionProducers.clustersummaryproducer_cfi import * -pixeltrackerlocalrecoTask = cms.Task(siPixelClustersPreSplittingTask,siPixelRecHitsPreSplittingTask) -striptrackerlocalrecoTask = cms.Task(siStripZeroSuppression,siStripClusters,siStripMatchedRecHits) -trackerlocalrecoTask = cms.Task(pixeltrackerlocalrecoTask,striptrackerlocalrecoTask,clusterSummaryProducer) +pixeltrackerlocalrecoTask = cms.Task( + siPixelClustersPreSplittingTask, + siPixelRecHitsPreSplittingTask) + +striptrackerlocalrecoTask = cms.Task( + siStripZeroSuppression, + siStripClusters, + siStripMatchedRecHits) + +trackerlocalrecoTask = cms.Task( + pixeltrackerlocalrecoTask, + striptrackerlocalrecoTask, + clusterSummaryProducer) pixeltrackerlocalreco = cms.Sequence(pixeltrackerlocalrecoTask) striptrackerlocalreco = cms.Sequence(striptrackerlocalrecoTask) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py index b9c6862b015bf..f3675134fb84d 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py @@ -1,14 +1,22 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SiPixelGainCalibrationServiceParameters from CondTools.SiPixel.SiPixelGainCalibrationService_cfi import * + +# legacy pixel cluster producer from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi import siPixelClusters as _siPixelClusters -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA siPixelClustersPreSplitting = SwitchProducerCUDA( cpu = _siPixelClusters.clone() ) from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA gpu.toModify(siPixelClustersPreSplitting, + # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU + cpu = dict( + payloadType = 'HLT' + ), cuda = cms.EDAlias( siPixelDigisClustersPreSplitting = cms.VPSet( cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector")) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py index 8bbf47e9ebf90..50e47edbcce26 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py @@ -1,26 +1,40 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run3_common_cff import run3_common +from Configuration.ProcessModifiers.gpu_cff import gpu +# conditions used *only* by the modules running on GPU +from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import siPixelROCsStatusAndMappingWrapperESProducer +from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import siPixelGainCalibrationForHLTGPU + +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import siPixelClustersPreSplitting -from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA -from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA -from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import * -from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import * -siPixelClustersPreSplittingTask = cms.Task(siPixelClustersPreSplitting) +siPixelClustersPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplitting +) +# reconstruct the pixel digis and clusters on the gpu +from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA siPixelClustersPreSplittingCUDA = _siPixelRawToClusterCUDA.clone() -from Configuration.Eras.Modifier_run3_common_cff import run3_common + run3_common.toModify(siPixelClustersPreSplittingCUDA, - isRun2=False + # use the pixel channel calibrations scheme for Run 3 + isRun2 = False ) +# convert the pixel digis (except errors) and clusters to the legacy format +from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA siPixelDigisClustersPreSplitting = _siPixelDigisClustersFromSoA.clone() -siPixelClustersPreSplittingTaskCUDA = cms.Task( + +gpu.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task( + # conditions used *only* by the modules running on GPU + siPixelROCsStatusAndMappingWrapperESProducer, + siPixelGainCalibrationForHLTGPU, + # reconstruct the pixel digis and clusters on the gpu siPixelClustersPreSplittingCUDA, + # convert the pixel digis (except errors) and clusters to the legacy format siPixelDigisClustersPreSplitting, -) - -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelClustersPreSplittingTask_gpu = siPixelClustersPreSplittingTask.copy() -_siPixelClustersPreSplittingTask_gpu.add(siPixelClustersPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelClustersPreSplittingTask, _siPixelClustersPreSplittingTask_gpu) + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplittingTask.copy() +)) diff --git a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py index eb9dbad4934cd..8430b19f1e9be 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py +++ b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py @@ -1,44 +1,46 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu +# legacy pixel rechit producer siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src = cms.InputTag("siPixelClusters"), CPE = cms.string('PixelCPEGeneric'), VerboseLevel = cms.untracked.int32(0) ) -_siPixelRecHitsPreSplitting = siPixelRecHits.clone( - src = 'siPixelClustersPreSplitting' -) - -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SwitchProducer wrapping the legacy pixel rechit producer siPixelRecHitsPreSplitting = SwitchProducerCUDA( - cpu = _siPixelRecHitsPreSplitting.clone() + cpu = siPixelRecHits.clone( + src = 'siPixelClustersPreSplitting' + ) ) +# convert the pixel rechits from legacy to SoA format +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as siPixelRecHitsPreSplittingSoA - -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA - -gpu.toModify(siPixelRecHitsPreSplitting, - cuda = _siPixelRecHitFromCUDA.clone() +siPixelRecHitsPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel rechit producer + siPixelRecHitsPreSplitting, + # convert the pixel rechits from legacy to SoA format + siPixelRecHitsPreSplittingSoA ) - -siPixelRecHitsPreSplittingTask = cms.Task(siPixelRecHitsPreSplitting) - +# reconstruct the pixel rechits on the gpu +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone( beamSpot = "offlineBeamSpotToCUDA" ) -siPixelRecHitsPreSplittingLegacy = _siPixelRecHitFromCUDA.clone() -siPixelRecHitsPreSplittingTaskCUDA = cms.Task( - siPixelRecHitsPreSplittingCUDA, - siPixelRecHitsPreSplittingLegacy, +# transfer the pixel rechits to the host and convert them from SoA +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA +gpu.toModify(siPixelRecHitsPreSplitting, + cuda = _siPixelRecHitFromCUDA.clone() ) -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelRecHitsPreSplittingTask_gpu = siPixelRecHitsPreSplittingTask.copy() -_siPixelRecHitsPreSplittingTask_gpu.add(siPixelRecHitsPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, _siPixelRecHitsPreSplittingTask_gpu) +gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task( + # reconstruct the pixel rechits on the gpu + siPixelRecHitsPreSplittingCUDA, + # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA + siPixelRecHitsPreSplittingTask.copy() +)) diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc index cf8cd2d82c0c9..fbeaa323d6331 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/DetSetVector.h" @@ -31,19 +31,21 @@ class SiStripClusterToDigiProducer : public edm::stream::EDProducer<> { private: void process(const ClusterCollection& input, std::vector& output_base); - void initialize(const edm::EventSetup& es); void setDetId(const uint32_t id); - float gain(const uint16_t& strip) const { return gainHandle->getStripGain(strip, gainRange); } + float gain(const uint16_t& strip) const { return gain_->getStripGain(strip, gainRange); } uint16_t applyGain(const uint16_t& strip, const uint16_t& adc); edm::EDGetTokenT token; SiStripApvGain::Range gainRange; - edm::ESHandle gainHandle; - uint32_t gain_cache_id, detId; + edm::ESGetToken gainToken_; + edm::ESWatcher gainWatcher_; + const SiStripGain* gain_; + uint32_t detId; }; SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(const edm::ParameterSet& conf) { token = consumes(conf.getParameter("ClusterProducer")); + gainToken_ = esConsumes(); produces("ZeroSuppressed"); produces("VirginRaw"); @@ -52,7 +54,9 @@ SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(const edm::ParameterS } void SiStripClusterToDigiProducer::produce(edm::Event& event, const edm::EventSetup& es) { - initialize(es); + if (gainWatcher_.check(es)) { + gain_ = &es.getData(gainToken_); + } std::vector output_base; edm::Handle input; @@ -97,17 +101,8 @@ void SiStripClusterToDigiProducer::process(const ClusterCollection& input, } } -void SiStripClusterToDigiProducer::initialize(const edm::EventSetup& es) { - uint32_t g_cache_id = es.get().cacheIdentifier(); - - if (g_cache_id != gain_cache_id) { - es.get().get(gainHandle); - gain_cache_id = g_cache_id; - } -} - inline void SiStripClusterToDigiProducer::setDetId(const uint32_t id) { - gainRange = gainHandle->getRange(id); + gainRange = gain_->getRange(id); detId = id; } diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h index 2f797e96e6d5a..e0de4c5eed8c0 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h @@ -7,7 +7,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" +#include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h" #include class SiStripNoises; @@ -17,9 +21,14 @@ class SiStripFedZeroSuppression { friend class SiStripRawProcessingFactory; public: - SiStripFedZeroSuppression(uint16_t fedalgo, bool trunc = true, bool trunc10bits = false) - : noise_cache_id(0), - threshold_cache_id(0), + SiStripFedZeroSuppression(uint16_t fedalgo, + edm::ConsumesCollector* iC = nullptr, + bool trunc = true, + bool trunc10bits = false) + : noiseToken_{iC ? decltype(noiseToken_){iC->esConsumes()} + : decltype(noiseToken_){}}, + thresholdToken_{iC ? decltype(thresholdToken_){iC->esConsumes()} + : decltype(thresholdToken_){}}, theFEDalgorithm(fedalgo), doTruncate(trunc), doTruncate10bits(trunc10bits) {} @@ -41,9 +50,12 @@ class SiStripFedZeroSuppression { }; private: - edm::ESHandle noiseHandle; - edm::ESHandle thresholdHandle; - uint32_t noise_cache_id, threshold_cache_id; + edm::ESGetToken noiseToken_; + edm::ESGetToken thresholdToken_; + const SiStripNoises* noise_; + const SiStripThreshold* threshold_; + edm::ESWatcher noiseWatcher_; + edm::ESWatcher thresholdWatcher_; uint16_t theFEDalgorithm; bool isAValidDigi(); diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h index 1a84c4729ea30..abe31a61f0eb9 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h @@ -16,7 +16,7 @@ class SiStripRawProcessingFactory { public: static std::unique_ptr create(const edm::ParameterSet&, edm::ConsumesCollector); - static std::unique_ptr create_Suppressor(const edm::ParameterSet&); + static std::unique_ptr create_Suppressor(const edm::ParameterSet&, edm::ConsumesCollector); static std::unique_ptr create_SubtractorPed(const edm::ParameterSet&, edm::ConsumesCollector); static std::unique_ptr create_SubtractorCMN(const edm::ParameterSet&, diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc index 4ace9de7efe9a..ddaa39cc89abf 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc @@ -10,23 +10,18 @@ using namespace std; void SiStripFedZeroSuppression::init(const edm::EventSetup& es) { - uint32_t n_cache_id = es.get().cacheIdentifier(); - uint32_t t_cache_id = es.get().cacheIdentifier(); - - if (n_cache_id != noise_cache_id) { - es.get().get(noiseHandle); - noise_cache_id = n_cache_id; + if (noiseWatcher_.check(es)) { + noise_ = &es.getData(noiseToken_); } - if (t_cache_id != threshold_cache_id) { - es.get().get(thresholdHandle); - threshold_cache_id = t_cache_id; + if (thresholdWatcher_.check(es)) { + threshold_ = &es.getData(thresholdToken_); } } void SiStripFedZeroSuppression::suppress(const std::vector& in, std::vector& selectedSignal, uint32_t detID) { - suppress(in, selectedSignal, detID, *noiseHandle, *thresholdHandle); + suppress(in, selectedSignal, detID, *noise_, *threshold_); } void SiStripFedZeroSuppression::suppress(const std::vector& in, @@ -133,8 +128,8 @@ void SiStripFedZeroSuppression::suppress(const std::vector& in, void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, edm::DetSet& out) { const uint32_t detID = out.id; - SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle->getRange(detID); + SiStripNoises::Range detNoiseRange = noise_->getRange(detID); + SiStripThreshold::Range detThRange = threshold_->getRange(detID); #ifdef DEBUG_SiStripZeroSuppression_ if (edm::isDebugEnabled()) LogTrace("SiStripZeroSuppression") @@ -152,10 +147,9 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, #endif adc = in_iter->adc(); - SiStripThreshold::Data thresholds = thresholdHandle->getData(strip, detThRange); - theFEDlowThresh = static_cast(thresholds.getLth() * noiseHandle->getNoiseFast(strip, detNoiseRange) + 0.5); - theFEDhighThresh = - static_cast(thresholds.getHth() * noiseHandle->getNoiseFast(strip, detNoiseRange) + 0.5); + SiStripThreshold::Data thresholds = threshold_->getData(strip, detThRange); + theFEDlowThresh = static_cast(thresholds.getLth() * noise_->getNoiseFast(strip, detNoiseRange) + 0.5); + theFEDhighThresh = static_cast(thresholds.getHth() * noise_->getNoiseFast(strip, detNoiseRange) + 0.5); adcPrev = -9999; adcNext = -9999; @@ -171,11 +165,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, theNextFEDhighThresh = 9999; } else { adcNext = (in_iter + 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle->getData(strip + 1, detThRange); + SiStripThreshold::Data thresholds_1 = threshold_->getData(strip + 1, detThRange); theNextFEDlowThresh = - static_cast(thresholds_1.getLth() * noiseHandle->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast(thresholds_1.getLth() * noise_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); theNextFEDhighThresh = - static_cast(thresholds_1.getHth() * noiseHandle->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast(thresholds_1.getHth() * noise_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); } /* Similarily, for the first strip @@ -187,11 +181,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, thePrevFEDhighThresh = 9999; } else { adcPrev = (in_iter - 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle->getData(strip - 1, detThRange); + SiStripThreshold::Data thresholds_1 = threshold_->getData(strip - 1, detThRange); thePrevFEDlowThresh = - static_cast(thresholds_1.getLth() * noiseHandle->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast(thresholds_1.getLth() * noise_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); thePrevFEDhighThresh = - static_cast(thresholds_1.getHth() * noiseHandle->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast(thresholds_1.getHth() * noise_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); } if (adcNext < adcPrev) { adcMaxNeigh = adcPrev; @@ -213,18 +207,16 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, theNext2FEDlowThresh = 9999; } else if (strip % 128 < 126) { adcNext2 = (in_iter + 2)->adc(); - theNext2FEDlowThresh = static_cast(thresholdHandle->getData(strip + 2, detThRange).getLth() * - noiseHandle->getNoiseFast(strip + 2, detNoiseRange) + - 0.5); + theNext2FEDlowThresh = static_cast( + threshold_->getData(strip + 2, detThRange).getLth() * noise_->getNoiseFast(strip + 2, detNoiseRange) + 0.5); } if (strip % 128 <= 1) { adcPrev2 = 0; thePrev2FEDlowThresh = 9999; } else if (strip % 128 > 1) { adcPrev2 = (in_iter - 2)->adc(); - thePrev2FEDlowThresh = static_cast(thresholdHandle->getData(strip - 2, detThRange).getLth() * - noiseHandle->getNoiseFast(strip - 2, detNoiseRange) + - 0.5); + thePrev2FEDlowThresh = static_cast( + threshold_->getData(strip - 2, detThRange).getLth() * noise_->getNoiseFast(strip - 2, detNoiseRange) + 0.5); } //GB 23/6/08: truncation should be done at the very beginning if (isAValidDigi()) @@ -233,8 +225,8 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet& in, } void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t size) { - SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle->getRange(detID); + SiStripNoises::Range detNoiseRange = noise_->getRange(detID); + SiStripThreshold::Range detThRange = threshold_->getRange(detID); if (highThr_.size() != size) { highThr_.resize(size); @@ -244,8 +236,8 @@ void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t siz lowThrSN_.resize(size); } - noiseHandle->allNoises(noises_, detNoiseRange); - thresholdHandle->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N + noise_->allNoises(noises_, detNoiseRange); + threshold_->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N for (size_t strip = 0; strip < size; ++strip) { float noise = noises_[strip]; // uncomment line below to check bluk noise decoding diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc index c87dd2e9c89b7..0a09812b9c932 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc @@ -19,7 +19,7 @@ std::unique_ptr SiStripRawProcessingFactory::cre new SiStripRawProcessingAlgorithms(iC, create_SubtractorPed(conf, iC), create_SubtractorCMN(conf, iC), - create_Suppressor(conf), + create_Suppressor(conf, iC), create_Restorer(conf, iC), conf.getParameter("doAPVRestore"), conf.getParameter("useCMMeanMap"))); @@ -61,8 +61,8 @@ std::unique_ptr SiStripRawProcessingFactory::c return std::unique_ptr(new MedianCMNSubtractor()); } -std::unique_ptr SiStripRawProcessingFactory::create_Suppressor( - const edm::ParameterSet& conf) { +std::unique_ptr SiStripRawProcessingFactory::create_Suppressor(const edm::ParameterSet& conf, + edm::ConsumesCollector iC) { const uint32_t mode = conf.getParameter("SiStripFedZeroSuppressionMode"); const bool trunc = conf.getParameter("TruncateInSuppressor"); const bool trunc10bits = conf.getParameter("Use10bitsTruncation"); @@ -71,11 +71,11 @@ std::unique_ptr SiStripRawProcessingFactory::create_S case 2: case 3: case 4: - return std::make_unique(mode, trunc, trunc10bits); + return std::make_unique(mode, &iC, trunc, trunc10bits); default: edm::LogError("SiStripRawProcessingFactory::createSuppressor") << "Unregistered mode: " << mode << ". Use one of {1,2,3,4}."; - return std::make_unique(4, true, trunc10bits); + return std::make_unique(4, &iC, true, trunc10bits); } } diff --git a/RecoMTD/DetLayers/BuildFile.xml b/RecoMTD/DetLayers/BuildFile.xml index b64af40d3e429..da920315fbb6a 100644 --- a/RecoMTD/DetLayers/BuildFile.xml +++ b/RecoMTD/DetLayers/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h index d218ded5ed597..1fa4a29844170 100644 --- a/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h +++ b/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h @@ -9,6 +9,7 @@ */ #include +#include #include class DetLayer; @@ -22,7 +23,7 @@ class ETLDetLayerGeometryBuilder { /// return.first=forward (+Z), return.second=backward (-Z) /// both vectors are sorted inside-out static std::pair, std::vector > buildLayers(const MTDGeometry& geo, - const int mtdTopologyMode); + const MTDTopology& topo); private: // Disable constructor - only static access is allowed. @@ -33,14 +34,11 @@ class ETLDetLayerGeometryBuilder { std::vector& rings, const MTDGeometry& geo); - static MTDSectorForwardDoubleLayer* buildLayerNew(int endcap, - int layer, - std::vector& sectors, - const MTDGeometry& geo); + static MTDSectorForwardDoubleLayer* buildLayerNew( + int endcap, int layer, std::vector& sectors, const MTDGeometry& geo, const MTDTopology& topo); static MTDDetRing* makeDetRing(std::vector& geomDets); static bool isFront(int layer, int ring, int module); - static MTDDetSector* makeDetSector(std::vector& geomDets); - static bool orderGeomDets(const GeomDet*&, const GeomDet*&); + static MTDDetSector* makeDetSector(std::vector& geomDets, const MTDTopology& topo); }; #endif diff --git a/RecoMTD/DetLayers/interface/MTDDetSector.h b/RecoMTD/DetLayers/interface/MTDDetSector.h index 7dac4a2e2dc96..fd05de8176efd 100644 --- a/RecoMTD/DetLayers/interface/MTDDetSector.h +++ b/RecoMTD/DetLayers/interface/MTDDetSector.h @@ -3,6 +3,7 @@ #include "TrackingTools/DetLayers/interface/GeometricSearchDet.h" #include "DataFormats/GeometrySurface/interface/BoundDiskSector.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" #include @@ -13,10 +14,12 @@ class MTDDetSector : public GeometricSearchDet { using GeometricSearchDet::GeometricSearchDet; /// Construct from iterators on GeomDet* - MTDDetSector(std::vector::const_iterator first, std::vector::const_iterator last); + MTDDetSector(std::vector::const_iterator first, + std::vector::const_iterator last, + const MTDTopology& topo); /// Construct from a vector of GeomDet* - MTDDetSector(const std::vector& dets); + MTDDetSector(const std::vector& dets, const MTDTopology& topo); ~MTDDetSector() override{}; @@ -49,6 +52,15 @@ class MTDDetSector : public GeometricSearchDet { const BoundDiskSector& specificSurface() const { return *theDiskS; } + void compatibleDetsLine(const size_t idetMin, + std::vector& result, + const TrajectoryStateOnSurface& tsos, + const Propagator& prop, + const MeasurementEstimator& est) const; + + size_t hshift(const uint32_t detid, const int horizontalShift) const; + size_t vshift(const uint32_t detid, const int verticalShift, size_t& closest) const; + protected: void setDisk(BoundDiskSector* diskS) { theDiskS = diskS; } @@ -62,12 +74,7 @@ class MTDDetSector : public GeometricSearchDet { ReferenceCountingPointer theDiskS; std::vector theDets; - // Window of detid ordered modules around that closest to the track extrapolation on the sector surface - // needed to limit the size of the vector of distances to sort - // value 50 based on the possible mismatch of module number between adjacent - // modules, due to left-right type imparity - - static constexpr size_t detsRange = 50; + const MTDTopology* topo_; void init(); }; diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc index 83af5cda4e386..66ccf3d51804d 100644 --- a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc @@ -19,9 +19,10 @@ using namespace std; pair, vector > ETLDetLayerGeometryBuilder::buildLayers(const MTDGeometry& geo, - const int mtdTopologyMode) { + const MTDTopology& topo) { vector result[2]; // one for each endcap + const int mtdTopologyMode = topo.getMTDTopologyMode(); if (mtdTopologyMode <= static_cast(MTDTopologyMode::Mode::barphiflat)) { for (unsigned endcap = 0; endcap < 2; ++endcap) { // there is only one layer for ETL right now, maybe more later @@ -60,12 +61,15 @@ pair, vector > ETLDetLayerGeometryBuilder::buildLay for (unsigned sector = 1; sector <= nSector; ++sector) { sectors.push_back(sector); } - MTDSectorForwardDoubleLayer* thelayer = buildLayerNew(endcap, layer, sectors, geo); + MTDSectorForwardDoubleLayer* thelayer = buildLayerNew(endcap, layer, sectors, geo, topo); if (thelayer) result[endcap].push_back(thelayer); } } } + // + // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0) + // pair, vector > res_pair(result[1], result[0]); return res_pair; } @@ -133,10 +137,8 @@ MTDDetRing* ETLDetLayerGeometryBuilder::makeDetRing(vector& geom return result; } -MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endcap, - int layer, - vector& sectors, - const MTDGeometry& geo) { +MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew( + int endcap, int layer, vector& sectors, const MTDGeometry& geo, const MTDTopology& topo) { MTDSectorForwardDoubleLayer* result = nullptr; std::vector frontSectors, backSectors; @@ -176,15 +178,15 @@ MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endca } if (!backGeomDets.empty()) { - std::sort(backGeomDets.begin(), backGeomDets.end(), orderGeomDets); + std::sort(backGeomDets.begin(), backGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "backGeomDets size = " << backGeomDets.size(); - backSectors.emplace_back(makeDetSector(backGeomDets)); + backSectors.emplace_back(makeDetSector(backGeomDets, topo)); } if (!frontGeomDets.empty()) { - std::sort(frontGeomDets.begin(), frontGeomDets.end(), orderGeomDets); + std::sort(frontGeomDets.begin(), frontGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "frontGeomDets size = " << frontGeomDets.size(); - frontSectors.emplace_back(makeDetSector(frontGeomDets)); + frontSectors.emplace_back(makeDetSector(frontGeomDets, topo)); assert(!backGeomDets.empty()); float frontz = frontSectors.back()->position().z(); float backz = backSectors.back()->position().z(); @@ -202,15 +204,11 @@ MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endca return result; } -MTDDetSector* ETLDetLayerGeometryBuilder::makeDetSector(vector& geomDets) { - MTDDetSector* result = new MTDDetSector(geomDets); +MTDDetSector* ETLDetLayerGeometryBuilder::makeDetSector(vector& geomDets, const MTDTopology& topo) { + MTDDetSector* result = new MTDDetSector(geomDets, topo); LogTrace("MTDDetLayers") << "ETLDetLayerGeometryBuilder::makeDetSector new MTDDetSector with " << std::fixed << std::setw(14) << geomDets.size() << " modules \n" << (*result); return result; } - -bool ETLDetLayerGeometryBuilder::orderGeomDets(const GeomDet*& gd1, const GeomDet*& gd2) { - return gd1->geographicalId().rawId() < gd2->geographicalId().rawId(); -} diff --git a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc index 61e92406557e8..63308e55b10f2 100644 --- a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc +++ b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc @@ -33,7 +33,7 @@ void MTDDetLayerGeometry::buildLayers(const MTDGeometry* geo, const MTDTopology* this->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*geo)); // Build ETL layers, depends on the scenario if (mtopo) { - this->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*geo, mtopo->getMTDTopologyMode())); + this->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*geo, *mtopo)); } else { LogWarning("MTDDetLayers") << "No MTD topology is available."; } diff --git a/RecoMTD/DetLayers/src/MTDDetSector.cc b/RecoMTD/DetLayers/src/MTDDetSector.cc index 286844aee4ab3..d47b98f948a36 100644 --- a/RecoMTD/DetLayers/src/MTDDetSector.cc +++ b/RecoMTD/DetLayers/src/MTDDetSector.cc @@ -1,6 +1,7 @@ //#define EDM_ML_DEBUG #include "RecoMTD/DetLayers/interface/MTDDetSector.h" +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "TrackingTools/GeomPropagators/interface/Propagator.h" #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h" @@ -14,12 +15,17 @@ using namespace std; -MTDDetSector::MTDDetSector(vector::const_iterator first, vector::const_iterator last) - : GeometricSearchDet(false), theDets(first, last) { +MTDDetSector::MTDDetSector(vector::const_iterator first, + vector::const_iterator last, + const MTDTopology& topo) + : GeometricSearchDet(false), theDets(first, last), topo_(&topo) { init(); } -MTDDetSector::MTDDetSector(const vector& vdets) : GeometricSearchDet(false), theDets(vdets) { init(); } +MTDDetSector::MTDDetSector(const vector& vdets, const MTDTopology& topo) + : GeometricSearchDet(false), theDets(vdets), topo_(&topo) { + init(); +} void MTDDetSector::init() { // Add here the sector build based on a collection of GeomDets, mimic what done in ForwardDetRingOneZ @@ -79,7 +85,8 @@ vector MTDDetSector::compatibleDets(const Traj TrajectoryStateOnSurface& tsos = compat.second; GlobalPoint startPos = tsos.globalPosition(); - LogTrace("MTDDetLayers") << "Starting position: " << startPos; + LogTrace("MTDDetLayers") << "Starting position: " << startPos << " starting p/pT: " << tsos.globalMomentum().mag() + << " / " << tsos.globalMomentum().perp(); // determine distance of det center from extrapolation on the surface, sort dets accordingly @@ -95,30 +102,35 @@ vector MTDDetSector::compatibleDets(const Traj dist2Min = dist2; idetMin = idet; } - LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets " << std::fixed << std::setw(8) << idet << " " - << theDets[idet]->geographicalId().rawId() << " dist = " << std::setw(10) - << std::sqrt(dist2) << " Min idet/dist = " << std::setw(8) << idetMin << " " - << std::setw(10) << std::sqrt(dist2Min) << " " << theDets[idet]->position(); } - // loop on an interval od ordered detIds around the minimum - // set a range of GeomDets around the minimum compatible with the geometry of ETL - - size_t iniPos(idetMin > detsRange ? idetMin - detsRange : static_cast(0)); - size_t endPos(std::min(idetMin + detsRange, basicComponents().size() - 1)); - tmpDets.erase(tmpDets.begin() + endPos, tmpDets.end()); - tmpDets.erase(tmpDets.begin(), tmpDets.begin() + iniPos); - std::sort(tmpDets.begin(), tmpDets.end()); - - for (const auto& thisDet : tmpDets) { - if (add(thisDet.second, result, tsos, prop, est)) { - LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det " << thisDet.second - << " detId = " << theDets[thisDet.second]->geographicalId().rawId() << " at " - << theDets[thisDet.second]->position() << " dist = " << std::sqrt(thisDet.first); - } else { - break; + //look for the compatibledets considering each line of the sector + + if (add(idetMin, result, tsos, prop, est)) { + compatibleDetsLine(idetMin, result, tsos, prop, est); + + for (int iside = -1; iside <= 1; iside += 2) { + bool isCompatible(true); + size_t idetNew(idetMin); + size_t closest = theDets.size(); + + while (isCompatible) { + idetNew = vshift(theDets[idetNew]->geographicalId().rawId(), iside, closest); + if (idetNew >= theDets.size()) { + if (closest < theDets.size()) { + idetNew = closest; + } else { + break; + } + } + isCompatible = add(idetNew, result, tsos, prop, est); + if (isCompatible) { + compatibleDetsLine(idetNew, result, tsos, prop, est); + } + } } } + #ifdef EDM_ML_DEBUG if (result.empty()) { LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, closest not compatible!"; @@ -156,6 +168,10 @@ bool MTDDetSector::add(size_t idet, if (compat.first) { result.push_back(DetWithState(theDets[idet], compat.second)); + LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det idetMin " << idet + << " detId = " << theDets[idet]->geographicalId().rawId() << " at " + << theDets[idet]->position() + << " dist = " << std::sqrt((tsos.globalPosition() - theDets[idet]->position()).mag2()); } return compat.first; @@ -172,3 +188,32 @@ std::ostream& operator<<(std::ostream& os, const MTDDetSector& id) { << " phi w/2 : " << std::setw(14) << id.specificSurface().phiHalfExtension() << std::endl; return os; } + +void MTDDetSector::compatibleDetsLine(const size_t idetMin, + vector& result, + const TrajectoryStateOnSurface& tsos, + const Propagator& prop, + const MeasurementEstimator& est) const { + for (int iside = -1; iside <= 1; iside += 2) { + bool isCompatible(true); + size_t idetNew(idetMin); + + while (isCompatible) { + idetNew = hshift(theDets[idetNew]->geographicalId().rawId(), iside); + if (idetNew >= theDets.size()) { + break; + } + isCompatible = add(idetNew, result, tsos, prop, est); + } + } + + return; +} + +size_t MTDDetSector::hshift(const uint32_t detid, const int horizontalShift) const { + return topo_->hshiftETL(detid, horizontalShift); +} + +size_t MTDDetSector::vshift(const uint32_t detid, const int verticalShift, size_t& closest) const { + return topo_->vshiftETL(detid, verticalShift, closest); +} diff --git a/RecoMTD/DetLayers/test/BuildFile.xml b/RecoMTD/DetLayers/test/BuildFile.xml index 2d8892ffe2fd8..c9fb7147c279b 100644 --- a/RecoMTD/DetLayers/test/BuildFile.xml +++ b/RecoMTD/DetLayers/test/BuildFile.xml @@ -10,4 +10,10 @@ +
+ + + + + diff --git a/RecoMTD/DetLayers/test/TestETLNavigation.cc b/RecoMTD/DetLayers/test/TestETLNavigation.cc new file mode 100644 index 0000000000000..c252d50621155 --- /dev/null +++ b/RecoMTD/DetLayers/test/TestETLNavigation.cc @@ -0,0 +1,119 @@ +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" +#include "RecoMTD/Records/interface/MTDRecoGeometryRecord.h" + +#include "RecoMTD/DetLayers/interface/MTDSectorForwardDoubleLayer.h" +#include "RecoMTD/DetLayers/interface/MTDDetSector.h" + +#include + +#include + +using namespace std; +using namespace edm; + +class TestETLNavigation : public EDAnalyzer { +public: + TestETLNavigation(const ParameterSet& pset); + + void analyze(const Event& ev, const EventSetup& es) override; + +private: + const edm::ESInputTag tag_; + edm::ESGetToken geomToken_; +}; + +TestETLNavigation::TestETLNavigation(const ParameterSet& iConfig) : tag_(edm::ESInputTag{"", ""}) { + geomToken_ = esConsumes(tag_); +} + +void TestETLNavigation::analyze(const Event& ev, const EventSetup& es) { + auto geo = es.getTransientHandle(geomToken_); + + const vector& layers = geo->allETLLayers(); + + // dump of ETL layers structure + + LogVerbatim("MTDLayerDump") << "\n\nTest of ETL navigation \n\n"; + + for (const auto& ilay : layers) { + const MTDSectorForwardDoubleLayer* layer = static_cast(ilay); + + LogVerbatim("MTDLayerDump") << std::fixed << "\nETL layer " << std::setw(4) << layer->subDetector() + << " at z = " << std::setw(14) << layer->surface().position().z() + << " sectors = " << std::setw(14) << layer->sectors().size() + << " dets = " << std::setw(14) << layer->basicComponents().size() + << " front dets = " << std::setw(14) << layer->frontLayer()->basicComponents().size() + << " back dets = " << std::setw(14) << layer->backLayer()->basicComponents().size(); + + unsigned int isectInd(0); + for (const auto& isector : layer->sectors()) { + isectInd++; + LogVerbatim("MTDLayerDump") << std::fixed << "\nSector " << std::setw(4) << isectInd << "\n" << (*isector); + unsigned int imodInd(0); + for (const auto& imod : isector->basicComponents()) { + imodInd++; + ETLDetId modId(imod->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << std::setw(5) << imodInd << " ETLDetId " << modId.rawId() + << " side = " << std::setw(4) << modId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << modId.nDisc() << " " << std::setw(4) + << modId.discSide() << " " << std::setw(4) << modId.sector() + << " mod/type = " << std::setw(4) << modId.module() << " " << std::setw(4) + << modId.modType() << " pos = " << imod->position(); + for (int iside = -1; iside <= 1; iside += 2) { + size_t idetNew = isector->hshift(modId, iside); + if (idetNew >= isector->basicComponents().size()) { + LogVerbatim("MTDLayerDump") << "...............hshift= " << std::fixed << std::setw(2) << iside + << " out of range"; + } else { + ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << "...............hshift= " << std::setw(2) << iside + << " side = " << std::setw(4) << newId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " + << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector() + << " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) + << newId.modType() + << " pos = " << isector->basicComponents()[idetNew]->position(); + } + } + for (int iside = -1; iside <= 1; iside += 2) { + size_t closest(isector->basicComponents().size()); + size_t idetNew = isector->vshift(modId, iside, closest); + if (idetNew >= isector->basicComponents().size()) { + LogVerbatim("MTDLayerDump") << "...............vshift= " << std::fixed << std::setw(2) << iside + << " out of range"; + if (closest < isector->basicComponents().size()) { + ETLDetId newId(isector->basicComponents()[closest]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") + << std::fixed << ".......closest.vshift= " << std::setw(2) << iside << " side = " << std::setw(4) + << newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " << std::setw(4) + << newId.discSide() << " " << std::setw(4) << newId.sector() << " mod/type = " << std::setw(4) + << newId.module() << " " << std::setw(4) << newId.modType() + << " pos = " << isector->basicComponents()[closest]->position(); + } + } else { + ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << "...............vshift= " << std::setw(2) << iside + << " side = " << std::setw(4) << newId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " + << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector() + << " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) + << newId.modType() + << " pos = " << isector->basicComponents()[idetNew]->position(); + } + } + } + } + } +} + +//define this as a plug-in +#include +DEFINE_FWK_MODULE(TestETLNavigation); diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index 36f1c074d2571..dbf9f757a0c0e 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -10,22 +10,40 @@ process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.debugModules = cms.untracked.vstring("*") -process.MessageLogger.files.debugs = cms.untracked.PSet( - threshold = cms.untracked.string('DEBUG'), - INFO= cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), +process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG') +process.MessageLogger.cerr.DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDLayerDump = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.MTDDetLayers = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdDetLayerGeometry = cms.untracked.PSet( MTDLayerDump = cms.untracked.PSet( limit = cms.untracked.int32(-1) ), MTDDetLayers = cms.untracked.PSet( limit = cms.untracked.int32(-1) ), - enableStatistics = cms.untracked.bool(True) -) + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO')) # Choose Tracker Geometry process.load("Configuration.Geometry.GeometryExtended2026D76_cff") @@ -44,5 +62,6 @@ process.Timing = cms.Service("Timing") process.prod = cms.EDAnalyzer("MTDRecoGeometryAnalyzer") +process.prod1 = cms.EDAnalyzer("TestETLNavigation") -process.p1 = cms.Path(process.prod) +process.p1 = cms.Path(process.prod+process.prod1) diff --git a/RecoMTD/DetLayers/test/runTest.sh b/RecoMTD/DetLayers/test/runTest.sh new file mode 100755 index 0000000000000..490b4b42d9f8e --- /dev/null +++ b/RecoMTD/DetLayers/test/runTest.sh @@ -0,0 +1,39 @@ +#!/bin/sh -e + +function die { echo $1: status $2 ; exit $2; } +function checkDiff { + FSIZE=$(stat -c%s "$1") + echo "The output diff is $FSIZE:" + cat $1; + if [ $FSIZE -gt 0 ] + then + exit -1; + fi +} + +TEST_DIR=src/RecoMTD/DetLayers/test + +F1=${TEST_DIR}/mtd_cfg.py + +REF_FILE="Geometry/TestReference/data/mtdDetLayerGeometryRef.log.gz" +REF="" +for d in $(echo $CMSSW_SEARCH_PATH | tr ':' '\n') ; do + if [ -e "${d}/${REF_FILE}" ] ; then + REF="${d}/${REF_FILE}" + break + fi +done +[ -z $REF ] && exit 1 + +FILE1=mtdDetLayerGeometry.log +LOG=mtddlglog +DIF=mtddlgdif + +echo " testing RecoMTD/DetLayers" + +echo "===== Test \"cmsRun mtd_cfg.py\" ====" +rm -f $LOG $DIF $FILE1 + +cmsRun $F1 >& $LOG || die "Failure using cmsRun $F1" $? +gzip -f $FILE1 || die "$FILE1 compression fail" $? +(zdiff $FILE1.gz $REF >& $DIF || [ -s $DIF ] && checkDiff $DIF || echo "OK") || die "Failure in comparison for $FILE1" $? diff --git a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py index face0beacc966..95b1ee8e6bf09 100644 --- a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py +++ b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py @@ -1,77 +1,49 @@ import FWCore.ParameterSet.Config as cms +import RecoMuon.L2MuonIsolationProducer.hltL2MuonIsolations_cfi as _mod -hltL2MuonIsolationsCR = cms.EDProducer("L2MuonIsolationProducer", - StandAloneCollectionLabel = cms.InputTag("L2Muons","UpdatedAtVtx"), - IsolatorPSet = cms.PSet( - ComponentName = cms.string( "CutsIsolatorWithCorrection" ), - ConeSizes = cms.vdouble(0.24, 0.24, 0.24, 0.24, 0.24, +hltL2MuonIsolationsCR = _mod.hltL2MuonIsolations.clone( + StandAloneCollectionLabel = "L2Muons:UpdatedAtVtx", + IsolatorPSet = dict( + ConeSizes = [0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, - 0.24), - Thresholds = cms.vdouble(5.5, 5.5, 5.9, 5.7, 5.1, + 0.24], + Thresholds = [5.5, 5.5, 5.9, 5.7, 5.1, 4.9, 5.0, 5.0, 5.1, 5.0, 4.8, 4.8, 4.7, 4.7, 3.5, 3.1, 3.5, 3.9, 3.7, 3.7, 3.5, 3.5, 3.2, 3.3, 3.4, - 3.4), - EtaBounds = cms.vdouble(0.0435, 0.1305, 0.2175, 0.3045, 0.3915, + 3.4], + EtaBounds = [0.0435, 0.1305, 0.2175, 0.3045, 0.3915, 0.4785, 0.5655, 0.6525, 0.7395, 0.8265, 0.9135, 1.0005, 1.0875, 1.1745, 1.2615, 1.3485, 1.4355, 1.5225, 1.6095, 1.6965, 1.785, 1.88, 1.9865, 2.1075, 2.247, - 2.411), - ConeSizesRel = cms.vdouble(0.24, 0.24, 0.24, 0.24, 0.24, + 2.411], + ConeSizesRel = [0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, - 0.24), -#some mild nonsense numbers - ThresholdsRel = cms.vdouble(0.155, 0.155, 0.159, 0.157, 0.151, + 0.24], + #some mild nonsense numbers + ThresholdsRel = [0.155, 0.155, 0.159, 0.157, 0.151, 0.149, 0.150, 0.150, 0.151, 0.150, 0.148, 0.148, 0.147, 0.147, 0.135, 0.131, 0.135, 0.139, 0.137, 0.137, 0.135, 0.135, 0.132, 0.133, 0.134, - 0.134), - EtaBoundsRel = cms.vdouble(0.0435, 0.1305, 0.2175, 0.3045, 0.3915, + 0.134], + EtaBoundsRel = [0.0435, 0.1305, 0.2175, 0.3045, 0.3915, 0.4785, 0.5655, 0.6525, 0.7395, 0.8265, 0.9135, 1.0005, 1.0875, 1.1745, 1.2615, 1.3485, 1.4355, 1.5225, 1.6095, 1.6965, 1.785, 1.88, 1.9865, 2.1075, 2.247, - 2.411), - CutAbsoluteIso = cms.bool(True), - CutRelativeIso = cms.bool(False), - UseRhoCorrection = cms.bool(False), - RhoSrc = cms.InputTag('hltKT6CaloJets','rho'), - RhoMax = cms.double(9.9999999E7), - RhoScaleBarrel = cms.double(1.0), - RhoScaleEndcap = cms.double(1.0), - EffAreaSFBarrel = cms.double(1.0), - EffAreaSFEndcap = cms.double(1.0), -#only one should be on - ReturnAbsoluteSum = cms.bool(True), - ReturnRelativeSum = cms.bool(False), - AndOrCuts = cms.bool(True) + 2.411], + UseRhoCorrection = False, + RhoSrc = 'hltKT6CaloJets:rho', + RhoMax = 9.9999999E7, ), - WriteIsolatorFloat = cms.bool(False), -# OutputMuIsoDeposits = cms.bool(True), - ExtractorPSet = cms.PSet( - DR_Veto_H = cms.double(0.1), - Vertex_Constraint_Z = cms.bool(False), - Threshold_H = cms.double(0.5), - ComponentName = cms.string('CaloExtractor'), - Threshold_E = cms.double(0.2), - DR_Max = cms.double(1.0), - DR_Veto_E = cms.double(0.07), - Weight_E = cms.double(1.5), - Vertex_Constraint_XY = cms.bool(False), - DepositLabel = cms.untracked.string('EcalPlusHcal'), - CaloTowerCollectionLabel = cms.InputTag("towerMaker"), - Weight_H = cms.double(1.0) - ) + ExtractorPSet = dict() ) - - - diff --git a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py index ec2289a64a1fc..2d18d6d42b720 100644 --- a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py +++ b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py @@ -1,79 +1,36 @@ import FWCore.ParameterSet.Config as cms - # The services from RecoMuon.TrackingTools.MuonServiceProxy_cff import * from RecoMuon.TrackingTools.MuonTrackLoader_cff import * -L2Muons = cms.EDProducer("L2MuonProducer", +import RecoMuon.L2MuonProducer.L2MuonProducer_cfi as _mod + +L2Muons = _mod.L2MuonProducer.clone( MuonTrackLoaderForSTA, MuonServiceProxy, - InputObjects = cms.InputTag("L2MuonSeeds"), - MuonTrajectoryBuilder = cms.string("StandAloneMuonTrajectoryBuilder"), - DoSeedRefit = cms.bool(False), - SeedTransformerParameters = cms.PSet( - Fitter = cms.string("hltESPKFFittingSmootherForL2Muon"), - MuonRecHitBuilder = cms.string("hltESPMuonTransientTrackingRecHitBuilder"), - NMinRecHits = cms.uint32(2), - UseSubRecHits = cms.bool(False), - Propagator = cms.string("hltESPFastSteppingHelixPropagatorAny"), - RescaleError = cms.double(100.0) - ), - L2TrajBuilderParameters = cms.PSet( - DoRefit = cms.bool(False), - FilterParameters = cms.PSet( - NumberOfSigma = cms.double(3.0), - FitDirection = cms.string('insideOut'), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - MaxChi2 = cms.double(1000.0), - MuonTrajectoryUpdatorParameters = cms.PSet( - MaxChi2 = cms.double(25.0), - RescaleError = cms.bool(False), - RescaleErrorFactor = cms.double(100.0), - Granularity = cms.int32(0), - ExcludeRPCFromFit = cms.bool(False), - UseInvalidHits = cms.bool(True), - ), - EnableRPCMeasurement = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - EnableDTMeasurement = cms.bool(True), - RPCRecSegmentLabel = cms.InputTag("rpcRecHits"), - Propagator = cms.string('SteppingHelixPropagatorL2Any'), - EnableGEMMeasurement = cms.bool(False), - GEMRecSegmentLabel = cms.InputTag("gemRecHits"), - EnableME0Measurement = cms.bool(False), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableCSCMeasurement = cms.bool(True) + InputObjects = "L2MuonSeeds", + MuonTrajectoryBuilder = "StandAloneMuonTrajectoryBuilder", + SeedTransformerParameters = dict(), + L2TrajBuilderParameters = dict( + FilterParameters = dict( + DTRecSegmentLabel = "dt4DSegments", + MuonTrajectoryUpdatorParameters = dict(), + CSCRecSegmentLabel = "cscSegments", + RPCRecSegmentLabel = "rpcRecHits", + Propagator = 'SteppingHelixPropagatorL2Any', ), # a precise propagation direction can be choosen accordingly with the # above seed position - SeedPropagator = cms.string('SteppingHelixPropagatorL2Any'), - NavigationType = cms.string('Standard'), - DoBackwardFilter = cms.bool(True), + SeedPropagator = 'SteppingHelixPropagatorL2Any', # where you want the seed (in,out) - SeedPosition = cms.string('in'), - BWFilterParameters = cms.PSet( - NumberOfSigma = cms.double(3.0), - BWSeedType = cms.string('fromGenerator'), - FitDirection = cms.string('outsideIn'), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - MaxChi2 = cms.double(100.0), - MuonTrajectoryUpdatorParameters = cms.PSet( - MaxChi2 = cms.double(25.0), - RescaleError = cms.bool(False), - RescaleErrorFactor = cms.double(100.0), - Granularity = cms.int32(2), - ExcludeRPCFromFit = cms.bool( False ), - UseInvalidHits = cms.bool( True ), - ), - EnableRPCMeasurement = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - EnableDTMeasurement = cms.bool(True), - RPCRecSegmentLabel = cms.InputTag("rpcRecHits"), - Propagator = cms.string('SteppingHelixPropagatorL2Any'), - EnableGEMMeasurement = cms.bool(False), - GEMRecSegmentLabel = cms.InputTag("gemRecHits"), - EnableME0Measurement = cms.bool(False), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableCSCMeasurement = cms.bool(True) + SeedPosition = 'in', + BWFilterParameters = dict( + DTRecSegmentLabel = "dt4DSegments", + MuonTrajectoryUpdatorParameters = dict( + Granularity = 2, + ), + CSCRecSegmentLabel = "cscSegments", + RPCRecSegmentLabel = "rpcRecHits", + Propagator = 'SteppingHelixPropagatorL2Any', ), ) ) diff --git a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py index 5af41e2a5130c..ce2da1b28ec18 100644 --- a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py +++ b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py @@ -1,128 +1,59 @@ import FWCore.ParameterSet.Config as cms - +import RecoMuon.L3MuonProducer.L3MuonProducer_cfi as _mod #this is a dump of the latest configuration of that module #this is not the actual configuration of HLT #changing this file will not change the behavior of HLT #see the actual configuration in confDB -L3Muons = cms.EDProducer("L3MuonProducer", - ServiceParameters = cms.PSet( - Propagators = cms.untracked.vstring('SmartPropagatorAny', +L3Muons = _mod.L3MuonProducer.clone( + ServiceParameters = dict( + Propagators = ['SmartPropagatorAny', 'SteppingHelixPropagatorAny', 'SmartPropagator', - 'SteppingHelixPropagatorOpposite'), - RPCLayers = cms.bool(True), - UseMuonNavigation = cms.untracked.bool(True) + 'SteppingHelixPropagatorOpposite'], ), - MuonCollectionLabel = cms.InputTag("hltL2Muons","UpdatedAtVtx"), - TrackLoaderParameters = cms.PSet( - PutTkTrackIntoEvent = cms.untracked.bool(True), - VertexConstraint = cms.bool(False), - MuonSeededTracksInstance = cms.untracked.string('L2Seeded'), - Smoother = cms.string('KFSmootherForMuonTrackLoader'), - MuonUpdatorAtVertexParameters = cms.PSet( - MaxChi2 = cms.double(1000000.0), - Propagator = cms.string('SteppingHelixPropagatorOpposite'), - BeamSpotPositionErrors = cms.vdouble(0.1, 0.1, 5.3) + TrackLoaderParameters = dict( + PutTkTrackIntoEvent = True, + Smoother = 'KFSmootherForMuonTrackLoader', + MuonUpdatorAtVertexParameters = dict( + Propagator = 'SteppingHelixPropagatorOpposite', ), - SmoothTkTrack = cms.untracked.bool(False), - DoSmoothing = cms.bool(True), - beamSpot = cms.InputTag("hltOfflineBeamSpot") + DoSmoothing = True, + beamSpot = "hltOfflineBeamSpot" ), - L3TrajBuilderParameters = cms.PSet( - ScaleTECxFactor = cms.double(-1.0), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - MuonTrackingRegionBuilder = cms.PSet( - EtaR_UpperLimit_Par1 = cms.double(0.25), - Eta_fixed = cms.double(0.2), - OnDemand = cms.double(-1.0), - Rescale_Dz = cms.double(3.0), - Eta_min = cms.double(0.05), - Rescale_phi = cms.double(3.0), - EtaR_UpperLimit_Par2 = cms.double(0.15), + L3TrajBuilderParameters = dict( + TrackerRecHitBuilder = 'WithTrackAngle', + MuonTrackingRegionBuilder = dict( + Rescale_Dz = 3.0, + Eta_min = 0.05, DeltaZ_Region = cms.double(15.9), - Rescale_eta = cms.double(3.0), - PhiR_UpperLimit_Par2 = cms.double(0.2), - vertexCollection = cms.InputTag("pixelVertices"), - Phi_fixed = cms.double(0.2), - DeltaR = cms.double(0.2), - EscapePt = cms.double(1.5), + DeltaR = 0.2, UseFixedRegion = cms.bool(False), - PhiR_UpperLimit_Par1 = cms.double(0.6), - Phi_min = cms.double(0.05), - UseVertex = cms.bool(False), - beamSpot = cms.InputTag("hltOfflineBeamSpot") + Phi_min = 0.05, + beamSpot = "hltOfflineBeamSpot" ), - TrackerPropagator = cms.string('SteppingHelixPropagatorAny'), - GlobalMuonTrackMatcher = cms.PSet( - Pt_threshold1 = cms.double(0.0), - DeltaDCut_3 = cms.double(15.0), - MinP = cms.double(2.5), - MinPt = cms.double(1.0), - Chi2Cut_1 = cms.double(50.0), - Pt_threshold2 = cms.double(999999999.0), - LocChi2Cut = cms.double(0.001), - Eta_threshold = cms.double(1.2), - Quality_3 = cms.double(7.0), - Quality_2 = cms.double(15.0), - Chi2Cut_2 = cms.double(50.0), - Chi2Cut_3 = cms.double(200.0), - DeltaDCut_1 = cms.double(40.0), - DeltaRCut_2 = cms.double(0.2), - DeltaRCut_3 = cms.double(1.0), - DeltaDCut_2 = cms.double(10.0), - DeltaRCut_1 = cms.double(0.1), - Quality_1 = cms.double(20.0), - Propagator = cms.string('SmartPropagator') + GlobalMuonTrackMatcher = dict( + Propagator = 'SmartPropagator' ), - ScaleTECyFactor = cms.double(-1.0), - tkTrajLabel = cms.InputTag("hltL3TkTracksFromL2"), - tkTrajBeamSpot = cms.InputTag("hltOfflineBeamSpot"), # add a filter for L3 trajectory - tkTrajMaxChi2 = cms.double(999), # add a filter for L3 trajectory - tkTrajMaxDXYBeamSpot = cms.double(999), # add a filter for L3 trajectory - tkTrajVertex = cms.InputTag("pixelVertices"), # add a filter for L3 trajectory - tkTrajUseVertex = cms.bool(False), # add a filter for L3 trajectory - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitRPCHits = cms.bool(True), - TrackTransformer = cms.PSet( - DoPredictionsOnly = cms.bool(False), - Fitter = cms.string('L3MuKFFitter'), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - Smoother = cms.string('KFSmootherForMuonTrackLoader'), - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitDirection = cms.string('insideOut'), - RefitRPCHits = cms.bool(True), - Propagator = cms.string('SmartPropagatorAny') + tkTrajLabel = "hltL3TkTracksFromL2", + tkTrajBeamSpot = "hltOfflineBeamSpot", # add a filter for L3 trajectory + tkTrajMaxChi2 = 999, # add a filter for L3 trajectory + tkTrajMaxDXYBeamSpot = 999, # add a filter for L3 trajectory + tkTrajVertex = "pixelVertices", # add a filter for L3 trajectory + tkTrajUseVertex = False, # add a filter for L3 trajectory + MuonRecHitBuilder = 'MuonRecHitBuilder', + TrackTransformer = dict( + Fitter = 'L3MuKFFitter', + TrackerRecHitBuilder = 'WithTrackAngle', + Smoother = 'KFSmootherForMuonTrackLoader', + MuonRecHitBuilder = 'MuonRecHitBuilder', + Propagator = 'SmartPropagatorAny' ), - PtCut = cms.double(1.0), - PCut = cms.double(2.5), - GlbRefitterParameters = cms.PSet( - TrackerSkipSection = cms.int32(-1), - DoPredictionsOnly = cms.bool(False), - PropDirForCosmics = cms.bool(False), - HitThreshold = cms.int32(1), - MuonHitsOption = cms.int32(1), - Chi2CutRPC = cms.double(1.0), - Fitter = cms.string('L3MuKFFitter'), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitDirection = cms.string('insideOut'), - CSCRecSegmentLabel = cms.InputTag("hltCscSegments"), - Chi2CutCSC = cms.double(150.0), - Chi2CutDT = cms.double(10.0), - Chi2CutGEM = cms.double(1.0), - Chi2CutME0 = cms.double(1.0), - RefitRPCHits = cms.bool(True), - SkipStation = cms.int32(-1), - Propagator = cms.string('SmartPropagatorAny'), - DTRecSegmentLabel = cms.InputTag("hltDt4DSegments"), - GEMRecHitLabel = cms.InputTag("gemRecHits"), - ME0RecHitLabel = cms.InputTag("me0Segments"), - TrackerSkipSystem = cms.int32(-1) + GlbRefitterParameters = dict( + Fitter = 'L3MuKFFitter', + TrackerRecHitBuilder = 'WithTrackAngle', + MuonRecHitBuilder = 'MuonRecHitBuilder', + Propagator = 'SmartPropagatorAny', ) ) ) - - - - diff --git a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc index 8a32ac1828428..9ebc80f4e5c49 100644 --- a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc +++ b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc @@ -265,7 +265,6 @@ void L3MuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio psd1.add("EtaR_UpperLimit_Par1", 0.25); psd1.add("EtaR_UpperLimit_Par2", 0.15); psd1.add("beamSpot", edm::InputTag("hltOnlineBeamSpot")); - psd1.add("EscapePt", 3.0); psd1.add("Pt_fixed", false); psd0.add("MuonTrackingRegionBuilder", psd1); } diff --git a/RecoMuon/L3MuonProducer/test/newL3.py b/RecoMuon/L3MuonProducer/test/newL3.py index 201391b1af739..6c4ccd70fb5d6 100644 --- a/RecoMuon/L3MuonProducer/test/newL3.py +++ b/RecoMuon/L3MuonProducer/test/newL3.py @@ -125,7 +125,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), - EscapePt = cms.double( 3.0 ), EtaR_UpperLimit_Par1 = cms.double( 0.25 ), EtaR_UpperLimit_Par2 = cms.double( 0.15 ), PhiR_UpperLimit_Par1 = cms.double( 0.6 ), @@ -346,7 +345,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), - EscapePt = cms.double( 3.0 ), EtaR_UpperLimit_Par1 = cms.double( 0.25 ), EtaR_UpperLimit_Par2 = cms.double( 0.15 ), PhiR_UpperLimit_Par1 = cms.double( 0.6 ), @@ -840,7 +838,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), #Normally 4 - EscapePt = cms.double( 3.0 ), #Normally 1.5 but it should be at least 8 for us EtaR_UpperLimit_Par1 = cms.double( 0.25 ), #Normally 0.25 EtaR_UpperLimit_Par2 = cms.double( 0.15 ), #Normally 0.15 PhiR_UpperLimit_Par1 = cms.double( 0.6 ), #Normally 0.6 diff --git a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py index cc8d977f6a2fb..182ea65e68250 100644 --- a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py +++ b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.IsolationAlgos.CITKPFIsolationSumProducerForPUPPI_cfi as _mod IsoConeDefinitions = cms.VPSet( cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), @@ -21,23 +22,23 @@ miniAODVertexCodes = cms.vuint32(2,3) ), ) -muonIsolationAODPUPPI = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", - srcToIsolate = cms.InputTag("muons"), - srcForIsolationCone = cms.InputTag(''), +muonIsolationAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( + srcToIsolate = "muons", + srcForIsolationCone = '', isolationConeDefinitions = IsoConeDefinitions ) -muonIsolationMiniAODPUPPI = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", - srcToIsolate = cms.InputTag("slimmedMuons"), - srcForIsolationCone = cms.InputTag('packedPFCandidates'), - puppiValueMap = cms.InputTag(''), +muonIsolationMiniAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( + srcToIsolate = "slimmedMuons", + srcForIsolationCone = 'packedPFCandidates', + puppiValueMap = '', isolationConeDefinitions = IsoConeDefinitions ) -muonIsolationMiniAODPUPPINoLeptons = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", - srcToIsolate = cms.InputTag("slimmedMuons"), - srcForIsolationCone = cms.InputTag('packedPFCandidates'), - puppiValueMap = cms.InputTag(''), - usePUPPINoLepton = cms.bool(True), +muonIsolationMiniAODPUPPINoLeptons = _mod.CITKPFIsolationSumProducerForPUPPI.clone( + srcToIsolate = "slimmedMuons", + srcForIsolationCone = 'packedPFCandidates', + puppiValueMap = '', + usePUPPINoLepton = True, isolationConeDefinitions = IsoConeDefinitions ) diff --git a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc index 82d117e468bf1..ba063f737b6e1 100644 --- a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc +++ b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc @@ -107,8 +107,18 @@ void MuonSeedGenerator::produce(edm::Event& event, const edm::EventSetup& eSetup void MuonSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setAllowAnything(); + desc.add("beamSpotTag", edm::InputTag("offlineBeamSpot")); + desc.add("scaleDT", true); + desc.add("CSCRecSegmentLabel", edm::InputTag("cscSegments")); + desc.add("DTRecSegmentLabel", edm::InputTag("dt4DSegments")); + desc.add("ME0RecSegmentLabel", edm::InputTag("me0Segments")); desc.add("EnableDTMeasurement", true); desc.add("EnableCSCMeasurement", true); desc.add("EnableME0Measurement", false); - descriptions.add("produceMuons", desc); + desc.add>("crackEtas", {0.2, 1.6, 1.7}); + desc.add("crackWindow", 0.04); + desc.add("deltaPhiSearchWindow", 0.25); + desc.add("deltaEtaSearchWindow", 0.2); + desc.add("deltaEtaCrackSearchWindow", 0.25); + descriptions.add("muonSeedGenerator", desc); } diff --git a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py index c6fc60c850e48..7d035ebf48d04 100644 --- a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py +++ b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py @@ -1,26 +1,26 @@ import FWCore.ParameterSet.Config as cms -from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import * -from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import * +from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import ptSeedParameterization +from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import dphiScale -# module standAloneMuonSeeds = MuonSeedGenerator { -ancientMuonSeed = cms.EDProducer("MuonSeedGenerator", +import RecoMuon.MuonSeedGenerator.muonSeedGenerator_cfi as _mod +ancientMuonSeed = _mod.muonSeedGenerator.clone( ptSeedParameterization, dphiScale, - beamSpotTag = cms.InputTag("offlineBeamSpot"), - scaleDT = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableDTMeasurement = cms.bool(True), - EnableCSCMeasurement = cms.bool(True), - EnableME0Measurement = cms.bool(False), + beamSpotTag = "offlineBeamSpot", + scaleDT = True, + CSCRecSegmentLabel = "cscSegments", + DTRecSegmentLabel = "dt4DSegments", + ME0RecSegmentLabel = "me0Segments", + EnableDTMeasurement = True, + EnableCSCMeasurement = True, + EnableME0Measurement = False, # places where it's OK to have single-segment seeds - crackEtas = cms.vdouble(0.2, 1.6, 1.7), - crackWindow = cms.double(0.04), - deltaPhiSearchWindow = cms.double(0.25), - deltaEtaSearchWindow = cms.double(0.2), - deltaEtaCrackSearchWindow = cms.double(0.25), + crackEtas = [0.2, 1.6, 1.7], + crackWindow = 0.04, + deltaPhiSearchWindow = 0.25, + deltaEtaSearchWindow = 0.2, + deltaEtaCrackSearchWindow = 0.25, ) # phase2 ME0 diff --git a/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h b/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h index 08895e7a6623f..c1cdc0e0fc22f 100644 --- a/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h +++ b/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h @@ -34,8 +34,8 @@ class HGCRecHitNavigator : public PFRecHitNavigatorBase { desc.add("hgchef", deschef); edm::ParameterSetDescription descheb; - deschef.add("name", "PFRecHitHGCHENavigator"); - deschef.add("topologySource", "HGCalHEScintillatorSensitive"); + descheb.add("name", "PFRecHitHGCHENavigator"); + descheb.add("topologySource", "HGCalHEScintillatorSensitive"); desc.add("hgcheb", descheb); descriptions.add("navigator", desc); diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc similarity index 61% rename from RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc rename to RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index 4d78d73b01e75..0fa3007b61138 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -1,23 +1,23 @@ -#include "PFClusterFromHGCalMultiCluster.h" +#include "PFClusterFromHGCalTrackster.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -void PFClusterFromHGCalMultiCluster::updateEvent(const edm::Event& ev) { - ev.getByToken(clusterToken_, clusterH_); +void PFClusterFromHGCalTrackster::updateEvent(const edm::Event& ev) { ev.getByToken(tracksterToken_, trackstersH_); + ev.getByToken(clusterToken_, clusterH_); } -void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle& input, - const std::vector& rechitMask, - const std::vector& seedable, - reco::PFClusterCollection& output) { - const auto& hgcalMultiClusters = *clusterH_; +void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle& input, + const std::vector& rechitMask, + const std::vector& seedable, + reco::PFClusterCollection& output) { auto const& hits = *input; const auto& tracksters = *trackstersH_; + const auto& clusters = *clusterH_; // for quick indexing back to hit energy std::unordered_map detIdToIndex(hits.size()); @@ -25,18 +25,16 @@ void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle > hitsAndFractions; - hitsAndFractions.insert(hitsAndFractions.end(), hitsAndFractions_mcl.begin(), hitsAndFractions_mcl.end()); - - // Use the H&F of the clusters inside the multicluster if the latter's H&F are not stored - if (hitsAndFractions.empty()) { - for (const auto& cl : mcl) { - const auto& hAndF_temp = cl->hitsAndFractions(); - hitsAndFractions.insert(hitsAndFractions.end(), hAndF_temp.begin(), hAndF_temp.end()); + int iLC = 0; + std::for_each(std::begin(tst.vertices()), std::end(tst.vertices()), [&](unsigned int lcId) { + const auto fraction = 1.f / tst.vertex_multiplicity(iLC++); + for (const auto& cell : clusters[lcId].hitsAndFractions()) { + hitsAndFractions.emplace_back(cell.first, cell.second * fraction); } - } + }); for (const auto& hAndF : hitsAndFractions) { auto itr = detIdToIndex.find(hAndF.first); @@ -88,5 +83,5 @@ void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle("filterByTracksterPID"); pid_threshold_ = conf.getParameter("pid_threshold"); filter_on_categories_ = conf.getParameter >("filter_on_categories"); - clusterToken_ = - sumes.consumes >(conf.getParameter("clusterSrc")); tracksterToken_ = sumes.consumes >(conf.getParameter("tracksterSrc")); + clusterToken_ = + sumes.consumes(conf.getParameter("clusterSrc")); } - ~PFClusterFromHGCalMultiCluster() override {} - PFClusterFromHGCalMultiCluster(const PFClusterFromHGCalMultiCluster&) = delete; - PFClusterFromHGCalMultiCluster& operator=(const PFClusterFromHGCalMultiCluster&) = delete; + ~PFClusterFromHGCalTrackster() override {} + PFClusterFromHGCalTrackster(const PFClusterFromHGCalTrackster&) = delete; + PFClusterFromHGCalTrackster& operator=(const PFClusterFromHGCalTrackster&) = delete; void updateEvent(const edm::Event&) final; @@ -35,13 +34,13 @@ class PFClusterFromHGCalMultiCluster : public InitialClusteringStepBase { float pid_threshold_; std::vector filter_on_categories_; - edm::EDGetTokenT > clusterToken_; - edm::Handle > clusterH_; - edm::EDGetTokenT > tracksterToken_; edm::Handle > trackstersH_; + + edm::EDGetTokenT clusterToken_; + edm::Handle clusterH_; }; -DEFINE_EDM_PLUGIN(InitialClusteringStepFactory, PFClusterFromHGCalMultiCluster, "PFClusterFromHGCalMultiCluster"); +DEFINE_EDM_PLUGIN(InitialClusteringStepFactory, PFClusterFromHGCalTrackster, "PFClusterFromHGCalTrackster"); #endif diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py index 04dfee19e226d..c36d95eaaf0d6 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py @@ -44,12 +44,12 @@ updateTiming = cms.bool(False) ) -_hgcalMultiClusterMapper_HGCal = cms.PSet( - algoName = cms.string("PFClusterFromHGCalMultiCluster"), +_hgcalTracksterMapper_HGCal = cms.PSet( + algoName = cms.string("PFClusterFromHGCalTrackster"), thresholdsByDetector = cms.VPSet( ), - clusterSrc = cms.InputTag("ticlMultiClustersFromTrackstersMerge"), tracksterSrc = cms.InputTag("ticlTrackstersMerge"), + clusterSrc = cms.InputTag("hgcalLayerClusters"), filterByTracksterPID = cms.bool(False), pid_threshold = cms.double(0.8), filter_on_categories = cms.vint32([0, 1]), @@ -68,5 +68,5 @@ ) particleFlowClusterHGCalFromMultiCl = particleFlowClusterHGCal.clone( - initialClusteringStep = _hgcalMultiClusterMapper_HGCal + initialClusteringStep = _hgcalTracksterMapper_HGCal ) diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py index c8939961bd36e..815e60d3c2b5a 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py @@ -56,5 +56,8 @@ # HCALonly WF particleFlowRecHitHBHEOnly = particleFlowRecHitHBHE.clone( - producers = { 0: dict(src = "hbheprereco:") } + producers = { 0: dict(src = "hbheprereco") } +) +run3_HB.toModify(particleFlowRecHitHBHEOnly, + producers = { 0: dict(src = "hbhereco") } ) diff --git a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py index 424ac13a43627..391055bd870e8 100644 --- a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py +++ b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py @@ -1,24 +1,67 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * -# -# for STARTUP ONLY use try and use Offline 3D PV from pixelTracks, with adaptive vertex -# from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import * -#from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * -recopixelvertexingTask = cms.Task(pixelTracksTask,pixelVertices) -recopixelvertexing = cms.Sequence(recopixelvertexingTask) -from Configuration.ProcessModifiers.gpu_cff import gpu +# legacy pixel vertex reconsruction using the divisive vertex finder +pixelVerticesTask = cms.Task( + pixelVertices +) + +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA -from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA +# build the pixel vertices in SoA format on the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA +pixelVerticesSoA = SwitchProducerCUDA( + cpu = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksSoA", + onGPU = False + ) +) + +# convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA +pixelNtupletFit.toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone( + src = "pixelVerticesSoA" +)) + +pixelNtupletFit.toReplaceWith(pixelVerticesTask, cms.Task( + # build the pixel vertices in SoA format on the CPU + pixelVerticesSoA, + # convert the pixel vertices from SoA to legacy format + pixelVertices +)) -_pixelVertexingCUDATask = cms.Task(pixelTracksTask,pixelVertexCUDA,pixelVertexSoA,pixelVertices) -# pixelVertexSoAonCPU = pixelVertexCUDA.clone() -# pixelVertexSoAonCPU.onGPU = False; +# "Patatrack" sequence running on the GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build pixel vertices in SoA format on the GPU +pixelVerticesCUDA = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksCUDA", + onGPU = True +) + +# transfer the pixel vertices in SoA format to the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA as _pixelVertexSoA +gpu.toModify(pixelVerticesSoA, + cuda = _pixelVertexSoA.clone( + src = cms.InputTag("pixelVerticesCUDA") + ) +) -gpu.toReplaceWith(pixelVertices,_pixelVertexFromSoA) -gpu.toReplaceWith(recopixelvertexingTask,_pixelVertexingCUDATask) +(pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task( + # build pixel vertices in SoA format on the GPU + pixelVerticesCUDA, + # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format + pixelVerticesTask.copy() +)) + +# Tasks and Sequences +recopixelvertexingTask = cms.Task( + pixelTracksTask, + pixelVerticesTask +) +recopixelvertexing = cms.Sequence(recopixelvertexingTask) diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py new file mode 100644 index 0000000000000..51abcd3ea7982 --- /dev/null +++ b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +def customizePixelTracksForTriplets(process): + + from HLTrigger.Configuration.common import producers_by_type + for producer in producers_by_type(process, 'CAHitNtupletCUDA'): + producer.includeJumpingForwardDoublets = True + producer.minHitsPerNtuplet = 3 + + return process diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py deleted file mode 100644 index 1661cac832b8b..0000000000000 --- a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py +++ /dev/null @@ -1,62 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -def customizePixelTracksSoAonCPU(process): - - process.CUDAService = cms.Service('CUDAService', - enabled = cms.untracked.bool(False) - ) - - # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU - process.siPixelClustersPreSplitting.cpu.payloadType = cms.string('HLT') - - from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy - process.siPixelRecHitsPreSplitting = siPixelRecHitSoAFromLegacy.clone( - convertToLegacy = True - ) - - from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA - process.pixelTrackSoA = caHitNtupletCUDA.clone( - onGPU = False, - pixelRecHitSrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA - process.pixelVertexSoA = pixelVertexCUDA.clone( - onGPU = False, - pixelTrackSrc = 'pixelTrackSoA' - ) - - from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA - process.pixelTracks = pixelTrackProducerFromSoA.clone( - pixelRecHitLegacySrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA - process.pixelVertices = pixelVertexFromSoA.clone() - - process.reconstruction_step += process.siPixelRecHitsPreSplitting + process.pixelTrackSoA + process.pixelVertexSoA - - return process - - -def customizePixelTracksForTriplets(process): - - from HLTrigger.Configuration.common import producers_by_type - for producer in producers_by_type(process, 'CAHitNtupletCUDA'): - producer.includeJumpingForwardDoublets = True - producer.minHitsPerNtuplet = 3 - - return process - - -def customizePixelTracksSoAonCPUForProfiling(process): - - process = customizePixelTracksSoAonCPU(process) - - process.siPixelRecHitSoAFromLegacy.convertToLegacy = False - - process.TkSoA = cms.Path(process.offlineBeamSpot + process.siPixelDigis + process.siPixelClustersPreSplitting + process.siPixelRecHitSoAFromLegacy + process.pixelTrackSoA + process.pixelVertexSoA) - - process.schedule = cms.Schedule(process.TkSoA) - - return process diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc index 2f0965be50eb8..04cc57db5876c 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc @@ -54,7 +54,7 @@ void PixelTrackDumpCUDA::fillDescriptions(edm::ConfigurationDescriptions& descri edm::ParameterSetDescription desc; desc.add("onGPU", true); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); desc.add("pixelVertexSrc", edm::InputTag("pixelVertexCUDA")); descriptions.add("pixelTrackDumpCUDA", desc); } diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc index 94c490e948575..60225eceebc00 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc @@ -82,7 +82,7 @@ PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iC void PixelTrackProducerFromSoA::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); - desc.add("trackSrc", edm::InputTag("pixelTrackSoA")); + desc.add("trackSrc", edm::InputTag("pixelTracksSoA")); desc.add("pixelRecHitLegacySrc", edm::InputTag("siPixelRecHitsPreSplittingLegacy")); desc.add("minNumberOfHits", 0); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc index 2de8ec6c335b5..ad2da317e8ba6 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc @@ -46,8 +46,8 @@ PixelTrackSoAFromCUDA::PixelTrackSoAFromCUDA(const edm::ParameterSet& iConfig) void PixelTrackSoAFromCUDA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("caHitNtupletCUDA")); - descriptions.add("pixelTrackSoA", desc); + desc.add("src", edm::InputTag("pixelTracksCUDA")); + descriptions.add("pixelTracksSoA", desc); } void PixelTrackSoAFromCUDA::acquire(edm::Event const& iEvent, diff --git a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py index 5ff404cb603d4..ec9bb133a6c58 100644 --- a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py +++ b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import * @@ -23,9 +24,11 @@ import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder +# Eras from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_run3_common_cff import run3_common -# SEEDING LAYERS +# seeding layers from RecoTracker.IterativeTracking.InitialStep_cff import initialStepSeedLayers, initialStepHitDoublets, _initialStepCAHitQuadruplets # TrackingRegion @@ -33,7 +36,7 @@ trackingLowPU.toReplaceWith(pixelTracksTrackingRegions, _globalTrackingRegionFromBeamSpot.clone()) -# Pixel Quadruplets Tracking +# Pixel quadruplets tracking pixelTracksSeedLayers = initialStepSeedLayers.clone( BPix = dict(HitProducer = "siPixelRecHitsPreSplitting"), FPix = dict(HitProducer = "siPixelRecHitsPreSplitting") @@ -50,19 +53,9 @@ SeedComparitorPSet = dict(clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting') ) -# for trackingLowPU -pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( - doublets = "pixelTracksHitDoublets", - produceSeedingHitSets = True, - SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( - clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" - ) -) - pixelTracks = _pixelTracks.clone( SeedingHitSets = "pixelTracksHitQuadruplets" ) -trackingLowPU.toModify(pixelTracks, SeedingHitSets = "pixelTracksHitTriplets") pixelTracksTask = cms.Task( pixelTracksTrackingRegions, @@ -73,30 +66,91 @@ pixelTracksHitQuadruplets, pixelTracks ) + +pixelTracksSequence = cms.Sequence(pixelTracksTask) + + +# Pixel triplets for trackingLowPU +pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "pixelTracksHitDoublets", + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( + clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" + ) +) + +trackingLowPU.toModify(pixelTracks, + SeedingHitSets = "pixelTracksHitTriplets" +) + _pixelTracksTask_lowPU = pixelTracksTask.copy() _pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets, pixelTracksHitTriplets) trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU) -# Use ntuple fit and substitute previous Fitter producer with the ntuple one -from Configuration.ProcessModifiers.pixelNtupleFit_cff import pixelNtupleFit as ntupleFit -ntupleFit.toModify(pixelTracks, Fitter = "pixelNtupletsFitter") -_pixelTracksTask_ntupleFit = pixelTracksTask.copy() -_pixelTracksTask_ntupleFit.replace(pixelFitterByHelixProjections, pixelNtupletsFitter) -ntupleFit.toReplaceWith(pixelTracksTask, _pixelTracksTask_ntupleFit) +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi import pixelTrackSoA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackFromSoA -_pixelTracksGPUTask = cms.Task( - caHitNtupletCUDA, - pixelTrackSoA, - pixelTracks # FromSoA +from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +pixelTracksSoA = SwitchProducerCUDA( + # build pixel ntuplets and pixel tracks in SoA format on the CPU + cpu = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA", + idealConditions = False, + onGPU = False + ) +) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksSoA.cpu, + idealConditions = True ) -gpu.toReplaceWith(pixelTracksTask, _pixelTracksGPUTask) -gpu.toReplaceWith(pixelTracks,_pixelTrackFromSoA) +# convert the pixel tracks from SoA to legacy format +from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA +pixelNtupletFit.toReplaceWith(pixelTracks, _pixelTrackProducerFromSoA.clone( + pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting", +)) + +pixelNtupletFit.toReplaceWith(pixelTracksTask, cms.Task( + #pixelTracksTrackingRegions, + #pixelFitterByHelixProjections, + #pixelTrackFilterByKinematics, + #pixelTracksSeedLayers, + #pixelTracksHitDoublets, + #pixelTracksHitQuadruplets, + # build the pixel ntuplets and the pixel tracks in SoA format on the GPU + pixelTracksSoA, + # convert the pixel tracks from SoA to legacy format + pixelTracks +)) -pixelTracksSequence = cms.Sequence(pixelTracksTask) +# "Patatrack" sequence running on GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build the pixel ntuplets and pixel tracks in SoA format on the GPU +pixelTracksCUDA = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA", + idealConditions = False, + onGPU = True +) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksCUDA, + idealConditions = True +) + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA +gpu.toModify(pixelTracksSoA, + # transfer the pixel tracks in SoA format to the host + cuda = _pixelTracksSoA.clone() +) + +(pixelNtupletFit & gpu).toReplaceWith(pixelTracksTask, cms.Task( + # build the pixel ntuplets and pixel tracks in SoA format on the GPU + pixelTracksCUDA, + # transfer the pixel tracks in SoA format to the CPU, and convert them to legacy format + pixelTracksTask.copy() +)) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc index beba54c33f513..ee295d8f5253c 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc @@ -61,7 +61,7 @@ void CAHitNtupletCUDA::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("pixelRecHitSrc", edm::InputTag("siPixelRecHitsPreSplittingCUDA")); CAHitNtupletGeneratorOnGPU::fillDescriptions(desc); - descriptions.add("caHitNtupletCUDA", desc); + descriptions.add("pixelTracksCUDA", desc); } void CAHitNtupletCUDA::produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& es) const { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc index e2c2bc76c8612..2989403fa4214 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc @@ -85,7 +85,7 @@ void PixelVertexProducerCUDA::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("chi2max", 9.); // max normalized distance to cluster desc.add("PtMin", 0.5); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); auto label = "pixelVertexCUDA"; descriptions.add(label, desc); diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h index b19aeb5930fc6..f71aa56842a67 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h @@ -59,7 +59,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h index 22ba1e15b4e05..a11283a7b2065 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h index 1f2934ba15d0c..66d246fcfa4fa 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc index 084763385bdb4..d685ced488233 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc @@ -1 +1,192 @@ -#include "gpuVertexFinderImpl.h" +#ifndef RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h +#define RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h + +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" + +#include "gpuClusterTracksByDensity.h" +#include "gpuClusterTracksDBSCAN.h" +#include "gpuClusterTracksIterative.h" +#include "gpuFitVertices.h" +#include "gpuSortByPt2.h" +#include "gpuSplitVertices.h" + +#undef PIXVERTEX_DEBUG_PRODUCE + +namespace gpuVertexFinder { + + // reject outlier tracks that contribute more than this to the chi2 of the vertex fit + constexpr float maxChi2ForFirstFit = 50.f; + constexpr float maxChi2ForFinalFit = 5000.f; + + // split vertices with a chi2/NDoF greater than this + constexpr float maxChi2ForSplit = 9.f; + + __global__ void loadTracks(TkSoA const* ptracks, ZVertexSoA* soa, WorkSpace* pws, float ptMin) { + assert(ptracks); + assert(soa); + auto const& tracks = *ptracks; + auto const& fit = tracks.stateAtBS; + auto const* quality = tracks.qualityData(); + + auto first = blockIdx.x * blockDim.x + threadIdx.x; + for (int idx = first, nt = TkSoA::stride(); idx < nt; idx += gridDim.x * blockDim.x) { + auto nHits = tracks.nHits(idx); + if (nHits == 0) + break; // this is a guard: maybe we need to move to nTracks... + + // initialize soa... + soa->idv[idx] = -1; + + if (nHits < 4) + continue; // no triplets + if (quality[idx] != pixelTrack::Quality::loose) + continue; + + auto pt = tracks.pt(idx); + + if (pt < ptMin) + continue; + + auto& data = *pws; + auto it = atomicAdd(&data.ntrks, 1); + data.itrk[it] = idx; + data.zt[it] = tracks.zip(idx); + data.ezt2[it] = fit.covariance(idx)(14); + data.ptt2[it] = pt * pt; + } + } + +// #define THREE_KERNELS +#ifndef THREE_KERNELS + __global__ void vertexFinderOneKernel(gpuVertexFinder::ZVertices* pdata, + gpuVertexFinder::WorkSpace* pws, + int minT, // min number of neighbours to be "seed" + float eps, // max absolute distance to cluster + float errmax, // max error to be "seed" + float chi2max // max normalized distance to cluster, + ) { + clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFirstFit); + __syncthreads(); + splitVertices(pdata, pws, maxChi2ForSplit); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFinalFit); + __syncthreads(); + sortByPt2(pdata, pws); + } +#else + __global__ void vertexFinderKernel1(gpuVertexFinder::ZVertices* pdata, + gpuVertexFinder::WorkSpace* pws, + int minT, // min number of neighbours to be "seed" + float eps, // max absolute distance to cluster + float errmax, // max error to be "seed" + float chi2max // max normalized distance to cluster, + ) { + clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFirstFit); + } + + __global__ void vertexFinderKernel2(gpuVertexFinder::ZVertices* pdata, gpuVertexFinder::WorkSpace* pws) { + fitVertices(pdata, pws, maxChi2ForFinalFit); + __syncthreads(); + sortByPt2(pdata, pws); + } +#endif + +#ifdef __CUDACC__ + ZVertexHeterogeneous Producer::makeAsync(cudaStream_t stream, TkSoA const* tksoa, float ptMin) const { +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "producing Vertices on GPU" << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + ZVertexHeterogeneous vertices(cms::cuda::make_device_unique(stream)); +#else + ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const { +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "producing Vertices on CPU" << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + ZVertexHeterogeneous vertices(std::make_unique()); +#endif + assert(tksoa); + auto* soa = vertices.get(); + assert(soa); + +#ifdef __CUDACC__ + auto ws_d = cms::cuda::make_device_unique(stream); +#else + auto ws_d = std::make_unique(); +#endif + +#ifdef __CUDACC__ + init<<<1, 1, 0, stream>>>(soa, ws_d.get()); + auto blockSize = 128; + auto numberOfBlocks = (TkSoA::stride() + blockSize - 1) / blockSize; + loadTracks<<>>(tksoa, soa, ws_d.get(), ptMin); + cudaCheck(cudaGetLastError()); +#else + init(soa, ws_d.get()); + loadTracks(tksoa, soa, ws_d.get(), ptMin); +#endif + +#ifdef __CUDACC__ + // Running too many thread lead to problems when printf is enabled. + constexpr int maxThreadsForPrint = 1024 - 256; + constexpr int numBlocks = 1024; + constexpr int threadsPerBlock = 128; + + if (oneKernel_) { + // implemented only for density clustesrs +#ifndef THREE_KERNELS + vertexFinderOneKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); +#else + vertexFinderKernel1<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + cudaCheck(cudaGetLastError()); + // one block per vertex... + splitVerticesKernel<<>>(soa, ws_d.get(), maxChi2ForSplit); + cudaCheck(cudaGetLastError()); + vertexFinderKernel2<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); +#endif + } else { // five kernels + if (useDensity_) { + clusterTracksByDensityKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useDBSCAN_) { + clusterTracksDBSCAN<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useIterative_) { + clusterTracksIterative<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } + cudaCheck(cudaGetLastError()); + fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFirstFit); + cudaCheck(cudaGetLastError()); + // one block per vertex... + splitVerticesKernel<<>>(soa, ws_d.get(), maxChi2ForSplit); + cudaCheck(cudaGetLastError()); + fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFinalFit); + cudaCheck(cudaGetLastError()); + sortByPt2Kernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); + } + cudaCheck(cudaGetLastError()); +#else // __CUDACC__ + if (useDensity_) { + clusterTracksByDensity(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useDBSCAN_) { + clusterTracksDBSCAN(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useIterative_) { + clusterTracksIterative(soa, ws_d.get(), minT, eps, errmax, chi2max); + } +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "found " << (*ws_d).nvIntermediate << " vertices " << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + fitVertices(soa, ws_d.get(), maxChi2ForFirstFit); + // one block per vertex! + splitVertices(soa, ws_d.get(), maxChi2ForSplit); + fitVertices(soa, ws_d.get(), maxChi2ForFinalFit); + sortByPt2(soa, ws_d.get()); +#endif + + return vertices; + } + +} // namespace gpuVertexFinder + +#endif // RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu index 084763385bdb4..9674eac7d8784 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu @@ -1 +1 @@ -#include "gpuVertexFinderImpl.h" +#include "gpuVertexFinder.cc" diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h deleted file mode 100644 index d685ced488233..0000000000000 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h -#define RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h - -#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" - -#include "gpuClusterTracksByDensity.h" -#include "gpuClusterTracksDBSCAN.h" -#include "gpuClusterTracksIterative.h" -#include "gpuFitVertices.h" -#include "gpuSortByPt2.h" -#include "gpuSplitVertices.h" - -#undef PIXVERTEX_DEBUG_PRODUCE - -namespace gpuVertexFinder { - - // reject outlier tracks that contribute more than this to the chi2 of the vertex fit - constexpr float maxChi2ForFirstFit = 50.f; - constexpr float maxChi2ForFinalFit = 5000.f; - - // split vertices with a chi2/NDoF greater than this - constexpr float maxChi2ForSplit = 9.f; - - __global__ void loadTracks(TkSoA const* ptracks, ZVertexSoA* soa, WorkSpace* pws, float ptMin) { - assert(ptracks); - assert(soa); - auto const& tracks = *ptracks; - auto const& fit = tracks.stateAtBS; - auto const* quality = tracks.qualityData(); - - auto first = blockIdx.x * blockDim.x + threadIdx.x; - for (int idx = first, nt = TkSoA::stride(); idx < nt; idx += gridDim.x * blockDim.x) { - auto nHits = tracks.nHits(idx); - if (nHits == 0) - break; // this is a guard: maybe we need to move to nTracks... - - // initialize soa... - soa->idv[idx] = -1; - - if (nHits < 4) - continue; // no triplets - if (quality[idx] != pixelTrack::Quality::loose) - continue; - - auto pt = tracks.pt(idx); - - if (pt < ptMin) - continue; - - auto& data = *pws; - auto it = atomicAdd(&data.ntrks, 1); - data.itrk[it] = idx; - data.zt[it] = tracks.zip(idx); - data.ezt2[it] = fit.covariance(idx)(14); - data.ptt2[it] = pt * pt; - } - } - -// #define THREE_KERNELS -#ifndef THREE_KERNELS - __global__ void vertexFinderOneKernel(gpuVertexFinder::ZVertices* pdata, - gpuVertexFinder::WorkSpace* pws, - int minT, // min number of neighbours to be "seed" - float eps, // max absolute distance to cluster - float errmax, // max error to be "seed" - float chi2max // max normalized distance to cluster, - ) { - clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFirstFit); - __syncthreads(); - splitVertices(pdata, pws, maxChi2ForSplit); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFinalFit); - __syncthreads(); - sortByPt2(pdata, pws); - } -#else - __global__ void vertexFinderKernel1(gpuVertexFinder::ZVertices* pdata, - gpuVertexFinder::WorkSpace* pws, - int minT, // min number of neighbours to be "seed" - float eps, // max absolute distance to cluster - float errmax, // max error to be "seed" - float chi2max // max normalized distance to cluster, - ) { - clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFirstFit); - } - - __global__ void vertexFinderKernel2(gpuVertexFinder::ZVertices* pdata, gpuVertexFinder::WorkSpace* pws) { - fitVertices(pdata, pws, maxChi2ForFinalFit); - __syncthreads(); - sortByPt2(pdata, pws); - } -#endif - -#ifdef __CUDACC__ - ZVertexHeterogeneous Producer::makeAsync(cudaStream_t stream, TkSoA const* tksoa, float ptMin) const { -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "producing Vertices on GPU" << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - ZVertexHeterogeneous vertices(cms::cuda::make_device_unique(stream)); -#else - ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const { -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "producing Vertices on CPU" << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - ZVertexHeterogeneous vertices(std::make_unique()); -#endif - assert(tksoa); - auto* soa = vertices.get(); - assert(soa); - -#ifdef __CUDACC__ - auto ws_d = cms::cuda::make_device_unique(stream); -#else - auto ws_d = std::make_unique(); -#endif - -#ifdef __CUDACC__ - init<<<1, 1, 0, stream>>>(soa, ws_d.get()); - auto blockSize = 128; - auto numberOfBlocks = (TkSoA::stride() + blockSize - 1) / blockSize; - loadTracks<<>>(tksoa, soa, ws_d.get(), ptMin); - cudaCheck(cudaGetLastError()); -#else - init(soa, ws_d.get()); - loadTracks(tksoa, soa, ws_d.get(), ptMin); -#endif - -#ifdef __CUDACC__ - // Running too many thread lead to problems when printf is enabled. - constexpr int maxThreadsForPrint = 1024 - 256; - constexpr int numBlocks = 1024; - constexpr int threadsPerBlock = 128; - - if (oneKernel_) { - // implemented only for density clustesrs -#ifndef THREE_KERNELS - vertexFinderOneKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); -#else - vertexFinderKernel1<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - cudaCheck(cudaGetLastError()); - // one block per vertex... - splitVerticesKernel<<>>(soa, ws_d.get(), maxChi2ForSplit); - cudaCheck(cudaGetLastError()); - vertexFinderKernel2<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); -#endif - } else { // five kernels - if (useDensity_) { - clusterTracksByDensityKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useDBSCAN_) { - clusterTracksDBSCAN<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useIterative_) { - clusterTracksIterative<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } - cudaCheck(cudaGetLastError()); - fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFirstFit); - cudaCheck(cudaGetLastError()); - // one block per vertex... - splitVerticesKernel<<>>(soa, ws_d.get(), maxChi2ForSplit); - cudaCheck(cudaGetLastError()); - fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFinalFit); - cudaCheck(cudaGetLastError()); - sortByPt2Kernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); - } - cudaCheck(cudaGetLastError()); -#else // __CUDACC__ - if (useDensity_) { - clusterTracksByDensity(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useDBSCAN_) { - clusterTracksDBSCAN(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useIterative_) { - clusterTracksIterative(soa, ws_d.get(), minT, eps, errmax, chi2max); - } -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "found " << (*ws_d).nvIntermediate << " vertices " << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - fitVertices(soa, ws_d.get(), maxChi2ForFirstFit); - // one block per vertex! - splitVertices(soa, ws_d.get(), maxChi2ForSplit); - fitVertices(soa, ws_d.get(), maxChi2ForFinalFit); - sortByPt2(soa, ws_d.get()); -#endif - - return vertices; - } - -} // namespace gpuVertexFinder - -#endif // RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h diff --git a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py index 6f74899c00f03..d47ce2eb339b4 100644 --- a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py +++ b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py @@ -1,4 +1,3 @@ import FWCore.ParameterSet.Config as cms from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import * - diff --git a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py index 24774bbda649c..045738b37dde1 100644 --- a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py +++ b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py @@ -6,7 +6,7 @@ def customizePixelOnlyForProfilingGPUOnly(process): process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('caHitNtupletCUDA', 'pixelVertexCUDA') + eventProducts = cms.untracked.vstring('pixelTracksCUDA', 'pixelVertexCUDA') ) process.consume_step = cms.EndPath(process.consumer) @@ -28,7 +28,7 @@ def customizePixelOnlyForProfilingGPUWithHostCopy(process): #? process.siPixelRecHitSoAFromLegacy.convertToLegacy = False process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('pixelTrackSoA', 'pixelVertexSoA') + eventProducts = cms.untracked.vstring('pixelTracksSoA', 'pixelVertexSoA') ) process.consume_step = cms.EndPath(process.consumer) diff --git a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc index 2c6b0ce9bfa7f..b3a7d0641504e 100644 --- a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc +++ b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc @@ -75,6 +75,9 @@ class ModuleInfo_Phase2 : public edm::EDAnalyzer { private: // ----------member data --------------------------- + edm::ESGetToken geom_esToken; + edm::ESGetToken geomDet_esToken; + edm::ESGetToken topo_esToken; bool fromDDD_; bool printDDD_; }; @@ -104,9 +107,7 @@ ModuleInfo_Phase2::~ModuleInfo_Phase2() { // ------------ method called to produce the data ------------ void ModuleInfo_Phase2::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &iSetup.getData(topo_esToken); edm::LogInfo("ModuleInfo_Phase2") << "begins"; @@ -124,15 +125,12 @@ void ModuleInfo_Phase2::analyze(const edm::Event& iEvent, const edm::EventSetup& // // get the GeometricDet // - edm::ESHandle rDD; + const GeometricDet* rDD = &iSetup.getData(geomDet_esToken); - iSetup.get().get(rDD); - edm::LogInfo("ModuleInfo_Phase2") << " Top node is " << rDD.product() << " " << rDD.product()->name() << std::endl; - edm::LogInfo("ModuleInfo_Phase2") << " And Contains Daughters: " << rDD.product()->deepComponents().size() - << std::endl; + edm::LogInfo("ModuleInfo_Phase2") << " Top node is " << rDD << " " << rDD->name() << std::endl; + edm::LogInfo("ModuleInfo_Phase2") << " And Contains Daughters: " << rDD->deepComponents().size() << std::endl; //first instance tracking geometry - edm::ESHandle pDD; - iSetup.get().get(pDD); + const TrackerGeometry* pDD = &iSetup.getData(geom_esToken); // // counters diff --git a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc index 1daf3e791ba3f..599d343ce5a0f 100644 --- a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc +++ b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc @@ -44,7 +44,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -124,10 +123,13 @@ class Phase2PixelNtuple : public edm::one::EDAnalyzer<> { const GeomDetUnit& det) const; private: - edm::ParameterSet const conf_; + edm::ESGetToken geom_esToken; + edm::ESGetToken topo_esToken; + edm::ESGetToken ttkb_esToken; + edm::ESGetToken tthb_esToken; + TrackerHitAssociator::Config trackerHitAssociatorConfig_; edm::EDGetTokenT> pixelRecHits_token_; - std::string ttrhBuilder_; edm::EDGetTokenT> recoTracks_token_; edm::EDGetTokenT tta_token_; @@ -201,9 +203,12 @@ class Phase2PixelNtuple : public edm::one::EDAnalyzer<> { }; Phase2PixelNtuple::Phase2PixelNtuple(edm::ParameterSet const& conf) - : trackerHitAssociatorConfig_(conf, consumesCollector()), + : geom_esToken(esConsumes()), + topo_esToken(esConsumes()), + ttkb_esToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + tthb_esToken(esConsumes(edm::ESInputTag("", conf.getParameter("ttrhBuilder")))), + trackerHitAssociatorConfig_(conf, consumesCollector()), pixelRecHits_token_(consumes>(edm::InputTag("siPixelRecHits"))), - ttrhBuilder_(conf.getParameter("ttrhBuilder")), //ttrhBuilder_token def recoTracks_token_(consumes>(conf.getParameter("trackProducer"))), tta_token_(consumes(conf.getParameter("trajectoryInput"))), verbose_(conf.getUntrackedParameter("verbose", false)), @@ -337,15 +342,10 @@ void Phase2PixelNtuple::beginJob() { // Functions that gets called by framework every event void Phase2PixelNtuple::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(topo_esToken); // geometry setup - edm::ESHandle geometry; - - es.get().get(geometry); - const TrackerGeometry* theGeometry = &(*geometry); + const TrackerGeometry* theGeometry = &es.getData(geom_esToken); std::vector matched; const PSimHit* closest_simhit = nullptr; @@ -357,14 +357,8 @@ void Phase2PixelNtuple::analyze(const edm::Event& e, const edm::EventSetup& es) TrackerHitAssociator associate(e, trackerHitAssociatorConfig_); //Transient Rechit Builders - edm::ESHandle theB; - es.get().get("TransientTrackBuilder", theB); - - //ttrh builder def - ESHandle hitBuilder; - es.get().get(ttrhBuilder_, hitBuilder); const TkTransientTrackingRecHitBuilder* builder = - static_cast(hitBuilder.product()); + static_cast(&es.getData(tthb_esToken)); auto hitCloner = builder->cloner(); if ((recHitColl.product())->dataSize() > 0) { diff --git a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc index e3c1b84cd4002..c0cfd4e98e345 100644 --- a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc +++ b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc @@ -7,8 +7,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -28,8 +26,6 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" @@ -39,8 +35,6 @@ // Geometry #include "MagneticField/Engine/interface/MagneticField.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h" #include "Geometry/CommonDetUnit/interface/GeomDetType.h" @@ -64,7 +58,9 @@ using namespace edm; using namespace reco; StdHitNtuplizer::StdHitNtuplizer(edm::ParameterSet const& conf) - : conf_(conf), + : geom_esToken(esConsumes()), + topo_esToken(esConsumes()), + conf_(conf), trackerHitAssociatorConfig_(conf, consumesCollector()), src_(conf.getParameter("src")), rphiRecHits_(conf.getParameter("rphiRecHits")), @@ -117,15 +113,10 @@ void StdHitNtuplizer::beginJob() { // Functions that gets called by framework every event void StdHitNtuplizer::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(topo_esToken); // geometry setup - edm::ESHandle geometry; - - es.get().get(geometry); - const TrackerGeometry* theGeometry = &(*geometry); + const TrackerGeometry* theGeometry = &es.getData(geom_esToken); // fastsim rechits //edm::Handle theGSRecHits; diff --git a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h index 044ebc9d88954..1eaa48e8bbd85 100644 --- a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h +++ b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h @@ -30,6 +30,11 @@ #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + class TTree; class TFile; class RectangularPixelTopology; @@ -68,6 +73,8 @@ class StdHitNtuplizer : public edm::EDAnalyzer { void fillPRecHit(const int subid, trackingRecHit_iterator pixeliter, const GeomDet* PixGeom); private: + edm::ESGetToken geom_esToken; + edm::ESGetToken topo_esToken; edm::ParameterSet conf_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; edm::InputTag src_; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml b/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml index 50d08e426a84d..2d57a74056b6b 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml @@ -2,5 +2,10 @@ + + + + + diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc similarity index 81% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 39d61303997bd..965281a03885b 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -1,7 +1,7 @@ // Original Author: Marco Rovere // -#include "LayerClusterAssociatorByEnergyScoreImpl.h" +#include "LCToCPAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" @@ -9,16 +9,16 @@ #include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h" -LayerClusterAssociatorByEnergyScoreImpl::LayerClusterAssociatorByEnergyScoreImpl( +LCToCPAssociatorByEnergyScoreImpl::LCToCPAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr recHitTools, - const std::unordered_map*& hitMap) + const std::unordered_map* hitMap) : hardScatterOnly_(hardScatterOnly), recHitTools_(recHitTools), hitMap_(hitMap), productGetter_(&productGetter) { layers_ = recHitTools_->lastLayerBH(); } -hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle& cCCH, const edm::Handle& cPCH) const { // 1. Extract collections and filter CaloParticles, if required const auto& clusters = *cCCH.product(); @@ -94,37 +94,37 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } #ifdef EDM_ML_DEBUG - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "cPOnLayer INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "cPOnLayer INFO" << std::endl; for (size_t cp = 0; cp < cPOnLayer.size(); ++cp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; for (size_t cpp = 0; cpp < cPOnLayer[cp].size(); ++cpp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticleIdx: " << cPOnLayer[cp][cpp].caloParticleId << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Energy: " << cPOnLayer[cp][cpp].energy << std::endl; double tot_energy = 0.; for (auto const& haf : cPOnLayer[cp][cpp].hits_and_fractions) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" - << lc.second.first << "/" << lc.second.second << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "detIdToCaloParticleId_Map INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "detIdToCaloParticleId_Map INFO" << std::endl; for (auto const& cp : detIdToCaloParticleId_Map) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)cp.first << " we have found the following connections with CaloParticles:" << std::endl; for (auto const& cpp : cp.second) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticle Id: " << cpp.clusterId << " with fraction: " << cpp.fraction << " and energy: " << cpp.fraction * hitMap_->at(cp.first)->energy() << std::endl; } @@ -269,21 +269,14 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" - << "\t" << std::setw(12) << "layerCluster" - << "\t" << std::setw(10) << "lc energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsCP" - << "\t" << std::setw(13) << "maxCPId_byEnergy" - << "\t" << std::setw(20) << "maxEnergySharedLCandCP" - << "\t" << std::setw(22) << "totalCPEnergyOnLayer" - << "\t" << std::setw(22) << "energyFractionOfLCinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinLC" - << "\t" - << "\n"; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") + << std::setw(10) << "LayerId:\t" << std::setw(12) << "layerCluster\t" << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22) << "maxCPId_byNumberOfHits\t" + << std::setw(8) << "nhitsCP\t" << std::setw(13) << "maxCPId_byEnergy\t" << std::setw(20) + << "maxEnergySharedLCandCP\t" << std::setw(22) << "totalCPEnergyOnLayer\t" << std::setw(22) + << "energyFractionOfLCinCP\t" << std::setw(25) << "energyFractionOfCPinLC\t" + << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) @@ -292,37 +285,37 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( << energyFractionOfLCinCP << "\t" << std::setw(25) << energyFractionOfCPinLC << "\n"; } // End of loop over LayerClusters - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "Improved cPOnLayer INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "Improved cPOnLayer INFO" << std::endl; for (size_t cp = 0; cp < cPOnLayer.size(); ++cp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; for (size_t cpp = 0; cpp < cPOnLayer[cp].size(); ++cpp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticleIdx: " << cPOnLayer[cp][cpp].caloParticleId << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Energy: " << cPOnLayer[cp][cpp].energy << std::endl; double tot_energy = 0.; for (auto const& haf : cPOnLayer[cp][cpp].hits_and_fractions) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" - << lc.second.first << "/" << lc.second.second << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "Improved detIdToCaloParticleId_Map INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "Improved detIdToCaloParticleId_Map INFO" << std::endl; for (auto const& cp : detIdToCaloParticleId_Map) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)cp.first << " we have found the following connections with CaloParticles:" << std::endl; for (auto const& cpp : cp.second) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticle Id: " << cpp.clusterId << " with fraction: " << cpp.fraction << " and energy: " << cpp.fraction * hitMap_->at(cp.first)->energy() << std::endl; } @@ -343,8 +336,8 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( if (clusters[lcId].energy() == 0. && !cpsInLayerCluster[lcId].empty()) { for (auto& cpPair : cpsInLayerCluster[lcId]) { cpPair.second = 1.; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t CP id : \t" - << cpPair.first << "\t score \t " << cpPair.second << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t CP id : \t" + << cpPair.first << "\t score \t " << cpPair.second << "\n"; } continue; } @@ -381,9 +374,8 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (cpsInLayerCluster[lcId].empty()) - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " + << "\t score \t-1\n"; #endif } // End of loop over LayerClusters @@ -407,12 +399,12 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( if (CPenergy > 0.f) CPEnergyFractionInLC = maxEnergyLCinCP / CPenergy; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) << "CPNhitsOnLayer\t" << std::setw(18) << "lcWithMaxEnergyInCP\t" << std::setw(15) << "maxEnergyLCinCP\t" << std::setw(20) << "CPEnergyFractionInLC" << "\n"; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) << caloParticles[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) << CPNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInCP << "\t" << std::setw(15) << maxEnergyLCinCP @@ -451,7 +443,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( lcPair.second.second += (lcFraction - cpFraction) * (lcFraction - cpFraction) * hitEnergyWeight * invCPEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "cpDetId:\t" << (uint32_t)cp_hitDetId << "\tlayerClusterId:\t" << layerClusterId << "\t" << "lcfraction,cpfraction:\t" << lcFraction << ", " << cpFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -462,12 +454,11 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of CaloParticle on a Layer #ifdef EDM_ML_DEBUG if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\tLC id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\tLC id:\t-1 " + << "\t score \t-1\n"; for (const auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\t LC id: \t" << lcPair.first << "\t score \t" << lcPair.second.second << "\t shared energy:\t" << lcPair.second.first << "\t shared energy fraction:\t" << (lcPair.second.first / CPenergy) << "\n"; @@ -478,7 +469,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( return {cpsInLayerCluster, cPOnLayer}; } -hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollection LCToCPAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle& cCCH, const edm::Handle& cPCH) const { hgcal::RecoToSimCollection returnValue(productGetter_); const auto& links = makeConnections(cCCH, cPCH); @@ -486,7 +477,7 @@ hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRec const auto& cpsInLayerCluster = std::get<0>(links); for (size_t lcId = 0; lcId < cpsInLayerCluster.size(); ++lcId) { for (auto& cpPair : cpsInLayerCluster[lcId]) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref(cCCH, lcId), // Ref to LC @@ -498,7 +489,7 @@ hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRec return returnValue; } -hgcal::SimToRecoCollection LayerClusterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollection LCToCPAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle& cCCH, const edm::Handle& cPCH) const { hgcal::SimToRecoCollection returnValue(productGetter_); const auto& links = makeConnections(cCCH, cPCH); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h similarity index 84% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index b14c4b3d9de06..346c3d64d2bba 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -44,12 +44,12 @@ namespace hgcal { typedef std::tuple association; } // namespace hgcal -class LayerClusterAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloParticleAssociatorBaseImpl { +class LCToCPAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloParticleAssociatorBaseImpl { public: - explicit LayerClusterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, - bool, - std::shared_ptr, - const std::unordered_map *&); + explicit LCToCPAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + bool, + std::shared_ptr, + const std::unordered_map *); hgcal::RecoToSimCollection associateRecoToSim(const edm::Handle &cCH, const edm::Handle &cPCH) const override; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc similarity index 61% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc index 760de51a17bb2..9187c7eac3202 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" -#include "LayerClusterAssociatorByEnergyScoreImpl.h" +#include "LCToCPAssociatorByEnergyScoreImpl.h" -class LayerClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class LCToCPAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit LayerClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~LayerClusterAssociatorByEnergyScoreProducer() override; + explicit LCToCPAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~LCToCPAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class LayerClusterAssociatorByEnergyScoreProducer : public edm::global::EDProduc std::shared_ptr rhtools_; }; -LayerClusterAssociatorByEnergyScoreProducer::LayerClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +LCToCPAssociatorByEnergyScoreProducer::LCToCPAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes>(ps.getParameter("hitMapTag"))), caloGeometry_(esConsumes()), hardScatterOnly_(ps.getParameter("hardScatterOnly")) { @@ -39,23 +39,23 @@ LayerClusterAssociatorByEnergyScoreProducer::LayerClusterAssociatorByEnergyScore produces(); } -LayerClusterAssociatorByEnergyScoreProducer::~LayerClusterAssociatorByEnergyScoreProducer() {} +LCToCPAssociatorByEnergyScoreProducer::~LCToCPAssociatorByEnergyScoreProducer() {} -void LayerClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, - edm::Event &iEvent, - const edm::EventSetup &es) const { +void LCToCPAssociatorByEnergyScoreProducer::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &es) const { edm::ESHandle geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique( - iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); + auto impl = + std::make_unique(iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique(std::move(impl)); iEvent.put(std::move(toPut)); } -void LayerClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void LCToCPAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add("hardScatterOnly", true); @@ -64,4 +64,4 @@ void LayerClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configur } //define this as a plug-in -DEFINE_FWK_MODULE(LayerClusterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(LCToCPAssociatorByEnergyScoreProducer); diff --git a/SimDataFormats/Associations/plugins/LCToCPAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc similarity index 96% rename from SimDataFormats/Associations/plugins/LCToCPAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc index f88b4dc625be6..41d1af3018340 100644 --- a/SimDataFormats/Associations/plugins/LCToCPAssociatorEDProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc @@ -73,12 +73,10 @@ void LCToCPAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, cons iEvent.getByToken(LCCollectionToken_, LCCollection); // associate LC and CP - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; hgcal::RecoToSimCollection recSimColl = theAssociator->associateRecoToSim(LCCollection, CPCollection); - LogTrace("AssociatorValidator") << "Calling associateSimToReco method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; hgcal::SimToRecoCollection simRecColl = theAssociator->associateSimToReco(LCCollection, CPCollection); auto rts = std::make_unique(recSimColl); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc similarity index 88% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc index 935898ccd6af1..091a29353c23f 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc @@ -1,9 +1,9 @@ -#include "SimClusterAssociatorByEnergyScoreImpl.h" +#include "LCToSCAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -SimClusterAssociatorByEnergyScoreImpl::SimClusterAssociatorByEnergyScoreImpl( +LCToSCAssociatorByEnergyScoreImpl::LCToSCAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr recHitTools, @@ -12,7 +12,7 @@ SimClusterAssociatorByEnergyScoreImpl::SimClusterAssociatorByEnergyScoreImpl( layers_ = recHitTools_->lastLayerBH(); } -hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle& cCCH, const edm::Handle& sCCH) const { // Get collections const auto& clusters = *cCCH.product(); @@ -26,7 +26,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( for (unsigned int scId = 0; scId < nSimClusters; ++scId) { if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; @@ -74,40 +74,40 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // end of loop over SimClusters #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "lcsInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; for (size_t sc = 0; sc < lcsInSimCluster.size(); ++sc) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; for (size_t sclay = 0; sclay < lcsInSimCluster[sc].size(); ++sclay) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << lcsInSimCluster[sc][sclay].simClusterId << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Energy: " << lcsInSimCluster[sc][sclay].energy << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; double tot_energy = 0.; for (auto const& haf : lcsInSimCluster[sc][sclay].hits_and_fractions) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : lcsInSimCluster[sc][sclay].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -261,7 +261,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" << "\t" << std::setw(12) << "layerCluster" << "\t" << std::setw(10) << "lc energy" << "\t" << std::setw(5) << "nhits" @@ -275,7 +275,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( << "\t" << std::setw(25) << "energyFractionOfSCinLC" << "\t" << "\n"; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) @@ -284,39 +284,39 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( << energyFractionOfLCinSC << "\t" << std::setw(25) << energyFractionOfSCinLC << "\n"; } // End of loop over LayerClusters - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Improved lcsInSimCluster INFO (Now containing the linked layer clusters id and energy - score still empty)" << std::endl; for (size_t sc = 0; sc < lcsInSimCluster.size(); ++sc) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; for (size_t sclay = 0; sclay < lcsInSimCluster[sc].size(); ++sclay) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << lcsInSimCluster[sc][sclay].simClusterId << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Energy: " << lcsInSimCluster[sc][sclay].energy << std::endl; double tot_energy = 0.; for (auto const& haf : lcsInSimCluster[sc][sclay].hits_and_fractions) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : lcsInSimCluster[sc][sclay].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -338,7 +338,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( if (clusters[lcId].energy() == 0. && !scsInLayerCluster[lcId].empty()) { for (auto& scPair : scsInLayerCluster[lcId]) { scPair.second = 1.; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t SC id : \t" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t SC id : \t" << scPair.first << "\t score \t " << scPair.second << "\n"; } continue; @@ -373,7 +373,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( scPair.second += (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invLayerClusterEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "rh_detid:\t" << (uint32_t)rh_detid << "\tlayerClusterId:\t" << lcId << "\t" << "rhfraction,scfraction:\t" << rhFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -384,7 +384,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (scsInLayerCluster[lcId].empty()) - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tSC id:\t-1 " + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tSC id:\t-1 " << "\t score \t-1" << "\n"; #endif @@ -412,12 +412,12 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( if (SCenergy > 0.f) SCEnergyFractionInLC = maxEnergyLCinSC / SCenergy; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(8) << "LayerId:\t" << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "lcWithMaxEnergyInSC\t" << std::setw(15) << "maxEnergyLCinSC\t" << std::setw(20) << "SCEnergyFractionInLC" << "\n"; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(8) << layerId << "\t" << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyLCinSC << "\t" @@ -456,7 +456,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( lcPair.second.second += (lcFraction - scFraction) * (lcFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "scDetId:\t" << (uint32_t)sc_hitDetId << "\tlayerClusterId:\t" << layerClusterId << "\t" << "lcfraction,scfraction:\t" << lcFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -467,12 +467,12 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of SimCluster on a Layer #ifdef EDM_ML_DEBUG if (lcsInSimCluster[scId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tLC id:\t-1 " + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tLC id:\t-1 " << "\t score \t-1" << "\n"; for (const auto& lcPair : lcsInSimCluster[scId][layerId].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\t LC id: \t" << lcPair.first << "\t score \t" << lcPair.second.second << "\t shared energy:\t" << lcPair.second.first << "\t shared energy fraction:\t" << (lcPair.second.first / SCenergy) << "\n"; @@ -483,7 +483,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( return {scsInLayerCluster, lcsInSimCluster}; } -hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollectionWithSimClusters LCToSCAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle& cCCH, const edm::Handle& sCCH) const { hgcal::RecoToSimCollectionWithSimClusters returnValue(productGetter_); const auto& links = makeConnections(cCCH, sCCH); @@ -491,7 +491,7 @@ hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl: const auto& scsInLayerCluster = std::get<0>(links); for (size_t lcId = 0; lcId < scsInLayerCluster.size(); ++lcId) { for (auto& scPair : scsInLayerCluster[lcId]) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\t SC id: \t" << scPair.first << "\t score \t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref(cCCH, lcId), // Ref to LC @@ -503,7 +503,7 @@ hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl: return returnValue; } -hgcal::SimToRecoCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollectionWithSimClusters LCToSCAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle& cCCH, const edm::Handle& sCCH) const { hgcal::SimToRecoCollectionWithSimClusters returnValue(productGetter_); const auto& links = makeConnections(cCCH, sCCH); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h similarity index 92% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index 3bee92f577b83..fbcd3882bdb5e 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -1,4 +1,4 @@ -// Original Author: Marco Rovere +// Original Author: Leonardo Cristella #include #include @@ -44,9 +44,9 @@ namespace hgcal { typedef std::tuple association; } // namespace hgcal -class SimClusterAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToSimClusterAssociatorBaseImpl { +class LCToSCAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToSimClusterAssociatorBaseImpl { public: - explicit SimClusterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + explicit LCToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr, const std::unordered_map *); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc similarity index 68% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc index bb4a6784da136..c8549133f52d6 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc @@ -1,4 +1,4 @@ -// Original author: Marco Rovere +// Original author: Leonardo Cristella // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" -#include "SimClusterAssociatorByEnergyScoreImpl.h" +#include "LCToSCAssociatorByEnergyScoreImpl.h" -class SimClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class LCToSCAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit SimClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~SimClusterAssociatorByEnergyScoreProducer() override; + explicit LCToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~LCToSCAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class SimClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer std::shared_ptr rhtools_; }; -SimClusterAssociatorByEnergyScoreProducer::SimClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +LCToSCAssociatorByEnergyScoreProducer::LCToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes>(ps.getParameter("hitMapTag"))), caloGeometry_(esConsumes()), hardScatterOnly_(ps.getParameter("hardScatterOnly")) { @@ -39,23 +39,23 @@ SimClusterAssociatorByEnergyScoreProducer::SimClusterAssociatorByEnergyScoreProd produces(); } -SimClusterAssociatorByEnergyScoreProducer::~SimClusterAssociatorByEnergyScoreProducer() {} +LCToSCAssociatorByEnergyScoreProducer::~LCToSCAssociatorByEnergyScoreProducer() {} -void SimClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, +void LCToSCAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &es) const { edm::ESHandle geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique( + auto impl = std::make_unique( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique(std::move(impl)); iEvent.put(std::move(toPut)); } -void SimClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void LCToSCAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add("hardScatterOnly", true); @@ -64,4 +64,4 @@ void SimClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configurat } //define this as a plug-in -DEFINE_FWK_MODULE(SimClusterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(LCToSCAssociatorByEnergyScoreProducer); diff --git a/SimDataFormats/Associations/plugins/LCToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc similarity index 96% rename from SimDataFormats/Associations/plugins/LCToSCAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc index 2a0e71e0cd730..6edda534b56ef 100644 --- a/SimDataFormats/Associations/plugins/LCToSCAssociatorEDProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc @@ -72,12 +72,10 @@ void LCToSCAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, cons iEvent.getByToken(LCCollectionToken_, LCCollection); // associate LC and SC - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; hgcal::RecoToSimCollectionWithSimClusters recSimColl = theAssociator->associateRecoToSim(LCCollection, SCCollection); - LogTrace("AssociatorValidator") << "Calling associateSimToReco method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; hgcal::SimToRecoCollectionWithSimClusters simRecColl = theAssociator->associateSimToReco(LCCollection, SCCollection); auto rts = std::make_unique(recSimColl); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc similarity index 81% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc index 6c78e2e6cfe5f..f93a9f3c1a99d 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc @@ -1,9 +1,9 @@ -#include "TracksterAssociatorByEnergyScoreImpl.h" +#include "TSToSCAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -TracksterAssociatorByEnergyScoreImpl::TracksterAssociatorByEnergyScoreImpl( +TSToSCAssociatorByEnergyScoreImpl::TSToSCAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr recHitTools, @@ -12,7 +12,7 @@ TracksterAssociatorByEnergyScoreImpl::TracksterAssociatorByEnergyScoreImpl( layers_ = recHitTools_->lastLayerBH(); } -hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle& tCH, const edm::Handle& lCCH, const edm::Handle& sCCH) const { @@ -29,7 +29,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( for (unsigned int scId = 0; scId < nSimClusters; ++scId) { if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; @@ -71,37 +71,36 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // end of loop over SimClusters #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "tssInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " Energy: " << tssInSimCluster[sc].energy << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\tSimClusterIdx:\t" << tssInSimCluster[sc].simClusterId << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\t# of clusters:\t" << layerClusters.size() << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; for (auto const& detId : detIdToSimClusterId_Map) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)detId.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sc : detId.second) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " SimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\tSimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction << " and energy: " << sc.fraction * hitMap_->at(detId.first)->energy() << std::endl; } } @@ -253,21 +252,14 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << std::setw(12) << "TracksterID:" - << "\t" << std::setw(12) << "layerCluster" - << "\t" << std::setw(10) << "lc energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxSCId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsSC" - << "\t" << std::setw(13) << "maxSCId_byEnergy" - << "\t" << std::setw(20) << "maxEnergySharedLCandSC" - << "\t" << std::setw(22) << "totalSCEnergyOnLayer" - << "\t" << std::setw(22) << "energyFractionOfLCinSC" - << "\t" << std::setw(25) << "energyFractionOfSCinLC" - << "\t" - << "\n"; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << std::setw(12) << "TracksterID:\t" << std::setw(12) << "layerCluster\t" << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22) << "maxSCId_byNumberOfHits\t" + << std::setw(8) << "nhitsSC\t" << std::setw(13) << "maxSCId_byEnergy\t" << std::setw(20) + << "maxEnergySharedLCandSC\t" << std::setw(22) << "totalSCEnergyOnLayer\t" << std::setw(22) + << "energyFractionOfLCinSC\t" << std::setw(25) << "energyFractionOfSCinLC\t" + << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << tsId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << tracksters[tsId].raw_energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) @@ -277,36 +269,35 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over LayerClusters in Trackster } // End of loop over Tracksters - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Improved tssInSimCluster INFO (Now containing the linked tracksters id and energy - score still empty)" << std::endl; for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " Energy: " << tssInSimCluster[sc].energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -327,8 +318,8 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { for (auto& scPair : scsInTrackster[tsId]) { scPair.second = 1.; - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "TracksterId : \t " << tsId << "\t SC id : \t" - << scPair.first << "\t score \t " << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "TracksterId:\t " << tsId << "\tSC id:\t" << scPair.first << "\tscore\t " << scPair.second << "\n"; } continue; } @@ -375,7 +366,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( scPair.second += (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invTracksterEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "rh_detid:\t" << (uint32_t)rh_detid << "\ttracksterId:\t" << tsId << "\t" << "rhfraction,scFraction:\t" << rhFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -388,9 +379,8 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG if (scsInTrackster[tsId].empty()) - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "trackster Id: \t" << tsId << "\tSC id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "trackster Id:\t" << tsId << "\tSC id:\t-1" + << "\tscore\t-1\n"; #endif } // End of loop over Tracksters @@ -417,12 +407,12 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( if (SCenergy > 0.f) SCEnergyFractionInTS = maxEnergyTSinSC / SCenergy; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "tsWithMaxEnergyInSC\t" << std::setw(15) << "maxEnergyTSinSC\t" << std::setw(20) << "SCEnergyFractionInTS" << "\n"; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << tsWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyTSinSC << "\t" << std::setw(20) << SCEnergyFractionInTS << "\n"; @@ -464,8 +454,8 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( tsPair.second.second += (tsFraction - scFraction) * (tsFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") - << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tracksterId << "\t" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tsId << "\t" << "tsFraction, scFraction:\t" << tsFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" << "current score:\t" << tsPair.second.second << "\t" @@ -476,12 +466,11 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of SimCluster on a Layer #ifdef EDM_ML_DEBUG if (tssInSimCluster[scId].tracksterIdToEnergyAndScore.empty()) - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tTS id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id:\t" << scId << "\tTS id:\t-1 " + << "\tscore\t-1\n"; for (const auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\t TS id: \t" << tsPair.first << "\t score \t" << tsPair.second.second << "\t shared energy:\t" << tsPair.second.first << "\t shared energy fraction:\t" << (tsPair.second.first / SCenergy) << "\n"; @@ -491,7 +480,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( return {scsInTrackster, tssInSimCluster}; } -hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle& tCH, const edm::Handle& lCCH, const edm::Handle& sCCH) const { @@ -501,8 +490,8 @@ hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::assoc const auto& scsInTrackster = std::get<0>(links); for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { for (auto& scPair : scsInTrackster[tsId]) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Trackster Id: \t" << tsId << "\t SimCluster id: \t" - << scPair.first << "\t score \t" << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "Trackster Id:\t" << tsId << "\tSimCluster id:\t" << scPair.first << "\tscore:\t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref(tCH, tsId), // Ref to TS std::make_pair(edm::Ref(sCCH, scPair.first), @@ -513,7 +502,7 @@ hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::assoc return returnValue; } -hgcal::SimToRecoCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle& tCH, const edm::Handle& lCCH, const edm::Handle& sCCH) const { diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h similarity index 93% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h index 8c75d5af38797..0a3eef9051760 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h @@ -37,9 +37,9 @@ namespace hgcal { typedef std::tuple association; } // namespace hgcal -class TracksterAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl { +class TSToSCAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl { public: - explicit TracksterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + explicit TSToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr, const std::unordered_map *); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc similarity index 69% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc index 8bd086a89574d..72c51329c0719 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" -#include "TracksterAssociatorByEnergyScoreImpl.h" +#include "TSToSCAssociatorByEnergyScoreImpl.h" -class TracksterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class TSToSCAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~TracksterAssociatorByEnergyScoreProducer() override; + explicit TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~TSToSCAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class TracksterAssociatorByEnergyScoreProducer : public edm::global::EDProducer< std::shared_ptr rhtools_; }; -TracksterAssociatorByEnergyScoreProducer::TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +TSToSCAssociatorByEnergyScoreProducer::TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes>(ps.getParameter("hitMapTag"))), caloGeometry_(esConsumes()), hardScatterOnly_(ps.getParameter("hardScatterOnly")) { @@ -39,23 +39,23 @@ TracksterAssociatorByEnergyScoreProducer::TracksterAssociatorByEnergyScoreProduc produces(); } -TracksterAssociatorByEnergyScoreProducer::~TracksterAssociatorByEnergyScoreProducer() {} +TSToSCAssociatorByEnergyScoreProducer::~TSToSCAssociatorByEnergyScoreProducer() {} -void TracksterAssociatorByEnergyScoreProducer::produce(edm::StreamID, +void TSToSCAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &es) const { edm::ESHandle geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique( + auto impl = std::make_unique( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique(std::move(impl)); iEvent.put(std::move(toPut)); } -void TracksterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void TSToSCAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add("hardScatterOnly", true); @@ -64,4 +64,4 @@ void TracksterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configurati } //define this as a plug-in -DEFINE_FWK_MODULE(TracksterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(TSToSCAssociatorByEnergyScoreProducer); diff --git a/SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc similarity index 100% rename from SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc diff --git a/SimDataFormats/Associations/plugins/BuildFile.xml b/SimDataFormats/Associations/plugins/BuildFile.xml deleted file mode 100644 index cb5fa596704db..0000000000000 --- a/SimDataFormats/Associations/plugins/BuildFile.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/SimDataFormats/CaloHit/interface/MaterialInformation.h b/SimDataFormats/CaloHit/interface/MaterialInformation.h new file mode 100644 index 0000000000000..7e468f617ce7a --- /dev/null +++ b/SimDataFormats/CaloHit/interface/MaterialInformation.h @@ -0,0 +1,54 @@ +#ifndef SimDataFormats_CaloHit_MaterialInformation_H +#define SimDataFormats_CaloHit_MaterialInformation_H + +#include +#include + +// Persistent information about steps in material + +class MaterialInformation { +public: + MaterialInformation( + std::string vname, int id = 0, float eta = 0, float phi = 0, float length = 0, float radlen = 0, float intlen = 0) + : vname_(vname), id_(id), eta_(eta), phi_(phi), length_(length), radlen_(radlen), intlen_(intlen) {} + MaterialInformation() : vname_(""), id_(0), eta_(0), phi_(0), length_(0), radlen_(0), intlen_(0) {} + + //Names + static const char *name() { return "MaterialInformation"; } + const char *getName() const { return name(); } + std::string vname() const { return vname_; } + int id() const { return id_; } + void setID(int i) { id_ = i; } + + //Track eta, phi + double trackEta() const { return eta_; } + void setTrackEta(double e) { eta_ = e; } + double trackPhi() const { return eta_; } + void setTrackPhi(double f) { phi_ = f; } + + //Lengths + double stepLength() const { return length_; } + void setStepLength(double l) { length_ = l; } + double radiationLength() const { return radlen_; } + void setRadiationLength(double r) { radlen_ = r; } + double interactionLength() const { return intlen_; } + void setInteractionLength(double i) { intlen_ = i; } + +protected: + std::string vname_; + int id_; + float eta_; + float phi_; + float length_; + float radlen_; + float intlen_; +}; + +namespace edm { + typedef std::vector MaterialInformationContainer; +} // namespace edm + +#include +std::ostream &operator<<(std::ostream &, const MaterialInformation &); + +#endif // _SimDataFormats_CaloHit_MaterialInformation_h_ diff --git a/SimDataFormats/CaloHit/src/MaterialInformation.cc b/SimDataFormats/CaloHit/src/MaterialInformation.cc new file mode 100644 index 0000000000000..0ba0979e73911 --- /dev/null +++ b/SimDataFormats/CaloHit/src/MaterialInformation.cc @@ -0,0 +1,11 @@ +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" +#include +#include + +std::ostream& operator<<(std::ostream& o, const MaterialInformation& info) { + o << info.vname() << " ID " << info.id() << " Eta:Phi " << info.trackEta() << ":" << info.trackPhi() + << " Step Length " << std::setw(10) << info.stepLength() << " Radiation Length " << std::setw(10) + << info.radiationLength() << " Interaction Length " << std::setw(10) << info.interactionLength(); + + return o; +} diff --git a/SimDataFormats/CaloHit/src/classes.h b/SimDataFormats/CaloHit/src/classes.h index 7d47b4fcc3c00..1aac6976e0f15 100644 --- a/SimDataFormats/CaloHit/src/classes.h +++ b/SimDataFormats/CaloHit/src/classes.h @@ -2,6 +2,7 @@ #include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h" #include "SimDataFormats/CaloHit/interface/HFShowerLibraryEventInfo.h" #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h" +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloHit/interface/PassiveHit.h" diff --git a/SimDataFormats/CaloHit/src/classes_def.xml b/SimDataFormats/CaloHit/src/classes_def.xml index 6e7cbbd897498..07f1ddb950ce4 100644 --- a/SimDataFormats/CaloHit/src/classes_def.xml +++ b/SimDataFormats/CaloHit/src/classes_def.xml @@ -38,4 +38,10 @@ + + + + + + diff --git a/SimG4Core/Application/src/StackingAction.cc b/SimG4Core/Application/src/StackingAction.cc index d488fa586d31c..ac241f5cce94a 100644 --- a/SimG4Core/Application/src/StackingAction.cc +++ b/SimG4Core/Application/src/StackingAction.cc @@ -171,8 +171,8 @@ StackingAction::~StackingAction() { delete newTA; } G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrack) { // G4 interface part G4ClassificationOfNewTrack classification = fUrgent; - int pdg = aTrack->GetDefinition()->GetPDGEncoding(); - int abspdg = std::abs(pdg); + const int pdg = aTrack->GetDefinition()->GetPDGEncoding(); + const int abspdg = std::abs(pdg); // primary if (aTrack->GetCreatorProcess() == nullptr || aTrack->GetParentID() == 0) { @@ -208,13 +208,13 @@ G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrac } else { // potentially good for tracking - double ke = aTrack->GetKineticEnergy(); + const double ke = aTrack->GetKineticEnergy(); // kill tracks in specific regions - if (classification != fKill && isThisRegion(reg, deadRegions)) { + if (isThisRegion(reg, deadRegions)) { classification = fKill; } - if (ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) { + if (classification != fKill && ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) { classification = fKill; } else { @@ -346,14 +346,14 @@ void StackingAction::PrepareNewEvent() {} void StackingAction::initPointer() { // prepare region vector - unsigned int num = maxTimeNames.size(); + const unsigned int num = maxTimeNames.size(); maxTimeRegions.resize(num, nullptr); // Russian roulette - std::vector* rs = G4RegionStore::GetInstance(); + const std::vector* rs = G4RegionStore::GetInstance(); for (auto& reg : *rs) { - G4String rname = reg->GetName(); + const G4String& rname = reg->GetName(); if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0) && rname == "EcalRegion") { regionEcal = reg; } @@ -434,8 +434,8 @@ bool StackingAction::rrApplicable(const G4Track* aTrack, const G4Track& mother) const TrackInformation& motherInfo(extractor(mother)); // Check whether mother is gamma, e+, e- - int genID = motherInfo.genParticlePID(); - return (22 == genID || 11 == genID || -11 == genID) ? false : true; + const int genID = std::abs(motherInfo.genParticlePID()); + return (22 != genID && 11 != genID); } int StackingAction::isItFromPrimary(const G4Track& mother, int flagIn) const { @@ -457,7 +457,7 @@ bool StackingAction::isItOutOfTimeWindow(const G4Region* reg, const G4Track* aTr break; } } - return (aTrack->GetGlobalTime() > tofM) ? true : false; + return (aTrack->GetGlobalTime() > tofM); } void StackingAction::printRegions(const std::vector& reg, const std::string& word) const { diff --git a/SimG4Core/Application/src/SteppingAction.cc b/SimG4Core/Application/src/SteppingAction.cc index 112fa02862150..a0442c5b4f92c 100644 --- a/SimG4Core/Application/src/SteppingAction.cc +++ b/SimG4Core/Application/src/SteppingAction.cc @@ -103,7 +103,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { // NaN energy deposit if (sAlive == tstat && edm::isNotFinite(aStep->GetTotalEnergyDeposit())) { tstat = sEnergyDepNaN; - if (nWarnings < 20) { + if (nWarnings < 5) { ++nWarnings; edm::LogWarning("SimG4CoreApplication") << "Track #" << theTrack->GetTrackID() << " " << theTrack->GetDefinition()->GetParticleName() @@ -138,34 +138,33 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { } // kill low-energy in vacuum - G4double kinEnergy = theTrack->GetKineticEnergy(); + const G4double kinEnergy = theTrack->GetKineticEnergy(); if (sAlive == tstat && killBeamPipe && kinEnergy < theCriticalEnergyForVacuum && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity() <= theCriticalDensity) { tstat = sLowEnergyInVacuum; } + } + // check transition tracker/calo + if (sAlive == tstat || sVeryForward == tstat) { + if (isThisVolume(preStep->GetTouchable(), tracker) && isThisVolume(postStep->GetTouchable(), calo)) { + math::XYZVectorD pos((preStep->GetPosition()).x(), (preStep->GetPosition()).y(), (preStep->GetPosition()).z()); - // check transition tracker/calo - if (sAlive == tstat || sVeryForward == tstat) { - if (isThisVolume(preStep->GetTouchable(), tracker) && isThisVolume(postStep->GetTouchable(), calo)) { - math::XYZVectorD pos((preStep->GetPosition()).x(), (preStep->GetPosition()).y(), (preStep->GetPosition()).z()); - - math::XYZTLorentzVectorD mom((preStep->GetMomentum()).x(), - (preStep->GetMomentum()).y(), - (preStep->GetMomentum()).z(), - preStep->GetTotalEnergy()); + math::XYZTLorentzVectorD mom((preStep->GetMomentum()).x(), + (preStep->GetMomentum()).y(), + (preStep->GetMomentum()).z(), + preStep->GetTotalEnergy()); - uint32_t id = theTrack->GetTrackID(); + uint32_t id = theTrack->GetTrackID(); - std::pair p(pos, mom); - eventAction_->addTkCaloStateInfo(id, p); - } - } else { - theTrack->SetTrackStatus(fStopAndKill); + std::pair p(pos, mom); + eventAction_->addTkCaloStateInfo(id, p); + } + } else { + theTrack->SetTrackStatus(fStopAndKill); #ifdef DebugLog - PrintKilledTrack(theTrack, tstat); + PrintKilledTrack(theTrack, tstat); #endif - } } if (nullptr != steppingVerbose) { steppingVerbose->NextStep(aStep, fpSteppingManager, (1 < tstat)); @@ -175,7 +174,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { bool SteppingAction::isLowEnergy(const G4Step* aStep) const { const G4StepPoint* sp = aStep->GetPostStepPoint(); const G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume(); - double ekin = sp->GetKineticEnergy(); + const double ekin = sp->GetKineticEnergy(); int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding(); for (auto& vol : ekinVolumes) { @@ -193,36 +192,28 @@ bool SteppingAction::isLowEnergy(const G4Step* aStep) const { bool SteppingAction::initPointer() { const G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance(); - if (pvs) { - std::vector::const_iterator pvcite; - for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) { - if ((*pvcite)->GetName() == "Tracker") - tracker = (*pvcite); - if ((*pvcite)->GetName() == "CALO") - calo = (*pvcite); - if (tracker && calo) - break; - } - if (tracker || calo) { - edm::LogVerbatim("SimG4CoreApplication") << "Pointer for Tracker " << tracker << " and for Calo " << calo; - if (tracker) - LogDebug("SimG4CoreApplication") << "Tracker vol name " << tracker->GetName(); - if (calo) - LogDebug("SimG4CoreApplication") << "Calorimeter vol name " << calo->GetName(); - } + for (auto const& pvcite : *pvs) { + const G4String& pvname = pvcite->GetName(); + if (pvname == "Tracker") + tracker = pvcite; + else if (pvname == "CALO") + calo = pvcite; + + if (tracker && calo) + break; } + edm::LogVerbatim("SimG4CoreApplication") + << "SteppingAction: pointer for Tracker " << tracker << " and for Calo " << calo; const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); if (numberEkins > 0) { - if (lvs) { - ekinVolumes.resize(numberEkins, nullptr); - std::vector::const_iterator lvcite; - for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) { - for (unsigned int i = 0; i < numberEkins; ++i) { - if ((*lvcite)->GetName() == (G4String)(ekinNames[i])) { - ekinVolumes[i] = (*lvcite); - break; - } + ekinVolumes.resize(numberEkins, nullptr); + for (auto const& lvcite : *lvs) { + const G4String& lvname = lvcite->GetName(); + for (unsigned int i = 0; i < numberEkins; ++i) { + if (lvname == (G4String)(ekinNames[i])) { + ekinVolumes[i] = lvcite; + break; } } } @@ -233,10 +224,11 @@ bool SteppingAction::initPointer() { if (numberPart > 0) { G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); - G4String partName; ekinPDG.resize(numberPart, 0); for (unsigned int i = 0; i < numberPart; ++i) { - ekinPDG[i] = theParticleTable->FindParticle(partName = ekinParticles[i])->GetPDGEncoding(); + const G4ParticleDefinition* part = theParticleTable->FindParticle(ekinParticles[i]); + if (nullptr != part) + ekinPDG[i] = part->GetPDGEncoding(); edm::LogVerbatim("SimG4CoreApplication") << "Particle " << ekinParticles[i] << " with PDG code " << ekinPDG[i] << " and KE cut off " << ekinMins[i] / MeV << " MeV"; } @@ -245,11 +237,11 @@ bool SteppingAction::initPointer() { const G4RegionStore* rs = G4RegionStore::GetInstance(); if (numberTimes > 0) { maxTimeRegions.resize(numberTimes, nullptr); - std::vector::const_iterator rcite; - for (rcite = rs->begin(); rcite != rs->end(); ++rcite) { + for (auto const& rcite : *rs) { + const G4String& rname = rcite->GetName(); for (unsigned int i = 0; i < numberTimes; ++i) { - if ((*rcite)->GetName() == (G4String)(maxTimeNames[i])) { - maxTimeRegions[i] = (*rcite); + if (rname == (G4String)(maxTimeNames[i])) { + maxTimeRegions[i] = rcite; break; } } @@ -257,11 +249,11 @@ bool SteppingAction::initPointer() { } if (ndeadRegions > 0) { deadRegions.resize(ndeadRegions, nullptr); - std::vector::const_iterator rcite; - for (rcite = rs->begin(); rcite != rs->end(); ++rcite) { + for (auto const& rcite : *rs) { + const G4String& rname = rcite->GetName(); for (unsigned int i = 0; i < ndeadRegions; ++i) { - if ((*rcite)->GetName() == (G4String)(deadRegionNames[i])) { - deadRegions[i] = (*rcite); + if (rname == (G4String)(deadRegionNames[i])) { + deadRegions[i] = rcite; break; } } diff --git a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h index 68bc7d70abd3c..f2ff65f159b0a 100644 --- a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h +++ b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h @@ -23,7 +23,7 @@ class CMSHadronPhysicsFTFP_BERT : public G4HadronPhysicsFTFP_BERT { public: explicit CMSHadronPhysicsFTFP_BERT(G4int verb); - explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3); + explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5); ~CMSHadronPhysicsFTFP_BERT() override; void ConstructProcess() override; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc index 93ada83904c43..4f368bed9fd82 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc @@ -8,23 +8,18 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: FTFP_BERT \n Flags for EM Physics " << emPhys - << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV - << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics @@ -39,25 +34,16 @@ FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc index 11aad9d53634b..9ff708e9a137e 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc @@ -7,22 +7,17 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" #include "G4EmStandardPhysics_option1.hh" FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EML: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EML: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; @@ -39,25 +34,16 @@ FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc index 22d99bcd6afce..69d8bd29e1c31 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc @@ -1,8 +1,6 @@ #include "FTFPCMS_BERT_EMM.h" #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" -#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -10,27 +8,22 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMM: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMM: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n Transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << "; for pions to " << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); @@ -41,25 +34,16 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT106(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc index 488d1fd53e8ba..ebd722c2f8f3a 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc @@ -8,51 +8,30 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMM_TRK::FTFPCMS_BERT_EMM_TRK(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); - bool emPhys = p.getUntrackedParameter("EMPhysics", true); - bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "FTFP_BERT_EMM_TRK \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " - << hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns; - - if (emPhys) { - // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver, p)); - - // Synchroton Radiation & GN Physics - G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); - RegisterPhysics(gn); - } + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMM_TRK"; - // Decays - this->RegisterPhysics(new G4DecayPhysics(ver)); + // EM physics + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); - if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); + // gamma and lepto-nuclear physics + RegisterPhysics(new G4EmExtraPhysics(ver)); - // Hadron Elastic scattering - RegisterPhysics(new G4HadronElasticPhysics(ver)); + // Decays + RegisterPhysics(new G4DecayPhysics(ver)); - // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(ver)); + // Hadron elastic scattering + RegisterPhysics(new G4HadronElasticPhysics(ver)); - // Stopping Physics - RegisterPhysics(new G4StoppingPhysics(ver)); + // Hadron inelastic physics + RegisterPhysics( + new CMSHadronPhysicsFTFP_BERT(3 * CLHEP::GeV, 6 * CLHEP::GeV, 12 * CLHEP::GeV, 2 * CLHEP::GeV, 4 * CLHEP::GeV)); - // Ion Physics - RegisterPhysics(new G4IonPhysics(ver)); + // Stopping physics + RegisterPhysics(new G4StoppingPhysics(ver)); - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } - } + // Ion physics + RegisterPhysics(new G4IonPhysics(ver)); } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc index 1cf4cb0e6b1ab..8169310af657c 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc @@ -8,21 +8,16 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMN: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMN: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; @@ -39,25 +34,16 @@ FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc index ea0c4e7f0edbb..6b52097af8182 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc @@ -8,29 +8,22 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" -#include "G4EmParameters.hh" FTFPCMS_BERT_EMY::FTFPCMS_BERT_EMY(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMY \n Flags for EM Physics " - << emPhys << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" - << maxBERTpi / CLHEP::GeV << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMY: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics RegisterPhysics(new G4EmStandardPhysics_option3(ver)); - G4EmParameters::Instance()->SetMscStepLimitType(fUseSafetyPlus); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); @@ -41,25 +34,16 @@ FTFPCMS_BERT_EMY::FTFPCMS_BERT_EMY(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc index c0b4b8ea65071..11cd87308430d 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc @@ -8,23 +8,18 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMZ::FTFPCMS_BERT_EMZ(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter("Verbosity", 0); bool emPhys = p.getUntrackedParameter("EMPhysics", true); bool hadPhys = p.getUntrackedParameter("HadPhysics", true); - bool tracking = p.getParameter("TrackingCut"); - double timeLimit = p.getParameter("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMZ \n Flags for EM Physics " - << emPhys << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" - << maxBERTpi / CLHEP::GeV << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMZ: " + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics @@ -39,25 +34,16 @@ FTFPCMS_BERT_EMZ::FTFPCMS_BERT_EMZ(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc index 7f68c96f3a63a..05badb037ddee 100644 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc +++ b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc @@ -51,6 +51,7 @@ CMSEmStandardPhysics::CMSEmStandardPhysics(G4int ver, const edm::ParameterSet& p param->SetStepFunction(0.8, 1 * CLHEP::mm); param->SetMscRangeFactor(0.2); param->SetMscStepLimitType(fMinimal); + param->SetFluo(false); SetPhysicsType(bElectromagnetic); fRangeFactor = p.getParameter("G4MscRangeFactor"); fGeomFactor = p.getParameter("G4MscGeomFactor"); @@ -99,7 +100,6 @@ void CMSEmStandardPhysics::ConstructProcess() { G4ParticleDefinition* particle = G4Gamma::Gamma(); G4PhotoElectricEffect* pee = new G4PhotoElectricEffect(); - pee->SetEmModel(new G4LivermorePhotoElectricModel()); if (G4EmParameters::Instance()->GeneralProcessActive()) { G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); diff --git a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc index 5c098b3c7c108..b4fb560e0f204 100644 --- a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc +++ b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc @@ -4,14 +4,16 @@ #include "G4Threading.hh" CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4int) - : CMSHadronPhysicsFTFP_BERT(3. * CLHEP::GeV, 6. * CLHEP::GeV, 12 * CLHEP::GeV) {} + : CMSHadronPhysicsFTFP_BERT(3 * CLHEP::GeV, 6 * CLHEP::GeV, 12 * CLHEP::GeV, 3 * CLHEP::GeV, 6 * CLHEP::GeV) {} -CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3) +CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5) : G4HadronPhysicsFTFP_BERT("hInelastic FTFP_BERT", false) { minFTFP_pion = e1; maxBERT_pion = e3; minFTFP_kaon = e1; maxBERT_kaon = e2; + minFTFP_kaon = e4; + maxBERT_kaon = e5; minFTFP_proton = e1; maxBERT_proton = e2; minFTFP_neutron = e1; diff --git a/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc index cf79b989c929b..7bfa25dfd5d7e 100644 --- a/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc @@ -52,7 +52,7 @@ DigiSimLinkAlgorithm::DigiSimLinkAlgorithm(const edm::ParameterSet& conf) : conf theDigiSimLinkPileUpSignals = new DigiSimLinkPileUpSignals(); theSiNoiseAdder = new SiGaussianTailNoiseAdder(theThreshold); theSiDigitalConverter = new SiTrivialDigitalConverter(theElectronPerADC, PreMixing_); - theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo); + theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo, nullptr); } DigiSimLinkAlgorithm::~DigiSimLinkAlgorithm() { diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 36e027cb03fd0..7a3450bc75508 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -164,7 +164,7 @@ PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, theElectronPerADC(ps.getParameter(peakMode ? "electronPerAdcPeak" : "electronPerAdcDec")), APVSaturationFromHIP_(ps.getParameter("APVSaturationFromHIP")), theFedAlgo(ps.getParameter("FedAlgorithm_PM")), - theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), + theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo, &iC)), theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)), // no premixing includeAPVSimulation_(ps.getParameter("includeAPVSimulation")), fracOfEventsToSimAPV_(ps.getParameter("fracOfEventsToSimAPV")), diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index b523c6256efa3..2c143a7532fd2 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -67,7 +67,7 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co theSiPileUpSignals(new SiPileUpSignals()), theSiNoiseAdder(new SiGaussianTailNoiseAdder(theThreshold)), theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, PreMixing_)), - theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), + theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo, &iC)), APVProbabilityFile(conf.getParameter("APVProbabilityFile")), includeAPVSimulation_(conf.getParameter("includeAPVSimulation")), apv_maxResponse_(conf.getParameter("apv_maxResponse")), diff --git a/Validation/Configuration/python/ECALHCAL.py b/Validation/Configuration/python/ECALHCAL.py index 50013e0859c30..1c4e18046144b 100644 --- a/Validation/Configuration/python/ECALHCAL.py +++ b/Validation/Configuration/python/ECALHCAL.py @@ -39,21 +39,21 @@ def customise(process): process.schedule.append(process.generation_step) process.schedule.append(process.simulation_step) - process.ecalMultiFitUncalibRecHit.EBdigiCollection = cms.InputTag("simEcalDigis","ebDigis") - process.ecalMultiFitUncalibRecHit.EEdigiCollection = cms.InputTag("simEcalDigis","eeDigis") + process.ecalMultiFitUncalibRecHit.cpu.EBdigiCollection = cms.InputTag("simEcalDigis","ebDigis") + process.ecalMultiFitUncalibRecHit.cpu.EEdigiCollection = cms.InputTag("simEcalDigis","eeDigis") process.ecalPreshowerRecHit.ESdigiCollection = cms.InputTag("simEcalPreshowerDigis") delattr(process,"hbhereco") process.hbhereco = process.hbheprereco.clone() process.hcalLocalRecoSequence.replace(process.hbheprereco,process.hbhereco) - process.hbhereco.digiLabelQIE8 = cms.InputTag("simHcalUnsuppressedDigis") - process.hbhereco.digiLabelQIE11 = cms.InputTag("simHcalUnsuppressedDigis","HBHEQIE11DigiCollection") + process.hbhereco.cpu.digiLabelQIE8 = cms.InputTag("simHcalUnsuppressedDigis") + process.hbhereco.cpu.digiLabelQIE11 = cms.InputTag("simHcalUnsuppressedDigis","HBHEQIE11DigiCollection") process.horeco.digiLabel = cms.InputTag("simHcalUnsuppressedDigis") process.hfreco.digiLabel = cms.InputTag("simHcalUnsuppressedDigis") - process.ecalRecHit.recoverEBIsolatedChannels = cms.bool(False) - process.ecalRecHit.recoverEEIsolatedChannels = cms.bool(False) - process.ecalRecHit.recoverEBFE = cms.bool(False) - process.ecalRecHit.recoverEEFE = cms.bool(False) + process.ecalRecHit.cpu.recoverEBIsolatedChannels = cms.bool(False) + process.ecalRecHit.cpu.recoverEEIsolatedChannels = cms.bool(False) + process.ecalRecHit.cpu.recoverEBFE = cms.bool(False) + process.ecalRecHit.cpu.recoverEEFE = cms.bool(False) # process.local_digireco = cms.Path(process.mix * process.calDigi * process.ecalLocalRecoSequence * process.hbhereco * process.hfreco * process.horeco * (process.ecalClusters+process.caloTowersRec) * process.reducedEcalRecHitsSequence ) diff --git a/Validation/Configuration/python/hgcalSimValid_cff.py b/Validation/Configuration/python/hgcalSimValid_cff.py index 3ac4142386bb0..680caacb61ff6 100644 --- a/Validation/Configuration/python/hgcalSimValid_cff.py +++ b/Validation/Configuration/python/hgcalSimValid_cff.py @@ -9,7 +9,7 @@ from Validation.HGCalValidation.simhitValidation_cff import * from Validation.HGCalValidation.digiValidation_cff import * from Validation.HGCalValidation.rechitValidation_cff import * -from Validation.HGCalValidation.hgcalHitValidation_cfi import * +from Validation.HGCalValidation.hgcalHitValidation_cff import * from RecoHGCal.TICL.SimTracksters_cff import * from Validation.HGCalValidation.HGCalValidator_cfi import hgcalValidator diff --git a/Validation/Geometry/BuildFile.xml b/Validation/Geometry/BuildFile.xml index 710935e56e879..866596d01a790 100644 --- a/Validation/Geometry/BuildFile.xml +++ b/Validation/Geometry/BuildFile.xml @@ -9,6 +9,7 @@ + diff --git a/Validation/Geometry/python/materialBudgetVolume_cfi.py b/Validation/Geometry/python/materialBudgetVolume_cfi.py new file mode 100644 index 0000000000000..09faa0476d007 --- /dev/null +++ b/Validation/Geometry/python/materialBudgetVolume_cfi.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms +from SimG4Core.Configuration.SimG4Core_cff import * + +g4SimHits.Watchers = cms.VPSet(cms.PSet( + MaterialBudgetVolume = cms.PSet( + lvNames = cms.vstring('BEAM', 'BEAM1', 'BEAM2', 'BEAM3', 'BEAM4', 'Tracker', 'ECAL', 'HCal', 'VCAL', 'MUON', 'HGCAL', 'MGNT', 'OQUA'), + lvLevels = cms.vint32(3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 8, 3, 3), + useDD4Hep = cms.bool(False), + ), + type = cms.string('MaterialBudgetVolume') +)) diff --git a/Validation/Geometry/src/MaterialBudgetVolume.cc b/Validation/Geometry/src/MaterialBudgetVolume.cc new file mode 100644 index 0000000000000..640906e4f72f2 --- /dev/null +++ b/Validation/Geometry/src/MaterialBudgetVolume.cc @@ -0,0 +1,244 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" + +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/BeginOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" + +#include "G4LogicalVolumeStore.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4TransportationManager.hh" +#include "DD4hep/Filter.h" + +#include "CLHEP/Units/GlobalPhysicalConstants.h" +#include "CLHEP/Units/GlobalSystemOfUnits.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +//#define EDM_ML_DEBUG + +class MaterialBudgetVolume : public SimProducer, + public Observer, + public Observer, + public Observer, + public Observer, + public Observer { +public: + MaterialBudgetVolume(const edm::ParameterSet& p); + ~MaterialBudgetVolume() override {} + + void produce(edm::Event&, const edm::EventSetup&) override; + + struct MatInfo { + double stepL, radL, intL; + MatInfo(double s = 0, double r = 0, double l = 0) : stepL(s), radL(r), intL(l) {} + }; + +private: + MaterialBudgetVolume(const MaterialBudgetVolume&) = delete; // stop default + const MaterialBudgetVolume& operator=(const MaterialBudgetVolume&) = delete; + + // observer classes + void update(const BeginOfRun* run) override; + void update(const BeginOfEvent* evt) override; + void update(const BeginOfTrack*) override; + void update(const EndOfTrack*) override; + void update(const G4Step* step) override; + + void endOfEvent(edm::MaterialInformationContainer& matbg); + bool loadLV(); + int findLV(const G4VTouchable*); + +private: + std::vector lvNames_; + std::vector lvLevel_; + int iaddLevel_; + bool init_; + std::map > mapLV_; + std::vector lengths_; + std::vector store_; +}; + +MaterialBudgetVolume::MaterialBudgetVolume(const edm::ParameterSet& p) : init_(false) { + edm::ParameterSet m_p = p.getParameter("MaterialBudgetVolume"); + + lvNames_ = m_p.getParameter >("lvNames"); + lvLevel_ = m_p.getParameter >("lvLevels"); + iaddLevel_ = (m_p.getParameter("useDD4Hep")) ? 1 : 0; + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Studies Material budget for " << lvNames_.size() + << " volumes with addLevel " << iaddLevel_; + std::ostringstream st1; + for (unsigned int k = 0; k < lvNames_.size(); ++k) + st1 << " [" << k << "] " << lvNames_[k] << " at " << lvLevel_[k]; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Volumes" << st1.str(); +#endif + + produces("MaterialInformation"); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: will produce MaterialInformationContainer"; +#endif +} + +void MaterialBudgetVolume::produce(edm::Event& e, const edm::EventSetup&) { + std::unique_ptr matbg(new edm::MaterialInformationContainer); + endOfEvent(*matbg); + e.put(std::move(matbg), "MaterialInformation"); +} + +void MaterialBudgetVolume::update(const BeginOfRun* run) { + init_ = loadLV(); + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() + << " logical volumes with return flag " << init_; +#endif +} + +void MaterialBudgetVolume::update(const BeginOfEvent* evt) { +#ifdef EDM_ML_DEBUG + int iev = (*evt)()->GetEventID(); + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: =====> Begin event = " << iev << std::endl; +#endif + if (!init_) + init_ = loadLV(); + + store_.clear(); +} + +void MaterialBudgetVolume::update(const BeginOfTrack* trk) { + lengths_ = std::vector(mapLV_.size()); + +#ifdef EDM_ML_DEBUG + const G4Track* aTrack = (*trk)(); + const G4ThreeVector& mom = aTrack->GetMomentum(); + double theEnergy = aTrack->GetTotalEnergy(); + int theID = static_cast(aTrack->GetDefinition()->GetPDGEncoding()); + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumme: Track " << aTrack->GetTrackID() << " Code " << theID + << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum " << mom / CLHEP::GeV + << " GeV"; +#endif +} + +void MaterialBudgetVolume::update(const G4Step* aStep) { + G4Material* material = aStep->GetPreStepPoint()->GetMaterial(); + double step = aStep->GetStepLength(); + double radl = material->GetRadlen(); + double intl = material->GetNuclearInterLength(); + const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); + int index = findLV(touch); + if (index >= 0) { + lengths_[index].stepL += step; + lengths_[index].radL += (step / radl); + lengths_[index].intL += (step / intl); + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Step in " + << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index " << index + << " Step " << step << " RadL " << step / radl << " IntL " << step / intl; +#endif +} + +void MaterialBudgetVolume::update(const EndOfTrack* trk) { + const G4Track* aTrack = (*trk)(); + int id = aTrack->GetTrackID(); + double eta = aTrack->GetMomentumDirection().eta(); + double phi = aTrack->GetMomentumDirection().phi(); + for (unsigned int k = 0; k < lengths_.size(); ++k) { + MaterialInformation info(lvNames_[k], id, eta, phi, lengths_[k].stepL, lengths_[k].radL, lengths_[k].intL); + store_.emplace_back(info); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Volume[" << k << "]: " << info; +#endif + } +} + +void MaterialBudgetVolume::endOfEvent(edm::MaterialInformationContainer& matbg) { +#ifdef EDM_ML_DEBUG + unsigned int kount(0); +#endif + for (const auto& element : store_) { + MaterialInformation info(element.vname(), + element.id(), + element.trackEta(), + element.trackPhi(), + element.stepLength(), + element.radiationLength(), + element.interactionLength()); + matbg.push_back(info); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume:: Info[" << kount << "] " << info; + ++kount; +#endif + } +} + +bool MaterialBudgetVolume::loadLV() { + const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); + bool flag(false); + if (lvs != nullptr) { + std::vector::const_iterator lvcite; + for (unsigned int i = 0; i < lvNames_.size(); i++) { + G4LogicalVolume* lv = nullptr; + std::string name(lvNames_[i]); + for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { + std::string namx(dd4hep::dd::noNamespace((*lvcite)->GetName())); + if (namx == name) { + lv = (*lvcite); + break; + } + } + if (lv != nullptr) + mapLV_[i] = std::make_pair(lv, lvLevel_[i]); + } + flag = true; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() << " logical volumes"; + unsigned int k(0); + for (const auto& lvs : mapLV_) { + edm::LogVerbatim("MaterialBudget") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " + << (lvs.second).second << ") : " << lvNames_[lvs.first]; + ++k; + } +#endif + } + return flag; +} + +int MaterialBudgetVolume::findLV(const G4VTouchable* touch) { + int level(-1); + int levels = ((touch->GetHistoryDepth()) + 1); + for (const auto& lvs : mapLV_) { + if ((lvs.second).second <= levels) { + int ii = levels - (lvs.second).second; + if ((touch->GetVolume(ii)->GetLogicalVolume()) == (lvs.second).first) { + level = lvs.first; + break; + } + } + } + return level; +} + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" + +DEFINE_SIMWATCHER(MaterialBudgetVolume); diff --git a/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc new file mode 100644 index 0000000000000..419c70660b902 --- /dev/null +++ b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc @@ -0,0 +1,161 @@ +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Math/interface/GeantUnits.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" + +#include "TProfile.h" +#include "TProfile2D.h" + +#include +#include +#include + +//#define EDM_ML_DEBUG + +using namespace geant_units::operators; + +class MaterialBudgetVolumeAnalysis : public edm::one::EDAnalyzer { +public: + explicit MaterialBudgetVolumeAnalysis(edm::ParameterSet const&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(edm::Event const&, edm::EventSetup const&) override; + void bookHisto(); + + const std::vector names_; + const edm::InputTag tag_; + const int binEta_, binPhi_; + const double etaLow_, etaHigh_, phiLow_, phiHigh_; + edm::EDGetTokenT tok_info_; + std::vector meStepEta_, meStepPhi_; + std::vector meRadLEta_, meRadLPhi_; + std::vector meIntLEta_, meIntLPhi_; + std::vector meStepEtaPhi_, meRadLEtaPhi_, meIntLEtaPhi_; +}; + +MaterialBudgetVolumeAnalysis::MaterialBudgetVolumeAnalysis(const edm::ParameterSet& p) + : names_(p.getParameter >("names")), + tag_(p.getParameter("inputTag")), + binEta_(p.getParameter("nBinEta")), + binPhi_(p.getParameter("nBinPhi")), + etaLow_(p.getParameter("etaLow")), + etaHigh_(p.getParameter("etaHigh")), + phiLow_(-1._pi), + phiHigh_(1._pi) { + usesResource(TFileService::kSharedResource); + tok_info_ = consumes(tag_); + + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumeAnalysis: Eta plot: NX " << binEta_ << " Range " + << -etaLow_ << ":" << etaHigh_ << " Phi plot: NX " << binPhi_ << " Range " + << -1._pi << ":" << 1._pi << " for " << names_.size() << " detectors from " + << tag_; + std::ostringstream st1; + for (unsigned int k = 0; k < names_.size(); ++k) + st1 << " [" << k << "] " << names_[k]; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: " << st1.str(); + bookHisto(); +} + +void MaterialBudgetVolumeAnalysis::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector names = { + "BEAM", "BEAM1", "BEAM2", "BEAM3", "BEAM4", "Tracker", "ECAL", "HCal", "MUON", "VCAL", "MGNT", "OQUA", "HGCal"}; + desc.add >("names", names); + desc.add("inputTag", edm::InputTag("g4SimHits", "MaterialInformation")); + desc.add("nBinEta", 260); + desc.add("nBinPhi", 180); + desc.add("etaLow", -5.2); + desc.add("etaHigh", 5.2); + descriptions.add("materialBudgetVolumeAnalysis", desc); +} + +void MaterialBudgetVolumeAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup&) { + edm::Handle materialInformationContainer; + iEvent.getByToken(tok_info_, materialInformationContainer); +#ifdef EDM_ML_DEBUG + unsigned int nsize(0), ntot(0), nused(0); +#endif + if (materialInformationContainer.isValid()) { +#ifdef EDM_ML_DEBUG + nsize = materialInformationContainer->size(); +#endif + for (const auto& it : *(materialInformationContainer.product())) { +#ifdef EDM_ML_DEBUG + ntot++; +#endif + if (std::find(names_.begin(), names_.end(), it.vname()) != names_.end()) { +#ifdef EDM_ML_DEBUG + nused++; +#endif + unsigned int k = + static_cast(std::find(names_.begin(), names_.end(), it.vname()) - names_.begin()); + meStepEta_[k]->Fill(it.trackEta(), it.stepLength()); + meRadLEta_[k]->Fill(it.trackEta(), it.radiationLength()); + meIntLEta_[k]->Fill(it.trackEta(), it.interactionLength()); + meStepPhi_[k]->Fill(it.trackPhi(), it.stepLength()); + meRadLPhi_[k]->Fill(it.trackPhi(), it.radiationLength()); + meIntLPhi_[k]->Fill(it.trackPhi(), it.interactionLength()); + meStepEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.stepLength()); + meRadLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.radiationLength()); + meIntLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.interactionLength()); + } + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialInformation with " << nsize << ":" << ntot << " elements of which " + << nused << " are used"; +#endif +} + +void MaterialBudgetVolumeAnalysis::bookHisto() { + edm::Service fs; + char name[40], title[100]; + for (unsigned int k = 0; k < names_.size(); ++k) { + sprintf(name, "stepEta%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #eta for %s", names_[k].c_str()); + meStepEta_.emplace_back(fs->make(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "radlEta%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #eta for %s", names_[k].c_str()); + meRadLEta_.emplace_back(fs->make(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "intlEta%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #eta for %s", names_[k].c_str()); + meIntLEta_.emplace_back(fs->make(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "stepPhi%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #phi for %s", names_[k].c_str()); + meStepPhi_.emplace_back(fs->make(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "radlPhi%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #phi for %s", names_[k].c_str()); + meRadLPhi_.emplace_back(fs->make(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "intlPhi%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #phi for %s", names_[k].c_str()); + meIntLPhi_.emplace_back(fs->make(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "stepEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #eta and #phi for %s", names_[k].c_str()); + meStepEtaPhi_.emplace_back( + fs->make(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); + sprintf(name, "radlEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #eta and #phi for %s", names_[k].c_str()); + meRadLEtaPhi_.emplace_back( + fs->make(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); + sprintf(name, "intlEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #eta and #phi for %s", names_[k].c_str()); + meIntLEtaPhi_.emplace_back( + fs->make(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); + } +} + +// define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(MaterialBudgetVolumeAnalysis); diff --git a/Validation/Geometry/test/MaterialBudget.py b/Validation/Geometry/test/MaterialBudget.py index 3cc55383e9c99..5fce383d89e71 100644 --- a/Validation/Geometry/test/MaterialBudget.py +++ b/Validation/Geometry/test/MaterialBudget.py @@ -2,6 +2,7 @@ # Pure trick to start ROOT in batch mode, pass this only option to it # and the rest of the command line options to this code. +from __future__ import print_function import six import sys oldargv = sys.argv[:] diff --git a/Validation/Geometry/test/MaterialBudgetHGCal.py b/Validation/Geometry/test/MaterialBudgetHGCal.py index 9ab3860283d99..185a9f0dc03b2 100644 --- a/Validation/Geometry/test/MaterialBudgetHGCal.py +++ b/Validation/Geometry/test/MaterialBudgetHGCal.py @@ -1,11 +1,13 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # Pure trick to start ROOT in batch mode, pass this only option to it # and the rest of the command line options to this code. +from __future__ import print_function import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt +import six from array import array oldargv = sys.argv[:] @@ -101,7 +103,7 @@ def createPlots_(plot, compounddetectorname): hist_X0_elements = OrderedDict() prof_X0_elements = OrderedDict() - for subDetector,color in DETECTORS.iteritems(): + for subDetector,color in six.iteritems(DETECTORS): subDetectorFilename = "matbdg_%s.root" % subDetector if not checkFile_(subDetectorFilename): print("Error opening file: %s" % subDetectorFilename) @@ -115,7 +117,7 @@ def createPlots_(plot, compounddetectorname): hist_X0_detectors[subDetector] = prof_X0_XXX.ProjectionX() # category profiles - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): prof_X0_elements[label] = subDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label] = assignOrAddIfExists_(hist_X0_elements.setdefault(label, None), prof_X0_elements[label]) @@ -128,10 +130,10 @@ def createPlots_(plot, compounddetectorname): cumulative_matbdg.SetDirectory(0) # colors - for det, color in DETECTORS.iteritems(): + for det, color in six.iteritems(DETECTORS): setColorIfExists_(hist_X0_detectors, det, color) - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): hist_X0_elements[label].SetFillColor(color) # First Plot: BeamPipe + Tracker + ECAL + HCal + HGCal + MB + MGNT @@ -139,7 +141,7 @@ def createPlots_(plot, compounddetectorname): stackTitle_SubDetectors = "Material Budget;%s;%s" % ( plots[plot].abscissa,plots[plot].ordinate) stack_X0_SubDetectors = THStack("stack_X0",stackTitle_SubDetectors) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): stack_X0_SubDetectors.Add(histo) cumulative_matbdg.Add(histo, 1) @@ -162,7 +164,7 @@ def createPlots_(plot, compounddetectorname): theLegend_SubDetectors.SetFillStyle(0) theLegend_SubDetectors.SetBorderSize(0) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): theLegend_SubDetectors.AddEntry(histo, det, "f") theLegend_SubDetectors.Draw() @@ -249,7 +251,7 @@ def createPlots2D_(plot, compounddetectorname): hist_X0_elements = OrderedDict() prof_X0_elements = OrderedDict() - for subDetector,color in DETECTORS.iteritems(): + for subDetector,color in six.iteritems(DETECTORS): subDetectorFilename = "matbdg_%s.root" % subDetector if not checkFile_(subDetectorFilename): print("Error opening file: %s" % subDetectorFilename) @@ -262,7 +264,7 @@ def createPlots2D_(plot, compounddetectorname): #hist_X0_detectors[subDetector] = prof_X0_XXX hist_X0_detectors[subDetector] = prof_X0_XXX.ProjectionXY("_pxy","B") - print subDetector + print(subDetector) # First Plot: BeamPipe + Tracker + ECAL + HCal + HGCal + MB + MGNT @@ -321,12 +323,12 @@ def createPlots2D_(plot, compounddetectorname): # colors - for det, color in DETECTORS.iteritems(): + for det, color in six.iteritems(DETECTORS): hist_X0_detectors[det].SetMarkerColor(color) hist_X0_detectors[det].SetFillColor(color) - for det, histo in hist_X0_detectors.iteritems(): - print det + for det, histo in six.iteritems(hist_X0_detectors): + print(det) histo.Draw("same") # Legenda @@ -336,7 +338,7 @@ def createPlots2D_(plot, compounddetectorname): theLegend_SubDetectors.SetFillStyle(0) theLegend_SubDetectors.SetBorderSize(0) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): theLegend_SubDetectors.AddEntry(histo, det, "f") #theLegend_SubDetectors.AddEntry(hgbound1, "HGCal Eta Boundaries [1.3, 3.0]", "l") @@ -403,7 +405,7 @@ def createPlotsReco_(reco_file, label, debug=False): for s in sPREF: hs = THStack("hs",""); histos = [] - for det, color in sDETS.iteritems(): + for det, color in six.iteritems(sDETS): layer_number = 0 while True: layer_number += 1 @@ -506,7 +508,7 @@ def createCompoundPlots(detector, plot): # get TProfiles prof_X0_elements = OrderedDict() hist_X0_elements = OrderedDict() - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): #print label, num, color, leg prof_X0_elements[label] = theDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label] = prof_X0_elements[label].ProjectionX() @@ -527,7 +529,7 @@ def createCompoundPlots(detector, plot): print("*** Open file... %s" % subDetectorFilename) # subdetector profiles - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): prof_X0_elements[label] = subDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label].Add(prof_X0_elements[label].ProjectionX("B_%s" % prof_X0_elements[label].GetName()) , +1.000) @@ -537,7 +539,7 @@ def createCompoundPlots(detector, plot): plots[plot].abscissa, plots[plot].ordinate) stack_X0 = THStack("stack_X0", stackTitle); - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): stack_X0.Add(hist_X0_elements[label]) # canvas @@ -557,7 +559,7 @@ def createCompoundPlots(detector, plot): if plot == "x_vs_phi" or plot == "l_vs_phi": theLegend = TLegend(0.65, 0.30, 0.89, 0.70) if plot == "x_vs_R" or plot == "l_vs_R": theLegend = TLegend(0.75, 0.60, 0.95, 0.90) - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): theLegend.AddEntry(hist_X0_elements[label], leg, "f") theLegend.Draw(); @@ -630,8 +632,8 @@ def create2DPlots(detector, plot, plotnum, plotmat, dosingledetector = True): # get TProfiles #prof2d_X0_det_total = theDetectorFile.Get('%s' % plots[plot].plotNumber) prof2d_X0_det_total = theDetectorFile.Get('%s' % plotnum) - print "==================================================================" - print plotnum + print("==================================================================") + print(plotnum) # histos prof2d_X0_det_total.__class__ = TProfile2D @@ -903,7 +905,7 @@ def GetSiliconZValuesFromXML(): layersmaxZ = np.asarray(layersmaxZ) layersmaxZ = 10. * layersmaxZ # in mm - print "Total number of layers from XML " , layersmaxZ.size - 1 # Minus 1 for the EE front input by hand. + print("Total number of layers from XML " , layersmaxZ.size - 1) # Minus 1 for the EE front input by hand. return layersmaxZ @@ -978,30 +980,30 @@ def GetSiliconZValuesFromXML(): #Function to help filling the twiki with all these plots #First I loop through labels to put the hide button in twiki #All HGCal - print "---+++ Results: Plots for individual material in all HGCal" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in all HGCal") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "all") #Z+ - print "---+++ Results: Plots for individual material in Z+ Endcap" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in Z+ Endcap") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "zplus") #Z- - print "---+++ Results: Plots for individual material in Z- Endcap" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in Z- Endcap") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "zminus") #Below is the silicon position from the xml geometry file #Should we put them on top of plots like the eta values? - print GetSiliconZValuesFromXML() + print(GetSiliconZValuesFromXML()) for p in required_2Dplots: #First the total create2DPlots(args.detector, p, plots[p].plotNumber, "") #Then, the rest - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): #print label, num, color, leg create2DPlots(args.detector, p, num + plots[p].plotNumber, leg) diff --git a/Validation/Geometry/test/genHGCalPlots.sh b/Validation/Geometry/test/genHGCalPlots.sh index 8a3992a4fb3b3..cbff3dab95fd2 100755 --- a/Validation/Geometry/test/genHGCalPlots.sh +++ b/Validation/Geometry/test/genHGCalPlots.sh @@ -10,5 +10,5 @@ mkdir $TEST_DIR && cd $TEST_DIR cmsRun ${VGEO_DIR}/test/single_neutrino_cfg.py nEvents=1 >$TEST_DIR/single_neutrino_cfg.log 2>&1 python ${VGEO_DIR}/test/runP_HGCal_cfg.py geom=${geom} label=HGCal >$TEST_DIR/runP_HGCal_cfg_${geom}.log 2>&1 -python ${VGEO_DIR}/test/MaterialBudgetHGCal.py -s -d HGCal +python3 ${VGEO_DIR}/test/MaterialBudgetHGCal.py -s -d HGCal diff --git a/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py new file mode 100644 index 0000000000000..ffac4162d22c6 --- /dev/null +++ b/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PROD',Run3) + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.Geometry.GeometryExtended2021_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("Validation.Geometry.materialBudgetVolume_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgHCAL_run3.root') +) + +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False + +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) diff --git a/Validation/Geometry/test/runMaterialMapForReco_fromReco.py b/Validation/Geometry/test/runMaterialMapForReco_fromReco.py index 9992485bed95b..c3e801061359e 100644 --- a/Validation/Geometry/test/runMaterialMapForReco_fromReco.py +++ b/Validation/Geometry/test/runMaterialMapForReco_fromReco.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Auto generated configuration file # using: # Revision: 1.19 @@ -93,7 +94,7 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') if options.fromLocalXML: - print "Loading material from local XMLs" + print("Loading material from local XMLs") process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') else: process.load('Configuration.StandardSequences.GeometryRecoDB_cff') diff --git a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py index 676f4dad0c57d..82579b3ef0d6f 100644 --- a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py +++ b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py @@ -1,3 +1,4 @@ +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 @@ -58,9 +59,9 @@ # Option validation if options.label not in _ALLOWED_LABELS: - print "\n*** Error, '%s' not registered as a valid components to monitor." % options.label - print "Allowed components:", _ALLOWED_LABELS - print + print("\n*** Error, '%s' not registered as a valid components to monitor." % options.label) + print("Allowed components:", _ALLOWED_LABELS) + print() raise RuntimeError("Unknown label") _components = _LABELS2COMPS[options.label] diff --git a/Validation/Geometry/test/runP_HGCal_cfg.py b/Validation/Geometry/test/runP_HGCal_cfg.py index bc184ffe5f120..640f861a316ae 100644 --- a/Validation/Geometry/test/runP_HGCal_cfg.py +++ b/Validation/Geometry/test/runP_HGCal_cfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # In order to produce everything that you need in one go, use the command: # # for t in {'BeamPipe','Tracker','PixBar','PixFwdMinus','PixFwdPlus','TIB','TOB','TIDB','TIDF','TEC','TkStrct','InnerServices'}; do cmsRun runP_Tracker_cfg.py geom=XYZ label=$t >& /dev/null &; done @@ -47,9 +48,9 @@ # Option validation if options.label not in _ALLOWED_LABELS: - print "\n*** Error, '%s' not registered as a valid components to monitor." % options.label - print "Allowed components:", _ALLOWED_LABELS - print + print("\n*** Error, '%s' not registered as a valid components to monitor." % options.label) + print("Allowed components:", _ALLOWED_LABELS) + print() raise RuntimeError("Unknown label") _components = _LABELS2COMPS[options.label] diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index f617830125c1d..870ac532e508f 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -7,7 +7,6 @@ * \author HGCal */ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -16,7 +15,7 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "DataFormats/ParticleFlowReco/interface/PFCluster.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "SimDataFormats/Vertex/interface/SimVertex.h" @@ -62,7 +61,7 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { protected: edm::ESGetToken caloGeomToken_; edm::InputTag label_lcl; - std::vector label_mcl; + std::vector label_tst; edm::InputTag associator_; edm::InputTag associatorSim_; const bool SaveGeneralInfo_; @@ -70,14 +69,14 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { const bool doCaloParticleSelection_; const bool doSimClustersPlots_; const bool doLayerClustersPlots_; - const bool doMultiClustersPlots_; + const bool doTrackstersPlots_; std::vector label_clustersmask; const edm::FileInPath cummatbudinxo_; std::vector> labelToken; - edm::EDGetTokenT> simclusters_; + edm::EDGetTokenT> simClusters_; edm::EDGetTokenT layerclusters_; - std::vector>> label_mclTokens; + std::vector> label_tstTokens; edm::EDGetTokenT> label_cp_effic; edm::EDGetTokenT> label_cp_fake; edm::EDGetTokenT> simVertices_; diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index f6359fd9294b1..7552fa82b2674 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -17,7 +17,7 @@ #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" -#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" @@ -109,7 +109,7 @@ struct HGVHistoProducerAlgoHistograms { std::unordered_map h_caloparticle_lastlayer_matchedtoRecHit; std::unordered_map h_caloparticle_layersnum_matchedtoRecHit; - //For simclusters + //For SimClusters std::unordered_map h_simclusternum_perlayer; std::unordered_map h_simclusternum_perthick; dqm::reco::MonitorElement* h_mixedhitssimcluster_zminus; @@ -138,54 +138,54 @@ struct HGVHistoProducerAlgoHistograms { std::vector> h_sharedenergy_simcluster2layercl_vs_eta_perlayer; std::vector> h_sharedenergy_simcluster2layercl_vs_phi_perlayer; - //For multiclusters - std::vector h_score_multicl2caloparticle; - std::vector h_score_caloparticle2multicl; - std::vector h_energy_vs_score_multicl2caloparticle; - std::vector h_energy_vs_score_caloparticle2multicl; - std::vector h_num_multicl_eta; - std::vector h_num_multicl_phi; - std::vector h_numMerge_multicl_eta; - std::vector h_numMerge_multicl_phi; - std::vector h_sharedenergy_multicl2caloparticle; - std::vector h_sharedenergy_caloparticle2multicl; - std::vector h_sharedenergy_caloparticle2multicl_assoc; - std::vector h_sharedenergy_multicl2caloparticle_vs_eta; - std::vector h_sharedenergy_multicl2caloparticle_vs_phi; - std::vector h_sharedenergy_caloparticle2multicl_vs_eta; - std::vector h_sharedenergy_caloparticle2multicl_vs_phi; - std::vector h_denom_multicl_eta; - std::vector h_denom_multicl_phi; + //For Tracksters + std::vector h_score_trackster2caloparticle; + std::vector h_score_caloparticle2trackster; + std::vector h_energy_vs_score_trackster2caloparticle; + std::vector h_energy_vs_score_caloparticle2trackster; + std::vector h_num_trackster_eta; + std::vector h_num_trackster_phi; + std::vector h_numMerge_trackster_eta; + std::vector h_numMerge_trackster_phi; + std::vector h_sharedenergy_trackster2caloparticle; + std::vector h_sharedenergy_caloparticle2trackster; + std::vector h_sharedenergy_caloparticle2trackster_assoc; + std::vector h_sharedenergy_trackster2caloparticle_vs_eta; + std::vector h_sharedenergy_trackster2caloparticle_vs_phi; + std::vector h_sharedenergy_caloparticle2trackster_vs_eta; + std::vector h_sharedenergy_caloparticle2trackster_vs_phi; + std::vector h_denom_trackster_eta; + std::vector h_denom_trackster_phi; std::vector h_num_caloparticle_eta; std::vector h_num_caloparticle_phi; - std::vector h_numDup_multicl_eta; - std::vector h_numDup_multicl_phi; + std::vector h_numDup_trackster_eta; + std::vector h_numDup_trackster_phi; std::vector h_denom_caloparticle_eta; std::vector h_denom_caloparticle_phi; - std::vector h_multiclusternum; - std::vector h_contmulticlusternum; - std::vector h_noncontmulticlusternum; - std::vector h_clusternum_in_multicluster; - std::vector> h_clusternum_in_multicluster_perlayer; - std::vector h_multiplicityOfLCinMCL; + std::vector h_tracksternum; + std::vector h_conttracksternum; + std::vector h_nonconttracksternum; + std::vector h_clusternum_in_trackster; + std::vector> h_clusternum_in_trackster_perlayer; + std::vector h_multiplicityOfLCinTST; std::vector h_multiplicity_numberOfEventsHistogram; std::vector h_multiplicity_zminus_numberOfEventsHistogram; std::vector h_multiplicity_zplus_numberOfEventsHistogram; - std::vector h_multiplicityOfLCinMCL_vs_layercluster; - std::vector h_multiplicityOfLCinMCL_vs_layercluster_zminus; - std::vector h_multiplicityOfLCinMCL_vs_layercluster_zplus; - std::vector h_multiplicityOfLCinMCL_vs_layerclusterenergy; - std::vector h_clusternum_in_multicluster_vs_layer; - std::vector h_multicluster_pt; - std::vector h_multicluster_eta; - std::vector h_multicluster_phi; - std::vector h_multicluster_energy; - std::vector h_multicluster_x; - std::vector h_multicluster_y; - std::vector h_multicluster_z; - std::vector h_multicluster_firstlayer; - std::vector h_multicluster_lastlayer; - std::vector h_multicluster_layersnum; + std::vector h_multiplicityOfLCinTST_vs_layercluster; + std::vector h_multiplicityOfLCinTST_vs_layercluster_zminus; + std::vector h_multiplicityOfLCinTST_vs_layercluster_zplus; + std::vector h_multiplicityOfLCinTST_vs_layerclusterenergy; + std::vector h_clusternum_in_trackster_vs_layer; + std::vector h_trackster_pt; + std::vector h_trackster_eta; + std::vector h_trackster_phi; + std::vector h_trackster_energy; + std::vector h_trackster_x; + std::vector h_trackster_y; + std::vector h_trackster_z; + std::vector h_trackster_firstlayer; + std::vector h_trackster_lastlayer; + std::vector h_trackster_layersnum; }; using Density = hgcal_clustering::Density; @@ -226,7 +226,7 @@ class HGVHistoProducerAlgo { unsigned int layers, std::vector thicknesses); - void bookMultiClusterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers); + void bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers); void layerClusters_to_CaloParticles(const Histograms& histograms, edm::Handle clusterHandle, @@ -244,21 +244,22 @@ class HGVHistoProducerAlgo { edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle> simClusterHandle, - std::vector const& simclusters, + std::vector const& simClusters, std::vector const& sCIndices, const std::vector& mask, std::unordered_map const&, unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters& recSimColl, const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; - void multiClusters_to_CaloParticles(const Histograms& histograms, - int count, - const std::vector& multiClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const&, - unsigned int layers) const; + void tracksters_to_CaloParticles(const Histograms& histograms, + int count, + const ticl::TracksterCollection& Tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const&, + unsigned int layers) const; void fill_info_histos(const Histograms& histograms, unsigned int layers) const; void fill_caloparticle_histos(const Histograms& histograms, int pdgid, @@ -281,16 +282,16 @@ class HGVHistoProducerAlgo { std::vector thicknesses, const hgcal::RecoToSimCollection& recSimColl, const hgcal::SimToRecoCollection& simRecColl) const; - void fill_simcluster_histos(const Histograms& histograms, - std::vector const& simclusters, + void fill_simCluster_histos(const Histograms& histograms, + std::vector const& simClusters, unsigned int layers, std::vector thicknesses) const; - void fill_simclusterassosiation_histos(const Histograms& histograms, + void fill_simClusterAssociation_histos(const Histograms& histograms, int count, edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle> simClusterHandle, - std::vector const& simclusters, + std::vector const& simClusters, std::vector const& sCIndices, const std::vector& mask, std::unordered_map const& hitMap, @@ -298,14 +299,15 @@ class HGVHistoProducerAlgo { const hgcal::RecoToSimCollectionWithSimClusters& recSimColl, const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; void fill_cluster_histos(const Histograms& histograms, int count, const reco::CaloCluster& cluster) const; - void fill_multi_cluster_histos(const Histograms& histograms, - int count, - const std::vector& multiClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const&, - unsigned int layers) const; + void fill_trackster_histos(const Histograms& histograms, + int count, + const ticl::TracksterCollection& Tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const&, + unsigned int layers) const; double distance2(const double x1, const double y1, const double x2, const double y2) const; double distance(const double x1, const double y1, const double x2, const double y2) const; @@ -319,9 +321,9 @@ class HGVHistoProducerAlgo { float fraction; }; - struct detIdInfoInMultiCluster { - bool operator==(const detIdInfoInMultiCluster& o) const { return multiclusterId == o.multiclusterId; }; - unsigned int multiclusterId; + struct detIdInfoInTrackster { + bool operator==(const detIdInfoInTrackster& o) const { return tracksterId == o.tracksterId; }; + unsigned int tracksterId; long unsigned int clusterId; float fraction; }; @@ -368,8 +370,8 @@ class HGVHistoProducerAlgo { int nintScore_; double minSharedEneFrac_, maxSharedEneFrac_; int nintSharedEneFrac_; - double minMCLSharedEneFrac_, maxMCLSharedEneFrac_; - int nintMCLSharedEneFrac_; + double minTSTSharedEneFrac_, maxTSTSharedEneFrac_; + int nintTSTSharedEneFrac_; double minTotNsimClsperthick_, maxTotNsimClsperthick_; int nintTotNsimClsperthick_; double minTotNClsperthick_, maxTotNClsperthick_; @@ -390,16 +392,16 @@ class HGVHistoProducerAlgo { int nintClEneperthickperlayer_; double minCellsEneDensperthick_, maxCellsEneDensperthick_; int nintCellsEneDensperthick_; - double minTotNMCLs_, maxTotNMCLs_; - int nintTotNMCLs_; - double minTotNClsinMCLs_, maxTotNClsinMCLs_; - int nintTotNClsinMCLs_; - double minTotNClsinMCLsperlayer_, maxTotNClsinMCLsperlayer_; - int nintTotNClsinMCLsperlayer_; + double minTotNTSTs_, maxTotNTSTs_; + int nintTotNTSTs_; + double minTotNClsinTSTs_, maxTotNClsinTSTs_; + int nintTotNClsinTSTs_; + double minTotNClsinTSTsperlayer_, maxTotNClsinTSTsperlayer_; + int nintTotNClsinTSTsperlayer_; double minMplofLCs_, maxMplofLCs_; int nintMplofLCs_; - double minSizeCLsinMCLs_, maxSizeCLsinMCLs_; - int nintSizeCLsinMCLs_; + double minSizeCLsinTSTs_, maxSizeCLsinTSTs_; + int nintSizeCLsinTSTs_; double minClEnepermultiplicity_, maxClEnepermultiplicity_; int nintClEnepermultiplicity_; double minX_, maxX_; diff --git a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc index f8d84f9e6246d..ed212051e4108 100644 --- a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc @@ -7,9 +7,6 @@ // user include files #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "CondFormats/GeometryObjects/interface/HcalParameters.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -21,10 +18,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/Records/interface/HcalParametersRcd.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" // Root objects @@ -51,15 +46,13 @@ class HGCalBHValidation : public edm::one::EDAnalyzer fs_; - const std::string g4Label_, hcalHits_; - const edm::InputTag hcalDigis_; - const int iSample_, geomType_; + const std::string g4Label_, hits_; + const edm::InputTag digis_; + const int iSample_; const double threshold_; - const bool ifHCAL_; - const edm::ESGetToken parToken_; - edm::EDGetTokenT tok_hits_; - edm::EDGetToken tok_hbhe_; - int etaMax_; + const edm::EDGetTokenT tok_hits_; + const edm::EDGetToken tok_digi_; + const int etaMax_; TH1D *hsimE1_, *hsimE2_, *hsimTm_; TH1D *hsimLn_, *hdigEn_, *hdigLn_; @@ -68,46 +61,32 @@ class HGCalBHValidation : public edm::one::EDAnalyzer("ModuleLabel", "g4SimHits")), - hcalHits_((ps.getUntrackedParameter("HitCollection", "HcalHits"))), - hcalDigis_(ps.getUntrackedParameter("DigiCollection")), - iSample_(ps.getUntrackedParameter("Sample", 5)), - geomType_(ps.getUntrackedParameter("GeometryType", 0)), - threshold_(ps.getUntrackedParameter("Threshold", 12.0)), - ifHCAL_(ps.getUntrackedParameter("ifHCAL", false)), - parToken_(esConsumes(edm::ESInputTag{})), + : g4Label_(ps.getParameter("ModuleLabel")), + hits_((ps.getParameter("HitCollection"))), + digis_(ps.getParameter("DigiCollection")), + iSample_(ps.getParameter("Sample")), + threshold_(ps.getParameter("Threshold")), + tok_hits_(consumes(edm::InputTag(g4Label_, hits_))), + tok_digi_(consumes(digis_)), etaMax_(100) { usesResource(TFileService::kSharedResource); - tok_hits_ = consumes(edm::InputTag(g4Label_, hcalHits_)); - if (ifHCAL_) - tok_hbhe_ = consumes(hcalDigis_); - else - tok_hbhe_ = consumes(hcalDigis_); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Input for SimHit:" << edm::InputTag(g4Label_, hcalHits_) - << " Digits:" << hcalDigis_ << " Sample: " << iSample_ << " Threshold " + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Input for SimHit:" << edm::InputTag(g4Label_, hits_) + << " Digits:" << digis_ << " Sample: " << iSample_ << " Threshold " << threshold_; } void HGCalBHValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.addUntracked("ModuleLabel", "g4SimHits"); - desc.addUntracked("HitCollection", "HGCHitsHEback"); - desc.addUntracked("DigiCollection", edm::InputTag("simHGCalUnsuppressedDigis", "HEback")); - desc.addUntracked("Sample", 5); - desc.addUntracked("GeometryType", 1); - desc.addUntracked("Threshold", 15.0); - desc.addUntracked("ifHCAL", false); + desc.add("ModuleLabel", "g4SimHits"); + desc.add("HitCollection", "HGCHitsHEback"); + desc.add("DigiCollection", edm::InputTag("simHGCalUnsuppressedDigis", "HEback")); + desc.add("Sample", 5); + desc.add("Threshold", 15.0); descriptions.add("hgcalBHAnalysis", desc); } void HGCalBHValidation::beginRun(edm::Run const&, edm::EventSetup const& es) { - if (geomType_ == 0) { - std::string label; - const HcalParameters* hpar = &es.getData(parToken_); - const std::vector etaM = hpar->etaMax; - etaMax_ = etaM[1]; - } edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Maximum Number of" << " eta sectors:" << etaMax_ << "\nHitsValidationHcal::Booking the Histograms"; @@ -131,38 +110,28 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation:Run = " << e.id().run() << " Event = " << e.id().event(); //SimHits - edm::Handle hitsHcal; - e.getByToken(tok_hits_, hitsHcal); + edm::Handle hitsHE; + e.getByToken(tok_hits_, hitsHE); edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: PCaloHitContainer" - << " obtained with flag " << hitsHcal.isValid(); - if (hitsHcal.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: PCaloHit buffer " << hitsHcal->size(); + << " obtained with flag " << hitsHE.isValid(); + if (hitsHE.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: PCaloHit buffer " << hitsHE->size(); unsigned i(0); std::map map_try; - for (edm::PCaloHitContainer::const_iterator it = hitsHcal->begin(); it != hitsHcal->end(); ++it) { + for (edm::PCaloHitContainer::const_iterator it = hitsHE->begin(); it != hitsHE->end(); ++it) { double energy = it->energy(); double time = it->time(); unsigned int id = it->id(); - int subdet(0), z(0), depth(0), eta(0), phi(0), lay(0); - bool hbhe(false), bh(false); - if (geomType_ == 0) { - HcalTestNumbering::unpackHcalIndex(id, subdet, z, depth, eta, phi, lay); - if (z == 0) - eta = -eta; - hbhe = ((subdet == static_cast(HcalEndcap)) || (subdet == static_cast(HcalBarrel))); - bh = (subdet == static_cast(HcalEndcap)); - } else { - hbhe = bh = (DetId(id).det() == DetId::HGCalHSc); - if (bh) { - eta = HGCScintillatorDetId(id).ieta(); - phi = HGCScintillatorDetId(id).iphi(); - lay = HGCScintillatorDetId(id).layer(); - } + int eta(0), phi(0), lay(0); + bool bh = (DetId(id).det() == DetId::HGCalHSc); + if (bh) { + eta = HGCScintillatorDetId(id).ieta(); + phi = HGCScintillatorDetId(id).iphi(); + lay = HGCScintillatorDetId(id).layer(); } double eta1 = (eta >= 0) ? (eta + 0.1) : (eta - 0.1); - if (hbhe) - hsi2Oc_->Fill(eta1, (phi - 0.1), energy); if (bh) { + hsi2Oc_->Fill(eta1, (phi - 0.1), energy); hsimE1_->Fill(energy); hsimTm_->Fill(time, energy); hsimOc_->Fill(eta1, (phi - 0.1), energy); @@ -174,9 +143,8 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { ensum += energy; map_try[id] = ensum; ++i; - edm::LogVerbatim("HGCalValidation") - << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " SubDet " << subdet << " depth " - << depth << " Eta " << eta << " Phi " << phi << " layer " << lay << " E " << energy << " time " << time; + edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " " + << HGCScintillatorDetId(id) << " E " << energy << " time " << time; } } for (std::map::iterator itr = map_try.begin(); itr != map_try.end(); ++itr) { @@ -186,57 +154,22 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { //Digits unsigned int kount(0); - if ((geomType_ == 0) && ifHCAL_) { - edm::Handle hbhecoll; - e.getByToken(tok_hbhe_, hbhecoll); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " - << "HBHEQIE11DigiCollection obtained " - << "with flag " << hbhecoll.isValid(); - if (hbhecoll.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HBHEDigit " - << "buffer " << hbhecoll->size(); - for (QIE11DigiCollection::const_iterator it = hbhecoll->begin(); it != hbhecoll->end(); ++it) { - QIE11DataFrame df(*it); - HcalDetId cell(df.id()); - bool hbhe = - ((cell.subdetId() == static_cast(HcalEndcap)) || (cell.subdetId() == static_cast(HcalBarrel))); - if (hbhe) { - bool bh = (cell.subdetId() == static_cast(HcalEndcap)); - int depth = cell.depth(); - double energy = df[iSample_].adc(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } - } - } else { - edm::Handle hbhecoll; - e.getByToken(tok_hbhe_, hbhecoll); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " - << "HGCalDigiCollection obtained with" - << " flag " << hbhecoll.isValid(); - if (hbhecoll.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi " - << "buffer " << hbhecoll->size(); - for (HGCalDigiCollection::const_iterator it = hbhecoll->begin(); it != hbhecoll->end(); ++it) { - HGCalDataFrame df(*it); - double energy = df[iSample_].data(); - if (geomType_ == 0) { - HcalDetId cell(df.id()); - bool hbhe = - ((cell.subdetId() == static_cast(HcalEndcap)) || (cell.subdetId() == static_cast(HcalBarrel))); - if (hbhe) { - bool bh = (cell.subdetId() == static_cast(HcalEndcap)); - int depth = cell.depth(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } else { - bool bh = (DetId(df.id()).det() == DetId::HGCalHSc); - if (bh) { - HGCScintillatorDetId cell(df.id()); - int depth = cell.layer(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } + edm::Handle hecoll; + e.getByToken(tok_digi_, hecoll); + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " + << "HGCalDigiCollection obtained with" + << " flag " << hecoll.isValid(); + if (hecoll.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi " + << "buffer " << hecoll->size(); + for (HGCalDigiCollection::const_iterator it = hecoll->begin(); it != hecoll->end(); ++it) { + HGCalDataFrame df(*it); + double energy = df[iSample_].data(); + bool bh = (DetId(df.id()).det() == DetId::HGCalHSc); + if (bh) { + HGCScintillatorDetId cell(df.id()); + int depth = cell.layer(); + analyzeDigi(cell, energy, bh, depth, kount); } } } diff --git a/Validation/HGCalValidation/plugins/HGCalDigiClient.cc b/Validation/HGCalValidation/plugins/HGCalDigiClient.cc index 6fc6092794243..e12854c9d6d3b 100644 --- a/Validation/HGCalValidation/plugins/HGCalDigiClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalDigiClient.cc @@ -14,16 +14,13 @@ #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalDigiClient : public DQMEDHarvester { private: const std::string nameDetector_; const int verbosity_; - const edm::ESGetToken tok_hcal_; const edm::ESGetToken tok_hgcal_; int layers_; @@ -34,24 +31,18 @@ class HGCalDigiClient : public DQMEDHarvester { void beginRun(const edm::Run &run, const edm::EventSetup &c) override; void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int digisEndjob(const std::vector &hcalMEs); + int digisEndjob(const std::vector &hgcalMEs); }; HGCalDigiClient::HGCalDigiClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter("DetectorName")), verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), - tok_hcal_(esConsumes(edm::ESInputTag{})), tok_hgcal_(esConsumes( edm::ESInputTag{"", nameDetector_})) {} void HGCalDigiClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants *hcons = &iSetup.getData(tok_hcal_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); - layers_ = hgcons->layers(true); - } + const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); + layers_ = hgcons->layers(true); } void HGCalDigiClient::dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) { runClient_(ib, ig); } diff --git a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc index c47927f2ec933..38313251b65ed 100644 --- a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc @@ -6,23 +6,13 @@ #include #include -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" -#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/HFNoseDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -38,9 +28,6 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" @@ -79,13 +66,10 @@ class HGCalDigiValidation : public DQMEDAnalyzer { // ----------member data --------------------------- const std::string nameDetector_; - const bool ifNose_, ifHCAL_; + const bool ifNose_; const int verbosity_, SampleIndx_; - const edm::ESGetToken tok_hcalc_; const edm::ESGetToken tok_hgcalc_; - const edm::ESGetToken tok_hcalg_; const edm::ESGetToken tok_hgcalg_; - const edm::ESGetToken tok_cond_; int layers_, firstLayer_; edm::EDGetToken digiSource_; @@ -105,30 +89,20 @@ class HGCalDigiValidation : public DQMEDAnalyzer { HGCalDigiValidation::HGCalDigiValidation(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter("DetectorName")), ifNose_(iConfig.getParameter("ifNose")), - ifHCAL_(iConfig.getParameter("ifHCAL")), verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), SampleIndx_(iConfig.getUntrackedParameter("SampleIndx", 0)), - tok_hcalc_(esConsumes(edm::ESInputTag{})), tok_hgcalc_(esConsumes( edm::ESInputTag{"", nameDetector_})), - tok_hcalg_(esConsumes()), tok_hgcalg_(esConsumes(edm::ESInputTag{"", nameDetector_})), - tok_cond_(esConsumes()), firstLayer_(1) { auto temp = iConfig.getParameter("DigiSource"); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { digiSource_ = consumes(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - digiSource_ = consumes(temp); - else - digiSource_ = consumes(temp); } else { throw cms::Exception("BadHGCDigiSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\", " - << "or \"HCal\"!"; + << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\"!"; } } @@ -137,7 +111,6 @@ void HGCalDigiValidation::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("DetectorName", "HGCalEESensitive"); desc.add("DigiSource", edm::InputTag("hgcalDigis", "EE")); desc.add("ifNose", false); - desc.add("ifHCAL", false); desc.addUntracked("Verbosity", 0); desc.addUntracked("SampleIndx", 2); // central bx descriptions.add("hgcalDigiValidationEEDefault", desc); @@ -147,20 +120,14 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent, const edm::EventSetu OccupancyMap_plus_.clear(); OccupancyMap_minus_.clear(); - const HGCalGeometry* geom0(nullptr); - const CaloGeometry* geom1(nullptr); int geomType(0); - if (nameDetector_ == "HCal") { - geom1 = &iSetup.getData(tok_hcalg_); - } else { - geom0 = &iSetup.getData(tok_hgcalg_); - if (geom0->topology().waferHexagon8()) - geomType = 1; - else if (geom0->topology().tileTrapezoid()) - geomType = 2; - if (nameDetector_ == "HGCalHFNoseSensitive") - geomType = 3; - } + const HGCalGeometry* geom0 = &iSetup.getData(tok_hgcalg_); + if (geom0->topology().waferHexagon8()) + geomType = 1; + else if (geom0->topology().tileTrapezoid()) + geomType = 2; + if (nameDetector_ == "HGCalHFNoseSensitive") + geomType = 3; unsigned int ntot(0), nused(0); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { @@ -219,68 +186,6 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent, const edm::EventSetu edm::LogVerbatim("HGCalValidation") << "DigiCollection handle does not " << "exist for " << nameDetector_; } - } else if ((nameDetector_ == "HCal") && (!ifHCAL_)) { - //HGCalBH - edm::Handle theHGCBHDigiContainers; - iEvent.getByToken(digiSource_, theHGCBHDigiContainers); - if (theHGCBHDigiContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHGCBHDigiContainers->size() << " element(s)"; - for (const auto& it : *(theHGCBHDigiContainers.product())) { - ntot++; - nused++; - HcalDetId detId = it.id(); - int layer = detId.depth(); - const HGCSample& hgcSample = it.sample(SampleIndx_); - uint16_t gain = hgcSample.toa(); - uint16_t adc = hgcSample.data(); - double charge = gain; - bool totmode = hgcSample.mode(); - bool zerothreshold = hgcSample.threshold(); - digiValidation(detId, geom1, layer, adc, charge, totmode, zerothreshold); - } - fillDigiInfo(); - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle does not " - << "exist for " << nameDetector_; - } - } else if (nameDetector_ == "HCal") { - //HE - edm::Handle theHEDigiContainers; - iEvent.getByToken(digiSource_, theHEDigiContainers); - if (theHEDigiContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHEDigiContainers->size() << " element(s)"; - const HcalDbService* conditions = &iSetup.getData(tok_cond_); - - for (const auto& it : *(theHEDigiContainers.product())) { - QIE11DataFrame df(it); - HcalDetId detId = (df.id()); - ntot++; - if (detId.subdet() == HcalEndcap) { - nused++; - HcalCalibrations calibrations = conditions->getHcalCalibrations(detId); - const HcalQIECoder* channelCoder = conditions->getHcalCoder(detId); - const HcalQIEShape* shape = conditions->getHcalShape(channelCoder); - HcalCoderDb coder(*channelCoder, *shape); - CaloSamples tool; - coder.adc2fC(df, tool); - int layer = detId.depth(); - uint16_t adc = (df)[SampleIndx_].adc(); - int capid = (df)[SampleIndx_].capid(); - double charge = (tool[SampleIndx_] - calibrations.pedestal(capid)); - bool totmode = false; - bool zerothreshold = false; - digiValidation(detId, geom1, layer, adc, charge, totmode, zerothreshold); - } - } - fillDigiInfo(); - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle does not " - << "exist for " << nameDetector_; - } } else { edm::LogWarning("HGCalValidation") << "invalid detector name !! " << nameDetector_; } @@ -356,14 +261,9 @@ void HGCalDigiValidation::fillDigiInfo() { } void HGCalDigiValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants* hcons = &iSetup.getData(tok_hcalc_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants* hgcons = &iSetup.getData(tok_hgcalc_); - layers_ = hgcons->layers(true); - firstLayer_ = hgcons->firstLayer(); - } + const HGCalDDDConstants* hgcons = &iSetup.getData(tok_hgcalc_); + layers_ = hgcons->layers(true); + firstLayer_ = hgcons->firstLayer(); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << "current DQM directory: " diff --git a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc index 8cee8099afcfd..9fa1d203597b6 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc @@ -17,16 +17,8 @@ #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" @@ -47,7 +39,6 @@ #include "SimG4CMS/Calo/interface/HGCNumberingScheme.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include @@ -74,20 +65,13 @@ class HGCalHitValidation : public DQMEDAnalyzer { int idet, MonitorElement* hist, std::map&); - template - void analyzeHGCalRecHit(T1 const& theHits, std::map const& hitRefs); private: //HGC Geometry std::vector hgcCons_; std::vector hgcGeometry_; - const HcalDDDSimConstants* hcCons_; - const HcalDDDRecConstants* hcConr_; - const CaloSubdetectorGeometry* hcGeometry_; std::vector geometrySource_; std::vector ietaExcludeBH_; - bool ifHCAL_; - bool ifHCALsim_; edm::InputTag eeSimHitSource, fhSimHitSource, bhSimHitSource; edm::EDGetTokenT> eeSimHitToken_; @@ -95,8 +79,9 @@ class HGCalHitValidation : public DQMEDAnalyzer { edm::EDGetTokenT> bhSimHitToken_; edm::EDGetTokenT eeRecHitToken_; edm::EDGetTokenT fhRecHitToken_; - edm::EDGetTokenT bhRecHitTokeng_; - edm::EDGetTokenT bhRecHitTokenh_; + edm::EDGetTokenT bhRecHitToken_; + std::vector> tok_ddd_; + std::vector> tok_geom_; //histogram related stuff MonitorElement *heedzVsZ, *heedyVsY, *heedxVsX; @@ -114,23 +99,24 @@ class HGCalHitValidation : public DQMEDAnalyzer { }; HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { - geometrySource_ = cfg.getUntrackedParameter>("geometrySource"); + geometrySource_ = cfg.getParameter>("geometrySource"); eeSimHitToken_ = consumes>(cfg.getParameter("eeSimHitSource")); fhSimHitToken_ = consumes>(cfg.getParameter("fhSimHitSource")); bhSimHitToken_ = consumes>(cfg.getParameter("bhSimHitSource")); eeRecHitToken_ = consumes(cfg.getParameter("eeRecHitSource")); fhRecHitToken_ = consumes(cfg.getParameter("fhRecHitSource")); + bhRecHitToken_ = consumes(cfg.getParameter("bhRecHitSource")); ietaExcludeBH_ = cfg.getParameter>("ietaExcludeBH"); - ifHCAL_ = cfg.getParameter("ifHCAL"); - ifHCALsim_ = cfg.getParameter("ifHCALsim"); - if (ifHCAL_) - bhRecHitTokenh_ = consumes(cfg.getParameter("bhRecHitSource")); - else - bhRecHitTokeng_ = consumes(cfg.getParameter("bhRecHitSource")); + + for (const auto& name : geometrySource_) { + tok_ddd_.emplace_back( + esConsumes(edm::ESInputTag{"", name})); + tok_geom_.emplace_back( + esConsumes(edm::ESInputTag{"", name})); + } #ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "Exclude the following " << ietaExcludeBH_.size() << " ieta values from BH plots (BH " - << ifHCAL_ << ") "; + edm::LogInfo("HGCalValid") << "Exclude the following " << ietaExcludeBH_.size() << " ieta values from BH plots"; for (unsigned int k = 0; k < ietaExcludeBH_.size(); ++k) edm::LogInfo("HGCalValid") << " [" << k << "] " << ietaExcludeBH_[k]; #endif @@ -139,11 +125,18 @@ HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { HGCalHitValidation::~HGCalHitValidation() {} void HGCalHitValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); + std::vector source = {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}; + desc.add>("geometrySource", source); + desc.add("eeSimHitSource", edm::InputTag("g4SimHits", "HGCHitsEE")); + desc.add("fhSimHitSource", edm::InputTag("g4SimHits", "HGCHitsHEfront")); + desc.add("bhSimHitSource", edm::InputTag("g4SimHits", "HGCHitsHEback")); + desc.add("eeRecHitSource", edm::InputTag("HGCalRecHit", "HGCEERecHits")); + desc.add("fhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEFRecHits")); + desc.add("bhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEBRecHits")); + std::vector dummy; + desc.add>("ietaExcludeBH", dummy); + descriptions.add("hgcalHitValidation", desc); } void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, edm::EventSetup const&) { @@ -187,46 +180,17 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, void HGCalHitValidation::dqmBeginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::ESHandle pHSNDC; - iSetup.get().get(pHSNDC); - if (pHSNDC.isValid()) { - hcCons_ = pHSNDC.product(); - hgcCons_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle pHRNDC; - iSetup.get().get(pHRNDC); - if (pHRNDC.isValid()) { - hcConr_ = pHRNDC.product(); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle caloG; - iSetup.get().get(caloG); - if (caloG.isValid()) { - const CaloGeometry* geo = caloG.product(); - hcGeometry_ = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - hgcGeometry_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i] << std::endl; - } + edm::ESHandle hgcCons = iSetup.getHandle(tok_ddd_[i]); + if (hgcCons.isValid()) { + hgcCons_.push_back(hgcCons.product()); } else { - edm::ESHandle hgcCons; - iSetup.get().get(geometrySource_[i], hgcCons); - if (hgcCons.isValid()) { - hgcCons_.push_back(hgcCons.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; - } - edm::ESHandle hgcGeom; - iSetup.get().get(geometrySource_[i], hgcGeom); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; + } + edm::ESHandle hgcGeom = iSetup.getHandle(tok_geom_[i]); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + } else { + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; } } } @@ -273,38 +237,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup edm::Handle> bhSimHits; iEvent.getByToken(bhSimHitToken_, bhSimHits); if (bhSimHits.isValid()) { - if (ifHCALsim_) { - for (std::vector::const_iterator simHit = bhSimHits->begin(); simHit != bhSimHits->end(); ++simHit) { - int subdet, z, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay); - - if (subdet == static_cast(HcalEndcap)) { - HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi); - double zp = cell.rz / 10; - - HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet, eta, phi, lay, depth); - int sign = (z == 0) ? (-1) : (1); - zp *= sign; - HcalDetId id = HcalDetId(HcalEndcap, sign * idx.eta, idx.phi, idx.depth); - - float energy = simHit->energy(); - float energySum(energy); - if (bhHitRefs.count(id.rawId()) != 0) - energySum += std::get<0>(bhHitRefs[id.rawId()]); - hebEnSim->Fill(energy); - if (std::find(ietaExcludeBH_.begin(), ietaExcludeBH_.end(), idx.eta) == ietaExcludeBH_.end()) { - bhHitRefs[id.rawId()] = std::make_tuple(energySum, cell.eta, cell.phi, zp); -#ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "Accept " << id << std::endl; - } else { - edm::LogInfo("HGCalValid") << "Reject " << id << std::endl; -#endif - } - } - } - } else { - analyzeHGCalSimHit(bhSimHits, 2, hebEnSim, bhHitRefs); - } + analyzeHGCalSimHit(bhSimHits, 2, hebEnSim, bhHitRefs); #ifdef EDM_ML_DEBUG for (std::map::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) { int idx = std::distance(bhHitRefs.begin(), itr); @@ -379,24 +312,39 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } //accessing BH Rechit information - if (ifHCAL_) { - edm::Handle bhRecHit; - iEvent.getByToken(bhRecHitTokenh_, bhRecHit); - if (bhRecHit.isValid()) { - const HBHERecHitCollection* theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; + edm::Handle bhRecHit; + iEvent.getByToken(bhRecHitToken_, bhRecHit); + if (bhRecHit.isValid()) { + const HGChebRecHitCollection* theHits = (bhRecHit.product()); + for (auto it = theHits->begin(); it != theHits->end(); ++it) { + double energy = it->energy(); + hebEnRec->Fill(energy); + std::map::const_iterator itr = bhHitRefs.find(it->id().rawId()); + GlobalPoint xyz = hgcGeometry_[2]->getPosition(it->id()); + if (itr != bhHitRefs.end()) { + float ang3 = xyz.phi().value(); // returns the phi in radians + double fac = sinh(std::get<1>(itr->second)); + double pT = std::get<3>(itr->second) / fac; + double xp = pT * cos(std::get<2>(itr->second)); + double yp = pT * sin(std::get<2>(itr->second)); + hebRecVsSimX->Fill(xp, xyz.x()); + hebRecVsSimY->Fill(yp, xyz.y()); + hebRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); + hebdEtaVsEta->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); + hebdPhiVsPhi->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); + hebdzVsZ->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); + hebEnSimRec->Fill(std::get<0>(itr->second), energy); + +#ifdef EDM_ML_DEBUG + edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" + << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" + << energy << ", " << xyz.x() << ", " << xyz.y() << ", " << xyz.z() << ")\n"; +#endif + } } } else { - edm::Handle bhRecHit; - iEvent.getByToken(bhRecHitTokeng_, bhRecHit); - if (bhRecHit.isValid()) { - const HGChebRecHitCollection* theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; - } + edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; } } @@ -436,41 +384,6 @@ void HGCalHitValidation::analyzeHGCalSimHit(edm::Handle> c } } -template -void HGCalHitValidation::analyzeHGCalRecHit(T1 const& theHits, std::map const& hitRefs) { - for (auto it = theHits->begin(); it != theHits->end(); ++it) { - DetId id = it->id(); - if (id.det() == DetId::Hcal and id.subdetId() == (int)(HcalEndcap)) { - double energy = it->energy(); - hebEnRec->Fill(energy); - GlobalPoint xyz = hcGeometry_->getGeometry(id)->getPosition(); - - std::map::const_iterator itr = hitRefs.find(id.rawId()); - if (itr != hitRefs.end()) { - float ang3 = xyz.phi().value(); // returns the phi in radians - double fac = sinh(std::get<1>(itr->second)); - double pT = std::get<3>(itr->second) / fac; - double xp = pT * cos(std::get<2>(itr->second)); - double yp = pT * sin(std::get<2>(itr->second)); - hebRecVsSimX->Fill(xp, xyz.x()); - hebRecVsSimY->Fill(yp, xyz.y()); - hebRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); - hebdEtaVsEta->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); - hebdPhiVsPhi->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); - hebdzVsZ->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); - hebEnSimRec->Fill(std::get<0>(itr->second), energy); - -#ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" - << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " - << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" - << energy << ", " << xyz.x() << ", " << xyz.y() << ", " << xyz.z() << ")\n"; -#endif - } - } - } -} - //define this as a plug-in #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(HGCalHitValidation); diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc index 2e962851ef802..d608f88b0f19e 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc @@ -8,9 +8,6 @@ #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" @@ -27,11 +24,8 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include "TVector3.h" @@ -69,12 +63,9 @@ class HGCalRecHitValidation : public DQMEDAnalyzer { // ----------member data --------------------------- std::string nameDetector_; - edm::ESGetToken caloGeomToken_; edm::ESGetToken geometry_token_; - edm::ESGetToken pHRNDCToken_; edm::ESGetToken geometry_beginRun_token_; edm::EDGetToken recHitSource_; - bool ifHCAL_; int verbosity_; unsigned int layers_; int firstLayer_; @@ -92,27 +83,19 @@ class HGCalRecHitValidation : public DQMEDAnalyzer { HGCalRecHitValidation::HGCalRecHitValidation(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter("DetectorName")), - caloGeomToken_(esConsumes()), geometry_token_(esConsumes(edm::ESInputTag("", nameDetector_))), - pHRNDCToken_(esConsumes()), geometry_beginRun_token_(esConsumes( edm::ESInputTag("", nameDetector_))), - ifHCAL_(iConfig.getParameter("ifHCAL")), verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), firstLayer_(1) { auto temp = iConfig.getParameter("RecHitSource"); if (nameDetector_ == "HGCalEESensitive" || nameDetector_ == "HGCalHESiliconSensitive" || nameDetector_ == "HGCalHEScintillatorSensitive") { recHitSource_ = consumes(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - recHitSource_ = consumes(temp); - else - recHitSource_ = consumes(temp); } else { throw cms::Exception("BadHGCRecHitSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", or \"HCal\"!"; + << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\"!"; } } @@ -120,7 +103,6 @@ void HGCalRecHitValidation::fillDescriptions(edm::ConfigurationDescriptions& des edm::ParameterSetDescription desc; desc.add("DetectorName", "HGCalEESensitive"); desc.add("RecHitSource", edm::InputTag("HGCalRecHit", "HGCEERecHits")); - desc.add("ifHCAL", false); desc.addUntracked("Verbosity", 0); descriptions.add("hgcalRecHitValidationEE", desc); } @@ -131,82 +113,33 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe bool ok(true); unsigned int ntot(0), nused(0); - if (nameDetector_ == "HCal") { - edm::ESHandle geom = iSetup.getHandle(caloGeomToken_); - if (!geom.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const CaloGeometry* geom0 = geom.product(); - if (ifHCAL_) { - edm::Handle hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - if (detId.subdetId() == HcalEndcap) { - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HBHERecHitCollection " - << "Handle does not exist !!!"; - } - } else { - edm::Handle hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HGChebRecHitCollection " - << "Handle does not exist !!!"; - } - } - } + edm::ESHandle geomHandle = iSetup.getHandle(geometry_token_); + if (!geomHandle.isValid()) { + edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " + << "Object for " << nameDetector_; } else { - edm::ESHandle geomHandle = iSetup.getHandle(geometry_token_); - if (!geomHandle.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const HGCalGeometry* geom0 = geomHandle.product(); - int geomType = ((geom0->topology().waferHexagon8()) ? 1 : ((geom0->topology().tileTrapezoid()) ? 2 : 0)); - - edm::Handle theRecHitContainers; - iEvent.getByToken(recHitSource_, theRecHitContainers); - if (theRecHitContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; - for (const auto& it : *(theRecHitContainers.product())) { - ntot++; - nused++; - DetId detId = it.id(); - int layer = ((geomType == 0) - ? HGCalDetId(detId).layer() - : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle " - << "does not exist !!!"; + const HGCalGeometry* geom0 = geomHandle.product(); + int geomType = ((geom0->topology().waferHexagon8()) ? 1 : ((geom0->topology().tileTrapezoid()) ? 2 : 0)); + + edm::Handle theRecHitContainers; + iEvent.getByToken(recHitSource_, theRecHitContainers); + if (theRecHitContainers.isValid()) { + if (verbosity_ > 0) + edm::LogVerbatim("HGCalValidation") + << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; + for (const auto& it : *(theRecHitContainers.product())) { + ntot++; + nused++; + DetId detId = it.id(); + int layer = ((geomType == 0) + ? HGCalDetId(detId).layer() + : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); + recHitValidation(detId, layer, geom0, &it); } + } else { + ok = false; + edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle " + << "does not exist !!!"; } } if (ok) @@ -277,20 +210,15 @@ void HGCalRecHitValidation::fillHitsInfo(HitsInfo& hits) { } void HGCalRecHitValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants& hcons = iSetup.getData(pHRNDCToken_); - layers_ = hcons.getMaxDepth(1); + edm::ESHandle geomHandle = iSetup.getHandle(geometry_beginRun_token_); + if (!geomHandle.isValid()) { + edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " + << "Object for " << nameDetector_; } else { - edm::ESHandle geomHandle = iSetup.getHandle(geometry_beginRun_token_); - if (!geomHandle.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const HGCalGeometry* geom = geomHandle.product(); - const HGCalDDDConstants& hgcons_ = geom->topology().dddConstants(); - layers_ = hgcons_.layers(true); - firstLayer_ = hgcons_.firstLayer(); - } + const HGCalGeometry* geom = geomHandle.product(); + const HGCalDDDConstants& hgcons_ = geom->topology().dddConstants(); + layers_ = hgcons_.layers(true); + firstLayer_ = hgcons_.firstLayer(); } } diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc index 1b53010405676..efe8f48e673bd 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc @@ -17,16 +17,15 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalRecHitsClient : public DQMEDHarvester { private: //member data - std::string nameDetector_; - int verbosity_; + const std::string nameDetector_; + const int verbosity_; + const edm::ESGetToken ddc_token_; unsigned int layers_; public: @@ -37,25 +36,18 @@ class HGCalRecHitsClient : public DQMEDHarvester { void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int recHitsEndjob(const std::vector &hcalMEs); + int recHitsEndjob(const std::vector &hgcalMEs); }; HGCalRecHitsClient::HGCalRecHitsClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter("DetectorName")), - verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)) {} + verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), + ddc_token_(esConsumes( + edm::ESInputTag{"", nameDetector_})) {} void HGCalRecHitsClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle pHRNDC; - iSetup.get().get(pHRNDC); - const HcalDDDRecConstants *hcons = &(*pHRNDC); - layers_ = hcons->getMaxDepth(1); - } else { - edm::ESHandle pHGDC; - iSetup.get().get(nameDetector_, pHGDC); - const HGCalDDDConstants &hgcons_ = (*pHGDC); - layers_ = hgcons_.layers(true); - } + const HGCalDDDConstants &hgcons_ = iSetup.getData(ddc_token_); + layers_ = hgcons_.layers(true); } void HGCalRecHitsClient::dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) { runClient_(ib, ig); } diff --git a/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc b/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc index fa2b9047ab22a..5990f506c0a45 100644 --- a/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc +++ b/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc @@ -4,7 +4,6 @@ #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" @@ -55,6 +54,7 @@ class HGCalShowerSeparation : public DQMEDAnalyzer { edm::EDGetTokenT> hitMap_; edm::EDGetTokenT> caloParticles_; + const edm::ESGetToken tok_geom_; int debug_; bool filterOnEnergyAndCaloP_; @@ -82,7 +82,8 @@ class HGCalShowerSeparation : public DQMEDAnalyzer { }; HGCalShowerSeparation::HGCalShowerSeparation(const edm::ParameterSet& iConfig) - : debug_(iConfig.getParameter("debug")), + : tok_geom_(esConsumes()), + debug_(iConfig.getParameter("debug")), filterOnEnergyAndCaloP_(iConfig.getParameter("filterOnEnergyAndCaloP")) { auto hitMapInputTag = iConfig.getParameter("hitMapTag"); auto caloParticles = iConfig.getParameter("caloParticles"); @@ -160,9 +161,7 @@ void HGCalShowerSeparation::bookHistograms(DQMStore::IBooker& ibooker, void HGCalShowerSeparation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle geom; - iSetup.get().get(geom); - recHitTools_.setGeometry(*geom); + recHitTools_.setGeometry(iSetup.getData(tok_geom_)); Handle> caloParticleHandle; iEvent.getByToken(caloParticles_, caloParticleHandle); diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc index 229bc5f7df33a..7d697779d7419 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc @@ -13,7 +13,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" @@ -25,11 +24,8 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" @@ -74,11 +70,8 @@ class HGCalSimHitStudy : public edm::one::EDAnalyzer tok_hrndc_; std::vector > tok_hgcGeom_; std::vector hgcons_; - const HcalDDDRecConstants* hcons_; - std::vector heRebuild_; std::vector > tok_hits_; std::vector layers_, layerFront_; @@ -106,21 +99,11 @@ HGCalSimHitStudy::HGCalSimHitStudy(const edm::ParameterSet& iConfig) ifLayer_(iConfig.getUntrackedParameter("ifLayer", false)) { usesResource(TFileService::kSharedResource); - for (auto const& name : nameDetectors_) { - if (name == "HCal") { - heRebuild_.emplace_back(true); - tok_hrndc_ = esConsumes(); - tok_hgcGeom_.emplace_back(esConsumes( - edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})); - } else { - heRebuild_.emplace_back(false); - tok_hgcGeom_.emplace_back( - esConsumes(edm::ESInputTag{"", name})); - } - } - for (auto const& source : caloHitSources_) { + for (auto const& name : nameDetectors_) + tok_hgcGeom_.emplace_back( + esConsumes(edm::ESInputTag{"", name})); + for (auto const& source : caloHitSources_) tok_hits_.emplace_back(consumes(edm::InputTag("g4SimHits", source))); - } } void HGCalSimHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -154,20 +137,7 @@ void HGCalSimHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size(); std::vector caloHits; - if (heRebuild_[k]) { - for (auto const& hit : *(theCaloHitContainers.product())) { - unsigned int id = hit.id(); - HcalDetId hid = HcalHitRelabeller::relabel(id, hcons_); - if (hid.subdet() != static_cast(HcalEndcap)) { - caloHits.emplace_back(hit); - caloHits.back().setID(hid.rawId()); - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << "Hit[" << caloHits.size() << "] " << hid; - } - } - } else { - caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); - } + caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); analyzeHits(k, nameDetectors_[k], caloHits); } else if (verbosity_ > 0) { edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not " @@ -191,73 +161,55 @@ void HGCalSimHitStudy::analyzeHits(int ih, std::string const& name, std::vector< int cell, sector, sector2(0), layer, zside; int subdet(0), cell2(0), type(0); HepGeom::Point3D gcoord; - if (heRebuild_[ih]) { - HcalDetId detId = HcalDetId(id); - subdet = detId.subdet(); - cell = detId.ietaAbs(); - sector = detId.iphi(); - layer = detId.depth(); + std::pair xy; + if (ifNose_) { + HFNoseDetId detId = HFNoseDetId(id); + subdet = detId.subdetId(); + cell = detId.cellU(); + cell2 = detId.cellV(); + sector = detId.waferU(); + sector2 = detId.waferV(); + type = detId.type(); + layer = detId.layer(); + zside = detId.zside(); + xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); + h_W2_[ih]->Fill(sector2); + h_C2_[ih]->Fill(cell2); + } else if (hgcons_[ih]->waferHexagon8()) { + HGCSiliconDetId detId = HGCSiliconDetId(id); + subdet = static_cast(detId.det()); + cell = detId.cellU(); + cell2 = detId.cellV(); + sector = detId.waferU(); + sector2 = detId.waferV(); + type = detId.type(); + layer = detId.layer(); zside = detId.zside(); - std::pair etaphi = hcons_->getEtaPhi(subdet, zside * cell, sector); - double rz = hcons_->getRZ(subdet, zside * cell, layer); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" - << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz; - gcoord = HepGeom::Point3D(rz * cos(etaphi.second) / cosh(etaphi.first), - rz * sin(etaphi.second) / cosh(etaphi.first), - rz * tanh(etaphi.first)); + xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); + h_W2_[ih]->Fill(sector2); + h_C2_[ih]->Fill(cell2); + } else if (hgcons_[ih]->tileTrapezoid()) { + HGCScintillatorDetId detId = HGCScintillatorDetId(id); + subdet = static_cast(detId.det()); + sector = detId.ieta(); + cell = detId.iphi(); + type = detId.type(); + layer = detId.layer(); + zside = detId.zside(); + xy = hgcons_[ih]->locateCellTrap(layer, sector, cell, false); } else { - std::pair xy; - if (ifNose_) { - HFNoseDetId detId = HFNoseDetId(id); - subdet = detId.subdetId(); - cell = detId.cellU(); - cell2 = detId.cellV(); - sector = detId.waferU(); - sector2 = detId.waferV(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); - h_W2_[ih]->Fill(sector2); - h_C2_[ih]->Fill(cell2); - - } else if (hgcons_[ih]->waferHexagon8()) { - HGCSiliconDetId detId = HGCSiliconDetId(id); - subdet = static_cast(detId.det()); - cell = detId.cellU(); - cell2 = detId.cellV(); - sector = detId.waferU(); - sector2 = detId.waferV(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); - h_W2_[ih]->Fill(sector2); - h_C2_[ih]->Fill(cell2); - } else if (hgcons_[ih]->tileTrapezoid()) { - HGCScintillatorDetId detId = HGCScintillatorDetId(id); - subdet = static_cast(detId.det()); - sector = detId.ieta(); - cell = detId.iphi(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCellTrap(layer, sector, cell, false); - } else { - HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector, type, cell); - xy = hgcons_[ih]->locateCell(cell, layer, sector, false); - } - double zp = hgcons_[ih]->waferZ(layer, false); - if (zside < 0) - zp = -zp; - double xp = (zp < 0) ? -xy.first : xy.first; - gcoord = HepGeom::Point3D(xp, xy.second, zp); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") - << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" - << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; + HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector, type, cell); + xy = hgcons_[ih]->locateCell(cell, layer, sector, false); } + double zp = hgcons_[ih]->waferZ(layer, false); + if (zside < 0) + zp = -zp; + double xp = (zp < 0) ? -xy.first : xy.first; + gcoord = HepGeom::Point3D(xp, xy.second, zp); + if (verbosity_ > 2) + edm::LogVerbatim("HGCalValidation") + << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" + << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; nused++; double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light; if (verbosity_ > 1) @@ -329,19 +281,9 @@ void HGCalSimHitStudy::analyzeHits(int ih, std::string const& name, std::vector< // ------------ method called when starting to processes a run ------------ void HGCalSimHitStudy::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { for (unsigned int k = 0; k < nameDetectors_.size(); ++k) { - if (heRebuild_[k]) { - hcons_ = &iSetup.getData(tok_hrndc_); - layers_.emplace_back(hcons_->getMaxDepth(1)); - hgcons_.emplace_back(nullptr); - layerFront_.emplace_back(40); - } else { - hgcons_.emplace_back(&iSetup.getData(tok_hgcGeom_[k])); - layers_.emplace_back(hgcons_.back()->layers(false)); - if (k == 0) - layerFront_.emplace_back(0); - else - layerFront_.emplace_back(28); - } + hgcons_.emplace_back(&iSetup.getData(tok_hgcGeom_[k])); + layers_.emplace_back(hgcons_.back()->layers(false)); + layerFront_.emplace_back(hgcons_.back()->firstLayer()); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << nameDetectors_[k] << " defined with " << layers_.back() << " Layers with " << layerFront_.back() << " in front"; @@ -460,7 +402,7 @@ void HGCalSimHitStudy::beginJob() { name << "LY_" << nameDetectors_[ih]; title << "Layer number for " << nameDetectors_[ih]; h_Ly_.emplace_back(fs->make(name.str().c_str(), title.str().c_str(), 200, 0, 100)); - if ((nameDetectors_[ih] == "HGCalHEScintillatorSensitive") || heRebuild_[ih]) { + if (nameDetectors_[ih] == "HGCalHEScintillatorSensitive") { name.str(""); title.str(""); name << "IR_" << nameDetectors_[ih]; diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc index 22fd33818b5ec..a121f956a8575 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc @@ -10,7 +10,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDSpecifics.h" @@ -33,12 +32,9 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" @@ -91,17 +87,15 @@ class HGCalSimHitValidation : public DQMEDAnalyzer { // ----------member data --------------------------- const std::string nameDetector_, caloHitSource_; const HGCalDDDConstants* hgcons_; - const HcalDDDRecConstants* hcons_; const std::vector times_; const int verbosity_; - const bool testNumber_, fromDDD_; - const edm::ESGetToken tok_hcal_; + const bool fromDDD_; const edm::ESGetToken tok_hgcal_; const edm::ESGetToken tok_cpv_; const edm::ESGetToken tok_cpvc_; edm::EDGetTokenT tok_hits_; edm::EDGetTokenT tok_hepMC_; - bool heRebuild_, symmDet_; + bool symmDet_; unsigned int layers_; int firstLayer_; std::map transMap_; @@ -119,16 +113,13 @@ HGCalSimHitValidation::HGCalSimHitValidation(const edm::ParameterSet& iConfig) caloHitSource_(iConfig.getParameter("CaloHitSource")), times_(iConfig.getParameter >("TimeSlices")), verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), - testNumber_(iConfig.getUntrackedParameter("TestNumber", true)), fromDDD_(iConfig.getUntrackedParameter("fromDDD", true)), - tok_hcal_(esConsumes(edm::ESInputTag{})), tok_hgcal_(esConsumes( edm::ESInputTag{"", nameDetector_})), tok_cpv_(esConsumes()), tok_cpvc_(esConsumes()), symmDet_(true), firstLayer_(1) { - heRebuild_ = (nameDetector_ == "HCal") ? true : false; tok_hepMC_ = consumes(edm::InputTag("generatorSmeared")); tok_hits_ = consumes(edm::InputTag("g4SimHits", caloHitSource_)); nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size(); @@ -172,17 +163,6 @@ void HGCalSimHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size(); std::vector caloHits; caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); - if (heRebuild_ && testNumber_) { - for (unsigned int i = 0; i < caloHits.size(); ++i) { - unsigned int id_ = caloHits[i].id(); - HcalDetId hid = HcalHitRelabeller::relabel(id_, hcons_); - if (hid.subdet() != int(HcalEndcap)) - hid = HcalDetId(HcalEmpty, hid.ieta(), hid.iphi(), hid.depth()); - caloHits[i].setID(hid.rawId()); - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << "Hit[" << i << "] " << hid; - } - } analyzeHits(caloHits); } else if (verbosity_ > 0) { edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!"; @@ -206,17 +186,7 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { uint32_t id_ = hits[i].id(); int cell, sector, subsector(0), layer, zside; int subdet(0), cell2(0), type(0); - if (heRebuild_) { - HcalDetId detId = HcalDetId(id_); - subdet = detId.subdet(); - if (subdet != static_cast(HcalEndcap)) - continue; - cell = detId.ietaAbs(); - sector = detId.iphi(); - subsector = 1; - layer = detId.depth(); - zside = detId.zside(); - } else if (hgcons_->waferHexagon8()) { + if (hgcons_->waferHexagon8()) { HGCSiliconDetId detId = HGCSiliconDetId(id_); subdet = ForwardEmpty; cell = detId.cellU(); @@ -226,8 +196,6 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { type = detId.type(); layer = detId.layer(); zside = detId.zside(); - } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) { - HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell); } else if (hgcons_->tileTrapezoid()) { HGCScintillatorDetId detId = HGCScintillatorDetId(id_); subdet = ForwardEmpty; @@ -248,36 +216,19 @@ void HGCalSimHitValidation::analyzeHits(std::vector& hits) { << " energyem = " << hits[i].energyEM() << " energyhad = " << hits[i].energyHad() << " time = " << time; HepGeom::Point3D gcoord; - if (heRebuild_) { - std::pair etaphi = hcons_->getEtaPhi(subdet, zside * cell, sector); - double rz = hcons_->getRZ(subdet, zside * cell, layer); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" - << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz; - gcoord = HepGeom::Point3D(rz * cos(etaphi.second) / cosh(etaphi.first), - rz * sin(etaphi.second) / cosh(etaphi.first), - rz * tanh(etaphi.first)); - } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) { - std::pair xy = hgcons_->locateCell(cell, layer, subsector, false); - const HepGeom::Point3D lcoord(xy.first, xy.second, 0); - int subs = (symmDet_ ? 0 : subsector); - id_ = HGCalTestNumbering::packSquareIndex(zside, layer, sector, subs, 0); - gcoord = (transMap_[id_] * lcoord); + std::pair xy; + if (hgcons_->waferHexagon8()) { + xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true); + } else if (hgcons_->tileTrapezoid()) { + xy = hgcons_->locateCellTrap(layer, sector, cell, false); } else { - std::pair xy; - if (hgcons_->waferHexagon8()) { - xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true); - } else if (hgcons_->tileTrapezoid()) { - xy = hgcons_->locateCellTrap(layer, sector, cell, false); - } else { - xy = hgcons_->locateCell(cell, layer, sector, false); - } - double zp = hgcons_->waferZ(layer, false); - if (zside < 0) - zp = -zp; - float xp = (zp < 0) ? -xy.first : xy.first; - gcoord = HepGeom::Point3D(xp, xy.second, zp); + xy = hgcons_->locateCell(cell, layer, sector, false); } + double zp = hgcons_->waferZ(layer, false); + if (zside < 0) + zp = -zp; + float xp = (zp < 0) ? -xy.first : xy.first; + gcoord = HepGeom::Point3D(xp, xy.second, zp); double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light; if (verbosity_ > 1) edm::LogVerbatim("HGCalValidation") @@ -466,20 +417,15 @@ bool HGCalSimHitValidation::defineGeometry(const cms::DDCompactView* ddViewH) { // ------------ method called when starting to processes a run ------------ void HGCalSimHitValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (heRebuild_) { - hcons_ = &iSetup.getData(tok_hcal_); - layers_ = hcons_->getMaxDepth(1); + hgcons_ = &iSetup.getData(tok_hgcal_); + layers_ = hgcons_->layers(false); + firstLayer_ = hgcons_->firstLayer(); + if (fromDDD_) { + const DDCompactView* pDD = &iSetup.getData(tok_cpv_); + defineGeometry(pDD); } else { - hgcons_ = &iSetup.getData(tok_hgcal_); - layers_ = hgcons_->layers(false); - firstLayer_ = hgcons_->firstLayer(); - if (fromDDD_) { - const DDCompactView* pDD = &iSetup.getData(tok_cpv_); - defineGeometry(pDD); - } else { - const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_); - defineGeometry(pDD); - } + const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_); + defineGeometry(pDD); } if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at " diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc b/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc index 4d2432c1ad775..1c835f929030d 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc @@ -18,9 +18,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalSimHitsClient : public DQMEDHarvester { @@ -28,7 +26,6 @@ class HGCalSimHitsClient : public DQMEDHarvester { //member data const std::string nameDetector_; const int nTimes_, verbosity_; - const edm::ESGetToken tok_hcal_; const edm::ESGetToken tok_hgcal_; unsigned int layers_; @@ -39,25 +36,19 @@ class HGCalSimHitsClient : public DQMEDHarvester { void beginRun(const edm::Run &run, const edm::EventSetup &c) override; void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int simHitsEndjob(const std::vector &hcalMEs); + int simHitsEndjob(const std::vector &hgcalMEs); }; HGCalSimHitsClient::HGCalSimHitsClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter("DetectorName")), nTimes_(iConfig.getParameter("TimeSlices")), verbosity_(iConfig.getUntrackedParameter("Verbosity", 0)), - tok_hcal_(esConsumes(edm::ESInputTag{})), tok_hgcal_(esConsumes( edm::ESInputTag{"", nameDetector_})) {} void HGCalSimHitsClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants *hcons = &iSetup.getData(tok_hcal_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); - layers_ = hgcons->layers(true); - } + const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); + layers_ = hgcons->layers(true); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << "Initialize HGCalSimHitsClient for " << nameDetector_ << " : " << layers_; } diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index e662bd1ff7b32..a44dad1b64e3e 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -11,7 +11,7 @@ using namespace edm; HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) : caloGeomToken_(esConsumes()), label_lcl(pset.getParameter("label_lcl")), - label_mcl(pset.getParameter>("label_mcl")), + label_tst(pset.getParameter>("label_tst")), associator_(pset.getUntrackedParameter("associator")), associatorSim_(pset.getUntrackedParameter("associatorSim")), SaveGeneralInfo_(pset.getUntrackedParameter("SaveGeneralInfo")), @@ -19,7 +19,7 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) doCaloParticleSelection_(pset.getUntrackedParameter("doCaloParticleSelection")), doSimClustersPlots_(pset.getUntrackedParameter("doSimClustersPlots")), doLayerClustersPlots_(pset.getUntrackedParameter("doLayerClustersPlots")), - doMultiClustersPlots_(pset.getUntrackedParameter("doMultiClustersPlots")), + doTrackstersPlots_(pset.getUntrackedParameter("doTrackstersPlots")), label_clustersmask(pset.getParameter>("LayerClustersInputMask")), cummatbudinxo_(pset.getParameter("cummatbudinxo")) { //In this way we can easily generalize to associations between other objects also. @@ -42,12 +42,12 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) density_ = consumes(edm::InputTag("hgcalLayerClusters")); - simclusters_ = consumes>(pset.getParameter("label_scl")); + simClusters_ = consumes>(pset.getParameter("label_scl")); layerclusters_ = consumes(label_lcl); - for (auto& itag : label_mcl) { - label_mclTokens.push_back(consumes>(itag)); + for (auto& itag : label_tst) { + label_tstTokens.push_back(consumes(itag)); } associatorMapRtS = consumes(associator_); @@ -115,7 +115,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName_); } - //Booking histograms concerning with simclusters + //Booking histograms concerning with simClusters if (doSimClustersPlots_) { ibook.cd(); ibook.setCurrentFolder(dirName_ + "simClusters/ClusterLevel"); @@ -147,7 +147,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, histoProducerAlgo_->bookSimClusterAssociationHistos( ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); } //end of loop over masks - } //if for simcluster plots + } //if for simCluster plots //Booking histograms concerning with hgcal layer clusters if (doLayerClustersPlots_) { @@ -169,10 +169,10 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); } - //Booking histograms for multiclusters - for (unsigned int www = 0; www < label_mcl.size(); www++) { + //Booking histograms for Tracksters + for (unsigned int www = 0; www < label_tst.size(); www++) { ibook.cd(); - InputTag algo = label_mcl[www]; + InputTag algo = label_tst[www]; string dirName = dirName_; if (!algo.process().empty()) dirName += algo.process() + "_"; @@ -192,11 +192,11 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName); - //Booking histograms concerning for hgcal multi clusters - if (doMultiClustersPlots_) { - histoProducerAlgo_->bookMultiClusterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); + //Booking histograms concerning for HGCal tracksters + if (doTrackstersPlots_) { + histoProducerAlgo_->bookTracksterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); } - } //end of booking multiclusters loop + } //end of booking Tracksters loop } void HGCalValidator::cpParametersAndSelection(const Histograms& histograms, @@ -278,8 +278,8 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, //get collections from the event //simClusters edm::Handle> simClustersHandle; - event.getByToken(simclusters_, simClustersHandle); - std::vector const& simclusters = *simClustersHandle; + event.getByToken(simClusters_, simClustersHandle); + std::vector const& simClusters = *simClustersHandle; //Layer clusters edm::Handle clusterHandle; @@ -291,16 +291,16 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(density_, densityHandle); const Density& densities = *densityHandle; - auto nSimClusters = simclusters.size(); + auto nSimClusters = simClusters.size(); std::vector sCIndices; //There shouldn't be any SimTracks from different crossings, but maybe they will be added later. //At the moment there should be one SimTrack in each SimCluster. for (unsigned int scId = 0; scId < nSimClusters; ++scId) { - if (simclusters[scId].g4Tracks()[0].eventId().event() != 0 or - simclusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0) { + if (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or + simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0) { LogDebug("HGCalValidator") << "Excluding SimClusters from event: " - << simclusters[scId].g4Tracks()[0].eventId().event() - << " with BX: " << simclusters[scId].g4Tracks()[0].eventId().bunchCrossing() + << simClusters[scId].g4Tracks()[0].eventId().event() + << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; } @@ -308,11 +308,11 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, } // ############################################## - // fill simcluster histograms + // fill simCluster histograms // ############################################## if (doSimClustersPlots_) { - histoProducerAlgo_->fill_simcluster_histos( - histograms.histoProducerAlgo, simclusters, totallayers_to_monitor_, thicknesses_to_monitor_); + histoProducerAlgo_->fill_simCluster_histos( + histograms.histoProducerAlgo, simClusters, totallayers_to_monitor_, thicknesses_to_monitor_); for (unsigned int ws = 0; ws < label_clustersmask.size(); ws++) { const auto& inputClusterMask = event.get(clustersMaskTokens_[ws]); @@ -324,12 +324,12 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(associatorMapRtSim, recotosimCollectionH); auto recSimColl = *recotosimCollectionH; - histoProducerAlgo_->fill_simclusterassosiation_histos(histograms.histoProducerAlgo, + histoProducerAlgo_->fill_simClusterAssociation_histos(histograms.histoProducerAlgo, ws, clusterHandle, clusters, simClustersHandle, - simclusters, + simClusters, sCIndices, inputClusterMask, *hitMap, @@ -338,8 +338,8 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, simRecColl); //General Info on simClusters - LogTrace("HGCalValidator") << "\n# of simclusters: " << nSimClusters << " label_clustersmask[ws].label() " - << label_clustersmask[ws].label() << "\n"; + LogTrace("HGCalValidator") << "\n# of SimClusters: " << nSimClusters + << ", layerClusters mask label: " << label_clustersmask[ws].label() << "\n"; } //end of loop overs masks } @@ -374,28 +374,29 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, } // ############################################## - // fill multicluster histograms + // fill Trackster histograms // ############################################## - for (unsigned int wml = 0; wml < label_mclTokens.size(); wml++) { - if (doMultiClustersPlots_) { - edm::Handle> multiClusterHandle; - event.getByToken(label_mclTokens[wml], multiClusterHandle); - const std::vector& multiClusters = *multiClusterHandle; - - histoProducerAlgo_->fill_multi_cluster_histos(histograms.histoProducerAlgo, - wml, - multiClusters, - caloParticles, - cPIndices, - selected_cPeff, - *hitMap, - totallayers_to_monitor_); - - //General Info on multiclusters - LogTrace("HGCalValidator") << "\n# of multi clusters with " << label_mcl[wml].process() << ":" - << label_mcl[wml].label() << ":" << label_mcl[wml].instance() << ": " - << multiClusters.size() << "\n" + for (unsigned int wml = 0; wml < label_tstTokens.size(); wml++) { + if (doTrackstersPlots_) { + edm::Handle tracksterHandle; + event.getByToken(label_tstTokens[wml], tracksterHandle); + const ticl::TracksterCollection& tracksters = *tracksterHandle; + + histoProducerAlgo_->fill_trackster_histos(histograms.histoProducerAlgo, + wml, + tracksters, + clusters, + caloParticles, + cPIndices, + selected_cPeff, + *hitMap, + totallayers_to_monitor_); + + //General Info on Tracksters + LogTrace("HGCalValidator") << "\n# of Tracksters with " << label_tst[wml].process() << ":" + << label_tst[wml].label() << ":" << label_tst[wml].instance() << ": " + << tracksters.size() << "\n" << std::endl; } - } //end of loop over multicluster input labels + } //end of loop over Trackster input labels } diff --git a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc index 004c5a2a657a2..bdf2b67b04204 100644 --- a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc +++ b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc @@ -9,8 +9,10 @@ HeterogeneousHGCalRecHitsValidator::HeterogeneousHGCalRecHitsValidator(const edm consumes(ps.getParameter("gpuRecHitsHSciToken"))}}}}), treenames_({{"CEE", "CHSi", "CHSci"}}) { usesResource(TFileService::kSharedResource); + estokenGeom_ = esConsumes(); edm::Service fs; for (unsigned i(0); i < nsubdetectors; ++i) { + estokens_[i] = esConsumes(edm::ESInputTag{"", handles_str_[i]}); trees_[i] = fs->make(treenames_[i].c_str(), treenames_[i].c_str()); trees_[i]->Branch("cpu", "ValidHitCollection", &cpuValidRecHits[i]); trees_[i]->Branch("gpu", "ValidHitCollection", &gpuValidRecHits[i]); @@ -23,14 +25,11 @@ HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator() {} void HeterogeneousHGCalRecHitsValidator::endJob() {} void HeterogeneousHGCalRecHitsValidator::set_geometry_(const edm::EventSetup &setup, const unsigned &detidx) { - edm::ESHandle handle; - setup.get().get(handles_str_[detidx], handle); + edm::ESHandle handle = setup.getHandle(estokens_[detidx]); } void HeterogeneousHGCalRecHitsValidator::analyze(const edm::Event &event, const edm::EventSetup &setup) { - edm::ESHandle baseGeom; - setup.get().get(baseGeom); - recHitTools_.setGeometry(*baseGeom); + recHitTools_.setGeometry(setup.getData(estokenGeom_)); //future subdetector loop for (size_t idet = 0; idet < nsubdetectors; ++idet) { diff --git a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h index 01435ff6fc271..9caff818acccc 100644 --- a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h +++ b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h @@ -9,7 +9,9 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "Validation/HGCalValidation/interface/ValidHit.h" @@ -41,6 +43,9 @@ class HeterogeneousHGCalRecHitsValidator : public edm::one::EDAnalyzer, ncomputingdevices>, nsubdetectors> tokens_; + std::array, nsubdetectors> estokens_; + edm::ESGetToken estokenGeom_; + std::array handles_str_ = { {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}}; hgcal::RecHitTools recHitTools_; diff --git a/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py b/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py index 10b1a27c50bf8..d87f588a30a75 100644 --- a/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py +++ b/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py @@ -3,7 +3,7 @@ from Validation.HGCalValidation.HGCalSimHitsClient_cff import * from Validation.HGCalValidation.HGCalDigiClient_cff import * from Validation.HGCalValidation.HGCalRecHitsClient_cff import * -from Validation.HGCalValidation.PostProcessorHGCAL_cfi import postProcessorHGCALlayerclusters,postProcessorHGCALsimclusters,postProcessorHGCALmulticlusters +from Validation.HGCalValidation.PostProcessorHGCAL_cfi import postProcessorHGCALlayerclusters,postProcessorHGCALsimclusters,postProcessorHGCALTracksters hgcalPostProcessor = cms.Sequence(hgcalSimHitClientEE + hgcalSimHitClientHEF @@ -18,4 +18,4 @@ hgcalValidatorPostProcessor = cms.Sequence( postProcessorHGCALlayerclusters+ postProcessorHGCALsimclusters+ - postProcessorHGCALmulticlusters) + postProcessorHGCALTracksters) diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index 4f415db769eaa..6c339f4312de4 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -10,8 +10,8 @@ from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge -labelMcl = [cms.InputTag("ticlMultiClustersFromTracksters"+iteration) for iteration in ticlIterLabelsMerge] -labelMcl.extend(["ticlMultiClustersFromSimTracksters"]) +labelTst = [cms.InputTag("ticlTracksters"+iteration) for iteration in ticlIterLabelsMerge] +labelTst.extend(["ticlSimTracksters"]) lcInputMask = [cms.InputTag("ticlTracksters"+iteration) for iteration in ticlIterLabels] lcInputMask.extend(["ticlSimTracksters"]) hgcalValidator = DQMEDAnalyzer( @@ -22,9 +22,9 @@ CaloParticleSelectionForEfficiency, ### reco input configuration ### - #2dlayerclusters, pfclusters, multiclusters + #2DLayerClusters, PFClusters, Tracksters label_lcl = layerClusterCaloParticleAssociation.label_lc, - label_mcl = cms.VInputTag(labelMcl), + label_tst = cms.VInputTag(labelTst), associator = cms.untracked.InputTag("layerClusterCaloParticleAssociationProducer"), @@ -40,8 +40,8 @@ doSimClustersPlots = cms.untracked.bool(True), #Layer Cluster related plots doLayerClustersPlots = cms.untracked.bool(True), - #Multi Cluster related plots - doMultiClustersPlots = cms.untracked.bool(True), + #Trackster related plots + doTrackstersPlots = cms.untracked.bool(True), #The cumulative material budget in front of each layer. To be more specific, it #is the material budget just in front of the active material (not including it). diff --git a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py index 49210b4334f0f..7d9eb26d1ba71 100644 --- a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py +++ b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py @@ -78,10 +78,10 @@ maxSharedEneFrac = cms.double(1.), nintSharedEneFrac = cms.int32(100), - #Same as above for multiclusters - minMCLSharedEneFrac = cms.double(0.), - maxMCLSharedEneFrac = cms.double(1.0), - nintMCLSharedEneFrac = cms.int32(100), + #Same as above for tracksters + minTSTSharedEneFrac = cms.double(0.), + maxTSTSharedEneFrac = cms.double(1.0), + nintTSTSharedEneFrac = cms.int32(100), #Parameters for the total number of simclusters per thickness minTotNsimClsperthick = cms.double(0.), @@ -133,31 +133,31 @@ maxCellsEneDensperthick = cms.double(100.), nintCellsEneDensperthick = cms.int32(200), - #Parameters for the total number of multiclusters per event + #Parameters for the total number of tracksters per event #We always treet one event as two events, one in +z one in -z - minTotNMCLs = cms.double(0.), - maxTotNMCLs = cms.double(50.), - nintTotNMCLs = cms.int32(50), + minTotNTSTs = cms.double(0.), + maxTotNTSTs = cms.double(50.), + nintTotNTSTs = cms.int32(50), - #Parameters for the total number of layer clusters in multicluster - minTotNClsinMCLs = cms.double(0.), - maxTotNClsinMCLs = cms.double(400.), - nintTotNClsinMCLs = cms.int32(100), + #Parameters for the total number of layer clusters in trackster + minTotNClsinTSTs = cms.double(0.), + maxTotNClsinTSTs = cms.double(400.), + nintTotNClsinTSTs = cms.int32(100), - #Parameters for the total number of layer clusters in multicluster per layer - minTotNClsinMCLsperlayer = cms.double(0.), - maxTotNClsinMCLsperlayer = cms.double(50.), - nintTotNClsinMCLsperlayer = cms.int32(50), + #Parameters for the total number of layer clusters in trackster per layer + minTotNClsinTSTsperlayer = cms.double(0.), + maxTotNClsinTSTsperlayer = cms.double(50.), + nintTotNClsinTSTsperlayer = cms.int32(50), - #Parameters for the multiplicity of layer clusters in multicluster + #Parameters for the multiplicity of layer clusters in trackster minMplofLCs = cms.double(0.), maxMplofLCs = cms.double(20.), nintMplofLCs = cms.int32(20), #Parameters for cluster size - minSizeCLsinMCLs = cms.double(0.), - maxSizeCLsinMCLs = cms.double(50.), - nintSizeCLsinMCLs = cms.int32(50), + minSizeCLsinTSTs = cms.double(0.), + maxSizeCLsinTSTs = cms.double(50.), + nintSizeCLsinTSTs = cms.int32(50), #Parameters for the energy of a cluster per multiplicity minClEnepermultiplicity = cms.double(0.), diff --git a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py index c138c5f07aa5d..0eeb62adbc314 100644 --- a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py +++ b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py @@ -45,21 +45,21 @@ outputFileName = cms.untracked.string(""), verbose = cms.untracked.uint32(4)) -eff_multiclusters = ["effic_eta 'MultiCluster Efficiency vs #eta' Num_CaloParticle_Eta Denom_CaloParticle_Eta"] -eff_multiclusters.extend(["effic_phi 'MultiCluster Efficiency vs #phi' Num_CaloParticle_Phi Denom_CaloParticle_Phi"]) -eff_multiclusters.extend(["duplicate_eta 'MultiCluster Duplicate(Split) Rate vs #eta' NumDup_MultiCluster_Eta Denom_MultiCluster_Eta"]) -eff_multiclusters.extend(["duplicate_phi 'MultiCluster Duplicate(Split) Rate vs #phi' NumDup_MultiCluster_Phi Denom_MultiCluster_Phi"]) -eff_multiclusters.extend(["fake_eta 'MultiCluster Fake Rate vs #eta' Num_MultiCluster_Eta Denom_MultiCluster_Eta fake"]) -eff_multiclusters.extend(["fake_phi 'MultiCluster Fake Rate vs #phi' Num_MultiCluster_Phi Denom_MultiCluster_Phi fake"]) -eff_multiclusters.extend(["merge_eta 'MultiCluster Merge Rate vs #eta' NumMerge_MultiCluster_Eta Denom_MultiCluster_Eta"]) -eff_multiclusters.extend(["merge_phi 'MultiCluster Merge Rate vs #phi' NumMerge_MultiCluster_Phi Denom_MultiCluster_Phi"]) +eff_tracksters = ["effic_eta 'Trackster Efficiency vs #eta' Num_CaloParticle_Eta Denom_CaloParticle_Eta"] +eff_tracksters.extend(["effic_phi 'Trackster Efficiency vs #phi' Num_CaloParticle_Phi Denom_CaloParticle_Phi"]) +eff_tracksters.extend(["duplicate_eta 'Trackster Duplicate(Split) Rate vs #eta' NumDup_Trackster_Eta Denom_Trackster_Eta"]) +eff_tracksters.extend(["duplicate_phi 'Trackster Duplicate(Split) Rate vs #phi' NumDup_Trackster_Phi Denom_Trackster_Phi"]) +eff_tracksters.extend(["fake_eta 'Trackster Fake Rate vs #eta' Num_Trackster_Eta Denom_Trackster_Eta fake"]) +eff_tracksters.extend(["fake_phi 'Trackster Fake Rate vs #phi' Num_Trackster_Phi Denom_Trackster_Phi fake"]) +eff_tracksters.extend(["merge_eta 'Trackster Merge Rate vs #eta' NumMerge_Trackster_Eta Denom_Trackster_Eta"]) +eff_tracksters.extend(["merge_phi 'Trackster Merge Rate vs #phi' NumMerge_Trackster_Phi Denom_Trackster_Phi"]) -subdirsMult = ['HGCAL/HGCalValidator/hgcalMultiClusters/','HGCAL/HGCalValidator/ticlMultiClustersFromSimTracksters/'] -subdirsMult.extend('HGCAL/HGCalValidator/ticlMultiClustersFromTracksters'+iteration+'/' for iteration in ticlIterLabelsMerge) +subdirsTracksters = ['HGCAL/HGCalValidator/hgcalTracksters/','HGCAL/HGCalValidator/ticlSimTracksters/'] +subdirsTracksters.extend('HGCAL/HGCalValidator/ticlTracksters'+iteration+'/' for iteration in ticlIterLabelsMerge) -postProcessorHGCALmulticlusters = DQMEDHarvester('DQMGenericClient', - subDirs = cms.untracked.vstring(subdirsMult), - efficiency = cms.vstring(eff_multiclusters), +postProcessorHGCALTracksters = DQMEDHarvester('DQMGenericClient', + subDirs = cms.untracked.vstring(subdirsTracksters), + efficiency = cms.vstring(eff_tracksters), resolution = cms.vstring(), cumulativeDists = cms.untracked.vstring(), noFlowDists = cms.untracked.vstring(), diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cff.py b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py new file mode 100644 index 0000000000000..a7184b58da9fe --- /dev/null +++ b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +hgcalHitValidation = DQMEDAnalyzer('HGCalHitValidation', + geometrySource = cms.vstring("HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive"), + eeSimHitSource = cms.InputTag("g4SimHits","HGCHitsEE"), + fhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEfront"), + bhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEback"), + eeRecHitSource = cms.InputTag("HGCalRecHit","HGCEERecHits"), + fhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEFRecHits"), + bhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEBRecHits"), + ietaExcludeBH = cms.vint32([]), +) + +from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration +from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation + +hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py deleted file mode 100644 index b3f8fb313cded..0000000000000 --- a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py +++ /dev/null @@ -1,22 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -hgcalHitValidation = DQMEDAnalyzer('HGCalHitValidation', - geometrySource = cms.untracked.vstring("HGCalEESensitive", - "HGCalHESiliconSensitive", - "HGCalHEScintillatorSensitive"), - eeSimHitSource = cms.InputTag("g4SimHits","HGCHitsEE"), - fhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEfront"), - bhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEback"), - eeRecHitSource = cms.InputTag("HGCalRecHit","HGCEERecHits"), - fhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEFRecHits"), - bhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEBRecHits"), - ietaExcludeBH = cms.vint32([]), - ifHCAL = cms.bool(False), - ifHCALsim = cms.bool(False), - ) - -from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration -from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation - -hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index 009f55a6c05a3..3efce5df299fc 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -1301,7 +1301,7 @@ _merges_zplus = PlotGroup("MergeRate_vs_layer", _mergeplots_zplus, ncols=1) #-------------------------------------------------------------------------------------------- -# SIMCLUSTERS +# SimClusters #-------------------------------------------------------------------------------------------- _common_sc_score = {"title": "Score SimCluster to LayerClusters in z-", @@ -1559,7 +1559,7 @@ #-------------------------------------------------------------------------------------------- # MULTICLUSTERS #-------------------------------------------------------------------------------------------- -_common_score = {#"title": "Score CaloParticle to MultiClusters", +_common_score = {#"title": "Score CaloParticle to Tracksters", "stat": False, "ymin": 0.1, "ymax": 100000, @@ -1570,11 +1570,11 @@ "ylog": True } _common_score.update(_legend_common) -_score_caloparticle_to_multiclusters = PlotGroup("ScoreCaloParticlesToMultiClusters", [ - Plot("Score_caloparticle2multicl", **_common_score) +_score_caloparticle_to_tracksters = PlotGroup("ScoreCaloParticlesToTracksters", [ + Plot("Score_caloparticle2trackster", **_common_score) ], ncols=1) -_common_score = {#"title": "Score MultiCluster to CaloParticles", +_common_score = {#"title": "Score Trackster to CaloParticles", "stat": False, "ymin": 0.1, "ymax": 100000, @@ -1585,37 +1585,37 @@ "ylog": True } _common_score.update(_legend_common) -_score_multicluster_to_caloparticles = PlotGroup("ScoreMultiClustersToCaloParticles", [ - Plot("Score_multicl2caloparticle", **_common_score) +_score_trackster_to_caloparticles = PlotGroup("ScoreTrackstersToCaloParticles", [ + Plot("Score_trackster2caloparticle", **_common_score) ], ncols=1) -_common_shared= {"title": "Shared Energy CaloParticle To Multi Cluster ", +_common_shared= {"title": "Shared Energy CaloParticle To Trackster ", "stat": False, "legend": True, "xmin": 0, "xmax": 1.0, } _common_shared.update(_legend_common) -_shared_plots = [ Plot("SharedEnergy_caloparticle2multicl", **_common_shared) ] +_shared_plots = [ Plot("SharedEnergy_caloparticle2trackster", **_common_shared) ] _common_shared["xmin"] = -4.0 _common_shared["xmax"] = 4.0 -_shared_plots.extend([Plot("SharedEnergy_caloparticle2multicl_vs_eta", xtitle="CaloParticle #eta", **_common_shared)]) -_shared_plots.extend([Plot("SharedEnergy_caloparticle2multicl_vs_phi", xtitle="CaloParticle #phi", **_common_shared)]) -_sharedEnergy_caloparticle_to_multicluster = PlotGroup("SharedEnergy_CaloParticleToMultiCluster", _shared_plots, ncols=3) +_shared_plots.extend([Plot("SharedEnergy_caloparticle2trackster_vs_eta", xtitle="CaloParticle #eta", **_common_shared)]) +_shared_plots.extend([Plot("SharedEnergy_caloparticle2trackster_vs_phi", xtitle="CaloParticle #phi", **_common_shared)]) +_sharedEnergy_caloparticle_to_trackster = PlotGroup("SharedEnergy_CaloParticleToTrackster", _shared_plots, ncols=3) -_common_shared= {"title": "Shared Energy Multi Cluster To CaloParticle ", +_common_shared= {"title": "Shared Energy Trackster To CaloParticle ", "stat": False, "legend": True, "xmin": 0, "xmax": 1.0, } _common_shared.update(_legend_common) -_shared_plots2 = [Plot("SharedEnergy_multicluster2caloparticle", **_common_shared)] +_shared_plots2 = [Plot("SharedEnergy_trackster2caloparticle", **_common_shared)] _common_shared["xmin"] = -4.0 _common_shared["xmax"] = 4.0 -_shared_plots2.extend([Plot("SharedEnergy_multicl2caloparticle_vs_eta", xtitle="MultiCluster #eta", **_common_shared)]) -_shared_plots2.extend([Plot("SharedEnergy_multicl2caloparticle_vs_phi", xtitle="MultiCluster #phi", **_common_shared)]) -_sharedEnergy_multicluster_to_caloparticle = PlotGroup("SharedEnergy_MultiClusterToCaloParticle", _shared_plots2, ncols=3) +_shared_plots2.extend([Plot("SharedEnergy_trackster2caloparticle_vs_eta", xtitle="Trackster #eta", **_common_shared)]) +_shared_plots2.extend([Plot("SharedEnergy_trackster2caloparticle_vs_phi", xtitle="Trackster #phi", **_common_shared)]) +_sharedEnergy_trackster_to_caloparticle = PlotGroup("SharedEnergy_TracksterToCaloParticle", _shared_plots2, ncols=3) _common_assoc = {#"title": "Cell Association Table", @@ -1660,96 +1660,96 @@ _common_energy_score = dict(removeEmptyBins=True, xbinlabelsize=10, xbinlabeloption="d") _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_cp2mcl = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToMultiClusters", Plot("Energy_vs_Score_caloparticle2multi", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_cp2mcl = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToTracksters", Plot("Energy_vs_Score_caloparticle2trackster", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_mcl2cp = PlotOnSideGroup("Energy_vs_Score_MultiClustersToCaloParticles", Plot("Energy_vs_Score_multi2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_mcl2cp = PlotOnSideGroup("Energy_vs_Score_TrackstersToCaloParticles", Plot("Energy_vs_Score_trackster2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) #Coming back to the usual box definition _common = {"stat": True, "drawStyle": "hist", "staty": 0.65 } -_totmulticlusternum = PlotGroup("TotalNumberofMultiClusters", [ - Plot("totmulticlusternum", xtitle="", **_common) +_tottracksternum = PlotGroup("TotalNumberofTracksters", [ + Plot("tottracksternum", xtitle="", **_common) ],ncols=1) -_multicluster_layernum_plots = [Plot("multicluster_firstlayer", xtitle="MultiCluster First Layer", **_common)] -_multicluster_layernum_plots.extend([Plot("multicluster_lastlayer", xtitle="MultiCluster Last Layer", **_common)]) -_multicluster_layernum_plots.extend([Plot("multicluster_layersnum", xtitle="MultiCluster Number of Layers", **_common)]) -_multicluster_layernum = PlotGroup("LayerNumbersOfMultiCluster", _multicluster_layernum_plots, ncols=3) +_trackster_layernum_plots = [Plot("trackster_firstlayer", xtitle="Trackster First Layer", **_common)] +_trackster_layernum_plots.extend([Plot("trackster_lastlayer", xtitle="Trackster Last Layer", **_common)]) +_trackster_layernum_plots.extend([Plot("trackster_layersnum", xtitle="Trackster Number of Layers", **_common)]) +_trackster_layernum = PlotGroup("LayerNumbersOfTrackster", _trackster_layernum_plots, ncols=3) _common["xmax"] = 50 -_clusternum_in_multicluster = PlotGroup("NumberofLayerClustersinMultiCluster",[ - Plot("clusternum_in_multicluster", xtitle="", **_common) +_clusternum_in_trackster = PlotGroup("NumberofLayerClustersinTrackster",[ + Plot("clusternum_in_trackster", xtitle="", **_common) ],ncols=1) _common = {"stat": True, "drawStyle": "hist", "staty": 0.65} _common = {"stat": True, "drawStyle": "pcolz", "staty": 0.65} -_clusternum_in_multicluster_vs_layer = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer",[ - Plot("clusternum_in_multicluster_vs_layer", xtitle="Layer number", ytitle = "<2d Layer Clusters in Multicluster>", **_common) +_clusternum_in_trackster_vs_layer = PlotGroup("NumberofLayerClustersinTracksterPerLayer",[ + Plot("clusternum_in_trackster_vs_layer", xtitle="Layer number", ytitle = "<2d Layer Clusters in Trackster>", **_common) ],ncols=1) _common["scale"] = 100. #, ztitle = "% of clusters" normalizeToUnitArea=True -_multiplicity_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_numberOfEventsHistogram" -_multiplicity_zminus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_zminus_numberOfEventsHistogram" -_multiplicity_zplus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_zplus_numberOfEventsHistogram" +_multiplicity_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_numberOfEventsHistogram" +_multiplicity_zminus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_zminus_numberOfEventsHistogram" +_multiplicity_zplus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_zplus_numberOfEventsHistogram" -_multiplicityOfLCinMCL_plots = [Plot("multiplicityOfLCinMCL", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Cluster size (n_{hit})", +_multiplicityOfLCinTST_plots = [Plot("multiplicityOfLCinTST", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Cluster size (n_{hit})", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)] -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layerclusterenergy", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Cluster Energy (GeV)", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layerclusterenergy", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Cluster Energy (GeV)", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layercluster_zplus", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Layer Number", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layercluster_zplus", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Layer Number", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layercluster_zminus", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Layer Number", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layercluster_zminus", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Layer Number", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL = PlotGroup("MultiplcityofLCinMLC", _multiplicityOfLCinMCL_plots, ncols=2) +_multiplicityOfLCinTST = PlotGroup("MultiplcityofLCinTST", _multiplicityOfLCinTST_plots, ncols=2) _common = {"stat": True, "drawStyle": "hist", "staty": 0.65} #-------------------------------------------------------------------------------------------- # z- #-------------------------------------------------------------------------------------------- -_clusternum_in_multicluster_perlayer_zminus_EE = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_EE", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm) +_clusternum_in_trackster_perlayer_zminus_EE = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_EE", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm) ], ncols=7) -_clusternum_in_multicluster_perlayer_zminus_FH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_FH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm,lastLayerFHzm) +_clusternum_in_trackster_perlayer_zminus_FH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_FH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm,lastLayerFHzm) ], ncols=7) -_clusternum_in_multicluster_perlayer_zminus_BH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_BH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzm,maxlayerzm) +_clusternum_in_trackster_perlayer_zminus_BH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_BH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzm,maxlayerzm) ], ncols=7) #-------------------------------------------------------------------------------------------- # z+ #-------------------------------------------------------------------------------------------- -_clusternum_in_multicluster_perlayer_zplus_EE = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_EE", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(maxlayerzm,lastLayerEEzp) +_clusternum_in_trackster_perlayer_zplus_EE = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_EE", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(maxlayerzm,lastLayerEEzp) ], ncols=7) -_clusternum_in_multicluster_perlayer_zplus_FH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_FH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzp,lastLayerFHzp) +_clusternum_in_trackster_perlayer_zplus_FH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_FH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzp,lastLayerFHzp) ], ncols=7) -_clusternum_in_multicluster_perlayer_zplus_BH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_BH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzp,maxlayerzp) +_clusternum_in_trackster_perlayer_zplus_BH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_BH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzp,maxlayerzp) ], ncols=7) #Coming back to the usual box definition _common = {"stat": True, "drawStyle": "hist", "staty": 0.65 } -#Some multiclusters quantities -_multicluster_eppe_plots = [Plot("multicluster_eta", xtitle="MultiCluster #eta", **_common)] -_multicluster_eppe_plots.extend([Plot("multicluster_phi", xtitle="MultiCluster #phi", **_common)]) -_multicluster_eppe_plots.extend([Plot("multicluster_pt", xtitle="MultiCluster p_{T}", **_common)]) -_multicluster_eppe_plots.extend([Plot("multicluster_energy", xtitle="MultiCluster Energy", **_common)]) -_multicluster_eppe = PlotGroup("EtaPhiPtEnergy", _multicluster_eppe_plots, ncols=2) +#Some tracksters quantities +_trackster_eppe_plots = [Plot("trackster_eta", xtitle="Trackster #eta", **_common)] +_trackster_eppe_plots.extend([Plot("trackster_phi", xtitle="Trackster #phi", **_common)]) +_trackster_eppe_plots.extend([Plot("trackster_pt", xtitle="Trackster p_{T}", **_common)]) +_trackster_eppe_plots.extend([Plot("trackster_energy", xtitle="Trackster Energy", **_common)]) +_trackster_eppe = PlotGroup("EtaPhiPtEnergy", _trackster_eppe_plots, ncols=2) -_multicluster_xyz_plots = [Plot("multicluster_x", xtitle="MultiCluster x", **_common)] -_multicluster_xyz_plots.extend([Plot("multicluster_y", xtitle="MultiCluster y", **_common)]) -_multicluster_xyz_plots.extend([Plot("multicluster_z", xtitle="MultiCluster z", **_common)]) -_multicluster_xyz = PlotGroup("XYZ", _multicluster_xyz_plots, ncols=3) +_trackster_xyz_plots = [Plot("trackster_x", xtitle="Trackster x", **_common)] +_trackster_xyz_plots.extend([Plot("trackster_y", xtitle="Trackster y", **_common)]) +_trackster_xyz_plots.extend([Plot("trackster_z", xtitle="Trackster z", **_common)]) +_trackster_xyz = PlotGroup("XYZ", _trackster_xyz_plots, ncols=3) #-------------------------------------------------------------------------------------------- # SIMHITS, DIGIS, RECHITS @@ -1945,21 +1945,21 @@ Plot("h_EoP_CPene_scint_calib_fraction", title="EoP_CPene_scint_calib_fraction", **_common), ]) -_ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy = PlotGroup("ParticleFlowClusterHGCalFromMultiCl", [ +_ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy = PlotGroup("ParticleFlowClusterHGCalFromTrackster", [ Plot("hgcal_EoP_CPene_100_calib_fraction", title="hgcal_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_EoP_CPene_200_calib_fraction", title="hgcal_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_EoP_CPene_300_calib_fraction", title="hgcal_EoP_CPene_300_calib_fraction", **_common), Plot("hgcal_EoP_CPene_scint_calib_fraction", title="hgcal_EoP_CPene_scint_calib_fraction", **_common), ]) -_EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy = PlotGroup("EcalDrivenGsfElectronsFromMultiCl", [ +_EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy = PlotGroup("EcalDrivenGsfElectronsFromTrackster", [ Plot("hgcal_ele_EoP_CPene_100_calib_fraction", title="hgcal_ele_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_200_calib_fraction", title="hgcal_ele_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_300_calib_fraction", title="hgcal_ele_EoP_CPene_300_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_scint_calib_fraction", title="hgcal_ele_EoP_CPene_scint_calib_fraction", **_common), ]) -_PhotonsFromMultiCl_Closest_EoverCPenergy = PlotGroup("PhotonsFromMultiCl", [ +_PhotonsFromTrackster_Closest_EoverCPenergy = PlotGroup("PhotonsFromTrackster", [ Plot("hgcal_photon_EoP_CPene_100_calib_fraction", title="hgcal_photon_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_photon_EoP_CPene_200_calib_fraction", title="hgcal_photon_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_photon_EoP_CPene_300_calib_fraction", title="hgcal_photon_EoP_CPene_300_calib_fraction", **_common), @@ -2425,58 +2425,58 @@ def append_hgcalSimClustersPlots(collection, name_collection): def _hgcalFolders(lastDirName="hgcalLayerClusters"): return "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"+lastDirName -_multiclustersAllPlots = [ +_trackstersAllPlots = [ _efficiencies, _duplicates, _fakes, _merges, - _multicluster_eppe, - _multicluster_xyz, - _totmulticlusternum, - _score_caloparticle_to_multiclusters, - _score_multicluster_to_caloparticles, - _sharedEnergy_caloparticle_to_multicluster, - _sharedEnergy_multicluster_to_caloparticle, + _trackster_eppe, + _trackster_xyz, + _tottracksternum, + _score_caloparticle_to_tracksters, + _score_trackster_to_caloparticles, + _sharedEnergy_caloparticle_to_trackster, + _sharedEnergy_trackster_to_caloparticle, #_energyscore_cp2mcl_mcl2cp, _energyscore_cp2mcl, _energyscore_mcl2cp, - _clusternum_in_multicluster, - _clusternum_in_multicluster_vs_layer, - _clusternum_in_multicluster_perlayer_zminus_EE, - _clusternum_in_multicluster_perlayer_zminus_FH, - _clusternum_in_multicluster_perlayer_zminus_BH, - _clusternum_in_multicluster_perlayer_zplus_EE, - _clusternum_in_multicluster_perlayer_zplus_FH, - _clusternum_in_multicluster_perlayer_zplus_BH, - _multicluster_layernum, - _multiplicityOfLCinMCL, + _clusternum_in_trackster, + _clusternum_in_trackster_vs_layer, + _clusternum_in_trackster_perlayer_zminus_EE, + _clusternum_in_trackster_perlayer_zminus_FH, + _clusternum_in_trackster_perlayer_zminus_BH, + _clusternum_in_trackster_perlayer_zplus_EE, + _clusternum_in_trackster_perlayer_zplus_FH, + _clusternum_in_trackster_perlayer_zplus_BH, + _trackster_layernum, + _multiplicityOfLCinTST, ] -hgcalMultiClustersPlotter = Plotter() -def append_hgcalMultiClustersPlots(collection = 'ticlMultiClustersFromTrackstersMerge', name_collection = "MultiClustersMerge"): +hgcalTrackstersPlotter = Plotter() +def append_hgcalTrackstersPlots(collection = 'ticlTrackstersMerge', name_collection = "TrackstersMerge"): # Appending all plots for MCs - hgcalMultiClustersPlotter.append(collection, [ + hgcalTrackstersPlotter.append(collection, [ _hgcalFolders(collection) ], PlotFolder( - *_multiclustersAllPlots, + *_trackstersAllPlots, loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection)) + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection)) #We append here two PlotFolder because we want the text to be in percent #and the number of events are different in zplus and zminus - #hgcalMultiClustersPlotter.append("Multiplicity", [ + #hgcalTrackstersPlotter.append("Multiplicity", [ # dqmfolder # ], PlotFolder( - # _multiplicityOfLCinMCL_vs_layercluster_zminus, + # _multiplicityOfLCinTST_vs_layercluster_zminus, # loopSubFolders=False, # purpose=PlotPurpose.Timing, page=collection, # numberOfEventsHistogram=_multiplicity_zminus_numberOfEventsHistogram # )) # - #hgcalMultiClustersPlotter.append("Multiplicity", [ + #hgcalTrackstersPlotter.append("Multiplicity", [ # dqmfolder # ], PlotFolder( - # _multiplicityOfLCinMCL_vs_layercluster_zplus, + # _multiplicityOfLCinTST_vs_layercluster_zplus, # loopSubFolders=False, # purpose=PlotPurpose.Timing, page=collection, # numberOfEventsHistogram=_multiplicity_zplus_numberOfEventsHistogram @@ -2505,7 +2505,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = name = obj.GetName() fileName = TString(name) fileName.ReplaceAll(" ","_") - pg= PlotGroup(fileName.Data(),[ + pg = PlotGroup(fileName.Data(),[ Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "", @@ -2514,7 +2514,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = ncols=1) if name in list_2D_histos : - pg= PlotOnSideGroup(plotName.Data(), + pg = PlotOnSideGroup(plotName.Data(), Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "COLZ", @@ -2537,7 +2537,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = return hgcalCaloParticlesPlotter #================================================================================================= -def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', name_collection = "MultiClustersMerge"): +def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', name_collection = "TrackstersMerge"): grouped = {"cosAngle Beta": PlotGroup("cosAngle_Beta_per_layer",[],ncols=10), "cosAngle Beta Weighted": PlotGroup("cosAngle_Beta_Weighted_per_layer",[],ncols=10)} groupingFlag = " on Layer " @@ -2576,7 +2576,7 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam drawCommand = "COLZ", **_common), ncols=1) - else: + elif obj.InheritsFrom("TH1"): pg = PlotGroup(plotName.Data(), [Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), @@ -2585,12 +2585,13 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam ], ncols=1, legendDh=-0.03 * len(files)) - hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", - [dqmfolder], PlotFolder(pg, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection) - #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) - ) + if (pg is not None): + hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", + [dqmfolder], PlotFolder(pg, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) + #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) + ) key = keys.After(key) @@ -2598,7 +2599,7 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", [dqmfolder], PlotFolder(grouped[group], loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection) + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) ) @@ -2623,29 +2624,32 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = name = obj.GetName() plotName = TString(name) plotName.ReplaceAll(" ","_") - pg= PlotGroup(plotName.Data(),[ - Plot(name, - xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), - drawCommand = "", # may want to customize for TH2 (colz, etc.) - normalizeToNumberOfEvents = True, **_common_Calo) - ], - ncols=1) + pg = None if obj.InheritsFrom("TH2"): - pg= PlotOnSideGroup(plotName.Data(), + pg = PlotOnSideGroup(plotName.Data(), Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "COLZ", normalizeToNumberOfEvents = True, **_common_Calo), ncols=1) + elif obj.InheritsFrom("TH1"): + pg = PlotGroup(plotName.Data(),[ + Plot(name, + xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), + drawCommand = "", # may want to customize for TH2 (colz, etc.) + normalizeToNumberOfEvents = True, **_common_Calo) + ], + ncols=1) - hgcalCaloParticlesPlotter.append("CaloParticles_"+name_collection, [ - dqmfolder - ], PlotFolder( - pg, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="CaloParticles", section=name_collection) - ) + if (pg is not None): + hgcalCaloParticlesPlotter.append("CaloParticles_"+name_collection, [ + dqmfolder + ], PlotFolder( + pg, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page="CaloParticles", section=name_collection) + ) key = keys.After(key) @@ -2772,26 +2776,26 @@ def append_hgcalDigisPlots(collection = "HGCalDigisV", name_collection = "Digis" purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy, + _ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("PhotonsFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("PhotonsFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _PhotonsFromMultiCl_Closest_EoverCPenergy, + _PhotonsFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy, + _EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index a0b4e6f3ae62f..37755c97b6bc5 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -5,28 +5,25 @@ import argparse from time import time +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge + from Validation.RecoTrack.plotting.validation import SeparateValidation, SimpleValidation, SimpleSample import Validation.HGCalValidation.hgcalPlots as hgcalPlots import Validation.RecoTrack.plotting.plotting as plotting -simClustersIters = ["ClusterLevel","ticlTrackstersTrkEM","ticlTrackstersEM","ticlTrackstersTrk","ticlTrackstersHAD","ticlSimTracksters"] - -trackstersIters = ["ticlMultiClustersFromTrackstersMerge", "ticlMultiClustersFromTrackstersMIP", - "ticlMultiClustersFromTrackstersTrk","ticlMultiClustersFromTrackstersTrkEM", - "ticlMultiClustersFromTrackstersEM", "ticlMultiClustersFromTrackstersHAD", - "ticlMultiClustersFromSimTracksters"] +simClustersIters = ["ClusterLevel","ticlSimTracksters"] +trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge] +trackstersIters.extend(["ticlSimTracksters"]) -simClustersGeneralLabel = 'simClusters' -layerClustersGeneralLabel = 'hgcalLayerClusters' -multiclustersGeneralLabel = 'hgcalMultiClusters' -trackstersGeneralLabel = 'allTiclMultiClusters' -hitValidationLabel = 'hitValidation' -hitCalibrationLabel = 'hitCalibration' -caloParticlesLabel = 'caloParticles' +hitLabel = 'recHits' +layerClustersLabel = 'layerClusters' +trackstersLabel = 'tracksters' +trackstersWithEdgesLabel = 'trackstersWithEdges' +simLabel = 'simulation' allLabel = 'all' -collection_choices = [layerClustersGeneralLabel] -collection_choices.extend([simClustersGeneralLabel]+[multiclustersGeneralLabel]+[trackstersGeneralLabel]+[hitValidationLabel]+[hitCalibrationLabel]+[allLabel]+[caloParticlesLabel]) +collection_choices = [allLabel] +collection_choices.extend([hitLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[simLabel]) def main(opts): @@ -52,34 +49,34 @@ def main(opts): htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0]) #layerClusters - if (opts.collection == layerClustersGeneralLabel): + def plot_LC(): hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) + #simClusters - elif (opts.collection == simClustersGeneralLabel): + def plot_SC(): hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] for i_iter in simClustersIters: hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) - #multiClusters - elif (opts.collection == multiclustersGeneralLabel): - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - hgcalPlots.append_hgcalMultiClustersPlots(multiclustersGeneralLabel, "MultiClusters") - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) - #ticlTracksters - elif (opts.collection == trackstersGeneralLabel): - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") - hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection) - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) - # TICLTrackstersEdges plots - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") + + #tracksters + def plot_Tst(): + hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] + for tracksterCollection in trackstersIters : + hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) + val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) + + #trackstersWithEdges + def plot_TstEdges(): + plot_Tst() + for tracksterCollection in trackstersIters : hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) - elif (opts.collection == caloParticlesLabel): + + #caloParticles + def plot_CP(): particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", "muon-": "-13", "muon+":"13", "electron-": "-11", "electron+": "11", "photon": "22", @@ -89,63 +86,31 @@ def main(opts): for i_part, i_partID in particletypes.iteritems() : hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) + #hitValidation - elif (opts.collection == hitValidationLabel): + def plot_hitVal(): hgchit = [hgcalPlots.hgcalHitPlotter] hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") val.doPlots(hgchit, plotterDrawArgs=drawArgs) - #hitCalibration - elif (opts.collection == hitCalibrationLabel): - hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] - val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - elif (opts.collection == allLabel): - #caloparticles - particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", - "muon-": "-13", "muon+":"13", - "electron-": "-11", "electron+": "11", "photon": "22", - "kaon0L": "310", "kaon0S": "130", - "kaon-": "-321", "kaon+": "321"} - hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter] - for i_part, i_partID in particletypes.iteritems() : - hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) - val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) - - #hits - hgchit = [hgcalPlots.hgcalHitPlotter] - hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") - hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") - hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") - val.doPlots(hgchit, plotterDrawArgs=drawArgs) - #calib + #hitCalibration + def plot_hitCal(): hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - #simClusters - hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] - for i_iter in simClustersIters : - hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) - val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) - - #layer clusters - hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] - hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) - val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) - #multiclusters - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") - hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection) - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) - #TICLTrackstersEdges plots - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") - hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] - val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) + plotDict = {hitLabel:[plot_hitVal, plot_hitCal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} + if (opts.collection != allLabel): + for task in plotDict[opts.collection]: + task() + else: + for label in plotDict: + if (label == trackstersLabel): continue # already run in trackstersWithEdges + for task in plotDict[label]: + task() if opts.no_html: print("Plots created into directory '%s'." % opts.outputDir) @@ -175,7 +140,7 @@ def main(opts): help="Sample name for HTML page generation (default 'Sample')") parser.add_argument("--html-validation-name", type=str, default=["",""], nargs="+", help="Validation name for HTML page generation (enters to element) (default '')") - parser.add_argument("--collection", choices=collection_choices, default=layerClustersGeneralLabel, + parser.add_argument("--collection", choices=collection_choices, default=layerClustersLabel, help="Choose output plots collections among possible choices") parser.add_argument("--extended", action="store_true", default = False, help="Include extended set of plots (e.g. bunch of distributions; default off)") diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 759950175b85d..11cdacabd372a 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -16,8 +16,8 @@ const double ScoreCutLCtoCP_ = 0.1; const double ScoreCutCPtoLC_ = 0.1; const double ScoreCutLCtoSC_ = 0.1; const double ScoreCutSCtoLC_ = 0.1; -const double ScoreCutMCLtoCPFakeMerge_ = 0.6; -const double ScoreCutCPtoMCLEffDup_ = 0.2; +const double ScoreCutTSTtoCPFakeMerge_ = 0.6; +const double ScoreCutCPtoTSTEffDup_ = 0.2; HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) : //parameters for eta @@ -41,7 +41,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxPhi_(pset.getParameter<double>("maxPhi")), nintPhi_(pset.getParameter<int>("nintPhi")), - //parameters for counting mixed hits simclusters + //parameters for counting mixed hits SimClusters minMixedHitsSimCluster_(pset.getParameter<double>("minMixedHitsSimCluster")), maxMixedHitsSimCluster_(pset.getParameter<double>("maxMixedHitsSimCluster")), nintMixedHitsSimCluster_(pset.getParameter<int>("nintMixedHitsSimCluster")), @@ -51,7 +51,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxMixedHitsCluster_(pset.getParameter<double>("maxMixedHitsCluster")), nintMixedHitsCluster_(pset.getParameter<int>("nintMixedHitsCluster")), - //parameters for the total amount of energy clustered by all layer clusters (fraction over caloparticles) + //parameters for the total amount of energy clustered by all layer clusters (fraction over CaloParticless) minEneCl_(pset.getParameter<double>("minEneCl")), maxEneCl_(pset.getParameter<double>("maxEneCl")), nintEneCl_(pset.getParameter<int>("nintEneCl")), @@ -66,7 +66,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxZpos_(pset.getParameter<double>("maxZpos")), nintZpos_(pset.getParameter<int>("nintZpos")), - //Parameters for the total number of simclusters per layer + //Parameters for the total number of SimClusters per layer minTotNsimClsperlay_(pset.getParameter<double>("minTotNsimClsperlay")), maxTotNsimClsperlay_(pset.getParameter<double>("maxTotNsimClsperlay")), nintTotNsimClsperlay_(pset.getParameter<int>("nintTotNsimClsperlay")), @@ -76,7 +76,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxTotNClsperlay_(pset.getParameter<double>("maxTotNClsperlay")), nintTotNClsperlay_(pset.getParameter<int>("nintTotNClsperlay")), - //Parameters for the energy clustered by layer clusters per layer (fraction over caloparticles) + //Parameters for the energy clustered by layer clusters per layer (fraction over CaloParticless) minEneClperlay_(pset.getParameter<double>("minEneClperlay")), maxEneClperlay_(pset.getParameter<double>("maxEneClperlay")), nintEneClperlay_(pset.getParameter<int>("nintEneClperlay")), @@ -97,12 +97,12 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxSharedEneFrac_(pset.getParameter<double>("maxSharedEneFrac")), nintSharedEneFrac_(pset.getParameter<int>("nintSharedEneFrac")), - //Same as above for multiclusters - minMCLSharedEneFrac_(pset.getParameter<double>("minMCLSharedEneFrac")), - maxMCLSharedEneFrac_(pset.getParameter<double>("maxMCLSharedEneFrac")), - nintMCLSharedEneFrac_(pset.getParameter<int>("nintMCLSharedEneFrac")), + //Same as above for Tracksters + minTSTSharedEneFrac_(pset.getParameter<double>("minTSTSharedEneFrac")), + maxTSTSharedEneFrac_(pset.getParameter<double>("maxTSTSharedEneFrac")), + nintTSTSharedEneFrac_(pset.getParameter<int>("nintTSTSharedEneFrac")), - //Parameters for the total number of simclusters per thickness + //Parameters for the total number of SimClusters per thickness minTotNsimClsperthick_(pset.getParameter<double>("minTotNsimClsperthick")), maxTotNsimClsperthick_(pset.getParameter<double>("maxTotNsimClsperthick")), nintTotNsimClsperthick_(pset.getParameter<int>("nintTotNsimClsperthick")), @@ -152,31 +152,31 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxCellsEneDensperthick_(pset.getParameter<double>("maxCellsEneDensperthick")), nintCellsEneDensperthick_(pset.getParameter<int>("nintCellsEneDensperthick")), - //Parameters for the total number of multiclusters per event + //Parameters for the total number of Tracksters per event //We always treet one event as two events, one in +z one in -z - minTotNMCLs_(pset.getParameter<double>("minTotNMCLs")), - maxTotNMCLs_(pset.getParameter<double>("maxTotNMCLs")), - nintTotNMCLs_(pset.getParameter<int>("nintTotNMCLs")), + minTotNTSTs_(pset.getParameter<double>("minTotNTSTs")), + maxTotNTSTs_(pset.getParameter<double>("maxTotNTSTs")), + nintTotNTSTs_(pset.getParameter<int>("nintTotNTSTs")), - //Parameters for the total number of layer clusters in multicluster - minTotNClsinMCLs_(pset.getParameter<double>("minTotNClsinMCLs")), - maxTotNClsinMCLs_(pset.getParameter<double>("maxTotNClsinMCLs")), - nintTotNClsinMCLs_(pset.getParameter<int>("nintTotNClsinMCLs")), + //Parameters for the total number of layer clusters in Trackster + minTotNClsinTSTs_(pset.getParameter<double>("minTotNClsinTSTs")), + maxTotNClsinTSTs_(pset.getParameter<double>("maxTotNClsinTSTs")), + nintTotNClsinTSTs_(pset.getParameter<int>("nintTotNClsinTSTs")), - //Parameters for the total number of layer clusters in multicluster per layer - minTotNClsinMCLsperlayer_(pset.getParameter<double>("minTotNClsinMCLsperlayer")), - maxTotNClsinMCLsperlayer_(pset.getParameter<double>("maxTotNClsinMCLsperlayer")), - nintTotNClsinMCLsperlayer_(pset.getParameter<int>("nintTotNClsinMCLsperlayer")), + //Parameters for the total number of layer clusters in Trackster per layer + minTotNClsinTSTsperlayer_(pset.getParameter<double>("minTotNClsinTSTsperlayer")), + maxTotNClsinTSTsperlayer_(pset.getParameter<double>("maxTotNClsinTSTsperlayer")), + nintTotNClsinTSTsperlayer_(pset.getParameter<int>("nintTotNClsinTSTsperlayer")), - //Parameters for the multiplicity of layer clusters in multicluster + //Parameters for the multiplicity of layer clusters in Trackster minMplofLCs_(pset.getParameter<double>("minMplofLCs")), maxMplofLCs_(pset.getParameter<double>("maxMplofLCs")), nintMplofLCs_(pset.getParameter<int>("nintMplofLCs")), //Parameters for cluster size - minSizeCLsinMCLs_(pset.getParameter<double>("minSizeCLsinMCLs")), - maxSizeCLsinMCLs_(pset.getParameter<double>("maxSizeCLsinMCLs")), - nintSizeCLsinMCLs_(pset.getParameter<int>("nintSizeCLsinMCLs")), + minSizeCLsinTSTs_(pset.getParameter<double>("minSizeCLsinTSTs")), + maxSizeCLsinTSTs_(pset.getParameter<double>("maxSizeCLsinTSTs")), + nintSizeCLsinTSTs_(pset.getParameter<int>("nintSizeCLsinTSTs")), //Parameters for the energy of a cluster per thickness per layer minClEnepermultiplicity_(pset.getParameter<double>("minClEnepermultiplicity")), @@ -214,25 +214,25 @@ void HGVHistoProducerAlgo::bookCaloParticleHistos(DQMStore::IBooker& ibook, int pdgid, unsigned int layers) { histograms.h_caloparticle_eta[pdgid] = - ibook.book1D("N of caloparticle vs eta", "N of caloparticle vs eta", nintEta_, minEta_, maxEta_); + ibook.book1D("N of caloparticle vs eta", "N of caloParticles vs eta", nintEta_, minEta_, maxEta_); histograms.h_caloparticle_eta_Zorigin[pdgid] = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", nintEta_, minEta_, maxEta_, nintZpos_, minZpos_, maxZpos_); histograms.h_caloparticle_energy[pdgid] = - ibook.book1D("Energy", "Energy of caloparticle", nintEne_, minEne_, maxEne_); - histograms.h_caloparticle_pt[pdgid] = ibook.book1D("Pt", "Pt of caloparticle", nintPt_, minPt_, maxPt_); - histograms.h_caloparticle_phi[pdgid] = ibook.book1D("Phi", "Phi of caloparticle", nintPhi_, minPhi_, maxPhi_); + ibook.book1D("Energy", "Energy of CaloParticles", nintEne_, minEne_, maxEne_); + histograms.h_caloparticle_pt[pdgid] = ibook.book1D("Pt", "Pt of CaloParticles", nintPt_, minPt_, maxPt_); + histograms.h_caloparticle_phi[pdgid] = ibook.book1D("Phi", "Phi of CaloParticles", nintPhi_, minPhi_, maxPhi_); histograms.h_caloparticle_selfenergy[pdgid] = ibook.book1D("SelfEnergy", "Total Energy of Hits in Sim Clusters (matched)", nintEne_, minEne_, maxEne_); histograms.h_caloparticle_energyDifference[pdgid] = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300., -5., 1.); histograms.h_caloparticle_nSimClusters[pdgid] = - ibook.book1D("Num Sim Clusters", "Num Sim Clusters in caloparticle", 100, 0., 100.); + ibook.book1D("Num Sim Clusters", "Num Sim Clusters in CaloParticles", 100, 0., 100.); histograms.h_caloparticle_nHitsInSimClusters[pdgid] = - ibook.book1D("Num Hits in Sim Clusters", "Num Hits in Sim Clusters in caloparticle", 1000, 0., 1000.); + ibook.book1D("Num Hits in Sim Clusters", "Num Hits in Sim Clusters in CaloParticles", 1000, 0., 1000.); histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit[pdgid] = ibook.book1D( - "Num Rec-matched Hits in Sim Clusters", "Num Hits in Sim Clusters (matched) in caloparticle", 1000, 0., 1000.); + "Num Rec-matched Hits in Sim Clusters", "Num Hits in Sim Clusters (matched) in CaloParticles", 1000, 0., 1000.); histograms.h_caloparticle_nHits_matched_energy[pdgid] = ibook.book1D("Energy of Rec-matched Hits", "Energy of Hits in Sim Clusters (matched)", 100, 0., 10.); @@ -265,18 +265,18 @@ void HGVHistoProducerAlgo::bookCaloParticleHistos(DQMStore::IBooker& ibook, 110.); histograms.h_caloparticle_firstlayer[pdgid] = - ibook.book1D("First Layer", "First layer of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("First Layer", "First layer of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_lastlayer[pdgid] = - ibook.book1D("Last Layer", "Last layer of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("Last Layer", "Last layer of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_layersnum[pdgid] = - ibook.book1D("Number of Layers", "Number of layers of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("Number of Layers", "Number of layers of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_firstlayer_matchedtoRecHit[pdgid] = ibook.book1D( - "First Layer (rec-matched hit)", "First layer of the caloparticle (matched)", 2 * layers, 0., (float)2 * layers); + "First Layer (rec-matched hit)", "First layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_lastlayer_matchedtoRecHit[pdgid] = ibook.book1D( - "Last Layer (rec-matched hit)", "Last layer of the caloparticle (matched)", 2 * layers, 0., (float)2 * layers); + "Last Layer (rec-matched hit)", "Last layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_layersnum_matchedtoRecHit[pdgid] = ibook.book1D("Number of Layers (rec-matched hit)", - "Number of layers of the caloparticle (matched)", + "Number of layers of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); @@ -620,14 +620,14 @@ void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel(DQMStore::IBooker& ibo //z- histograms.h_energyclustered_zminus.push_back( ibook.book1D("energyclustered_zminus", - "percent of total energy clustered by all layer clusters over caloparticles energy in z-", + "percent of total energy clustered by all layer clusters over CaloParticless energy in z-", nintEneCl_, minEneCl_, maxEneCl_)); //z+ histograms.h_energyclustered_zplus.push_back( ibook.book1D("energyclustered_zplus", - "percent of total energy clustered by all layer clusters over caloparticles energy in z+", + "percent of total energy clustered by all layer clusters over CaloParticless energy in z+", nintEneCl_, minEneCl_, maxEneCl_)); @@ -668,12 +668,12 @@ void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel(DQMStore::IBooker& ibo nintTotNClsperlay_, minTotNClsperlay_, maxTotNClsperlay_); - histograms.h_energyclustered_perlayer[ilayer] = - ibook.book1D("energyclustered_perlayer" + istr1, - "percent of total energy clustered by layer clusters over caloparticles energy for layer " + istr2, - nintEneClperlay_, - minEneClperlay_, - maxEneClperlay_); + histograms.h_energyclustered_perlayer[ilayer] = ibook.book1D( + "energyclustered_perlayer" + istr1, + "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2, + nintEneClperlay_, + minEneClperlay_, + maxEneClperlay_); } //--------------------------------------------------------------------------------------------------------------------------- @@ -963,110 +963,107 @@ void HGVHistoProducerAlgo::bookClusterHistos_CellLevel(DQMStore::IBooker& ibook, } //---------------------------------------------------------------------------------------------------------------------------- -void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, - Histograms& histograms, - unsigned int layers) { - histograms.h_score_multicl2caloparticle.push_back(ibook.book1D( - "Score_multicl2caloparticle", "Score of Multi Cluster per CaloParticle", nintScore_, minScore_, maxScore_)); - histograms.h_score_caloparticle2multicl.push_back(ibook.book1D( - "Score_caloparticle2multicl", "Score of CaloParticle per Multi Cluster", nintScore_, minScore_, maxScore_)); - histograms.h_energy_vs_score_multicl2caloparticle.push_back( - ibook.book2D("Energy_vs_Score_multi2caloparticle", - "Energy vs Score of Multi Cluster per CaloParticle", +void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers) { + histograms.h_score_trackster2caloparticle.push_back(ibook.book1D( + "Score_trackster2caloparticle", "Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_)); + histograms.h_score_caloparticle2trackster.push_back(ibook.book1D( + "Score_caloparticle2trackster", "Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_)); + histograms.h_energy_vs_score_trackster2caloparticle.push_back( + ibook.book2D("Energy_vs_Score_trackster2caloparticle", + "Energy vs Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_, nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_energy_vs_score_caloparticle2multicl.push_back( - ibook.book2D("Energy_vs_Score_caloparticle2multi", - "Energy vs Score of CaloParticle per Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_energy_vs_score_caloparticle2trackster.push_back( + ibook.book2D("Energy_vs_Score_caloparticle2trackster", + "Energy vs Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_, nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - - //back to all multiclusters - histograms.h_num_multicl_eta.push_back( - ibook.book1D("Num_MultiCluster_Eta", "Num MultiCluster Eta per Multi Cluster ", nintEta_, minEta_, maxEta_)); - histograms.h_numMerge_multicl_eta.push_back(ibook.book1D( - "NumMerge_MultiCluster_Eta", "Num Merge MultiCluster Eta per Multi Cluster ", nintEta_, minEta_, maxEta_)); - histograms.h_denom_multicl_eta.push_back( - ibook.book1D("Denom_MultiCluster_Eta", "Denom MultiCluster Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); - histograms.h_num_multicl_phi.push_back( - ibook.book1D("Num_MultiCluster_Phi", "Num MultiCluster Phi per Multi Cluster ", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numMerge_multicl_phi.push_back(ibook.book1D( - "NumMerge_MultiCluster_Phi", "Num Merge MultiCluster Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_denom_multicl_phi.push_back( - ibook.book1D("Denom_MultiCluster_Phi", "Denom MultiCluster Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_sharedenergy_multicl2caloparticle.push_back( - ibook.book1D("SharedEnergy_multicluster2caloparticle", - "Shared Energy of Multi Cluster per Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + + //back to all Tracksters + histograms.h_num_trackster_eta.push_back( + ibook.book1D("Num_Trackster_Eta", "Num Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_numMerge_trackster_eta.push_back( + ibook.book1D("NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_denom_trackster_eta.push_back( + ibook.book1D("Denom_Trackster_Eta", "Denom Trackster Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_num_trackster_phi.push_back( + ibook.book1D("Num_Trackster_Phi", "Num Trackster Phi per Trackster ", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numMerge_trackster_phi.push_back( + ibook.book1D("NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_denom_trackster_phi.push_back( + ibook.book1D("Denom_Trackster_Phi", "Denom Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_sharedenergy_trackster2caloparticle.push_back( + ibook.book1D("SharedEnergy_trackster2caloparticle", + "Shared Energy of Trackster per Calo Particle in each layer", nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_multicl2caloparticle_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_multicl2caloparticle_vs_eta", - "Shared Energy of MultiCluster vs #eta per best Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_eta", + "Shared Energy of Trackster vs #eta per best Calo Particle in each layer", nintEta_, minEta_, maxEta_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_multicl2caloparticle_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_multicl2caloparticle_vs_phi", - "Shared Energy of MultiCluster vs #phi per best Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_phi", + "Shared Energy of Trackster vs #phi per best Calo Particle in each layer", nintPhi_, minPhi_, maxPhi_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl.push_back( - ibook.book1D("SharedEnergy_caloparticle2multicl", - "Shared Energy of CaloParticle per Multi Cluster", - nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_assoc.push_back( - ibook.book1D("SharedEnergy_caloparticle2multicl_assoc", - "Shared Energy of Associated CaloParticle per Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster.push_back(ibook.book1D("SharedEnergy_caloparticle2trackster", + "Shared Energy of CaloParticle per Trackster", + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_assoc.push_back( + ibook.book1D("SharedEnergy_caloparticle2trackster_assoc", + "Shared Energy of Associated CaloParticle per Trackster", nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2multicl_vs_eta", - "Shared Energy of CaloParticle vs #eta per best Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_eta", + "Shared Energy of CaloParticle vs #eta per best Trackster", nintEta_, minEta_, maxEta_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2multicl_vs_phi", - "Shared Energy of CaloParticle vs #phi per best Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_phi", + "Shared Energy of CaloParticle vs #phi per best Trackster", nintPhi_, minPhi_, maxPhi_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); histograms.h_num_caloparticle_eta.push_back( - ibook.book1D("Num_CaloParticle_Eta", "Num CaloParticle Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); - histograms.h_numDup_multicl_eta.push_back( - ibook.book1D("NumDup_MultiCluster_Eta", "Num Duplicate MultiCl vs Eta", nintEta_, minEta_, maxEta_)); + ibook.book1D("Num_CaloParticle_Eta", "Num CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_numDup_trackster_eta.push_back( + ibook.book1D("NumDup_Trackster_Eta", "Num Duplicate Trackster vs Eta", nintEta_, minEta_, maxEta_)); histograms.h_denom_caloparticle_eta.push_back( - ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); + ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); histograms.h_num_caloparticle_phi.push_back( - ibook.book1D("Num_CaloParticle_Phi", "Num CaloParticle Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numDup_multicl_phi.push_back( - ibook.book1D("NumDup_MultiCluster_Phi", "Num Duplicate MultiCl vs Phi", nintPhi_, minPhi_, maxPhi_)); + ibook.book1D("Num_CaloParticle_Phi", "Num CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numDup_trackster_phi.push_back( + ibook.book1D("NumDup_Trackster_Phi", "Num Duplicate Trackster vs Phi", nintPhi_, minPhi_, maxPhi_)); histograms.h_denom_caloparticle_phi.push_back( - ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); + ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_multicluster_perlayer; - clusternum_in_multicluster_perlayer.clear(); + std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_trackster_perlayer; + clusternum_in_trackster_perlayer.clear(); for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) { auto istr1 = std::to_string(ilayer); @@ -1082,54 +1079,50 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, istr2 = std::to_string(ilayer - (layers - 1)) + " in z+"; } - clusternum_in_multicluster_perlayer[ilayer] = - ibook.book1D("clusternum_in_multicluster_perlayer" + istr1, - "Number of layer clusters in multicluster for layer " + istr2, - nintTotNClsinMCLsperlayer_, - minTotNClsinMCLsperlayer_, - maxTotNClsinMCLsperlayer_); + clusternum_in_trackster_perlayer[ilayer] = ibook.book1D("clusternum_in_trackster_perlayer" + istr1, + "Number of layer clusters in Trackster for layer " + istr2, + nintTotNClsinTSTsperlayer_, + minTotNClsinTSTsperlayer_, + maxTotNClsinTSTsperlayer_); } - histograms.h_clusternum_in_multicluster_perlayer.push_back(std::move(clusternum_in_multicluster_perlayer)); + histograms.h_clusternum_in_trackster_perlayer.push_back(std::move(clusternum_in_trackster_perlayer)); - histograms.h_multiclusternum.push_back( - ibook.book1D("totmulticlusternum", "total number of multiclusters", nintTotNMCLs_, minTotNMCLs_, maxTotNMCLs_)); + histograms.h_tracksternum.push_back( + ibook.book1D("tottracksternum", "total number of Tracksters", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); - histograms.h_contmulticlusternum.push_back(ibook.book1D("contmulticlusternum", - "number of multiclusters with 3 contiguous layers", - nintTotNMCLs_, - minTotNMCLs_, - maxTotNMCLs_)); + histograms.h_conttracksternum.push_back(ibook.book1D( + "conttracksternum", "number of Tracksters with 3 contiguous layers", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); - histograms.h_noncontmulticlusternum.push_back(ibook.book1D("noncontmulticlusternum", - "number of multiclusters without 3 contiguous layers", - nintTotNMCLs_, - minTotNMCLs_, - maxTotNMCLs_)); + histograms.h_nonconttracksternum.push_back(ibook.book1D("nonconttracksternum", + "number of Tracksters without 3 contiguous layers", + nintTotNTSTs_, + minTotNTSTs_, + maxTotNTSTs_)); - histograms.h_clusternum_in_multicluster.push_back(ibook.book1D("clusternum_in_multicluster", - "total number of layer clusters in multicluster", - nintTotNClsinMCLs_, - minTotNClsinMCLs_, - maxTotNClsinMCLs_)); + histograms.h_clusternum_in_trackster.push_back(ibook.book1D("clusternum_in_trackster", + "total number of layer clusters in Trackster", + nintTotNClsinTSTs_, + minTotNClsinTSTs_, + maxTotNClsinTSTs_)); - histograms.h_clusternum_in_multicluster_vs_layer.push_back( - ibook.bookProfile("clusternum_in_multicluster_vs_layer", - "Profile of 2d layer clusters in multicluster vs layer number", + histograms.h_clusternum_in_trackster_vs_layer.push_back( + ibook.bookProfile("clusternum_in_trackster_vs_layer", + "Profile of 2d layer clusters in Trackster vs layer number", 2 * layers, 0., 2. * layers, - minTotNClsinMCLsperlayer_, - maxTotNClsinMCLsperlayer_)); + minTotNClsinTSTsperlayer_, + maxTotNClsinTSTsperlayer_)); - histograms.h_multiplicityOfLCinMCL.push_back(ibook.book2D("multiplicityOfLCinMCL", - "Multiplicity vs Layer cluster size in Multiclusters", + histograms.h_multiplicityOfLCinTST.push_back(ibook.book2D("multiplicityOfLCinTST", + "Multiplicity vs Layer cluster size in Tracksters", nintMplofLCs_, minMplofLCs_, maxMplofLCs_, - nintSizeCLsinMCLs_, - minSizeCLsinMCLs_, - maxSizeCLsinMCLs_)); + nintSizeCLsinTSTs_, + minSizeCLsinTSTs_, + maxSizeCLsinTSTs_)); histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.book1D("multiplicity_numberOfEventsHistogram", "multiplicity numberOfEventsHistogram", @@ -1151,8 +1144,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, minMplofLCs_, maxMplofLCs_)); - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layercluster_zminus", + histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zminus", "Multiplicity vs Layer number in z-", nintMplofLCs_, minMplofLCs_, @@ -1161,8 +1154,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, 0., (float)layers)); - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layercluster_zplus", + histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zplus", "Multiplicity vs Layer number in z+", nintMplofLCs_, minMplofLCs_, @@ -1171,8 +1164,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, 0., (float)layers)); - histograms.h_multiplicityOfLCinMCL_vs_layerclusterenergy.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layerclusterenergy", + histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layerclusterenergy", "Multiplicity vs Layer cluster energy", nintMplofLCs_, minMplofLCs_, @@ -1181,26 +1174,22 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, minClEnepermultiplicity_, maxClEnepermultiplicity_)); - histograms.h_multicluster_pt.push_back( - ibook.book1D("multicluster_pt", "Pt of the multicluster", nintPt_, minPt_, maxPt_)); - histograms.h_multicluster_eta.push_back( - ibook.book1D("multicluster_eta", "Eta of the multicluster", nintEta_, minEta_, maxEta_)); - histograms.h_multicluster_phi.push_back( - ibook.book1D("multicluster_phi", "Phi of the multicluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_multicluster_energy.push_back( - ibook.book1D("multicluster_energy", "Energy of the multicluster", nintEne_, minEne_, maxEne_)); - histograms.h_multicluster_x.push_back( - ibook.book1D("multicluster_x", "X position of the multicluster", nintX_, minX_, maxX_)); - histograms.h_multicluster_y.push_back( - ibook.book1D("multicluster_y", "Y position of the multicluster", nintY_, minY_, maxY_)); - histograms.h_multicluster_z.push_back( - ibook.book1D("multicluster_z", "Z position of the multicluster", nintZ_, minZ_, maxZ_)); - histograms.h_multicluster_firstlayer.push_back( - ibook.book1D("multicluster_firstlayer", "First layer of the multicluster", 2 * layers, 0., (float)2 * layers)); - histograms.h_multicluster_lastlayer.push_back( - ibook.book1D("multicluster_lastlayer", "Last layer of the multicluster", 2 * layers, 0., (float)2 * layers)); - histograms.h_multicluster_layersnum.push_back(ibook.book1D( - "multicluster_layersnum", "Number of layers of the multicluster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_pt.push_back(ibook.book1D("trackster_pt", "Pt of the Trackster", nintPt_, minPt_, maxPt_)); + histograms.h_trackster_eta.push_back( + ibook.book1D("trackster_eta", "Eta of the Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_trackster_phi.push_back( + ibook.book1D("trackster_phi", "Phi of the Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_trackster_energy.push_back( + ibook.book1D("trackster_energy", "Energy of the Trackster", nintEne_, minEne_, maxEne_)); + histograms.h_trackster_x.push_back(ibook.book1D("trackster_x", "X position of the Trackster", nintX_, minX_, maxX_)); + histograms.h_trackster_y.push_back(ibook.book1D("trackster_y", "Y position of the Trackster", nintY_, minY_, maxY_)); + histograms.h_trackster_z.push_back(ibook.book1D("trackster_z", "Z position of the Trackster", nintZ_, minZ_, maxZ_)); + histograms.h_trackster_firstlayer.push_back( + ibook.book1D("trackster_firstlayer", "First layer of the Trackster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_lastlayer.push_back( + ibook.book1D("trackster_lastlayer", "Last layer of the Trackster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_layersnum.push_back( + ibook.book1D("trackster_layersnum", "Number of layers of the Trackster", 2 * layers, 0., (float)2 * layers)); } void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsigned int layers) const { @@ -1218,31 +1207,31 @@ void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsign void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms, int pdgid, - const CaloParticle& caloparticle, + const CaloParticle& caloParticle, std::vector<SimVertex> const& simVertices, unsigned int layers, std::unordered_map<DetId, const HGCRecHit*> const& hitMap) const { - const auto eta = getEta(caloparticle.eta()); + const auto eta = getEta(caloParticle.eta()); if (histograms.h_caloparticle_eta.count(pdgid)) { histograms.h_caloparticle_eta.at(pdgid)->Fill(eta); } if (histograms.h_caloparticle_eta_Zorigin.count(pdgid)) { histograms.h_caloparticle_eta_Zorigin.at(pdgid)->Fill( - simVertices.at(caloparticle.g4Tracks()[0].vertIndex()).position().z(), eta); + simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), eta); } if (histograms.h_caloparticle_energy.count(pdgid)) { - histograms.h_caloparticle_energy.at(pdgid)->Fill(caloparticle.energy()); + histograms.h_caloparticle_energy.at(pdgid)->Fill(caloParticle.energy()); } if (histograms.h_caloparticle_pt.count(pdgid)) { - histograms.h_caloparticle_pt.at(pdgid)->Fill(caloparticle.pt()); + histograms.h_caloparticle_pt.at(pdgid)->Fill(caloParticle.pt()); } if (histograms.h_caloparticle_phi.count(pdgid)) { - histograms.h_caloparticle_phi.at(pdgid)->Fill(caloparticle.phi()); + histograms.h_caloparticle_phi.at(pdgid)->Fill(caloParticle.phi()); } if (histograms.h_caloparticle_nSimClusters.count(pdgid)) { - histograms.h_caloparticle_nSimClusters.at(pdgid)->Fill(caloparticle.simClusters().size()); + histograms.h_caloparticle_nSimClusters.at(pdgid)->Fill(caloParticle.simClusters().size()); int simHits = 0; int minLayerId = 999; @@ -1255,7 +1244,7 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms float energy = 0.; std::map<int, double> totenergy_layer; - for (auto const& sc : caloparticle.simClusters()) { + for (auto const& sc : caloParticle.simClusters()) { LogDebug("HGCalValidator") << " This sim cluster has " << sc->hits_and_fractions().size() << " simHits and " << sc->energy() << " energy. " << std::endl; simHits += sc->hits_and_fractions().size(); @@ -1282,7 +1271,7 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms } else { totenergy_layer.emplace(layerId, hit->energy()); } - if (caloparticle.simClusters().size() == 1) + if (caloParticle.simClusters().size() == 1) histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(pdgid)->Fill(layerId, hit->energy() * h_and_f.second); } else { @@ -1307,21 +1296,21 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms histograms.h_caloparticle_nHitsInSimClusters.at(pdgid)->Fill((float)simHits); histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit.at(pdgid)->Fill((float)simHits_matched); histograms.h_caloparticle_selfenergy.at(pdgid)->Fill((float)energy); - histograms.h_caloparticle_energyDifference.at(pdgid)->Fill((float)1. - energy / caloparticle.energy()); + histograms.h_caloparticle_energyDifference.at(pdgid)->Fill((float)1. - energy / caloParticle.energy()); //Calculate sum energy per-layer auto i = totenergy_layer.begin(); double sum_energy = 0.0; while (i != totenergy_layer.end()) { sum_energy += i->second; - histograms.h_caloparticle_sum_energy_layer.at(pdgid)->Fill(i->first, sum_energy / caloparticle.energy() * 100.); + histograms.h_caloparticle_sum_energy_layer.at(pdgid)->Fill(i->first, sum_energy / caloParticle.energy() * 100.); i++; } } } -void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Histograms& histograms, - std::vector<SimCluster> const& simclusters, +void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(const Histograms& histograms, + std::vector<SimCluster> const& simClusters, unsigned int layers, std::vector<int> thicknesses) const { //Each event to be treated as two events: an event in +ve endcap, @@ -1330,7 +1319,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi //-z: 0->49 //+z: 50->99 - //To keep track of total num of simclusters per layer + //To keep track of total num of simClusters per layer //tnscpl[layerid] std::vector<int> tnscpl(1000, 0); //tnscpl.clear(); tnscpl.reserve(1000); @@ -1344,16 +1333,16 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi tnscpthplus.insert(std::pair<std::string, int>(std::to_string(*it), 0)); tnscpthminus.insert(std::pair<std::string, int>(std::to_string(*it), 0)); } - //To keep track of the total num of simclusters with mixed thickness hits per event + //To keep track of the total num of simClusters with mixed thickness hits per event tnscpthplus.insert(std::pair<std::string, int>("mixed", 0)); tnscpthminus.insert(std::pair<std::string, int>("mixed", 0)); - //loop through simclusters - for (unsigned int ic = 0; ic < simclusters.size(); ++ic) { - const auto& sc = simclusters[ic]; + //loop through simClusters + for (unsigned int ic = 0; ic < simClusters.size(); ++ic) { + const auto& sc = simClusters[ic]; const auto& hitsAndFractions = sc.hits_and_fractions(); - //Auxillary variables to count the number of different kind of hits in each simcluster + //Auxillary variables to count the number of different kind of hits in each simCluster int nthhits120p = 0; int nthhits200p = 0; int nthhits300p = 0; @@ -1364,10 +1353,10 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi int nthhitsscintm = 0; //For the hits thickness of the layer cluster. double thickness = 0.; - //To keep track if we added the simcluster in a specific layer + //To keep track if we added the simCluster in a specific layer std::vector<int> occurenceSCinlayer(1000, 0); //[layerid][0 if not added] - //loop through hits of the simcluster + //loop through hits of the simCluster for (const auto& hAndF : hitsAndFractions) { const DetId sh_detid = hAndF.first; @@ -1377,7 +1366,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi //zside that the current cluster belongs to. int zside = recHitTools_->zside(sh_detid); - //add the simcluster to the relevant layer. A simcluster may give contribution to several layers. + //add the simCluster to the relevant layer. A SimCluster may give contribution to several layers. if (occurenceSCinlayer[layerid] == 0) { tnscpl[layerid]++; } @@ -1388,7 +1377,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi } else if (sh_detid.det() == DetId::HGCalHSc) { thickness = -1; } else { - LogDebug("HGCalValidator") << "These are HGCal simclusters, you shouldn't be here !!! " << layerid << "\n"; + LogDebug("HGCalValidator") << "These are HGCal simClusters, you shouldn't be here !!! " << layerid << "\n"; continue; } @@ -1434,7 +1423,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi tnscpthminus[std::to_string((int)thickness)]++; } - } //end of loop through simclusters of the event + } //end of loop through SimClusters of the event //Per layer : Loop 0->99 for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) { @@ -1455,13 +1444,13 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi histograms.h_mixedhitssimcluster_zminus->Fill(tnscpthminus["mixed"]); } -void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simclusterassosiation_histos( +void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterAssociation_histos( const Histograms& histograms, int count, edm::Handle<reco::CaloClusterCollection> clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle<std::vector<SimCluster>> simClusterHandle, - std::vector<SimCluster> const& simclusters, + std::vector<SimCluster> const& simClusters, std::vector<size_t> const& sCIndices, const std::vector<float>& mask, std::unordered_map<DetId, const HGCRecHit*> const& hitMap, @@ -1481,7 +1470,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simclusterassosiation_hist clusterHandle, clusters, simClusterHandle, - simclusters, + simClusters, sCIndices, mask, hitMap, @@ -1514,7 +1503,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map; // The association has to be done in an all-vs-all fashion. - // For this reason we use the full set of caloParticles, with the only filter on bx + // For this reason we use the full set of CaloParticles, with the only filter on bx for (const auto& cpId : cPIndices) { const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters(); for (const auto& it_sc : simClusterRefVector) { @@ -1567,7 +1556,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { DetId rh_detid = hits_and_fractions[hitId].first; - auto rhFraction = hits_and_fractions[hitId].second; + const auto rhFraction = hits_and_fractions[hitId].second; std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); const HGCRecHit* hit = itcheck->second; @@ -1781,7 +1770,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( // Here we do fill the plots to compute the different metrics linked to // reco-level, namely fake-rate and merge-rate. In this loop we should *not* - // restrict only to the selected simClusters. + // restrict only to the selected SimClusters. for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) { if (mask[lcId] != 0.) { LogDebug("HGCalValidator") << "Skipping layer cluster " << lcId << " not belonging to mask" << std::endl; @@ -1810,11 +1799,11 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( } continue; } - //Loop through all simClusters linked to the layer cluster under study + //Loop through all SimClusters linked to the layer cluster under study for (const auto& scPair : scs) { LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId << "\t SC id: \t" << scPair.first.index() << "\t score \t" << scPair.second << std::endl; - //This should be filled #layerclusters in layer x #linked SimClusters + //This should be filled #layerClusters in layer x #linked SimClusters histograms.h_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(scPair.second); auto const& sc_linked = std::find_if(std::begin(lcsInSimClusterMap[scPair.first]), @@ -1830,7 +1819,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( histograms.h_energy_vs_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill( scPair.second, sc_linked->second.first / clusters[lcId].energy()); } - //Here he counts how many of the linked simclusters of the layer cluster under study have a score above a certain value. + //Here he counts how many of the linked SimClusters of the layer cluster under study have a score above a certain value. const auto assoc = std::count_if(std::begin(scs), std::end(scs), [](const auto& obj) { return obj.second < ScoreCutLCtoSC_; }); if (assoc) { @@ -1842,7 +1831,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( } const auto& best = std::min_element( std::begin(scs), std::end(scs), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - //From all simclusters he founds the one with the best (lowest) score and takes his scId + //From all SimClusters he founds the one with the best (lowest) score and takes his scId const auto& best_sc_linked = std::find_if(std::begin(lcsInSimClusterMap[best->first]), std::end(lcsInSimClusterMap[best->first]), @@ -1861,7 +1850,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( // Here we do fill the plots to compute the different metrics linked to // gen-level, namely efficiency and duplicate. In this loop we should restrict - // only to the selected simClusters. + // only to the selected SimClusters. for (const auto& scId : sCIndices) { const edm::Ref<SimClusterCollection> scRef(simClusterHandle, scId); const auto& lcsIt = lcsInSimClusterMap.find(scRef); @@ -1901,7 +1890,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( return lcLayerId; }; - //Loop through layer clusters linked to the simcluster under study + //Loop through layer clusters linked to the SimCluster under study for (const auto& lcPair : lcs) { auto lcId = lcPair.first.index(); if (mask[lcId] != 0.) { @@ -2004,7 +1993,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr //for the longitudinal depth barycenter std::vector<double> ldbar(1000, 0.0); //ldbar.clear(); ldbar.reserve(1000); - //We need to compare with the total amount of energy coming from caloparticles + //We need to compare with the total amount of energy coming from CaloParticles double caloparteneplus = 0.; double caloparteneminus = 0.; for (const auto& cpId : cPIndices) { @@ -2017,15 +2006,15 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr } //loop through clusters of the event - for (unsigned int layerclusterIndex = 0; layerclusterIndex < clusters.size(); layerclusterIndex++) { - const std::vector<std::pair<DetId, float>> hits_and_fractions = clusters[layerclusterIndex].hitsAndFractions(); + for (unsigned int lcId = 0; lcId < clusters.size(); lcId++) { + const std::vector<std::pair<DetId, float>> hits_and_fractions = clusters[lcId].hitsAndFractions(); - const DetId seedid = clusters[layerclusterIndex].seed(); + const DetId seedid = clusters[lcId].seed(); const double seedx = recHitTools_->getPosition(seedid).x(); const double seedy = recHitTools_->getPosition(seedid).y(); - DetId maxid = findmaxhit(clusters[layerclusterIndex], hitMap); + DetId maxid = findmaxhit(clusters[lcId], hitMap); - // const DetId maxid = clusters[layerclusterIndex].max(); + // const DetId maxid = clusters[lcId].max(); double maxx = recHitTools_->getPosition(maxid).x(); double maxy = recHitTools_->getPosition(maxid).y(); @@ -2202,13 +2191,13 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax); } if (histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) { - histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill( - distancebetseedandmax, clusters[layerclusterIndex].energy()); + histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax, + clusters[lcId].energy()); } //Energy clustered per layer - tecpl[layerid] = tecpl[layerid] + clusters[layerclusterIndex].energy(); - ldbar[layerid] = ldbar[layerid] + clusters[layerclusterIndex].energy() * cummatbudg[(double)lay]; + tecpl[layerid] = tecpl[layerid] + clusters[lcId].energy(); + ldbar[layerid] = ldbar[layerid] + clusters[lcId].energy() * cummatbudg[(double)lay]; } //end of loop through clusters of the event @@ -2274,28 +2263,29 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr histograms.h_longdepthbarycentre_zminus[count]->Fill(sumldbarmi / sumeneallclusmi); } -void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& histograms, - int count, - const std::vector<reco::HGCalMultiCluster>& multiClusters, - std::vector<CaloParticle> const& cP, - std::vector<size_t> const& cPIndices, - std::vector<size_t> const& cPSelectedIndices, - std::unordered_map<DetId, const HGCRecHit*> const& hitMap, - unsigned int layers) const { - auto nMultiClusters = multiClusters.size(); +void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histograms, + int count, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector<CaloParticle> const& cP, + std::vector<size_t> const& cPIndices, + std::vector<size_t> const& cPSelectedIndices, + std::unordered_map<DetId, const HGCRecHit*> const& hitMap, + unsigned int layers) const { + auto nTracksters = tracksters.size(); //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. auto nCaloParticles = cPIndices.size(); std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map; - std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInMultiCluster>> detIdToMultiClusterId_Map; - std::vector<int> tracksters_fakemerge(nMultiClusters, 0); - std::vector<int> tracksters_duplicate(nMultiClusters, 0); + std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>> detIdToTracksterId_Map; + std::vector<int> tracksters_fakemerge(nTracksters, 0); + std::vector<int> tracksters_duplicate(nTracksters, 0); - // this contains the ids of the caloparticles contributing with at least one hit to the multi cluster and the reconstruction error - //cpsInLayerCluster[multicluster][CPids] - //Connects a multicluster with all related caloparticles. - std::vector<std::vector<std::pair<unsigned int, float>>> cpsInMultiCluster; - cpsInMultiCluster.resize(nMultiClusters); + // this contains the ids of the CaloParticles contributing with at least one hit to the Trackster and the reconstruction error + //cpsInLayerCluster[trackster][CPids] + //Connects a Trackster with all related CaloParticles. + std::vector<std::vector<std::pair<unsigned int, float>>> cpsInTrackster; + cpsInTrackster.resize(nTracksters); //cPOnLayer[caloparticle][layer] //This defines a "calo particle on layer" concept. It is only filled in case @@ -2333,9 +2323,9 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist const HGCRecHit* hit = itcheck->second; //Since the current hit from sim cluster has a reconstructed hit with the same detid, //make a map that will connect a detid with: - //1. the caloparticles that have a simcluster with sim hits in that cell via caloparticle id. + //1. the CaloParticles that have a SimCluster with sim hits in that cell via caloparticle id. //2. the sum of all simhits fractions that contributes to that detid. - //So, keep in mind that in case of multiple caloparticles contributing in the same cell + //So, keep in mind that in case of multiple CaloParticles contributing in the same cell //the fraction is the sum over all calo particles. So, something like: //detid: (caloparticle 1, sum of hits fractions in that detid over all cp) , (caloparticle 2, sum of hits fractions in that detid over all cp), (caloparticle 3, sum of hits fractions in that detid over all cp) ... auto hit_find_it = detIdToCaloParticleId_Map.find(hitid); @@ -2374,309 +2364,311 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist } } } // end of loop through simhits - } // end of loop through simclusters - } // end of loop through caloparticles - - //Loop through multiclusters - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - std::unordered_map<unsigned, float> CPEnergyInMCL; - int maxCPId_byNumberOfHits = -1; - unsigned int maxCPNumberOfHitsInMCL = 0; - int maxCPId_byEnergy = -1; - float maxEnergySharedMCLandCP = 0.f; - float energyFractionOfMCLinCP = 0.f; - float energyFractionOfCPinMCL = 0.f; - - //In case of matched rechit-simhit, so matched - //caloparticle-layercluster-multicluster, he counts and saves the number of - //rechits related to the maximum energy CaloParticle out of all - //CaloParticles related to that layer cluster and multicluster. - - std::unordered_map<unsigned, unsigned> occurrencesCPinMCL; - unsigned int numberOfNoiseHitsInMCL = 0; - unsigned int numberOfHaloHitsInMCL = 0; - unsigned int numberOfHitsInMCL = 0; - - //number of hits related to that cluster. - unsigned int numberOfHitsInLC = hits_and_fractions.size(); - numberOfHitsInMCL += numberOfHitsInLC; - std::unordered_map<unsigned, float> CPEnergyInLC; - - //hitsToCaloParticleId is a vector of ints, one for each rechit of the - //layer cluster under study. If negative, there is no simhit from any CaloParticle related. - //If positive, at least one CaloParticle has been found with matched simhit. - //In more detail: - // 1. hitsToCaloParticleId[hitId] = -3 - // TN: These represent Halo Cells(N) that have not been - // assigned to any CaloParticle (hence the T). - // 2. hitsToCaloParticleId[hitId] = -2 - // FN: There represent Halo Cells(N) that have been assigned - // to a CaloParticle (hence the F, since those should have not been marked as halo) - // 3. hitsToCaloParticleId[hitId] = -1 - // FP: These represent Real Cells(P) that have not been - // assigned to any CaloParticle (hence the F, since these are fakes) - // 4. hitsToCaloParticleId[hitId] >= 0 - // TP There represent Real Cells(P) that have been assigned - // to a CaloParticle (hence the T) - - std::vector<int> hitsToCaloParticleId(numberOfHitsInLC); - //det id of the first hit just to make the lcLayerId variable - //which maps the layers in -z: 0->51 and in +z: 52->103 - const auto firstHitDetId = hits_and_fractions[0].first; - int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + - layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; + } // end of loop through SimClusters + } // end of loop through CaloParticles + + auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, const reco::CaloClusterCollection& layerClusters) { + std::vector<std::pair<DetId, float>> hits_and_fractions_norm; + int lcInTst = 0; + std::for_each(std::begin(trackster.vertices()), std::end(trackster.vertices()), [&](unsigned int idx) { + const auto fraction = 1.f / trackster.vertex_multiplicity(lcInTst++); + for (const auto& cell : layerClusters[idx].hitsAndFractions()) { + hits_and_fractions_norm.emplace_back(cell.first, cell.second * fraction); + } + }); + return hits_and_fractions_norm; + }; - //Loop though the hits of the layer cluster under study - for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { - DetId rh_detid = hits_and_fractions[hitId].first; - auto rhFraction = hits_and_fractions[hitId].second; + //Loop through Tracksters + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + if (tracksters[tstId].vertices().empty()) + continue; - //Since the hit is belonging to the layer cluster, it must also be in the rechits map. - std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); - const HGCRecHit* hit = itcheck->second; + std::unordered_map<unsigned, float> CPEnergyInTST; + int maxCPId_byNumberOfHits = -1; + unsigned int maxCPNumberOfHitsInTST = 0; + int maxCPId_byEnergy = -1; + float maxEnergySharedTSTandCP = 0.f; + float energyFractionOfTSTinCP = 0.f; + float energyFractionOfCPinTST = 0.f; + + //In case of matched rechit-simhit, so matched + //CaloParticle-LayerCluster-Trackster, he counts and saves the number of + //rechits related to the maximum energy CaloParticle out of all + //CaloParticles related to that layer cluster and Trackster. + + std::unordered_map<unsigned, unsigned> occurrencesCPinTST; + unsigned int numberOfNoiseHitsInTST = 0; + unsigned int numberOfHaloHitsInTST = 0; + + const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); + const auto numberOfHitsInTST = tst_hitsAndFractions.size(); + + //hitsToCaloParticleId is a vector of ints, one for each rechit of the + //layer cluster under study. If negative, there is no simhit from any CaloParticle related. + //If positive, at least one CaloParticle has been found with matched simhit. + //In more detail: + // 1. hitsToCaloParticleId[hitId] = -3 + // TN: These represent Halo Cells(N) that have not been + // assigned to any CaloParticle (hence the T). + // 2. hitsToCaloParticleId[hitId] = -2 + // FN: There represent Halo Cells(N) that have been assigned + // to a CaloParticle (hence the F, since those should have not been marked as halo) + // 3. hitsToCaloParticleId[hitId] = -1 + // FP: These represent Real Cells(P) that have not been + // assigned to any CaloParticle (hence the F, since these are fakes) + // 4. hitsToCaloParticleId[hitId] >= 0 + // TP There represent Real Cells(P) that have been assigned + // to a CaloParticle (hence the T) + + std::vector<int> hitsToCaloParticleId(numberOfHitsInTST); + //Det id of the first hit just to make the lcLayerId variable + //which maps the layers in -z: 0->51 and in +z: 52->103 + const auto firstHitDetId = tst_hitsAndFractions[0].first; + int lcLayerId = + recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; - //Make a map that will connect a detid (that belongs to a rechit of the layer cluster under study, - //no need to save others) with: - //1. the layer clusters that have rechits in that detid - //2. the fraction of the rechit of each layer cluster that contributes to that detid. - //So, something like: - //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... - //here comparing with the calo particle map above the - auto hit_find_in_LC = detIdToMultiClusterId_Map.find(rh_detid); - if (hit_find_in_LC == detIdToMultiClusterId_Map.end()) { - detIdToMultiClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInMultiCluster>(); - } - detIdToMultiClusterId_Map[rh_detid].emplace_back( - HGVHistoProducerAlgo::detIdInfoInMultiCluster{mclId, mclId, rhFraction}); + //Loop through the hits of the trackster under study + for (unsigned int hitId = 0; hitId < numberOfHitsInTST; hitId++) { + const auto rh_detid = tst_hitsAndFractions[hitId].first; + const auto rhFraction = tst_hitsAndFractions[hitId].second; + + //Since the hit is belonging to the layer cluster, it must also be in the rechits map. + std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); + const HGCRecHit* hit = itcheck->second; - //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + //Make a map that will connect a detid (that belongs to a rechit of the layer cluster under study, + //no need to save others) with: + //1. the layer clusters that have rechits in that detid + //2. the fraction of the rechit of each layer cluster that contributes to that detid. + //So, something like: + //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... + //here comparing with the calo particle map above the + auto hit_find_in_LC = detIdToTracksterId_Map.find(rh_detid); + if (hit_find_in_LC == detIdToTracksterId_Map.end()) { + detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>(); + } + detIdToTracksterId_Map[rh_detid].emplace_back( + HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, tstId, rhFraction}); - // if the fraction is zero or the hit does not belong to any calo - // particle, set the caloparticleId for the hit to -1 this will - // contribute to the number of noise hits + //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. + auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); - // MR Remove the case in which the fraction is 0, since this could be a - // real hit that has been marked as halo. - if (rhFraction == 0.) { - hitsToCaloParticleId[hitId] = -2; - numberOfHaloHitsInMCL++; - } - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { - hitsToCaloParticleId[hitId] -= 1; - } else { - auto maxCPEnergyInLC = 0.f; - auto maxCPId = -1; - for (auto& h : hit_find_in_CP->second) { - auto shared_fraction = std::min(rhFraction, h.fraction); - //We are in the case where there are calo particles with simhits connected via detid with the rechit under study - //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the - //energy of that calo particle as the sum over all rechits of the rechits energy weighted - //by the caloparticle's fraction related to that rechit. - CPEnergyInMCL[h.clusterId] += shared_fraction * hit->energy(); - //Same but for layer clusters for the cell association per layer - CPEnergyInLC[h.clusterId] += shared_fraction * hit->energy(); - //Here cPOnLayer[caloparticle][layer] describe above is set. - //Here for multi clusters with matched rechit the CP fraction times hit energy is added and saved . - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].first += - shared_fraction * hit->energy(); - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].second = FLT_MAX; - //cpsInMultiCluster[multicluster][CPids] - //Connects a multi cluster with all related caloparticles. - cpsInMultiCluster[mclId].emplace_back(h.clusterId, FLT_MAX); - //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle - //that after simhit-rechit matching in layer has the maximum energy. - if (shared_fraction > maxCPEnergyInLC) { - //energy is used only here. cpid is saved for multiclusters - maxCPEnergyInLC = CPEnergyInLC[h.clusterId]; - maxCPId = h.clusterId; - } + // if the fraction is zero or the hit does not belong to any calo + // particle, set the caloparticleId for the hit to -1 this will + // contribute to the number of noise hits + + // MR Remove the case in which the fraction is 0, since this could be a + // real hit that has been marked as halo. + if (rhFraction == 0.) { + hitsToCaloParticleId[hitId] = -2; + numberOfHaloHitsInTST++; + } + if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { + hitsToCaloParticleId[hitId] -= 1; + } else { + auto maxCPEnergyInTST = 0.f; + auto maxCPId = -1; + for (const auto& h : hit_find_in_CP->second) { + auto shared_fraction = std::min(rhFraction, h.fraction); + //We are in the case where there are calo particles with simhits connected via detid with the rechit under study + //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the + //energy of that calo particle as the sum over all rechits of the rechits energy weighted + //by the caloparticle's fraction related to that rechit. + CPEnergyInTST[h.clusterId] += shared_fraction * hit->energy(); + //Here cPOnLayer[caloparticle][layer] describe above is set. + //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved . + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += + shared_fraction * hit->energy(); + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; + //cpsInTrackster[trackster][CPids] + //Connects a Trackster with all related CaloParticles. + cpsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); + //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle + //that after simhit-rechit matching in layer has the maximum energy. + if (shared_fraction > maxCPEnergyInTST) { + //energy is used only here. cpid is saved for Tracksters + maxCPEnergyInTST = CPEnergyInTST[h.clusterId]; + maxCPId = h.clusterId; } - //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. - hitsToCaloParticleId[hitId] = maxCPId; } + //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. + hitsToCaloParticleId[hitId] = maxCPId; + } - } //end of loop through rechits of the layer cluster. + } //end of loop through rechits of the layer cluster. - //Loop through all rechits to count how many of them are noise and how many are matched. - //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. - for (auto c : hitsToCaloParticleId) { - if (c < 0) { - numberOfNoiseHitsInMCL++; - } else { - occurrencesCPinMCL[c]++; - } + //Loop through all rechits to count how many of them are noise and how many are matched. + //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. + for (auto c : hitsToCaloParticleId) { + if (c < 0) { + numberOfNoiseHitsInTST++; + } else { + occurrencesCPinTST[c]++; } + } - //Below from all maximum energy CaloParticles, he saves the one with the largest amount - //of related rechits. - for (auto& c : occurrencesCPinMCL) { - if (c.second > maxCPNumberOfHitsInMCL) { - maxCPId_byNumberOfHits = c.first; - maxCPNumberOfHitsInMCL = c.second; - } + //Below from all maximum energy CaloParticles, he saves the one with the largest amount + //of related rechits. + for (auto& c : occurrencesCPinTST) { + if (c.second > maxCPNumberOfHitsInTST) { + maxCPId_byNumberOfHits = c.first; + maxCPNumberOfHitsInTST = c.second; } + } - //Find the CaloParticle that has the maximum energy shared with the multicluster under study. - for (auto& c : CPEnergyInMCL) { - if (c.second > maxEnergySharedMCLandCP) { - maxCPId_byEnergy = c.first; - maxEnergySharedMCLandCP = c.second; - } + //Find the CaloParticle that has the maximum energy shared with the Trackster under study. + for (auto& c : CPEnergyInTST) { + if (c.second > maxEnergySharedTSTandCP) { + maxCPId_byEnergy = c.first; + maxEnergySharedTSTandCP = c.second; } - //The energy of the CaloParticle that found to have the maximum energy shared with the multicluster under study. - float totalCPEnergyFromLayerCP = 0.f; - if (maxCPId_byEnergy >= 0) { - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; - } - energyFractionOfCPinMCL = maxEnergySharedMCLandCP / totalCPEnergyFromLayerCP; - if (multiClusters[mclId].energy() > 0.f) { - energyFractionOfMCLinCP = maxEnergySharedMCLandCP / multiClusters[mclId].energy(); - } + } + //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study. + float totalCPEnergyFromLayerCP = 0.f; + if (maxCPId_byEnergy >= 0) { + //Loop through all layers + for (unsigned int j = 0; j < layers * 2; ++j) { + totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; } - - LogDebug("HGCalValidator") << std::setw(12) << "multiCluster" - << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << "mulcl energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsCP" - << "\t" << std::setw(16) << "maxCPId_byEnergy" - << "\t" << std::setw(23) << "maxEnergySharedMCLandCP" - << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" - << "\t" << std::setw(22) << "energyFractionOfMCLinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinMCL" - << "\t" << std::endl; - LogDebug("HGCalValidator") << std::setw(12) << mclId << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << multiClusters[mclId].energy() << "\t" << std::setw(5) - << numberOfHitsInMCL << "\t" << std::setw(12) << numberOfNoiseHitsInMCL << "\t" - << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) - << maxCPNumberOfHitsInMCL << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" - << std::setw(23) << maxEnergySharedMCLandCP << "\t" << std::setw(22) - << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfMCLinCP << "\t" - << std::setw(25) << energyFractionOfCPinMCL << std::endl; - - } //end of loop through multi clusters - } - //Loop through multiclusters - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - // find the unique caloparticles id contributing to the multi clusters - //cpsInMultiCluster[multicluster][CPids] - std::sort(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].end()); - auto last = std::unique(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].end()); - cpsInMultiCluster[mclId].erase(last, cpsInMultiCluster[mclId].end()); - - if (multiClusters[mclId].energy() == 0. && !cpsInMultiCluster[mclId].empty()) { - //Loop through all CaloParticles contributing to multicluster mclId. - for (auto& cpPair : cpsInMultiCluster[mclId]) { - //In case of a multi cluster with zero energy but related CaloParticles the score is set to 1. - cpPair.second = 1.; - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\t CP id: \t" << cpPair.first - << "\t score \t" << cpPair.second << std::endl; - histograms.h_score_multicl2caloparticle[count]->Fill(cpPair.second); - } - continue; + energyFractionOfCPinTST = maxEnergySharedTSTandCP / totalCPEnergyFromLayerCP; + if (tracksters[tstId].raw_energy() > 0.f) { + energyFractionOfTSTinCP = maxEnergySharedTSTandCP / tracksters[tstId].raw_energy(); } + } - // Compute the correct normalization - float invMultiClusterEnergyWeight = 0.f; - for (auto const& haf : multiClusters[mclId].hitsAndFractions()) { - invMultiClusterEnergyWeight += - (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); + LogDebug("HGCalValidator") << std::setw(12) << "Trackster" + << "\t" //LogDebug("HGCalValidator") + << std::setw(10) << "mulcl energy" + << "\t" << std::setw(5) << "nhits" + << "\t" << std::setw(12) << "noise hits" + << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" + << "\t" << std::setw(8) << "nhitsCP" + << "\t" << std::setw(16) << "maxCPId_byEnergy" + << "\t" << std::setw(23) << "maxEnergySharedTSTandCP" + << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" + << "\t" << std::setw(22) << "energyFractionOfTSTinCP" + << "\t" << std::setw(25) << "energyFractionOfCPinTST" + << "\t" << std::endl; + LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator") + << std::setw(10) << tracksters[tstId].raw_energy() << "\t" << std::setw(5) + << numberOfHitsInTST << "\t" << std::setw(12) << numberOfNoiseHitsInTST << "\t" + << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) + << maxCPNumberOfHitsInTST << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" + << std::setw(23) << maxEnergySharedTSTandCP << "\t" << std::setw(22) + << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSTinCP << "\t" + << std::setw(25) << energyFractionOfCPinTST << std::endl; + + } //end of loop through Tracksters + + //Loop through Tracksters + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + if (tracksters[tstId].vertices().empty()) + continue; + + // find the unique CaloParticles id contributing to the Tracksters + //cpsInTrackster[trackster][CPids] + std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + auto last = std::unique(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + cpsInTrackster[tstId].erase(last, cpsInTrackster[tstId].end()); + + if (tracksters[tstId].raw_energy() == 0. && !cpsInTrackster[tstId].empty()) { + //Loop through all CaloParticles contributing to Trackster tstId. + for (auto& cpPair : cpsInTrackster[tstId]) { + //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. + cpPair.second = 1.; + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" + << cpPair.second << std::endl; + histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); } - invMultiClusterEnergyWeight = 1.f / invMultiClusterEnergyWeight; - - unsigned int numberOfHitsInLC = hits_and_fractions.size(); - for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { - DetId rh_detid = hits_and_fractions[i].first; - float rhFraction = hits_and_fractions[i].second; - bool hitWithNoCP = false; - - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) - hitWithNoCP = true; - auto itcheck = hitMap.find(rh_detid); - const HGCRecHit* hit = itcheck->second; - float hitEnergyWeight = hit->energy() * hit->energy(); + continue; + } - for (auto& cpPair : cpsInMultiCluster[mclId]) { - float cpFraction = 0.f; - if (!hitWithNoCP) { - auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), - detIdToCaloParticleId_Map[rh_detid].end(), - HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first, 0.f}); - if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) { - cpFraction = findHitIt->fraction; - } - } - if (cpPair.second == FLT_MAX) { - cpPair.second = 0.f; - } - cpPair.second += - (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invMultiClusterEnergyWeight; - } - } //end of loop through rechits of layer cluster + const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); + ; + // Compute the correct normalization + float invTracksterEnergyWeight = 0.f; + for (const auto& haf : tst_hitsAndFractions) { + invTracksterEnergyWeight += + (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); + } + invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; - //In case of a multi cluster with some energy but none related CaloParticles print some info. - if (cpsInMultiCluster[mclId].empty()) - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\tCP id:\t-1 " - << "\t score \t-1" - << "\n"; + for (unsigned int i = 0; i < tst_hitsAndFractions.size(); ++i) { + const auto rh_detid = tst_hitsAndFractions[i].first; + const auto rhFraction = tst_hitsAndFractions[i].second; + bool hitWithNoCP = false; - auto score = std::min_element(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), - [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - for (auto& cpPair : cpsInMultiCluster[mclId]) { - // LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId - // << "\t CP id: \t" << cpPair.first - // << "\t score \t" << cpPair.second - // << "\n"; - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\t CP id: \t" << cpPair.first << "\t score \t" - << cpPair.second << std::endl; - if (cpPair.first == score->first) { - histograms.h_score_multicl2caloparticle[count]->Fill(score->second); + auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) + hitWithNoCP = true; + auto itcheck = hitMap.find(rh_detid); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + + for (auto& cpPair : cpsInTrackster[tstId]) { + float cpFraction = 0.f; + if (!hitWithNoCP) { + auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), + detIdToCaloParticleId_Map[rh_detid].end(), + HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first, 0.f}); + if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) { + cpFraction = findHitIt->fraction; + } } - float sharedeneCPallLayers = 0.; - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[mclId]; - sharedeneCPallLayers += cp_linked.first; - } //end of loop through layers - LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; - if (cpPair.first == score->first) { - histograms.h_sharedenergy_multicl2caloparticle[count]->Fill(sharedeneCPallLayers / - multiClusters[mclId].energy()); - histograms.h_energy_vs_score_multicl2caloparticle[count]->Fill( - score->second, sharedeneCPallLayers / multiClusters[mclId].energy()); + if (cpPair.second == FLT_MAX) { + cpPair.second = 0.f; } + cpPair.second += + (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; + } + } //end of loop through rechits of trackster + + //In case of a Trackster with some energy but none related CaloParticles print some info. + if (cpsInTrackster[tstId].empty()) + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\tCP id:\t-1 " + << "\t score \t-1" + << "\n"; + + const auto score = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); + for (auto& cpPair : cpsInTrackster[tstId]) { + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" + << cpPair.second << std::endl; + float sharedeneCPallLayers = 0.; + for (unsigned int j = 0; j < layers * 2; ++j) { + auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; + sharedeneCPallLayers += cp_linked.first; + } + LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; + if (cpPair.first == score->first) { + histograms.h_score_trackster2caloparticle[count]->Fill(score->second); + histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / + tracksters[tstId].raw_energy()); + histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( + score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); } - auto assocFakeMerge = std::count_if(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), - [](const auto& obj) { return obj.second < ScoreCutMCLtoCPFakeMerge_; }); - tracksters_fakemerge[mclId] = assocFakeMerge; } - } //end of loop through multiclusters + auto assocFakeMerge = std::count_if(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); + tracksters_fakemerge[tstId] = assocFakeMerge; + } //end of loop through Tracksters std::unordered_map<int, std::vector<float>> score3d; - std::unordered_map<int, std::vector<float>> mclsharedenergy; - std::unordered_map<int, std::vector<float>> mclsharedenergyfrac; + std::unordered_map<int, std::vector<float>> tstSharedEnergy; + std::unordered_map<int, std::vector<float>> tstSharedEnergyFrac; for (unsigned int i = 0; i < nCaloParticles; ++i) { auto cpIndex = cPIndices[i]; - score3d[cpIndex].resize(nMultiClusters); - mclsharedenergy[cpIndex].resize(nMultiClusters); - mclsharedenergyfrac[cpIndex].resize(nMultiClusters); - for (unsigned int j = 0; j < nMultiClusters; ++j) { + score3d[cpIndex].resize(nTracksters); + tstSharedEnergy[cpIndex].resize(nTracksters); + tstSharedEnergyFrac[cpIndex].resize(nTracksters); + for (unsigned int j = 0; j < nTracksters; ++j) { score3d[cpIndex][j] = FLT_MAX; - mclsharedenergy[cpIndex][j] = 0.f; - mclsharedenergyfrac[cpIndex][j] = 0.f; + tstSharedEnergy[cpIndex][j] = 0.f; + tstSharedEnergyFrac[cpIndex][j] = 0.f; } } @@ -2684,86 +2676,86 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist // gen-level, namely efficiency an duplicate. In this loop we should restrict // only to the selected caloParaticles. for (const auto& cpId : cPSelectedIndices) { - //We need to keep the multiclusters ids that are related to + //We need to keep the Tracksters ids that are related to //CaloParticle under study for the final filling of the score. - std::vector<unsigned int> cpId_mclId_related; - cpId_mclId_related.clear(); + std::vector<unsigned int> cpId_tstId_related; + cpId_tstId_related.clear(); float CPenergy = 0.f; for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) { unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size(); - //Below gives the CP energy related to multicluster per layer. + //Below gives the CP energy related to Trackster per layer. CPenergy += cPOnLayer[cpId][layerId].energy; if (CPNumberOfHits == 0) continue; - int mclWithMaxEnergyInCP = -1; - //This is the maximum energy related to multicluster per layer. - float maxEnergyMCLperlayerinCP = 0.f; - float CPEnergyFractionInMCLperlayer = 0.f; - //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the multicluster id. - for (const auto& mcl : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - if (mcl.second.first > maxEnergyMCLperlayerinCP) { - maxEnergyMCLperlayerinCP = mcl.second.first; - mclWithMaxEnergyInCP = mcl.first; + int tstWithMaxEnergyInCP = -1; + //This is the maximum energy related to Trackster per layer. + float maxEnergyTSTperlayerinCP = 0.f; + float CPEnergyFractionInTSTperlayer = 0.f; + //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the Trackster id. + for (const auto& tst : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { + if (tst.second.first > maxEnergyTSTperlayerinCP) { + maxEnergyTSTperlayerinCP = tst.second.first; + tstWithMaxEnergyInCP = tst.first; } } if (CPenergy > 0.f) - CPEnergyFractionInMCLperlayer = maxEnergyMCLperlayerinCP / CPenergy; + CPEnergyFractionInTSTperlayer = maxEnergyTSTperlayerinCP / CPenergy; LogDebug("HGCalValidator") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) - << "CPNhitsOnLayer\t" << std::setw(18) << "mclWithMaxEnergyInCP\t" << std::setw(15) - << "maxEnergyMCLinCP\t" << std::setw(20) << "CPEnergyFractionInMCL" + << "CPNhitsOnLayer\t" << std::setw(18) << "tstWithMaxEnergyInCP\t" << std::setw(15) + << "maxEnergyTSTinCP\t" << std::setw(20) << "CPEnergyFractionInTST" << "\n"; LogDebug("HGCalValidator") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) << cP[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) - << CPNumberOfHits << "\t" << std::setw(18) << mclWithMaxEnergyInCP << "\t" - << std::setw(15) << maxEnergyMCLperlayerinCP << "\t" << std::setw(20) - << CPEnergyFractionInMCLperlayer << "\n"; + << CPNumberOfHits << "\t" << std::setw(18) << tstWithMaxEnergyInCP << "\t" + << std::setw(15) << maxEnergyTSTperlayerinCP << "\t" << std::setw(20) + << CPEnergyFractionInTSTperlayer << "\n"; for (unsigned int i = 0; i < CPNumberOfHits; ++i) { auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first; auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second; - bool hitWithNoMCL = false; + bool hitWithNoTST = false; if (cpFraction == 0.f) continue; //hopefully this should never happen - auto hit_find_in_MCL = detIdToMultiClusterId_Map.find(cp_hitDetId); - if (hit_find_in_MCL == detIdToMultiClusterId_Map.end()) - hitWithNoMCL = true; + auto hit_find_in_TST = detIdToTracksterId_Map.find(cp_hitDetId); + if (hit_find_in_TST == detIdToTracksterId_Map.end()) + hitWithNoTST = true; auto itcheck = hitMap.find(cp_hitDetId); const HGCRecHit* hit = itcheck->second; float hitEnergyWeight = hit->energy() * hit->energy(); for (auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - unsigned int multiClusterId = lcPair.first; - if (std::find(std::begin(cpId_mclId_related), std::end(cpId_mclId_related), multiClusterId) == - std::end(cpId_mclId_related)) { - cpId_mclId_related.push_back(multiClusterId); + unsigned int tracksterId = lcPair.first; + if (std::find(std::begin(cpId_tstId_related), std::end(cpId_tstId_related), tracksterId) == + std::end(cpId_tstId_related)) { + cpId_tstId_related.push_back(tracksterId); } - float mclFraction = 0.f; - - if (!hitWithNoMCL) { - auto findHitIt = std::find(detIdToMultiClusterId_Map[cp_hitDetId].begin(), - detIdToMultiClusterId_Map[cp_hitDetId].end(), - HGVHistoProducerAlgo::detIdInfoInMultiCluster{multiClusterId, 0, 0.f}); - if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].end()) - mclFraction = findHitIt->fraction; + float tstFraction = 0.f; + + if (!hitWithNoTST) { + auto findHitIt = std::find(detIdToTracksterId_Map[cp_hitDetId].begin(), + detIdToTracksterId_Map[cp_hitDetId].end(), + HGVHistoProducerAlgo::detIdInfoInTrackster{tracksterId, 0, 0.f}); + if (findHitIt != detIdToTracksterId_Map[cp_hitDetId].end()) + tstFraction = findHitIt->fraction; } //Observe here that we do not divide as before by the layer cluster energy weight. We should sum first //over all layers and divide with the total CP energy over all layers. if (lcPair.second.second == FLT_MAX) { lcPair.second.second = 0.f; } - lcPair.second.second += (mclFraction - cpFraction) * (mclFraction - cpFraction) * hitEnergyWeight; - LogDebug("HGCalValidator") << "multiClusterId:\t" << multiClusterId << "\t" - << "mclfraction,cpfraction:\t" << mclFraction << ", " << cpFraction << "\t" + lcPair.second.second += (tstFraction - cpFraction) * (tstFraction - cpFraction) * hitEnergyWeight; + LogDebug("HGCalValidator") << "TracksterId:\t" << tracksterId << "\t" + << "tstfraction,cpfraction:\t" << tstFraction << ", " << cpFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" << "currect score numerator:\t" << lcPair.second.second << "\n"; } } //end of loop through sim hits of current calo particle if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id:\t-1 " + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id:\t-1 " << "\t layer \t " << layerId << " Sub score in \t -1" << "\n"; @@ -2773,7 +2765,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist score3d[cpId][lcPair.first] = 0.f; } score3d[cpId][lcPair.first] += lcPair.second.second; - mclsharedenergy[cpId][lcPair.first] += lcPair.second.first; + tstSharedEnergy[cpId][lcPair.first] += lcPair.second.first; } } //end of loop through layers @@ -2790,29 +2782,29 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist } invCPEnergyWeight = 1.f / invCPEnergyWeight; - //Loop through related multiclusters here + //Loop through related Tracksters here //Will switch to vector for access because it is faster - std::vector<int> cpId_mclId_related_vec(cpId_mclId_related.begin(), cpId_mclId_related.end()); - for (unsigned int i = 0; i < cpId_mclId_related_vec.size(); ++i) { - auto mclId = cpId_mclId_related_vec[i]; + std::vector<int> cpId_tstId_related_vec(cpId_tstId_related.begin(), cpId_tstId_related.end()); + for (unsigned int i = 0; i < cpId_tstId_related_vec.size(); ++i) { + auto tstId = cpId_tstId_related_vec[i]; //Now time for the denominator - score3d[cpId][mclId] = score3d[cpId][mclId] * invCPEnergyWeight; - mclsharedenergyfrac[cpId][mclId] = (mclsharedenergy[cpId][mclId] / CPenergy); + score3d[cpId][tstId] = score3d[cpId][tstId] * invCPEnergyWeight; + tstSharedEnergyFrac[cpId][tstId] = (tstSharedEnergy[cpId][tstId] / CPenergy); - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id: \t" << mclId << "\t score \t" // - << score3d[cpId][mclId] << "\t" + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id: \t" << tstId << "\t score \t" // + << score3d[cpId][tstId] << "\t" << "invCPEnergyWeight \t" << invCPEnergyWeight << "\t" - << "shared energy:\t" << mclsharedenergy[cpId][mclId] << "\t" - << "shared energy fraction:\t" << mclsharedenergyfrac[cpId][mclId] << "\n"; + << "shared energy:\t" << tstSharedEnergy[cpId][tstId] << "\t" + << "shared energy fraction:\t" << tstSharedEnergyFrac[cpId][tstId] << "\n"; - histograms.h_score_caloparticle2multicl[count]->Fill(score3d[cpId][mclId]); + histograms.h_score_caloparticle2trackster[count]->Fill(score3d[cpId][tstId]); - histograms.h_sharedenergy_caloparticle2multicl[count]->Fill(mclsharedenergyfrac[cpId][mclId]); - histograms.h_energy_vs_score_caloparticle2multicl[count]->Fill(score3d[cpId][mclId], - mclsharedenergyfrac[cpId][mclId]); - } //end of loop through multiclusters + histograms.h_sharedenergy_caloparticle2trackster[count]->Fill(tstSharedEnergyFrac[cpId][tstId]); + histograms.h_energy_vs_score_caloparticle2trackster[count]->Fill(score3d[cpId][tstId], + tstSharedEnergyFrac[cpId][tstId]); + } //end of loop through Tracksters - auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoMCLEffDup_; }; + auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoTSTEffDup_; }; auto assocDup = std::count_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); @@ -2820,13 +2812,13 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist histograms.h_num_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); histograms.h_num_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); auto best = std::min_element(std::begin(score3d[cpId]), std::end(score3d[cpId])); - auto bestmclId = std::distance(std::begin(score3d[cpId]), best); + auto bestTstId = std::distance(std::begin(score3d[cpId]), best); - histograms.h_sharedenergy_caloparticle2multicl_vs_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta(), - multiClusters[bestmclId].energy() / CPenergy); - histograms.h_sharedenergy_caloparticle2multicl_vs_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi(), - multiClusters[bestmclId].energy() / CPenergy); - histograms.h_sharedenergy_caloparticle2multicl_assoc[count]->Fill(mclsharedenergyfrac[cpId][bestmclId]); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta[count]->Fill( + cP[cpId].g4Tracks()[0].momentum().eta(), tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi[count]->Fill( + cP[cpId].g4Tracks()[0].momentum().phi(), tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_assoc[count]->Fill(tstSharedEnergyFrac[cpId][bestTstId]); } if (assocDup >= 2) { auto match = std::find_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); @@ -2838,233 +2830,234 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist histograms.h_denom_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); histograms.h_denom_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); - } //end of loop through caloparticles + } //end of loop through CaloParticles // Here we do fill the plots to compute the different metrics linked to // reco-level, namely fake-rate an merge-rate. In this loop we should *not* // restrict only to the selected caloParaticles. - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - auto assocFakeMerge = tracksters_fakemerge[mclId]; - auto assocDuplicate = tracksters_duplicate[mclId]; - if (assocDuplicate) { - histograms.h_numDup_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_numDup_multicl_phi[count]->Fill(multiClusters[mclId].phi()); - } - if (assocFakeMerge > 0) { - histograms.h_num_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_num_multicl_phi[count]->Fill(multiClusters[mclId].phi()); - auto best = std::min_element(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), - [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - - //This is the shared energy taking the best caloparticle in each layer - float sharedeneCPallLayers = 0.; - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[mclId]; - sharedeneCPallLayers += best_cp_linked.first; - } //end of loop through layers - histograms.h_sharedenergy_multicl2caloparticle_vs_eta[count]->Fill( - multiClusters[mclId].eta(), sharedeneCPallLayers / multiClusters[mclId].energy()); - histograms.h_sharedenergy_multicl2caloparticle_vs_phi[count]->Fill( - multiClusters[mclId].phi(), sharedeneCPallLayers / multiClusters[mclId].energy()); - } - if (assocFakeMerge >= 2) { - histograms.h_numMerge_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_numMerge_multicl_phi[count]->Fill(multiClusters[mclId].phi()); - } - histograms.h_denom_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_denom_multicl_phi[count]->Fill(multiClusters[mclId].phi()); + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + if (tracksters[tstId].vertices().empty()) + continue; + auto assocFakeMerge = tracksters_fakemerge[tstId]; + auto assocDuplicate = tracksters_duplicate[tstId]; + if (assocDuplicate) { + histograms.h_numDup_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numDup_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + } + if (assocFakeMerge > 0) { + histograms.h_num_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_num_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + auto best = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); + + //This is the shared energy taking the best caloparticle in each layer + float sharedeneCPallLayers = 0.; + //Loop through all layers + for (unsigned int j = 0; j < layers * 2; ++j) { + auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[tstId]; + sharedeneCPallLayers += best_cp_linked.first; + } //end of loop through layers + histograms.h_sharedenergy_trackster2caloparticle_vs_eta[count]->Fill( + tracksters[tstId].barycenter().eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi[count]->Fill( + tracksters[tstId].barycenter().phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); + } + if (assocFakeMerge >= 2) { + histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } + histograms.h_denom_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_denom_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } } -void HGVHistoProducerAlgo::fill_multi_cluster_histos(const Histograms& histograms, - int count, - const std::vector<reco::HGCalMultiCluster>& multiClusters, - std::vector<CaloParticle> const& cP, - std::vector<size_t> const& cPIndices, - std::vector<size_t> const& cPSelectedIndices, - std::unordered_map<DetId, const HGCRecHit*> const& hitMap, - unsigned int layers) const { +void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, + int count, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector<CaloParticle> const& cP, + std::vector<size_t> const& cPIndices, + std::vector<size_t> const& cPSelectedIndices, + std::unordered_map<DetId, const HGCRecHit*> const& hitMap, + unsigned int layers) const { //Each event to be treated as two events: //an event in +ve endcap, plus another event in -ve endcap. - //To keep track of total num of multiclusters - int tnmclmz = 0; //-z - int tnmclpz = 0; //+z - //To count the number of multiclusters with 3 contiguous layers per event. - int tncontmclpz = 0; //+z - int tncontmclmz = 0; //-z - //For the number of multiclusters without 3 contiguous layers per event. - int tnnoncontmclpz = 0; //+z - int tnnoncontmclmz = 0; //-z - //We want to check below the score of cont and non cont multiclusters - std::vector<bool> contmulti; - contmulti.clear(); - - //[mclId]-> vector of 2d layer clusters size + //To keep track of total num of Tracksters + int totNTstZm = 0; //-z + int totNTstZp = 0; //+z + //To count the number of Tracksters with 3 contiguous layers per event. + int totNContTstZp = 0; //+z + int totNContTstZm = 0; //-z + //For the number of Tracksters without 3 contiguous layers per event. + int totNNotContTstZp = 0; //+z + int totNNotContTstZm = 0; //-z + //We want to check below the score of cont and non cont Tracksters + std::vector<bool> contTracksters; + contTracksters.clear(); + + //[tstId]-> vector of 2d layer clusters size std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity; - //[mclId]-> [layer][cluster size] + //[tstId]-> [layer][cluster size] std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer; //We will need for the scale text option - // unsigned int totallcinmcls = 0; - // for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - // totallcinmcls = totallcinmcls + multiClusters[mclId].clusters().size(); + // unsigned int totalLcInTsts = 0; + // for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + // totalLcInTsts = totalLcInTsts + tracksters[tstId].vertices().size(); // } - auto nMultiClusters = multiClusters.size(); - //loop through multiclusters of the event - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto layerClusters = multiClusters[mclId].clusters(); - auto nLayerClusters = layerClusters.size(); + auto nTracksters = tracksters.size(); + //loop through Tracksters of the event + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + auto nLayerClusters = tracksters[tstId].vertices().size(); if (nLayerClusters == 0) continue; - if (multiClusters[mclId].z() < 0.) { - tnmclmz++; + if (tracksters[tstId].barycenter().z() < 0.) { + totNTstZm++; } - if (multiClusters[mclId].z() > 0.) { - tnmclpz++; + if (tracksters[tstId].barycenter().z() > 0.) { + totNTstZp++; } - //Total number of layer clusters in multicluster - int tnlcinmcl = 0; + //Total number of layer clusters in Trackster + int tnLcInTst = 0; - //To keep track of total num of layer clusters per multicluster - //tnlcinmclperlaypz[layerid], tnlcinmclperlaymz[layerid] - std::vector<int> tnlcinmclperlay(1000, 0); //+z + //To keep track of total num of layer clusters per Trackster + //tnLcInTstperlaypz[layerid], tnLcInTstperlaymz[layerid] + std::vector<int> tnLcInTstperlay(1000, 0); //+z - //For the layers the multicluster expands to. Will use a set because there would be many + //For the layers the Trackster expands to. Will use a set because there would be many //duplicates and then go back to vector for random access, since they say it is faster. - std::set<int> multicluster_layers; + std::set<int> trackster_layers; - bool multiclusterInZplus = false; - bool multiclusterInZminus = false; + bool tracksterInZplus = false; + bool tracksterInZminus = false; //Loop through layer clusters - for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) { + for (const auto lcId : tracksters[tstId].vertices()) { //take the hits and their fraction of the specific layer cluster. - const std::vector<std::pair<DetId, float>>& hits_and_fractions = layerClusters[lcId]->hitsAndFractions(); + const std::vector<std::pair<DetId, float>>& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - //For the multiplicity of the 2d layer clusters in multiclusters - multiplicity[mclId].emplace_back(hits_and_fractions.size()); + //For the multiplicity of the 2d layer clusters in Tracksters + multiplicity[tstId].emplace_back(hits_and_fractions.size()); const auto firstHitDetId = hits_and_fractions[0].first; //The layer that the layer cluster belongs to int layerid = recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; - multicluster_layers.insert(layerid); - multiplicity_vs_layer[mclId].emplace_back(layerid); + trackster_layers.insert(layerid); + multiplicity_vs_layer[tstId].emplace_back(layerid); - tnlcinmclperlay[layerid]++; - tnlcinmcl++; + tnLcInTstperlay[layerid]++; + tnLcInTst++; if (recHitTools_->zside(firstHitDetId) > 0.) { - multiclusterInZplus = true; + tracksterInZplus = true; } if (recHitTools_->zside(firstHitDetId) < 0.) { - multiclusterInZminus = true; + tracksterInZminus = true; } - } //end of loop through layerclusters + } // end of loop through layerClusters - //Per layer : Loop 0->99 + // Per layer : Loop 0->99 for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) { - if (histograms.h_clusternum_in_multicluster_perlayer[count].count(ilayer) && tnlcinmclperlay[ilayer] != 0) { - histograms.h_clusternum_in_multicluster_perlayer[count].at(ilayer)->Fill((float)tnlcinmclperlay[ilayer]); + if (histograms.h_clusternum_in_trackster_perlayer[count].count(ilayer) && tnLcInTstperlay[ilayer] != 0) { + histograms.h_clusternum_in_trackster_perlayer[count].at(ilayer)->Fill((float)tnLcInTstperlay[ilayer]); } - //For the profile now of 2d layer cluster in multiclusters vs layer number. - if (tnlcinmclperlay[ilayer] != 0) { - histograms.h_clusternum_in_multicluster_vs_layer[count]->Fill((float)ilayer, (float)tnlcinmclperlay[ilayer]); + // For the profile now of 2d layer cluster in Tracksters vs layer number. + if (tnLcInTstperlay[ilayer] != 0) { + histograms.h_clusternum_in_trackster_vs_layer[count]->Fill((float)ilayer, (float)tnLcInTstperlay[ilayer]); } - } //end of loop over layers + } // end of loop over layers - //Looking for multiclusters with 3 contiguous layers per event. - std::vector<int> multicluster_layers_vec(multicluster_layers.begin(), multicluster_layers.end()); - //Since we want to also check for non contiguous multiclusters - bool contimulti = false; + // Looking for Tracksters with 3 contiguous layers per event. + std::vector<int> trackster_layers_vec(trackster_layers.begin(), trackster_layers.end()); + // Since we want to also check for non contiguous Tracksters + bool contiTrackster = false; //Observe that we start from 1 and go up to size - 1 element. - if (multicluster_layers_vec.size() >= 3) { - for (unsigned int i = 1; i < multicluster_layers_vec.size() - 1; ++i) { - if ((multicluster_layers_vec[i - 1] + 1 == multicluster_layers_vec[i]) && - (multicluster_layers_vec[i + 1] - 1 == multicluster_layers_vec[i])) { - //So, this is a multicluster with 3 contiguous layers per event - if (multiclusterInZplus) { - tncontmclpz++; + if (trackster_layers_vec.size() >= 3) { + for (unsigned int i = 1; i < trackster_layers_vec.size() - 1; ++i) { + if ((trackster_layers_vec[i - 1] + 1 == trackster_layers_vec[i]) && + (trackster_layers_vec[i + 1] - 1 == trackster_layers_vec[i])) { + //So, this is a Trackster with 3 contiguous layers per event + if (tracksterInZplus) { + totNContTstZp++; } - if (multiclusterInZminus) { - tncontmclmz++; + if (tracksterInZminus) { + totNContTstZm++; } - contimulti = true; + contiTrackster = true; break; } } } - //Count non contiguous multiclusters - if (!contimulti) { - if (multiclusterInZplus) { - tnnoncontmclpz++; + // Count non contiguous Tracksters + if (!contiTrackster) { + if (tracksterInZplus) { + totNNotContTstZp++; } - if (multiclusterInZminus) { - tnnoncontmclmz++; + if (tracksterInZminus) { + totNNotContTstZm++; } } - //Save for the score - contmulti.push_back(contimulti); + // Save for the score + contTracksters.push_back(contiTrackster); - histograms.h_clusternum_in_multicluster[count]->Fill(tnlcinmcl); + histograms.h_clusternum_in_trackster[count]->Fill(tnLcInTst); - for (unsigned int lc = 0; lc < multiplicity[mclId].size(); ++lc) { + for (unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) { //multiplicity of the current LC - float mlp = std::count(std::begin(multiplicity[mclId]), std::end(multiplicity[mclId]), multiplicity[mclId][lc]); + float mlp = std::count(std::begin(multiplicity[tstId]), std::end(multiplicity[tstId]), multiplicity[tstId][lc]); //LogDebug("HGCalValidator") << "mlp %" << (100. * mlp)/ ((float) nLayerClusters) << std::endl; - // histograms.h_multiplicityOfLCinMCL[count]->Fill( mlp , multiplicity[mclId][lc] , 100. / (float) totallcinmcls ); - histograms.h_multiplicityOfLCinMCL[count]->Fill(mlp, multiplicity[mclId][lc]); + // histograms.h_multiplicityOfLCinTST[count]->Fill( mlp , multiplicity[tstId][lc] , 100. / (float) totalLcInTsts ); + histograms.h_multiplicityOfLCinTST[count]->Fill(mlp, multiplicity[tstId][lc]); //When we will plot with the text option we want the entries to be the same - //as the % of the current cell over the whole number of clusters. For this we need an extra histo. + //as the % of the current cell over the whole number of layerClusters. For this we need an extra histo. histograms.h_multiplicity_numberOfEventsHistogram[count]->Fill(mlp); //For the cluster multiplicity vs layer //First with the -z endcap (V10:0->49) - if (multiplicity_vs_layer[mclId][lc] < layers) { - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus[count]->Fill(mlp, multiplicity_vs_layer[mclId][lc]); + if (multiplicity_vs_layer[tstId][lc] < layers) { + histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus[count]->Fill(mlp, multiplicity_vs_layer[tstId][lc]); histograms.h_multiplicity_zminus_numberOfEventsHistogram[count]->Fill(mlp); } else { //Then for the +z (V10:50->99) - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus[count]->Fill( - mlp, multiplicity_vs_layer[mclId][lc] - layers); + histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus[count]->Fill( + mlp, multiplicity_vs_layer[tstId][lc] - layers); histograms.h_multiplicity_zplus_numberOfEventsHistogram[count]->Fill(mlp); } //For the cluster multiplicity vs cluster energy - histograms.h_multiplicityOfLCinMCL_vs_layerclusterenergy[count]->Fill(mlp, layerClusters[lc]->energy()); + histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[count]->Fill( + mlp, layerClusters[tracksters[tstId].vertices(lc)].energy()); } - if (!multicluster_layers.empty()) { - histograms.h_multicluster_x[count]->Fill(multiClusters[mclId].x()); - histograms.h_multicluster_y[count]->Fill(multiClusters[mclId].y()); - histograms.h_multicluster_z[count]->Fill(multiClusters[mclId].z()); - histograms.h_multicluster_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_multicluster_phi[count]->Fill(multiClusters[mclId].phi()); + if (!trackster_layers.empty()) { + histograms.h_trackster_x[count]->Fill(tracksters[tstId].barycenter().x()); + histograms.h_trackster_y[count]->Fill(tracksters[tstId].barycenter().y()); + histograms.h_trackster_z[count]->Fill(tracksters[tstId].barycenter().z()); + histograms.h_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - histograms.h_multicluster_firstlayer[count]->Fill((float)*multicluster_layers.begin()); - histograms.h_multicluster_lastlayer[count]->Fill((float)*multicluster_layers.rbegin()); - histograms.h_multicluster_layersnum[count]->Fill((float)multicluster_layers.size()); + histograms.h_trackster_firstlayer[count]->Fill((float)*trackster_layers.begin()); + histograms.h_trackster_lastlayer[count]->Fill((float)*trackster_layers.rbegin()); + histograms.h_trackster_layersnum[count]->Fill((float)trackster_layers.size()); - histograms.h_multicluster_pt[count]->Fill(multiClusters[mclId].pt()); + histograms.h_trackster_pt[count]->Fill(tracksters[tstId].raw_pt()); - histograms.h_multicluster_energy[count]->Fill(multiClusters[mclId].energy()); + histograms.h_trackster_energy[count]->Fill(tracksters[tstId].raw_energy()); } - } //end of loop through multiclusters + } //end of loop through Tracksters - histograms.h_multiclusternum[count]->Fill(tnmclmz + tnmclpz); - histograms.h_contmulticlusternum[count]->Fill(tncontmclpz + tncontmclmz); - histograms.h_noncontmulticlusternum[count]->Fill(tnnoncontmclpz + tnnoncontmclmz); + histograms.h_tracksternum[count]->Fill(totNTstZm + totNTstZp); + histograms.h_conttracksternum[count]->Fill(totNContTstZp + totNContTstZm); + histograms.h_nonconttracksternum[count]->Fill(totNNotContTstZp + totNNotContTstZm); - multiClusters_to_CaloParticles(histograms, count, multiClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); + tracksters_to_CaloParticles( + histograms, count, tracksters, layerClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); } double HGVHistoProducerAlgo::distance2(const double x1, diff --git a/Validation/HGCalValidation/test/HGCGeometryCheck.cc b/Validation/HGCalValidation/test/HGCGeometryCheck.cc index 96c2cd3a25bb4..2070cdf6ac662 100644 --- a/Validation/HGCalValidation/test/HGCGeometryCheck.cc +++ b/Validation/HGCalValidation/test/HGCGeometryCheck.cc @@ -9,10 +9,7 @@ #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" @@ -26,7 +23,6 @@ #include "FWCore/Utilities/interface/EDGetToken.h" #include "SimDataFormats/ValidationFormats/interface/PHGCalValidInfo.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include <TH2.h> @@ -50,12 +46,10 @@ class HGCGeometryCheck : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o private: edm::EDGetTokenT<PHGCalValidInfo> g4Token_; std::vector<std::string> geometrySource_; - edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> tok_hrndc_; std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> > tok_hgcGeom_; //HGCal geometry scheme std::vector<const HGCalDDDConstants *> hgcGeometry_; - const HcalDDDSimConstants *hcons_; //histogram related stuff TH2F *heedzVsZ, *hefdzVsZ, *hebdzVsZ; @@ -65,19 +59,14 @@ class HGCGeometryCheck : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o static constexpr double mmTocm_ = 0.1; }; -HGCGeometryCheck::HGCGeometryCheck(const edm::ParameterSet &cfg) : hcons_(nullptr) { +HGCGeometryCheck::HGCGeometryCheck(const edm::ParameterSet &cfg) { usesResource(TFileService::kSharedResource); g4Token_ = consumes<PHGCalValidInfo>(cfg.getParameter<edm::InputTag>("g4Source")); geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string> >("geometrySource"); - tok_hrndc_ = esConsumes<HcalDDDSimConstants, HcalSimNumberingRecord, edm::Transition::BeginRun>(); for (const auto &name : geometrySource_) { - if (name == "HCAL") - tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})); - else - tok_hgcGeom_.emplace_back( - esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_hgcGeom_.emplace_back( + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); } edm::LogVerbatim("HGCalValid") << "HGCGeometryCheck:: use information from " @@ -116,23 +105,12 @@ void HGCGeometryCheck::beginJob() { void HGCGeometryCheck::beginRun(const edm::Run &, const edm::EventSetup &iSetup) { //initiating hgc geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::ESHandle<HcalDDDSimConstants> pHRNDC = iSetup.getHandle(tok_hrndc_); - if (pHRNDC.isValid()) { - hcons_ = &(*pHRNDC); - hgcGeometry_.push_back(nullptr); - edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i]; - } + edm::ESHandle<HGCalDDDConstants> hgcGeom = iSetup.getHandle(tok_hgcGeom_[i]); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; } else { - edm::ESHandle<HGCalDDDConstants> hgcGeom = iSetup.getHandle(tok_hgcGeom_[i]); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i]; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i]; } } } @@ -199,26 +177,8 @@ void HGCGeometryCheck::analyze(const edm::Event &iEvent, const edm::EventSetup & hebzVsLayer->Fill(layer, zz); hebrVsLayer->Fill(layer, rr); } - - } else if (hitDet.at(i) == (unsigned int)(DetId::Hcal)) { - int subdet, zside, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(hitIdx.at(i), subdet, zside, depth, eta, phi, lay); - HcalCellType::HcalCell cell = hcons_->cell(subdet, zside, lay, eta, phi); - double zp = cell.rz / 10; //mm --> cm - if (zside == 0) - zp = -zp; -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalValid") << "Info[" << i << "] Detector Information " << hitDet[i] << ":" << subdet << ":" - << zside << ":" << depth << ":" << eta << ":" << phi << ":" << lay << " z " << zp - << ":" << zz << " R " << rr; -#endif - hebdzVsZ->Fill(zp, (zz - zp)); - hebzVsLayer->Fill(lay, zz); - hebrVsLayer->Fill(lay, rr); } - } //end G4 hits - } else { edm::LogWarning("HGCalValid") << "No PHGCalInfo " << std::endl; } diff --git a/Validation/HGCalValidation/test/HGCHitValidation.cc b/Validation/HGCalValidation/test/HGCHitValidation.cc index 3a5793a28dd38..d7633c7e80401 100644 --- a/Validation/HGCalValidation/test/HGCHitValidation.cc +++ b/Validation/HGCalValidation/test/HGCHitValidation.cc @@ -20,21 +20,11 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" @@ -56,7 +46,6 @@ #include "SimG4CMS/Calo/interface/HGCNumberingScheme.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include <TH1.h> @@ -99,12 +88,9 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o //HGC Geometry std::vector<const HGCalDDDConstants *> hgcCons_; std::vector<const HGCalGeometry *> hgcGeometry_; - const HcalDDDSimConstants *hcCons_; - const HcalDDDRecConstants *hcConr_; - const CaloSubdetectorGeometry *hcGeometry_; std::vector<std::string> geometrySource_; std::vector<int> ietaExcludeBH_; - bool ifHCAL_, ifHcalG_, makeTree_; + bool makeTree_; edm::InputTag eeSimHitSource, fhSimHitSource, bhSimHitSource; edm::EDGetTokenT<std::vector<PCaloHit>> eeSimHitToken_; @@ -113,10 +99,6 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o edm::EDGetTokenT<HGCeeRecHitCollection> eeRecHitToken_; edm::EDGetTokenT<HGChefRecHitCollection> fhRecHitToken_; edm::EDGetTokenT<HGChebRecHitCollection> bhRecHitTokeng_; - edm::EDGetTokenT<HBHERecHitCollection> bhRecHitTokenh_; - edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> tok_hcals_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcalr_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloG_; std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>> tok_hgcal_; std::vector<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>> tok_hgcalg_; @@ -141,8 +123,7 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o TH1F *hefEnSim_, *heeEnRec_, *heeEnSim_; }; -HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) - : hcCons_(nullptr), hcConr_(nullptr), hcGeometry_(nullptr), ifHcalG_(false) { +HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) { usesResource(TFileService::kSharedResource); geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string>>("geometrySource"); @@ -160,26 +141,12 @@ HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) eeRecHitToken_ = consumes<HGCeeRecHitCollection>(eeRecHitSource); fhRecHitToken_ = consumes<HGChefRecHitCollection>(fhRecHitSource); ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); - ifHCAL_ = cfg.getParameter<bool>("ifHCAL"); - if (ifHCAL_) - bhRecHitTokenh_ = consumes<HBHERecHitCollection>(bhRecHitSource); - else - bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(bhRecHitSource); - tok_hcals_ = esConsumes<HcalDDDSimConstants, HcalSimNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); - tok_hcalr_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); - tok_caloG_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); + bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(bhRecHitSource); for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - tok_hgcal_.emplace_back( - esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{})); - tok_hgcalg_.emplace_back( - esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{})); - } else { - tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", geometrySource_[i]})); - tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", geometrySource_[i]})); - } + tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( + edm::ESInputTag{"", geometrySource_[i]})); + tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>( + edm::ESInputTag{"", geometrySource_[i]})); } makeTree_ = cfg.getUntrackedParameter<bool>("makeTree", true); @@ -203,7 +170,7 @@ HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) hefEnSim_ = heeEnRec_ = heeEnSim_ = nullptr; edm::LogVerbatim("HGCalValid") << "MakeTree Flag set to " << makeTree_ << " and use " << geometrySource_.size() - << " Geometry sources and HCAL flag " << ifHCAL_; + << " Geometry sources"; for (auto const &s : geometrySource_) edm::LogVerbatim("HGCalValid") << " " << s; edm::LogVerbatim("HGCalValid") << "SimHit labels: " << eeSimHitSource << " " << fhSimHitSource << " " @@ -228,7 +195,6 @@ void HGCHitValidation::fillDescriptions(edm::ConfigurationDescriptions &descript desc.add<edm::InputTag>("fhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEFRecHits")); desc.add<edm::InputTag>("bhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEBRecHits")); desc.add<std::vector<int>>("ietaExcludeBH", etas); - desc.add<bool>("ifHCAL", false); descriptions.add("hgcHitAnalysis", desc); } @@ -304,46 +270,18 @@ void HGCHitValidation::beginJob() { void HGCHitValidation::beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::LogVerbatim("HGCalValid") << "Tries to initialize HcalGeometry " - << " and HcalDDDSimConstants for " << i; - ifHcalG_ = true; - edm::ESHandle<HcalDDDSimConstants> pHSNDC = iSetup.getHandle(tok_hcals_); - if (pHSNDC.isValid()) { - hcCons_ = pHSNDC.product(); - hgcCons_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HcalDDDRecConstants> pHRNDC = iSetup.getHandle(tok_hcalr_); - if (pHRNDC.isValid()) { - hcConr_ = pHRNDC.product(); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<CaloGeometry> caloG = iSetup.getHandle(tok_caloG_); - if (caloG.isValid()) { - const CaloGeometry *geo = caloG.product(); - hcGeometry_ = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - hgcGeometry_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogVerbatim("HGCalValid") << "Tries to initialize HGCalGeometry and HGCalDDDConstants for " << i; + edm::ESHandle<HGCalDDDConstants> hgcCons = iSetup.getHandle(tok_hgcal_[i]); + if (hgcCons.isValid()) { + hgcCons_.push_back(hgcCons.product()); } else { - edm::LogVerbatim("HGCalValid") << "Tries to initialize HGCalGeometry " - << " and HGCalDDDConstants for " << i; - edm::ESHandle<HGCalDDDConstants> hgcCons = iSetup.getHandle(tok_hgcal_[i]); - if (hgcCons.isValid()) { - hgcCons_.push_back(hgcCons.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HGCalGeometry> hgcGeom = iSetup.getHandle(tok_hgcalg_[i]); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; + } + edm::ESHandle<HGCalGeometry> hgcGeom = iSetup.getHandle(tok_hgcalg_[i]); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + } else { + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; } } } @@ -388,44 +326,12 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & edm::Handle<std::vector<PCaloHit>> bhSimHits; iEvent.getByToken(bhSimHitToken_, bhSimHits); if (bhSimHits.isValid()) { - if (ifHcalG_) { - for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin(); simHit != bhSimHits->end(); ++simHit) { - int subdet, z, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay); - - if (subdet == static_cast<int>(HcalEndcap)) { - HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi); - double zp = cell.rz / 10; - - HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet, eta, phi, lay, depth); - int sign = (z == 0) ? (-1) : (1); - zp *= sign; - HcalDetId id = HcalDetId(HcalEndcap, sign * idx.eta, idx.phi, idx.depth); - - float energy = simHit->energy(); - float energySum(0); - if (bhHitRefs.count(id.rawId()) != 0) - energySum = std::get<0>(bhHitRefs[id.rawId()]); - energySum += energy; - if (!makeTree_) - hebEnSim_->Fill(energy); - if (std::find(ietaExcludeBH_.begin(), ietaExcludeBH_.end(), idx.eta) == ietaExcludeBH_.end()) { - bhHitRefs[id.rawId()] = std::make_tuple(energySum, cell.eta, cell.phi, zp); - edm::LogVerbatim("HGCalValid") << "Accept " << id << std::endl; - } else { - edm::LogVerbatim("HGCalValid") << "Rejected cell " << idx.eta << "," << id << std::endl; - } - } - } - } else { - analyzeHGCalSimHit(bhSimHits, 2, hebEnSim_, bhHitRefs); - } + analyzeHGCalSimHit(bhSimHits, 2, hebEnSim_, bhHitRefs); for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) { int idx = std::distance(bhHitRefs.begin(), itr); edm::LogVerbatim("HGCalValid") << "BHHit[" << idx << "] " << std::hex << itr->first << std::dec << "; Energy " - << std::get<0>(itr->second) << "; Position" - << " (" << std::get<1>(itr->second) << ", " << std::get<2>(itr->second) << ", " - << std::get<3>(itr->second) << ")"; + << std::get<0>(itr->second) << "; Position (" << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ")"; } } else { edm::LogWarning("HGCalValid") << "No BH SimHit Found " << std::endl; @@ -514,24 +420,13 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & } //accessing BH Rechit information - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokenh_, bhRecHit); - if (bhRecHit.isValid()) { - const HBHERecHitCollection *theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; - } + edm::Handle<HGChebRecHitCollection> bhRecHit; + iEvent.getByToken(bhRecHitTokeng_, bhRecHit); + if (bhRecHit.isValid()) { + const HGChebRecHitCollection *theHits = (bhRecHit.product()); + analyzeHGCalRecHit(theHits, bhHitRefs); } else { - edm::Handle<HGChebRecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokeng_, bhRecHit); - if (bhRecHit.isValid()) { - const HGChebRecHitCollection *theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; - } + edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; } if (makeTree_) { @@ -646,48 +541,45 @@ template <class T1> void HGCHitValidation::analyzeHGCalRecHit(T1 const &theHits, std::map<unsigned int, HGCHitTuple> const &hitRefs) { for (auto it = theHits->begin(); it != theHits->end(); ++it) { DetId id = it->id(); - bool ok = (ifHCAL_) ? (id.subdetId() == (int)(HcalEndcap)) : true; - if (ok) { - double energy = it->energy(); - if (!makeTree_) - hebEnRec_->Fill(energy); - GlobalPoint xyz = (ifHcalG_ ? (hcGeometry_->getGeometry(id)->getPosition()) : (hgcGeometry_[2]->getPosition(id))); - - std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId()); - if (itr != hitRefs.end()) { - float ang3 = xyz.phi().value(); // returns the phi in radians - double fac = sinh(std::get<1>(itr->second)); - double pT = std::get<3>(itr->second) / fac; - double xp = pT * cos(std::get<2>(itr->second)); - double yp = pT * sin(std::get<2>(itr->second)); - if (makeTree_) { - hebRecX_->push_back(xyz.x()); - hebRecY_->push_back(xyz.y()); - hebRecZ_->push_back(xyz.z()); - hebRecEnergy_->push_back(energy); - hebSimX_->push_back(xp); - hebSimY_->push_back(yp); - hebSimZ_->push_back(std::get<3>(itr->second)); - hebSimEnergy_->push_back(std::get<0>(itr->second)); - hebSimEta_->push_back(std::get<1>(itr->second)); - hebRecEta_->push_back(xyz.eta()); - hebSimPhi_->push_back(std::get<2>(itr->second)); - hebRecPhi_->push_back(ang3); - hebDetID_->push_back(itr->first); - } else { - hebRecVsSimX_->Fill(xp, xyz.x()); - hebRecVsSimY_->Fill(yp, xyz.y()); - hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); - hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); - hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); - hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); - hebEnSimRec_->Fill(std::get<0>(itr->second), energy); - } - edm::LogVerbatim("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" - << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " - << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" - << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; + double energy = it->energy(); + if (!makeTree_) + hebEnRec_->Fill(energy); + GlobalPoint xyz = hgcGeometry_[2]->getPosition(id); + + std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId()); + if (itr != hitRefs.end()) { + float ang3 = xyz.phi().value(); // returns the phi in radians + double fac = sinh(std::get<1>(itr->second)); + double pT = std::get<3>(itr->second) / fac; + double xp = pT * cos(std::get<2>(itr->second)); + double yp = pT * sin(std::get<2>(itr->second)); + if (makeTree_) { + hebRecX_->push_back(xyz.x()); + hebRecY_->push_back(xyz.y()); + hebRecZ_->push_back(xyz.z()); + hebRecEnergy_->push_back(energy); + hebSimX_->push_back(xp); + hebSimY_->push_back(yp); + hebSimZ_->push_back(std::get<3>(itr->second)); + hebSimEnergy_->push_back(std::get<0>(itr->second)); + hebSimEta_->push_back(std::get<1>(itr->second)); + hebRecEta_->push_back(xyz.eta()); + hebSimPhi_->push_back(std::get<2>(itr->second)); + hebRecPhi_->push_back(ang3); + hebDetID_->push_back(itr->first); + } else { + hebRecVsSimX_->Fill(xp, xyz.x()); + hebRecVsSimY_->Fill(yp, xyz.y()); + hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); + hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); + hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); + hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); + hebEnSimRec_->Fill(std::get<0>(itr->second), energy); } + edm::LogVerbatim("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" + << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" + << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; } } } diff --git a/Validation/HGCalValidation/test/HGCalDigiStudy.cc b/Validation/HGCalValidation/test/HGCalDigiStudy.cc index 4d29fd598c75a..d66feb6b01f95 100644 --- a/Validation/HGCalValidation/test/HGCalDigiStudy.cc +++ b/Validation/HGCalValidation/test/HGCalDigiStudy.cc @@ -9,23 +9,13 @@ #include "TH2D.h" #include "TH1D.h" -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" -#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/HFNoseDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" @@ -43,10 +33,6 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" @@ -81,15 +67,12 @@ class HGCalDigiStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one // ----------member data --------------------------- const std::string nameDetector_; const edm::InputTag source_; - const bool ifNose_, ifHCAL_, ifLayer_; + const bool ifNose_, ifLayer_; const int verbosity_, SampleIndx_, nbinR_, nbinZ_, nbinEta_, nLayers_; const double rmin_, rmax_, zmin_, zmax_, etamin_, etamax_; edm::EDGetToken digiSource_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloGeom_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> tok_hgcGeom_; - edm::ESGetToken<HcalDbService, HcalDbRecord> tok_cond_; const HGCalGeometry* hgcGeom_; - const HcalGeometry* hcGeom_; int layers_, layerFront_, geomType_; TH1D *h_Charge_, *h_ADC_, *h_LayZp_, *h_LayZm_; TH2D *h_RZ_, *h_EtaPhi_; @@ -101,7 +84,6 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("detectorName")), source_(iConfig.getParameter<edm::InputTag>("digiSource")), ifNose_(iConfig.getUntrackedParameter<bool>("ifNose", false)), - ifHCAL_(iConfig.getUntrackedParameter<bool>("ifHCAL", false)), ifLayer_(iConfig.getUntrackedParameter<bool>("ifLayer", false)), verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)), SampleIndx_(iConfig.getUntrackedParameter<int>("sampleIndex", 5)), @@ -114,30 +96,21 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) zmin_(iConfig.getUntrackedParameter<double>("zMin", 300.0)), zmax_(iConfig.getUntrackedParameter<double>("zMax", 600.0)), etamin_(iConfig.getUntrackedParameter<double>("etaMin", 1.0)), - etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)), - hcGeom_(nullptr) { + etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)) { usesResource(TFileService::kSharedResource); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { digiSource_ = consumes<HGCalDigiCollection>(source_); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - digiSource_ = consumes<QIE11DigiCollection>(source_); - else - digiSource_ = consumes<HGCalDigiCollection>(source_); } else { throw cms::Exception("BadHGCDigiSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\", " - << "or \"HCal\"!"; + << "\"HGCalHEScintillatorSensitive\", or \"HGCalHFNoseSensitive\",!"; } edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: request for Digi " << "collection " << source_ << " for " << nameDetector_; - tok_caloGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>(); tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); - tok_cond_ = esConsumes<HcalDbService, HcalDbRecord>(); } void HGCalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -145,7 +118,6 @@ void HGCalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add<std::string>("detectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("digiSource", edm::InputTag("simHGCalUnsuppressedDigis", "EE")); desc.addUntracked<bool>("ifNose", false); - desc.addUntracked<bool>("ifHCAL", false); desc.addUntracked<bool>("ifLayer", false); desc.addUntracked<int>("verbosity", 0); desc.addUntracked<int>("sampleIndex", 0); @@ -211,7 +183,7 @@ void HGCalDigiStudy::beginJob() { hname << "LY_" << nameDetector_; title << "Layer number for " << nameDetector_; h_Ly_ = fs->make<TH1D>(hname.str().c_str(), title.str().c_str(), 200, 0, 100); - if ((nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HCal")) { + if (nameDetector_ == "HGCalHEScintillatorSensitive") { hname.str(""); title.str(""); hname << "IR_" << nameDetector_; @@ -247,36 +219,21 @@ void HGCalDigiStudy::beginJob() { } void HGCalDigiStudy::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(tok_caloGeom_); - if (!geom.isValid()) - edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " - << "valid Geometry Object for " << nameDetector_; - hcGeom_ = static_cast<const HcalGeometry*>((geom.product())->getSubdetectorGeometry(DetId::Hcal, HcalBarrel)); - hgcGeom_ = nullptr; - layers_ = hcGeom_->topology().maxDepthHE(); - layerFront_ = 40; + edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); + if (!geom.isValid()) + edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " + << "valid Geometry Object for " << nameDetector_; + hgcGeom_ = geom.product(); + layerFront_ = hgcGeom_->topology().dddConstants().firstLayer(); + layers_ = hgcGeom_->topology().dddConstants().layers(true); + if (hgcGeom_->topology().waferHexagon8()) + geomType_ = 1; + else if (hgcGeom_->topology().tileTrapezoid()) + geomType_ = 2; + else geomType_ = 0; - } else { - edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); - if (!geom.isValid()) - edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " - << "valid Geometry Object for " << nameDetector_; - hgcGeom_ = geom.product(); - layerFront_ = 0; - layers_ = hgcGeom_->topology().dddConstants().layers(true); - if (hgcGeom_->topology().waferHexagon8()) - geomType_ = 1; - else if (hgcGeom_->topology().tileTrapezoid()) - geomType_ = 2; - else - geomType_ = 0; - if (nameDetector_ == "HGCalHFNoseSensitive") { - geomType_ = 3; - } else if (nameDetector_ != "HGCalEESensitive") { - layerFront_ = 28; - } - } + if (nameDetector_ == "HGCalHFNoseSensitive") + geomType_ = 3; edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: gets Geometry for " << nameDetector_ << " of type " << geomType_ << " with " << layers_ << " layers and front layer " << layerFront_; } @@ -296,8 +253,9 @@ void HGCalDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS ntot++; nused++; DetId detId = it.id(); - int layer = ((geomType_ == 0) ? (HGCalDetId(detId).layer()) - : (geomType_ == 1) ? HGCSiliconDetId(detId).layer() : HFNoseDetId(detId).layer()); + int layer = ((geomType_ == 0) ? (HGCalDetId(detId).layer()) + : (geomType_ == 1) ? HGCSiliconDetId(detId).layer() + : HFNoseDetId(detId).layer()); const HGCSample& hgcSample = it.sample(SampleIndx_); uint16_t adc = hgcSample.data(); double charge = adc; @@ -373,62 +331,6 @@ void HGCalDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS edm::LogVerbatim("HGCalValidation") << "DigiCollection handle " << source_ << " does not exist for " << nameDetector_ << " !!!"; } - } else if ((nameDetector_ == "HCal") && (!ifHCAL_)) { - //HGCalBH - edm::Handle<HGCalDigiCollection> theHGCBHDigiContainer; - iEvent.getByToken(digiSource_, theHGCBHDigiContainer); - if (theHGCBHDigiContainer.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHGCBHDigiContainer->size() << " element(s)"; - for (const auto& it : *(theHGCBHDigiContainer.product())) { - ntot++; - nused++; - HcalDetId detId = it.id(); - int layer = detId.depth(); - const HGCSample& hgcSample = it.sample(SampleIndx_); - uint16_t adc = hgcSample.data(); - double charge = adc; - // uint16_t gain = hgcSample.toa(); - // double charge = adc*gain; - digiValidation(detId, hcGeom_, layer, adc, charge); - } - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle " << source_ << " does not exist for " - << nameDetector_ << " !!!"; - } - } else if (nameDetector_ == "HCal") { - //HE - edm::Handle<QIE11DigiCollection> theHEDigiContainer; - iEvent.getByToken(digiSource_, theHEDigiContainer); - if (theHEDigiContainer.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theHEDigiContainer->size() << " element(s)"; - edm::ESHandle<HcalDbService> conditions = iSetup.getHandle(tok_cond_); - - for (const auto& it : *(theHEDigiContainer.product())) { - QIE11DataFrame df(it); - HcalDetId detId = (df.id()); - ntot++; - if (detId.subdet() == HcalEndcap) { - nused++; - HcalCalibrations calibrations = conditions->getHcalCalibrations(detId); - const HcalQIECoder* channelCoder = conditions->getHcalCoder(detId); - const HcalQIEShape* shape = conditions->getHcalShape(channelCoder); - HcalCoderDb coder(*channelCoder, *shape); - CaloSamples tool; - coder.adc2fC(df, tool); - int layer = detId.depth(); - uint16_t adc = (df)[SampleIndx_].adc(); - int capid = (df)[SampleIndx_].capid(); - double charge = (tool[SampleIndx_] - calibrations.pedestal(capid)); - digiValidation(detId, hcGeom_, layer, adc, charge); - } - } - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle " << source_ << " does not exist for " - << nameDetector_ << " !!!"; - } } else { edm::LogWarning("HGCalValidation") << "invalid detector name !! " << nameDetector_ << " source " << source_; } diff --git a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc index f5d0e61809b12..ea776a4c775a1 100644 --- a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc +++ b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc @@ -26,17 +26,10 @@ #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "TH1D.h" #include "TH2D.h" @@ -78,11 +71,9 @@ class HGCalRecHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o // ----------member data --------------------------- const std::string nameDetector_; edm::EDGetToken recHitSource_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcaldd_; edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcaldd_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloGeom_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> tok_hgcGeom_; - const bool ifNose_, ifHCAL_, ifLayer_; + const bool ifNose_, ifLayer_; const int verbosity_, nbinR_, nbinZ_, nbinEta_, nLayers_; const double rmin_, rmax_, zmin_, zmax_, etamin_, etamax_; unsigned int layers_; @@ -98,7 +89,6 @@ class HGCalRecHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o HGCalRecHitStudy::HGCalRecHitStudy(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("detectorName")), ifNose_(iConfig.getUntrackedParameter<bool>("ifNose", false)), - ifHCAL_(iConfig.getUntrackedParameter<bool>("ifHCAL", false)), ifLayer_(iConfig.getUntrackedParameter<bool>("ifLayer", false)), verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)), nbinR_(iConfig.getUntrackedParameter<int>("nBinR", 300)), @@ -119,25 +109,16 @@ HGCalRecHitStudy::HGCalRecHitStudy(const edm::ParameterSet& iConfig) if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { recHitSource_ = consumes<HGCRecHitCollection>(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - recHitSource_ = consumes<HBHERecHitCollection>(temp); - else - recHitSource_ = consumes<HGCRecHitCollection>(temp); } else { throw cms::Exception("BadHGCRecHitSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", or \"HCal\"!"; + << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\"!"; } edm::LogVerbatim("HGCalValidation") << "Initialize HGCalRecHitStudy for " << nameDetector_ << " with i/p tag " << temp - << " Flag " << ifHCAL_ << ":" << ifNose_ << ":" << verbosity_; - tok_hcaldd_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(); - tok_caloGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord>(); - if (nameDetector_ != "HCal") { - tok_hgcaldd_ = esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", nameDetector_}); - tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_}); - } + << " Flag " << ifNose_ << ":" << verbosity_; + tok_hgcaldd_ = + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); + tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_}); } void HGCalRecHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -145,7 +126,6 @@ void HGCalRecHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<std::string>("detectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("source", edm::InputTag("HGCalRecHit", "HGCEERecHits")); desc.addUntracked<bool>("ifNose", false); - desc.addUntracked<bool>("ifHCAL", false); desc.addUntracked<bool>("ifLayer", false); desc.addUntracked<int>("verbosity", 0); desc.addUntracked<int>("nBinR", 300); @@ -167,76 +147,32 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& bool ok(true); unsigned int ntot(0), nused(0); - if (nameDetector_ == "HCal") { - edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(tok_caloGeom_); - if (!geom.isValid()) - edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; - const CaloGeometry* geom0 = geom.product(); - - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - if (detId.subdetId() == static_cast<int>(HcalEndcap)) { - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HBHERecHitCollection Handle does not exist !!!"; - } - } else { - edm::Handle<HGCRecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HGChebRecHitCollection Handle does not exist !!!"; - } + edm::Handle<HGCRecHitCollection> hbhecoll; + iEvent.getByToken(recHitSource_, hbhecoll); + edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); + if (!geom.isValid()) + edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; + const HGCalGeometry* geom0 = geom.product(); + + edm::Handle<HGCRecHitCollection> theRecHitContainers; + iEvent.getByToken(recHitSource_, theRecHitContainers); + if (theRecHitContainers.isValid()) { + if (verbosity_ > 0) + edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; + for (const auto& it : *(theRecHitContainers.product())) { + ntot++; + nused++; + DetId detId = it.id(); + int layer = (ifNose_ ? HFNoseDetId(detId).layer() + : ((detId.det() == DetId::Forward) + ? HGCalDetId(detId).layer() + : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() + : HGCSiliconDetId(detId).layer()))); + recHitValidation(detId, layer, geom0, &it); } } else { - edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); - if (!geom.isValid()) - edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; - const HGCalGeometry* geom0 = geom.product(); - - edm::Handle<HGCRecHitCollection> theRecHitContainers; - iEvent.getByToken(recHitSource_, theRecHitContainers); - if (theRecHitContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; - for (const auto& it : *(theRecHitContainers.product())) { - ntot++; - nused++; - DetId detId = it.id(); - int layer = (ifNose_ ? HFNoseDetId(detId).layer() - : ((detId.det() == DetId::Forward) - ? HGCalDetId(detId).layer() - : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() - : HGCSiliconDetId(detId).layer()))); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HGCRecHitCollection Handle does not exist !!!"; - } + ok = false; + edm::LogWarning("HGCalValidation") << "HGCRecHitCollection Handle does not exist !!!"; } if (ok) fillHitsInfo(); @@ -311,16 +247,10 @@ void HGCalRecHitStudy::fillHitsInfo(HitsInfo& hits) { } void HGCalRecHitStudy::beginRun(edm::Run const&, edm::EventSetup const& iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle<HcalDDDRecConstants> pHRNDC = iSetup.getHandle(tok_hcaldd_); - const HcalDDDRecConstants* hcons = &(*pHRNDC); - layers_ = hcons->getMaxDepth(1); - } else { - edm::ESHandle<HGCalDDDConstants> pHGDC = iSetup.getHandle(tok_hgcaldd_); - const HGCalDDDConstants& hgcons_ = (*pHGDC); - layers_ = hgcons_.layers(true); - firstLayer_ = hgcons_.firstLayer(); - } + edm::ESHandle<HGCalDDDConstants> pHGDC = iSetup.getHandle(tok_hgcaldd_); + const HGCalDDDConstants& hgcons_ = (*pHGDC); + layers_ = hgcons_.layers(true); + firstLayer_ = hgcons_.firstLayer(); edm::LogVerbatim("HGCalValidation") << "Finds " << layers_ << " layers for " << nameDetector_; diff --git a/Validation/HGCalValidation/test/HGCalWaferStudy.cc b/Validation/HGCalValidation/test/HGCalWaferStudy.cc index 3b7fd5b8ea168..9e69155eeb0ca 100644 --- a/Validation/HGCalValidation/test/HGCalWaferStudy.cc +++ b/Validation/HGCalValidation/test/HGCalWaferStudy.cc @@ -13,7 +13,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -27,13 +26,10 @@ #include "FWCore/Utilities/interface/transform.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" diff --git a/Validation/HGCalValidation/test/MakePlots.C b/Validation/HGCalValidation/test/MakePlots.C new file mode 100644 index 0000000000000..5757032b57e7d --- /dev/null +++ b/Validation/HGCalValidation/test/MakePlots.C @@ -0,0 +1,795 @@ +//########################################################################### +// +// void noseRecHitPlots(fname, dirnm, tag, save) +// Plots histograms created by recHitStudy for the Nose detector +// void hgcalStudyPlots(fname, type, tag, dtype, save, debug) +// Plots histograms created by SimHit/Digi/RecHit Study for HGCal +// void hgcalGeomCheckPlots(fname, tag, dtype, save, debug) +// Plots histograms created by HGCGeometryCheck +// void hgcalBHValidPlots(fname, tag, dtype, save, debug) +// Plots histograms created by HGCalBHValidation +// +// where +// fanme (std::string) Input ROOT file name +// ("hfnRecHitD31tt.root" for noseRecHitPlots, +// "roots/hgcSimHitD83tt.root" studyPlots, +// "roots/hgcGeomCheckD83.root" GeomCheck, +// "roots/hgcBHValidD83.root" BHValid) +// dirnm (std::string) Directory name +// ("hfnoseRecHitStudy" for noseRecHitPlots) +// itype (int) Type: 0 SimHit; 1 Digi; 2 RecHit (0) +// tag (std::string) Name of the tag for the canvas name +// ("HFNose" for noseRecHitPlots, +// "SimHitD83" for studyPlots, +// "GeomChkD83" for GeomCheck, +// "BHValidD83" for BHValid) +// dtype (std::string) Data type added for canvas name +// ("ttbar D83" for studyPlots, +// "#mu D83" for geomCheck, BHValid) +// save (bool) Flag to save the canvas (false) +// debug (bool) Debug flag (false) +// +//########################################################################### +// +#include <TROOT.h> +#include <TChain.h> +#include <TFile.h> +#include <TH1D.h> +#include <TH2D.h> +#include <TProfile.h> +#include <TFitResult.h> +#include <TFitResultPtr.h> +#include <TStyle.h> +#include <TCanvas.h> +#include <TLegend.h> +#include <TPaveStats.h> +#include <TPaveText.h> +#include <vector> +#include <string> +#include <iomanip> +#include <iostream> +#include <fstream> + +void noseRecHitPlots(std::string fname = "hfnRecHitD31tt.root", + std::string dirnm = "hfnoseRecHitStudy", + std::string tag = "HFNose", + bool save = false) { + int nums[2] = {5, 2}; + int layers(8); + std::string name1[5] = { + "Energy_Layer", "HitOccupancy_Minus_layer", "HitOccupaancy_Plus_layer", "EtaPhi_Minus_Layer", "EtaPhi_Plus_Layer"}; + std::string name2[2] = {"EtaPhi", "RZ"}; + std::string detName = "HGCalHFNoseSensitive"; + int type1[5] = {1, 1, 1, 2, 2}; + int rebin[5] = {10, 1, 1, 1, 1}; + int type2[2] = {2, 2}; + std::string xtitl1[5] = {"Energy (GeV)", "Hits", "Hits", "#eta", "#eta"}; + std::string ytitl1[5] = {" ", " ", " ", "#phi", "#phi"}; + std::string xtitl2[2] = {"#eta", "z (cm)"}; + std::string ytitl2[2] = {"#phi", "R (cm)"}; + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + TFile *file = new TFile(fname.c_str()); + if (file) { + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirnm.c_str()); + char name[100], title[100]; + for (int i1 = 0; i1 < 2; ++i1) { + int kk = (i1 == 0) ? layers : 1; + for (int i2 = 0; i2 < nums[i1]; ++i2) { + for (int k = 0; k < kk; ++k) { + int type(0); + if (i1 == 0) { + sprintf(name, "%s_%d", name1[i2].c_str(), k + 1); + sprintf(title, "%s (Layer %d)", tag.c_str(), k + 1); + type = type1[i2]; + } else { + sprintf(name, "%s_%s", name2[i2].c_str(), detName.c_str()); + sprintf(title, "Simulation of %s", tag.c_str()); + type = type2[i2]; + } + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (type == 1) + hist1 = (TH1D *)dir->FindObjectAny(name); + else + hist2 = (TH2D *)dir->FindObjectAny(name); + if ((hist1 != nullptr) || (hist2 != nullptr)) { + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + if (type == 1) { + if (i1 == 0) { + hist1->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + hist1->Rebin(rebin[i2]); + } else { + hist1->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + pad->SetLogy(); + hist1->Draw(); + } else { + if (i1 == 0) { + hist2->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + } else { + hist2->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); + hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s%s.jpg", tag.c_str(), pad->GetName()); + pad->Print(name); + } + } + } + } + } + } +} + +void hgcalStudyPlots(std::string fname = "roots/hgcSimHitD83tt.root", + int type = 0, + std::string tag = "SimHitD83", + std::string dtype = "ttbar D83", + bool save = false, + bool debug = false) { + int ndir[3] = {1, 3, 3}; + std::string dirnm[3][3] = {{"hgcalSimHitStudy", "", ""}, + {"hgcalDigiStudyEE", "hgcalDigiStudyHEF", "hgcalDigiStudyHEB"}, + {"hgcalRecHitStudyEE", "hgcalRecHitStudyFH", "hgcalRecHitStudyBH"}}; + std::string name0[4] = {"HGCal EE", "HGCal HE Silicon", "HGCal HE Scintillator", "HGCal"}; + int nname[3] = {4, 1, 1}; + std::string name1[4] = { + "HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive", "AllDetectors"}; + int nhist[3] = {4, 2, 2}; + int nhtype[3][4] = {{1, 1, 2, 2}, {1, 2, 0, 0}, {2, 2, 0, 0}}; + int yax[3][4] = {{1, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}}; + std::string name2[3][4] = { + {"E_", "T_", "RZ_", "EtaPhi_"}, {"Charge_", "RZ_", " ", " "}, {"RZ_", "EtaPhi_", " ", " "}}; + std::string xtitl[3][4] = { + {"Energy (GeV)", "Time (ns)", "Z (mm)", "#phi"}, {"Charge", "Z (cm)", " ", " "}, {"Z (cm)", "#phi", " ", " "}}; + std::string ytitl[3][4] = { + {"Hits", "Hits", "R (mm)", "#eta"}, {"Hits", "R (cm)", " ", " "}, {"R (cm)", "#eta", " ", " "}}; + double xmax[3][4] = {{0.2, 20.0, -1, -1}, {25.0, -1, -1, -1}, {-1, -1, -1, -1}}; + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Type " << type << ":" << name0[type] << " Tags " << tag << " : " << dtype + << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + for (int it = 0; it < ndir[type]; ++it) { + char dirx[100]; + sprintf(dirx, "%s", dirnm[type][it].c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int in = 0; in < nname[type]; ++in) { + for (int ih = 0; ih < nhist[type]; ++ih) { + char hname[100]; + if (type == 0) { + sprintf(hname, "%s%s", name2[type][ih].c_str(), name1[in].c_str()); + } else { + sprintf(hname, "%s%s", name2[type][ih].c_str(), name1[it].c_str()); + } + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (nhtype[type][ih] == 1) + hist1 = (TH1D *)dir->FindObjectAny(hname); + else + hist2 = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist1 << " : " << hist2 << " Xtitle " << xtitl[type][ih] + << " Ytitle " << ytitl[type][ih] << " xmax " << xmax[type][ih] << " Type " << nhtype[type][ih] + << " yscale " << yax[type][ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + if (type == 0) + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + else + sprintf(title, "%s (%s)", name0[it].c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + if (nhtype[type][ih] == 1) { + hist1->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + if (xmax[type][ih] > 0) + hist1->GetXaxis()->SetRangeUser(0, xmax[type][ih]); + if (yax[type][ih] > 0) + pad->SetLogy(); + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); + hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } + } + } +} + +void hgcalGeomCheckPlots(std::string fname = "roots/hgcGeomCheckD83.root", + std::string tag = "GeomChkD83", + std::string dtype = "#mu D83", + bool save = false, + bool debug = false) { + std::string dirnm = "hgcGeomCheck"; + std::string name0[3] = {"HGCal EE", "HGCal HE Silicon", "HGCal HE Scintillator"}; + int nhist = 3; + int nhtype = 3; + std::string name2[9] = {"heerVsLayer", + "heezVsLayer", + "heedzVsZ", + "hefrVsLayer", + "hefzVsLayer", + "hefdzVsZ", + "hebrVsLayer", + "hebzVsLayer", + "hebdzVsZ"}; + std::string xtitl[9] = { + "Layer", "Layer", "#Delta Z (cm)", "Layer", "Layer", "#Delta Z (cm)", "Layer", "Layer", "#Delta Z (cm)"}; + std::string ytitl[9] = {"R (cm)", "Z (cm)", "Z (cm)", "R (cm)", "Z (cm)", "Z (cm)", "R (cm)", "Z (cm)", "Z (cm)"}; + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + char dirx[100]; + sprintf(dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int in = 0; in < nhtype; ++in) { + for (int ih = 0; ih < nhist; ++ih) { + char hname[100]; + int inh = in * nhist + ih; + sprintf(hname, "%s", name2[inh].c_str()); + TH2D *hist = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist << " Xtitle " << xtitl[inh] << " Ytitle " << ytitl[inh] + << std::endl; + if (hist != nullptr) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + hist->GetYaxis()->SetTitle(ytitl[inh].c_str()); + hist->GetXaxis()->SetTitle(xtitl[inh].c_str()); + hist->SetTitle(title); + hist->GetYaxis()->SetTitleOffset(1.2); + hist->Draw(); + pad->Update(); + TPaveStats *st1 = (TPaveStats *)hist->GetListOfFunctions()->FindObject("stats"); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } + } +} + +void hgcalBHValidPlots(std::string fname = "roots/hgcBHValidD83.root", + std::string tag = "BHValidD83", + std::string dtype = "#mu D83", + bool save = false, + bool debug = false) { + std::string dirnm = "hgcalBHAnalysis"; + std::string name0 = "HGCal HE Scintillator"; + int nhist = 9; + std::string name2[9] = {"SimHitEn1", + "SimHitEn2", + "SimHitLong", + "SimHitOccup", + "SimHitOccu3", + "SimHitTime", + "DigiLong", + "DigiOccup", + "DigiOccu3"}; + std::string xtitl[9] = {"SimHit Energy (GeV)", + "SimHit Energy (GeV)", + "SimHit Layer #", + "SimHit i#eta", + "SimHit i#eta", + "Digi Layer #", + "Digi i#eta", + "Digi i#eta"}; + std::string ytitl[9] = {"Hits", "Hits", "Energy Sum (GeV)", "i#phi", "Layer #", "Digi Sum", "i#phi", "Layer #"}; + double xmax[9] = {0.05, 0.20, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}; + int ihty[9] = {1, 1, 1, 2, 2, 1, 1, 2, 2}; + int iaxty[9] = {1, 1, 0, 0, 0, 1, 0, 0, 0}; + int ibin[10] = {0, 0, 0, 0, 0, 10, 0, 0, 0}; + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + char dirx[100]; + sprintf(dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int ih = 0; ih < nhist; ++ih) { + char hname[100]; + sprintf(hname, "%s", name2[ih].c_str()); + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (ihty[ih] <= 1) + hist1 = (TH1D *)dir->FindObjectAny(hname); + else + hist2 = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist1 << ":" << hist2 << " Xtitle " << xtitl[ih] << " Ytitle " + << ytitl[ih] << " xmax " << xmax[ih] << " iaxty " << iaxty[ih] << " ibin " << ibin[ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0.c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + if (hist1 != nullptr) { + hist1->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist1->SetTitle(title); + if (xmax[ih] > 0) + hist1->GetXaxis()->SetRangeUser(0, xmax[ih]); + if (iaxty[ih] > 0) + pad->SetLogy(); + if (ibin[ih] > 0) + hist1->Rebin(ibin[ih]); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist2->SetTitle(title); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } +} + +void ehcalPlots(std::string fname = "ecalHitdd4hep.root", + std::string dirnm = "EcalSimHitStudy", + std::string tag = "DD4Hep", + int dets = 2, + bool save = false, + bool debug = false) { + const int nh = 2; + std::string name[nh] = {"poszp", "poszn"}; + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(10); + if (debug) + std::cout << "File " << fname << " Tag " << tag << " Detectors " << dets << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirnm.c_str()); + if (debug) + std::cout << "Directory " << dirnm << " : " << dir << std::endl; + if (dir) { + for (int id = 0; id < dets; ++id) { + for (int ih = 0; ih < nh; ++ih) { + char hname[100]; + sprintf(hname, "%s%d", name[ih].c_str(), id); + TH2D *hist = (TH2D *)(dir->FindObjectAny(hname)); + if (debug) + std::cout << "Hist " << hname << " : " << hist << ":" << hist->GetTitle() << " Xtitle " + << hist->GetXaxis()->GetTitle() << " Ytitle " << hist->GetYaxis()->GetTitle() << std::endl; + if (hist != nullptr) { + char cname[100], title[100]; + sprintf(cname, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(cname, cname, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", hist->GetTitle(), tag.c_str()); + if (debug) + std::cout << "Pad " << cname << " : " << pad << "\n"; + hist->SetTitle(title); + hist->SetMarkerStyle(20); + hist->SetMarkerSize(0.1); + hist->GetYaxis()->SetTitleOffset(1.3); + hist->Draw(); + pad->Update(); + TPaveStats *st1 = ((TPaveStats *)hist->GetListOfFunctions()->FindObject("stats")); + if (st1 != NULL) { + st1->SetY1NDC(0.85); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.70); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(cname, "c_%s.jpg", pad->GetName()); + pad->Print(cname); + } + } + } + } + } + } +} + +class hgcHits { +public: + TTree *fChain; + Int_t fCurrent; + +private: + // Declaration of leaf types + std::vector<float> *heeRecX; + std::vector<float> *heeRecY; + std::vector<float> *heeRecZ; + std::vector<float> *heeRecEnergy; + std::vector<float> *hefRecX; + std::vector<float> *hefRecY; + std::vector<float> *hefRecZ; + std::vector<float> *hefRecEnergy; + std::vector<float> *hebRecX; + std::vector<float> *hebRecY; + std::vector<float> *hebRecZ; + std::vector<float> *hebRecEta; + std::vector<float> *hebRecPhi; + std::vector<float> *hebRecEnergy; + std::vector<float> *heeSimX; + std::vector<float> *heeSimY; + std::vector<float> *heeSimZ; + std::vector<float> *heeSimEnergy; + std::vector<float> *hefSimX; + std::vector<float> *hefSimY; + std::vector<float> *hefSimZ; + std::vector<float> *hefSimEnergy; + std::vector<float> *hebSimX; + std::vector<float> *hebSimY; + std::vector<float> *hebSimZ; + std::vector<float> *hebSimEta; + std::vector<float> *hebSimPhi; + std::vector<float> *hebSimEnergy; + std::vector<unsigned int> *heeDetID; + std::vector<unsigned int> *hefDetID; + std::vector<unsigned int> *hebDetID; + + // List of branches + TBranch *b_heeRecX; + TBranch *b_heeRecY; + TBranch *b_heeRecZ; + TBranch *b_heeRecEnergy; + TBranch *b_hefRecX; + TBranch *b_hefRecY; + TBranch *b_hefRecZ; + TBranch *b_hefRecEnergy; + TBranch *b_hebRecX; + TBranch *b_hebRecY; + TBranch *b_hebRecZ; + TBranch *b_hebRecEta; + TBranch *b_hebRecPhi; + TBranch *b_hebRecEnergy; + TBranch *b_heeSimX; + TBranch *b_heeSimY; + TBranch *b_heeSimZ; + TBranch *b_heeSimEnergy; + TBranch *b_hefSimX; + TBranch *b_hefSimY; + TBranch *b_hefSimZ; + TBranch *b_hefSimEnergy; + TBranch *b_hebSimX; + TBranch *b_hebSimY; + TBranch *b_hebSimZ; + TBranch *b_hebSimEta; + TBranch *b_hebSimPhi; + TBranch *b_hebSimEnergy; + TBranch *b_heeDetID; + TBranch *b_hefDetID; + TBranch *b_hebDetID; + +public: + hgcHits(const char *infile); + virtual ~hgcHits(); + virtual Int_t Cut(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry); + virtual Long64_t LoadTree(Long64_t entry); + virtual void Init(TTree *tree); + virtual void Loop(); + virtual Bool_t Notify(); + virtual void Show(Long64_t entry = -1); + + void bookHistograms(); + void saveHistos(const char *outfile); + +private: +}; + +hgcHits::hgcHits::hgcHits(const char *infile) { + TFile *file = new TFile(infile); + TDirectory *dir = (TDirectory *)(file->FindObjectAny("hgcHitAnalysis")); + TTree *tree = (TTree *)(dir->FindObjectAny("hgcHits")); + std::cout << "Attaches tree hgcHits at " << tree << " in file " << infile << std::endl; + bookHistograms(); + Init(tree); +} + +hgcHits::~hgcHits() { + if (!fChain) + return; + delete fChain->GetCurrentFile(); +} + +Int_t hgcHits::GetEntry(Long64_t entry) { + // Read contents of entry. + if (!fChain) + return 0; + return fChain->GetEntry(entry); +} + +Long64_t hgcHits::LoadTree(Long64_t entry) { + // Set the environment to read one entry + if (!fChain) + return -5; + Long64_t centry = fChain->LoadTree(entry); + if (centry < 0) + return centry; + if (!fChain->InheritsFrom(TChain::Class())) + return centry; + TChain *chain = (TChain *)fChain; + if (chain->GetTreeNumber() != fCurrent) { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + +void hgcHits::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 normally 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 + heeRecX = 0; + heeRecY = 0; + heeRecZ = 0; + heeRecEnergy = 0; + hefRecX = 0; + hefRecY = 0; + hefRecZ = 0; + hefRecEnergy = 0; + hebRecX = 0; + hebRecY = 0; + hebRecZ = 0; + hebRecEta = 0; + hebRecPhi = 0; + hebRecEnergy = 0; + heeSimX = 0; + heeSimY = 0; + heeSimZ = 0; + heeSimEnergy = 0; + hefSimX = 0; + hefSimY = 0; + hefSimZ = 0; + hefSimEnergy = 0; + hebSimX = 0; + hebSimY = 0; + hebSimZ = 0; + hebSimEta = 0; + hebSimPhi = 0; + hebSimEnergy = 0; + heeDetID = 0; + hefDetID = 0; + hebDetID = 0; + // Set branch addresses and branch pointers + if (!tree) + return; + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass(1); + + fChain->SetBranchAddress("heeRecX", &heeRecX, &b_heeRecX); + fChain->SetBranchAddress("heeRecY", &heeRecY, &b_heeRecY); + fChain->SetBranchAddress("heeRecZ", &heeRecZ, &b_heeRecZ); + fChain->SetBranchAddress("heeRecEnergy", &heeRecEnergy, &b_heeRecEnergy); + fChain->SetBranchAddress("hefRecX", &hefRecX, &b_hefRecX); + fChain->SetBranchAddress("hefRecY", &hefRecY, &b_hefRecY); + fChain->SetBranchAddress("hefRecZ", &hefRecZ, &b_hefRecZ); + fChain->SetBranchAddress("hefRecEnergy", &hefRecEnergy, &b_hefRecEnergy); + fChain->SetBranchAddress("hebRecX", &hebRecX, &b_hebRecX); + fChain->SetBranchAddress("hebRecY", &hebRecY, &b_hebRecY); + fChain->SetBranchAddress("hebRecZ", &hebRecZ, &b_hebRecZ); + fChain->SetBranchAddress("hebRecEta", &hebRecEta, &b_hebRecEta); + fChain->SetBranchAddress("hebRecPhi", &hebRecPhi, &b_hebRecPhi); + fChain->SetBranchAddress("hebRecEnergy", &hebRecEnergy, &b_hebRecEnergy); + fChain->SetBranchAddress("heeSimX", &heeSimX, &b_heeSimX); + fChain->SetBranchAddress("heeSimY", &heeSimY, &b_heeSimY); + fChain->SetBranchAddress("heeSimZ", &heeSimZ, &b_heeSimZ); + fChain->SetBranchAddress("heeSimEnergy", &heeSimEnergy, &b_heeSimEnergy); + fChain->SetBranchAddress("hefSimX", &hefSimX, &b_hefSimX); + fChain->SetBranchAddress("hefSimY", &hefSimY, &b_hefSimY); + fChain->SetBranchAddress("hefSimZ", &hefSimZ, &b_hefSimZ); + fChain->SetBranchAddress("hefSimEnergy", &hefSimEnergy, &b_hefSimEnergy); + fChain->SetBranchAddress("hebSimX", &hebSimX, &b_hebSimX); + fChain->SetBranchAddress("hebSimY", &hebSimY, &b_hebSimY); + fChain->SetBranchAddress("hebSimZ", &hebSimZ, &b_hebSimZ); + fChain->SetBranchAddress("hebSimEta", &hebSimEta, &b_hebSimEta); + fChain->SetBranchAddress("hebSimPhi", &hebSimPhi, &b_hebSimPhi); + fChain->SetBranchAddress("hebSimEnergy", &hebSimEnergy, &b_hebSimEnergy); + fChain->SetBranchAddress("heeDetID", &heeDetID, &b_heeDetID); + fChain->SetBranchAddress("hefDetID", &hefDetID, &b_hefDetID); + fChain->SetBranchAddress("hebDetID", &hebDetID, &b_hebDetID); + Notify(); +} + +Bool_t hgcHits::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 normally 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; +} + +void hgcHits::Show(Long64_t entry) { + // Print contents of entry. + // If entry is not specified, print current entry + if (!fChain) + return; + fChain->Show(entry); +} + +Int_t hgcHits::Cut(Long64_t) { + // This function may be called from Loop. + // returns 1 if entry is accepted. + // returns -1 otherwise. + return 1; +} + +void hgcHits::Loop() { + // In a ROOT session, you can do: + // Root > .L hgcHits.C + // Root > hgcHits t + // Root > t.GetEntry(12); // Fill t data members with entry number 12 + // Root > t.Show(); // Show values of entry 12 + // Root > t.Show(16); // Read and show values of entry 16 + // Root > t.Loop(); // Loop on all entries + // + + // This is the loop skeleton where: + // jentry is the global entry number in the chain + // ientry is the entry number in the current Tree + // Note that the argument to GetEntry must be: + // jentry for TChain::GetEntry + // ientry for TTree::GetEntry and TBranch::GetEntry + // + // To read only selected branches, Insert statements like: + // METHOD1: + // fChain->SetBranchStatus("*",0); // disable all branches + // fChain->SetBranchStatus("branchname",1); // activate branchname + // METHOD2: replace line + // fChain->GetEntry(jentry); //read all branches + //by b_branchname->GetEntry(ientry); //read only this branch + if (fChain == 0) + return; + + Long64_t nentries = fChain->GetEntriesFast(); + + Long64_t nbytes = 0, nb = 0; + for (Long64_t jentry = 0; jentry < nentries; jentry++) { + Long64_t ientry = LoadTree(jentry); + if (ientry < 0) + break; + nb = fChain->GetEntry(jentry); + nbytes += nb; + // if (Cut(ientry) < 0) continue; + } +} + +void hgcHits::bookHistograms() {} + +void hgcHits::saveHistos(const char *) {} diff --git a/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py index afff0638dcca9..6a00250412ea9 100644 --- a/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py +++ b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py @@ -1,29 +1,29 @@ ############################################################################### # Way to use this: -# cmsRun protoVHGCalSimWatcher_cfg.py geometry=D71 +# cmsRun protoHGCalSimWatcher_cfg.py geometry=D77 # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # ############################################################################### import FWCore.ParameterSet.Config as cms import os, sys, imp, re import FWCore.ParameterSet.VarParsing as VarParsing -############################################################ +#################################################################### ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', "D71", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D84, D77, D83") ### get and parse the command line arguments options.parseArguments() print(options) -############################################################ +#################################################################### # Use the options if (options.geometry == "D49"): @@ -36,16 +36,21 @@ process = cms.Process('PROD',Phase2C12) process.load('Configuration.Geometry.GeometryExtended2026D68_cff') process.load('Configuration.Geometry.GeometryExtended2026D68Reco_cff') -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') diff --git a/Validation/HGCalValidation/test/python/protoSimValid_cfg.py b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py index d38f81c7bd083..af4eb29b09f9c 100644 --- a/Validation/HGCalValidation/test/python/protoSimValid_cfg.py +++ b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py @@ -1,8 +1,8 @@ ############################################################################### # Way to use this: -# cmsRun protoSimValid_cfg.py geometry=D71 type=hgcalBHValidation +# cmsRun protoSimValid_cfg.py geometry=D77 type=hgcalBHValidation # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # type hgcalBHValidation, hgcalSiliconValidation # ############################################################################### @@ -14,10 +14,10 @@ ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', - "D71", + "D77", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D77, D83, D84") options.register ('type', "hgcalBHValidation", VarParsing.VarParsing.multiplicity.singleton, @@ -50,24 +50,33 @@ fileName = 'hgcSilValidD68.root' else: fileName = 'hgcBHValidD68.root' -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD83.root' + else: + fileName = 'hgcBHValidD83.root' +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') if (options.type == "hgcalSiliconValidation"): - fileName = 'hgcSilValidD70.root' + fileName = 'hgcSilValidD84.root' else: - fileName = 'hgcBHValidD70.root' + fileName = 'hgcBHValidD84.root' else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') if (options.type == "hgcalSiliconValidation"): - fileName = 'hgcSilValidD71.root' + fileName = 'hgcSilValidD77.root' else: - fileName = 'hgcBHValidD71.root' + fileName = 'hgcBHValidD77.root' # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') diff --git a/Validation/HGCalValidation/test/python/protoValid_cfg.py b/Validation/HGCalValidation/test/python/protoValid_cfg.py index 9efe6d5e0f00a..75fa6ebdeccaf 100644 --- a/Validation/HGCalValidation/test/python/protoValid_cfg.py +++ b/Validation/HGCalValidation/test/python/protoValid_cfg.py @@ -1,8 +1,8 @@ ############################################################################### # Way to use this: -# cmsRun protoValid_cfg.py geometry=D71 type=hgcalSimHitStudy defaultInput=1 +# cmsRun protoValid_cfg.py geometry=D77 type=hgcalSimHitStudy defaultInput=1 # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # type hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy, # hgcalRecHitStudy, hgcalSiliconValidation # defaultInput 1, 0 @@ -16,10 +16,10 @@ ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', - "D71", + "D83", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D77, D83, D84") options.register('type', "hgcalGeomCheck", VarParsing.VarParsing.multiplicity.singleton, @@ -75,42 +75,60 @@ fileName = 'hgcSilValidD68.root' else: fileName = 'hgcGeomCheckD68.root' -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD83.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD83.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD83.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD83.root' + else: + fileName = 'hgcSilValidD83.root' + else: + fileName = 'hgcGeomCheckD83.root' +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') if (options.type == "hgcalSimHitStudy"): - fileName = 'hgcSimHitD70.root' + fileName = 'hgcSimHitD84.root' elif (options.type == "hgcalDigiStudy"): - fileName = 'hgcDigiD70.root' + fileName = 'hgcDigiD84.root' elif (options.type == "hgcalRecHitStudy"): - fileName = 'hgcRecHitD70.root' + fileName = 'hgcRecHitD84.root' elif (options.type == "hgcalSiliconValidation"): if (options.defaultInput == 0): - fileName = 'hgcDigValidD70.root' + fileName = 'hgcDigValidD84.root' else: - fileName = 'hgcSilValidD70.root' + fileName = 'hgcSilValidD84.root' else: - fileName = 'hgcGeomCheckD70.root' + fileName = 'hgcGeomCheckD84.root' else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') if (options.type == "hgcalSimHitStudy"): - fileName = 'hgcSimHitD71.root' + fileName = 'hgcSimHitD77.root' elif (options.type == "hgcalDigiStudy"): - fileName = 'hgcDigiD71.root' + fileName = 'hgcDigiD77.root' elif (options.type == "hgcalRecHitStudy"): - fileName = 'hgcRecHitD71.root' + fileName = 'hgcRecHitD77.root' elif (options.type == "hgcalSiliconValidation"): if (options.defaultInput == 0): - fileName = 'hgcDigValidD71.root' + fileName = 'hgcDigValidD77.root' else: - fileName = 'hgcSilValidD71.root' + fileName = 'hgcSilValidD77.root' else: - fileName = 'hgcGeomCheckD71.root' + fileName = 'hgcGeomCheckD77.root' process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Validation/HGCalValidation/test/python/standalone_fromRECO.py b/Validation/HGCalValidation/test/python/standalone_fromRECO.py index ef5c90850dbc5..cf1f6ce3c7177 100644 --- a/Validation/HGCalValidation/test/python/standalone_fromRECO.py +++ b/Validation/HGCalValidation/test/python/standalone_fromRECO.py @@ -1,14 +1,13 @@ import FWCore.ParameterSet.Config as cms - -from Configuration.Eras.Era_Phase2_cff import Phase2 -process = cms.Process('HGCAL',Phase2) +from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 +process = cms.Process('HGCAL',Phase2C11M9) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.maxEvents = cms.untracked.PSet( @@ -22,7 +21,7 @@ ) process.options = cms.untracked.PSet( - + SkipEvent = cms.untracked.vstring('ProductNotFound') ) # Production Info @@ -45,10 +44,13 @@ # Additional output definition from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') process.load("Validation.HGCalValidation.hgcalHitValidation_cfi") -process.dqmoffline_step = cms.EndPath(process.hgcalHitValidationSequece) +process.load("Validation.HGCalValidation.hgcalHitCalibration_cfi") +process.load("Validation.HGCalValidation.caloparticlevalidation_cfi") + +process.dqmoffline_step = cms.EndPath(process.hgcalHitValidation+process.hgcalHitCalibration+process.caloparticlevalidation) process.DQMoutput_step = cms.EndPath(process.DQMoutput) # Schedule definition diff --git a/Validation/MtdValidation/macros/makeTimeResPlots.C b/Validation/MtdValidation/macros/makeTimeResPlots.C new file mode 100644 index 0000000000000..38439d9d1e687 --- /dev/null +++ b/Validation/MtdValidation/macros/makeTimeResPlots.C @@ -0,0 +1,381 @@ +// ============================================================================= +// +// This macro reads the histograms of time residuals of the BTL and ETL +// UncalibratedRecHits from the DQM root file and produces time resolution +// plots vs the hit amplitude and the hit |eta|. +// +// Usage: +// root -l make_resPlot.C\(\"DQM_filename.root\"\) +// +// NB: In order to have the UncalibratedRecHits histograms filled, +// the MTD validation has to be run the flags: +// +// process.btlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// process.etlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// +// ============================================================================= + +#include <iostream> +#include "TStyle.h" +#include "TFile.h" +#include "TString.h" +#include "TCanvas.h" +#include "TH1F.h" +#include "TFitResult.h" +#include "TLegend.h" + +// ============================================================================= +// configuration + +const Float_t minBinContent = 20.; + +// --- BTL + +const Int_t nBinsQ_BTL = 20; +const Float_t binWidthQ_BTL = 30.; // [pC] +const Int_t nBinsQEta_BTL = 3; +const Float_t binsQEta_BTL[4] = {0., 0.65, 1.15, 1.55}; + +const Int_t nBinsEta_BTL = 31; +const Float_t binWidthEta_BTL = 0.05; +const Int_t nBinsEtaQ_BTL = 7; +const Float_t binsEtaQ_BTL[8] = {0., 30., 60., 90., 120., 150., 360., 600.}; + +// --- ETL + +const Int_t nBinsQ_ETL = 20; +const Float_t binWidthQ_ETL = 1.3; // [MIP] + +const Int_t nBinsEta_ETL = 26; +const Float_t binWidthEta_ETL = 0.05; +const Float_t etaMin_ETL = 1.65; + +// ============================================================================= + +TCanvas* c[10]; + +TH1F* h_TimeResQ_BTL[nBinsQ_BTL]; +TH1F* h_TimeResQEta_BTL[nBinsQ_BTL][nBinsQEta_BTL]; +TH1F* h_TimeResEta_BTL[nBinsEta_BTL]; +TH1F* h_TimeResEtaQ_BTL[nBinsEta_BTL][nBinsEtaQ_BTL]; + +TH1F* g_TimeResQ_BTL; +TH1F* g_TimeResQEta_BTL[nBinsQEta_BTL]; +TH1F* g_TimeResEta_BTL; +TH1F* g_TimeResEtaQ_BTL[nBinsEtaQ_BTL]; + +TH1F* h_TimeResQ_ETL[2][nBinsQ_ETL]; +TH1F* h_TimeResEta_ETL[2][nBinsEta_ETL]; + +TH1F* g_TimeResQ_ETL[2]; +TH1F* g_TimeResEta_ETL[2]; + +void makeTimeResPlots(const TString DQMfilename = "DQM_V0001_UNKNOWN_R000000001.root") { + gStyle->SetOptStat(kFALSE); + + // --- Histograms booking + + g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", nBinsQ_BTL, 0., nBinsQ_BTL * binWidthQ_BTL); + + for (Int_t ih = 0; ih < nBinsQEta_BTL; ++ih) { + TString hname = Form("g_TimeResQEta_BTL_%d", ih); + TString htitle = + Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", binsQEta_BTL[ih], binsQEta_BTL[ih + 1]); + g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL * binWidthQ_BTL); + } + + g_TimeResEta_BTL = new TH1F( + "g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", nBinsEta_BTL, 0., nBinsEta_BTL * binWidthEta_BTL); + + for (Int_t ih = 0; ih < nBinsEtaQ_BTL; ++ih) { + TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); + TString htitle = + Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih + 1]); + g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL * binWidthEta_BTL); + } + + for (Int_t iside = 0; iside < 2; ++iside) { + TString hname = Form("g_TimeResQ_ETL_%d", iside); + g_TimeResQ_ETL[iside] = + new TH1F(hname, "ETL time resolution vs amplitude", nBinsQ_ETL, 0., nBinsQ_ETL * binWidthQ_ETL); + + hname = Form("g_TimeResEta_ETL_%d", iside); + g_TimeResEta_ETL[iside] = new TH1F(hname, + "ETL time resolution vs |#eta_{hit}|", + nBinsEta_ETL, + etaMin_ETL, + etaMin_ETL + nBinsEta_ETL * binWidthEta_ETL); + } + + std::cout << " Processing file " << DQMfilename.Data() << " ... " << std::endl; + TFile* input_file = new TFile(DQMfilename.Data()); + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q + + for (Int_t iq = 0; iq < nBinsQ_BTL; ++iq) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d", iq); + h_TimeResQ_BTL[iq] = (TH1F*)input_file->Get(hname); + + if (h_TimeResQ_BTL[iq]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2. * h_TimeResQ_BTL[iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3 * h_TimeResQ_BTL[iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_BTL[iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQ_BTL[iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_BTL->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQ_BTL->SetBinError(iq + 1, fit_res->GetErrors()[2]); + + } // iq loop + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q in bind of |eta| + + for (Int_t iq = 0; iq < nBinsQ_BTL; ++iq) { + for (Int_t ieta = 0; ieta < nBinsQEta_BTL; ++ieta) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", iq, ieta); + h_TimeResQEta_BTL[iq][ieta] = (TH1F*)input_file->Get(hname); + + if (h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - 2. * h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + 3 * h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; + continue; + } + + g_TimeResQEta_BTL[ieta]->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQEta_BTL[ieta]->SetBinError(iq + 1, fit_res->GetErrors()[2]); + + } // ieta loop + + } // iq loop + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| + + for (Int_t ieta = 0; ieta < nBinsEta_BTL; ++ieta) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d", ieta); + h_TimeResEta_BTL[ieta] = (TH1F*)input_file->Get(hname); + + if (h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2. * h_TimeResEta_BTL[ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3 * h_TimeResEta_BTL[ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_BTL[ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEta_BTL[ieta]->GetName() << std::endl; + continue; + } + + g_TimeResEta_BTL->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEta_BTL->SetBinError(ieta + 1, fit_res->GetErrors()[2]); + + } // ieta loop + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| in bind of Q + + for (Int_t ieta = 0; ieta < nBinsEta_BTL; ++ieta) { + for (Int_t iq = 0; iq < nBinsEtaQ_BTL; ++iq) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", ieta, iq); + h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*)input_file->Get(hname); + + if (h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - 2. * h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + 3 * h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; + continue; + } + + g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEtaQ_BTL[iq]->SetBinError(ieta + 1, fit_res->GetErrors()[2]); + + } // iq loop + + } // ieta loop + + // --------------------------------------------------------------------------- + // ETL time resolution vs amplitude and |eta| + + for (Int_t iside = 0; iside < 2; ++iside) { + for (Int_t iq = 0; iq < nBinsQ_ETL; ++iq) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResQ_%d_%d", iside, iq); + h_TimeResQ_ETL[iside][iq] = (TH1F*)input_file->Get(hname); + + if (h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2. * h_TimeResQ_ETL[iside][iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3 * h_TimeResQ_ETL[iside][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_ETL[iside]->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQ_ETL[iside]->SetBinError(iq + 1, fit_res->GetErrors()[2]); + + } // iq loop + + for (Int_t ieta = 0; ieta < nBinsEta_ETL; ++ieta) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResEta_%d_%d", iside, ieta); + h_TimeResEta_ETL[iside][ieta] = (TH1F*)input_file->Get(hname); + + if (h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent) + continue; + + Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2. * h_TimeResEta_ETL[iside][ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3 * h_TimeResEta_ETL[iside][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); + + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEta_ETL[iside][ieta]->GetName() + << std::endl; + continue; + } + + g_TimeResEta_ETL[iside]->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEta_ETL[iside]->SetBinError(ieta + 1, fit_res->GetErrors()[2]); + + } // ieta loop + + } // iside loop + + // ============================================================================= + // Draw the histograms + + // --- BTL + + c[0] = new TCanvas("c_0", "BTL time resolution vs Q"); + c[0]->SetGridy(kTRUE); + g_TimeResQ_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQ_BTL->SetMarkerStyle(20); + g_TimeResQ_BTL->SetMarkerColor(4); + g_TimeResQ_BTL->SetXTitle("hit amplitude [pC]"); + g_TimeResQ_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResQ_BTL->Draw("EP"); + + c[1] = new TCanvas("c_1", "BTL time resolution vs Q"); + c[1]->SetGridy(kTRUE); + g_TimeResQEta_BTL[0]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQEta_BTL[0]->SetXTitle("hit amplitude [pC]"); + g_TimeResQEta_BTL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResQEta_BTL[0]->SetMarkerStyle(20); + g_TimeResQEta_BTL[0]->SetMarkerColor(1); + g_TimeResQEta_BTL[0]->Draw("EP"); + g_TimeResQEta_BTL[1]->SetMarkerStyle(20); + g_TimeResQEta_BTL[1]->SetMarkerColor(4); + g_TimeResQEta_BTL[1]->Draw("EPSAME"); + g_TimeResQEta_BTL[2]->SetMarkerStyle(20); + g_TimeResQEta_BTL[2]->SetMarkerColor(2); + g_TimeResQEta_BTL[2]->Draw("EPSAME"); + + TLegend* legend_1 = new TLegend(0.510, 0.634, 0.862, 0.847); + legend_1->SetBorderSize(0.); + legend_1->SetFillStyle(0); + for (Int_t ih = 0; ih < nBinsQEta_BTL; ++ih) + legend_1->AddEntry( + g_TimeResQEta_BTL[ih], Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih + 1]), "LP"); + legend_1->Draw(); + + c[2] = new TCanvas("c_2", "BTL time resolution vs eta"); + c[2]->SetGridy(kTRUE); + g_TimeResEta_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEta_BTL->SetMarkerStyle(20); + g_TimeResEta_BTL->SetMarkerColor(4); + g_TimeResEta_BTL->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResEta_BTL->Draw("EP"); + + c[3] = new TCanvas("c_3", "BTL time resolution vs eta"); + c[3]->SetGridy(kTRUE); + g_TimeResEtaQ_BTL[1]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEtaQ_BTL[1]->SetXTitle("|#eta_{hit}|"); + g_TimeResEtaQ_BTL[1]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResEtaQ_BTL[1]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[1]->SetMarkerColor(1); + g_TimeResEtaQ_BTL[1]->Draw("EP"); + + TLegend* legend_3 = new TLegend(0.649, 0.124, 0.862, 0.328); + legend_3->SetBorderSize(0.); + legend_3->SetFillStyle(0); + for (Int_t ih = 1; ih < nBinsEtaQ_BTL; ++ih) { + if (ih > 1) { + g_TimeResEtaQ_BTL[ih]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[ih]->SetMarkerColor(ih); + g_TimeResEtaQ_BTL[ih]->Draw("EPSAME"); + } + + legend_3->AddEntry( + g_TimeResEtaQ_BTL[ih], Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih + 1]), "LP"); + } + + legend_3->Draw(); + + // --- ETL + + c[4] = new TCanvas("c_4", "ETL time resolution vs amplitude"); + c[4]->SetGridy(kTRUE); + g_TimeResQ_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResQ_ETL[0]->SetXTitle("hit amplitude [MIP]"); + g_TimeResQ_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResQ_ETL[0]->SetMarkerStyle(20); + g_TimeResQ_ETL[0]->SetMarkerColor(4); + g_TimeResQ_ETL[0]->Draw("EP"); + g_TimeResQ_ETL[1]->SetMarkerStyle(20); + g_TimeResQ_ETL[1]->SetMarkerColor(2); + g_TimeResQ_ETL[1]->Draw("EPSAME"); + + TLegend* legend_4 = new TLegend(0.673, 0.655, 0.872, 0.819); + legend_4->SetBorderSize(0.); + legend_4->SetFillStyle(0); + legend_4->AddEntry(g_TimeResQ_ETL[0], "ETL-", "LP"); + legend_4->AddEntry(g_TimeResQ_ETL[1], "ETL+", "LP"); + legend_4->DrawClone(); + + c[5] = new TCanvas("c_5", "ETL time resolution vs |eta|"); + c[5]->SetGridy(kTRUE); + g_TimeResEta_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResEta_ETL[0]->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0., 0.075); + g_TimeResEta_ETL[0]->SetMarkerStyle(20); + g_TimeResEta_ETL[0]->SetMarkerColor(4); + g_TimeResEta_ETL[0]->Draw("EP"); + g_TimeResEta_ETL[1]->SetMarkerStyle(20); + g_TimeResEta_ETL[1]->SetMarkerColor(2); + g_TimeResEta_ETL[1]->Draw("EPSAME"); + + legend_4->DrawClone(); +} diff --git a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc index ab50036cc1115..b3db52544426b 100644 --- a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc @@ -66,8 +66,11 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer { const std::string folder_; const double hitMinEnergy_; const bool LocalPosDebug_; + const bool uncalibRecHitsPlots_; + const double hitMinAmplitude_; edm::EDGetTokenT<FTLRecHitCollection> btlRecHitsToken_; + edm::EDGetTokenT<FTLUncalibratedRecHitCollection> btlUncalibRecHitsToken_; edm::EDGetTokenT<CrossingFrame<PSimHit> > btlSimHitsToken_; edm::EDGetTokenT<FTLClusterCollection> btlRecCluToken_; @@ -123,16 +126,40 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer { MonitorElement* meCluEta_; MonitorElement* meCluHits_; MonitorElement* meCluZvsPhi_; + + // --- UncalibratedRecHits histograms + + static constexpr int nBinsQ_ = 20; + static constexpr float binWidthQ_ = 30.; + static constexpr int nBinsQEta_ = 3; + static constexpr float binsQEta_[nBinsQEta_ + 1] = {0., 0.65, 1.15, 1.55}; + + MonitorElement* meTimeResQ_[nBinsQ_]; + MonitorElement* meTimeResQvsEta_[nBinsQ_][nBinsQEta_]; + + static constexpr int nBinsEta_ = 31; + static constexpr float binWidthEta_ = 0.05; + static constexpr int nBinsEtaQ_ = 7; + static constexpr float binsEtaQ_[nBinsEtaQ_ + 1] = {0., 30., 60., 90., 120., 150., 360., 600.}; + + MonitorElement* meTimeResEta_[nBinsEta_]; + MonitorElement* meTimeResEtavsQ_[nBinsEta_][nBinsEtaQ_]; }; // ------------ constructor and destructor -------------- BtlLocalRecoValidation::BtlLocalRecoValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter<std::string>("folder")), - hitMinEnergy_(iConfig.getParameter<double>("hitMinimumEnergy")), - LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")) { + hitMinEnergy_(iConfig.getParameter<double>("HitMinimumEnergy")), + LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")), + uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")), + hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) { btlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag")); + if (uncalibRecHitsPlots_) + btlUncalibRecHitsToken_ = + consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag")); btlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag")); btlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag")); + mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>(); mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>(); } @@ -287,6 +314,91 @@ void BtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS meCluHits_->Fill(cluster.size()); } } + + // --- Loop over the BTL Uncalibrated RECO hits + if (uncalibRecHitsPlots_) { + auto btlUncalibRecHitsHandle = makeValid(iEvent.getHandle(btlUncalibRecHitsToken_)); + + for (const auto& uRecHit : *btlUncalibRecHitsHandle) { + BTLDetId detId = uRecHit.id(); + + // --- Skip UncalibratedRecHits not matched to SimHits + if (m_btlSimHits.count(detId.rawId()) != 1) + continue; + + DetId geoId = detId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topology->getMTDTopologyMode())); + const MTDGeomDet* thedet = geom->idToDet(geoId); + if (thedet == nullptr) + throw cms::Exception("BtlLocalRecoValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " (" + << detId.rawId() << ") is invalid!" << std::dec << std::endl; + const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology()); + const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology()); + + Local3DPoint local_point(0., 0., 0.); + local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows())); + const auto& global_point = thedet->toGlobal(local_point); + + // --- Combine the information from the left and right BTL cell sides + + float nHits = 0.; + float hit_amplitude = 0.; + float hit_time = 0.; + + // left side: + if (uRecHit.amplitude().first > 0.) { + hit_amplitude += uRecHit.amplitude().first; + hit_time += uRecHit.time().first; + nHits += 1.; + } + // right side: + if (uRecHit.amplitude().second > 0.) { + hit_amplitude += uRecHit.amplitude().second; + hit_time += uRecHit.time().second; + nHits += 1.; + } + + hit_amplitude /= nHits; + hit_time /= nHits; + + // --- Fill the histograms + + if (hit_amplitude < hitMinAmplitude_) + continue; + + float time_res = hit_time - m_btlSimHits[detId.rawId()].time; + + // amplitude histograms + + int qBin = (int)(hit_amplitude / binWidthQ_); + if (qBin > nBinsQ_ - 1) + qBin = nBinsQ_ - 1; + + meTimeResQ_[qBin]->Fill(time_res); + + int etaBin = 0; + for (int ibin = 1; ibin < nBinsQEta_; ++ibin) + if (fabs(global_point.eta()) >= binsQEta_[ibin] && fabs(global_point.eta()) < binsQEta_[ibin + 1]) + etaBin = ibin; + + meTimeResQvsEta_[qBin][etaBin]->Fill(time_res); + + // eta histograms + + etaBin = (int)(fabs(global_point.eta()) / binWidthEta_); + if (etaBin > nBinsEta_ - 1) + etaBin = nBinsEta_ - 1; + + meTimeResEta_[etaBin]->Fill(time_res); + + qBin = 0; + for (int ibin = 1; ibin < nBinsEtaQ_; ++ibin) + if (hit_amplitude >= binsEtaQ_[ibin] && hit_amplitude < binsEtaQ_[ibin + 1]) + qBin = ibin; + + meTimeResEtavsQ_[etaBin][qBin]->Fill(time_res); + + } // uRecHit loop + } } // ------------ method for histogram booking ------------ @@ -376,6 +488,38 @@ void BtlLocalRecoValidation::bookHistograms(DQMStore::IBooker& ibook, meCluHits_ = ibook.book1D("BtlCluHitNumber", "BTL hits per cluster; Cluster size", 10, 0, 10); meCluZvsPhi_ = ibook.book2D( "BtlOccupancy", "BTL cluster Z vs #phi;Z_{RECO} [cm]; #phi_{RECO} [rad]", 144, -260., 260., 50, -3.2, 3.2); + + // --- UncalibratedRecHits histograms + + if (uncalibRecHitsPlots_) { + for (unsigned int ihistoQ = 0; ihistoQ < nBinsQ_; ++ihistoQ) { + std::string hname = Form("TimeResQ_%d", ihistoQ); + std::string htitle = Form("BTL time resolution (Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ); + meTimeResQ_[ihistoQ] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsQEta_; ++ihistoEta) { + hname = Form("TimeResQvsEta_%d_%d", ihistoQ, ihistoEta); + htitle = Form("BTL time resolution (Q bin = %d, |#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ, ihistoEta); + meTimeResQvsEta_[ihistoQ][ihistoEta] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + } // ihistoEta loop + + } // ihistoQ loop + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsEta_; ++ihistoEta) { + std::string hname = Form("TimeResEta_%d", ihistoEta); + std::string htitle = Form("BTL time resolution (|#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta); + meTimeResEta_[ihistoEta] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + for (unsigned int ihistoQ = 0; ihistoQ < nBinsEtaQ_; ++ihistoQ) { + hname = Form("TimeResEtavsQ_%d_%d", ihistoEta, ihistoQ); + htitle = Form("BTL time resolution (|#eta| bin = %d, Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta, ihistoQ); + meTimeResEtavsQ_[ihistoEta][ihistoQ] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + } // ihistoQ loop + + } // ihistoEta loop + } } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -384,10 +528,13 @@ void BtlLocalRecoValidation::fillDescriptions(edm::ConfigurationDescriptions& de desc.add<std::string>("folder", "MTD/BTL/LocalReco"); desc.add<edm::InputTag>("recHitsTag", edm::InputTag("mtdRecHits", "FTLBarrel")); + desc.add<edm::InputTag>("uncalibRecHitsTag", edm::InputTag("mtdUncalibratedRecHits", "FTLBarrel")); desc.add<edm::InputTag>("simHitsTag", edm::InputTag("mix", "g4SimHitsFastTimerHitsBarrel")); desc.add<edm::InputTag>("recCluTag", edm::InputTag("mtdClusters", "FTLBarrel")); - desc.add<double>("hitMinimumEnergy", 1.); // [MeV] + desc.add<double>("HitMinimumEnergy", 1.); // [MeV] desc.add<bool>("LocalPositionDebug", false); + desc.add<bool>("UncalibRecHitsPlots", false); + desc.add<double>("HitMinimumAmplitude", 30.); // [pC] descriptions.add("btlLocalReco", desc); } diff --git a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc index 108bfdf2537c0..01616073904c5 100644 --- a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc @@ -63,8 +63,11 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer { const float hitMinEnergy1Dis_; const float hitMinEnergy2Dis_; const bool LocalPosDebug_; + const bool uncalibRecHitsPlots_; + const double hitMinAmplitude_; edm::EDGetTokenT<FTLRecHitCollection> etlRecHitsToken_; + edm::EDGetTokenT<FTLUncalibratedRecHitCollection> etlUncalibRecHitsToken_; edm::EDGetTokenT<CrossingFrame<PSimHit> > etlSimHitsToken_; edm::EDGetTokenT<FTLClusterCollection> etlRecCluToken_; @@ -108,6 +111,19 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer { MonitorElement* meEnergyRes_; MonitorElement* meTPullvsE_; MonitorElement* meTPullvsEta_; + + // --- UncalibratedRecHits histograms + + static constexpr int nBinsQ_ = 20; + static constexpr float binWidthQ_ = 1.3; // in MIP units + + MonitorElement* meTimeResQ_[2][nBinsQ_]; + + static constexpr int nBinsEta_ = 26; + static constexpr float binWidthEta_ = 0.05; + static constexpr float etaMin_ = 1.65; + + MonitorElement* meTimeResEta_[2][nBinsEta_]; }; // ------------ constructor and destructor -------------- @@ -115,10 +131,16 @@ EtlLocalRecoValidation::EtlLocalRecoValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter<std::string>("folder")), hitMinEnergy1Dis_(iConfig.getParameter<double>("hitMinimumEnergy1Dis")), hitMinEnergy2Dis_(iConfig.getParameter<double>("hitMinimumEnergy2Dis")), - LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")) { + LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")), + uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")), + hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) { etlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag")); + if (uncalibRecHitsPlots_) + etlUncalibRecHitsToken_ = + consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag")); etlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag")); etlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag")); + mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>(); mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>(); } @@ -357,6 +379,59 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS meCluHits_[idet]->Fill(cluster.size()); } } + + // --- Loop over the ETL Uncalibrated RECO hits + if (uncalibRecHitsPlots_) { + auto etlUncalibRecHitsHandle = makeValid(iEvent.getHandle(etlUncalibRecHitsToken_)); + + for (const auto& uRecHit : *etlUncalibRecHitsHandle) { + ETLDetId detId = uRecHit.id(); + + int idet = detId.zside() + detId.nDisc(); + + // --- Skip UncalibratedRecHits not matched to SimHits + if (m_etlSimHits[idet].count(detId.rawId()) != 1) + continue; + + DetId geoId = detId.geographicalId(); + const MTDGeomDet* thedet = geom->idToDet(geoId); + if (thedet == nullptr) + throw cms::Exception("EtlLocalRecoValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " (" + << detId.rawId() << ") is invalid!" << std::dec << std::endl; + const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology()); + + Local3DPoint local_point(topo.localX(uRecHit.row()), topo.localY(uRecHit.column()), 0.); + const auto& global_point = thedet->toGlobal(local_point); + + // --- Fill the histograms + + if (uRecHit.amplitude().first < hitMinAmplitude_) + continue; + + float time_res = uRecHit.time().first - m_etlSimHits[idet][detId.rawId()].time; + + int iside = (detId.zside() == -1 ? 0 : 1); + + // amplitude histograms + + int qBin = (int)(uRecHit.amplitude().first / binWidthQ_); + if (qBin > nBinsQ_ - 1) + qBin = nBinsQ_ - 1; + + meTimeResQ_[iside][qBin]->Fill(time_res); + + // eta histograms + + int etaBin = (int)((fabs(global_point.eta()) - etaMin_) / binWidthEta_); + if (etaBin < 0) + etaBin = 0; + else if (etaBin > nBinsEta_ - 1) + etaBin = nBinsEta_ - 1; + + meTimeResEta_[iside][etaBin]->Fill(time_res); + + } // uRecHit loop + } } // ------------ method for histogram booking ------------ @@ -738,6 +813,29 @@ void EtlLocalRecoValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -150, 150); + + // --- UncalibratedRecHits histograms + + if (uncalibRecHitsPlots_) { + const std::string det_name[2] = {"ETL-", "ETL+"}; + for (unsigned int iside = 0; iside < 2; ++iside) { + for (unsigned int ihistoQ = 0; ihistoQ < nBinsQ_; ++ihistoQ) { + std::string hname = Form("TimeResQ_%d_%d", iside, ihistoQ); + std::string htitle = + Form("%s time resolution (Q bin = %d);T_{RECO} - T_{SIM} [ns]", det_name[iside].data(), ihistoQ); + meTimeResQ_[iside][ihistoQ] = ibook.book1D(hname, htitle, 200, -0.5, 0.5); + + } // ihistoQ loop + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsEta_; ++ihistoEta) { + std::string hname = Form("TimeResEta_%d_%d", iside, ihistoEta); + std::string htitle = + Form("%s time resolution (|#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", det_name[iside].data(), ihistoEta); + meTimeResEta_[iside][ihistoEta] = ibook.book1D(hname, htitle, 200, -0.5, 0.5); + + } // ihistoEta loop + } + } } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -746,11 +844,14 @@ void EtlLocalRecoValidation::fillDescriptions(edm::ConfigurationDescriptions& de desc.add<std::string>("folder", "MTD/ETL/LocalReco"); desc.add<edm::InputTag>("recHitsTag", edm::InputTag("mtdRecHits", "FTLEndcap")); + desc.add<edm::InputTag>("uncalibRecHitsTag", edm::InputTag("mtdUncalibratedRecHits", "FTLEndcap")); desc.add<edm::InputTag>("simHitsTag", edm::InputTag("mix", "g4SimHitsFastTimerHitsEndcap")); desc.add<edm::InputTag>("recCluTag", edm::InputTag("mtdClusters", "FTLEndcap")); desc.add<double>("hitMinimumEnergy1Dis", 1.); // [MeV] desc.add<double>("hitMinimumEnergy2Dis", 0.001); // [MeV] desc.add<bool>("LocalPositionDebug", false); + desc.add<bool>("UncalibRecHitsPlots", false); + desc.add<double>("HitMinimumAmplitude", 0.33); // [MIP] descriptions.add("etlLocalReco", desc); } diff --git a/Validation/MtdValidation/test/mtdValidation_cfg.py b/Validation/MtdValidation/test/mtdValidation_cfg.py index 1a84ec60b0cc0..4509441227d78 100644 --- a/Validation/MtdValidation/test/mtdValidation_cfg.py +++ b/Validation/MtdValidation/test/mtdValidation_cfg.py @@ -7,22 +7,10 @@ process.load("FWCore.MessageService.MessageLogger_cfi") -process.load("Configuration.Geometry.GeometryExtended2026D49_cff") +process.load("Configuration.Geometry.GeometryExtended2026D76Reco_cff") process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load("Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cfi") -process.load("Geometry.MTDNumberingBuilder.mtdTopology_cfi") -process.load("Geometry.MTDGeometryBuilder.mtdGeometry_cfi") -process.load("Geometry.MTDGeometryBuilder.mtdParameters_cfi") - -process.mtdGeometry = cms.ESProducer("MTDDigiGeometryESModule", - alignmentsLabel = cms.string(''), - appendToDataLabel = cms.string(''), - applyAlignment = cms.bool(False), - fromDDD = cms.bool(True) -) - process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.MessageLogger.cerr.FwkReport = cms.untracked.PSet( @@ -53,8 +41,13 @@ # --- Global Validation process.load("Validation.MtdValidation.mtdTracks_cfi") +process.btlDigiHits.LocalPositionDebug = True +process.etlDigiHits.LocalPositionDebug = True +process.btlLocalReco.LocalPositionDebug = True +process.etlLocalReco.LocalPositionDebug = True + process.DQMStore = cms.Service("DQMStore") process.load("DQMServices.FileIO.DQMFileSaverOnline_cfi") -process.p = cms.Path( process.mix + btlValidation + etlValidation + process.globalReco + process.dqmSaver) +process.p = cms.Path( process.mix + btlValidation + etlValidation + process.mtdTracks + process.dqmSaver) diff --git a/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h b/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h index 99aace914f292..030f12a75c220 100644 --- a/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h +++ b/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h @@ -339,6 +339,7 @@ class MTVHistoProducerAlgoForTracker { const bool doSeedPlots_; const bool doMTDPlots_; + const bool doDzPVcutPlots_; // double ptRes_rangeMin, ptRes_rangeMax; diff --git a/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py b/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py index 7ce1eb5fad5c7..6b7a0d30e8c1c 100644 --- a/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py +++ b/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py @@ -141,6 +141,7 @@ seedingLayerSets = cms.vstring(), doMTDPlots = cms.untracked.bool(False), # meant to be switch on in Phase2 workflows + doDzPVcutPlots = cms.untracked.bool(True) ) def _modifyForPhase1(pset): diff --git a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc index e3370837a2a4c..709df082d2e2e 100644 --- a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc +++ b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc @@ -139,7 +139,9 @@ namespace { } // namespace MTVHistoProducerAlgoForTracker::MTVHistoProducerAlgoForTracker(const edm::ParameterSet& pset, const bool doSeedPlots) - : doSeedPlots_(doSeedPlots), doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")) { + : doSeedPlots_(doSeedPlots), + doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")), + doDzPVcutPlots_(pset.getUntrackedParameter<bool>("doDzPVcutPlots")) { //parameters for _vs_eta plots minEta = pset.getParameter<double>("minEta"); maxEta = pset.getParameter<double>("maxEta"); @@ -260,9 +262,6 @@ MTVHistoProducerAlgoForTracker::MTVHistoProducerAlgoForTracker(const edm::Parame maxDzpvCum = pset.getParameter<double>("maxDzpvCumulative"); nintDzpvCum = pset.getParameter<int>("nintDzpvCumulative"); - maxDzpvsigCum = pset.getParameter<double>("maxDzpvsigCumulative"); - nintDzpvsigCum = pset.getParameter<int>("nintDzpvsigCumulative"); - //--- tracking particle selectors for efficiency measurements using namespace edm; using namespace reco::modules; @@ -577,26 +576,17 @@ void MTVHistoProducerAlgoForTracker::bookSimTrackPVAssociationHistos(DQMStore::I histograms.h_simuldzpvzoomed.push_back(ibook.book1D( "num_simul_dzpv_zoomed", "N of simulated tracks vs dz(PV)", nintDz, minDz / dxyDzZoom, maxDz / dxyDzZoom)); - histograms.h_assoc_dzpvcut.push_back(ibook.book1D( - "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_simul_dzpvcut.push_back( - ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_simul2_dzpvcut.push_back(ibook.book1D( - "num_simul2_dzpvcut", "N of simulated tracks (associated to any track) from sim PV", nintDzpvCum, 0, maxDzpvCum)); - - histograms.h_assoc_dzpvsigcut.push_back(ibook.book1D("num_assoc(simToReco)_dzpvsigcut", - "N of associated tracks (simToReco) vs dz(PV)/dzError", - nintDzpvsigCum, + if (doDzPVcutPlots_) { + histograms.h_assoc_dzpvcut.push_back(ibook.book1D( + "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + histograms.h_simul_dzpvcut.push_back( + ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum)); + histograms.h_simul2_dzpvcut.push_back(ibook.book1D("num_simul2_dzpvcut", + "N of simulated tracks (associated to any track) from sim PV", + nintDzpvCum, 0, - maxDzpvsigCum)); - histograms.h_simul_dzpvsigcut.push_back(ibook.book1D( - "num_simul_dzpvsigcut", "N of simulated tracks from sim PV/dzError", nintDzpvsigCum, 0, maxDzpvsigCum)); - histograms.h_simul2_dzpvsigcut.push_back( - ibook.book1D("num_simul2_dzpvsigcut", - "N of simulated tracks (associated to any track) from sim PV/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); + maxDzpvCum)); + } } void MTVHistoProducerAlgoForTracker::bookRecoHistos(DQMStore::IBooker& ibook, @@ -1491,25 +1481,16 @@ void MTVHistoProducerAlgoForTracker::bookRecoPVAssociationHistos(DQMStore::IBook minDz / dxyDzZoom, maxDz / dxyDzZoom)); - histograms.h_reco_dzpvcut.push_back( - ibook.book1D("num_reco_dzpvcut", "N of reco track vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_assoc2_dzpvcut.push_back(ibook.book1D( - "num_assoc(recoToSim)_dzpvcut", "N of associated (recoToSim) tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_pileup_dzpvcut.push_back(ibook.book1D( - "num_pileup_dzpvcut", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - - histograms.h_reco_dzpvsigcut.push_back( - ibook.book1D("num_reco_dzpvsigcut", "N of reco track vs dz(PV)/dzError", nintDzpvsigCum, 0, maxDzpvsigCum)); - histograms.h_assoc2_dzpvsigcut.push_back(ibook.book1D("num_assoc(recoToSim)_dzpvsigcut", - "N of associated (recoToSim) tracks vs dz(PV)/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); - histograms.h_pileup_dzpvsigcut.push_back(ibook.book1D("num_pileup_dzpvsigcut", - "N of associated (recoToSim) pileup tracks vs dz(PV)/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); + if (doDzPVcutPlots_) { + histograms.h_reco_dzpvcut.push_back( + ibook.book1D("num_reco_dzpvcut", "N of reco track vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + + histograms.h_assoc2_dzpvcut.push_back(ibook.book1D( + "num_assoc(recoToSim)_dzpvcut", "N of associated (recoToSim) tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + + histograms.h_pileup_dzpvcut.push_back(ibook.book1D( + "num_pileup_dzpvcut", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + } } void MTVHistoProducerAlgoForTracker::bookRecodEdxHistos(DQMStore::IBooker& ibook, Histograms& histograms) { @@ -1870,19 +1851,19 @@ void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos( histograms.h_simuldzpv[count]->Fill(dzPVSim); histograms.h_simuldzpvzoomed[count]->Fill(dzPVSim); - histograms.h_simul_dzpvcut[count]->Fill(0); - histograms.h_simul_dzpvsigcut[count]->Fill(0); + if (doDzPVcutPlots_) + histograms.h_simul_dzpvcut[count]->Fill(0); if (isMatched) { histograms.h_assocdzpv[count]->Fill(dzPVSim); histograms.h_assocdzpvzoomed[count]->Fill(dzPVSim); - histograms.h_simul2_dzpvcut[count]->Fill(0); - histograms.h_simul2_dzpvsigcut[count]->Fill(0); - const double dzpvcut = std::abs(track->dz(*pvPosition)); - const double dzpvsigcut = dzpvcut / track->dzError(); - histograms.h_assoc_dzpvcut[count]->Fill(dzpvcut); - histograms.h_assoc_dzpvsigcut[count]->Fill(dzpvsigcut); + if (doDzPVcutPlots_) { + histograms.h_simul2_dzpvcut[count]->Fill(0); + + const double dzpvcut = std::abs(track->dz(*pvPosition)); + histograms.h_assoc_dzpvcut[count]->Fill(dzpvcut); + } } } if (simPVPosition) { @@ -1952,7 +1933,6 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr const auto dz = track.dz(bsPosition); const auto dxypv = pvPosition ? track.dxy(*pvPosition) : 0.0; const auto dzpv = pvPosition ? track.dz(*pvPosition) : 0.0; - const auto dzpvsig = pvPosition ? dzpv / track.dzError() : 0.0; const auto nhits = track.found(); const auto nlayers = track.hitPattern().trackerLayersWithMeasurement(); const auto nPixelLayers = track.hitPattern().pixelLayersWithMeasurement(); @@ -1991,8 +1971,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_recodxypvzoomed[count]->Fill(dxypv); histograms.h_recodzpvzoomed[count]->Fill(dzpv); - histograms.h_reco_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_reco_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_reco_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_reco_simpvz[count]->Fill(simpvz); @@ -2060,8 +2040,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_assoc2dxypvzoomed[count]->Fill(dxypv); histograms.h_assoc2dzpvzoomed[count]->Fill(dzpv); - histograms.h_assoc2_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_assoc2_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_assoc2_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_assoc2_simpvz[count]->Fill(simpvz); @@ -2183,8 +2163,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_pileupdxypvzoomed[count]->Fill(dxypv); histograms.h_pileupdzpvzoomed[count]->Fill(dzpv); - histograms.h_pileup_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_pileup_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_pileup_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_pileup_simpvz[count]->Fill(simpvz);