diff --git a/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py b/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py index 0a15276f22dd1..064c6d9418fb1 100644 --- a/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py +++ b/Alignment/CommonAlignment/python/tools/trackselectionRefitting.py @@ -156,6 +156,7 @@ def getSequence(process, collection, "minimumHits": 10, }) elif collection in ("ALCARECOTkAlCosmicsCTF0T", + "ALCARECOTkAlCosmicsCosmicTF0T", "ALCARECOTkAlCosmicsInCollisions"): isCosmics = True options["TrackSelector"]["HighPurity"] = {} # drop high purity cut diff --git a/Alignment/OfflineValidation/bin/Zmumumerge.cc b/Alignment/OfflineValidation/bin/Zmumumerge.cc index 1708273da083a..cc8479f647a4a 100644 --- a/Alignment/OfflineValidation/bin/Zmumumerge.cc +++ b/Alignment/OfflineValidation/bin/Zmumumerge.cc @@ -145,7 +145,7 @@ const TString tstring_variables_name[variables_number] = { void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path) { TH2D* th2d_mass_variables[variables_number]; TFile* inputfile = TFile::Open(inputfile_name.Data()); - TDirectoryFile* tdirectory = (TDirectoryFile*)inputfile->Get("myanalysis"); + TDirectoryFile* tdirectory = (TDirectoryFile*)inputfile->Get("DiMuonMassValidation"); for (int i = 0; i < variables_number; i++) { TString th2d_name = Form("th2d_mass_%s", tstring_variables_name[i].Data()); th2d_mass_variables[i] = (TH2D*)tdirectory->Get(th2d_name); @@ -238,12 +238,18 @@ void Draw_TH1D_forMultiRootFiles(const vector& file_names, } lg->Draw("same"); c->SaveAs(output_name); + if (output_name.Contains(".pdf")) { + TString output_name_png(output_name); // output_name is const, copy to modify + output_name_png.Replace(output_name_png.Index(".pdf"), 4, ".png"); + c->SaveAs(output_name_png); + } } int Zmumumerge(int argc, char* argv[]) { vector vec_single_file_path; vector vec_single_file_name; vector vec_global_tag; + vector vec_title; vector vec_color; vector vec_style; @@ -260,6 +266,7 @@ int Zmumumerge(int argc, char* argv[]) { vec_color.push_back(childTree.second.get("color")); vec_style.push_back(childTree.second.get("style")); vec_global_tag.push_back(childTree.second.get("globaltag")); + vec_title.push_back(childTree.second.get("title")); //Fitting_GetMassmeanVSvariables(childTree.second.get("file") + "/Zmumu.root", childTree.second.get("file")); } @@ -278,7 +285,7 @@ int Zmumumerge(int argc, char* argv[]) { TString th1d_name = Form("th1d_meanmass_%s", tstring_variables_name[idx_variable].Data()); Draw_TH1D_forMultiRootFiles( vec_single_fittingoutput, - vec_global_tag, + vec_title, vec_color, vec_style, th1d_name, @@ -286,7 +293,7 @@ int Zmumumerge(int argc, char* argv[]) { TString th1d_name_entries = Form("th1d_entries_%s", tstring_variables_name[idx_variable].Data()); Draw_TH1D_forMultiRootFiles( vec_single_fittingoutput, - vec_global_tag, + vec_title, vec_color, vec_style, th1d_name_entries, diff --git a/Alignment/OfflineValidation/plugins/DiMuonValidation.cc b/Alignment/OfflineValidation/plugins/DiMuonValidation.cc index 9c37310347454..44ccf9d52ca28 100644 --- a/Alignment/OfflineValidation/plugins/DiMuonValidation.cc +++ b/Alignment/OfflineValidation/plugins/DiMuonValidation.cc @@ -155,6 +155,8 @@ class DiMuonValidation : public edm::one::EDAnalyzer int variable_PairPt_nbins_; edm::EDGetTokenT theTrackCollectionToken_; + + TH1F* th1f_mass; TH2D* th2d_mass_variables_[varNumber_]; // actual histograms std::string variables_name_[varNumber_] = { "CosThetaCS", "DeltaEta", "EtaMinus", "EtaPlus", "PhiCS", "PhiMinus", "PhiPlus", "Pt"}; @@ -175,37 +177,35 @@ void DiMuonValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& const reco::TrackCollection& tC = iEvent.get(theTrackCollectionToken_); DiMuonValid::LV LV_mother(0., 0., 0., 0.); - //for (reco::TrackCollection::const_iterator track1 = tC.begin(); track1 != tC.end(); track1++) { - for (const auto& track1 : tC) { - DiMuonValid::LV LV_track1(track1.px(), - track1.py(), - track1.pz(), - sqrt((track1.p() * track1.p()) + mu_mass2_)); //old 106 - - for (const auto& track2 : tC) { - if (&track1 == &track2) { - continue; - } // discard the same track - - if (track1.charge() == track2.charge()) { + for (reco::TrackCollection::const_iterator track1 = tC.begin(); track1 != tC.end(); track1++) { + DiMuonValid::LV LV_track1(track1->px(), + track1->py(), + track1->pz(), + sqrt((track1->p() * track1->p()) + mu_mass2_)); //old 106 + + for (reco::TrackCollection::const_iterator track2 = track1 + 1; track2 != tC.end(); track2++) { + if (track1->charge() == track2->charge()) { continue; } // only reconstruct opposite charge pair - DiMuonValid::LV LV_track2(track2.px(), track2.py(), track2.pz(), sqrt((track2.p() * track2.p()) + mu_mass2_)); + DiMuonValid::LV LV_track2( + track2->px(), track2->py(), track2->pz(), sqrt((track2->p() * track2->p()) + mu_mass2_)); LV_mother = LV_track1 + LV_track2; double mother_mass = LV_mother.M(); + th1f_mass->Fill(mother_mass); + double mother_pt = LV_mother.Pt(); - int charge1 = track1.charge(); - double etaMu1 = track1.eta(); - double phiMu1 = track1.phi(); - double ptMu1 = track1.pt(); + int charge1 = track1->charge(); + double etaMu1 = track1->eta(); + double phiMu1 = track1->phi(); + double ptMu1 = track1->pt(); - int charge2 = track2.charge(); - double etaMu2 = track2.eta(); - double phiMu2 = track2.phi(); - double ptMu2 = track2.pt(); + int charge2 = track2->charge(); + double etaMu2 = track2->eta(); + double phiMu2 = track2->phi(); + double ptMu2 = track2->pt(); if (charge1 < 0) { // use Mu+ for charge1, Mu- for charge2 std::swap(charge1, charge2); @@ -263,6 +263,8 @@ void DiMuonValidation::beginJob() { fs->file().SetCompressionSettings(compressionSettings_); } + th1f_mass = fs->make("hMass", "mass;m_{#mu#mu} [GeV];events", 200, 0., 200.); + for (int i = 0; i < varNumber_; i++) { std::string th2d_name = fmt::sprintf("th2d_mass_%s", variables_name_[i].c_str()); th2d_mass_variables_[i] = fs->make(th2d_name.c_str(), @@ -288,10 +290,10 @@ void DiMuonValidation::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("Pair_mass_min", 60); desc.add("Pair_mass_max", 120); desc.add("Pair_mass_nbins", 120); - desc.add("Pair_etaminpos", 60); - desc.add("Pair_etamaxpos", 60); - desc.add("Pair_etaminneg", 60); - desc.add("Pair_etamaxneg", 60); + desc.add("Pair_etaminpos", -2.4); + desc.add("Pair_etamaxpos", 2.4); + desc.add("Pair_etaminneg", -2.4); + desc.add("Pair_etamaxneg", 2.4); desc.add("Variable_CosThetaCS_xmin", -1.); desc.add("Variable_CosThetaCS_xmax", 1.); diff --git a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc index e73449fefa8fe..73c15c0e7ff95 100644 --- a/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc +++ b/Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc @@ -274,6 +274,15 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer vTrackHistos_; std::vector vTrackProfiles_; std::vector vTrack2DHistos_; @@ -646,12 +655,31 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer beamSpotHandle = event.getHandle(beamspotToken_); if (beamSpotHandle.isValid()) { beamSpot = *beamSpotHandle; - math::XYZPoint point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0()); + + double BSx0 = beamSpot.x0(); + double BSy0 = beamSpot.y0(); + double BSz0 = beamSpot.z0(); + double Beamsigmaz = beamSpot.sigmaZ(); + double Beamdxdz = beamSpot.dxdz(); + double Beamdydz = beamSpot.dydz(); + double BeamWidthX = beamSpot.BeamWidthX(); + double BeamWidthY = beamSpot.BeamWidthY(); + + math::XYZPoint point(BSx0, BSy0, BSz0); double dxy = track->dxy(point); double dz = track->dz(point); hdxyBS->Fill(dxy); hd0BS->Fill(-dxy); hdzBS->Fill(dz); + + h_BSx0->Fill(BSx0); + h_BSy0->Fill(BSy0); + h_BSz0->Fill(BSz0); + h_Beamsigmaz->Fill(Beamsigmaz); + h_BeamWidthX->Fill(BeamWidthX); + h_BeamWidthY->Fill(BeamWidthY); + h_BSdxdz->Fill(Beamdxdz); + h_BSdydz->Fill(Beamdydz); } //dxy with respect to the primary vertex @@ -843,6 +871,15 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer("h_PhiEndcapPlus", "hPhiEndcapPlus (#eta>1.4);track #phi;track", 100, -M_PI, M_PI); hPhiEndcapMinus = book("h_PhiEndcapMinus", "hPhiEndcapMinus (#eta<1.4);track #phi;tracks", 100, -M_PI, M_PI); + h_BSx0 = book("h_BSx0", "x-coordinate of reco beamspot;x^{BS}_{0};n_{events}", 100, -0.1, 0.1); + h_BSy0 = book("h_BSy0", "y-coordinate of reco beamspot;y^{BS}_{0};n_{events}", 100, -0.1, 0.1); + h_BSz0 = book("h_BSz0", "z-coordinate of reco beamspot;z^{BS}_{0};n_{events}", 100, -1., 1.); + h_Beamsigmaz = book("h_Beamsigmaz", "z-coordinate beam width;#sigma_{Z}^{beam};n_{events}", 100, 0., 1.); + h_BeamWidthX = book("h_BeamWidthX", "x-coordinate beam width;#sigma_{X}^{beam};n_{events}", 100, 0., 0.01); + h_BeamWidthY = book("h_BeamWidthY", "y-coordinate beam width;#sigma_{Y}^{beam};n_{events}", 100, 0., 0.01); + h_BSdxdz = book("h_BSdxdz", "BeamSpot dxdz;beamspot dx/dz;n_{events}", 100, -0.0003, 0.0003); + h_BSdydz = book("h_BSdydz", "BeamSpot dydz;beamspot dy/dz;n_{events}", 100, -0.0003, 0.0003); + if (!isCosmics_) { hPhp = book("h_P_hp", "Momentum (high purity);track momentum [GeV];tracks", 100, 0., 100.); hPthp = book("h_Pt_hp", "Transverse Momentum (high purity);track p_{T} [GeV];tracks", 100, 0., 100.); diff --git a/Alignment/OfflineValidation/plugins/GeneralPurposeVertexAnalyzer.cc b/Alignment/OfflineValidation/plugins/GeneralPurposeVertexAnalyzer.cc new file mode 100644 index 0000000000000..0dfe9fa546114 --- /dev/null +++ b/Alignment/OfflineValidation/plugins/GeneralPurposeVertexAnalyzer.cc @@ -0,0 +1,698 @@ +// -*- C++ -*- +// +// Package: Alignment/GeneralPurposeVertexAnalyzer +// Class: GeneralPurposeVertexAnalyzer +// +/**\class GeneralPurposeVertexAnalyzer GeneralPurposeVertexAnalyzer.cc Alignment/GeneralPurposeVertexAnalyzer/plugins/GeneralPurposeVertexAnalyzer.cc + Description: monitor vertex properties for alignment purposes, largely copied from DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc + +*/ +// +// Original Author: Marco Musich +// Created: Thu, 13 Apr 2023 14:16:43 GMT +// +// + +// ROOT includes files +#include "TMath.h" +#include "TFile.h" +#include "TH1I.h" +#include "TH1D.h" +#include "TH2D.h" +#include "TProfile.h" +#include "TProfile2D.h" + +// system include files +#include +#include +#include + +// user include files +#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/Common/interface/Association.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/isFinite.h" + +// +// class declaration +// + +using reco::TrackCollection; + +class GeneralPurposeVertexAnalyzer : public edm::one::EDAnalyzer { +public: + explicit GeneralPurposeVertexAnalyzer(const edm::ParameterSet &); + ~GeneralPurposeVertexAnalyzer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +private: + void pvTracksPlots(const reco::Vertex &v); + void vertexPlots(const reco::Vertex &v, const reco::BeamSpot &beamSpot, int i); + template + T *book(const Args &...args) const; + void beginJob() override; + void analyze(const edm::Event &, const edm::EventSetup &) override; + + // ----------member data --------------------------- + edm::Service fs_; + + const int ndof_; + bool errorPrinted_; + + const edm::InputTag vertexInputTag_, beamSpotInputTag_; + const edm::EDGetTokenT vertexToken_; + using VertexScore = edm::ValueMap; + const edm::EDGetTokenT scoreToken_; + const edm::EDGetTokenT beamspotToken_; + + static constexpr int cmToUm = 10000; + + const double vposx_; + const double vposy_; + const int tkNoBin_; + const double tkNoMin_; + const double tkNoMax_; + + const int dxyBin_; + const double dxyMin_; + const double dxyMax_; + + const int dzBin_; + const double dzMin_; + const double dzMax_; + + const int phiBin_; + const int phiBin2D_; + const double phiMin_; + const double phiMax_; + + const int etaBin_; + const int etaBin2D_; + const double etaMin_; + const double etaMax_; + + // the histos + TH1I *nbvtx, *nbgvtx; + TH1D *nbtksinvtx[2], *trksWeight[2], *score[2]; + TH1D *tt[2]; + TH1D *xrec[2], *yrec[2], *zrec[2], *xDiff[2], *yDiff[2], *xerr[2], *yerr[2], *zerr[2]; + TH2D *xerrVsTrks[2], *yerrVsTrks[2], *zerrVsTrks[2]; + TH1D *ntracksVsZ[2]; + TH1D *vtxchi2[2], *vtxndf[2], *vtxprob[2], *nans[2]; + TH1D *type[2]; + TH1D *bsX, *bsY, *bsZ, *bsSigmaZ, *bsDxdz, *bsDydz, *bsBeamWidthX, *bsBeamWidthY, *bsType; + + TH1D *sumpt, *ntracks, *weight, *chi2ndf, *chi2prob; + TH1D *dxy, *dxy2, *dz, *dxyErr, *dzErr; + TH1D *phi_pt1, *eta_pt1; + TH1D *phi_pt10, *eta_pt10; + TProfile *dxyVsPhi_pt1, *dzVsPhi_pt1; + TProfile *dxyVsEta_pt1, *dzVsEta_pt1; + TProfile2D *dxyVsEtaVsPhi_pt1, *dzVsEtaVsPhi_pt1; + TProfile *dxyVsPhi_pt10, *dzVsPhi_pt10; + TProfile *dxyVsEta_pt10, *dzVsEta_pt10; + TProfile2D *dxyVsEtaVsPhi_pt10, *dzVsEtaVsPhi_pt10; +}; + +// +// constructors and destructor +// +GeneralPurposeVertexAnalyzer::GeneralPurposeVertexAnalyzer(const edm::ParameterSet &iConfig) + : ndof_(iConfig.getParameter("ndof")), + errorPrinted_(false), + vertexInputTag_(iConfig.getParameter("vertexLabel")), + beamSpotInputTag_(iConfig.getParameter("beamSpotLabel")), + vertexToken_(consumes(vertexInputTag_)), + scoreToken_(consumes(vertexInputTag_)), + beamspotToken_(consumes(beamSpotInputTag_)), + // to be configured for each year... + vposx_(iConfig.getParameter("Xpos")), + vposy_(iConfig.getParameter("Ypos")), + tkNoBin_(iConfig.getParameter("TkSizeBin")), + tkNoMin_(iConfig.getParameter("TkSizeMin")), + tkNoMax_(iConfig.getParameter("TkSizeMax")), + dxyBin_(iConfig.getParameter("DxyBin")), + dxyMin_(iConfig.getParameter("DxyMin")), + dxyMax_(iConfig.getParameter("DxyMax")), + dzBin_(iConfig.getParameter("DzBin")), + dzMin_(iConfig.getParameter("DzMin")), + dzMax_(iConfig.getParameter("DzMax")), + phiBin_(iConfig.getParameter("PhiBin")), + phiBin2D_(iConfig.getParameter("PhiBin2D")), + phiMin_(iConfig.getParameter("PhiMin")), + phiMax_(iConfig.getParameter("PhiMax")), + etaBin_(iConfig.getParameter("EtaBin")), + etaBin2D_(iConfig.getParameter("EtaBin2D")), + etaMin_(iConfig.getParameter("EtaMin")), + etaMax_(iConfig.getParameter("EtaMax")), + // histograms + nbvtx(nullptr), + bsX(nullptr), + bsY(nullptr), + bsZ(nullptr), + bsSigmaZ(nullptr), + bsDxdz(nullptr), + bsDydz(nullptr), + bsBeamWidthX(nullptr), + bsBeamWidthY(nullptr), + bsType(nullptr), + sumpt(nullptr), + ntracks(nullptr), + weight(nullptr), + chi2ndf(nullptr), + chi2prob(nullptr), + dxy(nullptr), + dxy2(nullptr), + dz(nullptr), + dxyErr(nullptr), + dzErr(nullptr), + phi_pt1(nullptr), + eta_pt1(nullptr), + phi_pt10(nullptr), + eta_pt10(nullptr), + dxyVsPhi_pt1(nullptr), + 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), + dxyVsEtaVsPhi_pt10(nullptr), + dzVsEtaVsPhi_pt10(nullptr) { + usesResource(TFileService::kSharedResource); +} + +// +// member functions +// + +// ------------ method called for each event ------------ +void GeneralPurposeVertexAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { + using namespace edm; + + const auto &recVtxs = iEvent.getHandle(vertexToken_); + const auto &scores = iEvent.getHandle(scoreToken_); + const auto &beamSpotHandle = iEvent.getHandle(beamspotToken_); + reco::BeamSpot beamSpot = *beamSpotHandle; + + // check for absent products and simply "return" in that case + if (recVtxs.isValid() == false || beamSpotHandle.isValid() == false) { + edm::LogWarning("GeneralPurposeVertexAnalyzer") + << " Some products not available in the event: VertexCollection " << vertexInputTag_ << " " << recVtxs.isValid() + << " BeamSpot " << beamSpotInputTag_ << " " << beamSpotHandle.isValid() << ". Skipping plots for this event"; + return; + } + + // check upfront that refs to track are (likely) to be valid + bool ok{true}; + for (const auto &v : *recVtxs) { + if (v.tracksSize() > 0) { + const auto &ref = v.trackRefAt(0); + if (ref.isNull() || !ref.isAvailable()) { + if (!errorPrinted_) { + edm::LogWarning("GeneralPurposeVertexAnalyzer") + << "Skipping vertex collection: " << vertexInputTag_ + << " since likely the track collection the vertex has refs pointing to is missing (at least the first " + "TrackBaseRef is null or not available)"; + } else { + errorPrinted_ = true; + } + ok = false; + } + } + } + + if (!ok) { + return; + } + + nbvtx->Fill(recVtxs->size()); + int ng = 0; + for (auto const &vx : (*recVtxs)) { + if (vx.isValid() && !vx.isFake() && vx.ndof() >= ndof_) { + ++ng; + } + } + nbgvtx->Fill(ng); + + if (scores.isValid() && !(*scores).empty()) { + auto pvScore = (*scores).get(0); + score[1]->Fill(std::sqrt(pvScore)); + for (unsigned int i = 1; i < (*scores).size(); ++i) { + score[0]->Fill(std::sqrt((*scores).get(i))); + } + } + + // fill PV tracks MEs (as now, for alignment) + if (!recVtxs->empty()) { + vertexPlots(recVtxs->front(), beamSpot, 1); + pvTracksPlots(recVtxs->front()); + + for (reco::VertexCollection::const_iterator v = recVtxs->begin() + 1; v != recVtxs->end(); ++v) { + vertexPlots(*v, beamSpot, 0); + } + } + + // Beamline plots: + bsX->Fill(beamSpot.x0()); + bsY->Fill(beamSpot.y0()); + bsZ->Fill(beamSpot.z0()); + bsSigmaZ->Fill(beamSpot.sigmaZ()); + bsDxdz->Fill(beamSpot.dxdz()); + bsDydz->Fill(beamSpot.dydz()); + bsBeamWidthX->Fill(beamSpot.BeamWidthX() * cmToUm); + bsBeamWidthY->Fill(beamSpot.BeamWidthY() * cmToUm); + bsType->Fill(beamSpot.type()); +} + +void GeneralPurposeVertexAnalyzer::pvTracksPlots(const reco::Vertex &v) { + if (!v.isValid()) + return; + if (v.isFake()) + return; + + if (v.tracksSize() == 0) { + ntracks->Fill(0); + return; + } + + const math::XYZPoint myVertex(v.position().x(), v.position().y(), v.position().z()); + + float sumPT = 0.; + for (const auto &t : v.tracks()) { + const bool isHighPurity = t->quality(reco::TrackBase::highPurity); + if (!isHighPurity) { + continue; + } + + const float pt = t->pt(); + if (pt < 1.f) { + continue; + } + + const float pt2 = pt * pt; + const float eta = t->eta(); + const float phi = t->phi(); + const float w = v.trackWeight(t); + const float chi2NDF = t->normalizedChi2(); + const float chi2Prob = TMath::Prob(t->chi2(), static_cast(t->ndof())); + const float Dxy = t->dxy(myVertex) * cmToUm; + const float Dz = t->dz(myVertex) * cmToUm; + const float DxyErr = t->dxyError() * cmToUm; + const float DzErr = t->dzError() * cmToUm; + + sumPT += pt2; + + weight->Fill(w); + chi2ndf->Fill(chi2NDF); + chi2prob->Fill(chi2Prob); + dxy->Fill(Dxy); + dxy2->Fill(Dxy); + dz->Fill(Dz); + dxyErr->Fill(DxyErr); + dzErr->Fill(DzErr); + phi_pt1->Fill(phi); + eta_pt1->Fill(eta); + dxyVsPhi_pt1->Fill(phi, Dxy); + 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.f) { + phi_pt10->Fill(phi); + eta_pt10->Fill(eta); + dxyVsPhi_pt10->Fill(phi, Dxy); + 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(static_cast(v.tracks().size())); + sumpt->Fill(sumPT); +} + +void GeneralPurposeVertexAnalyzer::vertexPlots(const reco::Vertex &v, const reco::BeamSpot &beamSpot, int i) { + if (i < 0 || i > 1) + return; + if (!v.isValid()) + type[i]->Fill(2.); + else if (v.isFake()) + type[i]->Fill(1.); + else + type[i]->Fill(0.); + + if (v.isValid() && !v.isFake()) { + float weight = 0; + for (reco::Vertex::trackRef_iterator t = v.tracks_begin(); t != v.tracks_end(); t++) + weight += v.trackWeight(*t); + trksWeight[i]->Fill(weight); + nbtksinvtx[i]->Fill(v.tracksSize()); + ntracksVsZ[i]->Fill(v.position().z() - beamSpot.z0(), v.tracksSize()); + + vtxchi2[i]->Fill(v.chi2()); + vtxndf[i]->Fill(v.ndof()); + vtxprob[i]->Fill(ChiSquaredProbability(v.chi2(), v.ndof())); + + xrec[i]->Fill(v.position().x()); + yrec[i]->Fill(v.position().y()); + zrec[i]->Fill(v.position().z()); + + float xb = beamSpot.x0() + beamSpot.dxdz() * (v.position().z() - beamSpot.z0()); + float yb = beamSpot.y0() + beamSpot.dydz() * (v.position().z() - beamSpot.z0()); + xDiff[i]->Fill((v.position().x() - xb) * cmToUm); + yDiff[i]->Fill((v.position().y() - yb) * cmToUm); + + xerr[i]->Fill(v.xError() * cmToUm); + yerr[i]->Fill(v.yError() * cmToUm); + zerr[i]->Fill(v.zError() * cmToUm); + xerrVsTrks[i]->Fill(weight, v.xError() * cmToUm); + yerrVsTrks[i]->Fill(weight, v.yError() * cmToUm); + zerrVsTrks[i]->Fill(weight, v.zError() * cmToUm); + + nans[i]->Fill(1., edm::isNotFinite(v.position().x()) * 1.); + nans[i]->Fill(2., edm::isNotFinite(v.position().y()) * 1.); + nans[i]->Fill(3., edm::isNotFinite(v.position().z()) * 1.); + + int index = 3; + for (int k = 0; k != 3; k++) { + for (int j = k; j != 3; j++) { + index++; + nans[i]->Fill(index * 1., edm::isNotFinite(v.covariance(k, j)) * 1.); + // in addition, diagonal element must be positive + if (j == k && v.covariance(k, j) < 0) { + nans[i]->Fill(index * 1., 1.); + } + } + } + } +} + +template +T *GeneralPurposeVertexAnalyzer::book(const Args &...args) const { + T *t = fs_->make(args...); + return t; +} + +// ------------ method called once each job just before starting event loop ------------ +void GeneralPurposeVertexAnalyzer::beginJob() { + nbvtx = book("vtxNbr", "Reconstructed Vertices in Event", 80, -0.5, 79.5); + nbgvtx = book("goodvtxNbr", "Reconstructed Good Vertices in Event", 80, -0.5, 79.5); + + nbtksinvtx[0] = book("otherVtxTrksNbr", "Reconstructed Tracks in Vertex (other Vtx)", 40, -0.5, 99.5); + ntracksVsZ[0] = + book("otherVtxTrksVsZ", "Reconstructed Tracks in Vertex (other Vtx) vs Z", 80, -20., 20., 0., 100., ""); + ntracksVsZ[0]->SetXTitle("z-bs"); + ntracksVsZ[0]->SetYTitle("#tracks"); + + score[0] = book("otherVtxScore", "sqrt(score) (other Vtx)", 100, 0., 400.); + trksWeight[0] = book("otherVtxTrksWeight", "Total weight of Tracks in Vertex (other Vtx)", 40, 0, 100.); + vtxchi2[0] = book("otherVtxChi2", "#chi^{2} (other Vtx)", 100, 0., 200.); + vtxndf[0] = book("otherVtxNdf", "ndof (other Vtx)", 100, 0., 200.); + vtxprob[0] = book("otherVtxProb", "#chi^{2} probability (other Vtx)", 100, 0., 1.); + nans[0] = book("otherVtxNans", "Illegal values for x,y,z,xx,xy,xz,yy,yz,zz (other Vtx)", 9, 0.5, 9.5); + + nbtksinvtx[1] = book("tagVtxTrksNbr", "Reconstructed Tracks in Vertex (tagged Vtx)", 100, -0.5, 99.5); + ntracksVsZ[1] = + book("tagVtxTrksVsZ", "Reconstructed Tracks in Vertex (tagged Vtx) vs Z", 80, -20., 20., 0., 100., ""); + ntracksVsZ[1]->SetXTitle("z-bs"); + ntracksVsZ[1]->SetYTitle("#tracks"); + + score[1] = book("tagVtxScore", "sqrt(score) (tagged Vtx)", 100, 0., 400.); + trksWeight[1] = book("tagVtxTrksWeight", "Total weight of Tracks in Vertex (tagged Vtx)", 100, 0, 100.); + vtxchi2[1] = book("tagVtxChi2", "#chi^{2} (tagged Vtx)", 100, 0., 200.); + vtxndf[1] = book("tagVtxNdf", "ndof (tagged Vtx)", 100, 0., 200.); + vtxprob[1] = book("tagVtxProb", "#chi^{2} probability (tagged Vtx)", 100, 0., 1.); + nans[1] = book("tagVtxNans", "Illegal values for x,y,z,xx,xy,xz,yy,yz,zz (tagged Vtx)", 9, 0.5, 9.5); + + xrec[0] = book("otherPosX", "Position x Coordinate (other Vtx)", 100, vposx_ - 0.1, vposx_ + 0.1); + yrec[0] = book("otherPosY", "Position y Coordinate (other Vtx)", 100, vposy_ - 0.1, vposy_ + 0.1); + zrec[0] = book("otherPosZ", "Position z Coordinate (other Vtx)", 100, -20., 20.); + xDiff[0] = book("otherDiffX", "X distance from BeamSpot (other Vtx)", 100, -500, 500); + yDiff[0] = book("otherDiffY", "Y distance from BeamSpot (other Vtx)", 100, -500, 500); + xerr[0] = book("otherErrX", "Uncertainty x Coordinate (other Vtx)", 100, 0., 100); + yerr[0] = book("otherErrY", "Uncertainty y Coordinate (other Vtx)", 100, 0., 100); + zerr[0] = book("otherErrZ", "Uncertainty z Coordinate (other Vtx)", 100, 0., 100); + xerrVsTrks[0] = book( + "otherErrVsWeightX", "Uncertainty x Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100); + yerrVsTrks[0] = book( + "otherErrVsWeightY", "Uncertainty y Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100); + zerrVsTrks[0] = book( + "otherErrVsWeightZ", "Uncertainty z Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100); + + xrec[1] = book("tagPosX", "Position x Coordinate (tagged Vtx)", 100, vposx_ - 0.1, vposx_ + 0.1); + yrec[1] = book("tagPosY", "Position y Coordinate (tagged Vtx)", 100, vposy_ - 0.1, vposy_ + 0.1); + zrec[1] = book("tagPosZ", "Position z Coordinate (tagged Vtx)", 100, -20., 20.); + xDiff[1] = book("tagDiffX", "X distance from BeamSpot (tagged Vtx)", 100, -500, 500); + yDiff[1] = book("tagDiffY", "Y distance from BeamSpot (tagged Vtx)", 100, -500, 500); + xerr[1] = book("tagErrX", "Uncertainty x Coordinate (tagged Vtx)", 100, 0., 100); + yerr[1] = book("tagErrY", "Uncertainty y Coordinate (tagged Vtx)", 100, 0., 100); + zerr[1] = book("tagErrZ", "Uncertainty z Coordinate (tagged Vtx)", 100, 0., 100); + xerrVsTrks[1] = book( + "tagErrVsWeightX", "Uncertainty x Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100); + yerrVsTrks[1] = book( + "tagErrVsWeightY", "Uncertainty y Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100); + zerrVsTrks[1] = book( + "tagErrVsWeightZ", "Uncertainty z Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100); + + type[0] = book("otherType", "Vertex type (other Vtx)", 3, -0.5, 2.5); + type[1] = book("tagType", "Vertex type (tagged Vtx)", 3, -0.5, 2.5); + + for (int i = 0; i < 2; ++i) { + type[i]->GetXaxis()->SetBinLabel(1, "Valid, real"); + type[i]->GetXaxis()->SetBinLabel(2, "Valid, fake"); + type[i]->GetXaxis()->SetBinLabel(3, "Invalid"); + } + + bsX = book("bsX", "BeamSpot x0", 100, vposx_ - 0.1, vposx_ + 0.1); + bsY = book("bsY", "BeamSpot y0", 100, vposy_ - 0.1, vposy_ + 0.1); + bsZ = book("bsZ", "BeamSpot z0", 100, -2., 2.); + bsSigmaZ = book("bsSigmaZ", "BeamSpot sigmaZ", 100, 0., 10.); + bsDxdz = book("bsDxdz", "BeamSpot dxdz", 100, -0.0003, 0.0003); + bsDydz = book("bsDydz", "BeamSpot dydz", 100, -0.0003, 0.0003); + bsBeamWidthX = book("bsBeamWidthX", "BeamSpot BeamWidthX", 100, 0., 100.); + bsBeamWidthY = book("bsBeamWidthY", "BeamSpot BeamWidthY", 100, 0., 100.); + bsType = book("bsType", "BeamSpot type", 4, -1.5, 2.5); + bsType->GetXaxis()->SetBinLabel(1, "Unknown"); + bsType->GetXaxis()->SetBinLabel(2, "Fake"); + bsType->GetXaxis()->SetBinLabel(3, "LHC"); + bsType->GetXaxis()->SetBinLabel(4, "Tracker"); + + // repeated strings in titles + std::string s_1 = "PV Tracks (p_{T} > 1 GeV)"; + std::string s_10 = "PV Tracks (p_{T} > 10 GeV)"; + + ntracks = book("ntracks", fmt::sprintf("number of %s", s_1).c_str(), tkNoBin_, tkNoMin_, tkNoMax_); + ntracks->SetXTitle(fmt::sprintf("Number of %s per Event", s_1).c_str()); + ntracks->SetYTitle("Number of Events"); + + weight = book("weight", fmt::sprintf("weight of %s", s_1).c_str(), 100, 0., 1.); + weight->SetXTitle(fmt::sprintf("weight of %s per Event", s_1).c_str()); + weight->SetYTitle("Number of Events"); + + sumpt = book("sumpt", fmt::sprintf("#Sum p_{T} of %s", s_1).c_str(), 100, -0.5, 249.5); + chi2ndf = book("chi2ndf", fmt::sprintf("%s #chi^{2}/ndof", s_1).c_str(), 100, 0., 20.); + chi2prob = book("chi2prob", fmt::sprintf("%s #chi^{2} probability", s_1).c_str(), 100, 0., 1.); + dxy = book("dxy", fmt::sprintf("%s d_{xy} (#mum)", s_1).c_str(), dxyBin_, dxyMin_, dxyMax_); + dxy2 = book("dxyzoom", fmt::sprintf("%s d_{xy} (#mum)", s_1).c_str(), dxyBin_, dxyMin_ / 5., dxyMax_ / 5.); + dxyErr = book("dxyErr", fmt::sprintf("%s d_{xy} error (#mum)", s_1).c_str(), 100, 0., 2000.); + dz = book("dz", fmt::sprintf("%s d_{z} (#mum)", s_1).c_str(), dzBin_, dzMin_, dzMax_); + dzErr = book("dzErr", fmt::sprintf("%s d_{z} error(#mum)", s_1).c_str(), 100, 0., 10000.); + + phi_pt1 = + book("phi_pt1", fmt::sprintf("%s #phi; PV tracks #phi;#tracks", s_1).c_str(), phiBin_, phiMin_, phiMax_); + eta_pt1 = + book("eta_pt1", fmt::sprintf("%s #eta; PV tracks #eta;#tracks", s_1).c_str(), etaBin_, etaMin_, etaMax_); + phi_pt10 = + book("phi_pt10", fmt::sprintf("%s #phi; PV tracks #phi;#tracks", s_10).c_str(), phiBin_, phiMin_, phiMax_); + eta_pt10 = + book("eta_pt10", fmt::sprintf("%s #phi; PV tracks #eta;#tracks", s_10).c_str(), etaBin_, etaMin_, etaMax_); + + dxyVsPhi_pt1 = book("dxyVsPhi_pt1", + fmt::sprintf("%s d_{xy} (#mum) VS track #phi", s_1).c_str(), + phiBin_, + phiMin_, + phiMax_, + dxyMin_, + dxyMax_); + dxyVsPhi_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #phi"); + dxyVsPhi_pt1->SetYTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)"); + + dzVsPhi_pt1 = book("dzVsPhi_pt1", + fmt::sprintf("%s d_{z} (#mum) VS track #phi", s_1).c_str(), + phiBin_, + phiMin_, + phiMax_, + dzMin_, + dzMax_); + dzVsPhi_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #phi"); + dzVsPhi_pt1->SetYTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)"); + + dxyVsEta_pt1 = book("dxyVsEta_pt1", + fmt::sprintf("%s d_{xy} (#mum) VS track #eta", s_1).c_str(), + etaBin_, + etaMin_, + etaMax_, + dxyMin_, + dxyMax_); + dxyVsEta_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #eta"); + dxyVsEta_pt1->SetYTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)"); + + dzVsEta_pt1 = book("dzVsEta_pt1", + fmt::sprintf("%s d_{z} (#mum) VS track #eta", s_1).c_str(), + etaBin_, + etaMin_, + etaMax_, + dzMin_, + dzMax_); + dzVsEta_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #eta"); + dzVsEta_pt1->SetYTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)"); + + dxyVsEtaVsPhi_pt1 = book("dxyVsEtaVsPhi_pt1", + fmt::sprintf("%s d_{xy} (#mum) VS track #eta VS track #phi", s_1).c_str(), + etaBin2D_, + etaMin_, + etaMax_, + phiBin2D_, + phiMin_, + phiMax_, + dxyMin_, + dxyMax_); + dxyVsEtaVsPhi_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #eta"); + dxyVsEtaVsPhi_pt1->SetYTitle("PV track (p_{T} > 1 GeV) #phi"); + dxyVsEtaVsPhi_pt1->SetZTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)"); + + dzVsEtaVsPhi_pt1 = book("dzVsEtaVsPhi_pt1", + fmt::sprintf("%s d_{z} (#mum) VS track #eta VS track #phi", s_1).c_str(), + etaBin2D_, + etaMin_, + etaMax_, + phiBin2D_, + phiMin_, + phiMax_, + dzMin_, + dzMax_); + dzVsEtaVsPhi_pt1->SetXTitle("PV track (p_{T} > 1 GeV) #eta"); + dzVsEtaVsPhi_pt1->SetYTitle("PV track (p_{T} > 1 GeV) #phi"); + dzVsEtaVsPhi_pt1->SetZTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)"); + + dxyVsPhi_pt10 = book("dxyVsPhi_pt10", + fmt::sprintf("%s d_{xy} (#mum) VS track #phi", s_10).c_str(), + phiBin_, + phiMin_, + phiMax_, + dxyMin_, + dxyMax_); + dxyVsPhi_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #phi"); + dxyVsPhi_pt10->SetYTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)"); + + dzVsPhi_pt10 = book("dzVsPhi_pt10", + fmt::sprintf("%s d_{z} (#mum) VS track #phi", s_10).c_str(), + phiBin_, + phiMin_, + phiMax_, + dzMin_, + dzMax_); + dzVsPhi_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #phi"); + dzVsPhi_pt10->SetYTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)"); + + dxyVsEta_pt10 = book("dxyVsEta_pt10", + fmt::sprintf("%s d_{xy} (#mum) VS track #eta", s_10).c_str(), + etaBin_, + etaMin_, + etaMax_, + dxyMin_, + dxyMax_); + dxyVsEta_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #eta"); + dxyVsEta_pt10->SetYTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)"); + + dzVsEta_pt10 = book("dzVsEta_pt10", + fmt::sprintf("%s d_{z} (#mum) VS track #eta", s_10).c_str(), + etaBin_, + etaMin_, + etaMax_, + dzMin_, + dzMax_); + dzVsEta_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #eta"); + dzVsEta_pt10->SetYTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)"); + + dxyVsEtaVsPhi_pt10 = book("dxyVsEtaVsPhi_pt10", + fmt::sprintf("%s d_{xy} (#mum) VS track #eta VS track #phi", s_10).c_str(), + etaBin2D_, + etaMin_, + etaMax_, + phiBin2D_, + phiMin_, + phiMax_, + dxyMin_, + dxyMax_); + dxyVsEtaVsPhi_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #eta"); + dxyVsEtaVsPhi_pt10->SetYTitle("PV track (p_{T} > 10 GeV) #phi"); + dxyVsEtaVsPhi_pt10->SetZTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)"); + + dzVsEtaVsPhi_pt10 = book("dzVsEtaVsPhi_pt10", + fmt::sprintf("%s d_{z} (#mum) VS track #eta VS track #phi", s_10).c_str(), + etaBin2D_, + etaMin_, + etaMax_, + phiBin2D_, + phiMin_, + phiMax_, + dzMin_, + dzMax_); + dzVsEtaVsPhi_pt10->SetXTitle("PV track (p_{T} > 10 GeV) #eta"); + dzVsEtaVsPhi_pt10->SetYTitle("PV track (p_{T} > 10 GeV) #phi"); + dzVsEtaVsPhi_pt10->SetZTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)"); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void GeneralPurposeVertexAnalyzer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + edm::ParameterSetDescription desc; + desc.add("ndof", 4); + desc.add("vertexLabel", edm::InputTag("offlinePrimaryVertices")); + desc.add("beamSpotLabel", edm::InputTag("offlineBeamSpot")); + desc.add("Xpos", 0.1); + desc.add("Ypos", 0.0); + desc.add("TkSizeBin", 100); + desc.add("TkSizeMin", 499.5); + desc.add("TkSizeMax", -0.5); + desc.add("DxyBin", 100); + desc.add("DxyMin", 5000.); + desc.add("DxyMax", -5000.); + desc.add("DzBin", 100); + desc.add("DzMin", -2000.0); + desc.add("DzMax", 2000.0); + desc.add("PhiBin", 32); + desc.add("PhiBin2D", 12); + desc.add("PhiMin", -M_PI); + desc.add("PhiMax", M_PI); + desc.add("EtaBin", 26); + desc.add("EtaBin2D", 8); + desc.add("EtaMin", -2.7); + desc.add("EtaMax", 2.7); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(GeneralPurposeVertexAnalyzer); diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py index 83bbb200c3796..e69951e1a799b 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py @@ -1,6 +1,7 @@ import math import json import os +from sys import version_info import FWCore.ParameterSet.Config as cms import FWCore.PythonUtilities.LumiList as LumiList @@ -26,7 +27,10 @@ # Read in AllInOne config in JSON format ################################################################### with open(options.config, "r") as configFile: - config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True) + if version_info.major == 2: + config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True) + else: + config = json.load(configFile) ################################################################### # Read filenames from given TXT file @@ -128,17 +132,17 @@ ################################################################### # The Di Muon Mass Validation module ################################################################### -from Alignment.OfflineValidation.diMuonValidation_cfi.py import diMuonValidation as _diMuonValidation +from Alignment.OfflineValidation.diMuonValidation_cfi import diMuonValidation as _diMuonValidation process.DiMuonMassValidation = _diMuonValidation.clone( TkTag = 'TrackRefitter', # mu mu mass Pair_mass_min = 80., Pair_mass_max = 120., Pair_mass_nbins = 80, - Pair_etaminpos = -1, - Pair_etamaxpos = 1, - Pair_etaminneg = -1, - Pair_etamaxneg = 1, + Pair_etaminpos = -2.4, + Pair_etamaxpos = 2.4, + Pair_etaminneg = -2.4, + Pair_etamaxneg = 2.4, # cosTheta CS Variable_CosThetaCS_xmin = -1., Variable_CosThetaCS_xmax = 1., diff --git a/Alignment/OfflineValidation/src/GeometryComparisonPlotter.cc b/Alignment/OfflineValidation/src/GeometryComparisonPlotter.cc index 45f95d0bfc55e..36df70af29971 100644 --- a/Alignment/OfflineValidation/src/GeometryComparisonPlotter.cc +++ b/Alignment/OfflineValidation/src/GeometryComparisonPlotter.cc @@ -154,8 +154,6 @@ GeometryComparisonPlotter::GeometryComparisonPlotter(TString tree_file_name, #endif // style - gROOT->Reset(); - data->SetMarkerSize(0.5); data->SetMarkerStyle(6); diff --git a/Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py b/Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py index ff4ba59b8cfef..8ec25c822b0ca 100644 --- a/Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py +++ b/Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py @@ -376,10 +376,33 @@ def switchClusterizerParameters(da): ################################################################### # The analysis module ################################################################### -process.myanalysis = cms.EDAnalyzer("GeneralPurposeTrackAnalyzer", - TkTag = cms.InputTag('FinalTrackRefitter'), - isCosmics = cms.bool(False) - ) +process.trackanalysis = cms.EDAnalyzer("GeneralPurposeTrackAnalyzer", + TkTag = cms.InputTag('FinalTrackRefitter'), + isCosmics = cms.bool(False)) + +process.vertexanalysis = cms.EDAnalyzer('GeneralPurposeVertexAnalyzer', + ndof = cms.int32(4), + vertexLabel = cms.InputTag('offlinePrimaryVerticesFromRefittedTrks'), + beamSpotLabel = cms.InputTag('offlineBeamSpot'), + Xpos = cms.double(0.1), + Ypos = cms.double(0), + TkSizeBin = cms.int32(100), + TkSizeMin = cms.double(499.5), + TkSizeMax = cms.double(-0.5), + DxyBin = cms.int32(100), + DxyMin = cms.double(5000), + DxyMax = cms.double(-5000), + DzBin = cms.int32(100), + DzMin = cms.double(-2000), + DzMax = cms.double(2000), + PhiBin = cms.int32(32), + PhiBin2D = cms.int32(12), + PhiMin = cms.double(-3.1415926535897931), + PhiMax = cms.double(3.1415926535897931), + EtaBin = cms.int32(26), + EtaBin2D = cms.int32(8), + EtaMin = cms.double(-2.7), + EtaMax = cms.double(2.7)) ################################################################### # The PV resolution module @@ -398,5 +421,6 @@ def switchClusterizerParameters(da): process.seqTrackselRefit + process.offlinePrimaryVerticesFromRefittedTrks + process.PrimaryVertexResolution + - process.myanalysis + process.trackanalysis + + process.vertexanalysis ) diff --git a/Alignment/TrackerAlignment/interface/AlignableStackDet.h b/Alignment/TrackerAlignment/interface/AlignableStackDet.h new file mode 100644 index 0000000000000..c5dd7f6d8608b --- /dev/null +++ b/Alignment/TrackerAlignment/interface/AlignableStackDet.h @@ -0,0 +1,37 @@ +#ifndef Alignment_TrackerAlignment_AlignableStackDet_H +#define Alignment_TrackerAlignment_AlignableStackDet_H + +/** \class AlignableStackDet + * An alignable for StackDets in the Phase-2 Outer Tracker detector, + * taking care of consistency with AlignableDet components. + * + * First implementation March 2022 + * \author Marco Musich, U. Pisa / INFN + * $Date: 2022/03/15 13:36:00 $ + * $Revision: 1.0 $ + */ + +#include "Alignment/CommonAlignment/interface/AlignableDet.h" +#include "Geometry/CommonDetUnit/interface/StackGeomDet.h" + +class AlignTransformErrorExtended; +class Bounds; +class StripGeomDetType; + +class AlignableStackDet : public AlignableDet { +public: + /// Constructor + AlignableStackDet(const StackGeomDet *geomDet); + /// reduntantly make destructor virtual + ~AlignableStackDet() override = default; + + /// first consistify with component detunits, then call method from AlignableDet + Alignments *alignments() const override; + +private: + /// make alignments consistent with daughters + void consistifyAlignments(); + const Plane theLowerDetSurface; +}; + +#endif diff --git a/Alignment/TrackerAlignment/interface/AlignableTrackerBuilder.h b/Alignment/TrackerAlignment/interface/AlignableTrackerBuilder.h index 9db3ee2b49f97..97338ec4bc204 100644 --- a/Alignment/TrackerAlignment/interface/AlignableTrackerBuilder.h +++ b/Alignment/TrackerAlignment/interface/AlignableTrackerBuilder.h @@ -49,6 +49,9 @@ class AlignableTrackerBuilder { void buildStripDetectorAlignable( const GeomDet*, int subdetId, Alignables& aliDets, Alignables& aliDetUnits, bool update = false); + void buildOuterTrackerDetectorAlignable( + const GeomDet*, int subdetId, Alignables& aliDets, Alignables& aliDetUnits, bool update = false); + /// Builds all composite Alignables for the tracker. The hierarchy and /// numbers of components are determined in TrackerAlignmentLevelBuilder. void buildAlignableComposites(bool update = false); @@ -56,6 +59,8 @@ class AlignableTrackerBuilder { void buildPixelDetector(AlignableTracker*); /// Builds the StripDetector by hand. void buildStripDetector(AlignableTracker*); + /// Builds the Phase-2 Outer Tracker Detector by hand. + void buildOuterTrackerDetector(AlignableTracker*); //========================== PRIVATE DATA =================================== //=========================================================================== diff --git a/Alignment/TrackerAlignment/python/Scenarios_cff.py b/Alignment/TrackerAlignment/python/Scenarios_cff.py index f9d5bc6e97e35..9e387c3400a36 100644 --- a/Alignment/TrackerAlignment/python/Scenarios_cff.py +++ b/Alignment/TrackerAlignment/python/Scenarios_cff.py @@ -3090,6 +3090,60 @@ def TECRing7Shift(shift): ), ) +MisalignmentScenario10MuPhase2 = MisalignmentScenarioSettings.clone( + setError = cms.bool(False), + scale = cms.double(0.01), # shifts in 100um + + P2PXBHalfBarrels = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + + P2OTBHalfBarrels = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + + P2PXECEndcaps = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + + P2OTECEndcaps = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + +) + +MisalignmentScenario10MuPixelPhase2 = MisalignmentScenarioSettings.clone( + setError = cms.bool(False), + scale = cms.double(0.01), # shifts in 100um + + P2PXBHalfBarrels = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + + P2PXECEndcaps = cms.PSet( + DetUnits = cms.PSet( + dYlocal = cms.double(0.1), + dXlocal = cms.double(0.1), + ), + ), + +) + MisalignmentScenario100Mu = MisalignmentScenarioSettings.clone( setError = cms.bool(False), scale = cms.double(0.01), # shifts in 100um diff --git a/Alignment/TrackerAlignment/src/AlignableStackDet.cc b/Alignment/TrackerAlignment/src/AlignableStackDet.cc new file mode 100644 index 0000000000000..a6d3b8ec84db9 --- /dev/null +++ b/Alignment/TrackerAlignment/src/AlignableStackDet.cc @@ -0,0 +1,54 @@ +/* + * $Date: 2011/09/05 16:59:07 $ + * $Revision: 1.9 $ + */ + +#include "Alignment/CommonAlignment/interface/AlignableSurface.h" +#include "Alignment/TrackerAlignment/interface/AlignableStackDet.h" +#include "CondFormats/Alignment/interface/AlignTransformErrorExtended.h" +#include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h" +#include "DataFormats/GeometryCommonDetAlgo/interface/AlignmentPositionError.h" +#include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h" +#include "DataFormats/GeometrySurface/interface/BoundPlane.h" +#include "DataFormats/GeometrySurface/interface/Bounds.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "Geometry/CommonDetUnit/interface/StackGeomDet.h" +#include + +AlignableStackDet::AlignableStackDet(const StackGeomDet* stackedDet) + : AlignableDet(stackedDet, true), // true: adding DetUnits + theLowerDetSurface(stackedDet->lowerDet()->surface()) { + // check order lower/upper + const Alignables units(this->components()); + if (units.size() != 2 || stackedDet->lowerDet()->geographicalId() != units[0]->geomDetId() || + stackedDet->upperDet()->geographicalId() != units[1]->geomDetId()) { + throw cms::Exception("LogicError") << "[AlignableStackDet] " + << "Either != 2 components or " + << "upper/lower in wrong order for consistifyAlignments."; + } +} + +//__________________________________________________________________________________________________ +Alignments* AlignableStackDet::alignments() const { + const_cast(this)->consistifyAlignments(); + return this->AlignableDet::alignments(); +} + +//__________________________________________________________________________________________________ +void AlignableStackDet::consistifyAlignments() { + // Now we have all to calculate new position and rotation via PlaneBuilderForGluedDet. + const PositionType oldPos(theSurface.position()); // From old surface for keeping... + const RotationType oldRot(theSurface.rotation()); // ...track of changes. + + // The plane is *not* built in the middle, but on the Lower surface + // see usage in Geometry/TrackerGeometryBuilder/src/TrackerGeomBuilderFromGeometricDet.cc + theSurface = AlignableSurface(theLowerDetSurface); + + // But do not forget to keep track of movements/rotations: + const GlobalVector movement(theSurface.position().basicVector() - oldPos.basicVector()); + // Seems to be correct down to delta angles 4.*1e-8: + const RotationType rotation(oldRot.multiplyInverse(theSurface.rotation())); + this->addDisplacement(movement); + this->addRotation(rotation); +} diff --git a/Alignment/TrackerAlignment/src/AlignableTrackerBuilder.cc b/Alignment/TrackerAlignment/src/AlignableTrackerBuilder.cc index de9c47766e6bd..ad2bbbc8aceac 100644 --- a/Alignment/TrackerAlignment/src/AlignableTrackerBuilder.cc +++ b/Alignment/TrackerAlignment/src/AlignableTrackerBuilder.cc @@ -6,12 +6,14 @@ // geometry #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h" +#include "Geometry/CommonTopologies/interface/StackGeomDet.h" // alignment #include "Alignment/CommonAlignment/interface/AlignableObjectId.h" #include "Alignment/CommonAlignment/interface/AlignableDetUnit.h" #include "Alignment/CommonAlignment/interface/AlignableCompositeBuilder.h" #include "Alignment/TrackerAlignment/interface/AlignableSiStripDet.h" +#include "Alignment/TrackerAlignment/interface/AlignableStackDet.h" #include "Alignment/TrackerAlignment/interface/TrackerAlignableIndexer.h" #include "DataFormats/SiStripDetId/interface/SiStripDetId.h" @@ -63,8 +65,15 @@ void AlignableTrackerBuilder ::buildAlignables(AlignableTracker* trackerAlignabl // create pixel-detector buildPixelDetector(trackerAlignables); - // create strip-detector - buildStripDetector(trackerAlignables); + + // for the Outer Tracker, decide which geometry we are addressing + if (alignableObjectId_.geometry() < AlignableObjectId::Geometry::PhaseII) { + // create strip-detector + buildStripDetector(trackerAlignables); + } else { + // create Phase2 Outer Tracker-detector + buildOuterTrackerDetector(trackerAlignables); + } // tracker itself is of course also an Alignable alignableMap_->get("Tracker").push_back(trackerAlignables); @@ -123,7 +132,12 @@ void AlignableTrackerBuilder ::convertGeomDetsToAlignables(const TrackingGeometr subdetId == SiStripDetId::TEC) { // for strip we create also ModuleUnit list // for 1D components of 2D layers - buildStripDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update); + + if (alignableObjectId_.geometry() < AlignableObjectId::Geometry::PhaseII) { + buildStripDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update); + } else { + buildOuterTrackerDetectorAlignable(geomDet, subdetId, alignables, aliUnits, update); + } } else { throw cms::Exception("LogicError") << "[AlignableTrackerBuilder] GeomDet of unknown subdetector"; @@ -236,6 +250,52 @@ void AlignableTrackerBuilder ::buildStripDetectorAlignable( // AlignableSiStripDet -> AlignableDet, see above } +//_____________________________________________________________________________ +void AlignableTrackerBuilder ::buildOuterTrackerDetectorAlignable( + const GeomDet* geomDet, int subdetId, Alignables& aliDets, Alignables& aliDetUnits, bool update) { + // hopefully all the geomdets are composite (either PS or SS modules in Ph-2 Outer Tracker) + if (!geomDet->components().empty()) { + // 2D-module, convert it to StackGeomDet + const StackGeomDet* stackGeomDet = dynamic_cast(geomDet); + if (!stackGeomDet) { + throw cms::Exception("LogicError") << "[AlignableTrackerBuilder] dynamic_cast " + << "failed."; + } + + // components (AlignableDetUnits) constructed within + if (update) { + auto ali = std::find_if(aliDets.cbegin(), aliDets.cend(), [&stackGeomDet](const auto& i) { + return i->id() == stackGeomDet->geographicalId().rawId(); + }); + if (ali != aliDets.end()) { + auto aliStackDet = dynamic_cast(*ali); + if (aliStackDet) { + aliStackDet->update(geomDet); + } else { + throw cms::Exception("LogicError") << "[AlignableTrackerBuilder::buildOuterTrackerDetectorAlignable] " + << "cast to 'AlignableStackDet*' failed while it should not\n"; + } + } else { + throw cms::Exception("GeometryMismatch") + << "[AlignableTrackerBuilder::buildStripDetectorAlignable] " + << "GeomDet with DetId " << stackGeomDet->geographicalId().rawId() << " not found in current geometry.\n"; + } + } else { + aliDets.push_back(new AlignableStackDet(stackGeomDet)); + } + const auto& addAliDetUnits = aliDets.back()->components(); + const auto& nAddedUnits = addAliDetUnits.size(); + + if (!update) { + // reserve space for the additional units: + aliDetUnits.reserve(aliDetUnits.size() + nAddedUnits - 1); + aliDetUnits.insert(aliDetUnits.end(), addAliDetUnits.begin(), addAliDetUnits.end()); + } + numDetUnits += nAddedUnits; + } // no else: stacked components of AlignableDet constructed within + // AlignableStackDet -> AlignableDet, see above +} + //_____________________________________________________________________________ void AlignableTrackerBuilder ::buildAlignableComposites(bool update) { unsigned int numCompositeAlignables = 0; @@ -316,3 +376,25 @@ void AlignableTrackerBuilder ::buildStripDetector(AlignableTracker* trackerAlign << " of " << tibName << ", " << tidName << ", " << tobName << " and " << tecName; } + +//_____________________________________________________________________________ +void AlignableTrackerBuilder ::buildOuterTrackerDetector(AlignableTracker* trackerAlignables) { + const std::string& tidName = alignableObjectId_.idToString(align::TIDEndcap); + const std::string& tobName = alignableObjectId_.idToString(align::TOBBarrel); + const std::string& stripName = alignableObjectId_.idToString(align::Strip); + + auto& tidAlignables = alignableMap_->find(tidName); + auto& tobAlignables = alignableMap_->find(tobName); + auto& stripAlignables = alignableMap_->get(stripName); + + stripAlignables.push_back(new AlignableComposite(tobAlignables[0]->id(), align::Strip, align::RotationType())); + stripAlignables[0]->addComponent(tobAlignables[0]); + stripAlignables[0]->addComponent(tidAlignables[0]); + stripAlignables[0]->addComponent(tidAlignables[1]); + + trackerAlignables->addComponent(stripAlignables[0]); + + edm::LogInfo("AlignableBuildProcess") << "@SUB=AlignableTrackerBuilder::buildStripDetector" + << "Built " << stripName << "-detector Alignable, consisting of Alignables" + << " of " << tidName << " and " << tobName; +} diff --git a/Alignment/TrackerAlignment/test/BuildFile.xml b/Alignment/TrackerAlignment/test/BuildFile.xml index d2ce844fc57ba..9970bae1b9fa0 100644 --- a/Alignment/TrackerAlignment/test/BuildFile.xml +++ b/Alignment/TrackerAlignment/test/BuildFile.xml @@ -26,3 +26,4 @@ + diff --git a/Alignment/TrackerAlignment/test/Misalignments/createRandomlyMisalignedGeometry_Phase2_cfg.py b/Alignment/TrackerAlignment/test/Misalignments/createRandomlyMisalignedGeometry_Phase2_cfg.py new file mode 100644 index 0000000000000..a43aeacdda74c --- /dev/null +++ b/Alignment/TrackerAlignment/test/Misalignments/createRandomlyMisalignedGeometry_Phase2_cfg.py @@ -0,0 +1,142 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +import copy, sys, os + +process = cms.Process("Misaligner") + +################################################################### +# Setup 'standard' options +################################################################### +options = VarParsing.VarParsing() + +options.register('myScenario', + "MisalignmentScenario10MuPixelPhase2", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "scenario to apply") + +options.register('mySigma', + -1, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.float, # string, int, or float + "sigma for random misalignment in um") + +options.register('inputDB', + None, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "input database file to override GT (optional)") + +options.parseArguments() + +################################################################### +# Message logger service +################################################################### +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cout = cms.untracked.PSet( + threshold = cms.untracked.string('INFO'), + default = cms.untracked.PSet( + limit = cms.untracked.int32(10000000) + ) +) +# replace MessageLogger.debugModules = { "*" } +# service = Tracer {} + +################################################################### +# Ideal geometry producer and standard includes +################################################################### +process.load('Configuration.Geometry.GeometryExtended2026D88Reco_cff') +process.trackerGeometry.applyAlignment = True + +################################################################### +# Just state the Global Tag (and pick some run) +################################################################### +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') # using realistic Phase 2 geom +print("Using global tag:", process.GlobalTag.globaltag.value()) + +################################################################### +# This uses the object from the tag and applies the misalignment scenario on top of that object +################################################################### +process.load("Alignment.CommonAlignmentProducer.AlignmentProducer_cff") +process.AlignmentProducer.doMisalignmentScenario=True +process.AlignmentProducer.applyDbAlignment=True +process.AlignmentProducer.checkDbAlignmentValidity=False #otherwise error thrown for IOV dependent GTs +import Alignment.TrackerAlignment.Scenarios_cff as scenarios + +if hasattr(scenarios, options.myScenario): + print("Using scenario:", options.myScenario) + print(" with sigma:", options.mySigma) + print() + process.AlignmentProducer.MisalignmentScenario = getattr(scenarios, options.myScenario) +else: + print("----- Begin Fatal Exception -----------------------------------------------") + print("Unrecognized",options.myScenario,"misalignment scenario !!!!") + print("Aborting cmsRun now, please check your input") + print("----- End Fatal Exception -------------------------------------------------") + sys.exit(1) + +sigma = options.mySigma +if sigma > 0: + process.AlignmentProducer.MisalignmentScenario.scale = cms.double(0.0001*sigma) # shifts are in cm + +# if options.inputDB is not None: +# print("EXTENDING THE GLOBAL TAG!!!!") +# process.GlobalTag.toGet.extend([ +# cms.PSet( +# connect = cms.string("sqlite_file:"+options.inputDB), +# record = cms.string("TrackerAlignmentRcd"), +# tag = cms.string("Alignments") +# ), +# cms.PSet( +# connect = cms.string("sqlite_file:"+options.inputDB), +# record = cms.string("TrackerAlignmentErrorExtendedRcd"), +# tag = cms.string("AlignmentErrorsExtended") +# ) +# ]) + +process.AlignmentProducer.saveToDB=True +process.AlignmentProducer.saveApeToDB=True + +################################################################### +# Output name +################################################################### +outputfilename = None +scenariolabel = str(options.myScenario) +if sigma > 0: + scenariolabel = scenariolabel+str(sigma) +outputfilename = "geometry_"+str(scenariolabel)+"__from_" +if options.inputDB is None: + outputfilename += process.GlobalTag.globaltag.value()+".db" +else: + outputfilename += options.inputDB + +################################################################### +# Source +################################################################### +process.source = cms.Source("EmptySource") +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +################################################################### +# Database output service +################################################################### +from CondCore.CondDB.CondDB_cfi import * +process.PoolDBOutputService = cms.Service( + "PoolDBOutputService", + CondDB, + timetype = cms.untracked.string("runnumber"), + toPut = cms.VPSet( + cms.PSet( + record = cms.string("TrackerAlignmentRcd"), + tag = cms.string("Alignments") + ), + cms.PSet( + record = cms.string("TrackerAlignmentErrorExtendedRcd"), + tag = cms.string("AlignmentErrorsExtended") + ), + ) + ) +process.PoolDBOutputService.connect = "sqlite_file:"+outputfilename +process.PoolDBOutputService.DBParameters.messageLevel = 2 diff --git a/Alignment/TrackerAlignment/test/testCreateRandomMisalignment.sh b/Alignment/TrackerAlignment/test/testCreateRandomMisalignment.sh new file mode 100755 index 0000000000000..6d6f3dc98a7bc --- /dev/null +++ b/Alignment/TrackerAlignment/test/testCreateRandomMisalignment.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function die { echo $1: status $2 ; exit $2; } +folder=$CMSSW_BASE/src/Alignment/TrackerAlignment/test/Misalignments + +for a in $(ls $folder); do + echo "running unit test: " ${a} + cmsRun $folder/${a} || die "Failure running ${a}" $? +done diff --git a/CUDADataFormats/SiStripCluster/BuildFile.xml b/CUDADataFormats/SiStripCluster/BuildFile.xml new file mode 100644 index 0000000000000..5e401d215c4eb --- /dev/null +++ b/CUDADataFormats/SiStripCluster/BuildFile.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/CUDADataFormats/SiStripCluster/interface/SiStripClustersCUDA.h b/CUDADataFormats/SiStripCluster/interface/SiStripClustersCUDA.h new file mode 100644 index 0000000000000..f64b8a533d513 --- /dev/null +++ b/CUDADataFormats/SiStripCluster/interface/SiStripClustersCUDA.h @@ -0,0 +1,59 @@ +#ifndef CUDADataFormats_SiStripCluster_interface_SiStripClustersCUDA_h +#define CUDADataFormats_SiStripCluster_interface_SiStripClustersCUDA_h + +#include "DataFormats/SiStripCluster/interface/SiStripClustersSOABase.h" +#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCompat.h" + +#include + +class SiStripClustersCUDADevice : public SiStripClustersSOABase { +public: + SiStripClustersCUDADevice() = default; + explicit SiStripClustersCUDADevice(uint32_t maxClusters, uint32_t maxStripsPerCluster, cudaStream_t stream); + ~SiStripClustersCUDADevice() override = default; + + SiStripClustersCUDADevice(const SiStripClustersCUDADevice &) = delete; + SiStripClustersCUDADevice &operator=(const SiStripClustersCUDADevice &) = delete; + SiStripClustersCUDADevice(SiStripClustersCUDADevice &&) = default; + SiStripClustersCUDADevice &operator=(SiStripClustersCUDADevice &&) = default; + + struct DeviceView { + uint32_t *clusterIndex_; + uint32_t *clusterSize_; + uint8_t *clusterADCs_; + stripgpu::detId_t *clusterDetId_; + stripgpu::stripId_t *firstStrip_; + bool *trueCluster_; + float *barycenter_; + float *charge_; + uint32_t nClusters_; + uint32_t maxClusterSize_; + }; + + DeviceView *view() const { return view_d.get(); } + uint32_t nClusters() const { return nClusters_; } + uint32_t *nClustersPtr() { return &nClusters_; } + uint32_t maxClusterSize() const { return maxClusterSize_; } + uint32_t *maxClusterSizePtr() { return &maxClusterSize_; } + +private: + cms::cuda::device::unique_ptr view_d; // "me" pointer + uint32_t nClusters_; + uint32_t maxClusterSize_; +}; + +class SiStripClustersCUDAHost : public SiStripClustersSOABase { +public: + SiStripClustersCUDAHost() = default; + explicit SiStripClustersCUDAHost(const SiStripClustersCUDADevice &clusters_d, cudaStream_t stream); + ~SiStripClustersCUDAHost() override = default; + + SiStripClustersCUDAHost(const SiStripClustersCUDAHost &) = delete; + SiStripClustersCUDAHost &operator=(const SiStripClustersCUDAHost &) = delete; + SiStripClustersCUDAHost(SiStripClustersCUDAHost &&) = default; + SiStripClustersCUDAHost &operator=(SiStripClustersCUDAHost &&) = default; +}; + +#endif diff --git a/CUDADataFormats/SiStripCluster/src/SiStripClustersCUDA.cc b/CUDADataFormats/SiStripCluster/src/SiStripClustersCUDA.cc new file mode 100644 index 0000000000000..220456760476a --- /dev/null +++ b/CUDADataFormats/SiStripCluster/src/SiStripClustersCUDA.cc @@ -0,0 +1,59 @@ +#include "CUDADataFormats/SiStripCluster/interface/SiStripClustersCUDA.h" +#include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h" + +SiStripClustersCUDADevice::SiStripClustersCUDADevice(uint32_t maxClusters, + uint32_t maxStripsPerCluster, + cudaStream_t stream) { + maxClusterSize_ = maxStripsPerCluster; + + clusterIndex_ = cms::cuda::make_device_unique(maxClusters, stream); + clusterSize_ = cms::cuda::make_device_unique(maxClusters, stream); + clusterADCs_ = cms::cuda::make_device_unique(maxClusters * maxStripsPerCluster, stream); + clusterDetId_ = cms::cuda::make_device_unique(maxClusters, stream); + firstStrip_ = cms::cuda::make_device_unique(maxClusters, stream); + trueCluster_ = cms::cuda::make_device_unique(maxClusters, stream); + barycenter_ = cms::cuda::make_device_unique(maxClusters, stream); + charge_ = cms::cuda::make_device_unique(maxClusters, stream); + + auto view = cms::cuda::make_host_unique(stream); + view->clusterIndex_ = clusterIndex_.get(); + view->clusterSize_ = clusterSize_.get(); + view->clusterADCs_ = clusterADCs_.get(); + view->clusterDetId_ = clusterDetId_.get(); + view->firstStrip_ = firstStrip_.get(); + view->trueCluster_ = trueCluster_.get(); + view->barycenter_ = barycenter_.get(); + view->charge_ = charge_.get(); + view->maxClusterSize_ = maxStripsPerCluster; + + view_d = cms::cuda::make_device_unique(stream); + cms::cuda::copyAsync(view_d, view, stream); +#ifdef GPU_CHECK + cudaCheck(cudaStreamSynchronize(stream)); +#endif +} + +SiStripClustersCUDAHost::SiStripClustersCUDAHost(const SiStripClustersCUDADevice& clusters_d, cudaStream_t stream) { + nClusters_ = clusters_d.nClusters(); + maxClusterSize_ = clusters_d.maxClusterSize(); + clusterIndex_ = cms::cuda::make_host_unique(nClusters_, stream); + clusterSize_ = cms::cuda::make_host_unique(nClusters_, stream); + clusterADCs_ = cms::cuda::make_host_unique(nClusters_ * maxClusterSize_, stream); + clusterDetId_ = cms::cuda::make_host_unique(nClusters_, stream); + firstStrip_ = cms::cuda::make_host_unique(nClusters_, stream); + trueCluster_ = cms::cuda::make_host_unique(nClusters_, stream); + barycenter_ = cms::cuda::make_host_unique(nClusters_, stream); + charge_ = cms::cuda::make_host_unique(nClusters_, stream); + + cms::cuda::copyAsync(clusterIndex_, clusters_d.clusterIndex(), nClusters_, stream); + cms::cuda::copyAsync(clusterSize_, clusters_d.clusterSize(), nClusters_, stream); + cms::cuda::copyAsync(clusterADCs_, clusters_d.clusterADCs(), nClusters_ * maxClusterSize_, stream); + cms::cuda::copyAsync(clusterDetId_, clusters_d.clusterDetId(), nClusters_, stream); + cms::cuda::copyAsync(firstStrip_, clusters_d.firstStrip(), nClusters_, stream); + cms::cuda::copyAsync(trueCluster_, clusters_d.trueCluster(), nClusters_, stream); + cms::cuda::copyAsync(barycenter_, clusters_d.barycenter(), nClusters_, stream); + cms::cuda::copyAsync(charge_, clusters_d.charge(), nClusters_, stream); +#ifdef GPU_CHECK + cudaCheck(cudaStreamSynchronize(stream)); +#endif +} diff --git a/CUDADataFormats/SiStripCluster/src/classes.h b/CUDADataFormats/SiStripCluster/src/classes.h new file mode 100644 index 0000000000000..b38f397dee067 --- /dev/null +++ b/CUDADataFormats/SiStripCluster/src/classes.h @@ -0,0 +1,8 @@ +#ifndef CUDADataFormats_SiStripCluster_classes_h +#define CUDADataFormats_SiStripCluster_classes_h + +#include "CUDADataFormats/Common/interface/Product.h" +#include "CUDADataFormats/SiStripCluster/interface/SiStripClustersCUDA.h" +#include "DataFormats/Common/interface/Wrapper.h" + +#endif diff --git a/CUDADataFormats/SiStripCluster/src/classes_def.xml b/CUDADataFormats/SiStripCluster/src/classes_def.xml new file mode 100644 index 0000000000000..3c2f3ab27c620 --- /dev/null +++ b/CUDADataFormats/SiStripCluster/src/classes_def.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/CalibCalorimetry/CaloTPG/python/CaloTPGTranscoder_cfi.py b/CalibCalorimetry/CaloTPG/python/CaloTPGTranscoder_cfi.py index 97fabf22b150b..2305916826f35 100644 --- a/CalibCalorimetry/CaloTPG/python/CaloTPGTranscoder_cfi.py +++ b/CalibCalorimetry/CaloTPG/python/CaloTPGTranscoder_cfi.py @@ -1,16 +1,6 @@ import FWCore.ParameterSet.Config as cms -tpScales = cms.PSet( - HF=cms.PSet( - NCTShift=cms.int32(1), - RCTShift=cms.int32(3), - ), - HBHE=cms.PSet( - LSBQIE8=cms.double(1/8.), - LSBQIE11=cms.double(1/16.), - LSBQIE11Overlap=cms.double(1/8.), - ) -) +from CalibCalorimetry.CaloTPG.tpScales_cff import tpScales CaloTPGTranscoder = cms.ESProducer("CaloTPGTranscoderULUTs", hcalLUT1 = cms.FileInPath('CalibCalorimetry/CaloTPG/data/outputLUTtranscoder_physics.dat'), @@ -26,3 +16,6 @@ RCTLSB = cms.double(0.25), tpScales = tpScales, ) + +from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018 +run2_HCAL_2018.toModify(CaloTPGTranscoder, linearLUTs=True) diff --git a/CalibCalorimetry/CaloTPG/python/tpScales_cff.py b/CalibCalorimetry/CaloTPG/python/tpScales_cff.py new file mode 100644 index 0000000000000..005a3b160c2a8 --- /dev/null +++ b/CalibCalorimetry/CaloTPG/python/tpScales_cff.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms + +tpScales = cms.PSet( + HF=cms.PSet( + NCTShift=cms.int32(1), + RCTShift=cms.int32(3), + ), + HBHE=cms.PSet( + LSBQIE8=cms.double(1/8.), + LSBQIE11=cms.double(1/16.), + LSBQIE11Overlap=cms.double(1/8.), + ) +) + +from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 +run2_HF_2017.toModify(tpScales.HF, NCTShift=2) + +from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +run3_HB.toModify(tpScales.HBHE, LSBQIE11Overlap=1/16.) diff --git a/CalibCalorimetry/EcalLaserSorting/test/RunStreamer.sh b/CalibCalorimetry/EcalLaserSorting/test/RunStreamer.sh index 453f41854ac8f..f404bfdc23298 100755 --- a/CalibCalorimetry/EcalLaserSorting/test/RunStreamer.sh +++ b/CalibCalorimetry/EcalLaserSorting/test/RunStreamer.sh @@ -9,6 +9,13 @@ echo "LOCAL_TEST_DIR = $SCRAM_TEST_PATH" RC=0 +mkdir inDir +cmsRun ${SCRAM_TEST_PATH}/streamOutPadding_cfg.py > outp 2>&1 || die "cmsRun streamOutPadding_cfg.py" $? +cp teststreamfile.dat teststreamfile.padding +mv teststreamfile.dat inDir/ +timeout --signal SIGTERM 180 cmsRun ${SCRAM_TEST_PATH}/streamIn_cfg.py > inp 2>&1 || die "cmsRun streamIn_cfg.py" $? +rm -rf inDir + mkdir inDir cmsRun ${SCRAM_TEST_PATH}/streamOut_cfg.py > out 2>&1 || die "cmsRun streamOut_cfg.py" $? cp teststreamfile.dat teststreamfile.original @@ -36,6 +43,10 @@ ANS_OUT_SIZE=`grep -c CHECKSUM out` ANS_OUT=`grep CHECKSUM out` ANS_IN=`grep CHECKSUM in` +ANS_OUTP_SIZE=`grep -c CHECKSUM outp` +ANS_OUTP=`grep CHECKSUM outp` +ANS_INP=`grep CHECKSUM inp` + if [ "${ANS_OUT_SIZE}" == "0" ] then echo "New Stream Test Failed (out was not created)" @@ -48,4 +59,16 @@ then RC=1 fi +if [ "${ANS_OUTP_SIZE}" == "0" ] +then + echo "New Stream Test Failed (out was not created)" + RC=1 +fi + +if [ "${ANS_OUTP}" != "${ANS_INP}" ] +then + echo "New Stream Test Failed (out!=in)" + RC=1 +fi + exit ${RC} diff --git a/CalibCalorimetry/EcalLaserSorting/test/streamOutPadding_cfg.py b/CalibCalorimetry/EcalLaserSorting/test/streamOutPadding_cfg.py new file mode 100644 index 0000000000000..72b0bba5cfce2 --- /dev/null +++ b/CalibCalorimetry/EcalLaserSorting/test/streamOutPadding_cfg.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +options = VarParsing.VarParsing('analysis') + +options.register ('compAlgo', + 'ZLIB', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Compression Algorithm") + +options.parseArguments() + + +process = cms.Process("HLT") + +import FWCore.Framework.test.cmsExceptionsFatal_cff +process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options + +process.load("FWCore.MessageLogger.MessageLogger_cfi") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(50) +) + +process.source = cms.Source("EmptySource", + firstEvent = cms.untracked.uint64(10123456789) +) + +process.m1 = cms.EDProducer("StreamThingProducer", + instance_count = cms.int32(5), + array_size = cms.int32(2) +) + +process.m2 = cms.EDProducer("NonProducer") + +process.a1 = cms.EDAnalyzer("StreamThingAnalyzer", + product_to_get = cms.string('m1') +) + +process.out = cms.OutputModule("EventStreamFileWriter", + fileName = cms.untracked.string('teststreamfile.dat'), + padding = cms.untracked.uint32(4096), + compression_level = cms.untracked.int32(1), + use_compression = cms.untracked.bool(True), + compression_algorithm = cms.untracked.string(options.compAlgo), + max_event_size = cms.untracked.int32(7000000) +) + +process.p1 = cms.Path(process.m1*process.a1*process.m2) +process.end = cms.EndPath(process.out) diff --git a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h index 0f9e0c6f9b804..7c8e8b322b140 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h +++ b/CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h @@ -107,6 +107,9 @@ #include "CondFormats/EcalObjects/interface/EcalSamplesCorrelation.h" #include "CondFormats/DataRecord/interface/EcalSamplesCorrelationRcd.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" +#include "CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h" + #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" #include "CondFormats/DataRecord/interface/EcalSimPulseShapeRcd.h" @@ -144,6 +147,8 @@ class EcalTrivialConditionRetriever : public edm::ESProducer, public edm::EventS const EcalIntercalibConstantsRcd&); virtual std::unique_ptr getIntercalibConstantsMCFromConfiguration( const EcalIntercalibConstantsMCRcd&); + virtual std::unique_ptr getEcalSimComponentShapeFromConfiguration( + const EcalSimComponentShapeRcd&); virtual std::unique_ptr getEcalSimPulseShapeFromConfiguration(const EcalSimPulseShapeRcd&); virtual std::unique_ptr getIntercalibErrorsFromConfiguration(const EcalIntercalibErrorsRcd&); virtual std::unique_ptr getTimeCalibConstantsFromConfiguration( @@ -349,6 +354,7 @@ class EcalTrivialConditionRetriever : public edm::ESProducer, public edm::EventS std::string EBSimPulseShapeFile_; std::string EESimPulseShapeFile_; std::string APDSimPulseShapeFile_; + std::vector EBSimComponentShapeFiles_; int nTDCbins_; @@ -381,12 +387,14 @@ class EcalTrivialConditionRetriever : public edm::ESProducer, public edm::EventS bool producedEcalAlignmentEB_; bool producedEcalAlignmentEE_; bool producedEcalAlignmentES_; + bool producedEcalSimComponentShape_; bool producedEcalSimPulseShape_; bool producedEcalPFRecHitThresholds_; bool getEBAlignmentFromFile_; bool getEEAlignmentFromFile_; bool getESAlignmentFromFile_; + bool getSimComponentShapeFromFile_; bool getSimPulseShapeFromFile_; bool getLaserAlphaFromFileEB_; diff --git a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialConditionRetriever.cc b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialConditionRetriever.cc index 7f5417392a83e..838d1f8b39b8b 100644 --- a/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialConditionRetriever.cc +++ b/CalibCalorimetry/EcalTrivialCondModules/src/EcalTrivialConditionRetriever.cc @@ -341,6 +341,18 @@ other solution : change this dataPath name to work directly in afs, ex. : findingRecord(); } + // sim component shape + getSimComponentShapeFromFile_ = ps.getUntrackedParameter("getSimComponentShapeFromFile", false); + producedEcalSimComponentShape_ = ps.getUntrackedParameter("producedEcalSimComponentShape", true); + std::vector vComponentShapes; + EBSimComponentShapeFiles_ = + ps.getUntrackedParameter >("EBSimComponentShapeFiles", vComponentShapes); + + if (producedEcalSimComponentShape_) { // user asks to produce constants + setWhatProduced(this, &EcalTrivialConditionRetriever::getEcalSimComponentShapeFromConfiguration); + findingRecord(); + } + // sim pulse shape getSimPulseShapeFromFile_ = ps.getUntrackedParameter("getSimPulseShapeFromFile", false); producedEcalSimPulseShape_ = ps.getUntrackedParameter("producedEcalSimPulseShape", true); @@ -3544,3 +3556,37 @@ std::unique_ptr EcalTrivialConditionRetriever::getEcalSimPuls return result; } + +std::unique_ptr EcalTrivialConditionRetriever::getEcalSimComponentShapeFromConfiguration( + const EcalSimComponentShapeRcd&) { + auto result = std::make_unique(); + + // save time interval to be used for the pulse shape + result->time_interval = sim_pulse_shape_TI_; + + // containers to store the shape info + std::vector > EBshapes; + + // --- get the shapes from the user provided txt files + if (!EBSimComponentShapeFiles_.empty()) { + int iShape(0); + for (auto filename : EBSimComponentShapeFiles_) { + std::ifstream shapeEBFile; + EBshapes.emplace_back(); + shapeEBFile.open(EBSimComponentShapeFiles_[iShape].c_str()); + float ww; + while (shapeEBFile >> ww) + EBshapes[iShape].push_back(ww); + shapeEBFile.close(); + ++iShape; + } + } + + // --- save threshold + result->barrel_thresh = sim_pulse_shape_EB_thresh_; + + // --- copy + copy(EBshapes.begin(), EBshapes.end(), back_inserter(result->barrel_shapes)); + + return result; +} diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h b/CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h index 1eb1f37912a27..6f9ebf98753a7 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h @@ -20,6 +20,8 @@ Text file formats for different data types is as following: - # in first column comments the line - HcalPedestals, HcalGains, HcalGainWidths have identical formats: eta(int) phi(int) depth(int) det(HB,HE,HF) cap1_value(float) cap2_value(float) cap3_value(float) cap4_value(float) HcalDetId(int,optional) +- HcalPFCuts: + eta(int) phi(int) depth(int) det(HB,HE,HF) noiseThreshold(float) seedThreshold(float) - HcalPedestalWidths: eta(int) phi(int) depth(int) det(HB,HE,HF) sigma_1_1(float) sigma_2_1 sigma_2_2 sigma_3_1 sigma_3_2 sigma_3_3 sigma_4_1 sigma_4_2 sigma_4_3 sigma_4_4 - HcalQIEShape: @@ -67,6 +69,8 @@ namespace HcalDbASCIIIO { bool dumpObject(std::ostream& fOutput, const HcalGains& fObject); bool getObject(std::istream& fInput, HcalGainWidths* fObject); bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject); + bool getObject(std::istream& fInput, HcalPFCuts* fObject); + bool dumpObject(std::ostream& fOutput, const HcalPFCuts& fObject); bool getObject(std::istream& fInput, HcalQIEData* fObject); bool dumpObject(std::ostream& fOutput, const HcalQIEData& fObject); bool getObject(std::istream& fInput, HcalCalibrationQIEData* fObject); diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h b/CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h index c7d089820f74b..269812057cbe7 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h @@ -11,6 +11,7 @@ #include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h" #include "CondFormats/HcalObjects/interface/HcalGain.h" #include "CondFormats/HcalObjects/interface/HcalGainWidth.h" +#include "CondFormats/HcalObjects/interface/HcalPFCut.h" #include "CondFormats/HcalObjects/interface/HcalZSThreshold.h" #include "CondFormats/HcalObjects/interface/HcalQIECoder.h" #include "CondFormats/HcalObjects/interface/HcalQIEShape.h" @@ -100,6 +101,7 @@ class HcalDbHardcode { HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology* topo, double intlumi); HcalGain makeGain(HcalGenericDetId fId, bool fSmear = false) const; HcalGainWidth makeGainWidth(HcalGenericDetId fId) const; + HcalPFCut makePFCut(HcalGenericDetId fId) const; HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const; HcalQIECoder makeQIECoder(HcalGenericDetId fId) const; HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const; diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h b/CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h index 67e0e3075bd2f..3601f3731d1c5 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h @@ -10,6 +10,7 @@ class HcalHardcodeParameters { public: //default constructor HcalHardcodeParameters() {} + //construct from values HcalHardcodeParameters(double pedestal, double pedestalWidth, @@ -23,28 +24,33 @@ class HcalHardcodeParameters { int recoShape, double photoelectronsToAnalog, const std::vector& darkCurrent, - const std::vector& noiseCorrelation); + const std::vector& noiseCorrelation, + double noiseThreshold, + double seedThreshold); + //construct from pset HcalHardcodeParameters(const edm::ParameterSet& p); //destructor - virtual ~HcalHardcodeParameters() {} + inline virtual ~HcalHardcodeParameters() {} //accessors //note: all vector accessors use at() in order to throw exceptions for malformed conditions - const double pedestal() const { return pedestal_; } - const double pedestalWidth() const { return pedestalWidth_; } - const double gain(unsigned index) const { return gain_.at(index); } - const double gainWidth(unsigned index) const { return gainWidth_.at(index); } - const int zsThreshold() const { return zsThreshold_; } - const int qieType() const { return qieType_; } - const double qieOffset(unsigned range) const { return qieOffset_.at(range); } - const double qieSlope(unsigned range) const { return qieSlope_.at(range); } - const int mcShape() const { return mcShape_; } - const int recoShape() const { return recoShape_; } - const double photoelectronsToAnalog() const { return photoelectronsToAnalog_; } - const double darkCurrent(unsigned index, double intlumi) const; - const double noiseCorrelation(unsigned index) const; + inline double pedestal() const { return pedestal_; } + inline double pedestalWidth() const { return pedestalWidth_; } + inline double gain(unsigned index) const { return gain_.at(index); } + inline double gainWidth(unsigned index) const { return gainWidth_.at(index); } + inline int zsThreshold() const { return zsThreshold_; } + inline int qieType() const { return qieType_; } + inline double qieOffset(unsigned range) const { return qieOffset_.at(range); } + inline double qieSlope(unsigned range) const { return qieSlope_.at(range); } + inline int mcShape() const { return mcShape_; } + inline int recoShape() const { return recoShape_; } + inline double photoelectronsToAnalog() const { return photoelectronsToAnalog_; } + double darkCurrent(unsigned index, double intlumi) const; + double noiseCorrelation(unsigned index) const; + inline double noiseThreshold() const { return noiseThreshold_; } + inline double seedThreshold() const { return seedThreshold_; } private: //member variables @@ -59,6 +65,7 @@ class HcalHardcodeParameters { std::vector noiseCorrelation_; bool doSipmRadiationDamage_; HcalSiPMRadiationDamage sipmRadiationDamage_; + double noiseThreshold_, seedThreshold_; }; #endif diff --git a/CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc b/CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc index d07e1d1cdeef4..0fc0b2011448a 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc @@ -261,6 +261,48 @@ bool getHcalSingleObject(std::istream& fInput, T* fObject) { return true; } +template +bool dumpHcalDoubleFloatObject(std::ostream& fOutput, const T& fObject) { + char buffer[1024]; + sprintf(buffer, "# %15s %15s %15s %15s %10s %10s %10s\n", "eta", "phi", "dep", "det", "value0", "value1", "DetId"); + fOutput << buffer; + std::vector channels = fObject.getAllChannels(); + std::sort(channels.begin(), channels.end(), DetIdLess()); + for (std::vector::iterator channel = channels.begin(); channel != channels.end(); ++channel) { + const float value0 = fObject.getValues(*channel)->getValue0(); + const float value1 = fObject.getValues(*channel)->getValue1(); + HcalDbASCIIIO::dumpId(fOutput, *channel); + sprintf(buffer, " %10.7f %10.7f %10X\n", value0, value1, channel->rawId()); + fOutput << buffer; + } + return true; +} + +template +bool getHcalDoubleFloatObject(std::istream& fInput, T* fObject) { + if (!fObject) + return false; //fObject = new T; + char buffer[1024]; + while (fInput.getline(buffer, 1024)) { + if (buffer[0] == '#') + continue; //ignore comment + std::vector items = splitString(std::string(buffer)); + if (items.empty()) + continue; // blank line + if (items.size() < 6) { + edm::LogWarning("Format Error") << "Bad line: " << buffer + << "\n line must contain 6 items: eta, phi, depth, subdet, value0, value1" + << std::endl; + continue; + } + DetId id = HcalDbASCIIIO::getId(items); + S fCondObject(id, atof(items[4].c_str()), atof(items[5].c_str())); + fObject->addValues(fCondObject); + } + + return true; +} + template bool dumpHcalSingleFloatObject(std::ostream& fOutput, const T& fObject) { char buffer[1024]; @@ -389,6 +431,13 @@ namespace HcalDbASCIIIO { } bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject) { return dumpHcalObject(fOutput, fObject); } + bool getObject(std::istream& fInput, HcalPFCuts* fObject) { + return getHcalDoubleFloatObject(fInput, fObject); + } + bool dumpObject(std::ostream& fOutput, const HcalPFCuts& fObject) { + return dumpHcalDoubleFloatObject(fOutput, fObject); + } + bool getObject(std::istream& fInput, HcalRespCorrs* fObject) { return getHcalSingleObject(fInput, fObject); } diff --git a/CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc b/CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc index f9ad603674683..e37868d5e9e9d 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc @@ -29,7 +29,9 @@ HcalDbHardcode::HcalDbHardcode() 105, //Reco shape 0.0, //photoelectronsToAnalog {0.0}, //dark current - {0.0} //noise correlation + {0.0}, //noise correlation + 0.0, //PF noise threshold + 0.1 //PF seed threshold ), setHB_(false), setHE_(false), @@ -176,6 +178,13 @@ HcalGainWidth HcalDbHardcode::makeGainWidth(HcalGenericDetId fId) const { // Ge return result; } +HcalPFCut HcalDbHardcode::makePFCut(HcalGenericDetId fId) const { // GeV + float value0 = getParameters(fId).noiseThreshold(); + float value1 = getParameters(fId).seedThreshold(); + HcalPFCut result(fId.rawId(), value0, value1); + return result; +} + HcalZSThreshold HcalDbHardcode::makeZSThreshold(HcalGenericDetId fId) const { int value = getParameters(fId).zsThreshold(); HcalZSThreshold result(fId.rawId(), value); diff --git a/CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc b/CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc index ecc5937be7209..f6eef5a2bde5d 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc @@ -1,18 +1,20 @@ #include "CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h" -HcalHardcodeParameters::HcalHardcodeParameters(double pedestal, - double pedestalWidth, +HcalHardcodeParameters::HcalHardcodeParameters(const double pedestal, + const double pedestalWidth, const std::vector& gain, const std::vector& gainWidth, - int zsThreshold, - int qieType, + const int zsThreshold, + const int qieType, const std::vector& qieOffset, const std::vector& qieSlope, - int mcShape, - int recoShape, - double photoelectronsToAnalog, + const int mcShape, + const int recoShape, + const double photoelectronsToAnalog, const std::vector& darkCurrent, - const std::vector& noiseCorrelation) + const std::vector& noiseCorrelation, + const double noiseTh, + const double seedTh) : pedestal_(pedestal), pedestalWidth_(pedestalWidth), gain_(gain), @@ -26,7 +28,9 @@ HcalHardcodeParameters::HcalHardcodeParameters(double pedestal, photoelectronsToAnalog_(photoelectronsToAnalog), darkCurrent_(darkCurrent), noiseCorrelation_(noiseCorrelation), - doSipmRadiationDamage_(false) {} + doSipmRadiationDamage_(false), + noiseThreshold_(noiseTh), + seedThreshold_(seedTh) {} HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet& p) : pedestal_(p.getParameter("pedestal")), @@ -42,15 +46,17 @@ HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet& p) photoelectronsToAnalog_(p.getParameter("photoelectronsToAnalog")), darkCurrent_(p.getParameter>("darkCurrent")), noiseCorrelation_(p.getParameter>("noiseCorrelation")), - doSipmRadiationDamage_(p.getParameter("doRadiationDamage")) { + doSipmRadiationDamage_(p.getParameter("doRadiationDamage")), + noiseThreshold_(p.getParameter("noiseThreshold")), + seedThreshold_(p.getParameter("seedThreshold")) { if (doSipmRadiationDamage_) sipmRadiationDamage_ = HcalSiPMRadiationDamage(darkCurrent_, p.getParameter("radiationDamage")); } -const double HcalHardcodeParameters::darkCurrent(unsigned index, double intlumi) const { +double HcalHardcodeParameters::darkCurrent(unsigned index, double intlumi) const { if (doSipmRadiationDamage_ and intlumi > 0) return sipmRadiationDamage_.getDarkCurrent(intlumi, index); return darkCurrent_.at(index); } -const double HcalHardcodeParameters::noiseCorrelation(unsigned index) const { return noiseCorrelation_.at(index); } +double HcalHardcodeParameters::noiseCorrelation(unsigned index) const { return noiseCorrelation_.at(index); } diff --git a/CalibCalorimetry/HcalAlgos/test/BuildFile.xml b/CalibCalorimetry/HcalAlgos/test/BuildFile.xml index 7e64fda0cdae0..c58de9152c21d 100644 --- a/CalibCalorimetry/HcalAlgos/test/BuildFile.xml +++ b/CalibCalorimetry/HcalAlgos/test/BuildFile.xml @@ -8,7 +8,4 @@ - - - - + diff --git a/CalibCalorimetry/HcalAlgos/test/HcalPulseContainmentTest.sh b/CalibCalorimetry/HcalAlgos/test/HcalPulseContainmentTest.sh index 04020ed30935b..e4d4a7ebea17e 100755 --- a/CalibCalorimetry/HcalAlgos/test/HcalPulseContainmentTest.sh +++ b/CalibCalorimetry/HcalAlgos/test/HcalPulseContainmentTest.sh @@ -3,5 +3,5 @@ # Pass in name and status function die { echo $1: status $2 ; exit $2; } -F1=${LOCAL_TEST_DIR}/HcalPulseContainmentTest_cfg.py +F1=${SCRAM_TEST_PATH}/HcalPulseContainmentTest_cfg.py (cmsRun $F1 ) || die "Failure using $F1" $? \ No newline at end of file diff --git a/CalibCalorimetry/HcalAlgos/test/TestDriver.cpp b/CalibCalorimetry/HcalAlgos/test/TestDriver.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/CalibCalorimetry/HcalAlgos/test/TestDriver.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/CalibCalorimetry/HcalPlugins/python/Hcal_Conditions_forGlobalTag_cff.py b/CalibCalorimetry/HcalPlugins/python/Hcal_Conditions_forGlobalTag_cff.py index f84d1d06275f3..0d5a044ad2208 100644 --- a/CalibCalorimetry/HcalPlugins/python/Hcal_Conditions_forGlobalTag_cff.py +++ b/CalibCalorimetry/HcalPlugins/python/Hcal_Conditions_forGlobalTag_cff.py @@ -48,6 +48,8 @@ photoelectronsToAnalog = cms.double(0.3305), darkCurrent = cms.vdouble(0.0), noiseCorrelation = cms.vdouble(0.0), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(False) ), he = cms.PSet( @@ -64,6 +66,8 @@ photoelectronsToAnalog = cms.double(0.3305), darkCurrent = cms.vdouble(0.0), noiseCorrelation = cms.vdouble(0.0), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(False) ), hf = cms.PSet( @@ -80,6 +84,8 @@ photoelectronsToAnalog = cms.double(0.0), darkCurrent = cms.vdouble(0.0), noiseCorrelation = cms.vdouble(0.0), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(False) ), ho = cms.PSet( @@ -96,6 +102,8 @@ photoelectronsToAnalog = cms.double(4.0), darkCurrent = cms.vdouble(0.0), noiseCorrelation = cms.vdouble(0.0), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(False) ), hbUpgrade = cms.PSet( @@ -112,6 +120,8 @@ photoelectronsToAnalog = cms.double(40.0), darkCurrent = cms.vdouble(0.01,0.015), noiseCorrelation = cms.vdouble(0.26,0.254), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(True), radiationDamage = cms.PSet( temperatureBase = cms.double(20), @@ -139,6 +149,8 @@ photoelectronsToAnalog = cms.double(40.0), darkCurrent = cms.vdouble(0.01,0.015), noiseCorrelation = cms.vdouble(0.26,0.254), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(True), radiationDamage = cms.PSet( temperatureBase = cms.double(20), @@ -166,6 +178,8 @@ photoelectronsToAnalog = cms.double(0.0), darkCurrent = cms.vdouble(0.0), noiseCorrelation = cms.vdouble(0.0), + noiseThreshold = cms.double(0.0), + seedThreshold = cms.double(0.1), doRadiationDamage = cms.bool(False) ), # types (in order): HcalHOZecotek, HcalHOHamamatsu, HcalHEHamamatsu1, HcalHEHamamatsu2, HcalHBHamamatsu1, HcalHBHamamatsu2, HcalHPD @@ -201,6 +215,7 @@ 'LutMetadata', 'L1TriggerObjects', 'PFCorrs', + 'PFCuts', 'ElectronicsMap', 'FrontEndMap', 'CovarianceMatrices', diff --git a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc index 43941d9d13cc4..70d8348991d76 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc +++ b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc @@ -222,6 +222,10 @@ HcalHardcodeCalibrations::HcalHardcodeCalibrations(const edm::ParameterSet& iCon topoTokens_[kGainWidths] = setWhatProduced(this, &HcalHardcodeCalibrations::produceGainWidths).consumes(); findingRecord(); } + if ((objectName == "PFCuts") || all) { + topoTokens_[kPFCuts] = setWhatProduced(this, &HcalHardcodeCalibrations::producePFCuts).consumes(); + findingRecord(); + } if ((objectName == "QIEData") || all) { topoTokens_[kQIEData] = setWhatProduced(this, &HcalHardcodeCalibrations::produceQIEData).consumes(); findingRecord(); @@ -425,6 +429,22 @@ std::unique_ptr HcalHardcodeCalibrations::produceGainWidths(cons return result; } +std::unique_ptr HcalHardcodeCalibrations::producePFCuts(const HcalPFCutsRcd& rec) { + edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::producePFCuts-> ..."; + + auto const& topo = rec.get(topoTokens_[kPFCuts]); + auto result = std::make_unique(&topo); + const std::vector& cells = allCells(topo, dbHardcode.killHE()); + for (auto cell : cells) { + // Use only standard Hcal channels for now, no TrigPrims + if (!cell.isHcalTrigTowerDetId()) { + HcalPFCut item = dbHardcode.makePFCut(cell); + result->addValues(item); + } + } + return result; +} + std::unique_ptr HcalHardcodeCalibrations::produceQIEData(const HcalQIEDataRcd& rcd) { edm::LogInfo("HCAL") << "HcalHardcodeCalibrations::produceQIEData-> ..."; @@ -890,6 +910,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_hb.add>("darkCurrent", std::vector({0.0})); desc_hb.add>("noiseCorrelation", std::vector({0.0})); desc_hb.add("doRadiationDamage", false); + desc_hb.add("noiseThreshold", 0.0); + desc_hb.add("seedThreshold", 0.1); desc.add("hb", desc_hb); edm::ParameterSetDescription desc_hbRaddam; @@ -916,6 +938,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_hbUpgrade.add>("noiseCorrelation", std::vector({0.26})); desc_hbUpgrade.add("doRadiationDamage", true); desc_hbUpgrade.add("radiationDamage", desc_hbRaddam); + desc_hbUpgrade.add("noiseThreshold", 0.0); + desc_hbUpgrade.add("seedThreshold", 0.1); desc.add("hbUpgrade", desc_hbUpgrade); edm::ParameterSetDescription desc_he; @@ -933,6 +957,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_he.add>("darkCurrent", std::vector({0.0})); desc_he.add>("noiseCorrelation", std::vector({0.0})); desc_he.add("doRadiationDamage", false); + desc_he.add("noiseThreshold", 0.0); + desc_he.add("seedThreshold", 0.1); desc.add("he", desc_he); edm::ParameterSetDescription desc_heRaddam; @@ -959,6 +985,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_heUpgrade.add>("noiseCorrelation", std::vector({0.26})); desc_heUpgrade.add("doRadiationDamage", true); desc_heUpgrade.add("radiationDamage", desc_heRaddam); + desc_heUpgrade.add("noiseThreshold", 0.0); + desc_heUpgrade.add("seedThreshold", 0.1); desc.add("heUpgrade", desc_heUpgrade); edm::ParameterSetDescription desc_hf; @@ -976,6 +1004,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_hf.add>("darkCurrent", std::vector({0.0})); desc_hf.add>("noiseCorrelation", std::vector({0.0})); desc_hf.add("doRadiationDamage", false); + desc_hf.add("noiseThreshold", 0.0); + desc_hf.add("seedThreshold", 0.1); desc.add("hf", desc_hf); edm::ParameterSetDescription desc_hfUpgrade; @@ -993,6 +1023,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_hfUpgrade.add>("darkCurrent", std::vector({0.0})); desc_hfUpgrade.add>("noiseCorrelation", std::vector({0.0})); desc_hfUpgrade.add("doRadiationDamage", false); + desc_hfUpgrade.add("noiseThreshold", 0.0); + desc_hfUpgrade.add("seedThreshold", 0.1); desc.add("hfUpgrade", desc_hfUpgrade); edm::ParameterSetDescription desc_hfrecal; @@ -1017,6 +1049,8 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions& desc_ho.add>("darkCurrent", std::vector({0.0})); desc_ho.add>("noiseCorrelation", std::vector({0.0})); desc_ho.add("doRadiationDamage", false); + desc_ho.add("noiseThreshold", 0.0); + desc_ho.add("seedThreshold", 0.1); desc.add("ho", desc_ho); edm::ParameterSetDescription validator_sipm; diff --git a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.h b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.h index c53b12e9aa912..28ea7ca9a8f2c 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.h +++ b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.h @@ -27,6 +27,7 @@ class HcalPedestalsRcd; class HcalPedestalWidthsRcd; class HcalGainsRcd; class HcalGainWidthsRcd; +class HcalPFCutsRcd; class HcalQIEDataRcd; class HcalQIETypesRcd; class HcalChannelQualityRcd; @@ -76,6 +77,7 @@ class HcalHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupR std::unique_ptr produceEffectivePedestalWidths(const HcalPedestalWidthsRcd& rcd); std::unique_ptr produceGains(const HcalGainsRcd& rcd); std::unique_ptr produceGainWidths(const HcalGainWidthsRcd& rcd); + std::unique_ptr producePFCuts(const HcalPFCutsRcd& rcd); std::unique_ptr produceQIEData(const HcalQIEDataRcd& rcd); std::unique_ptr produceQIETypes(const HcalQIETypesRcd& rcd); std::unique_ptr produceChannelQuality(const HcalChannelQualityRcd& rcd); @@ -116,6 +118,7 @@ class HcalHardcodeCalibrations : public edm::ESProducer, public edm::EventSetupR kEffectivePedestalWidths, kGains, kGainWidths, + kPFCuts, kQIEData, kQIETypes, kChannelQuality, diff --git a/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.cc b/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.cc index 7fc606a9378a3..e0b3281bfe926 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.cc +++ b/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.cc @@ -56,6 +56,9 @@ HcalTextCalibrations::HcalTextCalibrations(const edm::ParameterSet& iConfig) } else if (objectName == "GainWidths") { mTokens[objectName] = setWhatProduced(this, &HcalTextCalibrations::produceGainWidths).consumes(); findingRecord(); + } else if (objectName == "PFCuts") { + mTokens[objectName] = setWhatProduced(this, &HcalTextCalibrations::producePFCuts).consumes(); + findingRecord(); } else if (objectName == "QIEData") { mTokens[objectName] = setWhatProduced(this, &HcalTextCalibrations::produceQIEData).consumes(); findingRecord(); @@ -133,7 +136,7 @@ HcalTextCalibrations::HcalTextCalibrations(const edm::ParameterSet& iConfig) findingRecord(); } else { std::cerr << "HcalTextCalibrations-> Unknown object name '" << objectName << "', known names are: " - << "Pedestals PedestalWidths Gains GainWidths QIEData QIETypes ChannelQuality ElectronicsMap " + << "Pedestals PedestalWidths Gains GainWidths PFCuts QIEData QIETypes ChannelQuality ElectronicsMap " << "FrontEndMap ZSThresholds RespCorrs LUTCorrs PFCorrs TimeCorrs L1TriggerObjects " << "ValidationCorrs LutMetadata DcsValues DcsMap " << "RecoParams LongRecoParams ZDCLowGainFraction FlagHFDigiTimeParams MCParams " @@ -214,6 +217,11 @@ std::unique_ptr HcalTextCalibrations::produceGainWidths(const Hc return get_impl_topo(mInputs[n], &rcd.get(mTokens[n])); } +std::unique_ptr HcalTextCalibrations::producePFCuts(const HcalPFCutsRcd& rcd) { + std::string const n = "PFCuts"; + return get_impl_topo(mInputs[n], &rcd.get(mTokens[n])); +} + std::unique_ptr HcalTextCalibrations::produceQIEData(const HcalQIEDataRcd& rcd) { std::string const n = "QIEData"; return get_impl_topo(mInputs[n], &rcd.get(mTokens[n])); diff --git a/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.h b/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.h index ab29e5828554d..49563dd526768 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.h +++ b/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.h @@ -17,6 +17,7 @@ class HcalPedestalsRcd; class HcalPedestalWidthsRcd; class HcalGainsRcd; class HcalGainWidthsRcd; +class HcalPFCutsRcd; class HcalQIEDataRcd; class HcalQIETypesRcd; class HcalChannelQualityRcd; @@ -95,6 +96,7 @@ class HcalTextCalibrations : public edm::ESProducer, public edm::EventSetupRecor std::unique_ptr produceEffectivePedestalWidths(const HcalPedestalWidthsRcd& rcd); std::unique_ptr produceGains(const HcalGainsRcd& rcd); std::unique_ptr produceGainWidths(const HcalGainWidthsRcd& rcd); + std::unique_ptr producePFCuts(const HcalPFCutsRcd& rcd); std::unique_ptr produceQIEData(const HcalQIEDataRcd& rcd); std::unique_ptr produceQIETypes(const HcalQIETypesRcd& rcd); std::unique_ptr produceChannelQuality(const HcalChannelQualityRcd& rcd); diff --git a/CalibFormats/SiStripObjects/BuildFile.xml b/CalibFormats/SiStripObjects/BuildFile.xml index 325f0aa1bcb9f..83c3901a34f13 100644 --- a/CalibFormats/SiStripObjects/BuildFile.xml +++ b/CalibFormats/SiStripObjects/BuildFile.xml @@ -2,6 +2,9 @@ + + + diff --git a/CalibFormats/SiStripObjects/interface/SiStripClusterizerConditionsGPU.h b/CalibFormats/SiStripObjects/interface/SiStripClusterizerConditionsGPU.h new file mode 100644 index 0000000000000..94f0080f88019 --- /dev/null +++ b/CalibFormats/SiStripObjects/interface/SiStripClusterizerConditionsGPU.h @@ -0,0 +1,137 @@ +#ifndef CalibFormats_SiStripObjects_SiStripClusterizerConditionsGPU_h +#define CalibFormats_SiStripObjects_SiStripClusterizerConditionsGPU_h + +#include "DataFormats/SiStripCluster/interface/SiStripTypes.h" +#include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h" + +#include "HeterogeneousCore/CUDACore/interface/ESProduct.h" +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCompat.h" +#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h" + +class SiStripQuality; +class SiStripGain; +class SiStripNoises; + +namespace stripgpu { + __host__ __device__ inline fedId_t fedIndex(fedId_t fed) { return fed - sistrip::FED_ID_MIN; } + __host__ __device__ inline std::uint32_t stripIndex(fedId_t fed, fedCh_t channel, stripId_t strip) { + return fedIndex(fed) * sistrip::FEDCH_PER_FED * sistrip::STRIPS_PER_FEDCH + channel * sistrip::STRIPS_PER_FEDCH + + (strip % sistrip::STRIPS_PER_FEDCH); + } + __host__ __device__ inline std::uint32_t apvIndex(fedId_t fed, fedCh_t channel, stripId_t strip) { + return fedIndex(fed) * sistrip::APVS_PER_FEDCH * sistrip::FEDCH_PER_FED + sistrip::APVS_PER_CHAN * channel + + (strip % sistrip::STRIPS_PER_FEDCH) / sistrip::STRIPS_PER_APV; + } + __host__ __device__ inline std::uint32_t channelIndex(fedId_t fed, fedCh_t channel) { + return fedIndex(fed) * sistrip::FEDCH_PER_FED + channel; + } + + class SiStripClusterizerConditionsGPU { + public: + class DetToFed { + public: + DetToFed(detId_t detid, apvPair_t ipair, fedId_t fedid, fedCh_t fedch) + : detid_(detid), ipair_(ipair), fedid_(fedid), fedch_(fedch) {} + detId_t detID() const { return detid_; } + apvPair_t pair() const { return ipair_; } + fedId_t fedID() const { return fedid_; } + fedCh_t fedCh() const { return fedch_; } + + private: + detId_t detid_; + apvPair_t ipair_; + fedId_t fedid_; + fedCh_t fedch_; + }; + using DetToFeds = std::vector; + + static constexpr std::uint16_t badBit = 1 << 15; + + class Data { + public: + struct DeviceView { + __device__ inline detId_t detID(fedId_t fed, fedCh_t channel) const { + return detID_[channelIndex(fed, channel)]; + } + + __device__ inline apvPair_t iPair(fedId_t fed, fedCh_t channel) const { + return iPair_[channelIndex(fed, channel)]; + } + + __device__ inline float invthick(fedId_t fed, fedCh_t channel) const { + return invthick_[channelIndex(fed, channel)]; + } + + __device__ inline float noise(fedId_t fed, fedCh_t channel, stripId_t strip) const { + // noise is stored as 9 bits with a fixed point scale factor of 0.1 + return 0.1f * (noise_[stripIndex(fed, channel, strip)] & ~badBit); + } + + __device__ inline float gain(fedId_t fed, fedCh_t channel, stripId_t strip) const { + return gain_[apvIndex(fed, channel, strip)]; + } + + __device__ inline bool bad(fedId_t fed, fedCh_t channel, stripId_t strip) const { + return badBit == (noise_[stripIndex(fed, channel, strip)] & badBit); + } + const std::uint16_t* noise_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED * sistrip::STRIPS_PER_FEDCH]; + const float* invthick_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + const detId_t* detID_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + const apvPair_t* iPair_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + const float* gain_; //[sistrip::NUMBER_OF_FEDS*sistrip::APVS_PER_FEDCH * sistrip::FEDCH_PER_FED]; + }; + + const DeviceView* deviceView() const { return deviceView_.get(); } + + cms::cuda::device::unique_ptr deviceView_; + cms::cuda::host::unique_ptr hostView_; + + cms::cuda::device::unique_ptr + noise_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED * sistrip::STRIPS_PER_FEDCH]; + cms::cuda::device::unique_ptr invthick_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + cms::cuda::device::unique_ptr detID_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + cms::cuda::device::unique_ptr iPair_; //[sistrip::NUMBER_OF_FEDS*sistrip::FEDCH_PER_FED]; + cms::cuda::device::unique_ptr + gain_; //[sistrip::NUMBER_OF_FEDS*sistrip::APVS_PER_FEDCH * sistrip::FEDCH_PER_FED]; + }; + + SiStripClusterizerConditionsGPU(const SiStripQuality& quality, + const SiStripGain* gains, + const SiStripNoises& noises); + ~SiStripClusterizerConditionsGPU() = default; + + // Function to return the actual payload on the memory of the current device + Data const& getGPUProductAsync(cudaStream_t stream) const; + + const DetToFeds& detToFeds() const { return detToFeds_; } + + private: + void setStrip(fedId_t fed, fedCh_t channel, stripId_t strip, std::uint16_t noise, float gain, bool bad) { + gain_[apvIndex(fed, channel, strip)] = gain; + noise_[stripIndex(fed, channel, strip)] = noise; + if (bad) { + noise_[stripIndex(fed, channel, strip)] |= badBit; + } + } + + void setInvThickness(fedId_t fed, fedCh_t channel, float invthick) { + invthick_[channelIndex(fed, channel)] = invthick; + } + + // Holds the data in pinned CPU memory + std::vector> noise_; + std::vector> invthick_; + std::vector> detID_; + std::vector> iPair_; + std::vector> gain_; + + // Helper that takes care of complexity of transferring the data to + // multiple devices + cms::cuda::ESProduct gpuData_; + DetToFeds detToFeds_; + }; +} // namespace stripgpu + +#endif diff --git a/CalibFormats/SiStripObjects/src/EventSetup_Registration.cc b/CalibFormats/SiStripObjects/src/EventSetup_Registration.cc index ddf7a0ffb914f..05530484f14c4 100644 --- a/CalibFormats/SiStripObjects/src/EventSetup_Registration.cc +++ b/CalibFormats/SiStripObjects/src/EventSetup_Registration.cc @@ -23,3 +23,6 @@ TYPELOOKUP_DATA_REG(SiStripQuality); #include "CalibFormats/SiStripObjects/interface/SiStripClusterizerConditions.h" TYPELOOKUP_DATA_REG(SiStripClusterizerConditions); + +#include "CalibFormats/SiStripObjects/interface/SiStripClusterizerConditionsGPU.h" +TYPELOOKUP_DATA_REG(stripgpu::SiStripClusterizerConditionsGPU); diff --git a/CalibFormats/SiStripObjects/src/SiStripClusterizerConditionsGPU.cc b/CalibFormats/SiStripObjects/src/SiStripClusterizerConditionsGPU.cc new file mode 100644 index 0000000000000..33d0889ff5550 --- /dev/null +++ b/CalibFormats/SiStripObjects/src/SiStripClusterizerConditionsGPU.cc @@ -0,0 +1,100 @@ +#include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h" +#include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h" + +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" +#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" +#include "CalibFormats/SiStripObjects/interface/SiStripClusterizerConditionsGPU.h" + +#include "DataFormats/SiStripCluster/interface/SiStripClusterTools.h" + +namespace stripgpu { + SiStripClusterizerConditionsGPU::SiStripClusterizerConditionsGPU(const SiStripQuality& quality, + const SiStripGain* gains, + const SiStripNoises& noises) + + : noise_(sistrip::NUMBER_OF_FEDS * sistrip::FEDCH_PER_FED * sistrip::STRIPS_PER_FEDCH), + invthick_(sistrip::NUMBER_OF_FEDS * sistrip::FEDCH_PER_FED), + detID_(sistrip::NUMBER_OF_FEDS * sistrip::FEDCH_PER_FED), + iPair_(sistrip::NUMBER_OF_FEDS * sistrip::FEDCH_PER_FED), + gain_(sistrip::NUMBER_OF_FEDS * sistrip::APVS_PER_FEDCH * sistrip::FEDCH_PER_FED) { + // connected: map> + // map of KEY=detid DATA=vector of apvs, maximum 6 APVs per detector module : + const auto& connected = quality.cabling()->connected(); + // detCabling: map + // map of KEY=detid DATA=vector + const auto& detCabling = quality.cabling()->getDetCabling(); + + for (const auto& conn : connected) { + const auto det = conn.first; + if (!quality.IsModuleBad(det)) { + const auto detConn_it = detCabling.find(det); + + if (detCabling.end() != detConn_it) { + for (const auto& chan : (*detConn_it).second) { + if (chan && chan->fedId() && chan->isConnected()) { + const auto detID = chan->detId(); + const auto fedID = chan->fedId(); + const auto fedCh = chan->fedCh(); + const auto iPair = chan->apvPairNumber(); + + detToFeds_.emplace_back(detID, iPair, fedID, fedCh); + + detID_[channelIndex(fedID, fedCh)] = detID; + iPair_[channelIndex(fedID, fedCh)] = iPair; + setInvThickness(fedID, fedCh, siStripClusterTools::sensorThicknessInverse(detID)); + + auto offset = 256 * iPair; + + for (auto strip = 0; strip < 256; ++strip) { + const auto gainRange = gains->getRange(det); + + const auto detstrip = strip + offset; + const std::uint16_t noise = SiStripNoises::getRawNoise(detstrip, noises.getRange(det)); + const auto gain = SiStripGain::getStripGain(detstrip, gainRange); + const auto bad = quality.IsStripBad(quality.getRange(det), detstrip); + + // gain is actually stored per-APV, not per-strip + setStrip(fedID, fedCh, detstrip, noise, gain, bad); + } + } + } + } + } + } + + std::sort(detToFeds_.begin(), detToFeds_.end(), [](const DetToFed& a, const DetToFed& b) { + return a.detID() < b.detID() || (a.detID() == b.detID() && a.pair() < b.pair()); + }); + } + + SiStripClusterizerConditionsGPU::Data const& SiStripClusterizerConditionsGPU::getGPUProductAsync( + cudaStream_t stream) const { + auto const& data = gpuData_.dataForCurrentDeviceAsync(stream, [this](Data& data, cudaStream_t stream) { + data.noise_ = cms::cuda::make_device_unique(noise_.size(), stream); + data.invthick_ = cms::cuda::make_device_unique(invthick_.size(), stream); + data.detID_ = cms::cuda::make_device_unique(detID_.size(), stream); + data.iPair_ = cms::cuda::make_device_unique(iPair_.size(), stream); + data.gain_ = cms::cuda::make_device_unique(gain_.size(), stream); + + cms::cuda::copyAsync(data.noise_, noise_, stream); + cms::cuda::copyAsync(data.invthick_, invthick_, stream); + cms::cuda::copyAsync(data.detID_, detID_, stream); + cms::cuda::copyAsync(data.iPair_, iPair_, stream); + cms::cuda::copyAsync(data.gain_, gain_, stream); + + data.hostView_ = cms::cuda::make_host_unique(stream); + data.hostView_->noise_ = data.noise_.get(); + data.hostView_->invthick_ = data.invthick_.get(); + data.hostView_->detID_ = data.detID_.get(); + data.hostView_->iPair_ = data.iPair_.get(); + data.hostView_->gain_ = data.gain_.get(); + + data.deviceView_ = cms::cuda::make_device_unique(stream); + cms::cuda::copyAsync(data.deviceView_, data.hostView_, stream); + }); + + return data; + } +} // namespace stripgpu diff --git a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc index bdca326d712da..906e1aa150689 100644 --- a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc +++ b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc @@ -339,6 +339,7 @@ string TotemDAQMappingESSourceXML::CompleteFileName(const string &fn) { } //---------------------------------------------------------------------------------------------------- +static inline std::string to_string(const XMLCh *ch) { return XERCES_CPP_NAMESPACE_QUALIFIER XMLString::transcode(ch); } edm::ESProducts, std::unique_ptr> TotemDAQMappingESSourceXML::produce(const TotemReadoutRcd &) { @@ -347,19 +348,26 @@ TotemDAQMappingESSourceXML::produce(const TotemReadoutRcd &) { auto mapping = std::make_unique(); auto mask = std::make_unique(); - // initialize Xerces - cms::concurrency::xercesInitialize(); - - // load mapping files - for (const auto &fn : configuration[currentBlock].mappingFileNames) - ParseXML(pMapping, CompleteFileName(fn), mapping, mask); - - // load mask files - for (const auto &fn : configuration[currentBlock].maskFileNames) - ParseXML(pMask, CompleteFileName(fn), mapping, mask); - - // release Xerces - cms::concurrency::xercesTerminate(); + try { + // initialize Xerces + cms::concurrency::xercesInitialize(); + + // load mapping files + for (const auto &fn : configuration[currentBlock].mappingFileNames) + ParseXML(pMapping, CompleteFileName(fn), mapping, mask); + + // load mask files + for (const auto &fn : configuration[currentBlock].maskFileNames) + ParseXML(pMask, CompleteFileName(fn), mapping, mask); + + // release Xerces + cms::concurrency::xercesTerminate(); + } catch (const XMLException &e) { + throw cms::Exception("XMLDocument") << "cms::concurrency::xercesInitialize failed because of " + << to_string(e.getMessage()) << std::endl; + } catch (const SAXException &e) { + throw cms::Exception("XMLDocument") << "XML parser reported: " << to_string(e.getMessage()) << "." << std::endl; + } // commit the products return edm::es::products(std::move(mapping), std::move(mask)); diff --git a/CalibTracker/Configuration/python/Reconstruction_cff.py b/CalibTracker/Configuration/python/Reconstruction_cff.py index 5e20b01ceb9a2..dd78bb14a5540 100644 --- a/CalibTracker/Configuration/python/Reconstruction_cff.py +++ b/CalibTracker/Configuration/python/Reconstruction_cff.py @@ -15,7 +15,7 @@ from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoTracker.Configuration.RecoTracker_cff import * from RecoTracker.Configuration.RecoTrackerP5_cff import * -from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * +from RecoTracker.Configuration.RecoPixelVertexing_cff import * recotrack = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ckftracks) recotrackP5 = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ctftracksP5) diff --git a/CalibTracker/SiPixelESProducers/test/BuildFile.xml b/CalibTracker/SiPixelESProducers/test/BuildFile.xml index 2a47d8d476c54..cba0a258ec13c 100644 --- a/CalibTracker/SiPixelESProducers/test/BuildFile.xml +++ b/CalibTracker/SiPixelESProducers/test/BuildFile.xml @@ -9,9 +9,4 @@ - - - - - - + diff --git a/CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.sh b/CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.sh index c3fe2f6b11037..f5ddbd0f85734 100755 --- a/CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.sh +++ b/CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.sh @@ -5,13 +5,13 @@ function die { echo $1: status $2 ; exit $2; } echo "TESTING Fake Pixel Conditions Sources ..." printf "TESTING SiPixelFakeLorentzAngleESSource (BPix) ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/testSiPixelFakeLorentzAngleESSource_cfg.py isBPix=True || die "Failure testing SiPixelFakeLorentzAngleESSource (BPix)" $? +cmsRun ${SCRAM_TEST_PATH}/testSiPixelFakeLorentzAngleESSource_cfg.py isBPix=True || die "Failure testing SiPixelFakeLorentzAngleESSource (BPix)" $? printf "TESTING SiPixelFakeLorentzAngleESSource (FPix) ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/testSiPixelFakeLorentzAngleESSource_cfg.py isFPix=True || die "Failure testing SiPixelFakeLorentzAngleESSource (FPix)" $? +cmsRun ${SCRAM_TEST_PATH}/testSiPixelFakeLorentzAngleESSource_cfg.py isFPix=True || die "Failure testing SiPixelFakeLorentzAngleESSource (FPix)" $? printf "TESTING SiPixelFakeLorentzAngleESSource (By Module) ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/testSiPixelFakeLorentzAngleESSource_cfg.py isByModule=True || die "Failure testing SiPixelFakeLorentzAngleESSource (By Module)" $? +cmsRun ${SCRAM_TEST_PATH}/testSiPixelFakeLorentzAngleESSource_cfg.py isByModule=True || die "Failure testing SiPixelFakeLorentzAngleESSource (By Module)" $? printf "TESTING SiPixelFakeLorentzAngleESSource (Phase-2) ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/testSiPixelFakeLorentzAngleESSource_cfg.py isPhase2=True || die "Failure testing SiPixelFakeLorentzAngleESSource (Phase-2) " $? +cmsRun ${SCRAM_TEST_PATH}/testSiPixelFakeLorentzAngleESSource_cfg.py isPhase2=True || die "Failure testing SiPixelFakeLorentzAngleESSource (Phase-2) " $? diff --git a/CalibTracker/SiStripChannelGain/test/BuildFile.xml b/CalibTracker/SiStripChannelGain/test/BuildFile.xml index 5382aa13730b7..b1f371408c733 100644 --- a/CalibTracker/SiStripChannelGain/test/BuildFile.xml +++ b/CalibTracker/SiStripChannelGain/test/BuildFile.xml @@ -1,15 +1,9 @@ - - - - + - - - - + diff --git a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.cpp b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.sh b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.sh index 826441c8e1120..7fb78ee3c7fdc 100755 --- a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.sh +++ b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromCalibTree.sh @@ -8,8 +8,8 @@ COMMMAND=`xrdfs root://eoscms.cern.ch// locate ${REMOTE}/${FILE}` STATUS=$? echo "xrdfs command status = "$STATUS if [ $STATUS -eq 0 ]; then - (cmsRun ${LOCAL_TEST_DIR}/Gains_CT_step1.py firstRun=${RUN} lastRun=${RUN} inputFiles=root://eoscms.cern.ch//$REMOTE/$FILE outputFile=PromptCalibProdSiStripGainsFromTree.root) || die 'Failure running cmsRun Gains_CT_step1.py firstRun=${RUN} lastRun=${RUN} inputFiles=root://eoscms.cern.ch//$REMOTE/$FILE outputFile=PromptCalibProdSiStripGainsFromTree.root' $? - (cmsRun ${LOCAL_TEST_DIR}/Gains_CT_step2.py inputFiles=file:PromptCalibProdSiStripGainsFromTree.root DQMOutput=True) || die 'Failure running cmsRun Gains_CT_step2.py inputFiles=file:PromptCalibProdSiStripGainsFromTree.root DQMOutput=True' $? + (cmsRun ${SCRAM_TEST_PATH}/Gains_CT_step1.py firstRun=${RUN} lastRun=${RUN} inputFiles=root://eoscms.cern.ch//$REMOTE/$FILE outputFile=PromptCalibProdSiStripGainsFromTree.root) || die 'Failure running cmsRun Gains_CT_step1.py firstRun=${RUN} lastRun=${RUN} inputFiles=root://eoscms.cern.ch//$REMOTE/$FILE outputFile=PromptCalibProdSiStripGainsFromTree.root' $? + (cmsRun ${SCRAM_TEST_PATH}/Gains_CT_step2.py inputFiles=file:PromptCalibProdSiStripGainsFromTree.root DQMOutput=True) || die 'Failure running cmsRun Gains_CT_step2.py inputFiles=file:PromptCalibProdSiStripGainsFromTree.root DQMOutput=True' $? else die "SKIPPING test, file ${FILE} not found" 0 fi diff --git a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.cpp b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.sh b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.sh index 9fa8fb8b17b0e..318953f44353f 100755 --- a/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.sh +++ b/CalibTracker/SiStripChannelGain/test/testSSTGain_PCL_FromRECO.sh @@ -1,7 +1,7 @@ #!/bin/bash # Pass in name and status function die { echo $1: status $2 ; exit $2; } -(cmsRun ${LOCAL_TEST_DIR}/testSSTGain_PCL_FromRECO_cfg.py era=A) || die 'Failure running cmsRun testSSTGain_PCL_FromRECO_cfg.py era=A' $? -(cmsRun ${LOCAL_TEST_DIR}/testSSTGain_PCL_FromRECO_cfg.py era=B) || die 'Failure running cmsRun testSSTGain_PCL_FromRECO_cfg.py era=B' $? -(cmsRun ${LOCAL_TEST_DIR}/testSSTGain_HARVEST_FromRECO.py 0) || die 'Failure running cmsRun testSSTGain_HARVEST_FromRECO.py 0' $? -(cmsRun ${LOCAL_TEST_DIR}/testSSTGain_MultiRun_ALCAHARVEST.py globalTag=auto:run3_data_express) || die 'Failure running cmsRun testSSTGain_MultiRun_ALCAHARVEST.py 0' $? +(cmsRun ${SCRAM_TEST_PATH}/testSSTGain_PCL_FromRECO_cfg.py era=A) || die 'Failure running cmsRun testSSTGain_PCL_FromRECO_cfg.py era=A' $? +(cmsRun ${SCRAM_TEST_PATH}/testSSTGain_PCL_FromRECO_cfg.py era=B) || die 'Failure running cmsRun testSSTGain_PCL_FromRECO_cfg.py era=B' $? +(cmsRun ${SCRAM_TEST_PATH}/testSSTGain_HARVEST_FromRECO.py 0) || die 'Failure running cmsRun testSSTGain_HARVEST_FromRECO.py 0' $? +(cmsRun ${SCRAM_TEST_PATH}/testSSTGain_MultiRun_ALCAHARVEST.py globalTag=auto:run3_data_express) || die 'Failure running cmsRun testSSTGain_MultiRun_ALCAHARVEST.py 0' $? diff --git a/CalibTracker/SiStripCommon/test/BuildFile.xml b/CalibTracker/SiStripCommon/test/BuildFile.xml index 67321efb053eb..d338e4a84c8dc 100644 --- a/CalibTracker/SiStripCommon/test/BuildFile.xml +++ b/CalibTracker/SiStripCommon/test/BuildFile.xml @@ -1,9 +1,4 @@ - - - - - - + diff --git a/CalibTracker/SiStripCommon/test/testCalibTrackerSiStripCommon.cpp b/CalibTracker/SiStripCommon/test/testCalibTrackerSiStripCommon.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/CalibTracker/SiStripCommon/test/testCalibTrackerSiStripCommon.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/CalibTracker/SiStripCommon/test/test_all.sh b/CalibTracker/SiStripCommon/test/test_all.sh index 92fefbc66d358..e45c50c01e768 100755 --- a/CalibTracker/SiStripCommon/test/test_all.sh +++ b/CalibTracker/SiStripCommon/test/test_all.sh @@ -3,5 +3,5 @@ function die { echo $1: status $2 ; exit $2; } echo "TESTING CalibTracker/SiStripCommon ..." -cmsRun ${LOCAL_TEST_DIR}/test_all_cfg.py || die "Failure running test_CalibTrackerSiStripCommon_cfg.py" $? -cmsRun ${LOCAL_TEST_DIR}/testProduceCalibrationTree_cfg.py maxEvents=10 unitTest=True || die "Failure running produceCalibrationTree_template_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/test_all_cfg.py || die "Failure running test_CalibTrackerSiStripCommon_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/testProduceCalibrationTree_cfg.py maxEvents=10 unitTest=True || die "Failure running produceCalibrationTree_template_cfg.py" $? diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripFedCablingFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripFedCablingFakeESSource.cc index 33bf811a98365..f9ffefd678a80 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripFedCablingFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripFedCablingFakeESSource.cc @@ -95,16 +95,13 @@ SiStripFedCabling* SiStripFedCablingFakeESSource::make(const SiStripFedCablingRc bool insufficient = false; Feds::const_iterator ifed = feds.begin(); uint16_t fed_ch = 0; - for (std::vector::iterator icrate = fec_cabling->crates().begin(); - icrate != fec_cabling->crates().end(); - icrate++) { - for (std::vector::iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++) { - for (std::vector::iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++) { - for (std::vector::iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++) { - for (std::vector::iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); - imod++) { + for (auto& icrate : fec_cabling->crates()) { + for (auto& ifec : icrate.fecs()) { + for (auto& iring : ifec.rings()) { + for (auto& iccu : iring.ccus()) { + for (auto& imod : iccu.modules()) { if (populateAllFeds) { - for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) { + for (uint16_t ipair = 0; ipair < imod.nApvPairs(); ipair++) { if (ifed == feds.end()) { fed_ch++; ifed = feds.begin(); @@ -114,12 +111,12 @@ SiStripFedCabling* SiStripFedCablingFakeESSource::make(const SiStripFedCablingRc break; } - std::pair addr = imod->activeApvPair(imod->lldChannel(ipair)); + std::pair addr = imod.activeApvPair(imod.lldChannel(ipair)); SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1 (*ifed) % 16 + 2, // FED slot starts from 2 *ifed, fed_ch); - imod->fedCh(addr.first, fed_channel); + imod.fedCh(addr.first, fed_channel); ifed++; } } else { @@ -127,17 +124,17 @@ SiStripFedCabling* SiStripFedCablingFakeESSource::make(const SiStripFedCablingRc //to reproduce the fake cabling used in 2x //that was designed to fill each fed iteratively //filling all channels of a fed before going to the next one - if (96 - fed_ch < imod->nApvPairs()) { + if (96 - fed_ch < imod.nApvPairs()) { ifed++; fed_ch = 0; } // move to next FED - for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) { - std::pair addr = imod->activeApvPair(imod->lldChannel(ipair)); + for (uint16_t ipair = 0; ipair < imod.nApvPairs(); ipair++) { + std::pair addr = imod.activeApvPair(imod.lldChannel(ipair)); SiStripModule::FedChannel fed_channel((*ifed) / 16 + 1, // 16 FEDs per crate, numbering starts from 1 (*ifed) % 16 + 2, // FED slot starts from 2 (*ifed), fed_ch); - imod->fedCh(addr.first, fed_channel); + imod.fedCh(addr.first, fed_channel); fed_ch++; } } diff --git a/CalibTracker/SiStripESProducers/test/BuildFile.xml b/CalibTracker/SiStripESProducers/test/BuildFile.xml index 8b4315c5fc141..d256fdaf74878 100644 --- a/CalibTracker/SiStripESProducers/test/BuildFile.xml +++ b/CalibTracker/SiStripESProducers/test/BuildFile.xml @@ -12,10 +12,4 @@ - - - - - - - + diff --git a/CalibTracker/SiStripESProducers/test/python/testBadComponents_byHand.sh b/CalibTracker/SiStripESProducers/test/python/testBadComponents_byHand.sh index 38c54ee86589e..76085662cdfc8 100755 --- a/CalibTracker/SiStripESProducers/test/python/testBadComponents_byHand.sh +++ b/CalibTracker/SiStripESProducers/test/python/testBadComponents_byHand.sh @@ -3,4 +3,4 @@ function die { echo $1: status $2 ; exit $2; } echo "TESTING CalibTracker/SiStripESProducers ..." -cmsRun ${LOCAL_TEST_DIR}/SiStripBadAPVListBuilder_byHand_cfg.py || die "Failure running SiStripBadAPVListBuilder_byHand_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/python/SiStripBadAPVListBuilder_byHand_cfg.py || die "Failure running SiStripBadAPVListBuilder_byHand_cfg.py" $? diff --git a/CalibTracker/SiStripESProducers/test/testCalibTrackerSiStripESProducersByHand.cpp b/CalibTracker/SiStripESProducers/test/testCalibTrackerSiStripESProducersByHand.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripESProducers/test/testCalibTrackerSiStripESProducersByHand.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripHitEfficiency/test/BuildFile.xml b/CalibTracker/SiStripHitEfficiency/test/BuildFile.xml index c0caa951b4249..ed961b5b0c73c 100644 --- a/CalibTracker/SiStripHitEfficiency/test/BuildFile.xml +++ b/CalibTracker/SiStripHitEfficiency/test/BuildFile.xml @@ -1,4 +1 @@ - - - - + diff --git a/CalibTracker/SiStripHitEfficiency/test/TestDriver.cpp b/CalibTracker/SiStripHitEfficiency/test/TestDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripHitEfficiency/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripHitEfficiency/test/test_SiStripHitEfficiency.sh b/CalibTracker/SiStripHitEfficiency/test/test_SiStripHitEfficiency.sh index d0b8891a5d923..9397e50dcb324 100755 --- a/CalibTracker/SiStripHitEfficiency/test/test_SiStripHitEfficiency.sh +++ b/CalibTracker/SiStripHitEfficiency/test/test_SiStripHitEfficiency.sh @@ -7,12 +7,12 @@ if [ "${SCRAM_TEST_NAME}" != "" ] ; then fi echo -e "Testing SiStripHitEfficencyWorker \n\n" -cmsRun ${LOCAL_TEST_DIR}/testHitEffWorker.py isUnitTest=True || die 'failed running testHitEffWorker.py' $? +cmsRun ${SCRAM_TEST_PATH}/testHitEffWorker.py isUnitTest=True || die 'failed running testHitEffWorker.py' $? echo -e "Testing SiStripHitEfficencyHarvester \n\n" -cmsRun ${LOCAL_TEST_DIR}/testHitEffHarvester.py isUnitTest=True || die 'failed running testHitEffHarvester.py' $? +cmsRun ${SCRAM_TEST_PATH}/testHitEffHarvester.py isUnitTest=True || die 'failed running testHitEffHarvester.py' $? echo -e " testing tSiStripHitEffFromCalibTree \n\n" -cmsRun ${LOCAL_TEST_DIR}/testSiStripHitEffFromCalibTree_cfg.py inputFiles=HitEffTree.root runNumber=325172 || die 'failed running testSiStripHitEffFromCalibTree_cfg.py' $? +cmsRun ${SCRAM_TEST_PATH}/testSiStripHitEffFromCalibTree_cfg.py inputFiles=HitEffTree.root runNumber=325172 || die 'failed running testSiStripHitEffFromCalibTree_cfg.py' $? echo -e "Done with the tests!" diff --git a/CalibTracker/SiStripHitResolution/test/BuildFile.xml b/CalibTracker/SiStripHitResolution/test/BuildFile.xml index fa4cf908e6453..c5368be8fbb17 100644 --- a/CalibTracker/SiStripHitResolution/test/BuildFile.xml +++ b/CalibTracker/SiStripHitResolution/test/BuildFile.xml @@ -1,4 +1 @@ - - - - + diff --git a/CalibTracker/SiStripHitResolution/test/TestDriver.cpp b/CalibTracker/SiStripHitResolution/test/TestDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripHitResolution/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripHitResolution/test/test_SiStripHitResolution.sh b/CalibTracker/SiStripHitResolution/test/test_SiStripHitResolution.sh index b3a147f04da9c..90642802cb12f 100755 --- a/CalibTracker/SiStripHitResolution/test/test_SiStripHitResolution.sh +++ b/CalibTracker/SiStripHitResolution/test/test_SiStripHitResolution.sh @@ -7,20 +7,20 @@ if [ "${SCRAM_TEST_NAME}" != "" ] ; then fi echo -e "Testing SiStripHitEfficencyWorker \n\n" -cmsRun ${LOCAL_TEST_DIR}/SiStripHitResol_test.py isUnitTest=True || die 'failed running SiStripHitResol_test.py' $? +cmsRun ${SCRAM_TEST_PATH}/SiStripHitResol_test.py isUnitTest=True || die 'failed running SiStripHitResol_test.py' $? echo -e "Testing CPEanconfig.py \n\n" -cmsRun ${LOCAL_TEST_DIR}/CPEanconfig.py isUnitTest=True || die 'failed running CPEanconfig.py' $? +cmsRun ${SCRAM_TEST_PATH}/CPEanconfig.py isUnitTest=True || die 'failed running CPEanconfig.py' $? echo -e "Testing SiStripHitResolutionFromCalibTree_cfg.py \n\n" -cmsRun ${LOCAL_TEST_DIR}/SiStripHitResolutionFromCalibTree_cfg.py || die 'failed running SiStripHitResolutionFromCalibTree_cfg.py' $? +cmsRun ${SCRAM_TEST_PATH}/SiStripHitResolutionFromCalibTree_cfg.py || die 'failed running SiStripHitResolutionFromCalibTree_cfg.py' $? ### To be implemented #echo -e "Testing SiStripHitEfficencyHarvester \n\n" -#cmsRun ${LOCAL_TEST_DIR}/testHitEffHarvester.py isUnitTest=True || die 'failed running testHitEffHarvester.py' $? +#cmsRun ${SCRAM_TEST_PATH}/testHitEffHarvester.py isUnitTest=True || die 'failed running testHitEffHarvester.py' $? #echo -e " testing tSiStripHitEffFromCalibTree \n\n" -#cmsRun ${LOCAL_TEST_DIR}/testSiStripHitEffFromCalibTree_cfg.py inputFiles=HitEffTree.root runNumber=325172 || die 'failed running testSiStripHitEffFromCalibTree_cfg.py' $? +#cmsRun ${SCRAM_TEST_PATH}/testSiStripHitEffFromCalibTree_cfg.py inputFiles=HitEffTree.root runNumber=325172 || die 'failed running testSiStripHitEffFromCalibTree_cfg.py' $? echo -e "Done with the tests!" diff --git a/CalibTracker/SiStripQuality/test/BuildFile.xml b/CalibTracker/SiStripQuality/test/BuildFile.xml index ba56eaa8a7554..e59f7e7b0b3e6 100644 --- a/CalibTracker/SiStripQuality/test/BuildFile.xml +++ b/CalibTracker/SiStripQuality/test/BuildFile.xml @@ -1,9 +1,2 @@ - - - - - - - - - + + diff --git a/CalibTracker/SiStripQuality/test/TestDriver.cpp b/CalibTracker/SiStripQuality/test/TestDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CalibTracker/SiStripQuality/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiStripQuality/test/test_SiStripQualityStatistics.sh b/CalibTracker/SiStripQuality/test/test_SiStripQualityStatistics.sh index a58b5b517d687..114a70143133e 100755 --- a/CalibTracker/SiStripQuality/test/test_SiStripQualityStatistics.sh +++ b/CalibTracker/SiStripQuality/test/test_SiStripQualityStatistics.sh @@ -1,4 +1,4 @@ #!/bin/bash # Pass in name and status function die { echo $1: status $2 ; exit $2; } -(cmsRun ${LOCAL_TEST_DIR}/test_SiStripQualityStatistics_cfg.py) || die 'Failure running cmsRun test_SiStripQualityStatistics_cfg.py' $? +(cmsRun ${SCRAM_TEST_PATH}/test_SiStripQualityStatistics_cfg.py) || die 'Failure running cmsRun test_SiStripQualityStatistics_cfg.py' $? diff --git a/CalibTracker/SiStripQuality/test/test_makeMergedBadComponentsWithFedErr.sh b/CalibTracker/SiStripQuality/test/test_makeMergedBadComponentsWithFedErr.sh index a423b742933c1..7be31605600f2 100755 --- a/CalibTracker/SiStripQuality/test/test_makeMergedBadComponentsWithFedErr.sh +++ b/CalibTracker/SiStripQuality/test/test_makeMergedBadComponentsWithFedErr.sh @@ -5,9 +5,9 @@ dqmFile="/eos/cms/store/group/comm_dqm/DQMGUI_data/Run2018/ZeroBias/R0003191xx/D if [ ! -f "${dqmFile}" ]; then die "SKIPPING test, file ${dqmFile} not found" 0 fi -runStartTime=$( (python "${LOCAL_TEST_DIR}/cfg/getRunStartTime.py" "${run}" | tail -n1 ) || die "Failed to get run start time" $? ) +runStartTime=$( (python "${SCRAM_TEST_PATH}/cfg/getRunStartTime.py" "${run}" | tail -n1 ) || die "Failed to get run start time" $? ) echo "DEBUG: Run ${run} started at ${runStartTime}" -(cmsRun "${LOCAL_TEST_DIR}/cfg/makeMergeBadComponentPayload_example_cfg.py" globalTag=auto:run3_data_prompt runNumber="${run}" runStartTime="${runStartTime}" dqmFile="${dqmFile}" dbfile="test.db" outputTag="TestBadComponents" ) || die "Failure running cmsRun makeMergeBadComponentPayload_example_cfg.py" $? +(cmsRun "${SCRAM_TEST_PATH}/cfg/makeMergeBadComponentPayload_example_cfg.py" globalTag=auto:run3_data_prompt runNumber="${run}" runStartTime="${runStartTime}" dqmFile="${dqmFile}" dbfile="test.db" outputTag="TestBadComponents" ) || die "Failure running cmsRun makeMergeBadComponentPayload_example_cfg.py" $? # get the hash plEntryLn=$( (conddb --db sqlite_file:test.db list TestBadComponents | grep SiStripBadStrip) || die "Failed to get payload" $? ) read -a plEntryLn_split <<< "${plEntryLn}" diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc index 1e5290d2ad57c..45fc6c798dd5b 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHOCalibProducer.cc @@ -92,6 +92,7 @@ Ring 0 L0 : Width Tray 6:266.6, 5&4:325.6, 3:330.6, 2:341.6, 1:272.6 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/GeometrySurface/interface/PlaneBuilder.h" #include "DataFormats/Luminosity/interface/LumiDetails.h" +#include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h" #include "DataFormats/Math/interface/Error.h" #include "DataFormats/MuonReco/interface/Muon.h" #include "DataFormats/RecoCandidate/interface/IsoDeposit.h" @@ -199,6 +200,7 @@ class AlCaHOCalibProducer : public edm::one::EDProducer tok_vertex_; // edm::EDGetTokenT tok_lumi_; edm::EDGetTokenT tok_lumi_; + edm::EDGetTokenT tok_metaData_; edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_ho_; @@ -257,6 +259,7 @@ AlCaHOCalibProducer::AlCaHOCalibProducer(const edm::ParameterSet& iConfig) { tok_vertex_ = consumes(iConfig.getParameter("vertexTags")); // tok_lumi_ = consumes(iConfig.getParameter("lumiTags")); tok_lumi_ = consumes(iConfig.getParameter("lumiTags")); + tok_metaData_ = consumes(iConfig.getParameter("metadata")); tok_ho_ = consumes(iConfig.getParameter("hoInput")); tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); tok_tower_ = consumes(iConfig.getParameter("towerInput")); @@ -301,6 +304,7 @@ void AlCaHOCalibProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.addUntracked("muons", edm::InputTag("muons")); desc.add("vertexTags", edm::InputTag("offlinePrimaryVertices")); desc.add("lumiTags", edm::InputTag("scalersRawToDigi")); + desc.add("metadata", edm::InputTag("onlineMetaDataDigis")); descriptions.add("alcaHOCalibProducer", desc); } @@ -343,13 +347,17 @@ void AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe tmpHOCalib.inslumi = 0.; auto const& lumiScale = iEvent.getHandle(tok_lumi_); + auto const& metaData = iEvent.getHandle(tok_metaData_); - if (lumiScale.isValid()) { - if (lumiScale->empty()) { - edm::LogError("HOCalib") << "lumiScale collection is empty"; - } else { + // by default use Run-3 access (onlineMetaDataDigis) + if (metaData.isValid()) { + tmpHOCalib.inslumi = metaData->avgPileUp(); + } else if (lumiScale.isValid() && !lumiScale->empty()) { + if (lumiScale->begin() != lumiScale->end()) { tmpHOCalib.inslumi = lumiScale->begin()->pileup(); } + } else { + edm::LogWarning("HOCalib") << "Neither LumiScalers nor OnlineMetadata collections found in the event"; } } } diff --git a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml index fff6c2671b4ce..92ea6aec81373 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml +++ b/Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml @@ -13,6 +13,7 @@ + diff --git a/Calibration/HcalCalibAlgos/macros/CalibCorr.C b/Calibration/HcalCalibAlgos/macros/CalibCorr.C index fda2ef481f33c..050fb51750e77 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibCorr.C +++ b/Calibration/HcalCalibAlgos/macros/CalibCorr.C @@ -162,6 +162,31 @@ unsigned int repackId(int eta, int depth) { return id; } +unsigned int repackId(int subdet, int ieta, int iphi, int depth) { + unsigned int id = ((subdet & 0x7) << 25); + id |= ((0x1000000) | ((depth & 0xF) << 20) | ((ieta > 0) ? (0x80000 | (ieta << 10)) : ((-ieta) << 10)) | + (iphi & 0x3FF)); + return id; +} + +bool ifHB(int ieta, int depth) { return ((std::abs(ieta) < 16) || ((std::abs(ieta) == 16) && (depth != 4))); } + +int truncateDepth(int ieta, int depth, int truncateFlag) { + int d(depth); + if (truncateFlag == 5) { + d = (depth == 1) ? 1 : 2; + } else if (truncateFlag == 4) { + d = ifHB(ieta, depth) ? ((depth == 1) ? 1 : 2) : depth; + } else if (truncateFlag == 3) { + d = (!ifHB(ieta, depth)) ? ((depth == 1) ? 1 : 2) : depth; + } else if (truncateFlag == 2) { + d = 1; + } else if (truncateFlag == 1) { + d = ((std::abs(ieta) == 15) || (std::abs(ieta) == 16)) ? 1 : depth; + } + return d; +} + double puFactor(int type, int ieta, double pmom, double eHcal, double ediff, bool debug = false) { double fac(1.0); if (debug) diff --git a/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C b/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C index 5f9a3bc5d977a..a06e81766959c 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C +++ b/Calibration/HcalCalibAlgos/macros/CalibFitPlots.C @@ -131,6 +131,12 @@ // Mean response and its error for the 4 regions // Width of response and uts error for the 4 regions // +// For plotting depth dependent correction factors from muon study +// PlotDepthCorrFactor(infile, text, prefix, dataMC, drawStatBox, save) +// Defaults prefix = "", dataMC = true, drawStatBox = true, save = 0 +// Format for the input file: ieta and correcrion factor with its +// uncertainty for each depth +// // where: // infile (std::string) = Name of the input ROOT file // outfile (std::string) = Name of the output ROOT file @@ -2220,8 +2226,8 @@ void PlotHistCorrFactors(char* infile1, gStyle->SetOptStat(0); gStyle->SetOptFit(0); } - int colors[6] = {1, 6, 4, 2, 7, 9}; - int mtype[6] = {20, 24, 22, 23, 21, 33}; + int colors[7] = {1, 6, 4, 2, 7, 9, 46}; + int mtype[7] = {20, 24, 22, 23, 21, 25, 33}; int nbin = etamax - etamin + 1; std::vector hists; std::vector entries, htype, depths; @@ -2318,7 +2324,7 @@ void PlotHistCorrFactors(char* infile1, htype.push_back(k1); depths.push_back(j + 1); } - if (k1 == 0) + if (k1 <= 1) nline += hists.size(); else ++nline; @@ -2358,7 +2364,7 @@ void PlotHistCorrFactors(char* infile1, } else { sprintf(name, "Depth %d (%s Mean = %5.3f)", depths[k], texts[k1].c_str(), fitr[k]); } - if ((depths[k] == 1) || (k1 == 0)) + if ((depths[k] == 1) || (k1 <= 1)) legend->AddEntry(hists[k], name, "lp"); } legend->Draw("same"); @@ -3529,3 +3535,173 @@ void PlotMeanError(const std::string infilest, int reg = 3, bool resol = false, } } } + +void PlotDepthCorrFactor(char* infile, + std::string text, + std::string prefix = "", + bool dataMC = true, + bool drawStatBox = true, + int save = 0) { + std::map cfacs; + int etamin(100), etamax(-100), maxdepth(0); + std::ifstream ifile(infile); + if (!ifile.is_open()) { + std::cout << "Cannot open duplicate file " << infile << std::endl; + } else { + unsigned int all(0), good(0); + char buffer[1024]; + while (ifile.getline(buffer, 1024)) { + ++all; + std::string bufferString(buffer); + if (bufferString.substr(0, 1) == "#") { + continue; //ignore other comments + } else { + std::vector items = splitString(bufferString); + if (items.size() < 3) { + std::cout << "Ignore line: " << buffer << " Size " << items.size(); + for (unsigned int k = 0; k < items.size(); ++k) + std::cout << " [" << k << "] : " << items[k]; + std::cout << std::endl; + } else { + ++good; + int ieta = std::atoi(items[0].c_str()); + if (ieta < etamin) + etamin = ieta; + if (ieta > etamax) + etamax = ieta; + unsigned int k(1); + int depth(0); + std::cout << "ieta " << ieta; + while (k < items.size()) { + ++depth; + double corrf = std::atof(items[k].c_str()); + double dcorr = std::atof(items[k + 1].c_str()); + if (depth > maxdepth) + maxdepth = depth; + if ((depth == 1) && ((std::abs(ieta) == 17) || (std::abs(ieta) == 18))) { + } else { + int detId = repackId(ieta, depth); + cfacs[detId] = cfactors(ieta, depth, corrf, dcorr); + std::cout << " Depth " << depth << " " << corrf << " +- " << dcorr; + } + k += 2; + } + std::cout << std::endl; + } + } + } + ifile.close(); + std::cout << "Reads total of " << all << " and " << good << " good records of depth dependent factors from " + << infile << " Eta range " << etamin << ":" << etamax << " maxdepth " << maxdepth << std::endl; + } + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + if (drawStatBox) { + gStyle->SetOptStat(10); + gStyle->SetOptFit(10); + } else { + gStyle->SetOptStat(0); + gStyle->SetOptFit(0); + } + int colors[7] = {1, 6, 4, 7, 2, 9, 3}; + int mtype[7] = {20, 21, 22, 23, 24, 33, 25}; + int nbin = etamax - etamin + 1; + std::vector hists; + std::vector entries; + char name[100]; + double dy(0); + int fits(0); + for (int j = 0; j < maxdepth; ++j) { + sprintf(name, "hd%d", j + 1); + TH1D* h = new TH1D(name, name, nbin, etamin, etamax); + int nent(0); + for (std::map::const_iterator itr = cfacs.begin(); itr != cfacs.end(); ++itr) { + if ((itr->second).depth == j + 1) { + int ieta = (itr->second).ieta; + int bin = ieta - etamin + 1; + float val = (itr->second).corrf; + float dvl = (itr->second).dcorr; + h->SetBinContent(bin, val); + h->SetBinError(bin, dvl); + nent++; + } + } + h->SetLineColor(colors[j]); + h->SetMarkerColor(colors[j]); + h->SetMarkerStyle(mtype[j]); + h->GetXaxis()->SetTitle("i#eta"); + h->GetYaxis()->SetTitle("Depth Dependent Correction Factor"); + h->GetYaxis()->SetLabelOffset(0.005); + h->GetYaxis()->SetTitleOffset(1.20); + h->GetYaxis()->SetRangeUser(0.0, 2.0); + hists.push_back(h); + entries.push_back(nent); + dy += 0.025; + } + sprintf(name, "c_%sCorrFactor", prefix.c_str()); + TCanvas* pad = new TCanvas(name, name, 700, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + double yh = 0.90; + // double yl = yh - 0.025 * hists.size() - dy - 0.01; + double yl = 0.15; + TLegend* legend = new TLegend(0.35, yl, 0.65, yl + 0.04 * hists.size()); + legend->SetFillColor(kWhite); + for (unsigned int k = 0; k < hists.size(); ++k) { + if (k == 0) + hists[k]->Draw(""); + else + hists[k]->Draw("sames"); + pad->Update(); + TPaveStats* st1 = (TPaveStats*)hists[k]->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + dy = 0.025; + st1->SetLineColor(colors[k]); + st1->SetTextColor(colors[k]); + st1->SetY1NDC(yh - dy); + st1->SetY2NDC(yh); + st1->SetX1NDC(0.70); + st1->SetX2NDC(0.90); + yh -= dy; + } + sprintf(name, "Depth %d (%s)", k + 1, text.c_str()); + legend->AddEntry(hists[k], name, "lp"); + } + legend->Draw("same"); + pad->Update(); + if (fits < 1) { + double xmin = hists[0]->GetBinLowEdge(1); + int nbin = hists[0]->GetNbinsX(); + double xmax = hists[0]->GetBinLowEdge(nbin) + hists[0]->GetBinWidth(nbin); + TLine* line = new TLine(xmin, 1.0, xmax, 1.0); + line->SetLineColor(9); + line->SetLineWidth(2); + line->SetLineStyle(2); + line->Draw("same"); + pad->Modified(); + pad->Update(); + } + char txt1[30]; + double xmax = (dataMC) ? 0.33 : 0.44; + TPaveText* txt2 = new TPaveText(0.11, 0.85, xmax, 0.89, "blNDC"); + txt2->SetFillColor(0); + if (dataMC) + sprintf(txt1, "CMS Preliminary"); + else + sprintf(txt1, "CMS Simulation Preliminary"); + txt2->AddText(txt1); + txt2->Draw("same"); + pad->Modified(); + pad->Update(); + if (save > 0) { + sprintf(name, "%s.pdf", pad->GetName()); + pad->Print(name); + } else if (save < 0) { + sprintf(name, "%s.C", pad->GetName()); + pad->Print(name); + } +} diff --git a/Calibration/HcalCalibAlgos/macros/CalibSort.C b/Calibration/HcalCalibAlgos/macros/CalibSort.C index 8b8085cce8042..156fb96368ba6 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibSort.C +++ b/Calibration/HcalCalibAlgos/macros/CalibSort.C @@ -110,7 +110,7 @@ // (default "HcalIsoTrkAnalyzer") // // .L CalibSort.C+g -// combineML(const char* inputFileList, const char* outfile) +// combineML(inputFileList, outfile); // // Combines the ML values otained from the analysis of muon analysis to // determine depth dependent correction factors @@ -130,6 +130,21 @@ // (4 quantities per line with no tab separating each item): // #ieta depth ml uncertainity-in-ml // +// .L CalibSort.C+g +// calCorrCombine(inFileCorr, inFileDepth, outFileCorr, truncateFlag, etaMax); +// +// Combines the correction factors obtained from CalibTree and the depth +// dependent correction factors used in the CalibTree command +// +// inputFileCorr (const char*) = file containing correction factors obtained +// from the CalibTree +// inputFileDepth (const char*) = file containing depth dependent correction +// factors used in the CalibTree step +// outfileCorr (const char*) = name of the output file where the combined +// correction factors +// truncateFlag (int) = Truncate flag used in the CalibTree step +// etaMax (int) = Maximum eta value +// ////////////////////////////////////////////////////////////////////////////// #include @@ -2416,3 +2431,121 @@ void combineML(const char *inputFileList, const char *outfile) { } } } + +void calCorrCombine( + const char *inFileCorr, const char *inFileDepth, const char *outFileCorr, int truncateFlag, int etaMax) { + const int neta = 58; + int ietas[neta] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, + -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29}; + int depthMin[neta] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + int depthMax[neta] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 3}; + + // Read the correction factors + std::map > cfactors; + if (std::string(inFileCorr) != "") { + std::ifstream fInput(inFileCorr); + if (!fInput.good()) { + std::cout << "Cannot open file " << inFileCorr << std::endl; + } else { + char buffer[1024]; + unsigned int all(0), good(0); + while (fInput.getline(buffer, 1024)) { + ++all; + if (buffer[0] == '#') + continue; //ignore comment + std::vector items = splitString(std::string(buffer)); + if (items.size() != 5) { + std::cout << "Ignore line: " << buffer << std::endl; + } else { + ++good; + std::istringstream converter(items[0].c_str()); + unsigned int det; + converter >> std::hex >> det; + double corrf = std::atof(items[3].c_str()); + double dcorr = std::atof(items[4].c_str()); + cfactors[det] = std::pair(corrf, dcorr); + } + } + fInput.close(); + std::cout << "Reads total of " << all << " and " << good << " good records" << std::endl; + } + } + + // Read in the depth dependent correction factors + std::map > weights; + if (std::string(inFileDepth) != "") { + std::ifstream infile(inFileDepth); + if (!infile.is_open()) { + std::cout << "Cannot open duplicate file " << inFileDepth << std::endl; + } else { + unsigned int all(0), good(0); + char buffer[1024]; + while (infile.getline(buffer, 1024)) { + ++all; + std::string bufferString(buffer); + if (bufferString.substr(0, 1) == "#") { + continue; //ignore other comments + } else { + std::vector items = splitString(bufferString); + if (items.size() < 3) { + std::cout << "Ignore line: " << buffer << " Size " << items.size() << std::endl; + } else { + ++good; + int ieta = std::atoi(items[0].c_str()); + std::vector weight; + for (unsigned int k = 1; k < items.size(); ++k) { + double corrf = std::atof(items[k].c_str()); + weight.push_back(corrf); + } + weights[ieta] = weight; + } + } + } + infile.close(); + std::cout << "Reads total of " << all << " and " << good << " good records of depth dependent factors from " + << inFileDepth << std::endl; + } + } + + // Now combine the two information + std::map > cfacFinal; + std::ofstream outfile(outFileCorr); + outfile << "#" << std::setprecision(4) << std::setw(10) << "detId" << std::setw(10) << "ieta" << std::setw(10) + << "depth" << std::setw(15) << "corrFactor" << std::endl; + for (int k = 0; k < neta; ++k) { + int ieta = ietas[k]; + for (int depth = depthMin[k]; depth <= depthMax[k]; ++depth) { + int subdet = ifHB(ieta, depth) ? 1 : 2; + int d = truncateDepth(ieta, depth, truncateFlag); + unsigned int key = repackId(subdet, ieta, 0, d); + double c1(1), dc1(0), c2(1); + if (cfactors.find(key) != cfactors.end()) { + c1 = cfactors[key].first; + dc1 = cfactors[key].second; + } + if (weights.find(ieta) != weights.end()) { + if (static_cast(depth) <= weights[ieta].size()) + c2 = (weights[ieta])[depth - 1]; + } + double cf = c1 * c2; + double dcf = dc1 * c2; + if (std::abs(ieta) > etaMax) { + int ieta0 = (ieta > 0) ? etaMax : -etaMax; + key = repackId(subdet, ieta0, 0, depth); + if (cfacFinal.find(key) != cfacFinal.end()) { + cf = cfacFinal[key].first; + dcf = cfacFinal[key].second; + } + } + key = repackId(subdet, ieta, 0, depth); + cfacFinal[key] = std::pair(cf, dcf); + if (std::abs(ieta) <= etaMax) + outfile << std::setw(10) << std::hex << key << std::setw(10) << std::dec << ieta << std::setw(10) << depth + << std::setw(10) << cf << " " << std::setw(10) << dcf << std::endl; + } + } + outfile.close(); +} diff --git a/Calibration/HcalIsolatedTrackReco/python/HITpixelTripletRegGenerator_cfi.py b/Calibration/HcalIsolatedTrackReco/python/HITpixelTripletRegGenerator_cfi.py index 529d09b94225e..9b977cea57e87 100644 --- a/Calibration/HcalIsolatedTrackReco/python/HITpixelTripletRegGenerator_cfi.py +++ b/Calibration/HcalIsolatedTrackReco/python/HITpixelTripletRegGenerator_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from RecoPixelVertexing.PixelTriplets.PixelTripletHLTGenerator_cfi import * +from RecoTracker.PixelSeeding.PixelTripletHLTGenerator_cfi import * HITpixelTripletRegGenerator = cms.EDProducer("SeedGeneratorFromRegionHitsEDProducer", OrderedHitsFactoryPSet = cms.PSet( ComponentName = cms.string('StandardHitTripletGenerator'), diff --git a/Calibration/LumiAlCaRecoProducers/python/CorrPCCProducer_cfi.py b/Calibration/LumiAlCaRecoProducers/python/CorrPCCProducer_cfi.py index 6b61f7bfc7dc3..debb499759816 100644 --- a/Calibration/LumiAlCaRecoProducers/python/CorrPCCProducer_cfi.py +++ b/Calibration/LumiAlCaRecoProducers/python/CorrPCCProducer_cfi.py @@ -8,7 +8,7 @@ ProdInst = cms.string("rawPCCRandom"), approxLumiBlockSize=cms.int32(50), trigstring = cms.untracked.string("corrPCCRand"), - type2_a= cms.double(0.00072), - type2_b= cms.double(0.014), + type2_a= cms.double(0.00094), + type2_b= cms.double(0.018), ) ) diff --git a/Calibration/LumiAlCaRecoProducers/python/alcaRawPCCProducer_cfi.py b/Calibration/LumiAlCaRecoProducers/python/alcaRawPCCProducer_cfi.py index 5fd6d532347b0..bb80d48decfcc 100644 --- a/Calibration/LumiAlCaRecoProducers/python/alcaRawPCCProducer_cfi.py +++ b/Calibration/LumiAlCaRecoProducers/python/alcaRawPCCProducer_cfi.py @@ -14,4 +14,4 @@ ) -rawPCCProd.RawPCCProducerParameters.modVeto.extend([303042564,303042568,303042572,303042576,303042580,303042588,303042592,303046660,303046664,303046668,303046672,303046676,303046680,303046684,303046688,303050760,303050764,303050768,303050772,303050776,303050780,303050784,303054852,303054856,303054860,303054864,303054868,303054872,303054876,303054880,303058948,303058952,303058956,303058960,303058964,303058968,303058972,303058976,303063044,303063048,303063052,303063056,303063060,303063064,303063068,303063072,303067140,303067144,303067148,303067152,303067156,303067160,303067164,303067168,303071236,303071240,303071244,303071248,303071252,303071256,303071260,303071264,303075332,303075336,303075340,303075344,303075348,303075352,303075356,303075360,303079428,303079432,303079436,303079440,303079444,303079448,303079452,303079456,303083524,303083528,303083532,303083536,303083540,303083544,303083548,303083552,303087620,303087624,303087628,303087632,303087636,303087640,303087644,303087648,304091140,304091144,304091148,304091156,304091160,304091164,304091168,304095236,304095240,304095244,304095248,304095252,304095256,304095260,304095264,304099332,304099336,304099340,304099344,304099348,304099352,304099356,304099360,304103428,304103432,304103436,304103440,304103444,304103448,304103452,304103456,304107524,304107528,304107532,304107536,304107540,304107544,304107548,304111620,304111624,304111628,304111632,304111636,304111640,304111644,304111648,304115716,304115720,304115724,304115728,304115732,304115736,304115740,304115744,304119812,304119816,304119828,304119832,304119836,304119840,304123908,304123928,304123932,304123936,304128004,304128008,304128012,304128016,304128020,304128024,304128028,304128032,304132100,304132104,304132108,304132112,304132120,304132124,304132128,304136196,304136200,304136204,304136212,304136216,304136220,304136224,304140292,304140296,304140300,304140304,304140308,304140312,304140316,304140320,304144388,304144392,304144396,304144400,304144404,304144408,304144412,304144416,304148484,304148488,304148492,304148496,304148500,304148504,304148508,304148512,304152580,304152584,304152588,304152592,304152596,304152600,304152604,304152608,304156676,304156680,304156688,304156692,304156696,304156700,304156704,304160772,304160776,304160780,304160784,304160788,304160792,304160796,304160800,304164868,304164872,304164876,304164880,304164884,304164888,304164892,304164896,304168964,304168968,304168984,304168988,304168992,304173060,304173064,304173068,304173072,304173076,304173080,304173084,304173088,304177156,304177160,304177164,304177168,304177172,304177176,304177180,304177184,304181252,304181256,304181260,304181264,304181268,304181272,304181276,304181280,304185348,304185352,304185356,304185360,304185364,304185368,304185372,304185376,304189444,304189448,304189452,304189456,304189460,304189464,304189468,304189472,304193540,304193544,304193548,304193552,304193556,304193560,304193564,304193568,304197636,304197640,304197644,304197648,304197652,304197656,304197660,304197664,304201732,304201736,304201740,304201744,304201748,304201752,304201756,304201760,305139736,305139744,305143812,305143816,305143820,305143824,305143828,305147912,305147928,305147932,305152008,305152012,305152020,305152024,305152028,305152032,305156104,305156116,305156120,305156124,305156128,305160200,305160212,305160216,305160220,305160224,305164308,305164316,305164320,305168392,305168396,305168400,305168404,305168412,305172492,305172500,305172508,305176580,305176596,305176600,305176604,305176608,305180676,305180688,305180692,305180696,305180700,305180704,305184784,305184792,305184796,305188872,305188876,305188888,305188892,305188896,305192972,305192976,305192980,305192988,305192992,305197060,305197068,305197084,305201156,305201160,305201164,305201168,305201172,305201176,305201180,305205256,305205264,305205272,305205280,305209348,305209352,305209356,305209368,305209376,305213444,305213452,305213460,305213464,305213472,305217544,305217552,305217556,305217560,305217564,305217568,305221636,305221640,305221652,305221656,305221660,305221664,305225736,305225740,305225748,305225752,305225756,305225760,305229828,305229836,305229840,305233924,305233932,305233940,305233948,305238028,305238032,305238036,305238048,305242136,305246224,305250308,305250328,305254416,305254420,305254424,305258504,305258508,305258512,305258516,305258524,305262596,305262604,305262608,305262612,305266696,305266712,305266716,305266720,305270788,305270792,305270796,305270804,305274884,305274904,305274908,305278988,305278992,305278996,305283076,305283092,305287172,305287180,305291268,305291272,305291276,305291284,305291288,305295364,305295376,305295380,305295384,305295392,305299468,305299476,305299484,305303560,305303584,305307652,305307656,305307660,305307676,305307680,305311748,305311772,305311776,305315852,305315856,305315860,305315868,306188296,306188312,306192400,306196508,306196512,306200608,306204684,306204692,306204696,306204700,306204704,306208788,306208792,306208796,306208800,306212868,306212872,306212876,306212880,306212884,306212888,306212892,306212896,306216964,306216980,306216984,306216988,306216992,306221076,306225160,306225164,306225172,306225176,306229260,306229264,306229272,306229280,306233352,306233360,306233364,306237448,306237452,306237460,306237464,306237468,306237472,306241544,306241548,306241556,306241560,306241564,306241568,306245636,306245644,306245648,306245652,306245656,306245660,306245664,306249732,306249736,306249740,306249748,306249752,306249756,306249760,306253844,306257936,306257952,306262024,306262028,306266124,306266128,306266136,306270212,306270228,306270240,306278424,306278432,306282508,306282528,306286596,306286604,306290692,306290700,306290704,306298900,306298904,306298908,306298912,306302980,306302984,306302988,306302996,306307088,306307096,306311172,306311184,306311200,306319368,306319372,306319380,306319388,306319392,306323468,306323484,306327572,306331652,306331656,306331664,306331668,306335748,306335760,306335768,306335772,306335776,306339860,306339868,306339872,306343944,306343956,306343968,306348040,306348056,306352132,306352136,306352140,306352156,306352160,306356232,306356244,306360332,306360344,306364440,306364448,306368532,306368536,306368544,306372612,306376708,306376728,306376732,306380812,306380820,306384904,306384920,306384928,306388996,306389004,306393108,306397196,306397200,306401284,306401296,306401300,306401304,306405384,306405396,306405400,306409480,306409484,306409500,306409504,306413572,306413580,306413596,306417688,306417696,306421780,306425860,306425864,306425868,306425884,306425888,306429960,306429964,306429972,306429976,306434068,306434072,306434076,306434080,306438148,306438156,306438160,306442252,306442260,306442264,306442268,306442272,306446340,306446356,306446360,306446364,306446368,344201220,344205316,344208388,344213508,344220676,344221700,344225796,344233988,344241156,344242180,344246276,344249348,344253444,344254468,344257540,344262660,344265732,344266756,344270852,344274948,344278020,344279044,344282116,344291332,344295428,344298500,344302596,344303620,344314884,344320004,344324100,344328196,344332292,344335364,344336388,344339460,344340484,344344580,344348676,344365060,344369156,344373252,344376324,344380420,344384516,344389636,344397828,344401924,344406020,344409092,344410116,344422404,344425476,344426500,344462340,344463364,344466436,344467460,344471556,344474628,344475652,344478724,344479748,344482820,344483844,344486916,344487940,344495108,344499204,344500228,344508420,344511492,344512516,344515588,344516612,344520708,344523780,344524804,344532996,344537092,344540164,344541188,344545284,344548356,344549380,344553476,344556548,344560644,344561668,344568836,344569860,344572932,344573956,344577028,344578052,344581124,344582148,344585220,344586244,344598532,344602628,344605700,344606724,344609796,344610820,344613892,344617988,344627204,344630276,344631300,344638468,344642564,344646660,344647684,344650756,344659972,344664068,344667140,344668164,344672260,344676356,344679428,344680452,344687620,344688644,344729604,344733700,344736772,344740868,344741892,344744964,344749060,344750084,344753156,344757252,344758276,344761348,344762372,344765444,344766468,344769540,344774660,344777732,344778756,344781828,344782852,344785924,344786948,344790020,344791044,344794116,344795140,344798212,344799236,344802308,344803332,344806404,344807428,344811524,344826884,344827908,344830980,344843268,344844292,344847364,344848388,344851460,344855556,344863748,344867844,344871940,344872964,344876036,344877060,344881156,344892420,344896516,344900612,344901636,344904708,344913924,344921092,344922116,344930308,344933380,344946692,344950788,352588804,352589828,352592900,352593924,352596996,352601092,352602116,352605188,352606212,352609284,352610308,352617476,352621572,352622596,352625668,352626692,352629764,352630788,352633860,352634884,352637956,352638980,352642052,352643076,352646148,352654340,352658436,352659460,352662532,352663556,352666628,352667652,352670724,352671748,352675844,352678916,352679940,352683012,352684036,352687108,352688132,352691204,352692228,352695300,352696324,352699396,352700420,352703492,352704516,352707588,352708612,352711684,352712708,352715780,352719876,352740356,352741380,352744452,352745476,352748548,352749572,352753668,352757764,352761860,352765956,352770052,352774148,352781316,352782340,352786436,352789508,352790532,352793604,352794628,352797700,352798724,352801796,352802820,352805892,352806916,352809988,352811012,352814084,352815108,352850948,352851972,352855044,352856068,352859140,352860164,352863236,352864260,352868356,352871428,352872452,352875524,352876548,352879620,352883716,352892932,352896004,352900100,352901124,352904196,352905220,352908292,352912388,352913412,352920580,352924676,352925700,352928772,352936964,352937988,352941060,352945156,352949252,352950276,352953348,352954372,352957444,352958468,352962564,352966660,352974852,352995332,352999428,353002500,353010692,353015812,353018884,353022980,353024004,353044484,353047556,353048580,353052676,353063940,353068036,353073156,353076228,353118212,353122308,353126404,353129476,353130500,353134596,353141764,353142788,353146884,353149956,353150980,353154052,353155076,353158148,353162244,353163268,353166340,353167364,353170436,353174532,353175556,353178628,353179652,353183748,353187844,353190916,353191940,353195012,353196036,353199108,353200132,353203204,353204228,353207300,353208324,353211396,353216516,353219588,353223684,353224708,353228804,353231876,353235972,353240068,353244164,353249284,353252356,353256452,353268740,353281028,353285124,353286148,353290244,353293316,353298436,353302532,353305604,353313796,353314820,353317892,353321988,353326084,353330180,353331204,353334276,353338372,353339396]) +rawPCCProd.RawPCCProducerParameters.modVeto.extend([303042564,303042568,303042572,303042576,303042580,303042584,303042588,303042592,303046660,303046664,303046668,303046672,303046676,303046680,303046684,303046688,303050756,303050760,303050764,303050768,303050772,303050776,303050780,303050784,303054852,303054856,303054860,303054864,303054868,303054872,303054876,303054880,303058948,303058952,303058956,303058960,303058964,303058968,303058972,303058976,303063044,303063048,303063052,303063056,303063060,303063064,303063068,303063072,303067140,303067144,303067148,303067152,303067156,303067160,303067164,303067168,303071236,303071240,303071244,303071248,303071252,303071256,303071260,303071264,303075332,303075336,303075340,303075344,303075348,303075352,303075356,303075360,303079428,303079432,303079436,303079440,303079444,303079448,303079452,303079456,303083524,303083528,303083532,303083536,303083540,303083544,303083548,303083552,303087620,303087624,303087628,303087632,303087636,303087640,303087644,303087648,304091140,304091144,304091148,304091152,304091156,304091160,304091164,304091168,304095236,304095240,304095244,304095252,304095260,304095264,304099332,304099336,304099340,304099344,304099348,304099352,304099356,304103428,304103436,304103444,304103448,304103452,304103456,304107524,304107528,304107532,304107536,304107540,304107548,304107552,304111620,304111628,304111636,304111648,304115720,304115724,304115728,304115732,304115736,304115740,304115744,304119812,304119820,304119824,304119828,304119832,304119836,304119840,304123908,304123912,304123916,304123920,304123928,304128004,304128008,304128012,304128016,304128020,304128024,304128032,304132100,304132108,304132112,304132116,304132120,304132124,304136196,304136200,304136204,304136208,304136212,304136216,304136220,304136224,304140292,304140296,304140300,304140304,304140308,304140312,304140316,304140320,304144388,304144392,304144400,304144404,304144408,304144412,304144416,304148484,304148492,304148496,304148504,304148508,304152584,304152588,304152592,304152596,304152608,304156676,304156680,304156684,304156688,304156692,304156696,304160772,304160776,304160780,304160784,304160788,304160792,304160796,304160800,304164868,304164872,304164876,304164880,304164884,304164888,304164896,304168964,304168968,304168972,304168980,304168984,304168988,304168992,304173060,304173064,304173068,304173072,304173076,304173080,304173084,304173088,304177156,304177164,304177168,304177172,304177176,304177180,304177184,304181252,304181256,304181260,304181264,304181272,304181276,304181280,304185348,304185352,304185356,304185360,304185368,304185376,304189444,304189448,304189452,304189456,304189460,304189464,304189468,304189472,304193540,304193544,304193548,304193552,304193556,304193560,304193564,304193568,304197636,304197644,304197652,304197656,304197660,304197664,304201732,304201736,304201740,304201748,304201752,304201756,304201760,305139716,305139736,305139740,305143820,305143828,305143832,305147908,305147912,305147916,305147920,305147924,305147928,305147932,305147936,305152012,305152020,305152028,305152032,305156104,305156108,305156112,305156116,305160208,305160212,305160220,305160224,305164300,305164304,305164308,305164312,305168388,305168392,305168404,305168408,305168412,305172484,305172488,305172492,305172500,305172504,305172508,305172512,305176584,305176588,305176592,305176596,305176608,305180684,305180688,305180692,305180700,305180704,305184772,305184776,305184784,305184792,305184796,305184800,305188868,305188872,305188884,305188888,305188892,305188896,305192964,305192968,305192972,305192980,305192984,305192988,305192992,305197060,305197068,305197080,305197084,305201156,305201160,305201164,305201180,305201184,305205252,305205256,305205260,305205268,305205272,305205276,305205280,305209348,305209352,305209356,305209364,305209368,305209372,305209376,305213444,305213448,305213452,305213456,305213460,305213464,305213472,305217540,305217544,305217548,305217564,305217568,305221636,305221640,305221644,305221648,305221652,305221656,305225732,305225736,305225740,305225744,305225752,305225760,305229832,305229836,305229840,305229844,305229856,305233932,305233936,305233940,305233952,305238020,305238024,305238028,305238032,305238036,305242116,305242124,305242128,305242140,305242144,305246212,305246224,305246232,305246236,305246240,305250316,305250324,305250336,305254404,305254412,305254424,305258504,305258512,305258516,305258520,305258528,305262596,305262600,305262604,305262608,305262616,305262620,305266692,305266708,305266716,305266720,305270792,305270796,305270800,305270804,305274888,305274892,305274900,305274904,305274908,305274912,305278984,305278988,305278992,305279000,305279008,305283076,305283084,305283088,305283092,305283096,305283104,305287172,305287176,305291268,305291272,305291276,305291280,305291284,305291288,305291292,305291296,305295368,305295376,305295380,305295384,305295388,305299468,305299472,305299476,305299484,305303556,305303560,305303564,305303568,305303572,305303576,305303580,305307652,305307656,305307660,305307664,305307668,305307676,305307680,305311748,305311752,305311756,305311760,305311764,305311772,305311776,305315848,305315856,305315860,305315864,305315872,306188292,306188296,306188300,306188304,306188316,306192388,306192392,306192396,306192404,306192408,306192412,306192416,306196484,306196488,306196492,306196500,306196504,306196508,306196512,306200580,306200584,306200588,306200592,306200596,306200600,306200604,306200608,306204680,306204696,306204700,306204704,306208776,306208780,306208784,306208788,306208792,306208800,306212868,306212872,306212876,306212888,306216968,306216972,306216976,306216980,306216984,306216988,306216992,306221064,306221072,306221076,306221080,306221088,306225164,306225168,306225172,306225176,306225180,306225184,306229252,306229256,306229260,306229268,306229272,306229280,306233348,306233356,306233360,306233368,306233372,306233376,306237464,306241540,306241544,306241552,306241556,306241560,306241564,306241568,306245644,306245652,306245656,306245660,306245664,306249736,306249744,306249748,306249752,306249756,306249760,306253828,306253832,306253840,306253844,306253848,306253852,306253856,306257924,306257936,306257944,306257948,306262020,306262024,306262028,306262036,306262040,306262044,306262048,306266120,306266128,306266136,306266144,306270212,306270216,306270220,306270224,306270232,306270236,306270240,306274308,306274328,306274332,306274336,306278408,306278412,306278420,306278424,306278432,306282504,306282520,306282528,306286596,306286600,306286604,306286608,306286612,306286620,306286624,306290692,306290696,306290700,306290704,306290708,306290712,306290716,306290720,306294788,306294792,306294796,306294800,306294804,306294808,306294816,306298884,306298888,306298892,306298896,306298900,306298904,306298908,306298912,306302980,306302984,306302988,306302992,306303004,306303008,306307076,306307080,306307084,306307088,306307092,306307096,306311172,306311176,306311180,306311184,306311188,306311192,306311196,306315268,306315272,306315276,306315280,306315292,306319364,306319368,306319372,306319376,306319380,306319384,306319392,306323460,306323464,306323468,306323472,306323476,306323480,306323484,306323488,306327556,306327560,306327564,306327568,306327572,306327576,306327580,306327584,306331652,306331656,306331660,306331664,306331680,306335748,306335752,306335756,306335760,306335764,306335772,306335776,306339844,306339848,306339852,306339856,306339860,306339864,306339868,306339872,306343940,306343944,306343948,306343952,306343968,306348036,306348040,306348052,306352132,306352136,306352140,306352144,306352148,306352152,306352156,306352160,306356228,306356236,306356240,306356244,306356248,306356252,306356256,306360324,306360328,306360332,306360336,306360340,306360344,306360348,306360352,306364420,306364424,306364428,306364432,306364436,306364440,306364444,306364448,306368516,306368520,306368524,306368528,306368532,306368536,306368540,306368544,306372616,306372628,306372636,306376708,306376716,306376720,306376724,306376728,306380808,306380812,306380828,306384900,306384904,306384908,306384912,306384928,306388996,306389000,306389004,306389008,306389012,306389016,306389024,306393092,306393096,306393100,306393104,306393108,306393112,306393116,306393120,306397188,306397192,306397196,306397200,306397208,306397212,306397216,306401288,306405380,306405388,306405392,306405396,306405400,306405404,306405408,306409476,306409480,306409488,306409492,306409496,306409504,306413572,306413576,306413580,306413588,306413596,306413600,306417668,306417680,306417692,306417696,306421764,306421768,306421772,306421776,306421784,306421788,306421792,306425860,306425864,306425868,306425872,306425876,306425880,306425888,306429956,306429960,306429964,306429968,306429976,306429980,306429984,306434052,306434060,306434076,306434080,306438152,306438160,306438164,306438168,306438176,306442244,306442268,306442272,306446340,306446356,306446360,306446364,306446368,344200196,344205316,344208388,344212484,344213508,344216580,344217604,344220676,344221700,344224772,344225796,344228868,344232964,344233988,344237060,344241156,344242180,344245252,344249348,344253444,344257540,344258564,344261636,344262660,344265732,344266756,344269828,344270852,344273924,344274948,344278020,344279044,344282116,344283140,344286212,344287236,344290308,344291332,344294404,344295428,344298500,344299524,344302596,344303620,344306692,344307716,344310788,344311812,344314884,344315908,344318980,344320004,344323076,344327172,344328196,344331268,344335364,344339460,344343556,344344580,344347652,344348676,344351748,344352772,344355844,344356868,344359940,344360964,344364036,344365060,344368132,344369156,344372228,344373252,344376324,344377348,344384516,344389636,344392708,344396804,344397828,344404996,344413188,344421380,344425476,344426500,344463364,344466436,344467460,344471556,344478724,344479748,344482820,344486916,344487940,344491012,344500228,344504324,344507396,344508420,344511492,344512516,344516612,344519684,344520708,344523780,344527876,344528900,344531972,344532996,344537092,344540164,344541188,344545284,344548356,344552452,344553476,344556548,344557572,344561668,344564740,344565764,344568836,344569860,344585220,344586244,344589316,344590340,344593412,344594436,344597508,344598532,344601604,344609796,344613892,344622084,344626180,344627204,344630276,344635396,344643588,344647684,344650756,344655876,344658948,344659972,344663044,344664068,344667140,344668164,344671236,344672260,344676356,344679428,344680452,344683524,344684548,344687620,344688644,344724484,344725508,344728580,344732676,344733700,344736772,344737796,344740868,344744964,344750084,344757252,344758276,344761348,344762372,344765444,344769540,344770564,344774660,344777732,344778756,344781828,344785924,344786948,344790020,344794116,344795140,344798212,344799236,344802308,344803332,344806404,344807428,344810500,344811524,344814596,344815620,344818692,344819716,344823812,344826884,344835076,344836100,344839172,344840196,344843268,344844292,344847364,344848388,344851460,344852484,344855556,344856580,344859652,344860676,344863748,344864772,344868868,344871940,344872964,344876036,344885252,344888324,344889348,344892420,344893444,344900612,344901636,344904708,344905732,344908804,344909828,344912900,344913924,344916996,344918020,344921092,344922116,344925188,344926212,344929284,344933380,344934404,344937476,344938500,344941572,344942596,344945668,344946692,344949764,344950788,352588804,352589828,352592900,352593924,352596996,352598020,352601092,352602116,352605188,352606212,352613380,352614404,352617476,352618500,352621572,352622596,352629764,352630788,352633860,352637956,352642052,352643076,352646148,352650244,352655364,352658436,352659460,352662532,352663556,352666628,352667652,352674820,352675844,352678916,352679940,352683012,352684036,352687108,352688132,352691204,352692228,352695300,352696324,352699396,352704516,352708612,352712708,352715780,352716804,352719876,352720900,352723972,352724996,352728068,352729092,352732164,352733188,352737284,352740356,352741380,352744452,352745476,352748548,352749572,352753668,352756740,352760836,352761860,352764932,352769028,352770052,352773124,352774148,352777220,352778244,352781316,352782340,352785412,352786436,352789508,352790532,352794628,352797700,352798724,352801796,352802820,352805892,352806916,352809988,352811012,352814084,352815108,352850948,352855044,352856068,352859140,352860164,352863236,352864260,352867332,352868356,352871428,352872452,352875524,352876548,352879620,352884740,352887812,352891908,352892932,352896004,352897028,352901124,352904196,352905220,352908292,352913412,352916484,352921604,352924676,352925700,352928772,352929796,352933892,352936964,352941060,352942084,352945156,352946180,352949252,352950276,352953348,352957444,352958468,352961540,352962564,352966660,352969732,352970756,352973828,352974852,352977924,352978948,352982020,352983044,352986116,352987140,352990212,352991236,352994308,352995332,352998404,352999428,353002500,353003524,353006596,353007620,353010692,353011716,353014788,353015812,353031172,353032196,353035268,353036292,353039364,353040388,353043460,353044484,353052676,353055748,353060868,353063940,353064964,353068036,353069060,353072132,353073156,353076228,353077252,353113092,353114116,353117188,353118212,353122308,353126404,353130500,353133572,353137668,353138692,353141764,353149956,353150980,353154052,353155076,353158148,353162244,353166340,353167364,353170436,353171460,353174532,353175556,353178628,353182724,353186820,353190916,353195012,353196036,353199108,353200132,353203204,353204228,353207300,353208324,353215492,353219588,353223684,353224708,353227780,353228804,353231876,353232900,353235972,353236996,353240068,353241092,353244164,353245188,353248260,353249284,353252356,353253380,353256452,353257476,353260548,353261572,353264644,353265668,353268740,353269764,353272836,353273860,353276932,353277956,353281028,353282052,353285124,353286148,353289220,353290244,353294340,353297412,353298436,353301508,353302532,353305604,353306628,353309700,353310724,353313796,353314820,353317892,353318916,353321988,353323012,353326084,353327108,353330180,353331204,353334276,353335300,353338372,353339396]) diff --git a/Calibration/LumiAlCaRecoProducers/test/BuildFile.xml b/Calibration/LumiAlCaRecoProducers/test/BuildFile.xml index 99ad3dd84b8b7..f8fa0a9bde961 100644 --- a/Calibration/LumiAlCaRecoProducers/test/BuildFile.xml +++ b/Calibration/LumiAlCaRecoProducers/test/BuildFile.xml @@ -1,4 +1 @@ - - - - + diff --git a/Calibration/LumiAlCaRecoProducers/test/test.cpp b/Calibration/LumiAlCaRecoProducers/test/test.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/Calibration/LumiAlCaRecoProducers/test/test.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/Calibration/LumiAlCaRecoProducers/test/test.sh b/Calibration/LumiAlCaRecoProducers/test/test.sh index d3f76ae940e8e..78f3060c7672a 100755 --- a/Calibration/LumiAlCaRecoProducers/test/test.sh +++ b/Calibration/LumiAlCaRecoProducers/test/test.sh @@ -2,4 +2,4 @@ function die { echo $1: status $2 ; exit $2; } -cmsRun --parameter-set ${LOCAL_TEST_DIR}/test_cfg.py || die 'Failed in test_cfg.py' $? +cmsRun --parameter-set ${SCRAM_TEST_PATH}/test_cfg.py || die 'Failed in test_cfg.py' $? diff --git a/Calibration/PPSAlCaRecoProducer/test/BuildFile.xml b/Calibration/PPSAlCaRecoProducer/test/BuildFile.xml index 045e88b9906a4..24875475af5ba 100644 --- a/Calibration/PPSAlCaRecoProducer/test/BuildFile.xml +++ b/Calibration/PPSAlCaRecoProducer/test/BuildFile.xml @@ -1,18 +1,8 @@ - - - - - - + + - - - - - - - - + + + - - + diff --git a/Calibration/PPSAlCaRecoProducer/test/TestDriver.cpp b/Calibration/PPSAlCaRecoProducer/test/TestDriver.cpp deleted file mode 100644 index 9841eb54e4741..0000000000000 --- a/Calibration/PPSAlCaRecoProducer/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/Calibration/PPSAlCaRecoProducer/test/test_express_AlCaRecoProducer.sh b/Calibration/PPSAlCaRecoProducer/test/test_express_AlCaRecoProducer.sh index 3f4698792197f..697565d547e5f 100755 --- a/Calibration/PPSAlCaRecoProducer/test/test_express_AlCaRecoProducer.sh +++ b/Calibration/PPSAlCaRecoProducer/test/test_express_AlCaRecoProducer.sh @@ -11,7 +11,7 @@ COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $INPUTFILE` STATUS=$? echo "xrdfs command status = "$STATUS if [ $STATUS -eq 0 ]; then - echo "Using file ${INPUTFILE}. Running in ${LOCAL_TEST_DIR}." + echo "Using file ${INPUTFILE}. Running in ${SCRAM_TEST_PATH}." (cmsDriver.py testExpressPPSAlCaRecoProducer -s ALCAPRODUCER:PPSCalMaxTracks,ENDJOB \ --process ALCARECO \ --scenario pp \ diff --git a/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.sh b/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.sh index 07e4322d1c9bf..a6a0bd232c279 100755 --- a/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.sh +++ b/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.sh @@ -1,4 +1,4 @@ #!/bin/bash function die { echo $1: status $2; exit $2; } -(cmsRun ${LOCAL_TEST_DIR}/test_express_PPSAlCaReco_output.py) || die 'failed running test_express_PPSAlCaReco_output.py' $? +(cmsRun ${SCRAM_TEST_PATH}/test_express_PPSAlCaReco_output.py) || die 'failed running test_express_PPSAlCaReco_output.py' $? diff --git a/Calibration/PPSAlCaRecoProducer/test/test_prompt_AlCaRecoProducer.sh b/Calibration/PPSAlCaRecoProducer/test/test_prompt_AlCaRecoProducer.sh index b02bdd74d4ade..6d485f1f40870 100755 --- a/Calibration/PPSAlCaRecoProducer/test/test_prompt_AlCaRecoProducer.sh +++ b/Calibration/PPSAlCaRecoProducer/test/test_prompt_AlCaRecoProducer.sh @@ -11,7 +11,7 @@ COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $INPUTFILE` STATUS=$? echo "xrdfs command status = "$STATUS if [ $STATUS -eq 0 ]; then - echo "Using file ${INPUTFILE}. Running in ${LOCAL_TEST_DIR}." + echo "Using file ${INPUTFILE}. Running in ${SCRAM_TEST_PATH}." # note we currently use `auto:run3_data_express` GT # the correct GT (auto:run3_data_prompt) doesn't have LHCInfo record for run 322022 which corresponds to our face ALCARAW file (cmsDriver.py testPromptPPSAlCaRecoProducer -s ALCAPRODUCER:PPSCalMaxTracks,ENDJOB \ diff --git a/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.sh b/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.sh index 4cf5cd156a31d..f6de023687003 100755 --- a/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.sh +++ b/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.sh @@ -1,4 +1,4 @@ #!/bin/bash function die { echo $1: status $2; exit $2; } -(cmsRun ${LOCAL_TEST_DIR}/test_prompt_PPSAlCaReco_output.py) || die 'failed running test_prompt_PPSAlCaReco_output.py' $? +(cmsRun ${SCRAM_TEST_PATH}/test_prompt_PPSAlCaReco_output.py) || die 'failed running test_prompt_PPSAlCaReco_output.py' $? diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py index 3349e359c81b6..7aba63602f994 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_Output_cff.py @@ -11,6 +11,7 @@ 'keep *_*riggerResults_*_HLT', 'keep *_*closebyPixelClusters*_*_*', 'keep *_*trackDistances*_*_*', + 'keep PileupSummaryInfos_addPileupInfo_*_*' ) ) OutALCARECOSiPixelCalSingleMuonTight=OutALCARECOSiPixelCalSingleMuonTight_noDrop.clone() diff --git a/Calibration/TkAlCaRecoProducers/test/BuildFile.xml b/Calibration/TkAlCaRecoProducers/test/BuildFile.xml index b6a98b003b808..702e79509cf30 100644 --- a/Calibration/TkAlCaRecoProducers/test/BuildFile.xml +++ b/Calibration/TkAlCaRecoProducers/test/BuildFile.xml @@ -1,13 +1,5 @@ - - - - - - - - - - + + diff --git a/Calibration/TkAlCaRecoProducers/test/testAlCaHarvesting.sh b/Calibration/TkAlCaRecoProducers/test/testAlCaHarvesting.sh index 3ad6257e4a2e6..5b0548e101026 100755 --- a/Calibration/TkAlCaRecoProducers/test/testAlCaHarvesting.sh +++ b/Calibration/TkAlCaRecoProducers/test/testAlCaHarvesting.sh @@ -10,7 +10,7 @@ function cleanTheHouse { } echo "TESTING Calibration/TkAlCaRecoProducers ..." -cmsRun -e -j testPCLAlCaHarvesting.xml ${LOCAL_TEST_DIR}/testPCLAlCaHarvesting.py || die "Failure running testPCLAlCaHarvesting.py" $? +cmsRun -e -j testPCLAlCaHarvesting.xml ${SCRAM_TEST_PATH}/testPCLAlCaHarvesting.py || die "Failure running testPCLAlCaHarvesting.py" $? cleanTheHouse echo "PARSING Framework Job Report ..." -python3 ${LOCAL_TEST_DIR}/parseFwkJobReport.py +python3 ${SCRAM_TEST_PATH}/parseFwkJobReport.py diff --git a/Calibration/TkAlCaRecoProducers/test/testBeamSpotWorkflow.sh b/Calibration/TkAlCaRecoProducers/test/testBeamSpotWorkflow.sh index 2a6de8801ea5e..8008ce8f4dc84 100755 --- a/Calibration/TkAlCaRecoProducers/test/testBeamSpotWorkflow.sh +++ b/Calibration/TkAlCaRecoProducers/test/testBeamSpotWorkflow.sh @@ -6,7 +6,7 @@ if [ "${SCRAM_TEST_NAME}" != "" ] ; then fi echo "TESTING AlcaBeamSpotProducer ..." -cmsRun ${LOCAL_TEST_DIR}/Alca_BeamFit_Workflow.py || die "Failure running Alca_BeamFit_Workflow.py" $? +cmsRun ${SCRAM_TEST_PATH}/Alca_BeamFit_Workflow.py || die "Failure running Alca_BeamFit_Workflow.py" $? echo "TESTING AlcaBeamSpotHarvester ..." -cmsRun ${LOCAL_TEST_DIR}/Alca_BeamSpot_Harvester.py || die "Failure running Alca_BeamSpot_Harvester.py" $? +cmsRun ${SCRAM_TEST_PATH}/Alca_BeamSpot_Harvester.py || die "Failure running Alca_BeamSpot_Harvester.py" $? diff --git a/Calibration/TkAlCaRecoProducers/test/testCalibrationTkAlCaRecoProducers.cpp b/Calibration/TkAlCaRecoProducers/test/testCalibrationTkAlCaRecoProducers.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/Calibration/TkAlCaRecoProducers/test/testCalibrationTkAlCaRecoProducers.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc index b8f5edb30ee1c..82b891b05f572 100644 --- a/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc +++ b/CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.cc @@ -125,17 +125,17 @@ EcalDigiDisplay::EcalDigiDisplay(const edm::ParameterSet& ps) } } } else //if EE DCC is being picked up - if (ttDigi) { - //Check with Towers in Endcap - for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) { - if ((*intIter) > 34) { - edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. " - << " Valid range for EE DCC is 1-34. Returning."; - inputIsOk = false; - return; + if (ttDigi) { + //Check with Towers in Endcap + for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) { + if ((*intIter) > 34) { + edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. " + << " Valid range for EE DCC is 1-34. Returning."; + inputIsOk = false; + return; + } } } - } //PNs listPns = ps.getUntrackedParameter >("listPns", listDefaults); diff --git a/CommonTools/TrackerMap/src/TrackerMap.cc b/CommonTools/TrackerMap/src/TrackerMap.cc index bfe3aa2e67773..d993e2133a840 100644 --- a/CommonTools/TrackerMap/src/TrackerMap.cc +++ b/CommonTools/TrackerMap/src/TrackerMap.cc @@ -559,11 +559,6 @@ TrackerMap::~TrackerMap() { TmPsu *psu = ipsu->second; delete psu; } - - gROOT->Reset(); - - //for(std::vector::iterator col1=vc.begin();col1!=vc.end();col1++){ - // std::cout<<(*col1)<AddText(buffer); @@ -764,7 +765,7 @@ namespace AlignmentPI { } stat->AddText(buffer); - stat->SetLineColor(color); + stat->SetLineColor(0); stat->SetTextColor(color); stat->SetFillColor(10); stat->SetShadowColor(10); @@ -881,6 +882,17 @@ namespace AlignmentPI { virtual ~TkAlBarycenters() {} }; + /*--------------------------------------------------------------------*/ + inline void TkAlBarycenters::init() + /*--------------------------------------------------------------------*/ + { + // empty all maps + Xbarycenters.clear(); + Ybarycenters.clear(); + Zbarycenters.clear(); + nmodules.clear(); + } + /*--------------------------------------------------------------------*/ inline GlobalPoint TkAlBarycenters::getPartitionAvg(AlignmentPI::PARTITION p) /*--------------------------------------------------------------------*/ @@ -894,10 +906,8 @@ namespace AlignmentPI { const std::map& GPR) /*--------------------------------------------------------------------*/ { - // zero in the n. modules per partition... - for (const auto& p : PARTITIONS) { - nmodules[p] = 0.; - } + // clear all data members; + init(); for (const auto& ali : input) { if (DetId(ali.rawId()).det() != DetId::Tracker) { @@ -998,7 +1008,7 @@ namespace AlignmentPI { /*--------------------------------------------------------------------*/ inline void fillComparisonHistogram(const AlignmentPI::coordinate& coord, - std::vector& boundaries, + std::map& boundaries, const std::vector& ref_ali, const std::vector& target_ali, std::unique_ptr& compare) @@ -1014,7 +1024,7 @@ namespace AlignmentPI { auto thePart = static_cast(subid); if (thePart != currentPart) { currentPart = thePart; - boundaries.push_back(counter); + boundaries.insert({counter, thePart}); } CLHEP::HepRotation target_rot(target_ali[i].rotation()); @@ -1074,7 +1084,7 @@ namespace AlignmentPI { } /*--------------------------------------------------------------------*/ - inline void fillComparisonHistograms(std::vector& boundaries, + inline void fillComparisonHistograms(std::map& boundaries, const std::vector& ref_ali, const std::vector& target_ali, std::unordered_map >& compare, @@ -1098,7 +1108,7 @@ namespace AlignmentPI { if (thePart != currentPart) { currentPart = thePart; - boundaries.push_back(counter); + boundaries.insert({counter, thePart}); } CLHEP::HepRotation target_rot(target_ali[i].rotation()); diff --git a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc index e8fda41952064..f2a185b230615 100644 --- a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc +++ b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc @@ -28,10 +28,11 @@ #include "CondCore/AlignmentPlugins/interface/AlignmentPayloadInspectorHelper.h" #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h" +#include +#include // std::setprecision +#include #include #include -#include -#include // std::setprecision // include ROOT #include "TH2F.h" @@ -154,7 +155,8 @@ namespace { } // fill all the histograms together - std::vector boundaries; + std::map boundaries; + boundaries.insert({0, AlignmentPI::BPix}); // always start with BPix, not filled in the loop AlignmentPI::fillComparisonHistograms(boundaries, ref_ali, target_ali, diffs); unsigned int subpad{1}; @@ -216,25 +218,32 @@ namespace { for (const auto &coord : coords) { auto s_coord = AlignmentPI::getStringFromCoordinate(coord); canvas.cd(subpad + 1); - - unsigned int i = 0; - for (const auto &line : boundaries) { - l[subpad][i] = TLine(diffs[coord]->GetBinLowEdge(line), - canvas.cd(subpad + 1)->GetUymin(), - diffs[coord]->GetBinLowEdge(line), - canvas.cd(subpad + 1)->GetUymax() * 0.84); - l[subpad][i].SetLineWidth(1); - l[subpad][i].SetLineStyle(9); - l[subpad][i].SetLineColor(2); - l[subpad][i].Draw("same"); - i++; + for (const auto &line : boundaries | boost::adaptors::indexed(0)) { + const auto &index = line.index(); + const auto value = line.value(); + l[subpad][index] = TLine(diffs[coord]->GetBinLowEdge(value.first), + canvas.cd(subpad + 1)->GetUymin(), + diffs[coord]->GetBinLowEdge(value.first), + canvas.cd(subpad + 1)->GetUymax() * 0.84); + l[subpad][index].SetLineWidth(1); + l[subpad][index].SetLineStyle(9); + l[subpad][index].SetLineColor(2); + l[subpad][index].Draw("same"); } - const auto &theX_ = {0.2, 0.24, 0.31, 0.4, 0.55, 0.8}; - for (unsigned int j = 1; j <= 7; j++) { - auto thePart = static_cast(j); + const bool ph2 = (ref_ali.size() > AlignmentPI::phase1size); + for (const auto &elem : boundaries | boost::adaptors::indexed(0)) { + const auto &lm = canvas.cd(subpad + 1)->GetLeftMargin(); + const auto &rm = 1 - canvas.cd(subpad + 1)->GetRightMargin(); + const auto &frac = float(elem.value().first) / ref_ali.size(); + + LogDebug("TrackerAlignmentCompareAll") + << __PRETTY_FUNCTION__ << " left margin: " << lm << " right margin: " << rm << " fraction: " << frac; + + float theX_ = lm + (rm - lm) * frac + (elem.index() > 0 ? 0.025 : 0.01); + tSubdet[subpad].DrawLatex( - theX_.begin()[j - 1], 0.20, Form("%s", (AlignmentPI::getStringFromPart(thePart)).c_str())); + theX_, 0.23, Form("%s", AlignmentPI::getStringFromPart(elem.value().second, /*is phase2?*/ ph2).c_str())); } auto ltx = TLatex(); @@ -342,7 +351,8 @@ namespace { ref_ali.size() - 0.5); // fill the histograms - std::vector boundaries; + std::map boundaries; + boundaries.insert({0, AlignmentPI::BPix}); // always start with BPix, not filled in the loop AlignmentPI::fillComparisonHistogram(coord, boundaries, ref_ali, target_ali, compare); canvas.cd(); @@ -369,17 +379,17 @@ namespace { canvas.cd(); TLine l[boundaries.size()]; - unsigned int i = 0; - for (const auto &line : boundaries) { - l[i] = TLine(compare->GetBinLowEdge(line), - canvas.cd()->GetUymin(), - compare->GetBinLowEdge(line), - canvas.cd()->GetUymax()); - l[i].SetLineWidth(1); - l[i].SetLineStyle(9); - l[i].SetLineColor(2); - l[i].Draw("same"); - i++; + for (const auto &line : boundaries | boost::adaptors::indexed(0)) { + const auto &index = line.index(); + const auto value = line.value(); + l[index] = TLine(compare->GetBinLowEdge(value.first), + canvas.cd()->GetUymin(), + compare->GetBinLowEdge(value.first), + canvas.cd()->GetUymax()); + l[index].SetLineWidth(1); + l[index].SetLineStyle(9); + l[index].SetLineColor(2); + l[index].Draw("same"); } TLatex tSubdet; @@ -387,13 +397,13 @@ namespace { tSubdet.SetTextAlign(21); tSubdet.SetTextSize(0.027); tSubdet.SetTextAngle(90); - for (unsigned int j = 1; j <= 6; j++) { - auto thePart = static_cast(j); + + for (const auto &elem : boundaries) { tSubdet.SetTextColor(kRed); - auto myPair = (j > 1) ? AlignmentPI::calculatePosition(gPad, compare->GetBinLowEdge(boundaries[j - 2])) - : AlignmentPI::calculatePosition(gPad, compare->GetBinLowEdge(0)); - float theX_ = myPair.first + 0.025; - tSubdet.DrawLatex(theX_, 0.20, Form("%s", (AlignmentPI::getStringFromPart(thePart)).c_str())); + auto myPair = AlignmentPI::calculatePosition(gPad, compare->GetBinLowEdge(elem.first)); + float theX_ = elem.first != 0 ? myPair.first + 0.025 : myPair.first + 0.01; + const bool isPhase2 = (ref_ali.size() > AlignmentPI::phase1size); + tSubdet.DrawLatex(theX_, 0.20, Form("%s", AlignmentPI::getStringFromPart(elem.second, isPhase2).c_str())); } TLegend legend = TLegend(0.17, 0.86, 0.95, 0.94); @@ -532,27 +542,36 @@ namespace { diffs[coord] = std::make_unique(Form("hDiff_%s", s_coord.c_str()), Form(";#Delta%s %s;n. of modules", s_coord.c_str(), unit.c_str()), - 1000, - -500., - 500.); + 1001, + -500.5, + 500.5); } // fill the comparison histograms - std::vector boundaries{}; + std::map boundaries; AlignmentPI::fillComparisonHistograms(boundaries, ref_ali, target_ali, diffs, true, q); int c_index = 1; - auto legend = std::make_unique(0.14, 0.93, 0.55, 0.98); - legend->AddEntry( - diffs[AlignmentPI::t_x].get(), - ("#DeltaIOV: " + std::to_string(std::get<0>(lastiov)) + "-" + std::to_string(std::get<0>(firstiov))).c_str(), - "L"); - legend->SetTextSize(0.03); + //TLegend (Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *header="", Option_t *option="brNDC") + auto legend = std::make_unique(0.14, 0.88, 0.96, 0.99); + if (this->m_plotAnnotations.ntags == 2) { + legend->SetHeader("#bf{Two Tags Comparison}", "C"); // option "C" allows to center the header + legend->AddEntry( + diffs[AlignmentPI::t_x].get(), + ("#splitline{" + tagname1 + " : " + firstIOVsince + "}{" + tagname2 + " : " + lastIOVsince + "}").c_str(), + "PL"); + } else { + legend->SetHeader(("tag: #bf{" + tagname1 + "}").c_str(), "C"); // option "C" allows to center the header + legend->AddEntry(diffs[AlignmentPI::t_x].get(), + ("#splitline{IOV since: " + firstIOVsince + "}{IOV since: " + lastIOVsince + "}").c_str(), + "PL"); + } + legend->SetTextSize(0.025); for (const auto &coord : coords) { canvas.cd(c_index)->SetLogy(); - canvas.cd(c_index)->SetTopMargin(0.02); + canvas.cd(c_index)->SetTopMargin(0.01); canvas.cd(c_index)->SetBottomMargin(0.15); canvas.cd(c_index)->SetLeftMargin(0.14); canvas.cd(c_index)->SetRightMargin(0.04); @@ -567,6 +586,7 @@ namespace { int i_max = diffs[coord]->FindLastBinAbove(0.); int i_min = diffs[coord]->FindFirstBinAbove(0.); diffs[coord]->GetXaxis()->SetRange(std::max(1, i_min - 10), std::min(i_max + 10, diffs[coord]->GetNbinsX())); + diffs[coord]->SetMaximum(diffs[coord]->GetMaximum() * 5); diffs[coord]->Draw("HIST"); AlignmentPI::makeNiceStats(diffs[coord].get(), q, kBlack); @@ -673,6 +693,7 @@ namespace { bool fill() override { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); + const auto &tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); unsigned int run = std::get<0>(iov); @@ -774,8 +795,8 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Tracker Alignment Barycenters, IOV %i", run)); + t1.SetTextSize(0.045); + t1.DrawLatex(0.5, 0.96, Form("TkAl Barycenters, Tag: #color[4]{%s}, IOV #color[4]{%i}", tagname.c_str(), run)); t1.SetTextSize(0.025); std::string fileName(m_imageFileName); diff --git a/CondCore/AlignmentPlugins/test/testTrackerAlignment.sh b/CondCore/AlignmentPlugins/test/testTrackerAlignment.sh index 12d42918147be..6f10ee854d8ae 100755 --- a/CondCore/AlignmentPlugins/test/testTrackerAlignment.sh +++ b/CondCore/AlignmentPlugins/test/testTrackerAlignment.sh @@ -81,6 +81,7 @@ getPayloadData.py \ --db Prod \ --test ; +mv *.png $W_DIR/results_alignments/TrackerAlignmentBarycenters.png # add examples of Pixel barycenter comparison #*************************************************************************# @@ -93,6 +94,8 @@ getPayloadData.py \ --db Prod \ --test ; +mv *.png $W_DIR/results_alignments/PixelBarycentersCompare.png + getPayloadData.py \ --plugin pluginTrackerAlignment_PayloadInspector \ --plot plot_PixelBarycentersCompareTwoTags \ @@ -104,6 +107,8 @@ getPayloadData.py \ --db Prod \ --test ; +mv *.png $W_DIR/results_alignments/PixelBarycentersCompareTwoTags.png + # add examples of full 6 coordinate comparisons #*************************************************************************# getPayloadData.py \ @@ -116,3 +121,5 @@ getPayloadData.py \ --iovstwo '{"start_iov": "358156", "end_iov": "358156"}' \ --db Prod \ --test ; + +mv *.png $W_DIR/results_alignments/TrackerAlignmentComparatorTwoTags.png diff --git a/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h b/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h index 3fa2a88687ada..7479260083e65 100644 --- a/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h +++ b/CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h @@ -2,11 +2,11 @@ #define CONDCORE_BEAMSPOTPLUGINS_BEAMSPOTPAYLOADINSPECTORHELPER_H // User includes -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondCore/Utilities/interface/PayloadInspectorModule.h" -#include "CondCore/Utilities/interface/PayloadInspector.h" #include "CondCore/CondDB/interface/Time.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" // system includes #include @@ -15,13 +15,13 @@ // ROOT includes #include "TCanvas.h" -#include "TStyle.h" #include "TH2F.h" #include "TLatex.h" +#include "TStyle.h" //#define MMDEBUG /* to make it verbose */ -namespace BeamSpotPI { +namespace beamSpotPI { inline std::pair unpack(cond::Time_t since) { auto kLowMask = 0XFFFFFFFF; @@ -396,7 +396,7 @@ namespace BeamSpotPI { } ltx.SetTextAlign(11); - auto runLS = BeamSpotPI::unpack(std::get<0>(iov)); + auto runLS = beamSpotPI::unpack(std::get<0>(iov)); ltx.DrawLatexNDC( gPad->GetLeftMargin(), @@ -448,7 +448,7 @@ namespace BeamSpotPI { std::shared_ptr m_payload; /** - * Can't use BeamSpotPI::getStringFromParamEnum becasue it needs to be overridden + * Can't use beamSpotPI::getStringFromParamEnum becasue it needs to be overridden * for the BeamSpotOnlineObjects case. */ virtual std::string getStringFromTypeEnum(const parameters& parameter) const { @@ -536,8 +536,8 @@ namespace BeamSpotPI { h2_BSParameters->SetMarkerSize(1.5); // prepare the arrays to fill the histogram - BeamSpotPI::BSParamsHelper fBS(f_payload); - BeamSpotPI::BSParamsHelper lBS(l_payload); + beamSpotPI::BSParamsHelper fBS(f_payload); + beamSpotPI::BSParamsHelper lBS(l_payload); #ifdef MM_DEBUG std::stringstream ss1, ss2; @@ -557,7 +557,7 @@ namespace BeamSpotPI { unsigned int yBin = 8; for (int foo = parameters::X; foo <= parameters::dydz; foo++) { parameters param = static_cast(foo); - std::string theLabel = BeamSpotPI::getStringFromParamEnum(param, true /*use units*/); + std::string theLabel = beamSpotPI::getStringFromParamEnum(param, true /*use units*/); h2_BSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str()); h2_BSParameters->SetBinContent(1, yBin, diffPars[foo]); /* profiting of the parameters enum indexing */ h2_BSParameters->SetBinContent(2, yBin, diffErrors[foo]); @@ -576,14 +576,14 @@ namespace BeamSpotPI { double val_white = 0.; double per_white = (max != min) ? ((val_white - min) / (max - min)) : 0.5; - const int Number = 3; - double Red[Number] = {0., 1., 1.}; - double Green[Number] = {0., 1., 0.}; - double Blue[Number] = {1., 1., 0.}; - double Stops[Number] = {0., per_white, 1.}; + const int number = 3; + double Red[number] = {0., 1., 1.}; + double Green[number] = {0., 1., 0.}; + double Blue[number] = {1., 1., 0.}; + double Stops[number] = {0., per_white, 1.}; int nb = 256; h2_BSShadow->SetContour(nb); - TColor::CreateGradientColorTable(Number, Stops, Red, Green, Blue, nb); + TColor::CreateGradientColorTable(number, Stops, Red, Green, Blue, nb); h2_BSShadow->Draw("colz"); h2_BSParameters->Draw("TEXTsame"); @@ -594,9 +594,9 @@ namespace BeamSpotPI { ltx.SetTextAlign(11); // compute the (run,LS) pairs - auto l_runLS = BeamSpotPI::unpack(std::get<0>(lastiov)); + auto l_runLS = beamSpotPI::unpack(std::get<0>(lastiov)); std::string l_runLSs = "(" + std::to_string(l_runLS.first) + "," + std::to_string(l_runLS.second) + ")"; - auto f_runLS = BeamSpotPI::unpack(std::get<0>(firstiov)); + auto f_runLS = beamSpotPI::unpack(std::get<0>(firstiov)); std::string f_runLSs = "(" + std::to_string(f_runLS.first) + "," + std::to_string(f_runLS.second) + ")"; if (this->m_plotAnnotations.ntags == 2) { @@ -630,6 +630,332 @@ namespace BeamSpotPI { std::shared_ptr f_payload; std::shared_ptr l_payload; }; -} // namespace BeamSpotPI +} // namespace beamSpotPI + +// Similar namespace for SimBeamSpotObject +namespace simBeamSpotPI { + + enum parameters { + X = 0, // 0 - Positions + Y = 1, // 1 + Z = 2, // 2 + sigmaZ = 3, // 3 - Widths + betaStar = 4, // 4 + emittance = 5, // 5 + phi = 6, // 6 - Additional parameters + alpha = 7, // 7 + timeOffset = 8, // 8 + END_OF_TYPES = 9, + }; + + /************************************************/ + inline std::string getStringFromParamEnum(const parameters& parameter, const bool addUnits = false) { + switch (parameter) { + case X: + return (addUnits ? "X [cm]" : "X"); + case Y: + return (addUnits ? "Y [cm]" : "Y"); + case Z: + return (addUnits ? "Z [cm]" : "Z"); + case sigmaZ: + return (addUnits ? "#sigma_{Z} [cm]" : "sigmaZ"); + case betaStar: + return (addUnits ? "#beta* [cm]" : "BetaStar"); + case emittance: + return (addUnits ? "Emittance [cm]" : "Emittance"); + case phi: + return (addUnits ? "Phi [rad]" : "Phi"); + case alpha: + return (addUnits ? "Alpha [rad]" : "Alpha"); + case timeOffset: + return (addUnits ? "TimeOffset [ns]" : "TimeOffset"); + default: + return "should never be here"; + } + } + + /** + * Helper class for operations on the Sim Beam Spot Parameters + * It's a simplified representation of the beamspot + * data used as the underlying type for data transfers and comparisons + */ + template + class SimBSParamsHelper { + typedef std::array bshelpdata; + + public: + SimBSParamsHelper(const std::shared_ptr& bs) { + // fill in the values + m_values[0] = bs->x(), m_values[1] = bs->y(), m_values[2] = bs->z(); + m_values[3] = bs->sigmaZ(), m_values[4] = bs->betaStar(), m_values[5] = bs->emittance(); + m_values[6] = bs->phi(), m_values[7] = bs->alpha(), m_values[8] = bs->timeOffset(); + } + + void printDebug(std::stringstream& ss) { + ss << "Dumping SimBeamSpot parameters Data:" << std::endl; + for (uint i = parameters::X; i <= parameters::timeOffset; i++) { + parameters par = static_cast(i); + ss << getStringFromParamEnum(par) << " : " << m_values[i] << std::endl; + ss << std::endl; + } + } + + inline const bshelpdata centralValues() const { return m_values; } + + // get the difference in values + const bshelpdata diffCentralValues(const SimBSParamsHelper& bs2, const bool isPull = false) const { + bshelpdata ret; + for (uint i = parameters::X; i <= parameters::timeOffset; i++) { + ret[i] = this->centralValues()[i] - bs2.centralValues()[i]; + if (isPull) + (this->centralValues()[i] != 0.) ? ret[i] /= this->centralValues()[i] : 0.; + } + return ret; + } + + private: + bshelpdata m_values; + }; + + /************************************************ + Display of Sim Beam Spot parameters + *************************************************/ + template + class DisplayParameters : public cond::payloadInspector::PlotImage { + public: + DisplayParameters() + : cond::payloadInspector::PlotImage( + "Display of SimBeamSpot parameters") {} + + bool fill() override { + auto tag = cond::payloadInspector::PlotBase::getTag<0>(); + auto tagname = tag.name; + auto iov = tag.iovs.front(); + + gStyle->SetHistMinimumZero(kTRUE); + + m_payload = this->fetchPayload(std::get<1>(iov)); + + TCanvas canvas("Sim Beam Spot Parameters Summary", "Sim BeamSpot Parameters summary", 1000, 1000); + canvas.cd(1); + canvas.cd(1)->SetTopMargin(0.05); + canvas.cd(1)->SetBottomMargin(0.06); + canvas.cd(1)->SetLeftMargin(0.25); + canvas.cd(1)->SetRightMargin(0.01); + canvas.cd(1)->Modified(); + canvas.cd(1)->SetGrid(); + + auto h2_SimBSParameters = std::make_unique("Parameters", "", 1, 0.0, 1.0, 9, 0, 9.); + h2_SimBSParameters->SetStats(false); + + std::function cutFunctor = [this](parameters my_param) { + double ret(-999.); + switch (my_param) { + case X: + return m_payload->x(); + case Y: + return m_payload->y(); + case Z: + return m_payload->z(); + case sigmaZ: + return m_payload->sigmaZ(); + case betaStar: + return m_payload->betaStar(); + case emittance: + return m_payload->emittance(); + case phi: + return m_payload->phi(); + case alpha: + return m_payload->alpha(); + case timeOffset: + return m_payload->timeOffset(); + case END_OF_TYPES: + return ret; + default: + return ret; + } + }; + + h2_SimBSParameters->GetXaxis()->SetBinLabel(1, "Value"); + + unsigned int yBin = 9; + for (int foo = parameters::X; foo <= parameters::timeOffset; foo++) { + parameters param = static_cast(foo); + std::string theLabel = getStringFromParamEnum(param, true); + h2_SimBSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str()); + h2_SimBSParameters->SetBinContent(1, yBin, cutFunctor(param)); + yBin--; + } + + h2_SimBSParameters->GetXaxis()->LabelsOption("h"); + h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05); + h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05); + h2_SimBSParameters->SetMarkerSize(1.5); + h2_SimBSParameters->Draw("TEXT"); + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.025); + ltx.SetTextAlign(11); + + auto runLS = beamSpotPI::unpack(std::get<0>(iov)); + + ltx.DrawLatexNDC( + gPad->GetLeftMargin(), + 1 - gPad->GetTopMargin() + 0.01, + (tagname + " IOV: #color[4]{" + std::to_string(runLS.first) + "," + std::to_string(runLS.second) + "}") + .c_str()); + + std::string fileName(this->m_imageFileName); + canvas.SaveAs(fileName.c_str()); + + return true; + } + + protected: + std::shared_ptr m_payload; + }; + + /************************************************ + Display of Sim Beam Spot parameters difference + *************************************************/ + template + class DisplayParametersDiff : public cond::payloadInspector::PlotImage { + public: + DisplayParametersDiff() + : cond::payloadInspector::PlotImage( + "Display of Sim BeamSpot parameters differences") {} + + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto f_tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string l_tagname = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; + + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); + + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); + } + + l_payload = this->fetchPayload(std::get<1>(lastiov)); + f_payload = this->fetchPayload(std::get<1>(firstiov)); + + std::string lastIOVsince = std::to_string(std::get<0>(lastiov)); + std::string firstIOVsince = std::to_string(std::get<0>(firstiov)); + + TCanvas canvas( + "Sim Beam Spot Parameters Difference Summary", "Sim Beam Spot Parameters Difference summary", 1000, 1000); + canvas.cd(1); + canvas.cd(1)->SetTopMargin(0.10); + canvas.cd(1)->SetBottomMargin(0.06); + canvas.cd(1)->SetLeftMargin(0.23); + canvas.cd(1)->SetRightMargin(0.16); + canvas.cd(1)->Modified(); + canvas.cd(1)->SetGrid(); + + // for the "text"-filled histogram + auto h2_SimBSParameters = std::make_unique("Parameters", "", 1, 0.0, 1.0, 9, 0, 9.); + h2_SimBSParameters->SetStats(false); + h2_SimBSParameters->GetXaxis()->SetBinLabel(1, "Value"); + h2_SimBSParameters->GetXaxis()->LabelsOption("h"); + h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05); + h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05); + h2_SimBSParameters->SetMarkerSize(1.5); + + // prepare the arrays to fill the histogram + simBeamSpotPI::SimBSParamsHelper fBS(f_payload); + simBeamSpotPI::SimBSParamsHelper lBS(l_payload); + +#ifdef MM_DEBUG + std::stringstream ss1, ss2; + edm::LogPrint("") << "**** first payload"; + fBS.printDebug(ss1); + edm::LogPrint("") << ss1.str(); + edm::LogPrint("") << "**** last payload"; + lBS.printDebug(ss2); + edm::LogPrint("") << ss2.str(); +#endif + + const auto diffPars = fBS.diffCentralValues(lBS); + //const auto pullPars = fBS.diffCentralValues(lBS,true /*normalize*/); + + unsigned int yBin = 9; + for (int foo = parameters::X; foo <= parameters::timeOffset; foo++) { + parameters param = static_cast(foo); + std::string theLabel = simBeamSpotPI::getStringFromParamEnum(param, true /*use units*/); + h2_SimBSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str()); + h2_SimBSParameters->SetBinContent(1, yBin, diffPars[foo]); /* profiting of the parameters enum indexing */ + yBin--; + } + + // for the "colz"-filled histogram (clonde from the text-based one) + auto h2_SimBSShadow = (TH2F*)(h2_SimBSParameters->Clone("shadow")); + h2_SimBSShadow->GetZaxis()->SetTitle("#Delta Parameter(payload A - payload B)"); + h2_SimBSShadow->GetZaxis()->CenterTitle(); + h2_SimBSShadow->GetZaxis()->SetTitleOffset(1.5); + + // this is the fine gradient palette (blue to red) + double max = h2_SimBSShadow->GetMaximum(); + double min = h2_SimBSShadow->GetMinimum(); + double val_white = 0.; + double per_white = (max != min) ? ((val_white - min) / (max - min)) : 0.5; + + const int number = 3; + double Red[number] = {0., 1., 1.}; + double Green[number] = {0., 1., 0.}; + double Blue[number] = {1., 1., 0.}; + double Stops[number] = {0., per_white, 1.}; + int nb = 256; + h2_SimBSShadow->SetContour(nb); + TColor::CreateGradientColorTable(number, Stops, Red, Green, Blue, nb); + + h2_SimBSShadow->Draw("colz"); + h2_SimBSParameters->Draw("TEXTsame"); + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.025); + ltx.SetTextAlign(11); + + // compute the (run,LS) pairs + auto l_runLS = beamSpotPI::unpack(std::get<0>(lastiov)); + std::string l_runLSs = "(" + std::to_string(l_runLS.first) + "," + std::to_string(l_runLS.second) + ")"; + auto f_runLS = beamSpotPI::unpack(std::get<0>(firstiov)); + std::string f_runLSs = "(" + std::to_string(f_runLS.first) + "," + std::to_string(f_runLS.second) + ")"; + + if (this->m_plotAnnotations.ntags == 2) { + ltx.DrawLatexNDC( + gPad->GetLeftMargin(), + 1 - gPad->GetTopMargin() + 0.025, + (fmt::sprintf( + "#splitline{A = #color[4]{%s}: %s}{B = #color[4]{%s}: %s}", f_tagname, f_runLSs, l_tagname, l_runLSs)) + .c_str()); + } else { + ltx.DrawLatexNDC( + gPad->GetLeftMargin(), + 1 - gPad->GetTopMargin() + 0.025, + (fmt::sprintf("#splitline{#color[4]{%s}}{A = %s | B = %s}", f_tagname, l_runLSs, f_runLSs)).c_str()); + } + + std::string fileName(this->m_imageFileName); + canvas.SaveAs(fileName.c_str()); + + return true; + } + + protected: + std::shared_ptr f_payload; + std::shared_ptr l_payload; + }; + +} // namespace simBeamSpotPI #endif diff --git a/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc b/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc index c72f2395bd95f..3782998c44197 100644 --- a/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc +++ b/CondCore/BeamSpotPlugins/plugins/BeamSpotOnline_PayloadInspector.cc @@ -1,14 +1,14 @@ -#include "CondCore/Utilities/interface/PayloadInspectorModule.h" -#include "CondCore/Utilities/interface/PayloadInspector.h" -#include "CondCore/CondDB/interface/Time.h" #include "CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h" +#include "CondCore/CondDB/interface/Time.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" #include namespace { - using namespace BeamSpotPI; + using namespace beamSpotPI; /************************************************ history plots diff --git a/CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc b/CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc index 1f65c538ea782..e53df5be2e0bc 100644 --- a/CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc +++ b/CondCore/BeamSpotPlugins/plugins/BeamSpot_PayloadInspector.cc @@ -1,13 +1,12 @@ -#include "CondCore/Utilities/interface/PayloadInspectorModule.h" -#include "CondCore/Utilities/interface/PayloadInspector.h" -#include "CondCore/CondDB/interface/Time.h" - #include "CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h" +#include "CondCore/CondDB/interface/Time.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" namespace { - using namespace BeamSpotPI; + using namespace beamSpotPI; class BeamSpot_hx : public cond::payloadInspector::HistoryPlot > { public: diff --git a/CondCore/BeamSpotPlugins/plugins/BuildFile.xml b/CondCore/BeamSpotPlugins/plugins/BuildFile.xml index dce62f068af36..4ed737eff59eb 100644 --- a/CondCore/BeamSpotPlugins/plugins/BuildFile.xml +++ b/CondCore/BeamSpotPlugins/plugins/BuildFile.xml @@ -9,3 +9,9 @@ + + + + + + diff --git a/CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc b/CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc new file mode 100644 index 0000000000000..1532e61b86425 --- /dev/null +++ b/CondCore/BeamSpotPlugins/plugins/SimBeamSpot_PayloadInspector.cc @@ -0,0 +1,32 @@ +#include "CondCore/BeamSpotPlugins/interface/BeamSpotPayloadInspectorHelper.h" +#include "CondCore/CondDB/interface/Time.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" + +namespace { + + using namespace simBeamSpotPI; + + /************************************************ + Display of Sim Beam Spot parameters + *************************************************/ + + typedef DisplayParameters SimBeamSpotParameters; + + /************************************************ + Display of Sim Beam Spot parameters Differences + *************************************************/ + + typedef DisplayParametersDiff + SimBeamSpotParametersDiffSingleTag; + typedef DisplayParametersDiff + SimBeamSpotParametersDiffTwoTags; + +} // namespace + +PAYLOAD_INSPECTOR_MODULE(SimBeamSpot) { + PAYLOAD_INSPECTOR_CLASS(SimBeamSpotParameters); + PAYLOAD_INSPECTOR_CLASS(SimBeamSpotParametersDiffSingleTag); + PAYLOAD_INSPECTOR_CLASS(SimBeamSpotParametersDiffTwoTags); +} diff --git a/CondCore/ESSources/test/BuildFile.xml b/CondCore/ESSources/test/BuildFile.xml index b1ba41fd6cbf5..bacd84422a581 100644 --- a/CondCore/ESSources/test/BuildFile.xml +++ b/CondCore/ESSources/test/BuildFile.xml @@ -24,10 +24,7 @@ - - - - + diff --git a/CondCore/ESSources/test/TestConcurrentIOVsCondCore.sh b/CondCore/ESSources/test/TestConcurrentIOVsCondCore.sh index 93bdf58bdcf79..0c2749ec8fedb 100755 --- a/CondCore/ESSources/test/TestConcurrentIOVsCondCore.sh +++ b/CondCore/ESSources/test/TestConcurrentIOVsCondCore.sh @@ -2,11 +2,7 @@ function die { echo $1: status $2 ; exit $2; } -pushd ${LOCAL_TMP_DIR} - echo cmsRun TestConcurrentIOVsCondCore_cfg.py -cmsRun --parameter-set ${LOCAL_TEST_DIR}/TestConcurrentIOVsCondCore_cfg.py || die 'Failed in TestConcurrentIOVsCondCore_cfg.py' $? +cmsRun --parameter-set ${SCRAM_TEST_PATH}/TestConcurrentIOVsCondCore_cfg.py || die 'Failed in TestConcurrentIOVsCondCore_cfg.py' $? grep "TestConcurrentIOVsCondCore: " TestConcurrentIOVsCondCoreCout.log > TestConcurrentIOVsCondCore.log -diff ${LOCAL_TEST_DIR}/unit_test_outputs/TestConcurrentIOVsCondCore.log TestConcurrentIOVsCondCore.log || die "comparing TestConcurrentIOVsCondCore.log" $? - -popd +diff ${SCRAM_TEST_PATH}/unit_test_outputs/TestConcurrentIOVsCondCore.log TestConcurrentIOVsCondCore.log || die "comparing TestConcurrentIOVsCondCore.log" $? diff --git a/CondCore/ESSources/test/TestCondCoreESSources.cpp b/CondCore/ESSources/test/TestCondCoreESSources.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/CondCore/ESSources/test/TestCondCoreESSources.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/CondCore/EcalPlugins/plugins/BuildFile.xml b/CondCore/EcalPlugins/plugins/BuildFile.xml index b6ebee2d60261..31e9a03f94a6c 100644 --- a/CondCore/EcalPlugins/plugins/BuildFile.xml +++ b/CondCore/EcalPlugins/plugins/BuildFile.xml @@ -282,6 +282,12 @@ + + + + + + diff --git a/CondCore/EcalPlugins/plugins/EcalSimComponentShape_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalSimComponentShape_PayloadInspector.cc new file mode 100644 index 0000000000000..fbb2e0a2e64ef --- /dev/null +++ b/CondCore/EcalPlugins/plugins/EcalSimComponentShape_PayloadInspector.cc @@ -0,0 +1,102 @@ +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/EcalPlugins/plugins/EcalDrawUtils.h" + +// the data format of the condition to be inspected +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" + +#include "TProfile.h" +#include "TCanvas.h" +#include "TStyle.h" +#include "TLine.h" +#include "TLatex.h" +#include "TMarker.h" + +#include + +namespace { + /******************************************** + profile of ECAL SimComponentShape for 1 IOV + ********************************************/ + class EcalSimComponentShapeProfile : public cond::payloadInspector::PlotImage { + public: + EcalSimComponentShapeProfile() + : cond::payloadInspector::PlotImage("ECAL SimComponentShape - Profile ") { + setSingleIov(true); + } + + bool fill(const std::vector > &iovs) override { + auto iov = iovs.front(); + std::shared_ptr payload = fetchPayload(std::get<1>(iov)); + unsigned int run = std::get<0>(iov); + std::vector profiles; + std::vector EBnbins; + std::vector EBxmaxs; + double EBth; + int iShape = 0; + if (payload.get()) { + EBth = (*payload).barrel_thresh; + double time = (*payload).time_interval; + std::vector > EBshapes = (*payload).barrel_shapes; + char nameBuffer[50]; + for (auto EBshape : EBshapes) { + EBnbins.push_back(EBshape.size()); + EBxmaxs.push_back(EBnbins[iShape] * time); + sprintf(nameBuffer, "EBComponentShape_%d", iShape); + profiles.push_back(new TProfile(nameBuffer, "", EBnbins[iShape], 0, EBxmaxs[iShape])); + for (int s = 0; s < EBnbins[iShape]; s++) { + double val = EBshape[s]; + profiles[iShape]->Fill(s, val); + } + ++iShape; + } + } // if payload.get() + else + return false; + + // gStyle->SetPalette(1); + gStyle->SetOptStat(0); + gStyle->SetPalette(kThermometer); + TCanvas canvas("ESPS", "ESPS", 1000, 500); + TLatex t1; + t1.SetNDC(); + t1.SetTextAlign(26); + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Sim Component Shapes, IOV %i", run)); + + TPad *pad = new TPad("p_0", "p_0", 0.0, 0.0, 1.0, 0.95); + pad->Draw(); + pad->cd(); + iShape = 0; + for (auto profile : profiles) { + if (iShape == 0) { + profile->SetXTitle("time (ns)"); + profile->SetYTitle("normalized amplitude (ADC#)"); + profile->GetXaxis()->SetRangeUser(0., 275.); + profile->GetYaxis()->SetRangeUser(0., 1.25); + } + profile->SetMarkerColor(TColor::GetPalette().At(10 * iShape)); + profile->SetLineColor(TColor::GetPalette().At(10 * iShape)); + profile->SetMarkerStyle(20); + profile->SetMarkerSize(.25); + if (iShape == 0) { + profile->Draw(""); + } else { + profile->Draw("SAME"); + } + ++iShape; + } + pad->BuildLegend(.7, .225, .85, .8); + t1.SetTextAlign(12); + t1.DrawLatex(0.4, 0.85, Form("EB component shapes, threshold %f", EBth)); + + std::string ImageName(m_imageFileName); + canvas.SaveAs(ImageName.c_str()); + return true; + } // fill method + }; + +} // namespace + +// Register the classes as boost python plugin +PAYLOAD_INSPECTOR_MODULE(EcalSimComponentShape) { PAYLOAD_INSPECTOR_CLASS(EcalSimComponentShapeProfile); } diff --git a/CondCore/EcalPlugins/src/plugin.cc b/CondCore/EcalPlugins/src/plugin.cc index 3472afa007f91..fe753ac848cfe 100644 --- a/CondCore/EcalPlugins/src/plugin.cc +++ b/CondCore/EcalPlugins/src/plugin.cc @@ -170,6 +170,9 @@ #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" #include "CondFormats/DataRecord/interface/EcalSimPulseShapeRcd.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" +#include "CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h" + #include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h" #include "CondFormats/DataRecord/interface/EcalMustacheSCParametersRcd.h" #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h" @@ -201,6 +204,7 @@ REGISTER_PLUGIN(EcalClusterEnergyCorrectionParametersRcd, EcalFunParams); REGISTER_PLUGIN(EcalClusterEnergyCorrectionObjectSpecificParametersRcd, EcalFunParams); REGISTER_PLUGIN(EcalSimPulseShapeRcd, EcalSimPulseShape); +REGISTER_PLUGIN(EcalSimComponentShapeRcd, EcalSimComponentShape); REGISTER_PLUGIN(EcalMappingElectronicsRcd, EcalCondObjectContainer); diff --git a/CondCore/HcalPlugins/src/plugin.cc b/CondCore/HcalPlugins/src/plugin.cc index f87a87ba63942..1cef967b85a87 100644 --- a/CondCore/HcalPlugins/src/plugin.cc +++ b/CondCore/HcalPlugins/src/plugin.cc @@ -67,6 +67,7 @@ REGISTER_PLUGIN(HcalPedestalsRcd, HcalPedestals); REGISTER_PLUGIN(HcalPedestalWidthsRcd, HcalPedestalWidths); REGISTER_PLUGIN(HcalGainsRcd, HcalGains); REGISTER_PLUGIN(HcalGainWidthsRcd, HcalGainWidths); +REGISTER_PLUGIN(HcalPFCutsRcd, HcalPFCuts); REGISTER_PLUGIN_INIT(HcalElectronicsMapRcd, HcalElectronicsMap, InitHcalElectronicsMap); REGISTER_PLUGIN_INIT(HcalFrontEndMapRcd, HcalFrontEndMap, InitHcalFrontEndMap); REGISTER_PLUGIN(HcalChannelQualityRcd, HcalChannelQuality); diff --git a/CondCore/JetMETPlugins/plugins/BuildFile.xml b/CondCore/JetMETPlugins/plugins/BuildFile.xml index 4e5491733c365..c68a99c537eba 100644 --- a/CondCore/JetMETPlugins/plugins/BuildFile.xml +++ b/CondCore/JetMETPlugins/plugins/BuildFile.xml @@ -2,7 +2,13 @@ - + + + + + + + diff --git a/CondCore/JetMETPlugins/plugins/JetCorrector_PayloadInspector.cc b/CondCore/JetMETPlugins/plugins/JetCorrector_PayloadInspector.cc new file mode 100644 index 0000000000000..8b9471c82c2b5 --- /dev/null +++ b/CondCore/JetMETPlugins/plugins/JetCorrector_PayloadInspector.cc @@ -0,0 +1,448 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/CondDB/interface/Time.h" + +// the data format of the condition to be inspected +#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectorParametersHelper.h" +#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/FactorizedJetCorrector.h" +#include "CondFormats/JetMETObjects/interface/SimpleJetCorrectionUncertainty.h" +#include "CondFormats/JetMETObjects/interface/Utilities.h" + +#include "CommonTools/Utils/interface/FormulaEvaluator.h" + +#include +#include +#include +#include + +// include ROOT +#include "TH2F.h" +#include "TLegend.h" +#include "TCanvas.h" +#include "TLine.h" +#include "TStyle.h" +#include "TLatex.h" +#include "TPave.h" +#include "TPaveStats.h" + +#define MIN_ETA -5.05 +#define MAX_ETA 5.05 +#define NBIN_ETA 51 +#define MIN_PT -5. +#define MAX_PT 3005. +#define NBIN_PT 301 + +//namespace JME { +namespace { + + using namespace cond::payloadInspector; + + enum levelt { + L1Offset = 0, + L1JPTOffset = 7, + L1FastJet = 10, + L2Relative = 1, + L3Absolute = 2, + L2L3Residual = 8, + L4EMF = 3, + L5Flavor = 4, + L6UE = 5, + L7Parton = 6, + Uncertainty = 9, + UncertaintyAbsolute = 11, + UncertaintyHighPtExtra = 12, + UncertaintySinglePionECAL = 13, + UncertaintySinglePionHCAL = 27, + UncertaintyFlavor = 14, + UncertaintyTime = 15, + UncertaintyRelativeJEREC1 = 16, + UncertaintyRelativeJEREC2 = 17, + UncertaintyRelativeJERHF = 18, + UncertaintyRelativePtEC1 = 28, + UncertaintyRelativePtEC2 = 29, + UncertaintyRelativePtHF = 30, + UncertaintyRelativeStatEC2 = 19, + UncertaintyRelativeStatHF = 20, + UncertaintyRelativeFSR = 21, + UncertaintyRelativeSample = 31, + UncertaintyPileUpDataMC = 22, + UncertaintyPileUpOOT = 23, + UncertaintyPileUpPtBB = 24, + UncertaintyPileUpPtEC = 32, + UncertaintyPileUpPtHF = 33, + UncertaintyPileUpBias = 25, + UncertaintyPileUpJetRate = 26, + L1RC = 34, + L1Residual = 35, + UncertaintyAux3 = 36, + UncertaintyAux4 = 37, + N_LEVELS = 38 + }; + + /******************************************************* + * + * 1d histogram of JetCorectorParameters of 1 IOV + * + *******************************************************/ + + // inherit from one of the predefined plot class: Histogram1D + + template + class JetCorrectorVsEta : public cond::payloadInspector::Histogram1D { + public: + JetCorrectorVsEta() + : cond::payloadInspector::Histogram1D( + "Jet Corrector", "#eta", NBIN_ETA, MIN_ETA, MAX_ETA, "Corrector") {} + + bool fill() override { + auto tag = PlotBase::getTag<0>(); + for (auto const& iov : tag.iovs) { + std::shared_ptr payload = Base::fetchPayload(std::get<1>(iov)); + if (payload.get()) { + // JetCorrectorParametersCollection::key_type + std::vector keys; + // Get valid keys in this payload + (*payload).validKeys(keys); + + if (std::find(keys.begin(), keys.end(), ii) == keys.end()) { + edm::LogWarning("JEC_PI") << "Jet corrector level " << (*payload).findLabel(ii) << " is not available."; + return false; + } + auto JCParams = (*payload)[ii]; + + edm::LogInfo("JEC_PI") << "Jet corrector level " << (*payload).findLabel(ii) << " as " + << JCParams.definitions().level() << " has " << JCParams.definitions().nParVar() + << " parameters with " << JCParams.definitions().nBinVar() << " bin(s)."; + edm::LogInfo("JEC_PI") << "JCParam size: " << JCParams.size(); + edm::LogInfo("JEC_PI") << "JCParam def: " << JCParams.definitions().formula(); + + for (size_t idx = 0; idx <= NBIN_ETA; idx++) { + double x_axis = (idx + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA; + + if (ii == 9 && // Uncertainty + JCParams.definitions().formula().compare("\"\"") == 0) { + JetCorrectionUncertainty JCU(JCParams); + JCU.setJetEta(x_axis); + JCU.setJetPt(100.); + JCU.setJetPhi(0.); + JCU.setJetE(150.); + + float unc = JCU.getUncertainty(true); + fillWithBinAndValue(idx + 1, unc); + } else if (JCParams.definitions().formula().compare("1") == 0) { + fillWithBinAndValue(idx + 1, 1.); + } else if (JCParams.definitions().nBinVar() > 0 && + JCParams.definitions().binVar(0).compare("JetEta") == 0) { + std::vector vars; + std::vector bins; + std::vector params; + + double par_JetPt = 100.; + double par_JetEta = x_axis; + double par_JetA = 0.5; + double par_Rho = 40.; + + int ir = -1; + + vars.clear(); + bins.clear(); + params.clear(); + + for (size_t i = 0; i < JCParams.definitions().nBinVar(); i++) { + // fill up the parameter variables + if (JCParams.definitions().binVar(i).compare("JetPt") == 0) + bins.push_back(par_JetPt); + if (JCParams.definitions().binVar(i).compare("JetEta") == 0) + bins.push_back(par_JetEta); + if (JCParams.definitions().binVar(i).compare("JetA") == 0) + bins.push_back(par_JetA); + if (JCParams.definitions().binVar(i).compare("Rho") == 0) + bins.push_back(par_Rho); + } + + for (size_t i = 0; i < JCParams.definitions().nParVar(); i++) { + // fill up the parameter variables + if (JCParams.definitions().parVar(i).compare("JetPt") == 0) + vars.push_back(par_JetPt); + if (JCParams.definitions().parVar(i).compare("JetEta") == 0) + vars.push_back(par_JetEta); + if (JCParams.definitions().parVar(i).compare("JetA") == 0) + vars.push_back(par_JetA); + if (JCParams.definitions().parVar(i).compare("Rho") == 0) + vars.push_back(par_Rho); + } + + ir = JCParams.binIndex(bins); + edm::LogInfo("JEC_PI") << "Record index # " << ir; + + // check if no matched bin + if (ir < 0 || ir > (int)JCParams.size()) + continue; + + reco::FormulaEvaluator formula(JCParams.definitions().formula()); + + if (vars.size() < JCParams.definitions().nParVar()) { + edm::LogWarning("JEC_PI") << "Only " << vars.size() << " variables filled, while " + << JCParams.definitions().nParVar() << " needed!"; + return false; + } + + for (size_t i = 2 * vars.size(); i < JCParams.record(ir).nParameters(); i++) { + double par = JCParams.record(ir).parameter(i); + params.push_back(par); + } + + double jec = formula.evaluate(vars, params); + fillWithBinAndValue(idx + 1, jec); + + } // level + } // x_axis + return true; + } + return false; + } // for + return false; + } // fill + }; // class + + class JetCorrectorVsEtaSummary + : public cond::payloadInspector::PlotImage { + public: + JetCorrectorVsEtaSummary() + : cond::payloadInspector::PlotImage("Jet Correction Summary") {} + + bool fill_eta_hist(JetCorrectorParameters const& JCParam, TH1D* hist) { + if (!(JCParam.isValid())) { + edm::LogWarning("JEC_PI") << "JetCorrectorParameter is not valid."; + return false; + } + + std::vector vars; + std::vector bins; + std::vector params; + + double par_JetPt = 100.; + double par_JetEta = 0.; + double par_JetA = 0.5; + double par_Rho = 40.; + + int ir = -1; + + for (size_t idx = 0; idx <= NBIN_ETA; idx++) { + par_JetEta = (idx + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA; + + if (JCParam.definitions().formula().compare("1") == 0) { // unity + hist->SetBinContent(idx + 1, 1.); + continue; + } else if (JCParam.definitions().level().compare("Uncertainty") == 0 && + JCParam.definitions().formula().compare("\"\"") == 0) { + JetCorrectionUncertainty JCU(JCParam); + JCU.setJetEta(par_JetEta); + JCU.setJetPt(par_JetPt); + JCU.setJetPhi(0.); + JCU.setJetE(150.); + + float unc = JCU.getUncertainty(true); + hist->SetBinContent(idx + 1, unc); + + continue; + } + + reco::FormulaEvaluator formula(JCParam.definitions().formula()); + + vars.clear(); + bins.clear(); + params.clear(); + + for (size_t i = 0; i < JCParam.definitions().nBinVar(); i++) { + // fill up the parameter variables + if (JCParam.definitions().binVar(i).compare("JetPt") == 0) + bins.push_back(par_JetPt); + if (JCParam.definitions().binVar(i).compare("JetEta") == 0) + bins.push_back(par_JetEta); + if (JCParam.definitions().binVar(i).compare("JetA") == 0) + bins.push_back(par_JetA); + if (JCParam.definitions().binVar(i).compare("Rho") == 0) + bins.push_back(par_Rho); + } + + for (size_t i = 0; i < JCParam.definitions().nParVar(); i++) { + // fill up the parameter variables + if (JCParam.definitions().parVar(i).compare("JetPt") == 0) + vars.push_back(par_JetPt); + if (JCParam.definitions().parVar(i).compare("JetEta") == 0) + vars.push_back(par_JetEta); + if (JCParam.definitions().parVar(i).compare("JetA") == 0) + vars.push_back(par_JetA); + if (JCParam.definitions().parVar(i).compare("Rho") == 0) + vars.push_back(par_Rho); + } + + ir = JCParam.binIndex(bins); + + if (ir < 0 || ir > (int)JCParam.size()) + continue; + + // Extract JEC formula parameters from payload + for (size_t i = 2 * vars.size(); i < JCParam.record(ir).nParameters(); i++) { + double par = JCParam.record(ir).parameter(i); + params.push_back(par); + } + + double jec = formula.evaluate(vars, params); + hist->SetBinContent(idx + 1, jec); + + } // x_axis + return true; + + } // fill_eta_hist() + + bool fill() override { + TH1D* jec_l1fj = new TH1D("JEC L1FastJet vs. #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); + TH1D* jec_l2rel = new TH1D("JEC L2Relative vs. #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); + TH1D* jec_l2l3 = new TH1D("JEC L2L3Residual vs. #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); + TH1D* jec_l1rc = new TH1D("JEC L1RC vs. #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); + TH1D* jec_uncert = new TH1D("JEC Uncertainty vs. #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); + + TLegend* leg_eta = new TLegend(0.50, 0.73, 0.935, 0.90); + TLegend* leg_eta2 = new TLegend(0.50, 0.83, 0.935, 0.90); + + leg_eta->SetBorderSize(0); + leg_eta->SetLineStyle(0); + leg_eta->SetFillStyle(0); + leg_eta->SetTextFont(42); + + leg_eta2->SetBorderSize(0); + leg_eta2->SetLineStyle(0); + leg_eta2->SetFillStyle(0); + leg_eta2->SetTextFont(42); + + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); + + std::shared_ptr payload = fetchPayload(std::get<1>(iov)); + unsigned int run = std::get<0>(iov); + std::string tagname = tag.name; + std::stringstream ss_tagname(tag.name); + std::string stmp; + + std::string tag_ver; + std::string tag_res; + std::string tag_jet; + + getline(ss_tagname, stmp, '_'); // drop first + getline(ss_tagname, stmp, '_'); // year + tag_ver = stmp; + getline(ss_tagname, stmp, '_'); // ver + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // cmssw + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // data/mc + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // bin + tag_res = stmp; + getline(ss_tagname, stmp, '_'); // jet algorithm + tag_jet = stmp; + + if (payload.get()) { + // JetCorrectorParametersCollection::key_type + std::vector keys; + // Get valid keys in this payload + (*payload).validKeys(keys); + + auto JCParam_L1FJ = (*payload)[L1FastJet]; + auto JCParam_L2 = (*payload)[L2Relative]; + auto JCParam_L2L3 = (*payload)[L2L3Residual]; + auto JCParam_L1RC = (*payload)[L1RC]; + auto JCParam_Unc = (*payload)[Uncertainty]; + + fill_eta_hist(JCParam_L1FJ, jec_l1fj); + fill_eta_hist(JCParam_L2, jec_l2rel); + fill_eta_hist(JCParam_L2L3, jec_l2l3); + fill_eta_hist(JCParam_L1RC, jec_l1rc); + fill_eta_hist(JCParam_Unc, jec_uncert); + + gStyle->SetOptStat(0); + gStyle->SetLabelFont(42, "XYZ"); + gStyle->SetLabelSize(0.05, "XYZ"); + gStyle->SetFrameLineWidth(3); + + std::string title = Form("Summary Run %i", run); + TCanvas canvas("Jet Energy Correction", title.c_str(), 800, 1200); + canvas.Divide(1, 2); + + canvas.cd(1); + jec_l1fj->SetTitle((tag_ver + '_' + tag_jet).c_str()); + jec_l1fj->SetXTitle("#eta"); + jec_l1fj->SetMaximum(1.6); + jec_l1fj->SetMinimum(0.0); + jec_l1fj->SetLineWidth(3); + jec_l1fj->Draw("]["); + + jec_l2rel->SetLineColor(2); + jec_l2rel->SetLineWidth(3); + jec_l2rel->Draw("][same"); + + jec_l2l3->SetLineColor(8); + jec_l2l3->SetLineWidth(3); + jec_l2l3->Draw("][same"); + + jec_l1rc->SetLineColor(9); + jec_l1rc->SetLineWidth(3); + jec_l1rc->Draw("][same"); + + leg_eta->AddEntry(jec_l1fj, (*payload).findLabel(L1FastJet).c_str(), "l"); + leg_eta->AddEntry(jec_l2rel, (*payload).findLabel(L2Relative).c_str(), "l"); + leg_eta->AddEntry(jec_l2l3, (*payload).findLabel(L2L3Residual).c_str(), "l"); + leg_eta->AddEntry(jec_l1rc, (*payload).findLabel(L1RC).c_str(), "l"); + leg_eta->AddEntry((TObject*)nullptr, "JetPt=100; JetA=0.5; Rho=40.", ""); + leg_eta->Draw(); + + canvas.cd(2); + jec_uncert->SetTitle((tag_ver + '_' + tag_jet).c_str()); + jec_uncert->SetXTitle("#eta"); + jec_uncert->SetMaximum(0.1); + jec_uncert->SetMinimum(0.0); + jec_uncert->SetLineColor(6); + jec_uncert->SetLineWidth(3); + jec_uncert->Draw("]["); + + leg_eta2->AddEntry(jec_uncert, (*payload).findLabel(Uncertainty).c_str(), "l"); + leg_eta2->AddEntry((TObject*)nullptr, "JetPt=100; JetA=0.5; Rho=40.", ""); + leg_eta2->Draw(); + + canvas.SaveAs(m_imageFileName.c_str()); + + return true; + } else // no payload.get() + return false; + } // fill + + }; // class + + typedef JetCorrectorVsEta JetCorrectorVsEtaL1Offset; + typedef JetCorrectorVsEta JetCorrectorVsEtaL1FastJet; + typedef JetCorrectorVsEta JetCorrectorVsEtaL2Relative; + typedef JetCorrectorVsEta JetCorrectorVsEtaL3Absolute; + typedef JetCorrectorVsEta JetCorrectorVsEtaL2L3Residual; + typedef JetCorrectorVsEta JetCorrectorVsEtaUncertainty; + typedef JetCorrectorVsEta JetCorrectorVsEtaL1RC; + + // Register the classes as boost python plugin + PAYLOAD_INSPECTOR_MODULE(JetCorrectorParametersCollection) { + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL1Offset); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL1FastJet); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL2Relative); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL3Absolute); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL2L3Residual); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaUncertainty); + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaL1RC); + + PAYLOAD_INSPECTOR_CLASS(JetCorrectorVsEtaSummary); + } + +} // namespace diff --git a/CondCore/JetMETPlugins/plugins/JetResolution_PayloadInspector.cc b/CondCore/JetMETPlugins/plugins/JetResolution_PayloadInspector.cc index 5e3b8219b9afe..722bc8f8d4487 100644 --- a/CondCore/JetMETPlugins/plugins/JetResolution_PayloadInspector.cc +++ b/CondCore/JetMETPlugins/plugins/JetResolution_PayloadInspector.cc @@ -149,11 +149,43 @@ namespace JME { bool fill() override { TH1D* resol_eta = new TH1D("Jet Resolution vs #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA); TH1D* resol_pt = new TH1D("Jet Resolution vs p_T", "", NBIN_PT, MIN_PT, MAX_PT); + TLegend* leg_eta = new TLegend(0.26, 0.73, 0.935, 0.90); + TLegend* leg_pt = new TLegend(0.26, 0.73, 0.935, 0.90); + + leg_eta->SetBorderSize(0); + leg_eta->SetLineStyle(0); + leg_eta->SetFillStyle(0); + + leg_eta->SetTextFont(42); + leg_pt->SetBorderSize(0); + leg_pt->SetLineStyle(0); + leg_pt->SetFillStyle(0); + auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); unsigned int run = std::get<0>(iov); std::string tagname = tag.name; + std::stringstream ss_tagname(tag.name); + std::string stmp; + + std::string tag_ver; + std::string tag_res; + std::string tag_jet; + + getline(ss_tagname, stmp, '_'); // drop first + getline(ss_tagname, stmp, '_'); // year + tag_ver = stmp; + getline(ss_tagname, stmp, '_'); // ver + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // cmssw + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // data/mc + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // bin + tag_res = stmp; + getline(ss_tagname, stmp, '_'); // jet algorithm + tag_jet = stmp; if (payload.get()) { if (!payload->getRecords().empty() && // No formula for SF @@ -221,18 +253,27 @@ namespace JME { canvas.Divide(1, 2); canvas.cd(1); - resol_eta->SetTitle(tagname.c_str()); + resol_eta->SetTitle(tag_res.c_str()); resol_eta->SetXTitle("#eta"); resol_eta->SetYTitle("Resolution"); resol_eta->SetLineWidth(3); + resol_eta->SetMaximum(resol_eta->GetMaximum() * 1.25); resol_eta->Draw(""); + leg_eta->AddEntry(resol_eta, (tag_ver + '_' + tag_jet).c_str(), "l"); + leg_eta->AddEntry((TObject*)nullptr, "JetPt=100, Rho=20", ""); + leg_eta->Draw(); + canvas.cd(2); resol_pt->SetXTitle("p_{T} [GeV]"); resol_pt->SetYTitle("Resolution"); resol_pt->SetLineWidth(3); resol_pt->Draw("]["); + leg_pt->AddEntry(resol_pt, (tag_ver + '_' + tag_jet).c_str(), "l"); + leg_pt->AddEntry((TObject*)nullptr, "JetEta=2.3, Rho=15", ""); + leg_pt->Draw(); + canvas.SaveAs(m_imageFileName.c_str()); return true; @@ -262,6 +303,10 @@ namespace JME { if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta" && record.getParametersValues().size() == 3) { // norm, down, up + if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(1) == "JetPt" && + !record.getBinsRange()[1].is_inside(500.)) + continue; // for 2-bin payload, take jetpt=500 + for (size_t it = 0; it <= NBIN_ETA; it++) { double x_axis = (it + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA; if (record.getBinsRange()[0].is_inside(x_axis)) { @@ -284,6 +329,50 @@ namespace JME { typedef JetScaleFactorVsEta JetScaleFactorVsEtaDOWN; typedef JetScaleFactorVsEta JetScaleFactorVsEtaUP; + template + class JetScaleFactorVsPt : public cond::payloadInspector::Histogram1D { + public: + JetScaleFactorVsPt() + : cond::payloadInspector::Histogram1D( + "Jet Energy Scale Factor", "p_T", NBIN_PT, MIN_PT, MAX_PT, "Scale Factor") {} + + bool fill() override { + auto tag = PlotBase::getTag<0>(); + for (auto const& iov : tag.iovs) { + std::shared_ptr payload = Base::fetchPayload(std::get<1>(iov)); + if (payload.get()) { + if (!payload->getRecords().empty() && // No formula for SF + payload->getDefinition().getFormulaString().compare("") != 0) + return false; + + for (const auto& record : payload->getRecords()) { + if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(0) == "JetEta" && + record.getBinsRange()[0].is_inside(2.55) && // take jeteta=2.5 + payload->getDefinition().getBinName(1) == "JetPt" && // 2-bin + record.getParametersValues().size() == 3) { // norm, down, up + + for (size_t it = 0; it <= NBIN_PT; it++) { + double x_axis = (it + 0.5) * (MAX_PT - MIN_PT) / NBIN_PT + MIN_PT; + if (record.getBinsRange()[1].is_inside(x_axis)) { + double sf = 0.; + sf = record.getParametersValues()[ii]; + fillWithBinAndValue(it, sf); + } + } + } + } // records + return true; + } else + return false; + } // for + return false; + } // fill + }; // class + + typedef JetScaleFactorVsPt JetScaleFactorVsPtNORM; + typedef JetScaleFactorVsPt JetScaleFactorVsPtDOWN; + typedef JetScaleFactorVsPt JetScaleFactorVsPtUP; + class JetScaleFactorSummary : public cond::payloadInspector::PlotImage { public: JetScaleFactorSummary() @@ -293,32 +382,91 @@ namespace JME { TH1D* sf_eta_norm = new TH1D("Jet SF vs #eta NORM", "", NBIN_ETA, MIN_ETA, MAX_ETA); TH1D* sf_eta_down = new TH1D("Jet SF vs #eta DOWN", "", NBIN_ETA, MIN_ETA, MAX_ETA); TH1D* sf_eta_up = new TH1D("Jet SF vs #eta UP", "", NBIN_ETA, MIN_ETA, MAX_ETA); + TH1D* sf_pt_norm = new TH1D("Jet SF vs p_T NORM", "", NBIN_PT, MIN_PT, MAX_PT); + TH1D* sf_pt_down = new TH1D("Jet SF vs p_T DOWN", "", NBIN_PT, MIN_PT, MAX_PT); + TH1D* sf_pt_up = new TH1D("Jet SF vs p_T UP", "", NBIN_PT, MIN_PT, MAX_PT); + + TLegend* leg_eta = new TLegend(0.26, 0.73, 0.935, 0.90); + TLegend* leg_pt = new TLegend(0.26, 0.73, 0.935, 0.90); + + leg_eta->SetBorderSize(0); + leg_eta->SetLineStyle(0); + leg_eta->SetFillStyle(0); + + leg_eta->SetTextFont(42); + leg_pt->SetBorderSize(0); + leg_pt->SetLineStyle(0); + leg_pt->SetFillStyle(0); auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); unsigned int run = std::get<0>(iov); std::string tagname = tag.name; + std::stringstream ss_tagname(tag.name); + std::string stmp; + + std::string tag_ver; + std::string tag_res; + std::string tag_jet; + + getline(ss_tagname, stmp, '_'); // drop first + getline(ss_tagname, stmp, '_'); // year + tag_ver = stmp; + getline(ss_tagname, stmp, '_'); // ver + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // cmssw + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // data/mc + tag_ver += '_' + stmp; + getline(ss_tagname, stmp, '_'); // bin + tag_res = stmp; + getline(ss_tagname, stmp, '_'); // jet algorithm + tag_jet = stmp; + + bool is_2bin = false; if (payload.get()) { if (!payload->getRecords().empty() && // No formula for SF payload->getDefinition().getFormulaString().compare("") != 0) return false; + is_2bin = false; for (const auto& record : payload->getRecords()) { + if (record.getBinsRange().size() > 1) + is_2bin = true; + if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta" && record.getParametersValues().size() == 3) { // norm, down, up for (size_t it = 0; it <= NBIN_ETA; it++) { double x_axis = (it + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA; - if (record.getBinsRange()[0].is_inside(x_axis)) { + if (((is_2bin == false) || (is_2bin == true && record.getBinsRange()[1].is_inside(500.))) && + record.getBinsRange()[0].is_inside(x_axis)) { sf_eta_norm->SetBinContent(it + 1, record.getParametersValues()[0]); sf_eta_down->SetBinContent(it + 1, record.getParametersValues()[1]); sf_eta_up->SetBinContent(it + 1, record.getParametersValues()[2]); } } } - } // records + + if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(0) == "JetEta" && + record.getBinsRange()[0].is_inside(2.55) && // take jeteta=2.5 + payload->getDefinition().getBinName(1) == "JetPt" && + record.getParametersValues().size() == 3) { // norm, down, up + + is_2bin = true; + + for (size_t it = 0; it <= NBIN_PT; it++) { + double x_axis = (it + 0.5) * (MAX_PT - MIN_PT) / NBIN_PT + MIN_PT; + if (record.getBinsRange()[1].is_inside(x_axis)) { + sf_pt_norm->SetBinContent(it + 1, record.getParametersValues()[0]); + sf_pt_down->SetBinContent(it + 1, record.getParametersValues()[1]); + sf_pt_up->SetBinContent(it + 1, record.getParametersValues()[2]); + } + } + } // 2-bin + } // records gStyle->SetOptStat(0); gStyle->SetLabelFont(42, "XYZ"); @@ -326,15 +474,17 @@ namespace JME { gStyle->SetFrameLineWidth(3); std::string title = Form("Summary Run %i", run); - TCanvas canvas("Jet ScaleFactor Summary", title.c_str(), 800, 600); + TCanvas canvas("Jet ScaleFactor Summary", title.c_str(), 800, 1200); + canvas.Divide(1, 2); - canvas.cd(); - sf_eta_up->SetTitle(tagname.c_str()); + canvas.cd(1); + sf_eta_up->SetTitle("ScaleFactor vs. #eta"); sf_eta_up->SetXTitle("#eta"); sf_eta_up->SetYTitle("Scale Factor"); sf_eta_up->SetLineStyle(7); sf_eta_up->SetLineWidth(3); sf_eta_up->SetFillColorAlpha(kGray, 0.5); + sf_eta_up->SetMaximum(sf_eta_up->GetMaximum() * 1.25); sf_eta_up->SetMinimum(0.); sf_eta_up->Draw("]["); @@ -349,6 +499,38 @@ namespace JME { sf_eta_norm->Draw("][ same"); sf_eta_norm->Draw("axis same"); + leg_eta->AddEntry(sf_eta_norm, (tag_ver + '_' + tag_jet).c_str(), "l"); + leg_eta->AddEntry((TObject*)nullptr, "JetPt=500", ""); + leg_eta->Draw(); + + if (is_2bin == true) { + canvas.cd(2); + sf_pt_up->SetTitle("ScaleFactor vs. p_{T}"); + sf_pt_up->SetXTitle("p_{T} [GeV]"); + sf_pt_up->SetYTitle("Scale Factor"); + sf_pt_up->SetLineStyle(7); + sf_pt_up->SetLineWidth(3); + sf_pt_up->SetFillColorAlpha(kGray, 0.5); + sf_pt_up->SetMaximum(sf_pt_up->GetMaximum() * 1.25); + sf_pt_up->SetMinimum(0.); + sf_pt_up->Draw("]["); + + sf_pt_down->SetLineStyle(7); + sf_pt_down->SetLineWidth(3); + sf_pt_down->SetFillColorAlpha(kWhite, 1); + sf_pt_down->Draw("][ same"); + + sf_pt_norm->SetLineStyle(1); + sf_pt_norm->SetLineWidth(5); + sf_pt_norm->SetFillColor(0); + sf_pt_norm->Draw("][ same"); + sf_pt_norm->Draw("axis same"); + + leg_pt->AddEntry(sf_pt_norm, (tag_ver + '_' + tag_jet).c_str(), "l"); + leg_pt->AddEntry((TObject*)nullptr, "JetEta=2.55", ""); + leg_pt->Draw(); + } + canvas.SaveAs(m_imageFileName.c_str()); return true; @@ -357,6 +539,7 @@ namespace JME { } // fill }; // class + // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(JetResolutionObject) { PAYLOAD_INSPECTOR_CLASS(JetResolutionVsEta); @@ -364,6 +547,9 @@ namespace JME { PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsEtaNORM); PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsEtaDOWN); PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsEtaUP); + PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsPtNORM); + PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsPtDOWN); + PAYLOAD_INSPECTOR_CLASS(JetScaleFactorVsPtUP); PAYLOAD_INSPECTOR_CLASS(JetResolutionSummary); PAYLOAD_INSPECTOR_CLASS(JetScaleFactorSummary); } diff --git a/CondCore/JetMETPlugins/test/BuildFile.xml b/CondCore/JetMETPlugins/test/BuildFile.xml index 1cd520055c421..95a1092cb71f1 100644 --- a/CondCore/JetMETPlugins/test/BuildFile.xml +++ b/CondCore/JetMETPlugins/test/BuildFile.xml @@ -4,4 +4,6 @@ + + diff --git a/CondCore/JetMETPlugins/test/testJetCorrectorPayloadInspector.cpp b/CondCore/JetMETPlugins/test/testJetCorrectorPayloadInspector.cpp new file mode 100644 index 0000000000000..71752e137ae19 --- /dev/null +++ b/CondCore/JetMETPlugins/test/testJetCorrectorPayloadInspector.cpp @@ -0,0 +1,65 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondCore/CondDB/interface/Time.h" + +#include +#include +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/JetMETPlugins/plugins/JetCorrector_PayloadInspector.cc" + +#include "FWCore/PluginManager/interface/PluginManager.h" +#include "FWCore/PluginManager/interface/standard.h" +#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" + +int main(int argc, char** argv) { + Py_Initialize(); + edmplugin::PluginManager::Config config; + edmplugin::PluginManager::configure(edmplugin::standard::config()); + + std::vector psets; + edm::ParameterSet pSet; + pSet.addParameter("@service_type", std::string("SiteLocalConfigService")); + psets.push_back(pSet); + edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets)); + edm::ServiceRegistry::Operate operate(servToken); + + std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); + + std::string tag_mc = "JetCorrectorParametersCollection_Autumn18_V19_MC_AK4PF"; + std::string tag_data = "JetCorrectorParametersCollection_Autumn18_RunABCD_V19_DATA_AK4PF"; + cond::Time_t start = static_cast(1); + cond::Time_t end = static_cast(1); + + edm::LogWarning("JEC_PI") << "## Jet Energy Corrector Vs. Eta Histograms MC" << std::endl; + + JetCorrectorVsEtaL1Offset histo1; + histo1.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo1.data() << std::endl; + + JetCorrectorVsEtaL1FastJet histo2; + histo2.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo2.data() << std::endl; + + JetCorrectorVsEtaL2Relative histo3; + histo3.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo3.data() << std::endl; + + JetCorrectorVsEtaL3Absolute histo4; + histo4.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo4.data() << std::endl; + + JetCorrectorVsEtaL2L3Residual histo5; + histo5.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo5.data() << std::endl; + + JetCorrectorVsEtaUncertainty histo6; + histo6.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo6.data() << std::endl; + + JetCorrectorVsEtaL1RC histo7; + histo7.process(connectionString, PI::mk_input(tag_mc, start, end)); + edm::LogWarning("JEC_PI") << histo7.data() << std::endl; + + Py_Finalize(); +} diff --git a/CondCore/JetMETPlugins/test/testJetResolutionPayloadInspector.cpp b/CondCore/JetMETPlugins/test/testJetResolutionPayloadInspector.cpp index a0caf866ef48e..433915690bd29 100644 --- a/CondCore/JetMETPlugins/test/testJetResolutionPayloadInspector.cpp +++ b/CondCore/JetMETPlugins/test/testJetResolutionPayloadInspector.cpp @@ -32,39 +32,55 @@ int main(int argc, char** argv) { cond::Time_t start = static_cast(1); cond::Time_t end = static_cast(1); - std::cout << "## Jet Pt Resolution Histograms" << std::endl; + edm::LogWarning("JER_PI") << "## Jet Pt Resolution Histograms" << std::endl; JME::JetResolutionVsEta histo1; histo1.process(connectionString, PI::mk_input(tag_pt, start, end)); - std::cout << histo1.data() << std::endl; + edm::LogWarning("JER_PI") << histo1.data() << std::endl; JME::JetResolutionVsPt histo2; histo2.process(connectionString, PI::mk_input(tag_pt, start, end)); - std::cout << histo2.data() << std::endl; + edm::LogWarning("JER_PI") << histo2.data() << std::endl; - std::cout << "## Jet Eta Resolution Histograms" << std::endl; + edm::LogWarning("JER_PI") << "## Jet Eta Resolution Histograms" << std::endl; JME::JetResolutionVsEta histo3; histo3.process(connectionString, PI::mk_input(tag_eta, start, end)); - std::cout << histo3.data() << std::endl; + edm::LogWarning("JER_PI") << histo3.data() << std::endl; JME::JetResolutionVsPt histo4; histo4.process(connectionString, PI::mk_input(tag_eta, start, end)); - std::cout << histo4.data() << std::endl; + edm::LogWarning("JER_PI") << histo4.data() << std::endl; - std::cout << "## Jet SF Histograms" << std::endl; + edm::LogWarning("JER_PI") << "## Jet SF vs. Eta Histograms" << std::endl; JME::JetScaleFactorVsEtaNORM histo5; histo5.process(connectionString, PI::mk_input(tag_sf, start, end)); - std::cout << histo5.data() << std::endl; + edm::LogWarning("JER_PI") << histo5.data() << std::endl; JME::JetScaleFactorVsEtaDOWN histo6; histo6.process(connectionString, PI::mk_input(tag_sf, start, end)); - std::cout << histo6.data() << std::endl; + edm::LogWarning("JER_PI") << histo6.data() << std::endl; JME::JetScaleFactorVsEtaUP histo7; histo7.process(connectionString, PI::mk_input(tag_sf, start, end)); - std::cout << histo7.data() << std::endl; + edm::LogWarning("JER_PI") << histo7.data() << std::endl; + + tag_sf = "JR_Autumn18_V7_MC_SF_AK4PF"; + + edm::LogWarning("JER_PI") << "## Jet SF vs. Pt Histograms" << std::endl; + + JME::JetScaleFactorVsPtNORM histo8; + histo8.process(connectionString, PI::mk_input(tag_sf, start, end)); + edm::LogWarning("JER_PI") << histo8.data() << std::endl; + + JME::JetScaleFactorVsPtDOWN histo9; + histo9.process(connectionString, PI::mk_input(tag_sf, start, end)); + edm::LogWarning("JER_PI") << histo9.data() << std::endl; + + JME::JetScaleFactorVsPtUP histo10; + histo10.process(connectionString, PI::mk_input(tag_sf, start, end)); + edm::LogWarning("JER_PI") << histo10.data() << std::endl; Py_Finalize(); } diff --git a/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc b/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc index 344bbbb2ca343..6259304aa37a0 100644 --- a/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc +++ b/CondCore/SiPixelPlugins/plugins/SiPixelDynamicInefficiency_PayloadInspector.cc @@ -223,6 +223,155 @@ namespace { return (masks_geom.size() == masks_db.size() && std::equal(masks_geom.begin(), masks_geom.end(), masks_db.begin())); } + + //_________________________________________________ + unsigned int maxDepthOfPUArray(const std::map >& map_pufactor) { + unsigned int size{0}; + for (const auto& [id, vec] : map_pufactor) { + if (vec.size() > size) + size = vec.size(); + } + return size; + } + + //_________________________________________________ + std::pair getClosestFactors(int input) { + if ((input % 2 != 0) && input > 1) { + input += 1; + } + + int testNum = (int)sqrt(input); + while (input % testNum != 0) { + testNum--; + } + return std::make_pair(testNum, input / testNum); + } + + /** Given an input list of std::string this + * finds the longest common substring + */ + std::string findStem(const std::vector& arr) { + // Determine size of the array + int n = arr.size(); + + // Take first word from array as reference + const std::string& s = arr[0]; + int len = s.length(); + + std::string res = ""; + + for (int i = 0; i < len; i++) { + for (int j = i + 1; j <= len; j++) { + // generating all possible substrings + // of our reference string arr[0] i.e s + std::string stem = s.substr(i, j); + int k = 1; + for (k = 1; k < n; k++) { + // Check if the generated stem is + // common to all words + if (arr[k].find(stem) == std::string::npos) + break; + } + + // If current substring is present in + // all strings and its length is greater + // than current result + if (k == n && res.length() < stem.length()) + res = stem; + } + } + return res; + } + + /** This function determines from the list of attached DetId which + * SiPixelPI::region represents them + */ + std::string attachLocationLabel(const std::vector& listOfDetIds, SiPixelPI::PhaseInfo& phInfo) { + // collect all the regions in which it can be split + std::vector regions; + for (const auto& rawId : listOfDetIds) { + SiPixelPI::topolInfo t_info_fromXML; + t_info_fromXML.init(); + DetId detid(rawId); + + const char* path_toTopologyXML = phInfo.pathToTopoXML(); + auto tTopo = + StandaloneTrackerTopology::fromTrackerParametersXMLFile(edm::FileInPath(path_toTopologyXML).fullPath()); + t_info_fromXML.fillGeometryInfo(detid, tTopo, phInfo.phase()); + const auto& reg = SiPixelPI::getStringFromRegionEnum(t_info_fromXML.filterThePartition()); + if (!std::count(regions.begin(), regions.end(), reg)) { + regions.push_back(reg); + } + } + + std::string retVal = ""; + // if perfect match (only one category) + if (regions.size() == 1) { + retVal = regions.front(); + } else { + retVal = findStem(regions); + } + + // if the last char is "/" strip it from the string + if (retVal.back() == '/') + retVal.pop_back(); + + return retVal; + } + + void fillParametrizations(std::vector >& listOfParametrizations, + std::vector& parametrizations, + std::vector& formulas, + const std::vector& namesOfParts) { + static constexpr double xmin_ = 0.; // x10e34 (min inst. lumi) + static constexpr double xmax_ = 25.; // x10e34 (max inst. lumi) + + // functional for polynomial of n-th degree + auto func = [](double* x, double* p) { + int n = p[0]; + double* params = p + 1; + ROOT::Math::Polynomial pol(n); + return pol(x, params); + }; + + int index{0}; + for (auto& params : listOfParametrizations) { + index++; + int n = params.size(); + int npar = n + 2; + std::string str{namesOfParts[index - 1]}; + if (str.length() >= 2 && str.substr(str.length() - 2) == "/i") { + str += "nner"; + } else if (str.length() >= 2 && str.substr(str.length() - 2) == "/o") { + str += "uter"; + } + + TF1* f1 = new TF1((fmt::sprintf("region: #bf{%s}", str)).c_str(), func, xmin_, xmax_, npar); + + // push polynomial degree as first entry in the vector + params.insert(params.begin(), n); + // TF1::SetParameters needs a C-style array + double* arr = params.data(); + f1->SetLineWidth(2); + + // fill in the parameter + for (unsigned int j = 0; j < params.size(); j++) { + f1->SetParameter(j, arr[j]); + } + + parametrizations.push_back(f1); + + // build the formula to be displayed + std::string formula; + edm::LogVerbatim("fillParametrizations") << "index: " << index; + for (unsigned int i = 1; i < params.size(); i++) { + edm::LogVerbatim("fillParametrizations") << " " << params[i]; + formula += fmt::sprintf("%s%fx^{%i}", (i == 1 ? "" : (std::signbit(params[i]) ? "" : "+")), params[i], i - 1); + } + edm::LogVerbatim("fillParametrizations") << std::endl; + formulas.push_back(formula); + } + } } // namespace SiPixDynIneff /************************************************ @@ -580,6 +729,7 @@ namespace { SiPixelDetInfoFileReader reader = SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh1DefaultFile).fullPath()); const auto& p1detIds = reader.getAllDetIds(); + for (const auto& det : p1detIds) { const auto& value = SiPixDynIneff::getMatchingGeomFactor(det, theMap, detIdmasks_db); fullMap.fillTrackerMap(det, value); @@ -651,7 +801,7 @@ namespace { return false; } - unsigned int depth = maxDepthOfPUArray(theMap); + unsigned int depth = SiPixDynIneff::maxDepthOfPUArray(theMap); // create the maps for (unsigned int i = 0; i < depth; i++) { @@ -685,7 +835,7 @@ namespace { } // determine how the plot will be paginated - auto sides = getClosestFactors(depth); + auto sides = SiPixDynIneff::getClosestFactors(depth); TCanvas canvas("Canv", "Canv", sides.second * 900, sides.first * 600); canvas.Divide(sides.second, sides.first); @@ -711,28 +861,6 @@ namespace { protected: std::string payloadString; std::string label_; - - private: - unsigned int maxDepthOfPUArray(const std::map >& map_pufactor) { - unsigned int size{0}; - for (const auto& [id, vec] : map_pufactor) { - if (vec.size() > size) - size = vec.size(); - } - return size; - } - - std::pair getClosestFactors(int input) { - if ((input % 2 != 0) && input > 1) { - input += 1; - } - - int testNum = (int)sqrt(input); - while (input % testNum != 0) { - testNum--; - } - return std::make_pair(testNum, input / testNum); - } }; /************************************************ @@ -771,7 +899,11 @@ namespace { // retrieve the list of phase1 detids const auto& reader = SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh1DefaultFile).fullPath()); - const auto& p1detIds = reader.getAllDetIds(); + auto p1detIds = reader.getAllDetIds(); + + // follows hack to get an inner ladder module first + // skip the first 8 dets since they lay on the same ladder + std::swap(p1detIds[0], p1detIds[8]); std::map > modules_per_region; @@ -797,7 +929,7 @@ namespace { // fill in the (ordered) information about regions for (const auto& [index, modules] : modules_per_region) { auto PhInfo = SiPixelPI::PhaseInfo(SiPixelPI::phase1size); - const auto& regName = this->attachLocationLabel(modules, PhInfo); + const auto& regName = SiPixDynIneff::attachLocationLabel(modules, PhInfo); namesOfParts.push_back(regName); /* @@ -822,54 +954,16 @@ namespace { ss.str(std::string()); /* clear the stringstream */ } - // functional for polynomial of n-th degree - auto func = [](double* x, double* p) { - int n = p[0]; - double* params = p + 1; - ROOT::Math::Polynomial pol(n); - return pol(x, params); - }; - std::vector parametrizations; std::vector formulas; parametrizations.reserve(depth); formulas.reserve(depth); - int index{0}; - for (auto& params : listOfParametrizations) { - index++; - int n = params.size(); - int npar = n + 2; - TF1* f1 = - new TF1((fmt::sprintf("region: #bf{%s}", namesOfParts[index - 1])).c_str(), func, xmin_, xmax_, npar); - - // push polynomial degree as first entry in the vector - params.insert(params.begin(), n); - // TF1::SetParameters needs a C-style array - double* arr = params.data(); - f1->SetLineWidth(2); - - // fill in the parameter - for (unsigned int j = 0; j < params.size(); j++) { - f1->SetParameter(j, arr[j]); - } - - parametrizations.push_back(f1); - - // build the formula to be displayed - std::string formula; - edm::LogVerbatim(label_) << "index: " << index; - for (unsigned int i = 1; i < params.size(); i++) { - edm::LogVerbatim(label_) << " " << params[i]; - formula += - fmt::sprintf("%s%fx^{%i}", (i == 1 ? "" : (std::signbit(params[i]) ? "" : "+")), params[i], i - 1); - } - edm::LogVerbatim(label_) << std::endl; - formulas.push_back(formula); - } + // fill the parametrization plots + SiPixDynIneff::fillParametrizations(listOfParametrizations, parametrizations, formulas, namesOfParts); // determine how the plot will be paginated - auto sides = getClosestFactors(depth); + auto sides = SiPixDynIneff::getClosestFactors(depth); TCanvas canvas("Canv", "Canv", sides.second * 900, sides.first * 600); canvas.Divide(sides.second, sides.first); @@ -886,6 +980,7 @@ namespace { ax->SetTitle("Inst. luminosity [10^{33} cm^{-2}s^{-1}]"); TAxis* ay = h->GetYaxis(); + ay->SetRangeUser(0.80, 1.00); // force the scale ay->SetTitle("Double Column Efficiency parametrization"); // beautify @@ -897,15 +992,15 @@ namespace { ltx.SetTextAlign(11); ltx.DrawLatexNDC( gPad->GetLeftMargin() + 0.03, - gPad->GetBottomMargin() + 0.04, - ("#color[4]{" + tag.name + "}, IOV: #color[4]{" + std::to_string(std::get<0>(iov)) + "}").c_str()); + gPad->GetBottomMargin() + 0.08, + ("#color[2]{" + tag.name + "},IOV: #color[2]{" + std::to_string(std::get<0>(iov)) + "}").c_str()); auto ltxForm = TLatex(); ltxForm.SetTextFont(62); ltxForm.SetTextColor(kRed); - ltxForm.SetTextSize(0.045); + ltxForm.SetTextSize(0.035); ltxForm.SetTextAlign(11); - ltxForm.DrawLatexNDC(gPad->GetLeftMargin() + 0.05, 0.85, formulas[i].c_str()); + ltxForm.DrawLatexNDC(gPad->GetLeftMargin() + 0.03, gPad->GetBottomMargin() + 0.04, formulas[i].c_str()); edm::LogPrint(label_) << namesOfParts[i] << " => " << formulas[i] << std::endl; } @@ -920,104 +1015,224 @@ namespace { protected: std::string payloadString; std::string label_; + }; - static constexpr double xmin_ = 0.; // x10e34 (min inst. lumi) - static constexpr double xmax_ = 25.; // x10e34 (max inst. lumi) - - private: - unsigned int maxDepthOfPUArray(const std::map >& map_pufactor) { - unsigned int size{0}; - for (const auto& [id, vec] : map_pufactor) { - if (vec.size() > size) - size = vec.size(); - } - return size; + template + class SiPixelDynamicInefficiencyPUParamComparisonBase : public PlotImage { + public: + SiPixelDynamicInefficiencyPUParamComparisonBase() + : PlotImage( + Form("SiPixelDynamic Inefficiency parameterization comparison by Region %i tag(s)", ntags)) { + label_ = "SiPixelDynamicInefficiencyPUParameterization"; } - std::pair getClosestFactors(int input) { - if ((input % 2 != 0) && input > 1) { - input += 1; - } + bool fill() override { + gStyle->SetPalette(1); - int testNum = (int)sqrt(input); - while (input % testNum != 0) { - testNum--; + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = PlotBase::getTag<0>().iovs; + auto f_tagname = PlotBase::getTag<0>().name; + std::string l_tagname = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; + + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); + + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = PlotBase::getTag<1>().iovs; + l_tagname = PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); } - return std::make_pair(testNum, input / testNum); - } - /** This function determines from the list of attached DetId which - * SiPixelPI::region represents them - */ - std::string attachLocationLabel(const std::vector& listOfDetIds, SiPixelPI::PhaseInfo& phInfo) { - // collect all the regions in which it can be split - std::vector regions; - for (const auto& rawId : listOfDetIds) { - SiPixelPI::topolInfo t_info_fromXML; - t_info_fromXML.init(); - DetId detid(rawId); + std::shared_ptr last_payload = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); - const char* path_toTopologyXML = phInfo.pathToTopoXML(); - auto tTopo = - StandaloneTrackerTopology::fromTrackerParametersXMLFile(edm::FileInPath(path_toTopologyXML).fullPath()); - t_info_fromXML.fillGeometryInfo(detid, tTopo, phInfo.phase()); - const auto& reg = SiPixelPI::getStringFromRegionEnum(t_info_fromXML.filterThePartition()); - if (!std::count(regions.begin(), regions.end(), reg)) { - regions.push_back(reg); + if (first_payload.get() && last_payload.get()) { + SiPixDynIneff::PUFactorMap f_theMap = first_payload->getPUFactors(); + std::vector f_detIdmasks_db = first_payload->getDetIdmasks(); + + SiPixDynIneff::PUFactorMap l_theMap = last_payload->getPUFactors(); + std::vector l_detIdmasks_db = last_payload->getDetIdmasks(); + + if (!SiPixDynIneff::checkPhase(SiPixelPI::phase::one, f_detIdmasks_db) || + !SiPixDynIneff::checkPhase(SiPixelPI::phase::one, l_detIdmasks_db)) { + edm::LogError(label_) << label_ << " maps are not supported for non-Phase1 Pixel geometries !"; + TCanvas canvas("Canv", "Canv", 1200, 1000); + SiPixelPI::displayNotSupported(canvas, 0); + std::string fileName(this->m_imageFileName); + canvas.SaveAs(fileName.c_str()); + return false; } - } - std::string retVal = ""; - // if perfect match (only one category) - if (regions.size() == 1) { - retVal = regions.front(); - } else { - retVal = this->findStem(regions); - } + std::vector > f_listOfParametrizations; + std::vector > l_listOfParametrizations; - // if the last char is "/" strip it from the string - if (retVal.back() == '/') - retVal.pop_back(); + // retrieve the list of phase1 detids + const auto& reader = + SiPixelDetInfoFileReader(edm::FileInPath(SiPixelDetInfoFileReader::kPh1DefaultFile).fullPath()); + auto p1detIds = reader.getAllDetIds(); - return retVal; - } + // follows hack to get an inner ladder module first + // skip the first 8 dets since they lay on the same ladder + std::swap(p1detIds[0], p1detIds[8]); - /** Given an input list of std::string this - * finds the longest common substring - */ - std::string findStem(const std::vector& arr) { - // Determine size of the array - int n = arr.size(); + std::map > modules_per_region; - // Take first word from array as reference - std::string s = arr[0]; - int len = s.length(); + // fill the maps + for (const auto& det : p1detIds) { + const auto& f_values = SiPixDynIneff::getMatchingPUFactors(det, f_theMap, f_detIdmasks_db); + const auto& l_values = SiPixDynIneff::getMatchingPUFactors(det, l_theMap, l_detIdmasks_db); - std::string res = ""; + // find the index in the vector + auto fIndex = std::find(f_listOfParametrizations.begin(), f_listOfParametrizations.end(), f_values); + auto lIndex = std::find(l_listOfParametrizations.begin(), l_listOfParametrizations.end(), l_values); - for (int i = 0; i < len; i++) { - for (int j = i + 1; j <= len; j++) { - // generating all possible substrings - // of our reference string arr[0] i.e s - std::string stem = s.substr(i, j); - int k = 1; - for (k = 1; k < n; k++) { - // Check if the generated stem is - // common to all words - if (arr[k].find(stem) == std::string::npos) - break; + // if it's not there push it back in the list of parametrizations and then insert in the map + if (fIndex == f_listOfParametrizations.end()) { + f_listOfParametrizations.push_back(f_values); + std::vector toInsert = {det}; + modules_per_region.insert(std::make_pair(f_listOfParametrizations.size() - 1, toInsert)); + } else { + modules_per_region.at(fIndex - f_listOfParametrizations.begin()).push_back(det); } - // If current substring is present in - // all strings and its length is greater - // than current result - if (k == n && res.length() < stem.length()) - res = stem; + if (lIndex == l_listOfParametrizations.end()) { + l_listOfParametrizations.push_back(l_values); + } } - } - return res; - } + + unsigned int f_depth = f_listOfParametrizations.size(); + unsigned int l_depth = l_listOfParametrizations.size(); + + if (l_depth != f_depth) { + edm::LogError(label_) << label_ + << " trying to compare dynamic inefficiencys payload with different detid masks!"; + TCanvas canvas("Canv", "Canv", 1200, 1000); + SiPixelPI::displayNotSupported(canvas, 0); + std::string fileName(this->m_imageFileName); + canvas.SaveAs(fileName.c_str()); + return false; + } + + assert(f_depth == l_depth); + + std::vector namesOfParts; + namesOfParts.reserve(f_depth); + // fill in the (ordered) information about regions + for (const auto& [index, modules] : modules_per_region) { + auto PhInfo = SiPixelPI::PhaseInfo(SiPixelPI::phase1size); + const auto& regName = SiPixDynIneff::attachLocationLabel(modules, PhInfo); + namesOfParts.push_back(regName); + + /* + * The following is needed for internal + * debug / cross-check + */ + + std::stringstream ss; + ss << "region name: " << regName << " has the following modules attached: ["; + for (const auto& module : modules) { + ss << module << ", "; + } + ss.seekp(-2, std::ios_base::end); // remove last two chars + ss << "] " + << " has representation ("; + for (const auto& param : f_listOfParametrizations[index]) { + ss << param << ", "; + } + ss.seekp(-2, std::ios_base::end); // remove last two chars + ss << ") "; + edm::LogPrint(label_) << ss.str() << "\n\n"; + ss.str(std::string()); /* clear the stringstream */ + } + + // now fill the paramtrizations + std::vector f_parametrizations; + std::vector f_formulas; + f_parametrizations.reserve(f_depth); + f_formulas.reserve(f_depth); + + std::vector l_parametrizations; + std::vector l_formulas; + l_parametrizations.reserve(l_depth); + l_formulas.reserve(l_depth); + + // fill the parametrization plots + SiPixDynIneff::fillParametrizations(f_listOfParametrizations, f_parametrizations, f_formulas, namesOfParts); + SiPixDynIneff::fillParametrizations(l_listOfParametrizations, l_parametrizations, l_formulas, namesOfParts); + + // determine how the plot will be paginated + auto sides = SiPixDynIneff::getClosestFactors(f_depth); + TCanvas canvas("Canv", "Canv", sides.second * 900, sides.first * 600); + canvas.Divide(sides.second, sides.first); + + // print the sub-canvases + for (unsigned int i = 0; i < f_depth; i++) { + canvas.cd(i + 1); + gPad->SetGrid(); + SiPixelPI::adjustCanvasMargins(gPad, 0.07, 0.14, 0.14, 0.03); + f_parametrizations[i]->Draw(); + l_parametrizations[i]->SetLineColor(kBlue); + l_parametrizations[i]->SetLineStyle(kDashed); + l_parametrizations[i]->Draw("same"); + + // set axis + TH1* h = f_parametrizations[i]->GetHistogram(); + TAxis* ax = h->GetXaxis(); + ax->SetTitle("Inst. luminosity [10^{33} cm^{-2}s^{-1}]"); + + TAxis* ay = h->GetYaxis(); + ay->SetRangeUser(0.80, 1.00); // force the scale + ay->SetTitle("Double Column Efficiency parametrization"); + + // beautify + SiPixelPI::makeNicePlotStyle(h); + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.045); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC( + gPad->GetLeftMargin() + 0.03, + gPad->GetBottomMargin() + 0.16, + ("#color[2]{" + f_tagname + "},IOV: #color[2]{" + std::to_string(std::get<0>(firstiov)) + "}").c_str()); + ltx.DrawLatexNDC( + gPad->GetLeftMargin() + 0.03, + gPad->GetBottomMargin() + 0.08, + ("#color[4]{" + l_tagname + "},IOV: #color[4]{" + std::to_string(std::get<0>(lastiov)) + "}").c_str()); + + auto ltxForm = TLatex(); + ltxForm.SetTextFont(62); + ltxForm.SetTextColor(kRed); + ltxForm.SetTextSize(0.035); + ltxForm.SetTextAlign(11); + ltxForm.DrawLatexNDC(gPad->GetLeftMargin() + 0.03, gPad->GetBottomMargin() + 0.12, f_formulas[i].c_str()); + + ltxForm.SetTextColor(kBlue); + ltxForm.DrawLatexNDC(gPad->GetLeftMargin() + 0.03, gPad->GetBottomMargin() + 0.04, l_formulas[i].c_str()); + + edm::LogPrint(label_) << namesOfParts[i] << " => " << f_formulas[i] << std::endl; + edm::LogPrint(label_) << namesOfParts[i] << " => " << l_formulas[i] << std::endl; + } + + std::string fileName(this->m_imageFileName); + canvas.SaveAs(fileName.c_str()); + //canvas.SaveAs((fileName+".root").c_str()); + + } // if payload.get() + return true; + } // fill() + + protected: + std::string label_; }; + + using SiPixelDynamicInefficiencyPUParamComparisonTwoTags = + SiPixelDynamicInefficiencyPUParamComparisonBase; + } // namespace // Register the classes as boost python plugin @@ -1034,4 +1249,5 @@ PAYLOAD_INSPECTOR_MODULE(SiPixelDynamicInefficiency) { PAYLOAD_INSPECTOR_CLASS(SiPixelDynamicInefficiencyChipGeomFactorMap); PAYLOAD_INSPECTOR_CLASS(SiPixelDynamicInefficiencyPUPixelMaps); PAYLOAD_INSPECTOR_CLASS(SiPixelDynamicInefficiencyPUParametrization); + PAYLOAD_INSPECTOR_CLASS(SiPixelDynamicInefficiencyPUParamComparisonTwoTags); } diff --git a/CondCore/SiPixelPlugins/test/testSiPixelDynamicInefficiency.sh b/CondCore/SiPixelPlugins/test/testSiPixelDynamicInefficiency.sh index 802062feac098..0ca88b1a15365 100755 --- a/CondCore/SiPixelPlugins/test/testSiPixelDynamicInefficiency.sh +++ b/CondCore/SiPixelPlugins/test/testSiPixelDynamicInefficiency.sh @@ -88,3 +88,16 @@ getPayloadData.py \ --test; mv *.png $W_DIR/plots_DynIneff/SiPixelFullIneffROCfromDynIneffMapDelta.png + +getPayloadData.py \ + --plugin pluginSiPixelDynamicInefficiency_PayloadInspector \ + --plot plot_SiPixelDynamicInefficiencyPUParamComparisonTwoTags \ + --tag SiPixelDynamicInefficiency_phase1_2023_v2_fix3 \ + --tagtwo SiPixelDynamicInefficiency_phase1_2023_v2_fix2 \ + --time_type Run \ + --iovs '{"start_iov": "1", "end_iov": "1"}' \ + --iovstwo '{"start_iov": "1", "end_iov": "1"}' \ + --db Prod \ + --test; + +mv *.png $W_DIR/plots_DynIneff/SiPixelDynamicInefficiencyPUParamComparisonTwoTags.png diff --git a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp index d66551b25ba76..3b94cf916ae54 100644 --- a/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp +++ b/CondCore/SiPixelPlugins/test/testSiPixelPayloadInspector.cpp @@ -229,6 +229,10 @@ int main(int argc, char** argv) { histo29.process(connectionString, PI::mk_input(tag2, start, end)); edm::LogPrint("testSiPixelPayloadInspector") << histo29.data() << std::endl; + SiPixelDynamicInefficiencyPUParamComparisonTwoTags histo30; + histo30.process(connectionString, PI::mk_input(tag, start, end, tag2, start2, start2)); + edm::LogPrint("testSiPixelPayloadInspector") << histo30.data() << std::endl; + inputs.clear(); #if PY_MAJOR_VERSION >= 3 // TODO I don't know why this Py_INCREF is necessary... diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index 545686d069e15..f998451c222e0 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -96,6 +96,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(EcalSRSettings); PAYLOAD_2XML_CLASS(EcalSampleMask); PAYLOAD_2XML_CLASS(EcalSamplesCorrelation); + PAYLOAD_2XML_CLASS(EcalSimComponentShape); PAYLOAD_2XML_CLASS(EcalSimPulseShape); PAYLOAD_2XML_CLASS(EcalTBWeights); PAYLOAD_2XML_CLASS(EcalTPGFineGrainEBGroup); @@ -254,6 +255,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(RPFlatParams); PAYLOAD_2XML_CLASS(RecoIdealGeometry); PAYLOAD_2XML_CLASS(RunInfo); + PAYLOAD_2XML_CLASS(SimBeamSpotObjects); PAYLOAD_2XML_CLASS(SiPhase2OuterTrackerLorentzAngle); PAYLOAD_2XML_CLASS(SiPixel2DTemplateDBObject); PAYLOAD_2XML_CLASS(SiPixelCPEGenericErrorParm); diff --git a/CondCore/Utilities/src/CondDBFetch.cc b/CondCore/Utilities/src/CondDBFetch.cc index 10b7e3a15436c..b57943e136c5d 100644 --- a/CondCore/Utilities/src/CondDBFetch.cc +++ b/CondCore/Utilities/src/CondDBFetch.cc @@ -164,6 +164,7 @@ namespace cond { FETCH_PAYLOAD_CASE(HcalLutMetadata) FETCH_PAYLOAD_CASE(HcalMCParams) FETCH_PAYLOAD_CASE(HcalPFCorrs) + FETCH_PAYLOAD_CASE(HcalPFCuts) FETCH_PAYLOAD_CASE(HcalPedestalWidths) FETCH_PAYLOAD_CASE(HcalPedestals) FETCH_PAYLOAD_CASE(HcalQIEData) @@ -275,6 +276,7 @@ namespace cond { FETCH_PAYLOAD_CASE(RPFlatParams) FETCH_PAYLOAD_CASE(RecoIdealGeometry) FETCH_PAYLOAD_CASE(RunInfo) + FETCH_PAYLOAD_CASE(SimBeamSpotObjects) FETCH_PAYLOAD_CASE(SiPhase2OuterTrackerLorentzAngle) FETCH_PAYLOAD_CASE(SiPixelCalibConfiguration) FETCH_PAYLOAD_CASE(SiPixelCPEGenericErrorParm) diff --git a/CondCore/Utilities/src/CondDBImport.cc b/CondCore/Utilities/src/CondDBImport.cc index 94262be2d9e61..85298689b50d7 100644 --- a/CondCore/Utilities/src/CondDBImport.cc +++ b/CondCore/Utilities/src/CondDBImport.cc @@ -184,6 +184,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(HcalLutMetadata) IMPORT_PAYLOAD_CASE(HcalMCParams) IMPORT_PAYLOAD_CASE(HcalPFCorrs) + IMPORT_PAYLOAD_CASE(HcalPFCuts) IMPORT_PAYLOAD_CASE(HcalPedestalWidths) IMPORT_PAYLOAD_CASE(HcalPedestals) IMPORT_PAYLOAD_CASE(HcalQIEData) @@ -301,6 +302,7 @@ namespace cond { IMPORT_PAYLOAD_CASE(RPFlatParams) IMPORT_PAYLOAD_CASE(RecoIdealGeometry) IMPORT_PAYLOAD_CASE(RunInfo) + IMPORT_PAYLOAD_CASE(SimBeamSpotObjects) IMPORT_PAYLOAD_CASE(SiPhase2OuterTrackerLorentzAngle) IMPORT_PAYLOAD_CASE(SiPixelCalibConfiguration) IMPORT_PAYLOAD_CASE(SiPixelCPEGenericErrorParm) diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index bc70211ada4f7..9ff3f71bba310 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -8,6 +8,7 @@ #include "CondFormats/Alignment/interface/Alignments.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" #include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" +#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" #include "CondFormats/CastorObjects/interface/CastorElectronicsMap.h" #include "CondFormats/CastorObjects/interface/CastorSaturationCorrs.h" #include "CondFormats/HIObjects/interface/CentralityTable.h" @@ -206,6 +207,7 @@ #include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h" #include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h" #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" #include "CondFormats/Common/interface/FileBlob.h" //#include "CondFormats/GeometryObjects/interface/GeometryFile.h" @@ -214,6 +216,7 @@ #include "CondFormats/HcalObjects/interface/HcalFlagHFDigiTimeParams.h" #include "CondFormats/HcalObjects/interface/HcalGains.h" #include "CondFormats/HcalObjects/interface/HcalGainWidths.h" +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" #include "CondFormats/HcalObjects/interface/HcalL1TriggerObjects.h" #include "CondFormats/HcalObjects/interface/HcalLUTCorrs.h" #include "CondFormats/HcalObjects/interface/HcalLongRecoParams.h" diff --git a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h index 3a6f171a4ddc1..91765287a5377 100644 --- a/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h +++ b/CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h @@ -44,6 +44,9 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { enum TimeParamIndex { CREATE_TIME = 0, START_TIMESTAMP = 1, END_TIMESTAMP = 2, TSIZE = 3 }; /// Setters Methods + // copy all copiable members from BeamSpotObjects + void copyFromBeamSpotObject(const BeamSpotObjects& bs); + // set lastAnalyzedLumi_, last analyzed lumisection void setLastAnalyzedLumi(int val) { lastAnalyzedLumi_ = val; } @@ -164,4 +167,4 @@ class BeamSpotOnlineObjects : public BeamSpotObjects { std::ostream& operator<<(std::ostream&, BeamSpotOnlineObjects beam); -#endif \ No newline at end of file +#endif diff --git a/CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h b/CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h index 2e968a2e8602b..b4b1ce5c2f34a 100644 --- a/CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h +++ b/CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h @@ -13,17 +13,64 @@ class SimBeamSpotObjects { public: - SimBeamSpotObjects(){}; + /// default constructor + SimBeamSpotObjects() { + fX0 = 0.0; + fY0 = 0.0; + fZ0 = 0.0; + fSigmaZ = 0.0; + fbetastar = 0.0; + femittance = 0.0; + fPhi = 0.0; + fAlpha = 0.0; + fTimeOffset = 0.0; + }; + virtual ~SimBeamSpotObjects(){}; + /// set X, Y, Z positions + void setX(double val) { fX0 = val; } + void setY(double val) { fY0 = val; } + void setZ(double val) { fZ0 = val; } + /// set sigmaZ + void setSigmaZ(double val) { fSigmaZ = val; } + /// set BetaStar and Emittance + void setBetaStar(double val) { fbetastar = val; } + void setEmittance(double val) { femittance = val; } + /// set Phi, Alpha and TimeOffset + void setPhi(double val) { fPhi = val; } + void setAlpha(double val) { fAlpha = val; } + void setTimeOffset(double val) { fTimeOffset = val; } + + /// get X position + double x() const { return fX0; } + /// get Y position + double y() const { return fY0; } + /// get Z position + double z() const { return fZ0; } + /// get sigmaZ + double sigmaZ() const { return fSigmaZ; } + /// get BetaStar + double betaStar() const { return fbetastar; } + /// get Emittance + double emittance() const { return femittance; } + /// get Phi + double phi() const { return fPhi; } + /// get Alpha + double alpha() const { return fAlpha; } + /// get TimeOffset + double timeOffset() const { return fTimeOffset; } + + /// print sim beam spot parameters + void print(std::stringstream& ss) const; + +private: double fX0, fY0, fZ0; double fSigmaZ; double fbetastar, femittance; double fPhi, fAlpha; double fTimeOffset; - void print(std::stringstream& ss) const; - COND_SERIALIZABLE; }; diff --git a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc index dfee339cae9e8..9517de935d274 100644 --- a/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc +++ b/CondFormats/BeamSpotObjects/src/BeamSpotOnlineObjects.cc @@ -92,6 +92,27 @@ cond::Time_t BeamSpotOnlineObjects::endTimeStamp() const { } // setters +void BeamSpotOnlineObjects::copyFromBeamSpotObject(const BeamSpotObjects& bs) { + setType(bs.beamType()); + setPosition(bs.x(), bs.y(), bs.z()); + setSigmaZ(bs.sigmaZ()); + setdxdz(bs.dxdz()); + setdydz(bs.dydz()); + setBeamWidthX(bs.beamWidthX()); + setBeamWidthY(bs.beamWidthY()); + setBeamWidthXError(bs.beamWidthXError()); + setBeamWidthYError(bs.beamWidthYError()); + setEmittanceX(bs.emittanceX()); + setEmittanceY(bs.emittanceY()); + setBetaStar(bs.betaStar()); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 7; ++j) { + setCovariance(i, j, bs.covariance(i, j)); + } + } +} + void BeamSpotOnlineObjects::setNumTracks(int nTracks) { BeamSpotOnlineObjectsImpl::setOneParam(intParams_, NUM_TRACKS, nTracks); } @@ -173,4 +194,4 @@ std::ostream& operator<<(std::ostream& os, BeamSpotOnlineObjects beam) { beam.print(ss); os << ss.str(); return os; -} \ No newline at end of file +} diff --git a/CondFormats/BeamSpotObjects/src/SimBeamSpotObjects.cc b/CondFormats/BeamSpotObjects/src/SimBeamSpotObjects.cc index 3ed60eadb6e8c..2d1973fbcb03b 100644 --- a/CondFormats/BeamSpotObjects/src/SimBeamSpotObjects.cc +++ b/CondFormats/BeamSpotObjects/src/SimBeamSpotObjects.cc @@ -3,7 +3,18 @@ #include void SimBeamSpotObjects::print(std::stringstream& ss) const { - ss << "-----------------------------------------------------\n" << fX0 << std::endl; + ss << "-----------------------------------------------------\n" + << " Sim Beam Spot Data\n\n" + << " X0 = " << x() << " [cm]\n" + << " Y0 = " << y() << " [cm]\n" + << " Z0 = " << z() << " [cm]\n" + << " Sigma Z0 = " << sigmaZ() << " [cm]\n" + << " Beta star = " << betaStar() << " [cm]\n" + << " Emittance X = " << emittance() << " [cm]\n" + << " Phi = " << phi() << " [radians]\n" + << " Alpha = " << alpha() << " [radians]\n" + << " TimeOffset = " << timeOffset() << " [ns]\n" + << "-----------------------------------------------------\n\n"; } std::ostream& operator<<(std::ostream& os, SimBeamSpotObjects beam) { diff --git a/CondFormats/DTObjects/src/DTReadOutMapping.cc b/CondFormats/DTObjects/src/DTReadOutMapping.cc index 380a0f2bfc84a..30fa87e7a841f 100644 --- a/CondFormats/DTObjects/src/DTReadOutMapping.cc +++ b/CondFormats/DTObjects/src/DTReadOutMapping.cc @@ -202,11 +202,6 @@ int DTReadOutMapping::geometryToReadOut(int wheelId, int defaultValue; atomicCache()->mType.find(0, defaultValue); if (defaultValue) { - int loop1 = 0; - int loop2 = 0; - int loop3 = 0; - int loop0 = 0; - int searchStatus; int mapId = 0; std::vector const* robMLgr; @@ -227,7 +222,6 @@ int DTReadOutMapping::geometryToReadOut(int wheelId, std::vector::const_iterator tdc_iter = robMLgr->begin(); std::vector::const_iterator tdc_iend = robMLgr->end(); while (tdc_iter != tdc_iend) { - loop1++; const DTReadOutGeometryLink& ltdc(readOutChannelDriftTubeMap[*tdc_iter++]); channelId = ltdc.channelId; tdcId = ltdc.tdcId; @@ -244,7 +238,6 @@ int DTReadOutMapping::geometryToReadOut(int wheelId, std::vector::const_iterator ros_iter = rosMLgr->begin(); std::vector::const_iterator ros_iend = rosMLgr->end(); while (ros_iter != ros_iend) { - loop2++; const DTReadOutGeometryLink& lros(readOutChannelDriftTubeMap[*ros_iter++]); int secCk = lros.sectorId; int wheCk = lros.wheelId; @@ -268,11 +261,9 @@ int DTReadOutMapping::geometryToReadOut(int wheelId, return searchStatus; if (dduMLgr->empty()) return 1; - loop0++; std::vector::const_iterator ddu_iter = dduMLgr->begin(); std::vector::const_iterator ddu_iend = dduMLgr->end(); while (ddu_iter != ddu_iend) { - loop3++; const DTReadOutGeometryLink& lddu(readOutChannelDriftTubeMap[*ddu_iter++]); if (((sectorId == secCk) || (sectorId == lddu.sectorId)) && ((wheelId == wheCk) || (wheelId == lddu.wheelId))) { diff --git a/CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h b/CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h new file mode 100644 index 0000000000000..bba86593c334f --- /dev/null +++ b/CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h @@ -0,0 +1,6 @@ +#ifndef CondFormats_DataRecord_EcalSimComponentShapeRcd_h +#define CondFormats_DataRecord_EcalSimComponentShapeRcd_h + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +class EcalSimComponentShapeRcd : public edm::eventsetup::EventSetupRecordImplementation {}; +#endif diff --git a/CondFormats/DataRecord/interface/HcalAllRcds.h b/CondFormats/DataRecord/interface/HcalAllRcds.h index ea6bc2dcd591e..b1d1f1074589f 100644 --- a/CondFormats/DataRecord/interface/HcalAllRcds.h +++ b/CondFormats/DataRecord/interface/HcalAllRcds.h @@ -7,6 +7,7 @@ #include "CondFormats/DataRecord/interface/HcalFrontEndMapRcd.h" #include "CondFormats/DataRecord/interface/HcalGainsRcd.h" #include "CondFormats/DataRecord/interface/HcalGainWidthsRcd.h" +#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h" #include "CondFormats/DataRecord/interface/HcalL1TriggerObjectsRcd.h" #include "CondFormats/DataRecord/interface/HcalLUTCorrsRcd.h" #include "CondFormats/DataRecord/interface/HcalPFCorrsRcd.h" diff --git a/CondFormats/DataRecord/interface/HcalPFCutsRcd.h b/CondFormats/DataRecord/interface/HcalPFCutsRcd.h new file mode 100644 index 0000000000000..64024c76c9a42 --- /dev/null +++ b/CondFormats/DataRecord/interface/HcalPFCutsRcd.h @@ -0,0 +1,13 @@ +#ifndef CondFormats_DataRecord_HcalPFCutsRcd_h +#define CondFormats_DataRecord_HcalPFCutsRcd_h + +#include "FWCore/Framework/interface/DependentRecordImplementation.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" + +class HcalPFCutsRcd + : public edm::eventsetup:: + DependentRecordImplementation > { +}; + +#endif // CondFormats_DataRecord_HcalPFCutsRcd_h diff --git a/CondFormats/DataRecord/src/EcalSimComponentShapeRcd.cc b/CondFormats/DataRecord/src/EcalSimComponentShapeRcd.cc new file mode 100644 index 0000000000000..83277a3deea31 --- /dev/null +++ b/CondFormats/DataRecord/src/EcalSimComponentShapeRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(EcalSimComponentShapeRcd); diff --git a/CondFormats/DataRecord/src/HcalPFCutsRcd.cc b/CondFormats/DataRecord/src/HcalPFCutsRcd.cc new file mode 100644 index 0000000000000..67489030a0fe7 --- /dev/null +++ b/CondFormats/DataRecord/src/HcalPFCutsRcd.cc @@ -0,0 +1,4 @@ +#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(HcalPFCutsRcd); diff --git a/CondFormats/EcalObjects/interface/EcalSimComponentShape.h b/CondFormats/EcalObjects/interface/EcalSimComponentShape.h new file mode 100644 index 0000000000000..c83826fac6706 --- /dev/null +++ b/CondFormats/EcalObjects/interface/EcalSimComponentShape.h @@ -0,0 +1,18 @@ +#ifndef CondFormats_EcalObjects_EcalSimComponentShape_hh +#define CondFormats_EcalObjects_EcalSimComponentShape_hh + +#include "CondFormats/Serialization/interface/Serializable.h" +#include + +class EcalSimComponentShape { +public: + EcalSimComponentShape() = default; + + std::vector > barrel_shapes; // there is no need to getters/setters, just access data directly + + double barrel_thresh; + float time_interval; // time interval of the shape + + COND_SERIALIZABLE; +}; +#endif diff --git a/CondFormats/EcalObjects/src/EcalSimComponentShape.cc b/CondFormats/EcalObjects/src/EcalSimComponentShape.cc new file mode 100644 index 0000000000000..d2e135d5b6c93 --- /dev/null +++ b/CondFormats/EcalObjects/src/EcalSimComponentShape.cc @@ -0,0 +1 @@ +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" diff --git a/CondFormats/EcalObjects/src/T_EventSetup_EcalSimComponentShape.cc b/CondFormats/EcalObjects/src/T_EventSetup_EcalSimComponentShape.cc new file mode 100644 index 0000000000000..45311ac73475c --- /dev/null +++ b/CondFormats/EcalObjects/src/T_EventSetup_EcalSimComponentShape.cc @@ -0,0 +1,3 @@ +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" +#include "FWCore/Utilities/interface/typelookup.h" +TYPELOOKUP_DATA_REG(EcalSimComponentShape); diff --git a/CondFormats/EcalObjects/src/classes.h b/CondFormats/EcalObjects/src/classes.h index f35fcf033ea60..cf9e4896a0f2b 100644 --- a/CondFormats/EcalObjects/src/classes.h +++ b/CondFormats/EcalObjects/src/classes.h @@ -67,6 +67,7 @@ #include "CondFormats/EcalObjects/interface/EcalTPGSpike.h" #include "CondFormats/EcalObjects/interface/EcalSRSettings.h" #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" #include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h" #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h" //ECAL PH2: diff --git a/CondFormats/EcalObjects/src/classes_def.xml b/CondFormats/EcalObjects/src/classes_def.xml index ea50b1da79b67..a6895cbdf9f58 100644 --- a/CondFormats/EcalObjects/src/classes_def.xml +++ b/CondFormats/EcalObjects/src/classes_def.xml @@ -296,6 +296,12 @@ + + + + + + diff --git a/CondFormats/EcalObjects/src/headers.h b/CondFormats/EcalObjects/src/headers.h index 11b173bbaec83..380d009737fc6 100644 --- a/CondFormats/EcalObjects/src/headers.h +++ b/CondFormats/EcalObjects/src/headers.h @@ -6,6 +6,7 @@ #include "CondFormats/EcalObjects/interface/EcalPulseSymmCovariances.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" #include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h" #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h" #include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h" diff --git a/CondFormats/EcalObjects/test/testSerializationEcalObjects.cpp b/CondFormats/EcalObjects/test/testSerializationEcalObjects.cpp index 014d131cc0878..37ea922a0ebca 100644 --- a/CondFormats/EcalObjects/test/testSerializationEcalObjects.cpp +++ b/CondFormats/EcalObjects/test/testSerializationEcalObjects.cpp @@ -86,6 +86,7 @@ int main() { testSerialization(); testSerialization(); testSerialization(); + testSerialization(); testSerialization(); testSerialization(); testSerialization(); diff --git a/CondFormats/HcalObjects/interface/AllObjects.h b/CondFormats/HcalObjects/interface/AllObjects.h index 09551dd46fe0d..acd139ece5d35 100644 --- a/CondFormats/HcalObjects/interface/AllObjects.h +++ b/CondFormats/HcalObjects/interface/AllObjects.h @@ -18,6 +18,7 @@ #include "CondFormats/HcalObjects/interface/HcalTimeCorrs.h" #include "CondFormats/HcalObjects/interface/HcalLUTCorrs.h" #include "CondFormats/HcalObjects/interface/HcalPFCorrs.h" +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" #include "CondFormats/HcalObjects/interface/HcalValidationCorrs.h" #include "CondFormats/HcalObjects/interface/HcalLutMetadata.h" #include "CondFormats/HcalObjects/interface/HcalDcsValues.h" @@ -37,4 +38,5 @@ #include "CondFormats/HcalObjects/interface/HcalSiPMCharacteristics.h" #include "CondFormats/HcalObjects/interface/HcalTPParameters.h" #include "CondFormats/HcalObjects/interface/HcalTPChannelParameters.h" +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" #endif diff --git a/CondFormats/HcalObjects/interface/HcalPFCut.h b/CondFormats/HcalObjects/interface/HcalPFCut.h new file mode 100644 index 0000000000000..5c9d45d7bbeaf --- /dev/null +++ b/CondFormats/HcalObjects/interface/HcalPFCut.h @@ -0,0 +1,31 @@ +#ifndef CondFormats_HcalObjects_HcalPFCut_h +#define CondFormats_HcalObjects_HcalPFCut_h + +#include + +#include "CondFormats/Serialization/interface/Serializable.h" + +class HcalPFCut { +public: + inline HcalPFCut() : mId_(0), noiseThresh_(0.f), seedThresh_(0.f) {} + + inline HcalPFCut(unsigned long fId, float noiseThresh, float seedThresh) + : mId_(fId), noiseThresh_(noiseThresh), seedThresh_(seedThresh) {} + + inline uint32_t rawId() const { return mId_; } + inline float noiseThreshold() const { return noiseThresh_; } + inline float seedThreshold() const { return seedThresh_; } + + // Methods for HcalDbASCIIIO + inline float getValue0() const { return noiseThresh_; } + inline float getValue1() const { return seedThresh_; } + +private: + uint32_t mId_; + float noiseThresh_; + float seedThresh_; + + COND_SERIALIZABLE; +}; + +#endif // CondFormats_HcalObjects_HcalPFCut_h diff --git a/CondFormats/HcalObjects/interface/HcalPFCuts.h b/CondFormats/HcalObjects/interface/HcalPFCuts.h new file mode 100644 index 0000000000000..26b7102ff3b2e --- /dev/null +++ b/CondFormats/HcalObjects/interface/HcalPFCuts.h @@ -0,0 +1,20 @@ +#ifndef CondFormats_HcalObjects_HcalPFCuts_h +#define CondFormats_HcalObjects_HcalPFCuts_h + +#include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h" +#include "CondFormats/HcalObjects/interface/HcalPFCut.h" + +class HcalPFCuts : public HcalCondObjectContainer { +public: +#ifndef HCAL_COND_SUPPRESS_DEFAULT + HcalPFCuts() : HcalCondObjectContainer(nullptr) {} +#endif + HcalPFCuts(const HcalTopology* topo) : HcalCondObjectContainer(topo) {} + + inline std::string myname() const override { return "HcalPFCuts"; } + +private: + COND_SERIALIZABLE; +}; + +#endif // CondFormats_HcalObjects_HcalPFCuts_h diff --git a/CondFormats/HcalObjects/src/HcalPFCuts.cc b/CondFormats/HcalObjects/src/HcalPFCuts.cc new file mode 100644 index 0000000000000..6d2cee342c85f --- /dev/null +++ b/CondFormats/HcalObjects/src/HcalPFCuts.cc @@ -0,0 +1,3 @@ +// to see it compile + +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" diff --git a/CondFormats/HcalObjects/src/T_EventSetup_HcalPFCuts.cc b/CondFormats/HcalObjects/src/T_EventSetup_HcalPFCuts.cc new file mode 100644 index 0000000000000..6aeade845975e --- /dev/null +++ b/CondFormats/HcalObjects/src/T_EventSetup_HcalPFCuts.cc @@ -0,0 +1,4 @@ +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(HcalPFCuts); diff --git a/CondFormats/HcalObjects/src/classes.h b/CondFormats/HcalObjects/src/classes.h index c4604a1b82a6c..43fa0f97bad63 100644 --- a/CondFormats/HcalObjects/src/classes.h +++ b/CondFormats/HcalObjects/src/classes.h @@ -17,6 +17,9 @@ namespace CondFormats_HcalObjects { HcalGainWidths mygwidths(); std::vector mygwidthsVec; + HcalPFCuts mypfcuts(); + std::vector mypfcutVec; + HcalQIEData myqie(); std::vector myqievec; diff --git a/CondFormats/HcalObjects/src/classes_def.xml b/CondFormats/HcalObjects/src/classes_def.xml index 9a1a069404d7d..5b914714e2f56 100644 --- a/CondFormats/HcalObjects/src/classes_def.xml +++ b/CondFormats/HcalObjects/src/classes_def.xml @@ -69,6 +69,22 @@ + + + + + + + + + + + + + + + + diff --git a/CondFormats/HcalObjects/test/testSerializationHcalObjects.cpp b/CondFormats/HcalObjects/test/testSerializationHcalObjects.cpp index d7f872c10e34d..1db43c6f3c952 100644 --- a/CondFormats/HcalObjects/test/testSerializationHcalObjects.cpp +++ b/CondFormats/HcalObjects/test/testSerializationHcalObjects.cpp @@ -13,6 +13,7 @@ int main() { testSerialization>(); testSerialization>(); testSerialization>(); + testSerialization>(); testSerialization>(); testSerialization>(); testSerialization>(); @@ -44,6 +45,8 @@ int main() { testSerialization(); testSerialization(); testSerialization(); + testSerialization(); + testSerialization(); testSerialization(); testSerialization(); testSerialization(); @@ -84,6 +87,7 @@ int main() { testSerialization>>(); testSerialization>>(); testSerialization>>(); + testSerialization>>(); testSerialization>>(); testSerialization>>(); testSerialization>>(); @@ -109,6 +113,7 @@ int main() { testSerialization>(); testSerialization>(); testSerialization>(); + testSerialization>(); testSerialization>(); testSerialization>(); testSerialization>(); @@ -131,6 +136,7 @@ int main() { testSerialization>>>(); testSerialization>>>(); testSerialization>>>(); + testSerialization>>>(); testSerialization>>>(); testSerialization>>>(); testSerialization>>>(); diff --git a/CondFormats/L1TObjects/BuildFile.xml b/CondFormats/L1TObjects/BuildFile.xml index d23031ae29d16..c6b0e69154952 100644 --- a/CondFormats/L1TObjects/BuildFile.xml +++ b/CondFormats/L1TObjects/BuildFile.xml @@ -7,6 +7,8 @@ + + diff --git a/CondFormats/L1TObjects/interface/L1GtDefinitions.h b/CondFormats/L1TObjects/interface/L1GtDefinitions.h index eace4d495502d..7c0499b10ca9d 100644 --- a/CondFormats/L1TObjects/interface/L1GtDefinitions.h +++ b/CondFormats/L1TObjects/interface/L1GtDefinitions.h @@ -25,7 +25,7 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h" /// board types in GT -enum L1GtBoardType { GTFE, FDL, PSB, GMT, TCS, TIM, BoardNull }; +enum L1GtBoardType { GTFE, FDL, PSB, GMT, TCS, TIM, BoardNull, L1GtBoardTypeInvalid = -1 }; struct L1GtBoardTypeStringToEnum { const char* label; @@ -62,7 +62,8 @@ enum L1GtPsbQuad { HfQ, BptxQ, GtExternalQ, - PsbQuadNull + PsbQuadNull, + L1GtPsbQuadInvalid = -1 }; struct L1GtPsbQuadStringToEnum { diff --git a/CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h b/CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h index 95008abc8c18c..ecaa21a57b3b3 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h +++ b/CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h @@ -14,6 +14,7 @@ #include #include #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esAlgorithm.hh" /** * This class implements data structure for Algorithm @@ -29,6 +30,33 @@ class L1TUtmAlgorithm { module_id_(), module_index_(), version(0){}; + L1TUtmAlgorithm(std::string name, + std::string expression, + std::string expression_in_condition, + std::vector rpn_vector, + unsigned int index, + unsigned int module_id, + unsigned int module_index, + unsigned int ver) + : name_(name), + expression_(expression), + expression_in_condition_(expression_in_condition), + rpn_vector_(rpn_vector), + index_(index), + module_id_(module_id), + module_index_(module_index), + version(ver){}; + + L1TUtmAlgorithm(const tmeventsetup::esAlgorithm& esAlg) + : L1TUtmAlgorithm(esAlg.getName(), + esAlg.getExpression(), + esAlg.getExpressionInCondition(), + esAlg.getRpnVector(), + esAlg.getIndex(), + esAlg.getModuleId(), + esAlg.getModuleIndex(), + 0 //There is no version retrieval in esAlgorithm. However, it seems pretty hard coded to 0 + ){}; virtual ~L1TUtmAlgorithm() = default; diff --git a/CondFormats/L1TObjects/interface/L1TUtmBin.h b/CondFormats/L1TObjects/interface/L1TUtmBin.h index d9d0f66dcb37f..e2240fba7bee7 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmBin.h +++ b/CondFormats/L1TObjects/interface/L1TUtmBin.h @@ -12,6 +12,7 @@ #include #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esBin.hh" /** * This class implements data structure for Bin @@ -27,6 +28,10 @@ class L1TUtmBin { L1TUtmBin(const unsigned int id, const double min, const double max) : hw_index(id), minimum(min), maximum(max), version(0){}; + L1TUtmBin(const tmeventsetup::esBin& bin) : L1TUtmBin(bin.hw_index, bin.minimum, bin.maximum){}; + + operator tmeventsetup::esBin() const { return tmeventsetup::esBin(hw_index, minimum, maximum); } + virtual ~L1TUtmBin() = default; unsigned int hw_index; /**< HW index of bin */ diff --git a/CondFormats/L1TObjects/interface/L1TUtmCondition.h b/CondFormats/L1TObjects/interface/L1TUtmCondition.h index a1e7b4a905b38..52db58e31363a 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmCondition.h +++ b/CondFormats/L1TObjects/interface/L1TUtmCondition.h @@ -14,6 +14,8 @@ #include "CondFormats/L1TObjects/interface/L1TUtmObject.h" #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esCondition.hh" + #include #include @@ -23,6 +25,19 @@ class L1TUtmCondition { public: L1TUtmCondition() : name_(), type_(-9999), objects_(), cuts_(), version(0){}; + L1TUtmCondition( + std::string name, int type, std::vector objects, std::vector cuts, unsigned int vers) + : name_(name), type_(type), objects_(objects), cuts_(cuts), version(vers){}; + + L1TUtmCondition(const tmeventsetup::esCondition& esCond) + : name_(esCond.getName()), type_(esCond.getType()), version(0) { + objects_.reserve(esCond.getObjects().size()); + for (auto it = esCond.getObjects().begin(); it != esCond.getObjects().end(); ++it) + objects_.emplace_back(L1TUtmObject(*it)); + cuts_.reserve(esCond.getCuts().size()); + for (auto it = esCond.getCuts().begin(); it != esCond.getCuts().end(); ++it) + cuts_.emplace_back(L1TUtmCut(*it)); + }; virtual ~L1TUtmCondition() = default; diff --git a/CondFormats/L1TObjects/interface/L1TUtmCut.h b/CondFormats/L1TObjects/interface/L1TUtmCut.h index 98bb45f158cd5..1f6b1aa70eee2 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmCut.h +++ b/CondFormats/L1TObjects/interface/L1TUtmCut.h @@ -13,6 +13,8 @@ #include "CondFormats/L1TObjects/interface/L1TUtmCutValue.h" #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esCut.hh" + #include /** @@ -21,6 +23,32 @@ class L1TUtmCut { public: L1TUtmCut() : name_(), object_type_(), cut_type_(), minimum_(), maximum_(), data_(), key_(), version(0){}; + L1TUtmCut(std::string name, + int object_type, + int cut_type, + L1TUtmCutValue minimum, + L1TUtmCutValue maximum, + std::string data, + std::string key, + unsigned int vers) + : name_(name), + object_type_(object_type), + cut_type_(cut_type), + minimum_(minimum), + maximum_(maximum), + data_(data), + key_(key), + version(vers){}; + + L1TUtmCut(const tmeventsetup::esCut& esC) + : L1TUtmCut(esC.getName(), + esC.getObjectType(), + esC.getCutType(), + L1TUtmCutValue(esC.getMinimum()), + L1TUtmCutValue(esC.getMaximum()), + esC.getData(), + esC.getKey(), + 0){}; virtual ~L1TUtmCut() = default; diff --git a/CondFormats/L1TObjects/interface/L1TUtmCutValue.h b/CondFormats/L1TObjects/interface/L1TUtmCutValue.h index 8ae7442d9c4d1..3df9e365628d4 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmCutValue.h +++ b/CondFormats/L1TObjects/interface/L1TUtmCutValue.h @@ -12,6 +12,7 @@ #include #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esCutValue.hh" /** * This class implements data structure for CutValue @@ -19,6 +20,7 @@ struct L1TUtmCutValue { L1TUtmCutValue() : value(std::numeric_limits::max()), index(std::numeric_limits::max()), version(0){}; + L1TUtmCutValue(const tmeventsetup::esCutValue& esCV) : value(esCV.value), index(esCV.index), version(esCV.version){}; virtual ~L1TUtmCutValue() = default; diff --git a/CondFormats/L1TObjects/interface/L1TUtmObject.h b/CondFormats/L1TObjects/interface/L1TUtmObject.h index 0892ccec5f77a..b53d00baaab8b 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmObject.h +++ b/CondFormats/L1TObjects/interface/L1TUtmObject.h @@ -13,6 +13,8 @@ #include "CondFormats/L1TObjects/interface/L1TUtmCut.h" #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esObject.hh" + #include #include #include @@ -32,6 +34,38 @@ class L1TUtmObject { ext_channel_id_(std::numeric_limits::max()), cuts_(), version(0){}; + L1TUtmObject(std::string name, + int type, + int comparison_operator, + int bx_offset, + double threshold, + std::string ext_signal_name, + unsigned int ext_channel_id, + std::vector cuts, + unsigned int vers) + : name_(name), + type_(type), + comparison_operator_(comparison_operator), + bx_offset_(bx_offset), + threshold_(threshold), + ext_signal_name_(ext_signal_name), + ext_channel_id_(ext_channel_id), + cuts_(cuts), + version(vers){}; + + L1TUtmObject(const tmeventsetup::esObject& esObj) + : name_(esObj.getName()), + type_(esObj.getType()), + comparison_operator_(esObj.getComparisonOperator()), + bx_offset_(esObj.getBxOffset()), + threshold_(esObj.getThreshold()), + ext_signal_name_(esObj.getExternalSignalName()), + ext_channel_id_(esObj.getExternalChannelId()), + version(0) { + cuts_.reserve(esObj.getCuts().size()); + for (auto it = esObj.getCuts().begin(); it != esObj.getCuts().end(); ++it) + cuts_.emplace_back(L1TUtmCut(*it)); + }; virtual ~L1TUtmObject() = default; diff --git a/CondFormats/L1TObjects/interface/L1TUtmScale.h b/CondFormats/L1TObjects/interface/L1TUtmScale.h index 8e9a3978c6111..d143664a2029a 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmScale.h +++ b/CondFormats/L1TObjects/interface/L1TUtmScale.h @@ -13,6 +13,8 @@ #include "CondFormats/L1TObjects/interface/L1TUtmBin.h" #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esScale.hh" + #include #include #include @@ -24,8 +26,50 @@ class L1TUtmScale { public: L1TUtmScale() : name_(), object_(), type_(), minimum_(), maximum_(), step_(), n_bits_(), bins_(), version(0){}; + L1TUtmScale(std::string name, + int object, + int type, + double minimum, + double maximum, + double step, + unsigned int n_bits, + std::vector bins, + unsigned int vers) + : name_(name), + object_(object), + type_(type), + minimum_(minimum), + maximum_(maximum), + step_(step), + n_bits_(n_bits), + bins_(bins), + version(vers){}; + + L1TUtmScale(const tmeventsetup::esScale& esSc) + : name_(esSc.getName()), + object_(esSc.getObjectType()), + type_(esSc.getScaleType()), + minimum_(esSc.getMinimum()), + maximum_(esSc.getMaximum()), + step_(esSc.getStep()), + n_bits_(esSc.getNbits()), + version(0) { + bins_.reserve(esSc.getBins().size()); + for (auto it = esSc.getBins().begin(); it != esSc.getBins().end(); ++it) + bins_.emplace_back(L1TUtmBin(*it)); + }; + virtual ~L1TUtmScale() = default; + operator tmeventsetup::esScale() const { + std::vector bins; + bins.reserve(getBins().size()); + for (const auto& it : getBins()) + bins.emplace_back(tmeventsetup::esBin(it.hw_index, it.minimum, it.maximum)); + return tmeventsetup::esScale( + getName(), getObjectType(), getScaleType(), getMinimum(), getMaximum(), getStep(), getNbits(), bins); + } + /** get scale name */ const std::string& getName() const { return name_; }; diff --git a/CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h b/CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h index a2a91830396df..90a73dac8fe94 100644 --- a/CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h +++ b/CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h @@ -16,6 +16,8 @@ #include "CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h" #include "CondFormats/Serialization/interface/Serializable.h" +#include "tmEventSetup/esTriggerMenu.hh" + #include #include @@ -38,6 +40,49 @@ class L1TUtmTriggerMenu { scale_set_name_(), n_modules_(), version(0){}; + L1TUtmTriggerMenu(std::map algorithm_map, + std::map condition_map, + std::map scale_map, + std::string name, + std::string ver_s, + std::string comment, + std::string datetime, + std::string uuid_firmware, + std::string scale_set_name, + unsigned int n_modules, + unsigned int ver_i) + : algorithm_map_(algorithm_map), + condition_map_(condition_map), + scale_map_(scale_map), + external_map_(), + token_to_condition_(), + name_(name), + version_(ver_s), + comment_(comment), + datetime_(datetime), + uuid_firmware_(uuid_firmware), + scale_set_name_(scale_set_name), + n_modules_(n_modules), + version(ver_i){}; + + L1TUtmTriggerMenu(const tmeventsetup::esTriggerMenu& esMenu) + : external_map_(), //These are null to my best knowledge + token_to_condition_(), //These are null to my best knowledge + name_(esMenu.getName()), + version_(esMenu.getVersion()), + comment_(esMenu.getComment()), + datetime_(esMenu.getDatetime()), + uuid_firmware_(esMenu.getFirmwareUuid()), + scale_set_name_(esMenu.getScaleSetName()), + n_modules_(esMenu.getNmodules()), + version(0) { + for (const auto& it : esMenu.getAlgorithmMap()) + algorithm_map_.emplace(std::make_pair(it.first, L1TUtmAlgorithm(it.second))); + for (const auto& it : esMenu.getConditionMap()) + condition_map_.emplace(std::make_pair(it.first, L1TUtmCondition(it.second))); + for (const auto& it : esMenu.getScaleMap()) + scale_map_.emplace(std::make_pair(it.first, L1TUtmScale(it.second))); + }; virtual ~L1TUtmTriggerMenu() = default; diff --git a/CondFormats/PCLConfig/test/BuildFile.xml b/CondFormats/PCLConfig/test/BuildFile.xml index 6d1b0ff213cbf..0f36f3aff5d91 100644 --- a/CondFormats/PCLConfig/test/BuildFile.xml +++ b/CondFormats/PCLConfig/test/BuildFile.xml @@ -2,7 +2,4 @@ - - - - + diff --git a/CondFormats/PCLConfig/test/testDriver.cpp b/CondFormats/PCLConfig/test/testDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondFormats/PCLConfig/test/testDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh b/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh index 13596d09aaa1a..b7778706861c1 100755 --- a/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh +++ b/CondFormats/PCLConfig/test/testReadWriteAlignPCLThresholds.sh @@ -1,9 +1,9 @@ #!/bin/bash function die { echo $1: status $2; exit $2; } # test High Granularity -cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsWriter_cfg.py || die 'failed running AlignPCLThresholdsWriter_cfg.py' $? -cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsReader_cfg.py || die 'failed running AlignPCLThresholdsReader_cfg.py' $? +cmsRun ${SCRAM_TEST_PATH}/AlignPCLThresholdsWriter_cfg.py || die 'failed running AlignPCLThresholdsWriter_cfg.py' $? +cmsRun ${SCRAM_TEST_PATH}/AlignPCLThresholdsReader_cfg.py || die 'failed running AlignPCLThresholdsReader_cfg.py' $? # test Low Granularity -(cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsWriter_cfg.py writeLGpayload=True) || die 'failed running AlignPCLThresholdsWriter_cfg.py writeLGpayload=True' $? -(cmsRun ${LOCAL_TEST_DIR}/AlignPCLThresholdsReader_cfg.py readLGpayload=True) || die 'failed running AlignPCLThresholdsReader_cfg.py readLGpayload=True' $? +(cmsRun ${SCRAM_TEST_PATH}/AlignPCLThresholdsWriter_cfg.py writeLGpayload=True) || die 'failed running AlignPCLThresholdsWriter_cfg.py writeLGpayload=True' $? +(cmsRun ${SCRAM_TEST_PATH}/AlignPCLThresholdsReader_cfg.py readLGpayload=True) || die 'failed running AlignPCLThresholdsReader_cfg.py readLGpayload=True' $? diff --git a/CondFormats/PPSObjects/xml/mapping_timing_diamond_2023.xml b/CondFormats/PPSObjects/xml/mapping_timing_diamond_2023.xml index 0bc04fd4bfd8a..d134c57d9c9fd 100644 --- a/CondFormats/PPSObjects/xml/mapping_timing_diamond_2023.xml +++ b/CondFormats/PPSObjects/xml/mapping_timing_diamond_2023.xml @@ -45,18 +45,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/CondFormats/RPCObjects/src/RPCReadOutMapping.cc b/CondFormats/RPCObjects/src/RPCReadOutMapping.cc index a34a9297903b4..5c2f70ab57f6d 100644 --- a/CondFormats/RPCObjects/src/RPCReadOutMapping.cc +++ b/CondFormats/RPCObjects/src/RPCReadOutMapping.cc @@ -70,16 +70,11 @@ std::vector > RPCReadO eleIndex.lbNumInLink = board.linkBoardNumInLink(); const std::vector &febs = board.febs(); - int febCheck = 0; for (std::vector::const_iterator ifc = febs.begin(); ifc != febs.end(); ifc++) { const FebConnectorSpec &febConnector = (*ifc); - febCheck++; if (febConnector.rawId() != rawDetId) continue; int febInLB = febConnector.linkBoardInputNum(); - /* if (febInLB != febCheck) { - edm::LogError("rawDataFrame") << " problem with febInLB: " < detid_la = getBackPlaneCorrections(); std::map::const_iterator it; - size_t count = 0; ss << "SiStripBackPlaneCorrectionReader:" << std::endl; ss << "detid \t Geometry \t Back Plane Corrections" << std::endl; for (it = detid_la.begin(); it != detid_la.end(); ++it) { ss << it->first << "\t" << static_cast(trackerTopo->moduleGeometry(it->first)) << "\t" << it->second << std::endl; - ++count; } } diff --git a/CondFormats/SiStripObjects/src/SiStripLorentzAngle.cc b/CondFormats/SiStripObjects/src/SiStripLorentzAngle.cc index e866ee451f953..3a31b76e871d0 100644 --- a/CondFormats/SiStripObjects/src/SiStripLorentzAngle.cc +++ b/CondFormats/SiStripObjects/src/SiStripLorentzAngle.cc @@ -25,12 +25,10 @@ float SiStripLorentzAngle::getLorentzAngle(const uint32_t& detid) const { void SiStripLorentzAngle::printDebug(std::stringstream& ss, const TrackerTopology* /*trackerTopo*/) const { std::map detid_la = getLorentzAngles(); std::map::const_iterator it; - size_t count = 0; ss << "SiStripLorentzAngleReader:" << std::endl; ss << "detid \t Lorentz angle" << std::endl; for (it = detid_la.begin(); it != detid_la.end(); ++it) { ss << it->first << "\t" << it->second << std::endl; - ++count; } } diff --git a/CondTools/BeamSpot/BuildFile.xml b/CondTools/BeamSpot/BuildFile.xml index c29c5e0b51236..7ea3d0c066574 100644 --- a/CondTools/BeamSpot/BuildFile.xml +++ b/CondTools/BeamSpot/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/CondTools/BeamSpot/plugins/BeamProfile2DBReader.cc b/CondTools/BeamSpot/plugins/BeamProfile2DBReader.cc new file mode 100644 index 0000000000000..3e84c66806489 --- /dev/null +++ b/CondTools/BeamSpot/plugins/BeamProfile2DBReader.cc @@ -0,0 +1,180 @@ +// -*- C++ -*- +// +// Package: CondTools/BeamProfile2DBReader +// Class: BeamProfile2DBReader +// +/**\class BeamProfile2DBReader BeamProfile2DBReader.cc CondTools/BeamSpot/plugins/BeamProfile2DBReader.cc + + Description: simple emd::one::EDAnalyzer to retrieve and ntuplize SimBeamSpot data from the conditions database + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Francesco Brivio +// Created: 11 June 2023 +// + +// system include files +#include +#include +#include + +// user include files +#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" +#include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// For ROOT +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include + +// +// class declaration +// + +class BeamProfile2DBReader : public edm::one::EDAnalyzer { +public: + explicit BeamProfile2DBReader(const edm::ParameterSet&); + ~BeamProfile2DBReader() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + + struct TheBSfromDB { + int run; + int ls; + double fX0, fY0, fZ0; + double fSigmaZ; + double fbetastar, femittance; + double fPhi, fAlpha; + double fTimeOffset; + void init(); + } theBSfromDB_; + + const edm::ESGetToken beamSpotToken_; + edm::Service tFileService; + TTree* bstree_; + + // ----------member data --------------------------- + edm::ESWatcher watcher_; + std::unique_ptr output_; +}; + +// +// constructors and destructor +// +BeamProfile2DBReader::BeamProfile2DBReader(const edm::ParameterSet& iConfig) + : beamSpotToken_(esConsumes()), bstree_(nullptr) { + //now do what ever initialization is needed + usesResource("TFileService"); + std::string fileName(iConfig.getUntrackedParameter("rawFileName")); + if (!fileName.empty()) { + output_ = std::make_unique(fileName.c_str()); + if (!output_->good()) { + edm::LogError("IOproblem") << "Could not open output file " << fileName << "."; + output_.reset(); + } + } +} + +BeamProfile2DBReader::~BeamProfile2DBReader() = default; + +// +// member functions +// + +void BeamProfile2DBReader::TheBSfromDB::init() { + float dummy_double = 0.0; + int dummy_int = 0; + + run = dummy_int; + ls = dummy_int; + fX0 = dummy_double; + fY0 = dummy_double; + fZ0 = dummy_double; + fSigmaZ = dummy_double; + fbetastar = dummy_double; + femittance = dummy_double; + fPhi = dummy_double; + fAlpha = dummy_double; + fTimeOffset = dummy_double; +} + +// ------------ method called for each event ------------ +void BeamProfile2DBReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + std::ostringstream output; + + // initialize the ntuple + theBSfromDB_.init(); + + if (watcher_.check(iSetup)) { // check for new IOV for this run / LS + + output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl; + + // Get SimBeamSpot from EventSetup: + const SimBeamSpotObjects* mybeamspot = &iSetup.getData(beamSpotToken_); + + theBSfromDB_.run = iEvent.id().run(); + theBSfromDB_.ls = iEvent.id().luminosityBlock(); + theBSfromDB_.fX0 = mybeamspot->x(); + theBSfromDB_.fY0 = mybeamspot->y(); + theBSfromDB_.fZ0 = mybeamspot->z(); + theBSfromDB_.fSigmaZ = mybeamspot->sigmaZ(); + theBSfromDB_.fbetastar = mybeamspot->betaStar(); + theBSfromDB_.femittance = mybeamspot->emittance(); + theBSfromDB_.fPhi = mybeamspot->phi(); + theBSfromDB_.fAlpha = mybeamspot->alpha(); + theBSfromDB_.fTimeOffset = mybeamspot->timeOffset(); + bstree_->Fill(); + output << *mybeamspot << std::endl; + } + + // Final output - either message logger or output file: + if (output_.get()) + *output_ << output.str(); + else + edm::LogInfo("") << output.str(); +} + +// ------------ method called once each job just before starting event loop ------------ +void BeamProfile2DBReader::beginJob() { + bstree_ = tFileService->make("BSNtuple", "SimBeamSpot analyzer ntuple"); + + //Tree Branches + bstree_->Branch("run", &theBSfromDB_.run, "run/I"); + bstree_->Branch("ls", &theBSfromDB_.ls, "ls/I"); + bstree_->Branch("BSx0", &theBSfromDB_.fX0, "BSx0/F"); + bstree_->Branch("BSy0", &theBSfromDB_.fY0, "BSy0/F"); + bstree_->Branch("BSz0", &theBSfromDB_.fZ0, "BSz0/F"); + bstree_->Branch("Beamsigmaz", &theBSfromDB_.fSigmaZ, "Beamsigmaz/F"); + bstree_->Branch("BetaStar", &theBSfromDB_.fbetastar, "BetaStar/F"); + bstree_->Branch("Emittance", &theBSfromDB_.femittance, "Emittance/F"); + bstree_->Branch("Phi", &theBSfromDB_.fPhi, "Phi/F"); + bstree_->Branch("Alpha", &theBSfromDB_.fAlpha, "Alpha/F"); + bstree_->Branch("TimeOffset", &theBSfromDB_.fTimeOffset, "TimeOffset/F"); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void BeamProfile2DBReader::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(BeamProfile2DBReader); diff --git a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc b/CondTools/BeamSpot/plugins/BeamProfile2DBWriter.cc similarity index 52% rename from IOMC/EventVertexGenerators/src/BeamProfile2DB.cc rename to CondTools/BeamSpot/plugins/BeamProfile2DBWriter.cc index 6a922283d057a..2cac046919463 100644 --- a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc +++ b/CondTools/BeamSpot/plugins/BeamProfile2DBWriter.cc @@ -1,9 +1,9 @@ // -*- C++ -*- // -// Package: BeamProfile2DB -// Class: BeamProfile2DB +// Package: BeamProfile2DBWriter +// Class: BeamProfile2DBWriter // -/**\class BeamProfile2DB BeamProfile2DB.cc IOMC/BeamProfile2DB/src/BeamProfile2DB.cc +/**\class BeamProfile2DBWriter BeamProfile2DBWriter.cc CondTools/BeamSpot/plugins/BeamProfile2DBWriter.cc Description: [one line class summary] @@ -14,24 +14,21 @@ // Original Author: Jean-Roch Vlimant,40 3-A28,+41227671209, // Created: Fri Jan 6 14:49:42 CET 2012 // +// Updated; Francesco Brivio, June 11, 2023 // // system include files #include // user include files +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDAnalyzer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" @@ -39,16 +36,14 @@ // // class declaration // - -class BeamProfile2DB : public edm::global::EDAnalyzer<> { +class BeamProfile2DBWriter : public edm::global::EDAnalyzer<> { public: - explicit BeamProfile2DB(const edm::ParameterSet&); - ~BeamProfile2DB() override; + explicit BeamProfile2DBWriter(const edm::ParameterSet&); + ~BeamProfile2DBWriter() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginJob() override; void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override; void endJob() override; @@ -56,58 +51,38 @@ class BeamProfile2DB : public edm::global::EDAnalyzer<> { SimBeamSpotObjects beamSpot_; }; -namespace { - SimBeamSpotObjects read(const edm::ParameterSet& p) { - SimBeamSpotObjects ret; - ret.fX0 = p.getParameter("X0") * cm; - ret.fY0 = p.getParameter("Y0") * cm; - ret.fZ0 = p.getParameter("Z0") * cm; - ret.fSigmaZ = p.getParameter("SigmaZ") * cm; - ret.fAlpha = p.getParameter("Alpha") * radian; - ret.fPhi = p.getParameter("Phi") * radian; - ret.fbetastar = p.getParameter("BetaStar") * cm; - ret.femittance = p.getParameter("Emittance") * cm; // this is not the normalized emittance - ret.fTimeOffset = p.getParameter("TimeOffset") * ns * c_light; // HepMC time units are mm - return ret; - } - -} // namespace -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - // // constructors and destructor // -BeamProfile2DB::BeamProfile2DB(const edm::ParameterSet& iConfig) : beamSpot_(read(iConfig)) {} - -BeamProfile2DB::~BeamProfile2DB() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) +BeamProfile2DBWriter::BeamProfile2DBWriter(const edm::ParameterSet& iConfig) { + beamSpot_.setX(iConfig.getParameter("X0")); + beamSpot_.setY(iConfig.getParameter("Y0")); + beamSpot_.setZ(iConfig.getParameter("Z0")); + beamSpot_.setSigmaZ(iConfig.getParameter("SigmaZ")); + beamSpot_.setAlpha(iConfig.getParameter("Alpha")); + beamSpot_.setPhi(iConfig.getParameter("Phi")); + beamSpot_.setBetaStar(iConfig.getParameter("BetaStar")); + beamSpot_.setEmittance(iConfig.getParameter("Emittance")); + beamSpot_.setTimeOffset(iConfig.getParameter("TimeOffset")); } +BeamProfile2DBWriter::~BeamProfile2DBWriter() = default; + // // member functions // // ------------ method called for each event ------------ -void BeamProfile2DB::analyze(edm::StreamID, const edm::Event& iEvent, const edm::EventSetup& iSetup) const {} - -// ------------ method called once each job just before starting event loop ------------ -void BeamProfile2DB::beginJob() {} +void BeamProfile2DBWriter::analyze(edm::StreamID, const edm::Event& iEvent, const edm::EventSetup& iSetup) const {} // ------------ method called once each job just after ending the event loop ------------ -void BeamProfile2DB::endJob() { +void BeamProfile2DBWriter::endJob() { edm::Service poolDbService; poolDbService->createOneIOV(beamSpot_, poolDbService->beginOfTime(), "SimBeamSpotObjectsRcd"); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void BeamProfile2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void BeamProfile2DBWriter::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; @@ -117,11 +92,11 @@ void BeamProfile2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add("SigmaZ")->setComment("in cm"); desc.add("BetaStar")->setComment("in cm"); desc.add("Emittance")->setComment("in cm"); - desc.add("Alpha")->setComment("in radians"); - desc.add("Phi")->setComment("in radians"); - desc.add("TimeOffset")->setComment("in ns"); - descriptions.addDefault(desc); + desc.add("Alpha", 0.0)->setComment("in radians"); + desc.add("Phi", 0.0)->setComment("in radians"); + desc.add("TimeOffset", 0.0)->setComment("in ns"); + descriptions.addWithDefaultLabel(desc); } //define this as a plug-in -DEFINE_FWK_MODULE(BeamProfile2DB); +DEFINE_FWK_MODULE(BeamProfile2DBWriter); diff --git a/CondTools/BeamSpot/plugins/BeamSpotOnlineFromOfflineConverter.cc b/CondTools/BeamSpot/plugins/BeamSpotOnlineFromOfflineConverter.cc new file mode 100644 index 0000000000000..bb2df56d1db45 --- /dev/null +++ b/CondTools/BeamSpot/plugins/BeamSpotOnlineFromOfflineConverter.cc @@ -0,0 +1,194 @@ +// -*- C++ -*- +// +// Package: CondTools/BeamSpot +// Class: BeamSpotOnlineFromOfflineConverter +// +/**\class BeamSpotOnlineFromOfflineConverter BeamSpotOnlineFromOfflineConverter.cc CondTools/BeamSpot/plugins/BeamSpotOnlineFromOfflineConverter.cc + + Description: EDAnalyzer to create a BeamSpotOnlineHLTObjectsRcd from a BeamSpotObjectsRcd (inserting some parameters manually) + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Marco Musich +// Created: Sat, 06 May 2023 21:10:00 GMT +// +// + +// system include files +#include +#include +#include +#include +#include + +// user include files +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h" +#include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h" +#include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h" +#include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h" +#include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" + +// +// class declaration +// + +class BeamSpotOnlineFromOfflineConverter : public edm::one::EDAnalyzer<> { +public: + explicit BeamSpotOnlineFromOfflineConverter(const edm::ParameterSet&); + ~BeamSpotOnlineFromOfflineConverter() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + cond::Time_t pack(uint32_t, uint32_t); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + + // ----------member data --------------------------- + const edm::ESGetToken bsToken_; + + // parameters that can't be copied from the BeamSpotObject + const int lastAnalyzedLumi_, lastAnalyzedRun_, lastAnalyzedFill_; + const int numTracks_, numPVs_, numUsedEvents_, numMaxPVs_; + const float meanPVs_, meanPVError_, rmsPV_, rmsPVError_; + const std::string startTime_, endTime_, lumiRange_; + + // IoV-structure + const bool fIsHLT_; + uint32_t fIOVStartRun_; + uint32_t fIOVStartLumi_; + cond::Time_t fnewSince_; + bool fuseNewSince_; +}; + +// +// constructors and destructor +// +BeamSpotOnlineFromOfflineConverter::BeamSpotOnlineFromOfflineConverter(const edm::ParameterSet& iConfig) + : bsToken_(esConsumes()), + lastAnalyzedLumi_(iConfig.getParameter("lastAnalyzedLumi")), + lastAnalyzedRun_(iConfig.getParameter("lastAnalyzedRun")), + lastAnalyzedFill_(iConfig.getParameter("lastAnalyzedFill")), + numTracks_(iConfig.getParameter("numTracks")), + numPVs_(iConfig.getParameter("numPVs")), + numUsedEvents_(iConfig.getParameter("numUsedEvents")), + numMaxPVs_(iConfig.getParameter("numMaxPVs")), + meanPVs_(iConfig.getParameter("meanPVs")), + meanPVError_(iConfig.getParameter("meanPVError")), + rmsPV_(iConfig.getParameter("rmsPVs")), + rmsPVError_(iConfig.getParameter("rmsPVError")), + startTime_(iConfig.getParameter("startTime")), + endTime_(iConfig.getParameter("endTime")), + lumiRange_(iConfig.getParameter("lumiRange")), + fIsHLT_(iConfig.getParameter("isHLT")) { + if (iConfig.exists("IOVStartRun") && iConfig.exists("IOVStartLumi")) { + fIOVStartRun_ = iConfig.getUntrackedParameter("IOVStartRun"); + fIOVStartLumi_ = iConfig.getUntrackedParameter("IOVStartLumi"); + fnewSince_ = BeamSpotOnlineFromOfflineConverter::pack(fIOVStartRun_, fIOVStartLumi_); + fuseNewSince_ = true; + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "useNewSince = True"; + } else { + fuseNewSince_ = false; + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "useNewSince = False"; + } +} + +// +// member functions +// + +// ------------ Create a since object (cond::Time_t) by packing Run and LS (both uint32_t) ------------ +cond::Time_t BeamSpotOnlineFromOfflineConverter::pack(uint32_t fIOVStartRun, uint32_t fIOVStartLumi) { + return ((uint64_t)fIOVStartRun << 32 | fIOVStartLumi); +} + +// ------------ method called for each event ------------ +void BeamSpotOnlineFromOfflineConverter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + const std::string fLabel = (fIsHLT_) ? "BeamSpotOnlineHLTObjectsRcd" : "BeamSpotOnlineLegacyObjectsRcd"; + const BeamSpotObjects* inputSpot = &iSetup.getData(bsToken_); + + BeamSpotOnlineObjects abeam; + abeam.copyFromBeamSpotObject(*inputSpot); + abeam.setLastAnalyzedLumi(lastAnalyzedLumi_); + abeam.setLastAnalyzedRun(lastAnalyzedRun_); + abeam.setLastAnalyzedFill(lastAnalyzedFill_); + abeam.setStartTimeStamp(std::time(nullptr)); + abeam.setEndTimeStamp(std::time(nullptr)); + abeam.setNumTracks(numTracks_); + abeam.setNumPVs(numPVs_); + abeam.setUsedEvents(numUsedEvents_); + abeam.setMaxPVs(numMaxPVs_); + abeam.setMeanPV(meanPVs_); + abeam.setMeanErrorPV(meanPVError_); + abeam.setRmsPV(rmsPV_); + abeam.setRmsErrorPV(rmsPVError_); + abeam.setStartTime(startTime_); + abeam.setEndTime(endTime_); + abeam.setLumiRange(lumiRange_); + + // Set the creation time of the payload to the current time + auto creationTime = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + abeam.setCreationTime(creationTime); + + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << " Writing results to DB..."; + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << abeam; + + edm::Service poolDbService; + if (poolDbService.isAvailable()) { + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "poolDBService available"; + if (poolDbService->isNewTagRequest(fLabel)) { + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "new tag requested"; + if (fuseNewSince_) { + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "Using a new Since: " << fnewSince_; + poolDbService->createOneIOV(abeam, fnewSince_, fLabel); + } else + poolDbService->createOneIOV(abeam, poolDbService->beginOfTime(), fLabel); + } else { + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "no new tag requested"; + if (fuseNewSince_) { + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "Using a new Since: " << fnewSince_; + poolDbService->appendOneIOV(abeam, fnewSince_, fLabel); + } else + poolDbService->appendOneIOV(abeam, poolDbService->currentTime(), fLabel); + } + } + edm::LogPrint("BeamSpotOnlineFromOfflineConverter") << "[BeamSpotOnlineFromOfflineConverter] analyze done \n"; +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void BeamSpotOnlineFromOfflineConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("isHLT", true); + desc.addOptionalUntracked("IOVStartRun", 1); + desc.addOptionalUntracked("IOVStartLumi", 1); + desc.add("lastAnalyzedLumi", 1000); + desc.add("lastAnalyzedRun", 1); + desc.add("lastAnalyzedFill", -999); + desc.add("numTracks", 0); + desc.add("numPVs", 0); + desc.add("numUsedEvents", 0); + desc.add("numMaxPVs", 0); + desc.add("meanPVs", 0.); + desc.add("meanPVError", 0.); + desc.add("rmsPVs", 0.); + desc.add("rmsPVError", 0.); + desc.add("startTime", std::string("")); + desc.add("endTime", std::string("")); + desc.add("lumiRange", std::string("")); + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(BeamSpotOnlineFromOfflineConverter); diff --git a/CondTools/BeamSpot/python/BeamProfile2DBRead_cfi.py b/CondTools/BeamSpot/python/BeamProfile2DBRead_cfi.py new file mode 100644 index 0000000000000..1a3c33bb84de7 --- /dev/null +++ b/CondTools/BeamSpot/python/BeamProfile2DBRead_cfi.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +BeamProfile2DBRead = cms.EDAnalyzer("BeamProfile2DBReader", + rawFileName = cms.untracked.string("") + ) diff --git a/CondTools/BeamSpot/test/BeamProfile2DBReader_cfg.py b/CondTools/BeamSpot/test/BeamProfile2DBReader_cfg.py new file mode 100644 index 0000000000000..251dbbef08286 --- /dev/null +++ b/CondTools/BeamSpot/test/BeamProfile2DBReader_cfg.py @@ -0,0 +1,97 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +process = cms.Process("READ") + +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.register('startRun', + 1, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.register('startLumi', + 1, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "IOV Start Lumi") +options.parseArguments() + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 1000000 # do not clog output with IO + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) # large number of events is needed since we probe 5000LS for run (see below) + +#################################################################### +# Empty source +#################################################################### + +process.source = cms.Source("EmptySource", + firstRun = cms.untracked.uint32(options.startRun), + firstLuminosityBlock = cms.untracked.uint32(options.startRun), # probe one LS after the other + numberEventsInLuminosityBlock = cms.untracked.uint32(1), # probe one event per LS + numberEventsInRun = cms.untracked.uint32(1), # a number of events > the number of LS possible in a real run (5000 s ~ 32 h) + ) + +#################################################################### +# Connect to conditions DB +#################################################################### + +if options.unitTest: + tag_name = 'simBS_tag' +else: + tag_name = options.inputTag + +# either from Global Tag +# process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cfi") +# from Configuration.AlCa.GlobalTag import GlobalTag +# process.GlobalTag = GlobalTag(process.GlobalTag,"auto:phase1_2023_realistic") + +# ...or specify database connection and tag... +# from CondCore.CondDB.CondDB_cfi import * +# CondDBSimBeamSpot = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')) +# process.dbInput = cms.ESSource("PoolDBESSource", +# CondDBSimBeamSpot, +# toGet = cms.VPSet(cms.PSet(record = cms.string('SimBeamSpotObjectsRcd'), +# tag = cms.string(tag_name) # customize with input tag name +# ) +# ) +# ) + +# ...or specify local db file: +from CondCore.CondDB.CondDB_cfi import * +CondDBSimBeamSpot = CondDB.clone(connect = cms.string("sqlite_file:test_%s.db" % tag_name)) # customize with input db file +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + CondDBSimBeamSpot, + DumpStat=cms.untracked.bool(True), + toGet = cms.VPSet(cms.PSet( + record = cms.string('SimBeamSpotObjectsRcd'), + tag = cms.string(tag_name) # customize with input tag name + )) +) + + +#################################################################### +# Load and configure analyzer +#################################################################### +process.load("CondTools.BeamSpot.BeamProfile2DBRead_cfi") +process.BeamProfile2DBRead.rawFileName = 'reference_SimBeamSpotObjects.txt' + +#################################################################### +# Output file +#################################################################### +process.TFileService = cms.Service("TFileService", + fileName=cms.string("reference_SimBeamSpotObjects.root") + ) + +# Put module in path: +process.p = cms.Path(process.BeamProfile2DBRead) diff --git a/CondTools/BeamSpot/test/BeamProfile2DBWriter_cfg.py b/CondTools/BeamSpot/test/BeamProfile2DBWriter_cfg.py new file mode 100644 index 0000000000000..ba907148ba074 --- /dev/null +++ b/CondTools/BeamSpot/test/BeamProfile2DBWriter_cfg.py @@ -0,0 +1,52 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +process = cms.Process("writeBeamProfile2DB") + +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.parseArguments() + + +process.load("FWCore.MessageLogger.MessageLogger_cfi") +from CondCore.CondDB.CondDB_cfi import * + +if options.unitTest : + tag_name = 'simBS_tag' +else: + tag_name = options.inputTag + +################################# +# Produce a SQLITE FILE +################################# +CondDBSimBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBSimBeamSpotObjects, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet(record = cms.string("SimBeamSpotObjectsRcd"), # SimBeamSpot record + tag = cms.string(tag_name))), # choose your favourite tag + loadBlobStreamer = cms.untracked.bool(False) + ) + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +process.load("CondTools.BeamSpot.beamProfile2DBWriter_cfi") +process.beamProfile2DBWriter.X0 = 0.0458532 +process.beamProfile2DBWriter.Y0 = -0.016966 +process.beamProfile2DBWriter.Z0 = -0.074992 +process.beamProfile2DBWriter.SigmaZ = 3.6 +process.beamProfile2DBWriter.BetaStar = 30.0 +process.beamProfile2DBWriter.Emittance = 3.931e-8 + +process.p = cms.Path(process.beamProfile2DBWriter) diff --git a/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py b/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py new file mode 100644 index 0000000000000..84361db367bbd --- /dev/null +++ b/CondTools/BeamSpot/test/BeamSpotOnlineFromOfflineConverter_cfg.py @@ -0,0 +1,101 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +process = cms.Process("READ") + +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.register('inputRecord', + "BeamSpotOnlineLegacyObjectsRcd", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "type of record") +options.register('startRun', + 1, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "location of the input data") +options.register('startLumi', + 1, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "IOV Start Lumi") +options.parseArguments() + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 100000 # do not clog output with IO + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +#################################################################### +# Empty source +#################################################################### +process.source = cms.Source("EmptySource", + firstRun = cms.untracked.uint32(options.startRun), + firstLuminosityBlock = cms.untracked.uint32(options.startLumi), + numberEventsInLuminosityBlock = cms.untracked.uint32(1), + numberEventsInRun = cms.untracked.uint32(1)) + +#################################################################### +# Connect to conditions DB +#################################################################### + +# either from Global Tag +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag,"auto:phase2_realistic") + +# ...or specify database connection and tag: +#from CondCore.CondDB.CondDB_cfi import * +#CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS')) +#process.dbInput = cms.ESSource("PoolDBESSource", +# CondDBBeamSpotObjects, +# toGet = cms.VPSet(cms.PSet(record = cms.string('BeamSpotOnlineLegacyObjectsRcd'), # BeamSpotOnlineLegacy record +# tag = cms.string('BSLegacy_tag') # choose your favourite tag +# ) +# ) +# ) +# ...or from a local db file +# input database (in this case the local sqlite file) + +#################################################################### +# Load and configure outputservice +#################################################################### +if options.unitTest : + if options.inputRecord == "BeamSpotOnlineLegacyObjectsRcd" : + tag_name = 'BSLegacy_tag' + else: + tag_name = 'BSHLT_tag' +else: + tag_name = options.inputTag + +from CondCore.CondDB.CondDB_cfi import * +CondDBBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBBeamSpotObjects, + timetype = cms.untracked.string('lumiid'), #('lumiid'), #('runnumber') + toPut = cms.VPSet(cms.PSet(record = cms.string(options.inputRecord), # BeamSpotOnline record + tag = cms.string(tag_name))), # choose your favourite tag + loadBlobStreamer = cms.untracked.bool(False) + ) + +isForHLT = (options.inputRecord == "BeamSpotOnlineHLTObjectsRcd") +print("isForHLT: ",isForHLT) + +#################################################################### +# Load and configure analyzer +#################################################################### +from CondTools.BeamSpot.beamSpotOnlineFromOfflineConverter_cfi import beamSpotOnlineFromOfflineConverter +process.BeamSpotOnlineFromOfflineConverter = beamSpotOnlineFromOfflineConverter.clone(isHLT = isForHLT) + +# Put module in path: +process.p = cms.Path(process.BeamSpotOnlineFromOfflineConverter) diff --git a/CondTools/BeamSpot/test/BuildFile.xml b/CondTools/BeamSpot/test/BuildFile.xml index 6bb09f88411b9..539c958bd1c70 100644 --- a/CondTools/BeamSpot/test/BuildFile.xml +++ b/CondTools/BeamSpot/test/BuildFile.xml @@ -1,6 +1 @@ - - - - - - + diff --git a/CondTools/BeamSpot/test/testReadWriteBeamSpotsFromDB.sh b/CondTools/BeamSpot/test/testReadWriteBeamSpotsFromDB.sh new file mode 100755 index 0000000000000..619bb71bbf4ea --- /dev/null +++ b/CondTools/BeamSpot/test/testReadWriteBeamSpotsFromDB.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +function die { echo $1: status $2 ; exit $2; } + +echo "TESTING BeamSpot + BeamSpotOnline + SimBeamSpot From DB Read / Write codes ..." + +## clean the input db files +if test -f "test_BSHLT_tag.db"; then + rm -fr test_BSHLT_tag.db +fi + +if test -f "test_BSLegacy_tag.db"; then + rm -fr test_BSLegacy_tag.db +fi + +if test -f "test_simBS_tag.db"; then + rm -fr test_simBS_tag.db +fi + +## copy the input file +cp -pr $CMSSW_BASE/src/CondTools/BeamSpot/data/BeamFitResults_Run306171.txt . + +# test write +printf "TESTING Writing BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure writing payload for BeamSpotOnlineLegacyObjectsRcd" $? + +printf "TESTING Writing BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure writing payload for BeamSpotOnlineHLTObjectsRcd" $? + +printf "TESTING Writing SimBeamSpotObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamProfile2DBWriter_cfg.py unitTest=True || die "Failure writing payload for SimBeamSpotObjectsRcd" $? + +# test read +printf "TESTING Reading BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure reading payload for BeamSpotOnlineLegacyObjectsRcd" $? + +printf "TESTING Reading BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure reading payload for BeamSpotOnlineHLTObjectsRcd" $? + +printf "TESTING reading BeamSpotObjectRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotRcdPrinter_cfg.py || die "Failure running BeamSpotRcdPrinter" $? + +printf "TESTING converting BeamSpotOnlineObjects from BeamSpotObjects ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamSpotOnlineFromOfflineConverter_cfg.py unitTest=True || die "Failure running BeamSpotRcdPrinter" $? + +printf "TESTING Reading SimBeamSpotObjectsRcd DB object ...\n\n" +cmsRun ${SCRAM_TEST_PATH}/BeamProfile2DBReader_cfg.py unitTest=True || die "Failure reading payload for SimBeamSpotObjectsRcd" $? diff --git a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh b/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh deleted file mode 100755 index 0ae82bd5977e3..0000000000000 --- a/CondTools/BeamSpot/test/testReadWriteOnlineBSFromDB.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -function die { echo $1: status $2 ; exit $2; } - -echo "TESTING BeamSpotOnline From DB Read / Write codes ..." - -## clean the input db files -if test -f "test_BSHLT_tag.db"; then - rm -fr test_BSHLT_tag.db -fi - -if test -f "test_BSLegacy_tag.db"; then - rm -fr test_BSLegacy_tag.db -fi - -## copy the input file -cp -pr $CMSSW_BASE/src/CondTools/BeamSpot/data/BeamFitResults_Run306171.txt . - -# test write -printf "TESTING Writing BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure writing payload for BeamSpotOnlineLegacyObjectsRcd" $? - -printf "TESTING Writing BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsWriter_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure writing payload for BeamSpotOnlineHLTObjectsRcd" $? -# test read - -printf "TESTING Reading BeamSpotOnlineLegacyObjectsRcd DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineLegacyObjectsRcd || die "Failure reading payload for BeamSpotOnlineLegacyObjectsRcd" $? - -printf "TESTING Reading BeamSpotOnlineHLTObjectsRcd DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/BeamSpotOnlineRecordsReader_cfg.py unitTest=True inputRecord=BeamSpotOnlineHLTObjectsRcd || die "Failure reading payload for BeamSpotOnlineHLTObjectsRcd" $? - -echo "TESTING reading BeamSpotObjectRcd DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/BeamSpotRcdPrinter_cfg.py || die "Failure running BeamSpotRcdPrinter" $? diff --git a/CondTools/DQM/test/BuildFile.xml b/CondTools/DQM/test/BuildFile.xml index ba09749dad064..3ebd4cb84c9bf 100644 --- a/CondTools/DQM/test/BuildFile.xml +++ b/CondTools/DQM/test/BuildFile.xml @@ -1,12 +1,4 @@ - - - - - - - - - - - - + + + + diff --git a/CondTools/DQM/test/testPayloadReading.cpp b/CondTools/DQM/test/testPayloadReading.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/DQM/test/testPayloadReading.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondTools/DQM/test/testPayloadWriting.cpp b/CondTools/DQM/test/testPayloadWriting.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/DQM/test/testPayloadWriting.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondTools/DQM/test/test_read.sh b/CondTools/DQM/test/test_read.sh index 6754b354b87c4..2b519e7effac6 100755 --- a/CondTools/DQM/test/test_read.sh +++ b/CondTools/DQM/test/test_read.sh @@ -3,4 +3,4 @@ function die { echo $1: status $2 ; exit $2; } echo "TESTING CondTools/DQM ..." -cmsRun ${LOCAL_TEST_DIR}/DQMXMLFileEventSetupAnalyzer_cfg.py unitTest=True || die "Failure running testCondToolsDQMRead" $? +cmsRun ${SCRAM_TEST_PATH}/DQMXMLFileEventSetupAnalyzer_cfg.py unitTest=True || die "Failure running testCondToolsDQMRead" $? diff --git a/CondTools/DQM/test/test_write.sh b/CondTools/DQM/test/test_write.sh index 7f98d6c68e4d0..38f086e94f9b3 100755 --- a/CondTools/DQM/test/test_write.sh +++ b/CondTools/DQM/test/test_write.sh @@ -8,4 +8,4 @@ if test -f "testXML.db"; then fi echo "TESTING CondTools/DQM ..." -cmsRun ${LOCAL_TEST_DIR}/DQMUploadXMLFile.py || die "Failure running testCondToolsDQMUpload" $? +cmsRun ${SCRAM_TEST_PATH}/DQMUploadXMLFile.py || die "Failure running testCondToolsDQMUpload" $? diff --git a/CondTools/Ecal/interface/EcalDBCopy.h b/CondTools/Ecal/interface/EcalDBCopy.h index 69a3d65bf7ff9..e133d84ff189d 100644 --- a/CondTools/Ecal/interface/EcalDBCopy.h +++ b/CondTools/Ecal/interface/EcalDBCopy.h @@ -43,6 +43,7 @@ class EcalLaserAPDPNRatios; class Alignments; class EcalTimeOffsetConstant; class EcalSampleMask; +class EcalSimComponentShape; class EcalSimPulseShape; class EcalTimeBiasCorrections; class EcalSamplesCorrelation; @@ -79,6 +80,7 @@ class EEAlignmentRcd; class ESAlignmentRcd; class EcalTimeOffsetConstantRcd; class EcalSampleMaskRcd; +class EcalSimComponentShapeRcd; class EcalSimPulseShapeRcd; class EcalTimeBiasCorrectionsRcd; class EcalSamplesCorrelationRcd; @@ -134,6 +136,7 @@ class EcalDBCopy : public edm::one::EDAnalyzer<> { edm::ESGetToken esAlignmentToken_; edm::ESGetToken ecalTimeOffsetConstantToken_; edm::ESGetToken ecalSampleMaskToken_; + edm::ESGetToken ecalSimComponentShapeToken_; edm::ESGetToken ecalSimPulseShapeToken_; edm::ESGetToken ecalTimeBiasCorrectionsToken_; edm::ESGetToken ecalSamplesCorrelationToken_; diff --git a/CondTools/Ecal/interface/XMLTags.h b/CondTools/Ecal/interface/XMLTags.h index 383e360b18d76..8f55f8d44f382 100644 --- a/CondTools/Ecal/interface/XMLTags.h +++ b/CondTools/Ecal/interface/XMLTags.h @@ -57,6 +57,7 @@ namespace xuti { const std::string rms1_tag("rms_x1"); const std::string PulseShapes_tag("EcalPulseShapes"); + const std::string SimComponentShape_tag("EcalSimComponentShape"); const std::string SimPulseShape_tag("EcalSimPulseShape"); const std::string sample0_tag("sample_0"); const std::string sample1_tag("sample_1"); diff --git a/CondTools/Ecal/python/copySimComponentShapeFromFiles_cfg.py b/CondTools/Ecal/python/copySimComponentShapeFromFiles_cfg.py new file mode 100644 index 0000000000000..fb77a34c2fcf9 --- /dev/null +++ b/CondTools/Ecal/python/copySimComponentShapeFromFiles_cfg.py @@ -0,0 +1,63 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TEST") +process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetriever_cfi") +process.EcalTrivialConditionRetriever.producedEcalSimComponentShape = cms.untracked.bool(True) +process.EcalTrivialConditionRetriever.getSimComponentShapeFromFile = cms.untracked.bool(True) ### if set False hadrdcoded shapes will be loaded by default + + +### phase II Pulse Shapes +process.EcalTrivialConditionRetriever.sim_component_shape_TI = cms.untracked.double(1) +process.EcalTrivialConditionRetriever.sim_component_shape_EB_thresh = cms.double(0.00013) +fileNames = [f"EB_SimComponentShape_PhaseI_depth{i}.txt" for i in range(0,23)] +#fileNames = [f"EB_SimComponentShape_PhaseII_depth{i}.txt" for i in range(0,23)] +process.EcalTrivialConditionRetriever.EBSimComponentShapeFiles = cms.untracked.vstring(fileNames) + + +process.load("CondCore.CondDB.CondDB_cfi") +#process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_31X_ECAL' +#process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' +process.CondDB.connect = 'sqlite_file:EBSimComponentShape_PhaseI.db' +#process.CondDB.connect = 'sqlite_file:EBSimComponentShape_PhaseII.db' + +process.MessageLogger = cms.Service("MessageLogger", + cerr = cms.untracked.PSet( + enable = cms.untracked.bool(False) + ), + cout = cms.untracked.PSet( + enable = cms.untracked.bool(True) + ), + debugModules = cms.untracked.vstring('*') +) + +process.source = cms.Source("EmptyIOVSource", + firstValue = cms.uint64(1), + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + interval = cms.uint64(1) +) + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet( + cms.PSet( + record = cms.string('EcalSimComponentShapeRcd'), + tag = cms.string('EcalSimComponentShape_PhaseI') + #tag = cms.string('EcalSimComponentShape_PhaseII') + ) + ) +) + +process.dbCopy = cms.EDAnalyzer("EcalDBCopy", + timetype = cms.string('runnumber'), + toCopy = cms.VPSet( + cms.PSet( + record = cms.string('EcalSimComponentShapeRcd'), + container = cms.string('EcalSimComponentShape') + ) + ) +) + +process.prod = cms.EDAnalyzer("EcalTrivialObjectAnalyzer") + +process.p = cms.Path(process.prod*process.dbCopy) diff --git a/CondTools/Ecal/src/EcalDBCopy.cc b/CondTools/Ecal/src/EcalDBCopy.cc index 587c6172a03c2..992757e14c323 100644 --- a/CondTools/Ecal/src/EcalDBCopy.cc +++ b/CondTools/Ecal/src/EcalDBCopy.cc @@ -51,6 +51,8 @@ #include "CondFormats/EcalObjects/interface/EcalSamplesCorrelation.h" #include "CondFormats/DataRecord/interface/EcalSamplesCorrelationRcd.h" +#include "CondFormats/EcalObjects/interface/EcalSimComponentShape.h" +#include "CondFormats/DataRecord/interface/EcalSimComponentShapeRcd.h" #include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h" #include "CondFormats/DataRecord/interface/EcalSimPulseShapeRcd.h" @@ -91,6 +93,7 @@ EcalDBCopy::EcalDBCopy(const edm::ParameterSet& iConfig) esAlignmentToken_(esConsumes()), ecalTimeOffsetConstantToken_(esConsumes()), ecalSampleMaskToken_(esConsumes()), + ecalSimComponentShapeToken_(esConsumes()), ecalSimPulseShapeToken_(esConsumes()), ecalTimeBiasCorrectionsToken_(esConsumes()), ecalSamplesCorrelationToken_(esConsumes()) { @@ -182,6 +185,8 @@ bool EcalDBCopy::shouldCopy(const edm::EventSetup& evtSetup, const std::string& cacheID = evtSetup.get().cacheIdentifier(); } else if (container == "EcalTimeBiasCorrections") { cacheID = evtSetup.get().cacheIdentifier(); + } else if (container == "EcalSimComponentShape") { + cacheID = evtSetup.get().cacheIdentifier(); } else if (container == "EcalSimPulseShape") { cacheID = evtSetup.get().cacheIdentifier(); } else if (container == "EcalSamplesCorrelation") { @@ -364,6 +369,10 @@ void EcalDBCopy::copyToDB(const edm::EventSetup& evtSetup, const std::string& co edm::LogInfo("EcalDBCopy") << "sample mask pointer is: " << &obj << std::endl; dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); + } else if (container == "EcalSimComponentShape") { + const auto& obj = evtSetup.getData(ecalSimComponentShapeToken_); + dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); + } else if (container == "EcalSimPulseShape") { const auto& obj = evtSetup.getData(ecalSimPulseShapeToken_); dbOutput->createOneIOV(obj, dbOutput->beginOfTime(), recordName); diff --git a/CondTools/Hcal/interface/HcalPFCutsHandler.h b/CondTools/Hcal/interface/HcalPFCutsHandler.h new file mode 100644 index 0000000000000..c77d99a067552 --- /dev/null +++ b/CondTools/Hcal/interface/HcalPFCutsHandler.h @@ -0,0 +1,27 @@ +#ifndef CondTools_Hcal_HcalPFCutsHandler_h +#define CondTools_Hcal_HcalPFCutsHandler_h + +#include + +#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h" +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "CondFormats/HcalObjects/interface/HcalPFCuts.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +class HcalPFCutsHandler : public popcon::PopConSourceHandler { +public: + void getNewObjects() override; + std::string id() const override { return m_name; } + ~HcalPFCutsHandler() override; + HcalPFCutsHandler(edm::ParameterSet const&); + + void initObject(HcalPFCuts*); + +private: + unsigned int sinceTime; + edm::FileInPath fFile; + HcalPFCuts* myDBObject; + std::string m_name; +}; +#endif diff --git a/CondTools/Hcal/plugins/HcalDumpConditions.cc b/CondTools/Hcal/plugins/HcalDumpConditions.cc index a1e783cb9f3c1..b23028681131e 100644 --- a/CondTools/Hcal/plugins/HcalDumpConditions.cc +++ b/CondTools/Hcal/plugins/HcalDumpConditions.cc @@ -54,6 +54,7 @@ namespace edmtest { esConsumes(edm::ESInputTag("", "effective")); tok_Gains = esConsumes(); tok_GainWidths = esConsumes(); + tok_PFCuts = esConsumes(); tok_ChannelQuality = esConsumes(); tok_RespCorrs = esConsumes(); tok_ZSThresholds = esConsumes(); @@ -112,6 +113,7 @@ namespace edmtest { edm::ESGetToken tok_PedestalWidths_effective; edm::ESGetToken tok_Gains; edm::ESGetToken tok_GainWidths; + edm::ESGetToken tok_PFCuts; edm::ESGetToken tok_ChannelQuality; edm::ESGetToken tok_RespCorrs; edm::ESGetToken tok_ZSThresholds; @@ -204,6 +206,7 @@ namespace edmtest { mDumpRequest, e, context, "EffectivePedestalWidths", topo, tok_PedestalWidths_effective); dumpIt(mDumpRequest, e, context, "Gains", topo, tok_Gains); dumpIt(mDumpRequest, e, context, "GainWidths", topo, tok_GainWidths); + dumpIt(mDumpRequest, e, context, "PFCuts", topo, tok_PFCuts); dumpIt( mDumpRequest, e, context, "ChannelQuality", topo, tok_ChannelQuality); dumpIt(mDumpRequest, e, context, "RespCorrs", topo, tok_RespCorrs); diff --git a/CondTools/Hcal/plugins/HcalPFCutsPopConAnalyzer.cc b/CondTools/Hcal/plugins/HcalPFCutsPopConAnalyzer.cc new file mode 100644 index 0000000000000..6c40211c4d0c3 --- /dev/null +++ b/CondTools/Hcal/plugins/HcalPFCutsPopConAnalyzer.cc @@ -0,0 +1,38 @@ +#include "CondCore/PopCon/interface/PopConAnalyzer.h" +#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h" +#include "CondTools/Hcal/interface/HcalPFCutsHandler.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +class HcalPFCutsPopConAnalyzer : public popcon::PopConAnalyzer { +public: + typedef HcalPFCutsHandler SourceHandler; + + HcalPFCutsPopConAnalyzer(const edm::ParameterSet& pset) + : popcon::PopConAnalyzer(pset), + m_populator(pset), + m_source(pset.getParameter("Source")), + m_tok(esConsumes()) {} + +private: + void endJob() override { + m_source.initObject(myDBObject); + write(); + } + + void analyze(const edm::Event& ev, const edm::EventSetup& esetup) override { + //Using ES to get the data: + + myDBObject = new HcalPFCuts(esetup.getData(m_tok)); + } + + void write() { m_populator.write(m_source); } + +private: + popcon::PopCon m_populator; + SourceHandler m_source; + edm::ESGetToken m_tok; + + HcalPFCuts* myDBObject; +}; + +DEFINE_FWK_MODULE(HcalPFCutsPopConAnalyzer); diff --git a/CondTools/Hcal/src/HcalPFCutsHandler.cc b/CondTools/Hcal/src/HcalPFCutsHandler.cc new file mode 100644 index 0000000000000..604722a570339 --- /dev/null +++ b/CondTools/Hcal/src/HcalPFCutsHandler.cc @@ -0,0 +1,32 @@ +#include "CondTools/Hcal/interface/HcalPFCutsHandler.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +HcalPFCutsHandler::HcalPFCutsHandler(edm::ParameterSet const& ps) { + m_name = ps.getUntrackedParameter("name", "HcalPFCutsHandler"); + sinceTime = ps.getUntrackedParameter("IOVRun", 0); +} + +HcalPFCutsHandler::~HcalPFCutsHandler() {} + +void HcalPFCutsHandler::getNewObjects() { + edm::LogInfo("HcalPFCutsHandler") << "------- " << m_name << " - > getNewObjects\n" + << + //check whats already inside of database + "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << ", last object valid since " + << tagInfo().lastInterval.since; + + if (!myDBObject) + throw cms::Exception("Empty DB object") << m_name << " has received empty object - nothing to write to DB"; + + // IOV information + cond::Time_t myTime = sinceTime; + + edm::LogInfo("HcalPFCutsHandler") << "Using IOV run " << sinceTime; + + // prepare for transfer: + m_to_transfer.push_back(std::make_pair(myDBObject, myTime)); + + edm::LogInfo("HcalPFCutsHandler") << "------- " << m_name << " - > getNewObjects" << std::endl; +} + +void HcalPFCutsHandler::initObject(HcalPFCuts* fObject) { myDBObject = fObject; } diff --git a/CondTools/Hcal/test/BuildFile.xml b/CondTools/Hcal/test/BuildFile.xml index 11a0706916051..2bd964c9b3292 100644 --- a/CondTools/Hcal/test/BuildFile.xml +++ b/CondTools/Hcal/test/BuildFile.xml @@ -27,11 +27,11 @@ - + - - - + + + diff --git a/CondTools/Hcal/test/HFPhase1PMTParams_unittest.cc b/CondTools/Hcal/test/HFPhase1PMTParams_unittest.cc deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/Hcal/test/HFPhase1PMTParams_unittest.cc +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.cpp b/CondTools/Hcal/test/HcalPFCuts_unittest.cc similarity index 100% rename from CalibTracker/SiPixelESProducers/test/testSiPixelFakeLorentzAngleESSource.cpp rename to CondTools/Hcal/test/HcalPFCuts_unittest.cc diff --git a/CondTools/Hcal/test/pfcuts_db_io_test.sh b/CondTools/Hcal/test/pfcuts_db_io_test.sh new file mode 100755 index 0000000000000..61aee899ae22f --- /dev/null +++ b/CondTools/Hcal/test/pfcuts_db_io_test.sh @@ -0,0 +1,109 @@ +#!/bin/bash -ex + +inputfile=$(edmFileInPath CondTools/Hcal/data/hcalpfcuts.txt) +cat << \EOF > temp_pfcuts_to_db.py + +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras + +process = cms.Process("TODB",eras.Run3) +process.load("CondCore.CondDB.CondDB_cfi") + +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond["phase1_2022_realistic"] + +process.load('Configuration.StandardSequences.Services_cff') +process.load("CondCore.CondDB.CondDB_cfi") +process.CondDB.connect = "sqlite_file:HcalPFCuts_V00_test.db" + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.source = cms.Source("EmptySource", + numberEventsInRun = cms.untracked.uint32(1), + firstRun = cms.untracked.uint32(1) +) + +process.es_ascii = cms.ESSource("HcalTextCalibrations", + input = cms.VPSet( + cms.PSet( + object = cms.string("PFCuts"), + file = cms.FileInPath("CondTools/Hcal/data/hcalpfcuts.txt") + ) + ) +) +process.es_prefer = cms.ESPrefer('HcalTextCalibrations','es_ascii') + +process.PoolDBOutputService = cms.Service( + "PoolDBOutputService", + process.CondDB, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet( + record = cms.string("HcalPFCutsRcd"), + tag = cms.string("HcalPFCuts_test_tag") + )) +) + +process.mytest = cms.EDAnalyzer("HcalPFCutsPopConAnalyzer", + record = cms.string('HcalPFCutsRcd'), + loggingOn = cms.untracked.bool(True), + SinceAppendMode = cms.bool(True), + Source = cms.PSet( + IOVRun = cms.untracked.uint32(1) + ) +) +process.p = cms.Path(process.mytest) +EOF + +cmsRun temp_pfcuts_to_db.py +rm temp_pfcuts_to_db.py + +cat << \EOF > temp_pfcuts_from_db.py + +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras + +process = cms.Process("FROMDB",eras.Run3) +process.load("CondCore.CondDB.CondDB_cfi") + +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond["phase1_2022_realistic"] + +process.load('Configuration.StandardSequences.Services_cff') +process.load("CondCore.CondDB.CondDB_cfi") +process.CondDB.connect = "sqlite_file:HcalPFCuts_V00_test.db" + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.source = cms.Source("EmptySource", + numberEventsInRun = cms.untracked.uint32(1), + firstRun = cms.untracked.uint32(1) +) + +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + toGet = cms.VPSet(cms.PSet( + record = cms.string("HcalPFCutsRcd"), + tag = cms.string("HcalPFCuts_test_tag") + )) +) + +process.es_prefer = cms.ESPrefer("PoolDBESSource","") + +process.dumpcond = cms.EDAnalyzer("HcalDumpConditions", + dump = cms.untracked.vstring("PFCuts") +) +process.p = cms.Path(process.dumpcond) +EOF + +cmsRun temp_pfcuts_from_db.py +rm temp_pfcuts_from_db.py + +diff DumpPFCuts_Run1.txt $inputfile diff --git a/CondTools/Hcal/test/testHFPhase1PMTParams.sh b/CondTools/Hcal/test/testHFPhase1PMTParams.sh index a097dc1d18bb3..e4a6388e2f532 100755 --- a/CondTools/Hcal/test/testHFPhase1PMTParams.sh +++ b/CondTools/Hcal/test/testHFPhase1PMTParams.sh @@ -6,10 +6,10 @@ echo "TESTING HFPhase1PMTParams generation code ..." write_HFPhase1PMTParams 1 HFPhase1PMTParams_V00_mc.bbin || die "Failure running write_HFPhase1PMTParams" $? echo "TESTING HFPhase1PMTParams database creation code ..." -cmsRun ${LOCAL_TEST_DIR}/HFPhase1PMTParamsDBWriter_cfg.py || die "Failure running HFPhase1PMTParamsDBWriter_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/HFPhase1PMTParamsDBWriter_cfg.py || die "Failure running HFPhase1PMTParamsDBWriter_cfg.py" $? echo "TESTING HFPhase1PMTParams database reading code ..." -cmsRun ${LOCAL_TEST_DIR}/HFPhase1PMTParamsDBReader_cfg.py || die "Failure running HFPhase1PMTParamsDBReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/HFPhase1PMTParamsDBReader_cfg.py || die "Failure running HFPhase1PMTParamsDBReader_cfg.py" $? echo "TESTING that we can restore HFPhase1PMTParams from the database ..." diff HFPhase1PMTParams_V00_mc.bbin dbread.bbin || die "Database contents differ from the original" $? diff --git a/CondTools/RunInfo/interface/OMSAccess.h b/CondTools/RunInfo/interface/OMSAccess.h index 2cbecced23fee..104dd6073cc77 100644 --- a/CondTools/RunInfo/interface/OMSAccess.h +++ b/CondTools/RunInfo/interface/OMSAccess.h @@ -52,6 +52,12 @@ namespace cond { unsigned long int_val = from_string_impl(attributeValue, 0); return (unsigned short)int_val; } + inline unsigned long long s_to_ull(const std::string& val) { return std::stoull(val); } + template <> + inline unsigned long long from_string(const std::string& attributeValue) { + unsigned long long int_val = from_string_impl(attributeValue, 0); + return int_val; + } inline boost::posix_time::ptime s_to_time(const std::string& val) { boost::posix_time::time_input_facet* facet = new boost::posix_time::time_input_facet(OMS_TIME_FMT); @@ -147,6 +153,9 @@ namespace cond { OMSServiceResultIterator begin() const; OMSServiceResultIterator end() const; + OMSServiceResultRef front() const; + OMSServiceResultRef back() const; + // parse json returned from curl, filling the property tree size_t parseData(const std::string& data); diff --git a/CondTools/RunInfo/plugins/BuildFile.xml b/CondTools/RunInfo/plugins/BuildFile.xml index 6fff2bf931f54..7463d7150b208 100644 --- a/CondTools/RunInfo/plugins/BuildFile.xml +++ b/CondTools/RunInfo/plugins/BuildFile.xml @@ -49,6 +49,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc new file mode 100644 index 0000000000000..4757ae0ce420e --- /dev/null +++ b/CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc @@ -0,0 +1,736 @@ +#include "CondCore/CondDB/interface/ConnectionPool.h" +#include "CondCore/PopCon/interface/PopConAnalyzer.h" +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "CondFormats/Common/interface/TimeConversions.h" +#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "CoralBase/Attribute.h" +#include "CoralBase/AttributeList.h" +#include "CoralBase/AttributeSpecification.h" +#include "CoralBase/TimeStamp.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" +#include "LumiSectionFilter.h" +#include "RelationalAccess/ICursor.h" +#include "RelationalAccess/IQuery.h" +#include "RelationalAccess/ISchema.h" +#include "RelationalAccess/ISessionProxy.h" +#include +#include +#include +#include +#include +#include +#include + +class LHCInfoPerFillPopConSourceHandler; + +typedef popcon::PopConAnalyzer LHCInfoPerFillPopConAnalyzer; +//define this as a plug-in +DEFINE_FWK_MODULE(LHCInfoPerFillPopConAnalyzer); + +namespace cond { + namespace theLHCInfoPerFillPopConImpl { + + static const std::pair s_fillTypeMap[] = { + std::make_pair("PROTONS", LHCInfoPerFill::PROTONS), + std::make_pair("IONS", LHCInfoPerFill::IONS), + std::make_pair("COSMICS", LHCInfoPerFill::COSMICS), + std::make_pair("GAP", LHCInfoPerFill::GAP)}; + + static const std::pair s_particleTypeMap[] = { + std::make_pair("PROTON", LHCInfoPerFill::PROTON), + std::make_pair("PB82", LHCInfoPerFill::PB82), + std::make_pair("AR18", LHCInfoPerFill::AR18), + std::make_pair("D", LHCInfoPerFill::D), + std::make_pair("XE54", LHCInfoPerFill::XE54)}; + + LHCInfoPerFill::FillType fillTypeFromString(const std::string& s_fill_type) { + for (auto const& i : s_fillTypeMap) + if (s_fill_type == i.first) + return i.second; + return LHCInfoPerFill::UNKNOWN; + } + + LHCInfoPerFill::ParticleType particleTypeFromString(const std::string& s_particle_type) { + for (auto const& i : s_particleTypeMap) + if (s_particle_type == i.first) + return i.second; + return LHCInfoPerFill::NONE; + } + } // namespace theLHCInfoPerFillPopConImpl + + namespace impl { + + template <> + LHCInfoPerFill::FillType from_string(const std::string& attributeValue) { + return from_string_impl( + attributeValue, LHCInfoPerFill::UNKNOWN); + } + + template <> + LHCInfoPerFill::ParticleType from_string(const std::string& attributeValue) { + return from_string_impl( + attributeValue, LHCInfoPerFill::NONE); + } + + } // namespace impl +} // namespace cond + +namespace theLHCInfoPerFillImpl { + + bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult) { + bool ret = false; + if (!queryResult.empty()) { + auto row = *queryResult.begin(); + auto currentFill = row.get("fill_number"); + auto bunches1 = row.get("bunches_beam1"); + auto bunches2 = row.get("bunches_beam2"); + auto collidingBunches = row.get("bunches_colliding"); + auto targetBunches = row.get("bunches_target"); + auto fillType = row.get("fill_type_runtime"); + auto particleType1 = row.get("fill_type_party1"); + auto particleType2 = row.get("fill_type_party2"); + auto intensityBeam1 = row.get("intensity_beam1"); + auto intensityBeam2 = row.get("intensity_beam2"); + auto energy = row.get("energy"); + auto creationTime = row.get("start_time"); + auto stableBeamStartTime = row.get("start_stable_beam"); + auto beamDumpTime = row.get("end_time"); + auto injectionScheme = row.get("injection_scheme"); + targetPayload = std::make_unique(); + targetPayload->setFillNumber(currentFill); + targetPayload->setBunchesInBeam1(bunches1); + targetPayload->setBunchesInBeam2(bunches2); + targetPayload->setCollidingBunches(collidingBunches); + targetPayload->setTargetBunches(targetBunches); + targetPayload->setFillType(fillType); + targetPayload->setParticleTypeForBeam1(particleType1); + targetPayload->setParticleTypeForBeam2(particleType2); + targetPayload->setIntensityForBeam1(intensityBeam1); + targetPayload->setIntensityForBeam2(intensityBeam2); + targetPayload->setEnergy(energy); + targetPayload->setCreationTime(cond::time::from_boost(creationTime)); + targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime)); + targetPayload->setEndTime(cond::time::from_boost(beamDumpTime)); + targetPayload->setInjectionScheme(injectionScheme); + ret = true; + } + return ret; + } +} // namespace theLHCInfoPerFillImpl + +namespace theLHCInfoPerFillImpl { + static const std::map vecMap = { + {"Beam1/beamPhaseMean", 1}, {"Beam2/beamPhaseMean", 2}, {"Beam1/cavPhaseMean", 3}, {"Beam2/cavPhaseMean", 4}}; + void setElementData(cond::Time_t since, + const std::string& dipVal, + unsigned int elementNr, + float value, + LHCInfoPerFill& payload, + std::set& initList) { + if (initList.find(since) == initList.end()) { + payload.beam1VC().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam2VC().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam1RF().resize(LHCInfoPerFill::bunchSlots, 0.); + payload.beam2RF().resize(LHCInfoPerFill::bunchSlots, 0.); + initList.insert(since); + } + // set the current values to all of the payloads of the lumi section samples after the current since + if (elementNr < LHCInfoPerFill::bunchSlots) { + switch (vecMap.at(dipVal)) { + case 1: + payload.beam1VC()[elementNr] = value; + break; + case 2: + payload.beam2VC()[elementNr] = value; + break; + case 3: + payload.beam1RF()[elementNr] = value; + break; + case 4: + payload.beam2RF()[elementNr] = value; + break; + default: + break; + } + } + } +} // namespace theLHCInfoPerFillImpl + +namespace theLHCInfoPerFillImpl { + bool comparePayloads(const LHCInfoPerFill& rhs, const LHCInfoPerFill& lhs) { + if (rhs.fillNumber() != lhs.fillNumber() || rhs.delivLumi() != lhs.delivLumi() || rhs.recLumi() != lhs.recLumi() || + rhs.instLumi() != lhs.instLumi() || rhs.instLumiError() != lhs.instLumiError() || + rhs.lhcState() != rhs.lhcState() || rhs.lhcComment() != rhs.lhcComment() || + rhs.ctppsStatus() != rhs.ctppsStatus()) { + return false; + } + return true; + } + + size_t transferPayloads(const std::vector>>& buffer, + std::map>& iovsToTransfer, + std::shared_ptr& prevPayload) { + size_t niovs = 0; + std::stringstream condIovs; + std::stringstream formattedIovs; + for (auto& iov : buffer) { + bool add = false; + auto payload = iov.second; + cond::Time_t since = iov.first; + if (iovsToTransfer.empty()) { + add = true; + } else { + LHCInfoPerFill& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { + add = true; + } + } + if (add) { + niovs++; + condIovs << since << " "; + formattedIovs << boost::posix_time::to_iso_extended_string(cond::time::to_boost(since)) << " "; + iovsToTransfer.insert(std::make_pair(since, payload)); + prevPayload = iov.second; + } + } + edm::LogInfo("transferPayloads") << "TRANSFERED IOVS: " << condIovs.str(); + edm::LogInfo("transferPayloads") << "FORMATTED TRANSFERED IOVS: " << formattedIovs.str(); + return niovs; + } + +} // namespace theLHCInfoPerFillImpl +class LHCInfoPerFillPopConSourceHandler : public popcon::PopConSourceHandler { +public: + LHCInfoPerFillPopConSourceHandler(edm::ParameterSet const& pset) + : m_debug(pset.getUntrackedParameter("debug", false)), + m_startTime(), + m_endTime(), + m_samplingInterval((unsigned int)pset.getUntrackedParameter("samplingInterval", 300)), + m_endFillMode(pset.getUntrackedParameter("endFill", true)), + m_name(pset.getUntrackedParameter("name", "LHCInfoPerFillPopConSourceHandler")), + m_connectionString(pset.getUntrackedParameter("connectionString", "")), + m_ecalConnectionString(pset.getUntrackedParameter("ecalConnectionString", "")), + m_dipSchema(pset.getUntrackedParameter("DIPSchema", "")), + m_authpath(pset.getUntrackedParameter("authenticationPath", "")), + m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), + m_fillPayload(), + m_prevPayload(), + m_tmpBuffer() { + if (!pset.getUntrackedParameter("startTime").empty()) { + m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); + } + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + m_endTime = now; + if (!pset.getUntrackedParameter("endTime").empty()) { + m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); + if (m_endTime > now) + m_endTime = now; + } + } + //L1: try with different m_dipSchema + //L2: try with different m_name + ~LHCInfoPerFillPopConSourceHandler() override = default; + void getNewObjects() override { + //reference to the last payload in the tag + Ref previousFill; + + //if a new tag is created, transfer fake fill from 1 to the first fill for the first time + if (tagInfo().size == 0) { + edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; + } else { + //check what is already inside the database + edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size + << ", last object valid since " << tagInfo().lastInterval.since << " ( " + << boost::posix_time::to_iso_extended_string( + cond::time::to_boost(tagInfo().lastInterval.since)) + << " ); from " << m_name << "::getNewObjects"; + } + + cond::Time_t lastSince = tagInfo().lastInterval.since; + if (tagInfo().isEmpty()) { + // for a new or empty tag, an empty payload should be added on top with since=1 + addEmptyPayload(1); + lastSince = 1; + } else { + edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " + << m_name << "::getNewObjects"; + } + + boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); + cond::Time_t targetSince = 0; + cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); + if (!m_startTime.is_not_a_date_time()) { + targetSince = cond::time::from_boost(m_startTime); + } + if (lastSince > targetSince) + targetSince = lastSince; + + edm::LogInfo(m_name) << "Starting sampling at " + << boost::posix_time::to_simple_string(cond::time::to_boost(targetSince)); + + //retrieve the data from the relational database source + cond::persistency::ConnectionPool connection; + //configure the connection + if (m_debug) { + connection.setMessageVerbosity(coral::Debug); + } else { + connection.setMessageVerbosity(coral::Error); + } + connection.setAuthenticationPath(m_authpath); + connection.configure(); + //create the sessions + cond::persistency::Session session = connection.createSession(m_connectionString, false); + cond::persistency::Session session2 = connection.createSession(m_ecalConnectionString, false); + // fetch last payload when available + if (!tagInfo().lastInterval.payloadId.empty()) { + cond::persistency::Session session3 = dbSession(); + session3.transaction().start(true); + m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); + session3.transaction().commit(); + } + + // bool iovAdded = false; + while (true) { + if (targetSince >= executionTimeIov) { + edm::LogInfo(m_name) << "Sampling ended at the time " + << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); + break; + } + bool updateEcal = false; + boost::posix_time::ptime targetTime = cond::time::to_boost(targetSince); + boost::posix_time::ptime startSampleTime; + boost::posix_time::ptime endSampleTime; + + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + + edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(targetTime); + query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); + if (targetTime > cond::time::to_boost(m_prevPayload->createTime())) { + query->filterGE("start_time", targetTime); + } else { + query->filterGT("start_time", targetTime); + } + + query->filterLT("start_time", m_endTime); + if (m_endFillMode) + query->filterNotNull("end_time"); + bool foundFill = query->execute(); + if (foundFill) + foundFill = theLHCInfoPerFillImpl::makeFillPayload(m_fillPayload, query->result()); + if (!foundFill) { + edm::LogInfo(m_name) << "No fill found - END of job."; + // if (iovAdded) + // addEmptyPayload(targetSince); + break; + } + + startSampleTime = cond::time::to_boost(m_fillPayload->createTime()); + cond::Time_t startFillTime = m_fillPayload->createTime(); + cond::Time_t endFillTime = m_fillPayload->endTime(); + unsigned short lhcFill = m_fillPayload->fillNumber(); + bool ongoingFill = endFillTime == 0ULL; + if (ongoingFill) { + edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " + << cond::time::to_boost(startFillTime); + endSampleTime = executionTime; + targetSince = executionTimeIov; + } else { + edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(startFillTime) + << " ending at " << cond::time::to_boost(endFillTime); + endSampleTime = cond::time::to_boost(endFillTime); + targetSince = endFillTime; + } + if (m_endFillMode || ongoingFill) { + getDipData(oms, startSampleTime, endSampleTime); + getLumiData(oms, lhcFill, startSampleTime, endSampleTime); + if (!m_tmpBuffer.empty()) { + boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); + boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); + edm::LogInfo(m_name) << "First lumi starts at " << flumiStart << " last lumi starts at " << flumiStop; + session.transaction().start(true); + getCTTPSData(session, startSampleTime, endSampleTime); + session.transaction().commit(); + session2.transaction().start(true); + getEcalData(session2, startSampleTime, endSampleTime, updateEcal); + session2.transaction().commit(); + } + } + + size_t niovs = theLHCInfoPerFillImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); + edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; + m_tmpBuffer.clear(); + // iovAdded = true; + if (m_prevPayload->fillNumber() and !ongoingFill) + addEmptyPayload(endFillTime); + } + } + + std::string id() const override { return m_name; } + + static constexpr unsigned int kLumisectionsQueryLimit = 4000; + +private: + void addEmptyPayload(cond::Time_t iov) { + bool add = false; + if (m_iovs.empty()) { + if (!m_lastPayloadEmpty) + add = true; + } else { + auto lastAdded = m_iovs.rbegin()->second; + if (lastAdded->fillNumber() != 0) { + add = true; + } + } + if (add) { + auto newPayload = std::make_shared(); + m_iovs.insert(std::make_pair(iov, newPayload)); + m_prevPayload = newPayload; + edm::LogInfo(m_name) << "Added empty payload with IOV " << iov << " ( " + << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; + } + } + + void addPayloadToBuffer(cond::OMSServiceResultRef& row) { + auto lumiTime = row.get("start_time"); + auto delivLumi = row.get("delivered_lumi"); + auto recLumi = row.get("recorded_lumi"); + LHCInfoPerFill* thisLumiSectionInfo = m_fillPayload->cloneFill(); + m_tmpBuffer.emplace_back(std::make_pair(cond::time::from_boost(lumiTime), thisLumiSectionInfo)); + LHCInfoPerFill& payload = *thisLumiSectionInfo; + payload.setDelivLumi(delivLumi); + payload.setRecLumi(recLumi); + } + + size_t getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + auto query = oms.query("lumisections"); + query->addOutputVars({"start_time", "delivered_lumi", "recorded_lumi", "beams_stable"}); + query->filterEQ("fill_number", fillId); + query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); + query->filterEQ("beams_stable", "true"); + query->limit(kLumisectionsQueryLimit); + if (query->execute()) { + int nLumi = 0; + auto queryResult = query->result(); + edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections with STABLE BEAM during the fill " + << fillId; + + if (!queryResult.empty()) { + if (m_endFillMode) { + auto firstRow = queryResult.front(); + addPayloadToBuffer(firstRow); + nLumi++; + } + + auto lastRow = queryResult.back(); + addPayloadToBuffer(lastRow); + nLumi++; + } + } + return 0; + } + + void getDipData(const cond::OMSService& oms, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + // unsure how to handle this. + // the old implementation is not helping: apparently it is checking only the bunchconfiguration for the first diptime set of values... + auto query1 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam1"); + query1->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + //If all this data is needed and saved properly the limit has to be set: query1->limit(...) + if (query1->execute()) { + auto res = query1->result(); + if (!res.empty()) { + std::bitset bunchConfiguration1(0ULL); + auto row = *res.begin(); + auto vbunchConf1 = row.getArray("value"); + for (auto vb : vbunchConf1) { + if (vb != 0) { + unsigned short slot = (vb - 1) / 10 + 1; + bunchConfiguration1[slot] = true; + } + } + m_fillPayload->setBunchBitsetForBeam1(bunchConfiguration1); + } + } + auto query2 = oms.query("diplogger/dip/acc/LHC/RunControl/CirculatingBunchConfig/Beam2"); + query2->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + if (query2->execute()) { + auto res = query2->result(); + if (!res.empty()) { + std::bitset bunchConfiguration2(0ULL); + auto row = *res.begin(); + auto vbunchConf2 = row.getArray("value"); + for (auto vb : vbunchConf2) { + if (vb != 0) { + unsigned short slot = (vb - 1) / 10 + 1; + bunchConfiguration2[slot] = true; + } + } + m_fillPayload->setBunchBitsetForBeam2(bunchConfiguration2); + } + } + + auto query3 = oms.query("diplogger/dip/CMS/LHC/LumiPerBunch"); + query3->filterGT("dip_time", beginFillTime).filterLT("dip_time", endFillTime); + //This query is limited to 100 rows, but currently only one is used + if (query3->execute()) { + auto res = query3->result(); + if (!res.empty()) { + std::vector lumiPerBX; + auto row = *res.begin(); + auto lumiBunchInst = row.getArray("lumi_bunch_inst"); + for (auto lb : lumiBunchInst) { + if (lb != 0.) { + lumiPerBX.push_back(lb); + } + } + m_fillPayload->setLumiPerBX(lumiPerBX); + } + } + } + + bool getCTTPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + //run the fifth query against the CTPPS schema + //Initializing the CMS_CTP_CTPPS_COND schema. + coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); + //execute query for CTPPS Data + std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); + //FROM clause + CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); + //SELECT clause + CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); + CTPPSDataQuery->addToOutputList(std::string("LHC_STATE")); + CTPPSDataQuery->addToOutputList(std::string("LHC_COMMENT")); + if (m_debug) { + CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); + CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); + } + //WHERE CLAUSE + coral::AttributeList CTPPSDataBindVariables; + CTPPSDataBindVariables.extend(std::string("beginFillTime")); + CTPPSDataBindVariables.extend(std::string("endFillTime")); + CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); + CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); + std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); + CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); + //ORDER BY clause + CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); + //define query output + coral::AttributeList CTPPSDataOutput; + CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); + CTPPSDataOutput.extend(std::string("LHC_STATE")); + CTPPSDataOutput.extend(std::string("LHC_COMMENT")); + if (m_debug) { + CTPPSDataOutput.extend(std::string("RUN_NUMBER")); + CTPPSDataOutput.extend(std::string("LUMI_SECTION")); + } + CTPPSDataQuery->defineOutput(CTPPSDataOutput); + //execute the query + coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); + cond::Time_t dipTime = 0; + std::string lhcState = "", lhcComment = "", ctppsStatus = ""; + + //debug informations + unsigned int lumiSection = 0; + cond::Time_t runNumber = 0; + cond::Time_t savedDipTime = 0; + unsigned int savedLumiSection = 0; + cond::Time_t savedRunNumber = 0; + + bool ret = false; + LumiSectionFilter filter(m_tmpBuffer); + while (CTPPSDataCursor.next()) { + if (m_debug) { + std::ostringstream CTPPS; + CTPPSDataCursor.currentRow().toOutputStream(CTPPS); + } + coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; + if (!dipTimeAttribute.isNull()) { + dipTime = cond::time::from_boost(dipTimeAttribute.data().time()); + if (filter.process(dipTime)) { + ret = true; + coral::Attribute const& lhcStateAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_STATE")]; + if (!lhcStateAttribute.isNull()) { + lhcState = lhcStateAttribute.data(); + } + coral::Attribute const& lhcCommentAttribute = CTPPSDataCursor.currentRow()[std::string("LHC_COMMENT")]; + if (!lhcCommentAttribute.isNull()) { + lhcComment = lhcCommentAttribute.data(); + } + + if (m_debug) { + coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; + if (!runNumberAttribute.isNull()) { + runNumber = runNumberAttribute.data(); + } + coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; + if (!lumiSectionAttribute.isNull()) { + lumiSection = lumiSectionAttribute.data(); + } + } + + for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { + // set the current values to all of the payloads of the lumi section samples after the current since + LHCInfoPerFill& payload = *(it->second); + payload.setLhcState(lhcState); + payload.setLhcComment(lhcComment); + payload.setCtppsStatus(ctppsStatus); + + if (m_debug) { + savedDipTime = dipTime; + savedLumiSection = lumiSection; + savedRunNumber = runNumber; + } + } + } + } + } + if (m_debug) { + edm::LogInfo(m_name) << "Last assigned: " + << "DipTime: " << savedDipTime << " " + << "LumiSection: " << savedLumiSection << " " + << "RunNumber: " << savedRunNumber; + } + return ret; + } + + bool getEcalData(cond::persistency::Session& session, + const boost::posix_time::ptime& lowerTime, + const boost::posix_time::ptime& upperTime, + bool update) { + //run the sixth query against the CMS_DCS_ENV_PVSS_COND schema + //Initializing the CMS_DCS_ENV_PVSS_COND schema. + coral::ISchema& ECAL = session.nominalSchema(); + //start the transaction against the fill logging schema + //execute query for ECAL Data + std::unique_ptr ECALDataQuery(ECAL.newQuery()); + //FROM clause + ECALDataQuery->addToTableList(std::string("BEAM_PHASE")); + //SELECT clause + ECALDataQuery->addToOutputList(std::string("CHANGE_DATE")); + ECALDataQuery->addToOutputList(std::string("DIP_value")); + ECALDataQuery->addToOutputList(std::string("element_nr")); + ECALDataQuery->addToOutputList(std::string("VALUE_NUMBER")); + //WHERE CLAUSE + coral::AttributeList ECALDataBindVariables; + ECALDataBindVariables.extend(std::string("lowerTime")); + ECALDataBindVariables.extend(std::string("upperTime")); + ECALDataBindVariables[std::string("lowerTime")].data() = coral::TimeStamp(lowerTime); + ECALDataBindVariables[std::string("upperTime")].data() = coral::TimeStamp(upperTime); + std::string conditionStr = std::string( + "(DIP_value LIKE '%beamPhaseMean%' OR DIP_value LIKE '%cavPhaseMean%') AND CHANGE_DATE >= :lowerTime AND " + "CHANGE_DATE < :upperTime"); + + ECALDataQuery->setCondition(conditionStr, ECALDataBindVariables); + //ORDER BY clause + ECALDataQuery->addToOrderList(std::string("CHANGE_DATE")); + ECALDataQuery->addToOrderList(std::string("DIP_value")); + ECALDataQuery->addToOrderList(std::string("element_nr")); + //define query output + coral::AttributeList ECALDataOutput; + ECALDataOutput.extend(std::string("CHANGE_DATE")); + ECALDataOutput.extend(std::string("DIP_value")); + ECALDataOutput.extend(std::string("element_nr")); + ECALDataOutput.extend(std::string("VALUE_NUMBER")); + //ECALDataQuery->limitReturnedRows( 14256 ); //3564 entries per vector. + ECALDataQuery->defineOutput(ECALDataOutput); + //execute the query + coral::ICursor& ECALDataCursor = ECALDataQuery->execute(); + cond::Time_t changeTime = 0; + cond::Time_t firstTime = 0; + std::string dipVal = ""; + unsigned int elementNr = 0; + float value = 0.; + std::set initializedVectors; + LumiSectionFilter filter(m_tmpBuffer); + bool ret = false; + if (m_prevPayload.get()) { + for (auto& lumiSlot : m_tmpBuffer) { + lumiSlot.second->setBeam1VC(m_prevPayload->beam1VC()); + lumiSlot.second->setBeam2VC(m_prevPayload->beam2VC()); + lumiSlot.second->setBeam1RF(m_prevPayload->beam1RF()); + lumiSlot.second->setBeam2RF(m_prevPayload->beam2RF()); + } + } + std::map iovMap; + if (m_tmpBuffer.empty()) { + return ret; + } + cond::Time_t lowerLumi = m_tmpBuffer.front().first; + while (ECALDataCursor.next()) { + if (m_debug) { + std::ostringstream ECAL; + ECALDataCursor.currentRow().toOutputStream(ECAL); + } + coral::Attribute const& changeDateAttribute = ECALDataCursor.currentRow()[std::string("CHANGE_DATE")]; + if (!changeDateAttribute.isNull()) { + ret = true; + boost::posix_time::ptime chTime = changeDateAttribute.data().time(); + // move the first IOV found to the start of the fill interval selected + if (changeTime == 0) { + firstTime = cond::time::from_boost(chTime); + } + changeTime = cond::time::from_boost(chTime); + cond::Time_t iovTime = changeTime; + if (!update and changeTime == firstTime) + iovTime = lowerLumi; + coral::Attribute const& dipValAttribute = ECALDataCursor.currentRow()[std::string("DIP_value")]; + coral::Attribute const& valueNumberAttribute = ECALDataCursor.currentRow()[std::string("VALUE_NUMBER")]; + coral::Attribute const& elementNrAttribute = ECALDataCursor.currentRow()[std::string("element_nr")]; + if (!dipValAttribute.isNull() and !valueNumberAttribute.isNull()) { + dipVal = dipValAttribute.data(); + elementNr = elementNrAttribute.data(); + value = valueNumberAttribute.data(); + if (std::isnan(value)) + value = 0.; + if (filter.process(iovTime)) { + iovMap.insert(std::make_pair(changeTime, filter.current()->first)); + for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { + LHCInfoPerFill& payload = *(it->second); + theLHCInfoPerFillImpl::setElementData(it->first, dipVal, elementNr, value, payload, initializedVectors); + } + } + //} + } + } + } + if (m_debug) { + for (auto& im : iovMap) { + edm::LogInfo(m_name) << "Found iov=" << im.first << " (" << cond::time::to_boost(im.first) << " ) moved to " + << im.second << " ( " << cond::time::to_boost(im.second) << " )"; + } + } + return ret; + } + +private: + bool m_debug; + // starting date for sampling + boost::posix_time::ptime m_startTime; + boost::posix_time::ptime m_endTime; + // sampling interval in seconds + unsigned int m_samplingInterval; + bool m_endFillMode = true; + std::string m_name; + //for reading from relational database source + std::string m_connectionString, m_ecalConnectionString; + std::string m_dipSchema, m_authpath; + std::string m_omsBaseUrl; + std::unique_ptr m_fillPayload; + std::shared_ptr m_prevPayload; + std::vector>> m_tmpBuffer; + bool m_lastPayloadEmpty = false; +}; diff --git a/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc b/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc new file mode 100644 index 0000000000000..5889c23407999 --- /dev/null +++ b/CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc @@ -0,0 +1,556 @@ +#include "CondCore/CondDB/interface/ConnectionPool.h" +#include "CondCore/CondDB/interface/Types.h" +#include "CondCore/PopCon/interface/PopConAnalyzer.h" +#include "CondCore/PopCon/interface/PopConSourceHandler.h" +#include "CondFormats/Common/interface/TimeConversions.h" +#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "CondTools/RunInfo/interface/OMSAccess.h" +#include "CoralBase/Attribute.h" +#include "CoralBase/AttributeList.h" +#include "CoralBase/AttributeSpecification.h" +#include "CoralBase/TimeStamp.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" +#include "RelationalAccess/ICursor.h" +#include "RelationalAccess/IQuery.h" +#include "RelationalAccess/ISchema.h" +#include "RelationalAccess/ISessionProxy.h" +#include +#include +#include +#include +#include +#include +#include +#include + +class LHCInfoPerLSPopConSourceHandler; + +typedef popcon::PopConAnalyzer LHCInfoPerLSPopConAnalyzer; +//define this as a plug-in +DEFINE_FWK_MODULE(LHCInfoPerLSPopConAnalyzer); + +namespace theLHCInfoPerLSImpl { + + struct LumiSectionFilter { + LumiSectionFilter(const std::vector>>& samples) + : currLow(samples.begin()), currUp(samples.begin()), end(samples.end()) { + currUp++; + } + + void reset(const std::vector>>& samples) { + currLow = samples.begin(); + currUp = samples.begin(); + currUp++; + end = samples.end(); + currentDipTime = 0; + } + + bool process(cond::Time_t dipTime) { + if (currLow == end) + return false; + bool search = false; + if (currentDipTime == 0) { + search = true; + } else { + if (dipTime == currentDipTime) + return true; + else { + cond::Time_t upper = cond::time::MAX_VAL; + if (currUp != end) + upper = currUp->first; + if (dipTime < upper && currentDipTime >= currLow->first) + return false; + else { + search = true; + } + } + } + if (search) { + while (currUp != end and currUp->first < dipTime) { + currLow++; + currUp++; + } + currentDipTime = dipTime; + return currLow != end; + } + return false; + } + + cond::Time_t currentSince() { return currLow->first; } + LHCInfoPerLS& currentPayload() { return *currLow->second; } + + std::vector>>::const_iterator current() { return currLow; } + std::vector>>::const_iterator currLow; + std::vector>>::const_iterator currUp; + std::vector>>::const_iterator end; + cond::Time_t currentDipTime = 0; + }; + + bool comparePayloads(const LHCInfoPerLS& rhs, const LHCInfoPerLS& lhs) { + if (rhs.fillNumber() != lhs.fillNumber()) + return false; + if (rhs.runNumber() != lhs.runNumber()) + return false; + if (rhs.crossingAngleX() != lhs.crossingAngleX()) + return false; + if (rhs.crossingAngleY() != lhs.crossingAngleY()) + return false; + if (rhs.betaStarX() != lhs.betaStarX()) + return false; + if (rhs.betaStarY() != lhs.betaStarY()) + return false; + return true; + } + + size_t transferPayloads(const std::vector>>& buffer, + std::map>& iovsToTransfer, + std::shared_ptr& prevPayload) { + size_t niovs = 0; + std::stringstream condIovs; + for (auto& iov : buffer) { + bool add = false; + auto payload = iov.second; + cond::Time_t since = iov.first; + if (iovsToTransfer.empty()) { + add = true; + } else { + LHCInfoPerLS& lastAdded = *iovsToTransfer.rbegin()->second; + if (!comparePayloads(lastAdded, *payload)) { + add = true; + } + } + if (add) { + niovs++; + condIovs << since << " "; + iovsToTransfer.insert(std::make_pair(since, payload)); + prevPayload = iov.second; + } + } + edm::LogInfo("transferPayloads") << "TRANSFERED COND IOVS: " << condIovs.str(); + return niovs; + } + +} // namespace theLHCInfoPerLSImpl +class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler { +public: + LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const& pset) + : m_debug(pset.getUntrackedParameter("debug", false)), + m_startTime(), + m_endTime(), + m_samplingInterval((unsigned int)pset.getUntrackedParameter("samplingInterval", 300)), + m_endFillMode(pset.getUntrackedParameter("endFill", true)), + m_name(pset.getUntrackedParameter("name", "LHCInfoPerLSPopConSourceHandler")), + m_connectionString(pset.getUntrackedParameter("connectionString", "")), + m_dipSchema(pset.getUntrackedParameter("DIPSchema", "")), + m_authpath(pset.getUntrackedParameter("authenticationPath", "")), + m_omsBaseUrl(pset.getUntrackedParameter("omsBaseUrl", "")), + m_fillPayload(), + m_prevPayload(), + m_tmpBuffer() { + if (!pset.getUntrackedParameter("startTime").empty()) { + m_startTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("startTime")); + } + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + m_endTime = now; + if (!pset.getUntrackedParameter("endTime").empty()) { + m_endTime = boost::posix_time::time_from_string(pset.getUntrackedParameter("endTime")); + if (m_endTime > now) + m_endTime = now; + } + } + //L1: try with different m_dipSchema + //L2: try with different m_name + ~LHCInfoPerLSPopConSourceHandler() override = default; + void getNewObjects() override { + //if a new tag is created, transfer fake fill from 1 to the first fill for the first time + if (tagInfo().size == 0) { + edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects"; + } else { + //check what is already inside the database + edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size + << ", last object valid since " << tagInfo().lastInterval.since << " ( " + << boost::posix_time::to_iso_extended_string( + cond::time::to_boost(tagInfo().lastInterval.since)) + << " ); from " << m_name << "::getNewObjects"; + } + + cond::Time_t lastSince = tagInfo().lastInterval.since; + if (tagInfo().isEmpty()) { + // for a new or empty tag, an empty payload should be added on top with since=1 + addEmptyPayload(1); + lastSince = 1; + } else { + edm::LogInfo(m_name) << "The last Iov in tag " << tagInfo().name << " valid since " << lastSince << "from " + << m_name << "::getNewObjects"; + } + + boost::posix_time::ptime executionTime = boost::posix_time::second_clock::local_time(); + cond::Time_t targetSince = 0; + cond::Time_t executionTimeIov = cond::time::from_boost(executionTime); + if (!m_startTime.is_not_a_date_time()) { + targetSince = cond::time::from_boost(m_startTime); + } + if (lastSince > targetSince) + targetSince = lastSince; + + edm::LogInfo(m_name) << "Starting sampling at " + << boost::posix_time::to_simple_string(cond::time::to_boost(targetSince)); + + //retrieve the data from the relational database source + cond::persistency::ConnectionPool connection; + //configure the connection + if (m_debug) { + connection.setMessageVerbosity(coral::Debug); + } else { + connection.setMessageVerbosity(coral::Error); + } + connection.setAuthenticationPath(m_authpath); + connection.configure(); + //create the sessions + cond::persistency::Session session = connection.createSession(m_connectionString, false); + // fetch last payload when available + if (!tagInfo().lastInterval.payloadId.empty()) { + cond::persistency::Session session3 = dbSession(); + session3.transaction().start(true); + m_prevPayload = session3.fetchPayload(tagInfo().lastInterval.payloadId); + session3.transaction().commit(); + + // find startFillTime and endFillTime of the most recent fill already saved in the tag + if (m_prevPayload->fillNumber() != 0) { + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + query->addOutputVar("end_time"); + query->filterEQ("fill_number", m_prevPayload->fillNumber()); + bool foundFill = query->execute(); + if (foundFill) { + auto result = query->result(); + + if (!result.empty()) { + auto endFillTime = (*result.begin()).get("end_time"); + m_prevEndFillTime = cond::time::from_boost(endFillTime); + auto startFillTime = (*result.begin()).get("start_time"); + m_prevStartFillTime = cond::time::from_boost(startFillTime); + } else { + foundFill = false; + } + } + if (!foundFill) { + edm::LogError(m_name) << "Could not find end time of fill #" << m_prevPayload->fillNumber(); + } + } else { + m_prevEndFillTime = 0; + m_prevStartFillTime = 0; + } + } + + while (true) { + if (targetSince >= executionTimeIov) { + edm::LogInfo(m_name) << "Sampling ended at the time " + << boost::posix_time::to_simple_string(cond::time::to_boost(executionTimeIov)); + break; + } + boost::posix_time::ptime targetTime = cond::time::to_boost(targetSince); + boost::posix_time::ptime startSampleTime; + boost::posix_time::ptime endSampleTime; + + cond::OMSService oms; + oms.connect(m_omsBaseUrl); + auto query = oms.query("fills"); + + if (!m_endFillMode and m_prevPayload->fillNumber() and m_prevEndFillTime == 0ULL) { + // continue processing unfinished fill with some payloads already in the tag + edm::LogInfo(m_name) << "Searching started fill #" << m_prevPayload->fillNumber(); + query->filterEQ("fill_number", m_prevPayload->fillNumber()); + bool foundFill = query->execute(); + if (foundFill) + foundFill = makeFillPayload(m_fillPayload, query->result()); + if (!foundFill) { + edm::LogError(m_name) << "Could not find fill #" << m_prevPayload->fillNumber(); + break; + } + startSampleTime = cond::time::to_boost(lastSince); + } else { + edm::LogInfo(m_name) << "Searching new fill after " << boost::posix_time::to_simple_string(targetTime); + query->filterNotNull("start_stable_beam").filterNotNull("fill_number"); + if (targetTime > cond::time::to_boost(m_prevStartFillTime)) { + query->filterGE("start_time", targetTime); + } else { + query->filterGT("start_time", targetTime); + } + + query->filterLT("start_time", m_endTime); + if (m_endFillMode) + query->filterNotNull("end_time"); + bool foundFill = query->execute(); + if (foundFill) + foundFill = makeFillPayload(m_fillPayload, query->result()); + if (!foundFill) { + edm::LogInfo(m_name) << "No fill found - END of job."; + break; + } + startSampleTime = cond::time::to_boost(m_startFillTime); + } + + unsigned short lhcFill = m_fillPayload->fillNumber(); + bool ongoingFill = m_endFillTime == 0ULL; + if (ongoingFill) { + edm::LogInfo(m_name) << "Found ongoing fill " << lhcFill << " created at " + << cond::time::to_boost(m_startFillTime); + endSampleTime = executionTime; + targetSince = executionTimeIov; + } else { + edm::LogInfo(m_name) << "Found fill " << lhcFill << " created at " << cond::time::to_boost(m_startFillTime) + << " ending at " << cond::time::to_boost(m_endFillTime); + endSampleTime = cond::time::to_boost(m_endFillTime); + targetSince = m_endFillTime; + } + + if (m_endFillMode || ongoingFill) { + getLumiData(oms, lhcFill, startSampleTime, endSampleTime); + + if (!m_tmpBuffer.empty()) { + boost::posix_time::ptime flumiStart = cond::time::to_boost(m_tmpBuffer.front().first); + boost::posix_time::ptime flumiStop = cond::time::to_boost(m_tmpBuffer.back().first); + edm::LogInfo(m_name) << "First buffered lumi starts at " << flumiStart << " last lumi starts at " + << flumiStop; + session.transaction().start(true); + getCTTPSData(session, startSampleTime, endSampleTime); + session.transaction().commit(); + } + } + + size_t niovs = theLHCInfoPerLSImpl::transferPayloads(m_tmpBuffer, m_iovs, m_prevPayload); + edm::LogInfo(m_name) << "Added " << niovs << " iovs within the Fill time"; + if (niovs) { + m_prevEndFillTime = m_endFillTime; + m_prevStartFillTime = m_startFillTime; + } + m_tmpBuffer.clear(); + if (m_prevPayload->fillNumber() and !ongoingFill) + addEmptyPayload(m_endFillTime); + } + } + std::string id() const override { return m_name; } + + static constexpr unsigned int kLumisectionsQueryLimit = 4000; + +private: + void addEmptyPayload(cond::Time_t iov) { + bool add = false; + if (m_iovs.empty()) { + if (!m_lastPayloadEmpty) + add = true; + } else { + auto lastAdded = m_iovs.rbegin()->second; + if (lastAdded->fillNumber() != 0) { + add = true; + } + } + if (add) { + auto newPayload = std::make_shared(); + m_iovs.insert(std::make_pair(iov, newPayload)); + m_prevPayload = newPayload; + m_prevEndFillTime = 0; + m_prevStartFillTime = 0; + edm::LogInfo(m_name) << "Added empty payload with IOV" << iov << " ( " + << boost::posix_time::to_iso_extended_string(cond::time::to_boost(iov)) << " )"; + } + } + + bool makeFillPayload(std::unique_ptr& targetPayload, const cond::OMSServiceResult& queryResult) { + bool ret = false; + if (!queryResult.empty()) { + auto row = *queryResult.begin(); + auto currentFill = row.get("fill_number"); + m_startFillTime = cond::time::from_boost(row.get("start_time")); + m_endFillTime = cond::time::from_boost(row.get("end_time")); + targetPayload = std::make_unique(); + targetPayload->setFillNumber(currentFill); + ret = true; + } + return ret; + } + + void addPayloadToBuffer(cond::OMSServiceResultRef& row) { + auto lumiTime = row.get("start_time"); + LHCInfoPerLS* thisLumiSectionInfo = new LHCInfoPerLS(*m_fillPayload); + m_tmpBuffer.emplace_back(std::make_pair(cond::time::from_boost(lumiTime), thisLumiSectionInfo)); + } + + size_t bufferAllLS(const cond::OMSServiceResult& queryResult) { + for (auto r : queryResult) { + addPayloadToBuffer(r); + } + return queryResult.size(); + } + + size_t bufferFirstStableBeamLS(const cond::OMSServiceResult& queryResult) { + for (auto r : queryResult) { + if (r.get("beams_stable") == "true") { + addPayloadToBuffer(r); + edm::LogInfo(m_name) << "Buffered first lumisection of stable beam: LS: " + << r.get("lumisection_number") + << " run: " << r.get("run_number"); + return 1; + } + } + return 0; + } + + size_t getLumiData(const cond::OMSService& oms, + unsigned short fillId, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + auto query = oms.query("lumisections"); + query->addOutputVars({"start_time", "run_number", "beams_stable", "lumisection_number"}); + query->filterEQ("fill_number", fillId); + query->filterGT("start_time", beginFillTime).filterLT("start_time", endFillTime); + query->limit(kLumisectionsQueryLimit); + size_t nlumi = 0; + if (query->execute()) { + auto queryResult = query->result(); + if (m_endFillMode) { + nlumi = bufferAllLS(queryResult); + } else if (!queryResult.empty()) { + auto newestPayload = queryResult.back(); + if (newestPayload.get("beams_stable") == "true") { + addPayloadToBuffer(newestPayload); + nlumi = 1; + edm::LogInfo(m_name) << "Buffered most recent lumisection:" + << " LS: " << newestPayload.get("lumisection_number") + << " run: " << newestPayload.get("run_number"); + } + } + edm::LogInfo(m_name) << "Found " << queryResult.size() << " lumisections during the fill " << fillId; + } else { + edm::LogInfo(m_name) << "OMS query for lumisections of fill " << fillId << "failed, status:" << query->status(); + } + return nlumi; + } + bool getCTTPSData(cond::persistency::Session& session, + const boost::posix_time::ptime& beginFillTime, + const boost::posix_time::ptime& endFillTime) { + //run the fifth query against the CTPPS schema + //Initializing the CMS_CTP_CTPPS_COND schema. + coral::ISchema& CTPPS = session.coralSession().schema("CMS_PPS_SPECT_COND"); + //execute query for CTPPS Data + std::unique_ptr CTPPSDataQuery(CTPPS.newQuery()); + //FROM clause + CTPPSDataQuery->addToTableList(std::string("PPS_LHC_MACHINE_PARAMS")); + //SELECT clause + CTPPSDataQuery->addToOutputList(std::string("DIP_UPDATE_TIME")); + CTPPSDataQuery->addToOutputList(std::string("LUMI_SECTION")); + CTPPSDataQuery->addToOutputList(std::string("RUN_NUMBER")); + CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_X_URAD")); + CTPPSDataQuery->addToOutputList(std::string("XING_ANGLE_P5_Y_URAD")); + CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_X_M")); + CTPPSDataQuery->addToOutputList(std::string("BETA_STAR_P5_Y_M")); + //WHERE CLAUSE + coral::AttributeList CTPPSDataBindVariables; + CTPPSDataBindVariables.extend(std::string("beginFillTime")); + CTPPSDataBindVariables.extend(std::string("endFillTime")); + CTPPSDataBindVariables[std::string("beginFillTime")].data() = coral::TimeStamp(beginFillTime); + CTPPSDataBindVariables[std::string("endFillTime")].data() = coral::TimeStamp(endFillTime); + std::string conditionStr = std::string("DIP_UPDATE_TIME>= :beginFillTime and DIP_UPDATE_TIME< :endFillTime"); + CTPPSDataQuery->setCondition(conditionStr, CTPPSDataBindVariables); + //ORDER BY clause + CTPPSDataQuery->addToOrderList(std::string("DIP_UPDATE_TIME")); + //define query output + coral::AttributeList CTPPSDataOutput; + CTPPSDataOutput.extend(std::string("DIP_UPDATE_TIME")); + CTPPSDataOutput.extend(std::string("LUMI_SECTION")); + CTPPSDataOutput.extend(std::string("RUN_NUMBER")); + CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_X_URAD")); + CTPPSDataOutput.extend(std::string("XING_ANGLE_P5_Y_URAD")); + CTPPSDataOutput.extend(std::string("BETA_STAR_P5_X_M")); + CTPPSDataOutput.extend(std::string("BETA_STAR_P5_Y_M")); + CTPPSDataQuery->defineOutput(CTPPSDataOutput); + //execute the query + coral::ICursor& CTPPSDataCursor = CTPPSDataQuery->execute(); + cond::Time_t dipTime = 0; + unsigned int lumiSection = 0; + cond::Time_t runNumber = 0; + float crossingAngleX = 0., betaStarX = 0.; + float crossingAngleY = 0., betaStarY = 0.; + + bool ret = false; + theLHCInfoPerLSImpl::LumiSectionFilter filter(m_tmpBuffer); + while (CTPPSDataCursor.next()) { + if (m_debug) { + std::ostringstream CTPPS; + CTPPSDataCursor.currentRow().toOutputStream(CTPPS); + } + coral::Attribute const& dipTimeAttribute = CTPPSDataCursor.currentRow()[std::string("DIP_UPDATE_TIME")]; + if (!dipTimeAttribute.isNull()) { + dipTime = cond::time::from_boost(dipTimeAttribute.data().time()); + if (filter.process(dipTime)) { + ret = true; + coral::Attribute const& lumiSectionAttribute = CTPPSDataCursor.currentRow()[std::string("LUMI_SECTION")]; + if (!lumiSectionAttribute.isNull()) { + lumiSection = lumiSectionAttribute.data(); + } + coral::Attribute const& runNumberAttribute = CTPPSDataCursor.currentRow()[std::string("RUN_NUMBER")]; + if (!runNumberAttribute.isNull()) { + runNumber = runNumberAttribute.data(); + } + coral::Attribute const& crossingAngleXAttribute = + CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_X_URAD")]; + if (!crossingAngleXAttribute.isNull()) { + crossingAngleX = crossingAngleXAttribute.data(); + } + coral::Attribute const& crossingAngleYAttribute = + CTPPSDataCursor.currentRow()[std::string("XING_ANGLE_P5_Y_URAD")]; + if (!crossingAngleYAttribute.isNull()) { + crossingAngleY = crossingAngleYAttribute.data(); + } + coral::Attribute const& betaStarXAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_X_M")]; + if (!betaStarXAttribute.isNull()) { + betaStarX = betaStarXAttribute.data(); + } + coral::Attribute const& betaStarYAttribute = CTPPSDataCursor.currentRow()[std::string("BETA_STAR_P5_Y_M")]; + if (!betaStarYAttribute.isNull()) { + betaStarY = betaStarYAttribute.data(); + } + for (auto it = filter.current(); it != m_tmpBuffer.end(); it++) { + // set the current values to all of the payloads of the lumi section samples after the current since + LHCInfoPerLS& payload = *(it->second); + payload.setCrossingAngleX(crossingAngleX); + payload.setCrossingAngleY(crossingAngleY); + payload.setBetaStarX(betaStarX); + payload.setBetaStarY(betaStarY); + payload.setLumiSection(lumiSection); + payload.setRunNumber(runNumber); + } + } + } + } + return ret; + } + +private: + bool m_debug; + // starting date for sampling + boost::posix_time::ptime m_startTime; + boost::posix_time::ptime m_endTime; + // sampling interval in seconds + unsigned int m_samplingInterval; + bool m_endFillMode = true; + std::string m_name; + //for reading from relational database source + std::string m_connectionString, m_ecalConnectionString; + std::string m_dipSchema, m_authpath; + std::string m_omsBaseUrl; + std::unique_ptr m_fillPayload; + std::shared_ptr m_prevPayload; + cond::Time_t m_startFillTime; + cond::Time_t m_endFillTime; + cond::Time_t m_prevEndFillTime; + cond::Time_t m_prevStartFillTime; + std::vector>> m_tmpBuffer; + bool m_lastPayloadEmpty = false; +}; diff --git a/CondTools/RunInfo/plugins/LumiSectionFilter.h b/CondTools/RunInfo/plugins/LumiSectionFilter.h new file mode 100644 index 0000000000000..6b40b3727d6d5 --- /dev/null +++ b/CondTools/RunInfo/plugins/LumiSectionFilter.h @@ -0,0 +1,59 @@ +#include "CondFormats/Common/interface/TimeConversions.h" +#include +#include + +template +struct LumiSectionFilter { + LumiSectionFilter(const std::vector>>& samples) + : currLow(samples.begin()), currUp(samples.begin()), end(samples.end()) { + currUp++; + } + + void reset(const std::vector>>& samples) { + currLow = samples.begin(); + currUp = samples.begin(); + currUp++; + end = samples.end(); + currentDipTime = 0; + } + + bool process(cond::Time_t dipTime) { + if (currLow == end) + return false; + bool search = false; + if (currentDipTime == 0) { + search = true; + } else { + if (dipTime == currentDipTime) + return true; + else { + cond::Time_t upper = cond::time::MAX_VAL; + if (currUp != end) + upper = currUp->first; + if (dipTime < upper && currentDipTime >= currLow->first) + return false; + else { + search = true; + } + } + } + if (search) { + while (currUp != end and currUp->first < dipTime) { + currLow++; + currUp++; + } + currentDipTime = dipTime; + return currLow != end; + } + return false; + } + + cond::Time_t currentSince() { return currLow->first; } + T& currentPayload() { return *currLow->second; } + + typename std::vector>>::const_iterator current() { return currLow; } + typename std::vector>>::const_iterator currLow; + typename std::vector>>::const_iterator currUp; + typename std::vector>>::const_iterator end; + cond::Time_t currentDipTime = 0; +}; diff --git a/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer.py b/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer.py new file mode 100644 index 0000000000000..e4b6dd762df21 --- /dev/null +++ b/CondTools/RunInfo/python/LHCInfoPerFillPopConAnalyzer.py @@ -0,0 +1,114 @@ +import socket +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +process = cms.Process("LHCInfoPerFillPopulator") +from CondCore.CondDB.CondDB_cfi import * +#process.load("CondCore.DBCommon.CondDBCommon_cfi") +#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db' +#process.CondDBCommon.DBParameters.authenticationPath = '.' +#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1) + +sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R' +if socket.getfqdn().find('.cms') != -1: + sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R' + +options = VarParsing.VarParsing() +options.register( 'mode' + , None # Required parameter + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "The mode the fills are going to be process and the data gathered. Accepted values: duringFill endFill" + ) +options.register( 'destinationConnection' + , 'sqlite_file:lhcinfo_pop_test.db' #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "Connection string to the DB where payloads will be possibly written." + ) +options.register( 'targetConnection' + , '' #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Connection string to the target DB: + if not empty (default), this provides the latest IOV and payloads to compare; + it is the DB where payloads should be finally uploaded.""" + ) +options.register( 'tag' + , 'LHCInfoPerFill_PopCon_test' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "Tag written in destinationConnection and finally appended in targetConnection." + ) +options.register( 'messageLevel' + , 0 #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.int + , "Message level; default to 0" + ) +options.register( 'startTime' + , '2021-09-10 03:10:18.000' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Date and time of the start of processing: + processes only fills starting at startTime or later""" + ) +options.register( 'endTime' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Date and time of the start of processing: + processes only fills starting before endTime; + default to empty string which sets no restriction""" + ) +options.parseArguments() +if options.mode is None: + raise ValueError("mode argument not provided. Supported modes are: duringFill endFill") +if options.mode not in ("duringFill", "endFill"): + raise ValueError("Wrong mode argument. Supported modes are: duringFill endFill") + +CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) ) +CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel ) + +process.MessageLogger = cms.Service("MessageLogger", + cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')), + destinations = cms.untracked.vstring('cout') + ) + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBConnection, + timetype = cms.untracked.string('timestamp'), + toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerFillRcd'), + tag = cms.string( options.tag ) + ) + ) + ) + +process.Test1 = cms.EDAnalyzer("LHCInfoPerFillPopConAnalyzer", + SinceAppendMode = cms.bool(True), + record = cms.string('LHCInfoPerFillRcd'), + name = cms.untracked.string('LHCInfo'), + Source = cms.PSet(fill = cms.untracked.uint32(6417), + startTime = cms.untracked.string(options.startTime), + endTime = cms.untracked.string(options.endTime), + samplingInterval = cms.untracked.uint32( 600 ), + endFill = cms.untracked.bool(True if options.mode == "endFill" else False), + name = cms.untracked.string("LHCInfoPerFillPopConSourceHandler"), + connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"), + ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"), + DIPSchema = cms.untracked.string("CMS_BEAM_COND"), + omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"), + authenticationPath = cms.untracked.string(""), + debug=cms.untracked.bool(False) + ), + loggingOn = cms.untracked.bool(True), + IsDestDbCheckedInQueryLog = cms.untracked.bool(False) + ) + +process.p = cms.Path(process.Test1) diff --git a/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer.py b/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer.py new file mode 100644 index 0000000000000..522aedae4ec1c --- /dev/null +++ b/CondTools/RunInfo/python/LHCInfoPerLSPopConAnalyzer.py @@ -0,0 +1,113 @@ +import socket +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +process = cms.Process("LHCInfoPerLSPopulator") +from CondCore.CondDB.CondDB_cfi import * +#process.load("CondCore.DBCommon.CondDBCommon_cfi") +#process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db' +#process.CondDBCommon.DBParameters.authenticationPath = '.' +#process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1) + +sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R' +if socket.getfqdn().find('.cms') != -1: + sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R' + +options = VarParsing.VarParsing() +options.register( 'mode' + , None # Required parameter + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "The mode the fills are going to be process and the data gathered. Accepted values: duringFill endFill" + ) +options.register( 'destinationConnection' + , 'sqlite_file:lhcinfo_pop_test.db' #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "Connection string to the DB where payloads will be possibly written." + ) +options.register( 'targetConnection' + , '' #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Connection string to the target DB: + if not empty (default), this provides the latest IOV and payloads to compare; + it is the DB where payloads should be finally uploaded.""" + ) +options.register( 'tag' + , 'LHCInfoPerLS_PopCon_test' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , "Tag written in destinationConnection and finally appended in targetConnection." + ) +options.register( 'messageLevel' + , 0 #default value + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.int + , "Message level; default to 0" + ) +options.register( 'startTime' + , '2021-09-10 03:10:18.000' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Date and time of the start of processing: + processes only fills starting at startTime or later""" + ) +options.register( 'endTime' + , '' + , VarParsing.VarParsing.multiplicity.singleton + , VarParsing.VarParsing.varType.string + , """Date and time of the start of processing: + processes only fills starting before endTime; + default to empty string which sets no restriction""" + ) +options.parseArguments() +if options.mode is None: + raise ValueError("mode argument not provided. Supported modes are: duringFill endFill") +if options.mode not in ("duringFill", "endFill"): + raise ValueError("Wrong mode argument. Supported modes are: duringFill endFill") + +CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) ) +CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel ) + +process.MessageLogger = cms.Service("MessageLogger", + cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')), + destinations = cms.untracked.vstring('cout') + ) + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBConnection, + timetype = cms.untracked.string('timestamp'), + toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'), + tag = cms.string( options.tag ) + ) + ) + ) + +process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer", + SinceAppendMode = cms.bool(True), + record = cms.string('LHCInfoPerLSRcd'), + name = cms.untracked.string('LHCInfo'), + Source = cms.PSet(fill = cms.untracked.uint32(6417), + startTime = cms.untracked.string(options.startTime), + endTime = cms.untracked.string(options.endTime), + samplingInterval = cms.untracked.uint32( 600 ), + endFill = cms.untracked.bool(True if options.mode == "endFill" else False), + name = cms.untracked.string("LHCInfoPerLSPopConSourceHandler"), + connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"), + DIPSchema = cms.untracked.string("CMS_BEAM_COND"), + omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"), + authenticationPath = cms.untracked.string(""), + debug=cms.untracked.bool(False) + ), + loggingOn = cms.untracked.bool(True), + IsDestDbCheckedInQueryLog = cms.untracked.bool(False) + ) + +process.p = cms.Path(process.Test1) diff --git a/CondTools/RunInfo/src/OMSAccess.cc b/CondTools/RunInfo/src/OMSAccess.cc index 4a699c955428e..cc033e42ed6b8 100644 --- a/CondTools/RunInfo/src/OMSAccess.cc +++ b/CondTools/RunInfo/src/OMSAccess.cc @@ -33,6 +33,16 @@ namespace cond { OMSServiceResultIterator OMSServiceResult::end() const { return OMSServiceResultIterator(m_data->end()); } + OMSServiceResultRef OMSServiceResult::front() const { + auto& attributeList = m_data->front().second.get_child("attributes"); + return OMSServiceResultRef(&attributeList); + } + + OMSServiceResultRef OMSServiceResult::back() const { + auto& attributeList = m_data->back().second.get_child("attributes"); + return OMSServiceResultRef(&attributeList); + } + size_t OMSServiceResult::parseData(const std::string& data) { m_data = nullptr; std::stringstream sout; diff --git a/CondTools/RunInfo/test/BuildFile.xml b/CondTools/RunInfo/test/BuildFile.xml index 3af9ead5f1a2d..0ab497a493183 100644 --- a/CondTools/RunInfo/test/BuildFile.xml +++ b/CondTools/RunInfo/test/BuildFile.xml @@ -5,3 +5,6 @@ + + + diff --git a/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh b/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh new file mode 100755 index 0000000000000..e503999330647 --- /dev/null +++ b/CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +SCRIPTS_DIR=${CMSSW_BASE}/src/CondTools/RunInfo/python + +function die { echo Failure $1: status $2 ; exit $2 ; } + +assert_equal() { + expected="$1" + actual="$2" + message="$3" + + if [ "$expected" != "$actual" ]; then + die "$message: Expected $expected, but got $actual" 1 + fi +} + +function assert_found_fills { + log_file="$1" + script_name="$2" + shift 2 + for fill_nr in "$@"; do + if ! grep -q "Found fill $fill_nr" "$log_file"; then + die "$script_name didn't find fill $fill_nr" 1 # TODO FIX + fi + done +} + +rm -f lhcinfo_pop_unit_test.db + +echo "testing LHCInfoPerFillPopConAnalyzer in EndFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" +cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer.py mode=endFill \ + destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ + startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ + tag=fill_end_test > fill_end_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer.py mode=endFill" $? +assert_equal 7 `cat fill_end_test.log | grep -E '^Since ' | \ + wc -l` "LHCInfoPerFillPopConAnalyzer in EndFill mode written wrong number of payloads" +assert_found_fills fill_end_test.log "LHCInfoPerFillPopConAnalyzer in EndFill mode" 8307 8309 + +echo "testing LHCInfoPerLSPopConAnalyzerEndFill in endFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" +cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer.py mode=endFill \ + destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ + startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ + tag=ls_end_test > ls_end_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer.py mode=endFill" $? +assert_equal 169 `cat ls_end_test.log | grep -E '^Since ' | \ + wc -l` "LHCInfoPerLSPopConAnalyzerEndFill in endFill mode written wrong number of payloads" +assert_found_fills ls_end_test.log "LHCInfoPerLSPopConAnalyzerEndFill in endFill mode" 8307 8309 + +echo "testing LHCInfoPerFillPopConAnalyzer in DuringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" +cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer.py mode=duringFill \ + destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ + startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ + tag=fill_during_test > fill_during_test.log || die "cmsRun LHCInfoPerFillPopConAnalyzer.py" $? +assert_equal 1 `cat fill_during_test.log | grep -E '^Since ' | \ + wc -l` "LHCInfoPerFillPopConAnalyzer in DuringFill written wrong number of payloads" +assert_found_fills fill_during_test.log "LHCInfoPerFillPopConAnalyzer in DuringFill" 8307 8309 + +echo "testing LHCInfoPerLSPopConAnalyzerEndFill in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\"" +cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer.py mode=duringFill \ + destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \ + startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \ + tag=ls_during_test > ls_during_test.log || die "cmsRun LHCInfoPerLSPopConAnalyzer.py mode=duringFill" $? +assert_equal 1 `cat ls_during_test.log | grep -E '^Since ' | \ + wc -l` "LHCInfoPerLSPopConAnalyzerEndFill in duringFill mode written wrong number of payloads" +assert_found_fills ls_during_test.log "LHCInfoPerLSPopConAnalyzerEndFill in duringFill mode" 8307 8309 \ No newline at end of file diff --git a/CondTools/SiPixel/test/BuildFile.xml b/CondTools/SiPixel/test/BuildFile.xml index fca130d33840d..af3d4ccb341bb 100644 --- a/CondTools/SiPixel/test/BuildFile.xml +++ b/CondTools/SiPixel/test/BuildFile.xml @@ -1,10 +1,2 @@ - - - - - - - - - - + + diff --git a/CondTools/SiPixel/test/createTestDBObjects.sh b/CondTools/SiPixel/test/createTestDBObjects.sh index 3bcbce6b5c5b1..f794dda371c0b 100755 --- a/CondTools/SiPixel/test/createTestDBObjects.sh +++ b/CondTools/SiPixel/test/createTestDBObjects.sh @@ -5,69 +5,69 @@ function die { echo $1: status $2 ; exit $2; } echo -e "TESTING Pixel CPE DB codes ..." echo -e "TESTING Pixel 1D Template DB code ..." -cmsRun ${LOCAL_TEST_DIR}/SiPixelTemplateDBObjectUploader_cfg.py MagField=0.0 Fullname=SiPixelTemplateDBObject_phase1_0T_mc_BoR3_v1_bugfix Map=${LOCAL_TEST_DIR}/../data/phaseI_mapping.csv TemplateFilePath=CalibTracker/SiPixelESProducers/data/SiPixelTemplateDBObject_0T_phase1_BoR3_v1 || die "Failure running SiPixelTemplateDBObjectUploader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelTemplateDBObjectUploader_cfg.py MagField=0.0 Fullname=SiPixelTemplateDBObject_phase1_0T_mc_BoR3_v1_bugfix Map=${SCRAM_TEST_PATH}/../data/phaseI_mapping.csv TemplateFilePath=CalibTracker/SiPixelESProducers/data/SiPixelTemplateDBObject_0T_phase1_BoR3_v1 || die "Failure running SiPixelTemplateDBObjectUploader_cfg.py" $? echo -e "TESTING Pixel 1D GenErr DB code ..." -cmsRun ${LOCAL_TEST_DIR}/SiPixelGenErrorDBObjectUploader_cfg.py MagField=0.0 Fullname=SiPixelGenErrorDBObject_phase1_0T_mc_BoR3_v1_bugfix Map=${LOCAL_TEST_DIR}/../data/phaseI_mapping.csv GenErrFilePath=CalibTracker/SiPixelESProducers/data/SiPixelTemplateDBObject_0T_phase1_BoR3_v1 || die "Failure running SiPixelGenErrorDBObjectUploader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelGenErrorDBObjectUploader_cfg.py MagField=0.0 Fullname=SiPixelGenErrorDBObject_phase1_0T_mc_BoR3_v1_bugfix Map=${SCRAM_TEST_PATH}/../data/phaseI_mapping.csv GenErrFilePath=CalibTracker/SiPixelESProducers/data/SiPixelTemplateDBObject_0T_phase1_BoR3_v1 || die "Failure running SiPixelGenErrorDBObjectUploader_cfg.py" $? echo -e "TESTING Pixel 1D Template DB code for Phase-2 ..." -cmsRun ${LOCAL_TEST_DIR}/SiPixelTemplateDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${LOCAL_TEST_DIR}/../data/phase2_T21_mapping.csv geometry=T21 TemplateFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc || die "Failure running SiPixelTemplateDBObjectUploader_Phase2_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelTemplateDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${SCRAM_TEST_PATH}/../data/phase2_T21_mapping.csv geometry=T21 TemplateFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc || die "Failure running SiPixelTemplateDBObjectUploader_Phase2_cfg.py" $? echo -e "TESTING Pixel 1D GenErr DB code for Phase-2 ..." -cmsRun ${LOCAL_TEST_DIR}/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${LOCAL_TEST_DIR}/../data/phase2_T21_mapping.csv geometry=T21 GenErrFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc || die "Failure running SiPixelGenErrorDBObjectUploader_Phase2_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelGenErrorDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${SCRAM_TEST_PATH}/../data/phase2_T21_mapping.csv geometry=T21 GenErrFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc || die "Failure running SiPixelGenErrorDBObjectUploader_Phase2_cfg.py" $? echo -e "TESTING Pixel 2D Template DB code for Phase-2 ..." -cmsRun ${LOCAL_TEST_DIR}/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${LOCAL_TEST_DIR}/../data/phase2_T21_mapping_den.csv TemplateFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc denominator=True || die "Failure running SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py MagField=3.8 Version=1 Append=mc_25x100_IT615 Map=${SCRAM_TEST_PATH}/../data/phase2_T21_mapping_den.csv TemplateFilePath=CalibTracker/SiPixelESProducers/data/Phase2_IT_v6.1.5_25x100_irradiated_v2_mc denominator=True || die "Failure running SiPixel2DTemplateDBObjectUploader_Phase2_cfg.py" $? echo -e "TESTING SiPixelVCal DB codes ... \n\n" echo -e "TESTING Writing SiPixelVCal DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelVCalDB_cfg.py || die "Failure running SiPixelVCalDB_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelVCalDB_cfg.py || die "Failure running SiPixelVCalDB_cfg.py" $? echo -e "TESTING Reading SiPixelVCal DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelVCalReader_cfg.py || die "Failure running SiPixelVCalReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelVCalReader_cfg.py || die "Failure running SiPixelVCalReader_cfg.py" $? echo -e "TESTING SiPixelLorentzAngle DB codes ... \n\n" echo -e "TESTING Writing SiPixelLorentzAngle DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelLorentzAngleDB_cfg.py || die "Failure running SiPixelLorentzAngleDB_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelLorentzAngleDB_cfg.py || die "Failure running SiPixelLorentzAngleDB_cfg.py" $? echo -e "TESTING Reading SiPixelLorentzAngle DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelLorentzAngleReader_cfg.py || die "Failure running SiPixelLorentzAngleReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelLorentzAngleReader_cfg.py || die "Failure running SiPixelLorentzAngleReader_cfg.py" $? echo -e "TESTING SiPixelDynamicInefficiency DB codes ... \n\n" echo -e "TESTING Writing SiPixelDynamicInefficiency DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelDynamicInefficiencyDB_cfg.py || die "Failure running SiPixelDynamicInefficiencyDB_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelDynamicInefficiencyDB_cfg.py || die "Failure running SiPixelDynamicInefficiencyDB_cfg.py" $? echo -e "TESTING Reading SiPixelDynamicInefficiency DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelDynamicInefficiencyReader_cfg.py || die "Failure running SiPixelDynamicInefficiencyReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelDynamicInefficiencyReader_cfg.py || die "Failure running SiPixelDynamicInefficiencyReader_cfg.py" $? echo -e "TESTING SiPixelGain Scaling DB codes ... \n\n" echo -e "TESTING Writing Scaled SiPixel Gain DB Object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelGainCalibScaler_cfg.py firstRun=278869 maxEvents=12000 || die "Failure running SiPixelGainCalibScaler_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelGainCalibScaler_cfg.py firstRun=278869 maxEvents=12000 || die "Failure running SiPixelGainCalibScaler_cfg.py" $? echo -e "TESTING SiPixelQuality DB codes ... \n\n" echo -e "TESTING Writing SiPixelQuality DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelBadModuleByHandBuilder_cfg.py || die "Failure running SiPixelBadModuleByHandBuilder_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelBadModuleByHandBuilder_cfg.py || die "Failure running SiPixelBadModuleByHandBuilder_cfg.py" $? echo -e "TESTING Reading SiPixelQuality DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelBadModuleReader_cfg.py || die "Failure running SiPixelBadModuleReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelBadModuleReader_cfg.py || die "Failure running SiPixelBadModuleReader_cfg.py" $? echo -e "TESTING SiPixelQualityProbabilities codes ...\n\n" echo -e "TESTING Writing SiPixelQualityProbabilities DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelQualityProbabilitiesTestWriter_cfg.py || die "Failure running SiPixelQualityProbabilitiesTestWriter_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelQualityProbabilitiesTestWriter_cfg.py || die "Failure running SiPixelQualityProbabilitiesTestWriter_cfg.py" $? echo -e "TESTING Reading SiPixelQualityProbabilities DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelQualityProbabilitiesTestReader_cfg.py || die "Failure running SiPixelQualityProbabilitiesTestReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelQualityProbabilitiesTestReader_cfg.py || die "Failure running SiPixelQualityProbabilitiesTestReader_cfg.py" $? echo -e "TESTING SiPixelFEDChannelContainer codes ...\n\n" echo -e "TESTING Writing SiPixelFEDChannelContainer DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/FastSiPixelFEDChannelContainerFromQuality_cfg.py || die "Failure running FastSiPixelFEDChannelContainerFromQuality_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/FastSiPixelFEDChannelContainerFromQuality_cfg.py || die "Failure running FastSiPixelFEDChannelContainerFromQuality_cfg.py" $? echo -e "TESTING Reading SiPixelFEDChannelContainer DB object ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelFEDChannelContainerTestReader_cfg.py || die "Failure running SiPixelFEDChannelContainerTestReader_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelFEDChannelContainerTestReader_cfg.py || die "Failure running SiPixelFEDChannelContainerTestReader_cfg.py" $? diff --git a/CondTools/SiPixel/test/testPixelDBs.cpp b/CondTools/SiPixel/test/testPixelDBs.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/SiPixel/test/testPixelDBs.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondTools/SiPixel/test/testSiPixelGainCalibrationHandlers.sh b/CondTools/SiPixel/test/testSiPixelGainCalibrationHandlers.sh index 0f587848b9385..161fc5e130339 100755 --- a/CondTools/SiPixel/test/testSiPixelGainCalibrationHandlers.sh +++ b/CondTools/SiPixel/test/testSiPixelGainCalibrationHandlers.sh @@ -9,7 +9,7 @@ if [ "${SCRAM_TEST_NAME}" != "" ] ; then cd ${SCRAM_TEST_NAME} fi -for entry in "${LOCAL_TEST_DIR}/"SiPixelCondObj*Reader_cfg.py +for entry in "${SCRAM_TEST_PATH}/"SiPixelCondObj*Reader_cfg.py do echo "===== Test \"cmsRun $entry \" ====" (cmsRun $entry) || die "Failure using cmsRun $entry" $? @@ -18,6 +18,6 @@ done echo -e " Done with the readers \n\n" echo -e "TESTING Reject Noisy and Dead ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py || die "Failure running SiPixelGainCalibrationRejectNoisyAndDead_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/SiPixelGainCalibrationRejectNoisyAndDead_cfg.py || die "Failure running SiPixelGainCalibrationRejectNoisyAndDead_cfg.py" $? echo -e " Done with the test \n\n" diff --git a/CondTools/SiStrip/plugins/SiStripNoisesAndBadCompsChecker.cc b/CondTools/SiStrip/plugins/SiStripNoisesAndBadCompsChecker.cc new file mode 100644 index 0000000000000..dbf3ec589add6 --- /dev/null +++ b/CondTools/SiStrip/plugins/SiStripNoisesAndBadCompsChecker.cc @@ -0,0 +1,134 @@ +// system includes +#include +#include + +// user includes +#include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" +#include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "DataFormats/SiStripCommon/interface/SiStripConstants.h" /* for STRIPS_PER_APV*/ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/Exception.h" + +class SiStripNoisesAndBadCompsChecker : public edm::one::EDAnalyzer { +public: + explicit SiStripNoisesAndBadCompsChecker(const edm::ParameterSet& iConfig); + + ~SiStripNoisesAndBadCompsChecker() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void analyze(const edm::Event&, const edm::EventSetup&) override; + +private: + const bool writePayload_; + const edm::FileInPath fp_; + const uint32_t printdebug_; + const edm::ESGetToken noiseToken_; + const edm::ESGetToken deadChannelToken_; + + const std::string k_Name_ = "SiStripNoisesAndBadCompsChecker"; + const std::string k_Record_ = "SiStripNoisesRcd"; +}; + +SiStripNoisesAndBadCompsChecker::SiStripNoisesAndBadCompsChecker(const edm::ParameterSet& iConfig) + : writePayload_(iConfig.getUntrackedParameter("writePayload", true)), + fp_(iConfig.getUntrackedParameter("file", + edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), + printdebug_(iConfig.getUntrackedParameter("printDebug", std::numeric_limits::max())), + noiseToken_(esConsumes()), + deadChannelToken_(esConsumes()) { + usesResource(cond::service::PoolDBOutputService::kSharedResource); +} + +void SiStripNoisesAndBadCompsChecker::analyze(const edm::Event& evt, const edm::EventSetup& iSetup) { + SiStripNoises obj; /* this is the output object */ + + unsigned int count{0}; + + const auto& reader = SiStripDetInfoFileReader::read(fp_.fullPath()); + const auto& DetInfos = reader.getAllData(); + + auto const& deadChannel = iSetup.getData(deadChannelToken_); + auto const& noise = iSetup.getData(noiseToken_); + + for (const auto& it : DetInfos) { + const auto& nAPVs = it.second.nApvs; + + SiStripNoises::Range detNoiseRange = noise.getRange(it.first); + + // fill in the information about the dead channels + SiStripBadStrip::Range detBadStripRange = deadChannel.getRange(it.first); + std::vector badChannels; + badChannels.clear(); + badChannels.insert(badChannels.begin(), sistrip::STRIPS_PER_APV * nAPVs, false); + for (SiStripBadStrip::ContainerIterator it2 = detBadStripRange.first; it2 != detBadStripRange.second; ++it2) { + SiStripBadStrip::data fs = deadChannel.decode(*it2); + for (int strip = fs.firstStrip; strip < fs.firstStrip + fs.range; ++strip) { + badChannels[strip] = true; + } + } + + SiStripNoises::InputVector theSiStripVector; + for (int strip = 0; strip < sistrip::STRIPS_PER_APV * nAPVs; ++strip) { + const auto& theNoise = noise.getNoise(strip, detNoiseRange); + if (!badChannels[strip]) { + try { + noise.verify(strip, detNoiseRange); + } catch (cms::Exception& e) { + if (count < printdebug_) { + edm::LogPrint(k_Name_) << "WARNING: out-of-range " + << " detid: " << it.first << " strip: " << strip << " noise:" << theNoise; + } + count++; + } + } // is strip is not masked + obj.setData(theNoise, theSiStripVector); + } // loop on the strips + + if (!obj.put(it.first, theSiStripVector)) + edm::LogError(k_Name_) << "[SiStripNoisesAndBadCompsChecker::analyze] detid already exists"; + } // loop on the detids + edm::LogPrint(k_Name_) << "Found " << count << " strips in out-of-bounds!"; + + if (writePayload_) { + edm::LogInfo(k_Name_) << "Will write an updated fixed payload"; + + //And now write sistripnoises data in DB + edm::Service mydbservice; + + if (mydbservice.isAvailable()) { + if (mydbservice->isNewTagRequest("SiStripNoisesRcd")) { + mydbservice->createOneIOV(obj, mydbservice->beginOfTime(), k_Record_); + } else { + mydbservice->appendOneIOV(obj, mydbservice->currentTime(), k_Record_); + } + } else { + edm::LogError("SiStripNoisesBuilder") << "Service is unavailable, will not write any output"; + } + } +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void SiStripNoisesAndBadCompsChecker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.setComment( + "Given a certain Global Tag, checks that the all the unmasked strips, do have a noise within the payload range"); + desc.addUntracked("writePayload", true); + desc.addUntracked("file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile)); + desc.addUntracked("printDebug", std::numeric_limits::max()); + descriptions.addWithDefaultLabel(desc); +} + +DEFINE_FWK_MODULE(SiStripNoisesAndBadCompsChecker); diff --git a/CondTools/SiStrip/test/BuildFile.xml b/CondTools/SiStrip/test/BuildFile.xml index 910886174a153..fd0ab2a0a150e 100644 --- a/CondTools/SiStrip/test/BuildFile.xml +++ b/CondTools/SiStrip/test/BuildFile.xml @@ -1,12 +1,6 @@ - - - - - - - + diff --git a/CondTools/SiStrip/test/SiStripNoisesAndBadCompsChecker_cfg.py b/CondTools/SiStrip/test/SiStripNoisesAndBadCompsChecker_cfg.py new file mode 100644 index 0000000000000..e71f29c1dbded --- /dev/null +++ b/CondTools/SiStrip/test/SiStripNoisesAndBadCompsChecker_cfg.py @@ -0,0 +1,96 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +import copy + +process = cms.Process("Demo") + +#prepare options + +options = VarParsing.VarParsing("analysis") + +options.register ('globalTag', + "auto:phase1_2018_cosmics_peak", + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "GlobalTag") + +options.register ('runNumber', + 1, + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.int, # string, int, or float + "run number") + +options.register ('writePayload', + True, + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "write out payload") + +options.parseArguments() + + +## +## MessageLogger +## +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.enable = False +process.MessageLogger.SiStripNoisesAndBadCompsChecker=dict() +process.MessageLogger.cout = cms.untracked.PSet( + enable = cms.untracked.bool(True), + enableStatistics = 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) + ), + SiStripNoisesAndBadCompsChecker = cms.untracked.PSet( limit = cms.untracked.int32(-1)) + ) + +## +## Conditions +## +process.load("Configuration.Geometry.GeometryRecoDB_cff") # Ideal geometry and interface +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '') + +print("Using Global Tag:", process.GlobalTag.globaltag._value) + +## +## Empty Source +## +process.source = cms.Source("EmptySource", + firstRun = cms.untracked.uint32(options.runNumber), + numberEventsInRun = cms.untracked.uint32(1), + ) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) + +## +## DB Output +## +if(options.writePayload) : + process.PoolDBOutputService = cms.Service("PoolDBOutputService", + BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), + DBParameters = cms.PSet(authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')), + timetype = cms.untracked.string('runnumber'), + connect = cms.string('sqlite_file:SiStripNoise_PeakMode_2018_Minus20C_v0_mc_fixed.db'), + toPut = cms.VPSet(cms.PSet(record = cms.string('SiStripNoisesRcd'), + tag = cms.string('SiStripNoise_PeakMode_2018_Minus20C_v0_mc_fixed') + ) + ) + ) + +## +## Analyzer +## +process.demo = cms.EDAnalyzer('SiStripNoisesAndBadCompsChecker', + writePayload = cms.untracked.bool(options.writePayload), + printDebug = cms.untracked.uint32(100), + file = cms.untracked.FileInPath('CalibTracker/SiStripCommon/data/SiStripDetInfo.dat')) + +## +## Parh +## +process.p = cms.Path(process.demo) diff --git a/CondTools/SiStrip/test/runTests.cpp b/CondTools/SiStrip/test/runTests.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/CondTools/SiStrip/test/runTests.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/CondTools/SiStrip/test/testBuildersReaders.sh b/CondTools/SiStrip/test/testBuildersReaders.sh index 20d4cdbde7ebc..f064877a6267f 100755 --- a/CondTools/SiStrip/test/testBuildersReaders.sh +++ b/CondTools/SiStrip/test/testBuildersReaders.sh @@ -16,7 +16,7 @@ pwd echo " testing CondTools/SiStrip" # do the builders first (need the input db file) -for entry in "${LOCAL_TEST_DIR}/"SiStrip*Builder_cfg.py +for entry in "${SCRAM_TEST_PATH}/"SiStrip*Builder_cfg.py do echo "===== Test \"cmsRun $entry \" ====" (cmsRun $entry) || die "Failure using cmsRun $entry" $? @@ -25,7 +25,7 @@ done echo -e " Done with the writers \n\n" ## do the readers -for entry in "${LOCAL_TEST_DIR}/"SiStrip*Reader_cfg.py +for entry in "${SCRAM_TEST_PATH}/"SiStrip*Reader_cfg.py do echo "===== Test \"cmsRun $entry \" ====" (cmsRun $entry) || die "Failure using cmsRun $entry" $? @@ -36,7 +36,7 @@ echo -e " Done with the readers \n\n" sleep 5 ## do the builders from file -for entry in "${LOCAL_TEST_DIR}/"SiStrip*FromASCIIFile_cfg.py +for entry in "${SCRAM_TEST_PATH}/"SiStrip*FromASCIIFile_cfg.py do echo "===== Test \"cmsRun $entry \" ====" (cmsRun $entry) || die "Failure using cmsRun $entry" $? @@ -45,7 +45,7 @@ done echo -e " Done with the builders from file \n\n" ## do the miscalibrators -for entry in "${LOCAL_TEST_DIR}/"SiStrip*Miscalibrator_cfg.py +for entry in "${SCRAM_TEST_PATH}/"SiStrip*Miscalibrator_cfg.py do echo "===== Test \"cmsRun $entry \" ====" (cmsRun $entry) || die "Failure using cmsRun $entry" $? @@ -75,13 +75,13 @@ sqlite3 gainManipulations.db "update IOV SET SINCE=1 where SINCE=$((--OLDG2since echo -e "\n\n Checking the content of the local conditions file \n\n" sqlite3 gainManipulations.db "select * from IOV" -(cmsRun ${LOCAL_TEST_DIR}/SiStripApvGainRescaler_cfg.py additionalConds=sqlite_file:${PWD}/gainManipulations.db) || die "Failure using cmsRun SiStripApvGainRescaler_cfg.py)" $? +(cmsRun ${SCRAM_TEST_PATH}/SiStripApvGainRescaler_cfg.py additionalConds=sqlite_file:${PWD}/gainManipulations.db) || die "Failure using cmsRun SiStripApvGainRescaler_cfg.py)" $? echo -e " Done with the gain rescaler \n\n" ## do the visualization code -(cmsRun "${LOCAL_TEST_DIR}/"SiStripCondVisualizer_cfg.py) || die "Failure using cmsRun SiStripCondVisualizer_cfg.py" $? -(python3 "${LOCAL_TEST_DIR}/"db_tree_dump_wrapper.py) || die "Failure running python3 db_tree_dump_wrapper.py" $? +(cmsRun "${SCRAM_TEST_PATH}/"SiStripCondVisualizer_cfg.py) || die "Failure using cmsRun SiStripCondVisualizer_cfg.py" $? +(python3 "${SCRAM_TEST_PATH}/"db_tree_dump_wrapper.py) || die "Failure running python3 db_tree_dump_wrapper.py" $? echo -e " Done with the visualization \n\n" echo -e "\n\n Testing the conditions patching code: \n\n" @@ -93,7 +93,7 @@ done myFEDs+=491 echo " masking the following FEDs: "${myFEDs} -(cmsRun "${LOCAL_TEST_DIR}/"SiStripBadChannelPatcher_cfg.py isUnitTest=True FEDsToAdd=${myFEDs} outputTag=OddFEDs) || die "Failure using cmsRun SiStripBadChannelPatcher_cfg.py when adding FEDs" $? -(cmsRun "${LOCAL_TEST_DIR}/"SiStripBadChannelPatcher_cfg.py isUnitTest=True inputConnection=sqlite_file:outputDB.db inputTag=OddFEDs FEDsToRemove=${myFEDs} outputTag=OddFEDsRemoved) || die "Failure using cmsRun SiStripBadChannelPatcher_cfg.py when removing FEDs" $? +(cmsRun "${SCRAM_TEST_PATH}/"SiStripBadChannelPatcher_cfg.py isUnitTest=True FEDsToAdd=${myFEDs} outputTag=OddFEDs) || die "Failure using cmsRun SiStripBadChannelPatcher_cfg.py when adding FEDs" $? +(cmsRun "${SCRAM_TEST_PATH}/"SiStripBadChannelPatcher_cfg.py isUnitTest=True inputConnection=sqlite_file:outputDB.db inputTag=OddFEDs FEDsToRemove=${myFEDs} outputTag=OddFEDsRemoved) || die "Failure using cmsRun SiStripBadChannelPatcher_cfg.py when removing FEDs" $? echo -e " Done with the bad components patching \n\n" diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index ee04d4372782d..e2dbc8de86008 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,27 +2,27 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '131X_mcRun1_design_v1', + 'run1_design' : '131X_mcRun1_design_v2', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '131X_mcRun1_realistic_v1', + 'run1_mc' : '131X_mcRun1_realistic_v2', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '131X_mcRun1_HeavyIon_v1', + 'run1_mc_hi' : '131X_mcRun1_HeavyIon_v2', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '131X_mcRun2_startup_v1', + 'run2_mc_50ns' : '131X_mcRun2_startup_v2', # GlobalTag for MC production (2015 L1 Trigger Stage1) with startup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode - 'run2_mc_l1stage1' : '131X_mcRun2_asymptotic_l1stage1_v1', + 'run2_mc_l1stage1' : '131X_mcRun2_asymptotic_l1stage1_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '131X_mcRun2_design_v1', + 'run2_design' : '131X_mcRun2_design_v2', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, prior to VFP change - 'run2_mc_pre_vfp' : '131X_mcRun2_asymptotic_preVFP_v1', + 'run2_mc_pre_vfp' : '131X_mcRun2_asymptotic_preVFP_v2', #GlobalTag for MC production with optimistic alignment and calibrations for 2016, after VFP change - 'run2_mc' : '131X_mcRun2_asymptotic_v1', + 'run2_mc' : '131X_mcRun2_asymptotic_v2', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '131X_mcRun2cosmics_asymptotic_deco_v1', + 'run2_mc_cosmics' : '131X_mcRun2cosmics_asymptotic_deco_v2', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '131X_mcRun2_HeavyIon_v1', + 'run2_mc_hi' : '131X_mcRun2_HeavyIon_v2', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '131X_mcRun2_pA_v1', + 'run2_mc_pa' : '131X_mcRun2_pA_v2', # GlobalTag for Run2 data reprocessing 'run2_data' : '124X_dataRun2_v2', # GlobalTag for Run2 data 2018B relvals only: HEM-15-16 fail @@ -31,62 +31,62 @@ 'run2_data_promptlike_hi' : '124X_dataRun2_PromptLike_HI_v1', # GlobalTag with fixed snapshot time for Run2 HLT RelVals: customizations to run with fixed L1 Menu 'run2_hlt_relval' : '123X_dataRun2_HLT_relval_v3', - # GlobalTag for Run3 HLT: identical to the online GT (130X_dataRun3_HLT_v2) but with snapshot at 2023-03-16 19:00:00 (UTC) - 'run3_hlt' : '130X_dataRun3_HLT_frozen_v1', - # GlobalTag for Run3 data relvals (express GT) - identical to 130X_dataRun3_Express_v2 but with snapshot at 2023-03-16 19:00:00 (UTC) - 'run3_data_express' : '130X_dataRun3_Express_frozen_v1', - # GlobalTag for Run3 data relvals (prompt GT) - identical to 130X_dataRun3_Prompt_v2 but with snapshot at 2023-03-16 19:00:00 (UTC) - 'run3_data_prompt' : '130X_dataRun3_Prompt_frozen_v1', - # GlobalTag for Run3 offline data reprocessing - snapshot at 2023-03-16 19:00:00 (UTC) - 'run3_data' : '130X_dataRun3_v1', + # GlobalTag for Run3 HLT: identical to the online GT (130X_dataRun3_HLT_v2) but with snapshot at 2023-05-10 09:00:00 (UTC) + 'run3_hlt' : '130X_dataRun3_HLT_frozen_v2', + # GlobalTag for Run3 data relvals (express GT) - identical to 130X_dataRun3_Express_v2 but with snapshot at 2023-05-10 09:00:00 (UTC) + 'run3_data_express' : '130X_dataRun3_Express_frozen_v2', + # GlobalTag for Run3 data relvals (prompt GT) - identical to 130X_dataRun3_Prompt_v3 but with snapshot at 2023-05-10 09:00:00 (UTC) + 'run3_data_prompt' : '130X_dataRun3_Prompt_frozen_v2', + # GlobalTag for Run3 offline data reprocessing - snapshot at 2023-05-09 15:38:20 (UTC) + 'run3_data' : '130X_dataRun3_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '131X_mc2017_design_v1', + 'phase1_2017_design' : '131X_mc2017_design_v2', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '131X_mc2017_realistic_v1', + 'phase1_2017_realistic' : '131X_mc2017_realistic_v2', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '131X_mc2017cosmics_realistic_deco_v1', + 'phase1_2017_cosmics' : '131X_mc2017cosmics_realistic_deco_v2', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '131X_mc2017cosmics_realistic_peak_v1', + 'phase1_2017_cosmics_peak' : '131X_mc2017cosmics_realistic_peak_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) - 'phase1_2018_design' : '131X_upgrade2018_design_v1', + 'phase1_2018_design' : '131X_upgrade2018_design_v2', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector - 'phase1_2018_realistic' : '131X_upgrade2018_realistic_v1', + 'phase1_2018_realistic' : '131X_upgrade2018_realistic_v2', # GlobalTag for MC production with realistic run-dependent (RD) conditions for full Phase1 2018 detector - 'phase1_2018_realistic_rd' : '131X_upgrade2018_realistic_RD_v1', + 'phase1_2018_realistic_rd' : '131X_upgrade2018_realistic_RD_v2', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector for Heavy Ion - 'phase1_2018_realistic_hi' : '131X_upgrade2018_realistic_HI_v1', + 'phase1_2018_realistic_hi' : '131X_upgrade2018_realistic_HI_v2', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector: HEM-15-16 fail - 'phase1_2018_realistic_HEfail' : '131X_upgrade2018_realistic_HEfail_v2', + 'phase1_2018_realistic_HEfail' : '131X_upgrade2018_realistic_HEfail_v3', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode - 'phase1_2018_cosmics' : '131X_upgrade2018cosmics_realistic_deco_v1', + 'phase1_2018_cosmics' : '131X_upgrade2018cosmics_realistic_deco_v2', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in PEAK mode - 'phase1_2018_cosmics_peak' : '131X_upgrade2018cosmics_realistic_peak_v1', + 'phase1_2018_cosmics_peak' : '131X_upgrade2018cosmics_realistic_peak_v3', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2022 - 'phase1_2022_design' : '131X_mcRun3_2022_design_v1', + 'phase1_2022_design' : '131X_mcRun3_2022_design_v2', # GlobalTag for MC production with realistic conditions for Phase1 2022 - 'phase1_2022_realistic' : '131X_mcRun3_2022_realistic_v1', + 'phase1_2022_realistic' : '131X_mcRun3_2022_realistic_v3', # GlobalTag for MC production with realistic conditions for Phase1 2022 post-EE+ leak - 'phase1_2022_realistic_postEE' : '131X_mcRun3_2022_realistic_postEE_v1', + 'phase1_2022_realistic_postEE' : '131X_mcRun3_2022_realistic_postEE_v3', # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2022, Strip tracker in DECO mode - 'phase1_2022_cosmics' : '131X_mcRun3_2022cosmics_realistic_deco_v1', + 'phase1_2022_cosmics' : '131X_mcRun3_2022cosmics_realistic_deco_v3', # GlobalTag for MC production (cosmics) with perfectly aligned and calibrated detector for Phase1 2022, Strip tracker in DECO mode - 'phase1_2022_cosmics_design' : '131X_mcRun3_2022cosmics_design_deco_v1', + 'phase1_2022_cosmics_design' : '131X_mcRun3_2022cosmics_design_deco_v2', # GlobalTag for MC production with realistic conditions for Phase1 2022 detector for Heavy Ion - 'phase1_2022_realistic_hi' : '131X_mcRun3_2022_realistic_HI_v2', + 'phase1_2022_realistic_hi' : '131X_mcRun3_2022_realistic_HI_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2023 - 'phase1_2023_design' : '131X_mcRun3_2023_design_v1', + 'phase1_2023_design' : '131X_mcRun3_2023_design_v5', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '131X_mcRun3_2023_realistic_v1', + 'phase1_2023_realistic' : '131X_mcRun3_2023_realistic_v5', # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2023, Strip tracker in DECO mode - 'phase1_2023_cosmics' : '131X_mcRun3_2023cosmics_realistic_deco_v1', + 'phase1_2023_cosmics' : '131X_mcRun3_2023cosmics_realistic_deco_v5', # GlobalTag for MC production (cosmics) with perfectly aligned and calibrated detector for Phase1 2023, Strip tracker in DECO mode - 'phase1_2023_cosmics_design' : '131X_mcRun3_2023cosmics_design_deco_v1', + 'phase1_2023_cosmics_design' : '131X_mcRun3_2023cosmics_design_deco_v5', # GlobalTag for MC production with realistic conditions for Phase1 2023 detector for Heavy Ion - 'phase1_2023_realistic_hi' : '131X_mcRun3_2023_realistic_HI_v2', + 'phase1_2023_realistic_hi' : '131X_mcRun3_2023_realistic_HI_v11', # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '131X_mcRun3_2024_realistic_v1', + 'phase1_2024_realistic' : '131X_mcRun3_2024_realistic_v3', # GlobalTag for MC production with realistic conditions for Phase2 - 'phase2_realistic' : '131X_mcRun4_realistic_v2' + 'phase2_realistic' : '131X_mcRun4_realistic_v5' } aliases = { diff --git a/Configuration/AlCa/python/autoCondModifiers.py b/Configuration/AlCa/python/autoCondModifiers.py index 42fca41e91de7..82c060b96c2e2 100644 --- a/Configuration/AlCa/python/autoCondModifiers.py +++ b/Configuration/AlCa/python/autoCondModifiers.py @@ -115,7 +115,7 @@ def autoCondRelValForRun3(autoCond): GlobalTagRelValForRun3 = {} L1GtTriggerMenuForRelValForRun3 = ','.join( ['L1Menu_Collisions2015_25nsStage1_v5' , "L1GtTriggerMenuRcd", connectionString, "", "2023-01-28 12:00:00.000"] ) - L1TUtmTriggerMenuForRelValForRun3 = ','.join( ['L1Menu_Collisions2023_v1_0_0_xml' , "L1TUtmTriggerMenuRcd", connectionString, "", "2023-03-08 12:00:00.000"] ) + L1TUtmTriggerMenuForRelValForRun3 = ','.join( ['L1Menu_Collisions2023_v1_1_0-v2_xml' , "L1TUtmTriggerMenuRcd", connectionString, "", "2023-05-02 12:00:00.000"] ) for key,val in autoCond.items(): if 'run3_data' in key or 'run3_hlt' in key : diff --git a/Configuration/DataProcessing/python/Impl/ppEra_Run3_2023.py b/Configuration/DataProcessing/python/Impl/ppEra_Run3_2023.py new file mode 100644 index 0000000000000..33bd6101cf174 --- /dev/null +++ b/Configuration/DataProcessing/python/Impl/ppEra_Run3_2023.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +""" +_ppEra_Run3_2023_ + +Scenario supporting proton collisions for 2023 with updated HCAL Barrel thresholds + +""" + +import os +import sys + +from Configuration.DataProcessing.Reco import Reco +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Run3_2023_cff import Run3_2023 + +from Configuration.DataProcessing.Impl.pp import pp + +class ppEra_Run3_2023(pp): + def __init__(self): + pp.__init__(self) + self.recoSeq='' + self.cbSc='pp' + self.eras=Run3_2023 + self.promptCustoms += [ 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run3_2023' ] + self.expressCustoms += [ 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run3_2023' ] + self.visCustoms += [ 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run3_2023' ] + """ + _ppEra_Run3_2023_ + + Implement configuration building for data processing for proton + collision data taking for Run3_2023 + + """ diff --git a/Configuration/DataProcessing/python/Reco.py b/Configuration/DataProcessing/python/Reco.py index 443d4ae45849e..dd77ee60d9ad7 100644 --- a/Configuration/DataProcessing/python/Reco.py +++ b/Configuration/DataProcessing/python/Reco.py @@ -61,14 +61,17 @@ def promptReco(self, globalTag, **args): miniAODStep = '' nanoAODStep = '' + if not 'customs' in args: + args['customs']= [] if 'outputs' in args: - print(args['outputs']) + print(args['outputs']) for a in args['outputs']: if a['dataTier'] == 'MINIAOD': - miniAODStep = ',PAT' + miniAODStep = ',PAT' if a['dataTier'] in ['NANOAOD', 'NANOEDMAOD']: - nanoAODStep = ',NANO' + nanoAODStep = ',NANO' + args['customs'].append('PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomize') self._checkRepackedFlag(options, **args) diff --git a/Configuration/DataProcessing/python/RecoTLR.py b/Configuration/DataProcessing/python/RecoTLR.py index 7b270f6750947..1e78235fa7025 100644 --- a/Configuration/DataProcessing/python/RecoTLR.py +++ b/Configuration/DataProcessing/python/RecoTLR.py @@ -90,6 +90,11 @@ def customisePostEra_Run3(process): customisePostEra_Run2_2018(process) return process +def customisePostEra_Run3_2023(process): + #start with a repeat of Run3 + customisePostEra_Run3(process) + return process + def customisePostEra_Run3_express_trackingOnly(process): #start with a repeat of 2018 customisePostEra_Run2_2018_express_trackingOnly(process) diff --git a/Configuration/DataProcessing/test/BuildFile.xml b/Configuration/DataProcessing/test/BuildFile.xml index 5244977623072..073c709564047 100644 --- a/Configuration/DataProcessing/test/BuildFile.xml +++ b/Configuration/DataProcessing/test/BuildFile.xml @@ -1,4 +1,2 @@ - - - + diff --git a/Configuration/DataProcessing/test/TestCfg.cpp b/Configuration/DataProcessing/test/TestCfg.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/Configuration/DataProcessing/test/TestCfg.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/Configuration/DataProcessing/test/run_CfgTest.sh b/Configuration/DataProcessing/test/run_CfgTest.sh index 9840f8d184097..cf779eb022807 100755 --- a/Configuration/DataProcessing/test/run_CfgTest.sh +++ b/Configuration/DataProcessing/test/run_CfgTest.sh @@ -10,80 +10,79 @@ function die { echo $1: status $2 ; exit $2; } function runTest { echo $1 ; python3 $1 || die "Failure for configuration: $1" $?; } - -runTest "${LOCAL_TEST_DIR}/RunRepack.py --select-events HLT:path1,HLT:path2 --lfn /store/whatever" +runTest "${SCRAM_TEST_PATH}/RunRepack.py --select-events HLT:path1,HLT:path2 --lfn /store/whatever" declare -a arr=("cosmicsEra_Run2_2018" "ppEra_Run2_2018" "ppEra_Run2_2018_highBetaStar" "ppEra_Run2_2018_pp_on_AA" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3" "ppEra_Run3") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco TkAlMinBias+SiStripCalMinBias " - runTest "${LOCAL_TEST_DIR}/RunVisualizationProcessing.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --fevt" - runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" + runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco TkAlMinBias+SiStripCalMinBias " + runTest "${SCRAM_TEST_PATH}/RunVisualizationProcessing.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --fevt" + runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" done declare -a arr=("cosmicsEra_Run2_2018" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco SiStripCalCosmicsNano " + runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco SiStripCalCosmicsNano " done declare -a arr=("HeavyIonsEra_Run2_2018") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco TkAlMinBiasHI+SiStripCalMinBias " - runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" - runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario $scenario --lfn=/store/whatever --global-tag GLOBALTAG --skims SiStripCalZeroBias,SiStripCalMinBias,PromptCalibProd" - runTest "${LOCAL_TEST_DIR}/RunDQMHarvesting.py --scenario $scenario --lfn /store/whatever --run 12345 --dataset /A/B/C --global-tag GLOBALTAG" - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBiasHI+SiStripCalMinBias --PhysicsSkim=DiJet+Photon+ZEE+ZMM" + runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --fevt --dqmio --alcareco TkAlMinBiasHI+SiStripCalMinBias " + runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --workflows=BeamSpotByRun,BeamSpotByLumi,SiStripQuality" + runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario $scenario --lfn=/store/whatever --global-tag GLOBALTAG --skims SiStripCalZeroBias,SiStripCalMinBias,PromptCalibProd" + runTest "${SCRAM_TEST_PATH}/RunDQMHarvesting.py --scenario $scenario --lfn /store/whatever --run 12345 --dataset /A/B/C --global-tag GLOBALTAG" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBiasHI+SiStripCalMinBias --PhysicsSkim=DiJet+Photon+ZEE+ZMM" done -declare -a arr=("AlCaLumiPixels" "AlCaTestEnable" "cosmicsEra_Run2_2018" "hcalnzsEra_Run2_2018" "ppEra_Run2_2018" "hcalnzsEra_Run2_2018_highBetaStar" "hcalnzsEra_Run2_2018_pp_on_AA" "ppEra_Run2_2018_highBetaStar" "ppEra_Run2_2018_pp_on_AA" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3" "hcalnzsEra_Run3" "ppEra_Run3" "AlCaLumiPixels_Run3" "AlCaPhiSymEcal_Nano" "AlCaPPS_Run3" "ppEra_Run3_pp_on_PbPb" "hcalnzsEra_Run3_pp_on_PbPb" "ppEra_Run3_pp_on_PbPb_approxSiStripClusters") +declare -a arr=("AlCaLumiPixels" "AlCaTestEnable" "cosmicsEra_Run2_2018" "hcalnzsEra_Run2_2018" "ppEra_Run2_2018" "hcalnzsEra_Run2_2018_highBetaStar" "hcalnzsEra_Run2_2018_pp_on_AA" "ppEra_Run2_2018_highBetaStar" "ppEra_Run2_2018_pp_on_AA" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3" "hcalnzsEra_Run3" "ppEra_Run3" "AlCaLumiPixels_Run3" "AlCaPhiSymEcal_Nano" "AlCaPPS_Run3" "ppEra_Run3_pp_on_PbPb" "hcalnzsEra_Run3_pp_on_PbPb" "ppEra_Run3_pp_on_PbPb_approxSiStripClusters" "ppEra_Run3_2023") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" done declare -a arr=("AlCaLumiPixels" "cosmicsEra_Run2_2018" "ppEra_Run2_2018" "ppEra_Run2_2018_highBetaStar" "ppEra_Run2_2018_pp_on_AA" "cosmicsHybridEra_Run2_2018" "cosmicsEra_Run3" "ppEra_Run3" "AlCaLumiPixels_Run3") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario $scenario --lfn=/store/whatever --global-tag GLOBALTAG --skims SiStripCalZeroBias,SiStripCalMinBias,PromptCalibProd" - runTest "${LOCAL_TEST_DIR}/RunDQMHarvesting.py --scenario $scenario --lfn /store/whatever --run 12345 --dataset /A/B/C --global-tag GLOBALTAG" + runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario $scenario --lfn=/store/whatever --global-tag GLOBALTAG --skims SiStripCalZeroBias,SiStripCalMinBias,PromptCalibProd" + runTest "${SCRAM_TEST_PATH}/RunDQMHarvesting.py --scenario $scenario --lfn /store/whatever --run 12345 --dataset /A/B/C --global-tag GLOBALTAG" done declare -a arr=("ppEra_Run2_2018" "ppEra_Run2_2018_highBetaStar" "ppEra_Run2_2018_pp_on_AA") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --PhysicsSkim=@SingleMuon" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --PhysicsSkim=@SingleMuon" done declare -a arr=("ppEra_Run3") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --nanoaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" - runTest "${LOCAL_TEST_DIR}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --PhysicsSkim=@Muon" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --nanoaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias" + runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --PhysicsSkim=@Muon0" done -runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario AlCaTestEnable --global-tag GLOBALTAG --lfn /store/whatever --alcareco PromptCalibProdEcalPedestals " -runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario AlCaTestEnable --lfn=/store/whatever --global-tag GLOBALTAG --skims PromptCalibProdEcalPedestals" -runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario AlCaTestEnable --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdEcalPedestals" +runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario AlCaTestEnable --global-tag GLOBALTAG --lfn /store/whatever --alcareco PromptCalibProdEcalPedestals " +runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario AlCaTestEnable --lfn=/store/whatever --global-tag GLOBALTAG --skims PromptCalibProdEcalPedestals" +runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario AlCaTestEnable --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdEcalPedestals" -runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario AlCaLumiPixels --global-tag GLOBALTAG --lfn /store/whatever --alcareco AlCaPCCRandom+PromptCalibProdLumiPCC" -runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario AlCaLumiPixels --lfn=/store/whatever --global-tag GLOBALTAG --skims AlCaPCCRandom,PromptCalibProdLumiPCC" -runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario AlCaLumiPixels --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario AlCaLumiPixels --global-tag GLOBALTAG --lfn /store/whatever --alcareco AlCaPCCRandom+PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario AlCaLumiPixels --lfn=/store/whatever --global-tag GLOBALTAG --skims AlCaPCCRandom,PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario AlCaLumiPixels --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdLumiPCC" -runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario AlCaLumiPixels_Run3 --global-tag GLOBALTAG --lfn /store/whatever --alcareco AlCaPCCRandom+PromptCalibProdLumiPCC" -runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario AlCaLumiPixels_Run3 --lfn=/store/whatever --global-tag GLOBALTAG --skims AlCaPCCRandom,PromptCalibProdLumiPCC" -runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario AlCaLumiPixels_Run3 --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario AlCaLumiPixels_Run3 --global-tag GLOBALTAG --lfn /store/whatever --alcareco AlCaPCCRandom+PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario AlCaLumiPixels_Run3 --lfn=/store/whatever --global-tag GLOBALTAG --skims AlCaPCCRandom,PromptCalibProdLumiPCC" +runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario AlCaLumiPixels_Run3 --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdLumiPCC" declare -a arr=("trackingOnlyEra_Run2_2018" "trackingOnlyEra_Run2_2018_highBetaStar" "trackingOnlyEra_Run2_2018_pp_on_AA" "trackingOnlyEra_Run3" "trackingOnlyEra_Run3_pp_on_PbPb") for scenario in "${arr[@]}" do - runTest "${LOCAL_TEST_DIR}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --alcarecos=TkAlMinBias+PromptCalibProdBeamSpotHP" - runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --skims TkAlMinBias,PromptCalibProdBeamSpotHP" - runTest "${LOCAL_TEST_DIR}/RunAlcaSkimming.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --skims TkAlMinBias,PromptCalibProdBeamSpotHPLowPU" - runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdBeamSpotHP" - runTest "${LOCAL_TEST_DIR}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdBeamSpotHPLowPU" + runTest "${SCRAM_TEST_PATH}/RunExpressProcessing.py --scenario $scenario --global-tag GLOBALTAG --lfn /store/whatever --alcarecos=TkAlMinBias+PromptCalibProdBeamSpotHP" + runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --skims TkAlMinBias,PromptCalibProdBeamSpotHP" + runTest "${SCRAM_TEST_PATH}/RunAlcaSkimming.py --scenario $scenario --lfn /store/whatever --global-tag GLOBALTAG --skims TkAlMinBias,PromptCalibProdBeamSpotHPLowPU" + runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdBeamSpotHP" + runTest "${SCRAM_TEST_PATH}/RunAlcaHarvesting.py --scenario $scenario --lfn /store/whatever --dataset /A/B/C --global-tag GLOBALTAG --alcapromptdataset=PromptCalibProdBeamSpotHPLowPU" done diff --git a/Configuration/Eras/python/Era_Run3_2023_cff.py b/Configuration/Eras/python/Era_Run3_2023_cff.py new file mode 100644 index 0000000000000..8b14afa323e92 --- /dev/null +++ b/Configuration/Eras/python/Era_Run3_2023_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.Modifier_run3_egamma_2023_cff import run3_egamma_2023 + +Run3_2023 = cms.ModifierChain(Run3, run3_egamma_2023) diff --git a/Configuration/Eras/python/Modifier_run3_ecal_devel_cff.py b/Configuration/Eras/python/Modifier_run3_ecal_devel_cff.py new file mode 100644 index 0000000000000..48d4436487bcd --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_ecal_devel_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +run3_ecal_devel = cms.Modifier() + diff --git a/Configuration/Eras/python/Modifier_run3_egamma_2023_cff.py b/Configuration/Eras/python/Modifier_run3_egamma_2023_cff.py new file mode 100644 index 0000000000000..dc3296a329635 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_egamma_2023_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run3_egamma_2023 =cms.Modifier() diff --git a/Configuration/EventContent/doc/EventContent.doc b/Configuration/EventContent/doc/EventContent.doc index 64335a6f1fe13..2530b50d5b03f 100644 --- a/Configuration/EventContent/doc/EventContent.doc +++ b/Configuration/EventContent/doc/EventContent.doc @@ -35,7 +35,7 @@ Package which contains .cff files defining event content for the different data "RecoBTag/Configuration/data/RecoBTag_EventContent.cff" "RecoTauTag/Configuration/data/RecoTauTag_EventContent.cff" "RecoVertex/Configuration/data/RecoVertex_EventContent.cff" -"RecoPixelVertexing/Configuration/data/RecoPixelVertexing_EventContent.cff" +"RecoTracker/Configuration/data/RecoPixelVertexing_EventContent.cff" "RecoEgamma/Configuration/data/RecoEgamma_EventContent.cff" # Simulation part "SimG4Core/Configuration/data/SimG4Core_EventContent.cff" diff --git a/Configuration/EventContent/python/EventContentCosmics_cff.py b/Configuration/EventContent/python/EventContentCosmics_cff.py index 21ec8b2549f2b..3beaa0f9c1a67 100644 --- a/Configuration/EventContent/python/EventContentCosmics_cff.py +++ b/Configuration/EventContent/python/EventContentCosmics_cff.py @@ -65,7 +65,7 @@ #include "RecoBTag/Configuration/data/RecoBTag_EventContent.cff" #include "RecoTauTag/Configuration/data/RecoTauTag_EventContent.cff" #include "RecoVertex/Configuration/data/RecoVertex_EventContent.cff" -#include "RecoPixelVertexing/Configuration/data/RecoPixelVertexing_EventContent.cff" +#include "RecoTracker/Configuration/data/RecoPixelVertexing_EventContent.cff" #include "RecoEgamma/Configuration/data/RecoEgamma_EventContent.cff" #include "RecoParticleFlow/Configuration/data/RecoParticleFlow_EventContent.cff" @@ -132,6 +132,7 @@ AODEventContent.outputCommands.extend(EvtScalersAOD.outputCommands) AODEventContent.outputCommands.extend(OnlineMetaDataContent.outputCommands) AODEventContent.outputCommands.extend(TcdsEventContent.outputCommands) +AODEventContent.outputCommands.extend(L1TriggerAOD.outputCommands) # # # RAWSIM Data Tier definition diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 3b5471e04c55d..e671fafcbc1e8 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -56,7 +56,7 @@ from RecoBTag.Configuration.RecoBTag_EventContent_cff import * from RecoTauTag.Configuration.RecoTauTag_EventContent_cff import * from RecoVertex.Configuration.RecoVertex_EventContent_cff import * -from RecoPixelVertexing.Configuration.RecoPixelVertexing_EventContent_cff import * +from RecoTracker.Configuration.RecoPixelVertexing_EventContent_cff import * from RecoEgamma.Configuration.RecoEgamma_EventContent_cff import * from RecoParticleFlow.Configuration.RecoParticleFlow_EventContent_cff import * from RecoVertex.BeamSpotProducer.BeamSpot_EventContent_cff import * diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2017DD4hepReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2017Reco_cff.py similarity index 100% rename from Configuration/Geometry/python/GeometryDD4hepExtended2017DD4hepReco_cff.py rename to Configuration/Geometry/python/GeometryDD4hepExtended2017Reco_cff.py diff --git a/Configuration/Geometry/python/GeometryDD4hepExtended2018DD4hepReco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtended2018Reco_cff.py similarity index 100% rename from Configuration/Geometry/python/GeometryDD4hepExtended2018DD4hepReco_cff.py rename to Configuration/Geometry/python/GeometryDD4hepExtended2018Reco_cff.py diff --git a/Configuration/Geometry/python/dict2021Geometry.py b/Configuration/Geometry/python/dict2021Geometry.py index 6c004ecde8176..81383ca6a85fb 100644 --- a/Configuration/Geometry/python/dict2021Geometry.py +++ b/Configuration/Geometry/python/dict2021Geometry.py @@ -1498,7 +1498,7 @@ 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdc/2021/v2/zdc.xml', 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], diff --git a/Configuration/Geometry/python/dict2026Geometry.py b/Configuration/Geometry/python/dict2026Geometry.py index 2682b8120e2a8..1f9d98d937a40 100644 --- a/Configuration/Geometry/python/dict2026Geometry.py +++ b/Configuration/Geometry/python/dict2026Geometry.py @@ -915,12 +915,12 @@ 'Geometry/ForwardCommonData/data/forwardshield/2017/v1/forwardshield.xml', 'Geometry/ForwardCommonData/data/brmrotations.xml', 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ @@ -928,7 +928,7 @@ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "reco" :[ @@ -940,12 +940,12 @@ 'Geometry/ForwardCommonData/data/forwardshield/2026/v1/forwardshield.xml', 'Geometry/ForwardCommonData/data/brmrotations.xml', 'Geometry/ForwardCommonData/data/brm/2026/v2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ @@ -953,7 +953,7 @@ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "sim" : [ @@ -967,12 +967,12 @@ 'Geometry/ForwardCommonData/data/forwardshield/2026/v2/forwardshield.xml', 'Geometry/ForwardCommonData/data/brmrotations.xml', 'Geometry/ForwardCommonData/data/PostLS2/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ @@ -980,7 +980,7 @@ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "reco" :[ @@ -992,12 +992,12 @@ 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', 'Geometry/ForwardCommonData/data/brmrotations.xml', 'Geometry/ForwardCommonData/data/brm/2026/v1/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ @@ -1005,7 +1005,7 @@ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "reco" :[ @@ -1017,12 +1017,12 @@ 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', 'Geometry/ForwardCommonData/data/brmrotations.xml', 'Geometry/ForwardCommonData/data/brm/2026/v3/brm.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ @@ -1030,7 +1030,7 @@ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "reco" :[ @@ -1040,19 +1040,19 @@ "F8" : { 1 : [ 'Geometry/ForwardCommonData/data/forwardshield/2026/v4/forwardshield.xml', - 'Geometry/ForwardCommonData/data/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', 'Geometry/ForwardCommonData/data/lumimaterials.xml', 'Geometry/ForwardCommonData/data/zdcrotations.xml', 'Geometry/ForwardCommonData/data/lumirotations.xml', - 'Geometry/ForwardCommonData/data/zdc.xml', - 'Geometry/ForwardCommonData/data/zdclumi.xml', + 'Geometry/ForwardCommonData/data/zdc/2026/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', 'Geometry/ForwardCommonData/data/cmszdc.xml', ], 3 : [ 'Geometry/ForwardSimData/data/zdcsens.xml', ], 4 : [ - 'Geometry/ForwardSimData/data/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', ], "reco" :[ diff --git a/Configuration/HLT/python/addOnTestsHLT.py b/Configuration/HLT/python/addOnTestsHLT.py index 7a0fcc942a445..3e9f2ac80eff6 100644 --- a/Configuration/HLT/python/addOnTestsHLT.py +++ b/Configuration/HLT/python/addOnTestsHLT.py @@ -10,18 +10,18 @@ def addOnTestsHLT(): 'hlt_mc_Fake2': ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake2 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --fileout file:RelVal_Raw_Fake2_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake2.py', 'cmsDriver.py RelVal -s HLT:Fake2,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake2 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run2_2016 --processName=HLTRECO --filein file:RelVal_Raw_Fake2_MC.root --fileout file:RelVal_Raw_Fake2_MC_HLT_RECO.root'], - 'hlt_mc_GRun' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_GRun_MC.root', + 'hlt_mc_GRun' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --fileout file:RelVal_Raw_GRun_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_GRun.py', - 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_GRun_MC.root --fileout file:RelVal_Raw_GRun_MC_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_GRun_MC.root --fileout file:RelVal_Raw_GRun_MC_HLT_RECO.root'], 'hlt_mc_HIon' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_HIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_pp_on_PbPb --fileout file:RelVal_Raw_HIon_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_HIon.py', 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3_pp_on_PbPb --processName=HLTRECO --filein file:RelVal_Raw_HIon_MC.root --fileout file:RelVal_Raw_HIon_MC_HLT_RECO.root'], - 'hlt_mc_PIon' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PIon_MC.root', + 'hlt_mc_PIon' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --fileout file:RelVal_Raw_PIon_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_PIon.py', - 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PIon_MC.root --fileout file:RelVal_Raw_PIon_MC_HLT_RECO.root'], - 'hlt_mc_PRef' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_PRef_MC.root', + 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_PIon_MC.root --fileout file:RelVal_Raw_PIon_MC_HLT_RECO.root'], + 'hlt_mc_PRef' : ['cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --fileout file:RelVal_Raw_PRef_MC.root', 'HLTrigger/Configuration/test/OnLine_HLT_PRef.py', - 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PRef_MC.root --fileout file:RelVal_Raw_PRef_MC_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run3_mc_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_PRef_MC.root --fileout file:RelVal_Raw_PRef_MC_HLT_RECO.root'], 'hlt_data_Fake' : ['cmsDriver.py RelVal -s L1REPACK:GT1 --data --scenario=pp -n 10 --conditions auto:run1_hlt_Fake --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake.py', 'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run1_data_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --processName=HLTRECO --filein file:RelVal_Raw_Fake_DATA.root --fileout file:RelVal_Raw_Fake_DATA_HLT_RECO.root'], @@ -31,18 +31,18 @@ def addOnTestsHLT(): 'hlt_data_Fake2': ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run2_hlt_Fake2 --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --fileout file:RelVal_Raw_Fake2_DATA.root --filein /store/data/Run2016B/JetHT/RAW/v1/000/272/762/00000/C666CDE2-E013-E611-B15A-02163E011DBE.root', 'HLTrigger/Configuration/test/OnLine_HLT_Fake2.py', 'cmsDriver.py RelVal -s HLT:Fake2,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_Fake2 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --era Run2_2016 --processName=HLTRECO --filein file:RelVal_Raw_Fake2_DATA.root --fileout file:RelVal_Raw_Fake2_DATA_HLT_RECO.root'], - 'hlt_data_GRun' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_GRun --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --fileout file:RelVal_Raw_GRun_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', + 'hlt_data_GRun' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_GRun --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --fileout file:RelVal_Raw_GRun_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', 'HLTrigger/Configuration/test/OnLine_HLT_GRun.py', - 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'], 'hlt_data_HIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_HIon --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_pp_on_PbPb --fileout file:RelVal_Raw_HIon_DATA.root --filein /store/hidata/HIRun2022A/HITestRaw0/RAW/v1/000/362/321/00000/f467ee64-fc64-47a6-9d8a-7ca73ebca2bd.root --customise=HLTrigger/Configuration/CustomConfigs.customiseL1TforHIonRepackedRAW', 'HLTrigger/Configuration/test/OnLine_HLT_HIon.py', 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3_pp_on_PbPb --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'], - 'hlt_data_PIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PIon --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --eventcontent RAW --fileout file:RelVal_Raw_PIon_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', + 'hlt_data_PIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PIon --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --eventcontent RAW --fileout file:RelVal_Raw_PIon_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', 'HLTrigger/Configuration/test/OnLine_HLT_PIon.py', - 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'], - 'hlt_data_PRef' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PRef --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3 --eventcontent RAW --fileout file:RelVal_Raw_PRef_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', + 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'], + 'hlt_data_PRef' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run3_hlt_PRef --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run3_2023 --eventcontent RAW --fileout file:RelVal_Raw_PRef_DATA.root --filein /store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root', 'HLTrigger/Configuration/test/OnLine_HLT_PRef.py', - 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3 --processName=HLTRECO --filein file:RelVal_Raw_PRef_DATA.root --fileout file:RelVal_Raw_PRef_DATA_HLT_RECO.root'], + 'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run3_data_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=HLTrigger/Configuration/CustomConfigs.HLTRECO --customise=HLTrigger/Configuration/CustomConfigs.customiseGlobalTagForOnlineBeamSpot --era Run3_2023 --processName=HLTRECO --filein file:RelVal_Raw_PRef_DATA.root --fileout file:RelVal_Raw_PRef_DATA_HLT_RECO.root'], } return addOnTestsHLT diff --git a/Configuration/HLT/python/autoCondHLT.py b/Configuration/HLT/python/autoCondHLT.py index f05ad598bf511..9288f735367c0 100644 --- a/Configuration/HLT/python/autoCondHLT.py +++ b/Configuration/HLT/python/autoCondHLT.py @@ -18,9 +18,9 @@ 'Fake' : ( ','.join( [ 'L1GtTriggerMenu_L1Menu_Collisions2012_v3_mc' , l1MenuRecord,connectionString, l1MenuLabel, "2015-10-26 12:00:00.000"] ), ), 'Fake1' : ( ','.join( [ 'L1Menu_Collisions2015_25nsStage1_v5' , l1MenuRecord,connectionString, l1MenuLabel, "2015-10-26 12:00:00.000"] ), ), 'Fake2' : ( ','.join( [ 'L1Menu_Collisions2016_v9_m2_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2016-10-06 19:36:53.000"] ), ), - 'FULL' : ( ','.join( [ 'L1Menu_Collisions2023_v1_0_0_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2023-03-08 09:39:50.000"] ), ), - 'GRun' : ( ','.join( [ 'L1Menu_Collisions2023_v1_0_0_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2023-03-08 09:39:50.000"] ), ), - '2022v15' : ( ','.join( [ 'L1Menu_Collisions2022_v1_3_0-d1_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2022-08-01 08:47:17.000"] ), ), + 'FULL' : ( ','.join( [ 'L1Menu_Collisions2023_v1_1_0-v2_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2023-05-02 08:03:44.000"] ), ), + 'GRun' : ( ','.join( [ 'L1Menu_Collisions2023_v1_1_0-v2_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2023-05-02 08:03:44.000"] ), ), + '2023v11' : ( ','.join( [ 'L1Menu_Collisions2023_v1_1_0-v2_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2023-05-02 08:03:44.000"] ), ), 'HIon' : ( ','.join( [ 'L1Menu_CollisionsHeavyIons2022_v1_1_0-d1_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2022-10-26 10:46:29.000"] ), ), 'PIon' : ( ','.join( [ 'L1Menu_HeavyIons2016_v3_m2_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2016-11-22 11:11:00.000"] ), ), 'PRef' : ( ','.join( [ 'L1Menu_pp502Collisions2017_v4_m6_xml' ,l1tMenuRecord,connectionString,l1tMenuLabel, "2017-11-03 18:00:00.000"] ), ), @@ -36,7 +36,7 @@ 'run2_mc_Fake2' : ('run2_mc' ,l1Menus['Fake2']), 'run3_mc_FULL' : ('phase1_2023_realistic' ,l1Menus['FULL']), 'run3_mc_GRun' : ('phase1_2023_realistic' ,l1Menus['GRun']), - 'run3_mc_2022v15' : ('phase1_2022_realistic' ,l1Menus['2022v15']), + 'run3_mc_2023v11' : ('phase1_2023_realistic' ,l1Menus['2023v11']), 'run3_mc_HIon' : ('phase1_2023_realistic_hi',l1Menus['HIon']), 'run3_mc_PIon' : ('phase1_2023_realistic' ,l1Menus['PIon']), 'run3_mc_PRef' : ('phase1_2023_realistic' ,l1Menus['PRef']), @@ -47,7 +47,7 @@ 'run2_hlt_Fake2' : ('run2_hlt_relval' ,l1Menus['Fake2']), 'run3_hlt_FULL' : ('run3_hlt' ,l1Menus['FULL']), 'run3_hlt_GRun' : ('run3_hlt' ,l1Menus['GRun']), - 'run3_hlt_2022v15' : ('run3_hlt' ,l1Menus['2022v15']), + 'run3_hlt_2023v11' : ('run3_hlt' ,l1Menus['2023v11']), 'run3_hlt_HIon' : ('run3_hlt' ,l1Menus['HIon']), 'run3_hlt_PIon' : ('run3_hlt' ,l1Menus['PIon']), 'run3_hlt_PRef' : ('run3_hlt' ,l1Menus['PRef']), @@ -58,7 +58,7 @@ 'run2_data_Fake2' : ('run2_data' ,l1Menus['Fake2']), 'run3_data_FULL' : ('run3_data_prompt' ,l1Menus['FULL']), 'run3_data_GRun' : ('run3_data_prompt' ,l1Menus['GRun']), - 'run3_data_2022v15' : ('run3_data_prompt' ,l1Menus['2022v15']), + 'run3_data_2023v11' : ('run3_data_prompt' ,l1Menus['2023v11']), 'run3_data_HIon' : ('run3_data_prompt' ,l1Menus['HIon']), 'run3_data_PIon' : ('run3_data_prompt' ,l1Menus['PIon']), 'run3_data_PRef' : ('run3_data_prompt' ,l1Menus['PRef']), diff --git a/Configuration/HLT/python/autoHLT.py b/Configuration/HLT/python/autoHLT.py index 6039fb273c95e..c0a63caadd60d 100644 --- a/Configuration/HLT/python/autoHLT.py +++ b/Configuration/HLT/python/autoHLT.py @@ -10,8 +10,8 @@ 'relval2016' : 'Fake2', 'relval2017' : 'Fake2', 'relval2018' : 'Fake2', - 'relval2022' : '2022v15', - 'relval2023' : 'GRun', + 'relval2022' : 'Fake2', + 'relval2023' : '2023v11', 'relval2026' : '75e33', 'test' : 'GRun', } diff --git a/Configuration/ProcessModifiers/python/displacedRegionalTracking_cff.py b/Configuration/ProcessModifiers/python/displacedRegionalTracking_cff.py new file mode 100644 index 0000000000000..070c349a0aae9 --- /dev/null +++ b/Configuration/ProcessModifiers/python/displacedRegionalTracking_cff.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for activating displacedRegionalStep step for phase1 tracking + +displacedRegionalTracking = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/trackingMkFitDevel_cff.py b/Configuration/ProcessModifiers/python/trackingMkFitDevel_cff.py index 6a71b93894d0f..2d684c88435ab 100644 --- a/Configuration/ProcessModifiers/python/trackingMkFitDevel_cff.py +++ b/Configuration/ProcessModifiers/python/trackingMkFitDevel_cff.py @@ -12,6 +12,7 @@ from Configuration.ProcessModifiers.trackingMkFitMixedTripletStep_cff import * from Configuration.ProcessModifiers.trackingMkFitPixelLessStep_cff import * from Configuration.ProcessModifiers.trackingMkFitTobTecStep_cff import * +from Configuration.ProcessModifiers.trackingMkFitDisplacedRegionalStep_cff import * # Use mkFit in selected iterations trackingMkFitDevel = cms.ModifierChain( @@ -26,5 +27,6 @@ trackingMkFitPixelPairStep, trackingMkFitMixedTripletStep, trackingMkFitPixelLessStep, - trackingMkFitTobTecStep + trackingMkFitTobTecStep, + trackingMkFitDisplacedRegionalStep ) diff --git a/Configuration/ProcessModifiers/python/trackingMkFitDisplacedRegionalStep_cff.py b/Configuration/ProcessModifiers/python/trackingMkFitDisplacedRegionalStep_cff.py new file mode 100644 index 0000000000000..ae5cccc872cf1 --- /dev/null +++ b/Configuration/ProcessModifiers/python/trackingMkFitDisplacedRegionalStep_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets replaces the default pattern recognition with mkFit for displacedRegionalStep +trackingMkFitDisplacedRegionalStep = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index e8a7ccd150dd8..f124270a5749a 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -51,7 +51,9 @@ The offsets currently in use are: * 0.6: HE Collapse (old depth segmentation for 2018) * 0.601: HLT as separate step * 0.7: trackingMkFit modifier +* 0.701: DisplacedRegionalStep tracking iteration for Run-3 * 0.8: BPH Parking (Run-2) +* 0.81: Running also HeavyFlavor DQM * 0.9: Vector hits * 0.12: Neutron background * 0.13: MLPF algorithm @@ -84,3 +86,8 @@ The offsets currently in use are: * 0.9001: Sonic Triton * 0.278: Weighted Vertexing in Blocks * 0.279: Weighted Vertexing in Blocks and tracking only wf +* 0.111: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency only) +* 0.112: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency; PS-s and SS: 1% bad strips) +* 0.113: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency; PS-s and SS: 5% bad strips) +* 0.114: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency; PS-s and SS: 10% bad strips) +* 0.141: Activate emulation of the signal shape of the InnerTracker FE chip (CROC) diff --git a/Configuration/PyReleaseValidation/python/MatrixReader.py b/Configuration/PyReleaseValidation/python/MatrixReader.py index b5038512659b0..7448cc2d7ba25 100644 --- a/Configuration/PyReleaseValidation/python/MatrixReader.py +++ b/Configuration/PyReleaseValidation/python/MatrixReader.py @@ -185,7 +185,6 @@ def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None): self.relvalModule.steps, [(x,refRel) for x in self.relvalModule.baseDataSetRelease] ) - for num, wfInfo in self.relvalModule.workflows.items(): commands=[] @@ -248,8 +247,7 @@ def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None): stepList.pop(0) #print "\t\tmod",stepList break - - + for (stepI,step) in enumerate(stepList): stepName=step if self.relvalModule.steps[stepName] is None: @@ -258,7 +256,7 @@ def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None): #cannot put a certain number of things in wm if stepName in ['SKIMD','SKIMCOSD','SKIMDreHLT']: continue - + #replace stepName is needed #if stepName in self.replaceStep if len(name) > 0 : name += '+' diff --git a/Configuration/PyReleaseValidation/python/MatrixRunner.py b/Configuration/PyReleaseValidation/python/MatrixRunner.py index 1d72a59c8e73b..0120e65f5b865 100644 --- a/Configuration/PyReleaseValidation/python/MatrixRunner.py +++ b/Configuration/PyReleaseValidation/python/MatrixRunner.py @@ -59,7 +59,7 @@ def runTests(self, opt): print('\nPreparing to run %s %s' % (wf.numId, item)) sys.stdout.flush() - current = WorkFlowRunner(wf,noRun,dryRun,cafVeto, opt.dasOptions, opt.jobReports, opt.nThreads, opt.nStreams, opt.maxSteps) + current = WorkFlowRunner(wf,noRun,dryRun,cafVeto, opt.dasOptions, opt.jobReports, opt.nThreads, opt.nStreams, opt.maxSteps, opt.nEvents) self.threadList.append(current) current.start() if not dryRun: diff --git a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py index fcf6a942502bb..e30c7d8fa000f 100644 --- a/Configuration/PyReleaseValidation/python/WorkFlowRunner.py +++ b/Configuration/PyReleaseValidation/python/WorkFlowRunner.py @@ -8,7 +8,7 @@ from datetime import datetime class WorkFlowRunner(Thread): - def __init__(self, wf, noRun=False,dryRun=False,cafVeto=True,dasOptions="",jobReport=False, nThreads=1, nStreams=0, maxSteps=9999): + def __init__(self, wf, noRun=False,dryRun=False,cafVeto=True,dasOptions="",jobReport=False, nThreads=1, nStreams=0, maxSteps=9999, nEvents=0): Thread.__init__(self) self.wf = wf @@ -24,6 +24,7 @@ def __init__(self, wf, noRun=False,dryRun=False,cafVeto=True,dasOptions="",jobRe self.nThreads=nThreads self.nStreams=nStreams self.maxSteps=maxSteps + self.nEvents=nEvents self.wfDir=str(self.wf.numId)+'_'+self.wf.nameId return @@ -166,6 +167,11 @@ def closeCmd(i,ID): cmd += ' --nThreads %s' % self.nThreads if (self.nStreams > 0) and ('HARVESTING' not in cmd) and ('ALCAHARVEST' not in cmd): cmd += ' --nStreams %s' % self.nStreams + if (self.nEvents > 0): + event_token = " -n " + split = cmd.split(event_token) + pos_cmd = " ".join(split[1].split(" ")[1:]) + cmd = split[0] + event_token + '%s ' % self.nEvents + pos_cmd cmd+=closeCmd(istep,self.wf.nameId) retStep = 0 if istep>self.maxSteps: diff --git a/Configuration/PyReleaseValidation/python/relval_2017.py b/Configuration/PyReleaseValidation/python/relval_2017.py index 68bd09c452df1..f4e36910e69fc 100644 --- a/Configuration/PyReleaseValidation/python/relval_2017.py +++ b/Configuration/PyReleaseValidation/python/relval_2017.py @@ -46,6 +46,7 @@ # (QCD 1.8TeV DeepCore) # (TTbar DigiNoHLT) # 2023 (TTbar, TTbar PU, TTbar PU premix) +# (TTbar trackingMkFit) # (TTbar FastSim) # 2024 (TTbar, TTbar PU, TTbar PU premix) numWFIB = [10001.0,10002.0,10003.0,10004.0,10005.0,10006.0,10007.0,10008.0,10009.0,10059.0,10071.0, @@ -82,6 +83,7 @@ 11723.17, 11634.601, 12434.0,12634.0,12634.99, + 12434.7, 14034.0, 12834.0,13034.0,13034.99,] for numWF in numWFIB: diff --git a/Configuration/PyReleaseValidation/python/relval_2026.py b/Configuration/PyReleaseValidation/python/relval_2026.py index 254b71a6313ea..857b5cdc121d5 100644 --- a/Configuration/PyReleaseValidation/python/relval_2026.py +++ b/Configuration/PyReleaseValidation/python/relval_2026.py @@ -15,8 +15,7 @@ #2026 WFs to run in IB (TTbar) numWFIB = [] numWFIB.extend([20034.0]) #2026D86 -numWFIB.extend([20834.0,20834.911,20834.103]) #2026D88 DDD XML, DD4hep XML, aging -numWFIB.extend([20834.75,20834.76]) #2026D88 with HLT75e33 after RECO, HLTe33 with the same step with Digi+L1 +numWFIB.extend([20834.0]) #2026D88 numWFIB.extend([21061.97]) #2026D88 premixing stage1 (NuGun+PU) numWFIB.extend([20834.5,20834.9,20834.501,20834.502]) #2026D88 pixelTrackingOnly, vector hits, Patatrack local reconstruction on CPU, Patatrack local reconstruction on GPU numWFIB.extend([21034.99,21034.999]) #2026D88 premixing combined stage1+stage2 (ttbar+PU200, ttbar+PU50 for PR test) @@ -26,16 +25,22 @@ numWFIB.extend([22434.0]) #2026D92 numWFIB.extend([22834.0]) #2026D93 numWFIB.extend([23234.0]) #2026D94 -numWFIB.extend([23634.0]) #2026D95 +numWFIB.extend([23634.0,23634.911,23634.103]) #2026D95 DDD XML, DD4hep XML, aging +numWFIB.extend([23861.97]) #2026D95 premixing stage1 (NuGun+PU) +numWFIB.extend([23634.5,23634.9]) #2026D95 pixelTrackingOnly, vector hits +numWFIB.extend([23834.99,23834.999]) #2026D95 premixing combined stage1+stage2 (ttbar+PU200, ttbar+PU50 for PR test) +numWFIB.extend([23634.21,23834.21,23834.9921]) #2026D95 prodlike, prodlike PU, prodlike premix stage1+stage2 numWFIB.extend([24034.0]) #2026D96 numWFIB.extend([24434.0]) #2026D97 numWFIB.extend([24834.0]) #2026D98 -numWFIB.extend([25234.0]) #2026D99 +numWFIB.extend([25234.0,25234.911]) #2026D99 DDD XML, DD4hep XML #Additional sample for short matrix and IB #CloseByPGun for HGCAL numWFIB.extend([20896.0]) #CE_E_Front_120um D88 numWFIB.extend([20900.0]) #CE_H_Coarse_Scint D88 +numWFIB.extend([23696.0]) #CE_E_Front_120um D95 +numWFIB.extend([23700.0]) #CE_H_Coarse_Scint D95 for numWF in numWFIB: workflows[numWF] = _upgrade_workflows[numWF] diff --git a/Configuration/PyReleaseValidation/python/relval_gpu.py b/Configuration/PyReleaseValidation/python/relval_gpu.py index 89a9257835fe8..0014f37857070 100644 --- a/Configuration/PyReleaseValidation/python/relval_gpu.py +++ b/Configuration/PyReleaseValidation/python/relval_gpu.py @@ -14,7 +14,7 @@ # just define all of them # WFs to run in IB: -# mc 2018 Patatrack pixel-only quadruplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling +# mc 2022 Patatrack pixel-only quadruplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only triplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only quadruplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only triplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling @@ -25,7 +25,7 @@ # full reco with Patatrack pixel-only quadruplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling # full reco with Patatrack pixel-only triplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling -# mc 2021 Patatrack pixel-only quadruplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling +# mc 2023 Patatrack pixel-only quadruplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only triplets: ZMM - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only quadruplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling # Patatrack pixel-only triplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling @@ -36,16 +36,7 @@ # full reco with Patatrack pixel-only quadruplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling # full reco with Patatrack pixel-only triplets: TTbar - on GPU (optional), GPU-vs-CPU validation, profiling numWFIB = [ - 10842.502, 10842.503, 10842.504, - 10842.506, 10842.507, 10842.508, - 10824.502, 10824.503, 10824.504, - 10824.506, 10824.507, 10824.508, - 10824.512, 10824.513, 10824.514, - 10824.522, 10824.523, 10824.524, - 10824.582, 10824.583, # 10824.524, - 10824.586, 10824.587, # 10824.528, - 10824.592, 10824.593, - 10824.596, 10824.597, + # 2022 11650.502, 11650.503, 11650.504, 11650.506, 11650.507, 11650.508, 11634.502, 11634.503, 11634.504, @@ -56,19 +47,27 @@ 11634.586, 11634.587, # 11634.528, 11634.592, 11634.593, 11634.596, 11634.597, + + # 2023 + 12450.502, 12450.503, 12450.504, + 12450.506, 12450.507, 12450.508, + 12434.502, 12434.503, 12434.504, + 12434.506, 12434.507, 12434.508, + 12434.512, 12434.513, 12434.514, + 12434.522, 12434.523, 12434.524, + 12434.582, 12434.583, + 12434.586, 12434.587, + 12434.592, 12434.593, + 12434.596, 12434.597, ] for numWF in numWFIB: if not numWF in _upgrade_workflows: continue workflows[numWF] = _upgrade_workflows[numWF] -# data 2018 Patatrack pixel-only quadruplets: RunHLTPhy2018D on GPU (optional), RunJetHT2018D on GPU (optional) -# Patatrack ECAL-only: RunHLTPhy2018D on GPU (optional), RunJetHT2018D on GPU (optional) -# Patatrack HCAL-only: RunHLTPhy2018D on GPU (optional), RunJetHT2018D on GPU (optional) - -workflows[136.885502] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_Patatrack_PixelOnlyGPU','HARVEST2018_pixelTrackingOnly']] -workflows[136.888502] = ['RunJetHT2018DpixelGPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_Patatrack_PixelOnlyGPU','HARVEST2018_pixelTrackingOnly']] -workflows[136.885512] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_ECALOnlyGPU','HARVEST2018_ECALOnly']] -workflows[136.888512] = ['RunJetHT2018DecalGPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_ECALOnlyGPU','HARVEST2018_ECALOnly']] -workflows[136.885522] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyGPU','HARVEST2018_HCALOnly']] -workflows[136.888522] = ['RunJetHT2018DhcalGPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyGPU','HARVEST2018_HCALOnly']] +# data 2023 Patatrack pixel-only triplets: RunJetMET2022D on GPU (optional) +# Patatrack ECAL-only: RunJetMET2022D on GPU (optional) +# Patatrack HCAL-only: RunJetMET2022D on GPU (optional) +workflows[140.065506] = ['Run3-2023_JetMET2022D_RecoPixelOnlyTripletsGPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_Patatrack_PixelOnlyTripletsGPU','HARVESTRUN3_pixelTrackingOnly']] +workflows[140.065512] = ['Run3-2023_JetMET2022D_RecoECALOnlyGPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_ECALOnlyGPU','HARVESTRUN3_ECALOnly']] +workflows[140.065522] = ['Run3-2023_JetMET2022D_RecoHCALOnlyGPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_HCALOnlyGPU','HARVESTRUN3_HCALOnly']] diff --git a/Configuration/PyReleaseValidation/python/relval_nano.py b/Configuration/PyReleaseValidation/python/relval_nano.py index 74fb42436e75a..221f7e85d536e 100644 --- a/Configuration/PyReleaseValidation/python/relval_nano.py +++ b/Configuration/PyReleaseValidation/python/relval_nano.py @@ -106,6 +106,9 @@ steps['NANO_data12.4']=merge([{'--era':'Run3,run3_nanoAOD_124', '--conditions':'auto:run3_data'}, _NANO_data]) +#prompt nano test +steps['NANO_data12.4_prompt']=merge([{'--customise' : 'PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomize', '-n' : '1000'}, + steps['NANO_data12.4']]) ##12.6 workflows steps['TTBarMINIAOD12.6'] = {'INPUT':InputInfo(location='STD',ls=run3_lumis, @@ -134,6 +137,8 @@ #12.4 input workflows[2500.501] = ['NANOmc124Xrun3', ['TTbarMINIAOD12.4','NANO_mc12.4', 'HRV_NANO_mc']] workflows[2500.511] = ['NANOdata124Xrun3', ['MuonEG2022MINIAOD12.4','NANO_data12.4', 'HRV_NANO_data']] +workflows[2500.5111] = ['NANOdata124Xrun3', ['MuonEG2022MINIAOD12.4','NANO_data12.4_prompt', 'HRV_NANO_data']] + ################ #12.6 workflows diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 01febbafd179c..0afce4f509280 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -409,17 +409,7 @@ ### run 2018D pixel tracks ### workflows[136.8855] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_Prompt_pixelTrackingOnly','HARVEST2018_pixelTrackingOnly']] -workflows[136.885501] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_Patatrack_PixelOnlyCPU','HARVEST2018_pixelTrackingOnly']] workflows[136.8885] = ['',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_Prompt_pixelTrackingOnly','HARVEST2018_pixelTrackingOnly']] -workflows[136.888501] = ['RunJetHT2018DpixelCPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_Patatrack_PixelOnlyCPU','HARVEST2018_pixelTrackingOnly']] - -### run 2018D ECAL-only ### -workflows[136.885511] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_ECALOnlyCPU','HARVEST2018_ECALOnly']] -workflows[136.888511] = ['RunJetHT2018DecalCPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_ECALOnlyCPU','HARVEST2018_ECALOnly']] - -### run 2018D HCAL-only ### -workflows[136.885521] = ['',['RunHLTPhy2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyCPU','HARVEST2018_HCALOnly']] -workflows[136.888521] = ['RunJetHT2018DhcalCPU',['RunJetHT2018D','HLTDR2_2018','RECODR2_2018reHLT_HCALOnlyCPU','HARVEST2018_HCALOnly']] ### run 2021 CRUZET/CRAFT ### workflows[136.897] = ['',['RunCosmics2021CRUZET','RECOCOSDRUN3','ALCACOSDRUN3','HARVESTDCR3']] @@ -494,22 +484,37 @@ workflows[140.068] = ['',['RunTau2022D','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] workflows[140.069] = ['',['RunMuonEG2022D','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] -### run3 (2022) skims ### -workflows[140.104] = ['',['RunZeroBias2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMZEROBIASRUN3_reHLT']] -workflows[140.105] = ['',['RunBTagMu2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMBTAGMURUN3_reHLT']] -workflows[140.106] = ['',['RunJetHT2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMJETMETRUN3_reHLT']] -workflows[140.107] = ['',['RunDisplacedJet2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMDISPLACEDJETRUN3_reHLT']] -workflows[140.109] = ['',['RunEGamma2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMEGAMMARUN3_reHLT']] -workflows[140.110] = ['',['RunTau2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMTAURUN3_reHLT']] -workflows[140.111] = ['',['RunDoubleMuon2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMMUONRUN3_reHLT']] -workflows[140.112] = ['',['RunMuonEG2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMMUONEGRUN3_reHLT']] -workflows[140.113] = ['',['RunNoBPTX2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMNOBPTXRUN3_reHLT']] -workflows[140.114] = ['',['RunHcalNZS2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMHCALNZSRUN3_reHLT']] -workflows[140.115] = ['',['RunHLTPhysics2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMHLTPHYSICSRUN3_reHLT']] -workflows[140.116] = ['',['RunCommissioning2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMCOMMISSIONINGRUN3_reHLT']] -workflows[140.117] = ['',['RunCosmics2022B','HLTDR3_2023','RECOCOSMRUN3_reHLT','SKIMCOSMICSRUN3_reHLT']] +### run3-2023 (2022 data) - Pixel-only (triplets), ECAL-only and HCAL-only +workflows[140.065505] = ['Run3-2023_JetMET2022D_RecoPixelOnlyTripletsCPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_Patatrack_PixelOnlyTripletsCPU','HARVESTRUN3_pixelTrackingOnly']] +workflows[140.065511] = ['Run3-2023_JetMET2022D_RecoECALOnlyCPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_ECALOnlyCPU','HARVESTRUN3_ECALOnly']] +workflows[140.065521] = ['Run3-2023_JetMET2022D_RecoHCALOnlyCPU',['RunJetMET2022D','HLTDR3_2023','RECODR3_reHLT_HCALOnlyCPU','HARVESTRUN3_HCALOnly']] + +workflows[140.071] = ['',['RunMuon2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.072] = ['',['RunZeroBias2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.073] = ['',['RunBTagMu2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.074] = ['',['RunJetMET2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.075] = ['',['RunDisplacedJet2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.076] = ['',['RunEGamma2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.077] = ['',['RunTau2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] +workflows[140.078] = ['',['RunMuonEG2022E','HLTDR3_2023','RECONANORUN3_reHLT','HARVESTRUN3']] + +### run3 (2023) skims ### +workflows[140.104] = ['',['RunZeroBias2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMZEROBIASRUN3_reHLT']] +workflows[140.105] = ['',['RunBTagMu2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMBTAGMURUN3_reHLT']] +workflows[140.106] = ['',['RunJetMET2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMJETMET0RUN3_reHLT']] +workflows[140.107] = ['',['RunDisplacedJet2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMDISPLACEDJETRUN3_reHLT']] +workflows[140.109] = ['',['RunEGamma2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMEGAMMA0RUN3_reHLT']] +workflows[140.110] = ['',['RunTau2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMTAURUN3_reHLT']] +workflows[140.111] = ['',['RunMuon2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMMUON0RUN3_reHLT']] +workflows[140.112] = ['',['RunMuonEG2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMMUONEGRUN3_reHLT']] +workflows[140.113] = ['',['RunNoBPTX2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMNOBPTXRUN3_reHLT']] +workflows[140.114] = ['',['RunHcalNZS2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMHCALNZSRUN3_reHLT']] +workflows[140.115] = ['',['RunHLTPhysics2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMHLTPHYSICSRUN3_reHLT']] +workflows[140.116] = ['',['RunCommissioning2022D','HLTDR3_2023','RECONANORUN3_reHLT','SKIMCOMMISSIONINGRUN3_reHLT']] +workflows[140.117] = ['',['RunCosmics2022D','HLTDR3_2023','RECOCOSMRUN3_reHLT','SKIMCOSMICSRUN3_reHLT']] #workflows[140.118] = ['',['RunParkingBPH2022B','HLTDR3_2023','RECONANORUN3_reHLT','SKIMPARKINGBPHRUN3_reHLT']] + ### fastsim ### workflows[5.1] = ['TTbarFS', ['TTbarFS','HARVESTFS']] workflows[5.2] = ['SingleMuPt10FS', ['SingleMuPt10FS','HARVESTFS']] @@ -789,4 +794,3 @@ ### pPb Run2 ### workflows[281]= ['',['EPOS_PPb_8160GeV_MinimumBias','DIGIUP15_PPb','RECOUP15_PPb','HARVESTUP15_PPb']] - diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 802236073733b..cac66fc80c027 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -549,6 +549,20 @@ steps['RunTau2022D']={'INPUT':InputInfo(dataSet='/Tau/Run2022D-v1/RAW',label='2022D',events=100000,location='STD', ls=Run2022D_LS100)} steps['RunMuonEG2022D']={'INPUT':InputInfo(dataSet='/MuonEG/Run2022D-v1/RAW',label='2022D',events=100000,location='STD', ls=Run2022D_LS100)} + +Run2022E={359694: [[1, 50]]} +Run2022E_LS100={359694: [[1, 100]]} +Run2022E_LS200={359694: [[1, 200]]} +steps['RunMuon2022E']={'INPUT':InputInfo(dataSet='/Muon/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E)} +steps['RunZeroBias2022E']={'INPUT':InputInfo(dataSet='/ZeroBias/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E_LS100)} +steps['RunBTagMu2022E']={'INPUT':InputInfo(dataSet='/BTagMu/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E_LS100)} +steps['RunJetMET2022E']={'INPUT':InputInfo(dataSet='/JetMET/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E)} +steps['RunDisplacedJet2022E']={'INPUT':InputInfo(dataSet='/DisplacedJet/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E_LS200)} +steps['RunEGamma2022E']={'INPUT':InputInfo(dataSet='/EGamma/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E)} +steps['RunTau2022E']={'INPUT':InputInfo(dataSet='/Tau/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E_LS200)} +steps['RunMuonEG2022E']={'INPUT':InputInfo(dataSet='/MuonEG/Run2022E-v1/RAW',label='2022E',events=100000,location='STD', ls=Run2022E_LS200)} + + Run2022FCosmics_LS24={360336: [[24, 24]]} Run2022FCosmics={360333: [[1,105]]} steps['RunCosmics2022F']={'INPUT':InputInfo(dataSet='/Cosmics/Run2022F-v1/RAW',label='2022F',events=100000,location='STD', ls=Run2022FCosmics_LS24)} @@ -2520,7 +2534,7 @@ def lhegensim2018ml(fragment,howMuch): '--era':'Run3', '--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run3'},dataReco]) -steps['RECODR3_reHLT']=merge([{'--conditions':'auto:run3_data_prompt_relval', '--hltProcess':'reHLT'},steps['RECODR3']]) +steps['RECODR3_reHLT']=merge([{'--conditions':'auto:run3_data_relval', '--hltProcess':'reHLT'},steps['RECODR3']]) steps['RECODR3Splash']=merge([{'-n': 2, '-s': 'RAW2DIGI,L1Reco,RECO,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@standardDQMFakeHLT+@miniAODDQM' @@ -2553,7 +2567,7 @@ def lhegensim2018ml(fragment,howMuch): '--data':'', '--era':'Run3', '--scenario':'pp', - '--conditions':'auto:run3_data_prompt_relval', + '--conditions':'auto:run3_data_relval', '--hltProcess':'reHLT'} if 'Cosmics' in s: steps['SKIM'+s.upper()+'RUN3_reHLT']['--scenario'] = 'cosmics' @@ -2627,7 +2641,7 @@ def gen2022HiMix(fragment,howMuch): '--procModifiers': 'pixelNtupletFit,gpu' } step3_pixel_triplets = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise': 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' } step3_gpu = { '--procModifiers': 'gpu', @@ -2759,15 +2773,6 @@ def gen2022HiMix(fragment,howMuch): steps['RECODR2_2018reHLT_Prompt']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_ZBPrompt']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,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_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_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']]) -steps['RECODR2_2018reHLT_HCALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,DQM:@hcalOnly+@hcal2Only'},steps['RECODR2_2018reHLT_Prompt']]) -steps['RECODR2_2018reHLT_HCALOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_HCALOnlyCPU']]) steps['RECODR2_2018reHLT_Offline']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_ZBOffline']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_skimEGamma_Prompt_L1TEgDQM']=merge([{'--conditions':'auto:run2_data'},steps['RECODR2_2018reHLT_skimEGamma_L1TEgDQM']]) @@ -2845,6 +2850,15 @@ def gen2022HiMix(fragment,howMuch): steps['RECODR3_reHLT_ZBOffline']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign+HcalCalIsoTrkProducerFilter,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM','--procModifiers':'siPixelQualityRawToDigi'},steps['RECODR3_reHLT']]) steps['RECODR3_reHLT_HLTPhysics_Offline']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,PAT,ALCA:TkAlMinBias+HcalCalIterativePhiSym+HcalCalIsoTrkProducerFilter+HcalCalHO+HcalCalHBHEMuonProducerFilter,DQM:@commonReduced+@miniAODDQM','--procModifiers':'siPixelQualityRawToDigi'},steps['RECODR3_reHLT']]) steps['RECODR3_reHLT_AlCaTkCosmics_Offline']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,SKIM:EXONoBPTXSkim,PAT,ALCA:TkAlCosmicsInCollisions,DQM:@standardDQM+@miniAODDQM'},steps['RECODR3_reHLT']]) +steps['RECODR3_reHLT_pixelTrackingOnly']=merge([{'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,DQM:@pixelTrackingOnlyDQM'},steps['RECODR3_reHLT']]) +steps['RECODR3_reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixel_ntuplet_cpu, steps['RECODR3_reHLT_pixelTrackingOnly']]) +steps['RECODR3_reHLT_Patatrack_PixelOnlyGPU']=merge([step3_pixel_ntuplet_gpu, steps['RECODR3_reHLT_pixelTrackingOnly']]) +steps['RECODR3_reHLT_Patatrack_PixelOnlyTripletsCPU']=merge([step3_pixel_ntuplet_cpu, step3_pixel_triplets, steps['RECODR3_reHLT_pixelTrackingOnly']]) +steps['RECODR3_reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_pixel_ntuplet_gpu, step3_pixel_triplets, steps['RECODR3_reHLT_pixelTrackingOnly']]) +steps['RECODR3_reHLT_ECALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,DQM:@ecalOnly'},steps['RECODR3_reHLT']]) +steps['RECODR3_reHLT_ECALOnlyGPU']=merge([step3_gpu, steps['RECODR3_reHLT_ECALOnlyCPU']]) +steps['RECODR3_reHLT_HCALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,DQM:@hcalOnly+@hcal2Only'},steps['RECODR3_reHLT']]) +steps['RECODR3_reHLT_HCALOnlyGPU']=merge([step3_gpu, steps['RECODR3_reHLT_HCALOnlyCPU']]) steps['RECONANORUN3_reHLT']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,PAT,NANO,DQM:@standardDQM+@miniAODDQM+@nanoAODDQM'},steps['RECODR3_reHLT']]) steps['RECOCOSMRUN3_reHLT']=merge([{'--scenario':'cosmics','-s':'RAW2DIGI,L1Reco,RECO,DQM','--datatier':'RECO,DQMIO','--eventcontent':'RECO,DQM'},steps['RECONANORUN3_reHLT']]) @@ -3344,8 +3358,6 @@ def gen2022HiMix(fragment,howMuch): steps['HARVEST2018_L1TMuDQM'] = merge([ {'-s':'HARVESTING:@commonFakeHLT+@muon+@lumi+@L1TMuon'}, steps['HARVEST2018'] ]) steps['HARVEST2018_L1TMuDQM_Prompt'] = merge([ {'-s':'HARVESTING:@commonFakeHLT+@muon+@lumi+@L1TMuon'}, steps['HARVEST2018_Prompt'] ]) steps['HARVEST2018_pixelTrackingOnly'] = merge([ {'-s':'HARVESTING:@pixelTrackingOnlyDQM'}, steps['HARVEST2018'] ]) -steps['HARVEST2018_ECALOnly'] = merge([ {'-s':'HARVESTING:@ecal'}, steps['HARVEST2018'] ]) -steps['HARVEST2018_HCALOnly'] = merge([ {'-s':'HARVESTING:@hcalOnly'}, steps['HARVEST2018'] ]) steps['HARVEST2018_hBStar'] = merge([ {'--era' : 'Run2_2018_highBetaStar'}, steps['HARVEST2018'] ]) steps['HARVEST2018_HEfail'] = merge([ {'--conditions':'auto:run2_data_HEfail'}, steps['HARVEST2018'] ]) steps['HARVEST2018_skimJetHT'] = merge([ {'-s':'HARVESTING:@commonFakeHLT+@jetmet+@hcalOnly'}, steps['HARVEST2018'] ]) @@ -3414,7 +3426,7 @@ def gen2022HiMix(fragment,howMuch): steps['HARVESTDCRUN2']=merge([{'--conditions':'auto:run2_data','--era':'Run2_2016'},steps['HARVESTDC']]) steps['HARVESTDR3'] = merge([{'--conditions':'auto:run3_data','--era':'Run3'}, steps['HARVESTD']]) -steps['HARVESTDR3_reHLT'] = merge([{'--conditions':'auto:run3_data_prompt_relval','--hltProcess':'reHLT','-s':'HARVESTING:@standardDQM+@miniAODDQM'}, steps['HARVESTDR3']]) +steps['HARVESTDR3_reHLT'] = merge([{'--conditions':'auto:run3_data_relval','--hltProcess':'reHLT','-s':'HARVESTING:@standardDQM+@miniAODDQM'}, steps['HARVESTDR3']]) steps['HARVESTD2021MB_reHLT'] = merge([{'-s':'HARVESTING:@commonSiStripZeroBias+@ExtraHLT+@miniAODDQM'}, steps['HARVESTDR3_reHLT'] ]) steps['HARVESTD2021ZB_reHLT'] = merge([{'-s':'HARVESTING:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'}, steps['HARVESTDR3_reHLT'] ]) steps['HARVESTD2021HLTPhy_reHLT'] = merge([{'-s':'HARVESTING:@commonReduced+@miniAODDQM'}, steps['HARVESTDR3_reHLT'] ]) @@ -3473,7 +3485,10 @@ def gen2022HiMix(fragment,howMuch): steps['HARVESTRUN3']=merge([{'--data':'', '-s':'HARVESTING:@standardDQM+@miniAODDQM+@nanoAODDQM','--era':'Run3'},steps['HARVESTDRUN3']]) - +steps['HARVESTRUN3_pixelTrackingOnly'] = merge([ {'-s':'HARVESTING:@pixelTrackingOnlyDQM'}, steps['HARVESTRUN3'] ]) +steps['HARVESTRUN3_ECALOnly'] = merge([ {'-s':'HARVESTING:@ecal'}, steps['HARVESTRUN3'] ]) +steps['HARVESTRUN3_HCALOnly'] = merge([ {'-s':'HARVESTING:@hcalOnly'}, steps['HARVESTRUN3'] ]) + #MC steps['HARVEST']={'-s':'HARVESTING:validationHarvestingNoHLT+dqmHarvestingFakeHLT', '--conditions':'auto:run1_mc', @@ -3903,7 +3918,7 @@ def gen2022HiMix(fragment,howMuch): defaultDataSets['2017Design']='CMSSW_12_0_0_pre4-113X_mc2017_design_v5-v' defaultDataSets['2018']='CMSSW_12_0_0_pre4-113X_upgrade2018_realistic_v5-v' defaultDataSets['2018Design']='CMSSW_12_0_0_pre4-113X_upgrade2018_design_v5-v' -defaultDataSets['2021']='CMSSW_12_5_0_pre4-124X_mcRun3_2022_realistic_v10_BS2022-v' +defaultDataSets['2021']='CMSSW_13_1_0_pre1-130X_mcRun3_2022_realistic_withNewBSFromEOY2022Data_v2_RV186-v' defaultDataSets['2021Design']='CMSSW_12_5_0_pre4-124X_mcRun3_2022_design_v7_design_BS2022-v' defaultDataSets['2021FS']='CMSSW_12_5_0_pre4-124X_mcRun3_2022_realistic_v10_BS2022_FastSim-v' defaultDataSets['2023']='CMSSW_12_5_0_pre4-124X_mcRun3_2023_realistic_v11_BS2022-v' @@ -3912,13 +3927,15 @@ def gen2022HiMix(fragment,howMuch): defaultDataSets['2026D76']='CMSSW_12_0_0_pre4-113X_mcRun4_realistic_v7_2026D76noPU-v' defaultDataSets['2026D77']='CMSSW_12_1_0_pre2-113X_mcRun4_realistic_v7_2026D77noPU-v' defaultDataSets['2026D88']='CMSSW_12_3_0_pre5-123X_mcRun4_realistic_v4_2026D88noPU-v' +defaultDataSets['2026D95']='CMSSW_13_1_0_pre1-130X_mcRun4_realistic_v2_2026D95noPU-v' +defaultDataSets['2026D96']='CMSSW_13_1_0_pre1-130X_mcRun4_realistic_v2_2026D96noPU-v' puDataSets = {} for key, value in defaultDataSets.items(): puDataSets[key+'PU'] = value defaultDataSets.update(puDataSets) # sometimes v1 won't be used - override it here - the dictionary key is gen fragment + '_' + geometry -versionOverrides={'BuMixing_BMuonFilter_forSTEAM_13TeV_TuneCUETP8M1_2017':'2','HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_2017':'2','RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_2017':'2','WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_2017':'2','DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_2017':'2','TenE_E_0_200_pythia8_2017':'2','TenE_E_0_200_pythia8_2017PU':'2', 'TenTau_E_15_500_pythia8_2018':'2','PhotonJet_Pt_10_13TeV_TuneCUETP8M1_2018':'2','Wjet_Pt_80_120_13TeV_TuneCUETP8M1_2018':'2'} +versionOverrides={'BuMixing_BMuonFilter_forSTEAM_13TeV_TuneCUETP8M1_2017':'2','HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_2017':'2','RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_2017':'2','WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_2017':'2','DisplacedSUSY_stopToBottom_M_300_1000mm_TuneCUETP8M1_13TeV_pythia8_2017':'2','TenE_E_0_200_pythia8_2017':'2','TenE_E_0_200_pythia8_2017PU':'2', 'TenTau_E_15_500_pythia8_2018':'2','PhotonJet_Pt_10_13TeV_TuneCUETP8M1_2018':'2','Wjet_Pt_80_120_13TeV_TuneCUETP8M1_2018':'2','SingleMuPt10_Eta2p85_2021':'2','SingleMuPt100_Eta2p85_2021':'2','SingleMuPt1000_Eta2p85_2021':'2'} baseDataSetReleaseBetter={} for gen in upgradeFragments: @@ -4032,7 +4049,7 @@ def gen2022HiMix(fragment,howMuch): '--eventcontent':'FEVTDEBUGHLT', '--geometry' : geom } - + upgradeStepDict['HLTRun3'][k] = {'-s':'HLT:%s'%(hltversion), '--conditions':gt, '--datatier':'GEN-SIM-DIGI-RAW', @@ -4041,7 +4058,7 @@ def gen2022HiMix(fragment,howMuch): '--geometry' : geom, '--outputCommands' : '"drop *_*_*_GEN,drop *_*_*_DIGI2RAW"' } - + upgradeStepDict['HLT75e33'][k] = {'-s':'HLT:@relval2026', '--processName':'HLTX', '--conditions':gt, @@ -4050,7 +4067,7 @@ def gen2022HiMix(fragment,howMuch): '--eventcontent':'FEVTDEBUGHLT', '--geometry' : geom } - + upgradeStepDict['Reco'][k] = {'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM', '--conditions':gt, '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', @@ -4099,21 +4116,29 @@ def gen2022HiMix(fragment,howMuch): '--filetype':'DQM', } - upgradeStepDict['HARVESTNano'][k]={'-s':'HARVESTING:@standardValidation+@standardDQM+@ExtraHLT+@miniAODValidation+@miniAODDQM+@nanoAODDQM', + upgradeStepDict['HARVESTFakeHLT'][k]={'-s':'HARVESTING:@standardValidationNoHLT+@standardDQMFakeHLT+@miniAODValidation+@miniAODDQM', '--conditions':gt, '--mc':'', '--geometry' : geom, '--scenario' : 'pp', '--filetype':'DQM', - } - - upgradeStepDict['HARVESTFakeHLT'][k]={'-s':'HARVESTING:@standardValidationNoHLT+@standardDQMFakeHLT+@miniAODValidation+@miniAODDQM', - '--conditions':gt, - '--mc':'', - '--geometry' : geom, - '--scenario' : 'pp', - '--filetype':'DQM', - } + } + + upgradeStepDict['HARVESTNano'][k]={'-s': 'HARVESTING:@standardValidation+@standardDQM+@ExtraHLT+@miniAODValidation+@miniAODDQM+@nanoAODDQM', + '--conditions': gt, + '--mc': '', + '--geometry': geom, + '--scenario': 'pp', + '--filetype': 'DQM', + } + + upgradeStepDict['HARVESTNanoFakeHLT'][k]={'-s': 'HARVESTING:@standardValidationNoHLT+@standardDQMFakeHLT+@miniAODValidation+@miniAODDQM+@nanoAODDQM', + '--conditions': gt, + '--mc': '', + '--geometry': geom, + '--scenario': 'pp', + '--filetype': 'DQM', + } upgradeStepDict['HARVESTGlobal'][k] = merge([{'-s': 'HARVESTING:@phase2Validation+@phase2+@miniAODValidation+@miniAODDQM'}, upgradeStepDict['HARVEST'][k]]) @@ -4135,7 +4160,7 @@ def gen2022HiMix(fragment,howMuch): '--fast':'', '--geometry' : geom, '--relval':'27000,3000'} - + upgradeStepDict['HARVESTFast'][k]={'-s':'HARVESTING:validationHarvesting', '--conditions':gt, '--mc':'', @@ -4152,7 +4177,7 @@ def gen2022HiMix(fragment,howMuch): '--eventcontent':'FEVTDEBUGHLT,MINIAODSIM,NANOEDMAODSIM,DQM', '--datatier':'GEN-SIM-DIGI-RECO,MINIAODSIM,NANOAODSIM,DQMIO', } - + upgradeStepDict['HARVESTFastRun3'][k]={'-s':'HARVESTING:validationHarvesting+@miniAODValidation+@miniAODDQM+@nanoAODDQM', '--conditions':gt, '--mc':'', @@ -4161,7 +4186,7 @@ def gen2022HiMix(fragment,howMuch): '--scenario':'pp', '--filetype':'DQM', '--filein':'file:step2_inDQM.root'} - + upgradeStepDict['Nano'][k] = {'-s':'NANO,DQM:@nanoAODDQM', '--conditions':gt, '--datatier':'NANOAODSIM,DQMIO', @@ -4170,15 +4195,23 @@ def gen2022HiMix(fragment,howMuch): '--filein':'file:step3_inMINIAODSIM.root', '--geometry' : geom } - + upgradeStepDict['RecoNano'][k] = {'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,PAT,NANO,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@nanoAODDQM', '--conditions':gt, '--datatier':'GEN-SIM-RECO,MINIAODSIM,NANOAODSIM,DQMIO', '-n':'10', '--eventcontent':'RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM', - '--geometry' : geom + '--geometry' : geom, } - + + upgradeStepDict['RecoNanoFakeHLT'][k] = {'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,PAT,NANO,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM+@nanoAODDQM', + '--conditions':gt, + '--datatier':'GEN-SIM-RECO,MINIAODSIM,NANOAODSIM,DQMIO', + '-n':'10', + '--eventcontent':'RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM', + '--geometry' : geom, + } + # setup baseline and variations for specialType,specialWF in upgradeWFs.items(): specialWF.setup(upgradeStepDict, k, upgradeProperties[year][k]) diff --git a/Configuration/PyReleaseValidation/python/relval_upgrade.py b/Configuration/PyReleaseValidation/python/relval_upgrade.py index c6551e92c22b4..e6adaab29c36f 100644 --- a/Configuration/PyReleaseValidation/python/relval_upgrade.py +++ b/Configuration/PyReleaseValidation/python/relval_upgrade.py @@ -47,10 +47,11 @@ def makeStepName(key,frag,step,suffix): stepList[specialType].append(stepMaker(key,frag[:-4],step,specialWF.suffix)) # hack to add an extra step if 'ProdLike' in specialType: - if 'Reco' in step: # handles both Reco and RecoGlobal - stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoGlobal','MiniAOD').replace('RecoNano','MiniAOD').replace('Reco','MiniAOD'),specialWF.suffix)) - if 'RecoNano' in step: - stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoNano','Nano'),specialWF.suffix)) + if 'Reco' in step: # handles both Reco, RecoFakeHLT and RecoGlobal + stepWoFakeHLT = step.replace('FakeHLT','') # ignore "FakeHLT" from step + stepList[specialType].append(stepMaker(key,frag[:-4],stepWoFakeHLT.replace('RecoGlobal','MiniAOD').replace('RecoNano','MiniAOD').replace('Reco','MiniAOD'),specialWF.suffix)) + if 'RecoNano' in stepWoFakeHLT: + stepList[specialType].append(stepMaker(key,frag[:-4],stepWoFakeHLT.replace('RecoNano','Nano'),specialWF.suffix)) # hack to add extra HLT75e33 step for Phase-2 if 'HLT75e33' in specialType: if 'RecoGlobal' in step: diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index da38232757bfb..5c76f2b4fa7b2 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -170,9 +170,11 @@ def condition(self, fragment, stepList, key, hasHarvest): 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', 'HARVESTFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'FastSim', 'HARVESTFast', 'HARVESTGlobal', @@ -192,9 +194,11 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Reco', 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', 'HARVESTFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'HARVESTGlobal', 'MiniAOD', 'Nano', @@ -224,6 +228,7 @@ def condition(self, fragment, stepList, key, hasHarvest): steps = [ 'Digi', 'RecoNano', + 'RecoNanoFakeHLT', 'ALCA' ], PU = [], @@ -266,23 +271,27 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['trackingOnly'] = UpgradeWorkflow_trackingOnly( steps = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', - 'RecoFakeHLT', - 'HARVESTFakeHLT', + 'HARVESTNanoFakeHLT', ], PU = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', - 'RecoFakeHLT', - 'HARVESTFakeHLT' + 'HARVESTNanoFakeHLT', ], @@ -323,8 +332,8 @@ def condition_(self, fragment, stepList, key, hasHarvest): upgradeWFs['trackingOnlyRun2'] = UpgradeWorkflow_trackingOnlyRun2( steps = [ 'Reco', - 'HARVEST', 'RecoFakeHLT', + 'HARVEST', 'HARVESTFakeHLT', ], PU = [], @@ -360,13 +369,15 @@ def condition_(self, fragment, stepList, key, hasHarvest): upgradeWFs['pixelTrackingOnly'] = UpgradeWorkflow_pixelTrackingOnly( steps = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', - 'RecoFakeHLT', - 'HARVESTFakeHLT', + 'HARVESTNanoFakeHLT', 'ALCA', 'ALCAPhase2' ], @@ -385,15 +396,16 @@ def setup__(self, step, stepName, stepDict, k, properties): if 'Digi' in step: stepDict[stepName][k] = merge([self.step2, stepDict[step][k]]) if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) def condition_(self, fragment, stepList, key, hasHarvest): - return '2017' in key or '2021' in key + return ('2017' in key or '2021' in key or '2023' in key) and ('FS' not in key) upgradeWFs['trackingMkFit'] = UpgradeWorkflow_trackingMkFit( steps = [ 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', - 'RecoFakeHLT', + 'RecoNanoFakeHLT', ], PU = [], suffix = '_trackingMkFit', @@ -419,25 +431,53 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['seedingDeepCore'] = UpgradeWorkflow_seedingDeepCore( steps = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'Nano', 'ALCA', ], PU = [ 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', ], suffix = '_seedingDeepCore', offset = 0.17, ) +#Workflow to enable displacedRegionalStep tracking iteration +class UpgradeWorkflow_displacedRegional(UpgradeWorkflowTracking): + def setup__(self, step, stepName, stepDict, k, properties): + if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) + def condition_(self, fragment, stepList, key, hasHarvest): + return '2021' in key +upgradeWFs['displacedRegional'] = UpgradeWorkflow_displacedRegional( + steps = [ + 'Reco', + 'RecoFakeHLT', + 'RecoGlobal', + 'RecoNano', + ], + PU = [], + suffix = '_displacedRegional', + offset = 0.701, +) +upgradeWFs['displacedRegional'].step3 = { + '--procModifiers': 'displacedRegionalTracking' +} + # Vector Hits workflows class UpgradeWorkflow_vectorHits(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): @@ -464,23 +504,27 @@ def __init__(self, reco = {}, harvest = {}, **kwargs): super(UpgradeWorkflow_weightedVertex, self).__init__( steps = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', - 'RecoFakeHLT', - 'HARVESTFakeHLT', + 'HARVESTNanoFakeHLT', ], PU = [ 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', - 'RecoFakeHLT', - 'HARVESTFakeHLT', + 'HARVESTNanoFakeHLT', ], **kwargs) self.__reco = reco @@ -611,11 +655,15 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['trackdnn'] = UpgradeWorkflow_trackdnn( steps = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], PU = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], suffix = '_trackdnn', offset = 0.91, @@ -633,11 +681,15 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['mlpf'] = UpgradeWorkflow_mlpf( steps = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], PU = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], suffix = '_mlpf', offset = 0.13, @@ -661,11 +713,15 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['ecalDeepSC'] = UpgradeWorkflow_ecalclustering( steps = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], PU = [ 'Reco', + 'RecoFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', ], suffix = '_ecalDeepSC', offset = 0.19, @@ -687,14 +743,12 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['photonDRN'] = UpgradeWorkflow_photonDRN( steps = [ - 'Reco', - 'RecoNano', - 'RecoFakeHLT' + 'RecoFakeHLT', + 'RecoNanoFakeHLT', ], PU = [ - 'Reco', - 'RecoNano', - 'RecoFakeHLT' + 'RecoFakeHLT', + 'RecoNanoFakeHLT', ], suffix = '_photonDRN', offset = 0.31, @@ -704,11 +758,14 @@ def condition(self, fragment, stepList, key, hasHarvest): } -# Patatrack workflows: +# Patatrack workflows (NoPU and PU): # - 2018 conditions, TTbar -# - 2018 conditions, Z->mumu, -# - 2021 conditions, TTbar -# - 2021 conditions, Z->mumu, +# - 2018 conditions, Z->mumu +# - 2022 conditions (labelled "2021"), TTbar +# - 2022 conditions (labelled "2021"), Z->mumu +# - 2023 conditions, TTbar +# - 2023 conditions, Z->mumu +# - 2026D88 conditions, TTbar class PatatrackWorkflow(UpgradeWorkflow): def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs): # adapt the parameters for the UpgradeWorkflow init method @@ -717,13 +774,15 @@ def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs): 'Digi', 'DigiTrigger', 'Reco', - 'HARVEST', 'RecoFakeHLT', + 'HARVEST', 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'Nano', 'ALCA', 'ALCAPhase2' @@ -732,13 +791,15 @@ def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs): 'Digi', 'DigiTrigger', 'Reco', - 'HARVEST', 'RecoFakeHLT', + 'HARVEST', 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'Nano', 'ALCA', 'ALCAPhase2' @@ -756,9 +817,11 @@ def condition(self, fragment, stepList, key, hasHarvest): # select only a subset of the workflows selected = [ ('2018' in key and fragment == "TTbar_13"), - (('2021' in key or '2023' in key) and fragment == "TTbar_14TeV" and 'FS' not in key), + ('2021' in key and fragment == "TTbar_14TeV" and 'FS' not in key), + ('2023' in key and fragment == "TTbar_14TeV" and 'FS' not in key), ('2018' in key and fragment == "ZMM_13"), - (('2021' in key or '2023' in key) and fragment == "ZMM_14" and 'FS' not in key), + ('2021' in key and fragment == "ZMM_14" and 'FS' not in key), + ('2023' in key and fragment == "ZMM_14" and 'FS' not in key), ('2026D88' in key and fragment == "TTbar_14TeV" and "PixelOnly" in self.suffix) ] result = any(selected) and hasHarvest @@ -876,7 +939,7 @@ def setup_(self, step, stepName, stepDict, k, properties): reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise' : 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -897,7 +960,7 @@ def setup_(self, step, stepName, stepDict, k, properties): reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit,gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise': 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -920,7 +983,7 @@ def setup_(self, step, stepName, stepDict, k, properties): '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', '--accelerators': 'gpu-nvidia', '--procModifiers': 'pixelNtupletFit,gpuValidation', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise': 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM', @@ -941,7 +1004,7 @@ def setup_(self, step, stepName, stepDict, k, properties): reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly', '--procModifiers': 'pixelNtupletFit,gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets,RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly' + '--customise': 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets,RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly' }, harvest = None, suffix = 'Patatrack_PixelOnlyTripletsGPU_Profiling', @@ -1314,7 +1377,7 @@ def setup_(self, step, stepName, stepDict, k, properties): # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise' : 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { # skip the @pixelTrackingOnlyDQM harvesting @@ -1336,7 +1399,7 @@ def setup_(self, step, stepName, stepDict, k, properties): # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', '--procModifiers': 'pixelNtupletFit,gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise': 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { # skip the @pixelTrackingOnlyDQM harvesting @@ -1360,7 +1423,7 @@ def setup_(self, step, stepName, stepDict, k, properties): '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM', '--accelerators': 'gpu-nvidia', '--procModifiers': 'pixelNtupletFit,gpuValidation', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' + '--customise' : 'RecoTracker/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { # skip the @pixelTrackingOnlyDQM harvesting @@ -1398,11 +1461,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'MiniAOD', 'ALCA', 'ALCAPhase2', @@ -1413,11 +1480,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'MiniAOD', 'ALCA', 'ALCAPhase2', @@ -1435,11 +1506,15 @@ def __init__(self, suffix, offset, fixedPU, 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'MiniAOD', 'ALCA', 'ALCAPhase2', @@ -1641,13 +1716,17 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GenSim', 'Digi', 'Reco', +# 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'ALCA', ], PU = [ 'Digi', 'Reco', +# 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', ], suffix = '_heCollapse', offset = 0.6, @@ -1725,17 +1804,25 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GenSim', 'Digi', 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], PU = [ 'Digi', 'Reco', + 'RecoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVESTNano', + 'HARVESTNanoFakeHLT', ], suffix = '_0T', offset = 0.24, @@ -1750,12 +1837,42 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['ParkingBPH'] = UpgradeWorkflow_ParkingBPH( steps = [ 'Reco', + 'RecoFakeHLT', ], PU = [], suffix = '_ParkingBPH', offset = 0.8, ) +## Wf to add Heavy Flavor DQM to whichever DQM is already there +class UpgradeWorkflow_HeavyFlavor(UpgradeWorkflow): + def setup_(self, step, stepName, stepDict, k, properties): + self.__frags = ["B0","Psi2S","Bu","Bd","Xi","Bs"] + thisStep = stepDict[step][k]["-s"] + if "Reco" in step: + if "DQM:" in thisStep: + stepDict[stepName][k] = merge([{'-s': thisStep.replace("DQM:","DQM:@heavyFlavor+")}, stepDict[step][k]]) + elif "DQM" in thisStep: + stepDict[stepName][k] = merge([{'-s': thisStep.replace("DQM","DQM:@heavyFlavor")}, stepDict[step][k]]) + else: + stepDict[stepName][k] = merge([{'-s': thisStep + ",DQM:@heavyFlavor"}, stepDict[step][k]]) + + def condition(self, fragment, stepList, key, hasHarvest): + return any(frag in fragment for frag in self.__frags) + +upgradeWFs['HeavyFlavor'] = UpgradeWorkflow_HeavyFlavor( + steps = [ + 'Reco', + 'RecoFakeHLT', + 'RecoNano', + 'RecoNanoFakeHLT', + ], + PU = [], + suffix = '_HeavyFlavor', + offset = 0.81, +) + + class UpgradeWorkflow_JMENano(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if 'Nano' in step: @@ -1766,6 +1883,7 @@ def condition(self, fragment, stepList, key, hasHarvest): steps = [ 'Nano', 'RecoNano', + 'RecoNanoFakeHLT', ], PU = [], suffix = '_JMENano', @@ -1787,6 +1905,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', ], PU = [ @@ -1794,6 +1913,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', ], suffix = 'Aging1000', @@ -1848,6 +1968,29 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['OTInefficiency10PC'].offset = 0.114 upgradeWFs['OTInefficiency10PC'].percent = 'Ten' +# +# Simulates CROC signal shape in IT modules +# +class UpgradeWorkflow_ITSignalShape(UpgradeWorkflow): + def setup_(self, step, stepName, stepDict, k, properties): + if 'Digi' in step: + stepDict[stepName][k] = merge([{'--customise': 'SimTracker/SiPhase2Digitizer/customizeForPhase2TrackerSignalShape.customizeSiPhase2ITSignalShape'}, stepDict[step][k]]) + def condition(self, fragment, stepList, key, hasHarvest): + return '2026' in key +# define several of them +upgradeWFs['ITSignalShape'] = UpgradeWorkflow_ITSignalShape( + steps = [ + 'Digi', + 'DigiTrigger', + ], + PU = [ + 'Digi', + 'DigiTrigger', + ], + suffix = '_ITSignalShape', + offset = 0.141 +) + # Specifying explicitly the --filein is not nice but that was the # easiest way to "skip" the output of step2 (=premixing stage1) for # filein (as it goes to pileup_input). It works (a bit accidentally @@ -1950,8 +2093,10 @@ def workflow_(self, workflows, num, fragment, stepList, key): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'Nano', ], suffix = '_PMXS2', @@ -1968,8 +2113,10 @@ def workflow_(self, workflows, num, fragment, stepList, key): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'Nano', ], suffix = '_PMXS1S2', @@ -1995,9 +2142,11 @@ def condition(self, fragment, stepList, key, hasHarvest): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'Nano', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', ], suffix = '_PMXS1S2PR', @@ -2035,12 +2184,16 @@ def condition(self, fragment, stepList, key, hasHarvest): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'Nano', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'MiniAOD', 'ALCA', ], @@ -2058,12 +2211,16 @@ def condition(self, fragment, stepList, key, hasHarvest): 'DigiTrigger', 'RecoLocal', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'Nano', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'MiniAOD', 'ALCA', ], @@ -2120,6 +2277,7 @@ def condition(self, fragment, stepList, key, hasHarvest): offset = 0.303, ) + class UpgradeWorkflow_DD4hep(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']: @@ -2141,11 +2299,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], PU = [], @@ -2170,11 +2332,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], PU = [], @@ -2185,7 +2351,7 @@ def condition(self, fragment, stepList, key, hasHarvest): class UpgradeWorkflow_DDDDB(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): - if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']: + if 'Run3' in stepDict[step][k]['--era'] and '2023' not in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']: # retain any other eras tmp_eras = stepDict[step][k]['--era'].split(',') tmp_eras[tmp_eras.index("Run3")] = 'Run3_DDD' @@ -2201,11 +2367,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], PU = [], @@ -2228,11 +2398,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], PU = [ @@ -2242,11 +2416,15 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Digi', 'DigiTrigger', 'Reco', + 'RecoFakeHLT', 'RecoGlobal', 'RecoNano', + 'RecoNanoFakeHLT', 'HARVEST', + 'HARVESTFakeHLT', 'HARVESTGlobal', 'HARVESTNano', + 'HARVESTNanoFakeHLT', 'ALCA', ], suffix = '_SonicTriton', @@ -2299,8 +2477,8 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2022_realistic', 'HLTmenu': '@relval2022', 'Era' : 'Run3', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', - 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], + 'BeamSpot': 'Realistic25ns13p6TeVEOY2022Collision', + 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT','ALCA'], }, '2021Design' : { 'Geom' : 'DB:Extended', @@ -2308,13 +2486,13 @@ def condition(self, fragment, stepList, key, hasHarvest): 'HLTmenu': '@relval2022', 'Era' : 'Run3', 'BeamSpot': 'GaussSigmaZ4cm', - 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano'], + 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT'], }, '2023' : { 'Geom' : 'DB:Extended', 'GT' : 'auto:phase1_2023_realistic', 'HLTmenu': '@relval2023', - 'Era' : 'Run3', + 'Era' : 'Run3_2023', 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, @@ -2340,7 +2518,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'HLTmenu': '@relval2022', 'Era' : 'Run3', 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', - 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], + 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT','ALCA'], }, '2023FS' : { 'Geom' : 'DB:Extended', @@ -2355,10 +2533,14 @@ def condition(self, fragment, stepList, key, hasHarvest): # standard PU sequences for key in list(upgradeProperties[2017].keys()): upgradeProperties[2017][key+'PU'] = deepcopy(upgradeProperties[2017][key]) - if "FS" not in key: - upgradeProperties[2017][key+'PU']['ScenToRun'] = ['GenSim','DigiPU'] + \ - (['RecoNanoPU','HARVESTNanoPU'] if '202' in key else ['RecoFakeHLTPU','HARVESTFakeHLTPU']) + \ - (['Nano'] if 'Nano' in upgradeProperties[2017][key]['ScenToRun'] else []) + if 'FS' not in key: + # update ScenToRun list + scenToRun = upgradeProperties[2017][key+'PU']['ScenToRun'] + for idx,val in enumerate(scenToRun): + # Digi -> DigiPU, Reco* -> Reco*PU, HARVEST* -> HARVEST*PU + scenToRun[idx] += 'PU'*(val.startswith('Digi') or val.startswith('Reco') or val.startswith('HARVEST')) + # remove ALCA + upgradeProperties[2017][key+'PU']['ScenToRun'] = [foo for foo in scenToRun if foo != 'ALCA'] else: upgradeProperties[2017][key+'PU']['ScenToRun'] = ['Gen','FastSimRun3PU','HARVESTFastRun3PU'] diff --git a/Configuration/PyReleaseValidation/scripts/README.md b/Configuration/PyReleaseValidation/scripts/README.md index 6edccd7c8f7f7..24bfb66db9670 100644 --- a/Configuration/PyReleaseValidation/scripts/README.md +++ b/Configuration/PyReleaseValidation/scripts/README.md @@ -209,40 +209,83 @@ Example: ``` matrix> showWorkflow Available workflows: -relval_gpu -relval_production -relval_identity -relval_ged -relval_highstats -relval_generator -relval_standard -relval_extendedgen -relval_premix -relval_2026 -relval_machine -relval_pileup -relval_2017 -relval_upgrade -matrix> showWorkflow relval_gpu -136.885502 RunHLTPhy2018D RunHLTPhy2018D+HLTDR2_2018+RECODR2_2018reHLT_Patatrack_PixelOnlyGPU+HARVEST2018_pixelTrackingOnly -136.885512 RunHLTPhy2018D RunHLTPhy2018D+HLTDR2_2018+RECODR2_2018reHLT_ECALOnlyGPU+HARVEST2018_ECALOnly -136.885522 RunHLTPhy2018D RunHLTPhy2018D+HLTDR2_2018+RECODR2_2018reHLT_HCALOnlyGPU+HARVEST2018_HCALOnly -136.888502 RunJetHT2018D RunJetHT2018D+HLTDR2_2018+RECODR2_2018reHLT_Patatrack_PixelOnlyGPU+HARVEST2018_pixelTrackingOnly -136.888512 RunJetHT2018D RunJetHT2018D+HLTDR2_2018+RECODR2_2018reHLT_ECALOnlyGPU+HARVEST2018_ECALOnly -136.888522 RunJetHT2018D RunJetHT2018D+HLTDR2_2018+RECODR2_2018reHLT_HCALOnlyGPU+HARVEST2018_HCALOnly -10824.502 TTbar_13 2018_Patatrack_PixelOnlyGPU+TTbar_13TeV_TuneCUETP8M1_GenSim+Digi+RecoFakeHLT+HARVESTFakeHLT -10824.512 TTbar_13 2018_Patatrack_ECALOnlyGPU+TTbar_13TeV_TuneCUETP8M1_GenSim+Digi+RecoFakeHLT+HARVESTFakeHLT -10824.522 TTbar_13 2018_Patatrack_HCALOnlyGPU+TTbar_13TeV_TuneCUETP8M1_GenSim+Digi+RecoFakeHLT+HARVESTFakeHLT -10842.502 ZMM_13 2018_Patatrack_PixelOnlyGPU+ZMM_13TeV_TuneCUETP8M1_GenSim+Digi+RecoFakeHLT+HARVESTFakeHLT -11634.502 TTbar_14TeV 2021_Patatrack_PixelOnlyGPU+TTbar_14TeV_TuneCP5_GenSim+Digi+Reco+HARVEST -11634.512 TTbar_14TeV 2021_Patatrack_ECALOnlyGPU+TTbar_14TeV_TuneCP5_GenSim+Digi+Reco+HARVEST -11634.522 TTbar_14TeV 2021_Patatrack_HCALOnlyGPU+TTbar_14TeV_TuneCP5_GenSim+Digi+Reco+HARVEST -11650.502 ZMM_14 2021_Patatrack_PixelOnlyGPU+ZMM_14TeV_TuneCP5_GenSim+Digi+Reco+HARVEST -relval_gpu contains 14 workflows +standard +highstats +pileup +generator +extendedgen +production +ged +upgrade +cleanedupgrade +gpu +2017 +2026 +identity +machine +premix +nano + +matrix> showWorkflow gpu +140.065506 Run3-2023_JetMET2022D_RecoPixelOnlyTripletsGPU +140.065512 Run3-2023_JetMET2022D_RecoECALOnlyGPU +140.065522 Run3-2023_JetMET2022D_RecoHCALOnlyGPU +11634.502 TTbar_14TeV+2021_Patatrack_PixelOnlyGPU +11634.503 TTbar_14TeV+2021_Patatrack_PixelOnlyGPU_Validation +11634.504 TTbar_14TeV+2021_Patatrack_PixelOnlyGPU_Profiling +11634.506 TTbar_14TeV+2021_Patatrack_PixelOnlyTripletsGPU +11634.507 TTbar_14TeV+2021_Patatrack_PixelOnlyTripletsGPU_Validation +11634.508 TTbar_14TeV+2021_Patatrack_PixelOnlyTripletsGPU_Profiling +11634.512 TTbar_14TeV+2021_Patatrack_ECALOnlyGPU +11634.513 TTbar_14TeV+2021_Patatrack_ECALOnlyGPU_Validation +11634.514 TTbar_14TeV+2021_Patatrack_ECALOnlyGPU_Profiling +11634.522 TTbar_14TeV+2021_Patatrack_HCALOnlyGPU +11634.523 TTbar_14TeV+2021_Patatrack_HCALOnlyGPU_Validation +11634.524 TTbar_14TeV+2021_Patatrack_HCALOnlyGPU_Profiling +11634.582 TTbar_14TeV+2021_Patatrack_AllGPU +11634.583 TTbar_14TeV+2021_Patatrack_AllGPU_Validation +11634.586 TTbar_14TeV+2021_Patatrack_AllTripletsGPU +11634.587 TTbar_14TeV+2021_Patatrack_AllTripletsGPU_Validation +11634.592 TTbar_14TeV+2021_Patatrack_FullRecoGPU +11634.593 TTbar_14TeV+2021_Patatrack_FullRecoGPU_Validation +11634.596 TTbar_14TeV+2021_Patatrack_FullRecoTripletsGPU +11634.597 TTbar_14TeV+2021_Patatrack_FullRecoTripletsGPU_Validation +11650.502 ZMM_14+2021_Patatrack_PixelOnlyGPU +11650.503 ZMM_14+2021_Patatrack_PixelOnlyGPU_Validation +11650.504 ZMM_14+2021_Patatrack_PixelOnlyGPU_Profiling +11650.506 ZMM_14+2021_Patatrack_PixelOnlyTripletsGPU +11650.507 ZMM_14+2021_Patatrack_PixelOnlyTripletsGPU_Validation +11650.508 ZMM_14+2021_Patatrack_PixelOnlyTripletsGPU_Profiling +12434.502 TTbar_14TeV+2023_Patatrack_PixelOnlyGPU +12434.503 TTbar_14TeV+2023_Patatrack_PixelOnlyGPU_Validation +12434.504 TTbar_14TeV+2023_Patatrack_PixelOnlyGPU_Profiling +12434.506 TTbar_14TeV+2023_Patatrack_PixelOnlyTripletsGPU +12434.507 TTbar_14TeV+2023_Patatrack_PixelOnlyTripletsGPU_Validation +12434.508 TTbar_14TeV+2023_Patatrack_PixelOnlyTripletsGPU_Profiling +12434.512 TTbar_14TeV+2023_Patatrack_ECALOnlyGPU +12434.513 TTbar_14TeV+2023_Patatrack_ECALOnlyGPU_Validation +12434.514 TTbar_14TeV+2023_Patatrack_ECALOnlyGPU_Profiling +12434.522 TTbar_14TeV+2023_Patatrack_HCALOnlyGPU +12434.523 TTbar_14TeV+2023_Patatrack_HCALOnlyGPU_Validation +12434.524 TTbar_14TeV+2023_Patatrack_HCALOnlyGPU_Profiling +12434.582 TTbar_14TeV+2023_Patatrack_AllGPU +12434.583 TTbar_14TeV+2023_Patatrack_AllGPU_Validation +12434.586 TTbar_14TeV+2023_Patatrack_AllTripletsGPU +12434.587 TTbar_14TeV+2023_Patatrack_AllTripletsGPU_Validation +12434.592 TTbar_14TeV+2023_Patatrack_FullRecoGPU +12434.593 TTbar_14TeV+2023_Patatrack_FullRecoGPU_Validation +12434.596 TTbar_14TeV+2023_Patatrack_FullRecoTripletsGPU +12434.597 TTbar_14TeV+2023_Patatrack_FullRecoTripletsGPU_Validation +12450.502 ZMM_14+2023_Patatrack_PixelOnlyGPU +12450.503 ZMM_14+2023_Patatrack_PixelOnlyGPU_Validation +12450.504 ZMM_14+2023_Patatrack_PixelOnlyGPU_Profiling +12450.506 ZMM_14+2023_Patatrack_PixelOnlyTripletsGPU +12450.507 ZMM_14+2023_Patatrack_PixelOnlyTripletsGPU_Validation +12450.508 ZMM_14+2023_Patatrack_PixelOnlyTripletsGPU_Profiling +gpu contains 55 workflows matrix> ``` All commands come with dynamic TAB-completion. There's also a transient history -of the commands issues within a single session. Transient means that, after a +of the commands issued within a single session. Transient means that, after a session is closed, the history is lost. - diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index e9ce275bbbbda..f95d627222707 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -92,18 +92,16 @@ def runSelected(opt): 11634.911, #2021 DD4hep ttbar reading geometry from XML 11634.914, #2021 DDD ttbar reading geometry from the DB 11634.0, #2021 ttbar (switching to DD4hep by default) - 11634.7, #2021 ttbar mkFit 11834.0, #2021 ttbar PU 13234.0, #2021 ttbar fastsim 13434.0, #2021 ttbar PU fastsim 12434.0, #2023 ttbar - 20834.0, #2026D88 ttbar (2022 new baseline) - 20834.75, #2026D88 ttbar with HLT75e33 - 20834.76, #2026D88 ttbar with HLT75e33 in the same step as DIGI+L1 - #20834.911, #2026D88 ttbar DD4hep XML - 21034.999, #2026D88 ttbar premixing stage1+stage2, PU50 - 20896.0, #CE_E_Front_120um D88 - 20900.0, #CE_H_Coarse_Scint D88 + 12434.7, #2023 ttbar mkFit + 23634.0, #2026D95 ttbar (Phase-2 baseline) + 23634.911, #2026D95 ttbar DD4hep XML + 23834.999, #2026D95 ttbar premixing stage1+stage2, PU50 + 23696.0, #CE_E_Front_120um D95 + 23700.0, #CE_H_Coarse_Scint D95 23234.0, #2026D94 ttbar (exercise with HFNose) 25202.0, #2016 ttbar UP15 PU 250202.181, #2018 ttbar stage1 + stage2 premix @@ -154,6 +152,12 @@ def runSelected(opt): type=int, default=0) + parser.add_argument('--nEvents', + help='number of events to process in cmsRun. If 0 will use the standard 10 events.', + dest='nEvents', + type=int, + default=0) + parser.add_argument('--numberEventsInLuminosityBlock', help='number of events in a luminosity block', dest='numberEventsInLuminosityBlock', diff --git a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h index 750ef843753e2..2b37c48b8f392 100644 --- a/Configuration/Skimming/interface/DisappearingMuonsSkimming.h +++ b/Configuration/Skimming/interface/DisappearingMuonsSkimming.h @@ -22,19 +22,21 @@ #include // user include filter -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Framework/interface/one/EDFilter.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "FWCore/Framework/interface/one/EDFilter.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" // // class declaration @@ -47,28 +49,28 @@ class DisappearingMuonsSkimming : public edm::one::EDFilter<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; - void endJob() override; + bool passTriggers(const edm::Event& iEvent, - edm::EDGetToken m_trigResultsToken, - std::vector m_muonPathsToPass); - double getTrackIsolation(const edm::Event&, - edm::Handle vtxHandle, - std::vector::const_iterator& iTrack); - double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack track); + const edm::TriggerResults& results, + const std::vector& m_muonPathsToPass); - // ----------member data --------------------------- + bool findTrackInVertices(const reco::TrackRef& tkToMatch, + const reco::VertexCollection& vertices, + unsigned int& vtxIndex, + unsigned int& trackIndex); - const edm::EDGetToken recoMuonToken_; - const edm::EDGetToken standaloneMuonToken_; - const edm::EDGetTokenT> trackCollectionToken_; - const edm::EDGetTokenT> primaryVerticesToken_; + double getTrackIsolation(const reco::TrackRef& tkToMatch, const reco::VertexCollection& vertices); + double getECALIsolation(const edm::Event&, const edm::EventSetup&, const reco::TransientTrack& track); + + // ----------member data --------------------------- + const edm::EDGetTokenT recoMuonToken_; + const edm::EDGetTokenT standaloneMuonToken_; + const edm::EDGetTokenT trackCollectionToken_; + const edm::EDGetTokenT primaryVerticesToken_; const edm::EDGetTokenT reducedEndcapRecHitCollectionToken_; const edm::EDGetTokenT reducedBarrelRecHitCollectionToken_; const edm::EDGetTokenT trigResultsToken_; - const edm::EDGetToken genParticleToken_; - const edm::EDGetToken genInfoToken_; const edm::ESGetToken transientTrackToken_; const edm::ESGetToken geometryToken_; const std::vector muonPathsToPass_; diff --git a/Configuration/Skimming/python/PDWG_EXODelayedJet_cff.py b/Configuration/Skimming/python/PDWG_EXODelayedJet_cff.py index 07d879091ae41..0f699007f48dd 100644 --- a/Configuration/Skimming/python/PDWG_EXODelayedJet_cff.py +++ b/Configuration/Skimming/python/PDWG_EXODelayedJet_cff.py @@ -4,7 +4,7 @@ DelayedJetHTTrigger = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone() DelayedJetHTTrigger.TriggerResultsTag = cms.InputTag( "TriggerResults", "", "HLT" ) DelayedJetHTTrigger.HLTPaths = cms.vstring( - "HLT_HT430_DelayedJet40*" + ["HLT_HT430_DelayedJet40*","HLT_HT350_DelayedJet40*","HLT_L1Tau_DelayedJet40*"] ) DelayedJetHTTrigger.throw = False DelayedJetHTTrigger.andOr = True diff --git a/Configuration/Skimming/python/PDWG_EXOLLPJetHCAL_cff.py b/Configuration/Skimming/python/PDWG_EXOLLPJetHCAL_cff.py new file mode 100644 index 0000000000000..540c3e30bb158 --- /dev/null +++ b/Configuration/Skimming/python/PDWG_EXOLLPJetHCAL_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms + +import HLTrigger.HLTfilters.hltHighLevel_cfi as _hltHighLevel +hltLLPJetHCAL = _hltHighLevel.hltHighLevel.clone( + throw = False, + andOr = True, + HLTPaths = [ + "HLT*_L1SingleLLPJet_*", + ] +) + +# disappTrk skim sequence +EXOLLPJetHCALSkimSequence = cms.Sequence( + hltLLPJetHCAL + ) \ No newline at end of file diff --git a/Configuration/Skimming/python/Skims_PDWG_cff.py b/Configuration/Skimming/python/Skims_PDWG_cff.py index 93575f538756a..0ab2334456d3e 100644 --- a/Configuration/Skimming/python/Skims_PDWG_cff.py +++ b/Configuration/Skimming/python/Skims_PDWG_cff.py @@ -293,6 +293,17 @@ dataTier = cms.untracked.string('AOD') ) +from Configuration.Skimming.PDWG_EXOLLPJetHCAL_cff import * +EXOLLPJetHCALPath = cms.Path(EXOLLPJetHCALSkimSequence) +SKIMStreamEXOLLPJetHCAL = cms.FilteredStream( + responsible = 'PDWG', + name = 'EXOLLPJetHCAL', + paths = (EXOLLPJetHCALPath), + content = skimRawAODContent.outputCommands+['keep *_hbhereco__*'], + selectEvents = cms.untracked.PSet(), + dataTier = cms.untracked.string('AOD') + ) + from Configuration.Skimming.PDWG_EXODTCluster_cff import * EXODTClusterPath = cms.Path(EXODTClusterSkimSequence) SKIMStreamEXODTCluster = cms.FilteredStream( diff --git a/Configuration/Skimming/python/autoSkim.py b/Configuration/Skimming/python/autoSkim.py index d907d09c58339..9b24732e91d73 100644 --- a/Configuration/Skimming/python/autoSkim.py +++ b/Configuration/Skimming/python/autoSkim.py @@ -1,10 +1,15 @@ autoSkim = { + + # Skim 2023 'BTagMu' : 'LogError+LogErrorMonitor', - 'DisplacedJet' : 'EXODisplacedJet+EXODelayedJet+EXODTCluster+EXOCSCCluster+LogError+LogErrorMonitor', - 'JetMET' : 'JetHTJetPlusHOFilter+EXOHighMET+EXODelayedJetMET+EXODisappTrk+LogError+LogErrorMonitor', - 'EGamma':'ZElectron+WElectron+EXOMONOPOLE+EXODisappTrk+LogError+LogErrorMonitor', + 'DisplacedJet' : 'EXODisplacedJet+EXODelayedJet+EXODTCluster+EXOLLPJetHCAL+LogError+LogErrorMonitor', + 'JetMET0' : 'JetHTJetPlusHOFilter+EXOHighMET+EXODelayedJetMET+EXODisappTrk+LogError+LogErrorMonitor', + 'JetMET1' : 'JetHTJetPlusHOFilter+EXOHighMET+EXODelayedJetMET+EXODisappTrk+LogError+LogErrorMonitor', + 'EGamma0':'ZElectron+WElectron+EXOMONOPOLE+EXODisappTrk+LogError+LogErrorMonitor', + 'EGamma1':'ZElectron+WElectron+EXOMONOPOLE+EXODisappTrk+LogError+LogErrorMonitor', 'Tau' : 'EXODisappTrk+LogError+LogErrorMonitor', - 'Muon' : 'ZMu+EXODisappTrk+LogError+LogErrorMonitor', + 'Muon0' : 'ZMu+EXODisappTrk+EXOCSCCluster+EXODisappMuon+LogError+LogErrorMonitor', + 'Muon1' : 'ZMu+EXODisappTrk+EXOCSCCluster+EXODisappMuon+LogError+LogErrorMonitor', 'MuonEG' : 'TopMuEG+LogError+LogErrorMonitor', 'NoBPTX' : 'EXONoBPTXSkim+LogError+LogErrorMonitor', 'HcalNZS' : 'LogError+LogErrorMonitor', @@ -13,6 +18,17 @@ 'Commissioning' : 'EcalActivity+LogError+LogErrorMonitor', 'Cosmics':'CosmicSP+CosmicTP+LogError+LogErrorMonitor', + # These should be uncommented when 2022 data reprocessing + # Dedicated skim for 2022 + #'JetMET' : 'JetHTJetPlusHOFilter+EXOHighMET+EXODelayedJetMET+EXODisappTrk+LogError+LogErrorMonitor', + #'EGamma':'ZElectron+WElectron+EXOMONOPOLE+EXODisappTrk+LogError+LogErrorMonitor', + #'Muon' : 'ZMu+EXODisappTrk+EXODisappMuon+LogError+LogErrorMonitor', + #'DisplacedJet' : 'EXODisplacedJet+EXODelayedJet+EXODTCluster+EXOCSCCluster+EXOLLPJetHCAL+LogError+LogErrorMonitor', + #'JetHT' : 'JetHTJetPlusHOFilter+LogError+LogErrorMonitor', + #'MET' : 'EXOHighMET+EXODelayedJetMET+EXODisappTrk+LogError+LogErrorMonitor', + #'SingleMuon' : 'ZMu+EXODisappTrk+EXODisappMuon+LogError+LogErrorMonitor', + #'DoubleMuon' : 'LogError+LogErrorMonitor', + # Used in unit test scenario ppEra_Run2_2018 'SingleMuon': 'LogError+LogErrorMonitor', } diff --git a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc index a1fed76d152dd..b30cf8a1736ba 100644 --- a/Configuration/Skimming/src/DisappearingMuonsSkimming.cc +++ b/Configuration/Skimming/src/DisappearingMuonsSkimming.cc @@ -17,38 +17,27 @@ // // system include files #include - #include "Math/VectorUtil.h" + // user include files #include "Configuration/Skimming/interface/DisappearingMuonsSkimming.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/one/EDFilter.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Math/interface/deltaR.h" #include "FWCore/Common/interface/TriggerNames.h" -#include "DataFormats/PatCandidates/interface/Muon.h" -#include "DataFormats/VertexReco/interface/Vertex.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/TrackReco/interface/Track.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" DisappearingMuonsSkimming::DisappearingMuonsSkimming(const edm::ParameterSet& iConfig) - : recoMuonToken_(consumes>(iConfig.getParameter("recoMuons"))), - standaloneMuonToken_(consumes>(iConfig.getParameter("StandaloneTracks"))), - trackCollectionToken_(consumes>(iConfig.getParameter("tracks"))), - primaryVerticesToken_( - consumes>(iConfig.getParameter("primaryVertices"))), + : recoMuonToken_(consumes(iConfig.getParameter("recoMuons"))), + standaloneMuonToken_(consumes(iConfig.getParameter("StandaloneTracks"))), + trackCollectionToken_(consumes(iConfig.getParameter("tracks"))), + primaryVerticesToken_(consumes(iConfig.getParameter("primaryVertices"))), reducedEndcapRecHitCollectionToken_( consumes(iConfig.getParameter("EERecHits"))), reducedBarrelRecHitCollectionToken_( @@ -98,80 +87,68 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup bool offPeak = false; bool partialRegion = false; - edm::Handle staTracks; - iEvent.getByToken(standaloneMuonToken_, staTracks); - edm::Handle> vertices; - iEvent.getByToken(primaryVerticesToken_, vertices); - edm::Handle> recoMuons; - iEvent.getByToken(recoMuonToken_, recoMuons); - edm::Handle> thePATTrackHandle; - iEvent.getByToken(trackCollectionToken_, thePATTrackHandle); + const auto& staTracks = iEvent.get(standaloneMuonToken_); + const auto& vertices = iEvent.get(primaryVerticesToken_); + const auto& recoMuons = iEvent.get(recoMuonToken_); + const auto& thePATTracks = iEvent.get(trackCollectionToken_); + const auto& triggerResults = iEvent.get(trigResultsToken_); + // this wraps tracks with additional methods that are used in vertex-calculation const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(transientTrackToken_); - if (!passTriggers(iEvent, trigResultsToken_, muonPathsToPass_)) + if (!passTriggers(iEvent, triggerResults, muonPathsToPass_)) return false; int nMuonTrackCand = 0; float MuonTrackMass = 0.; //Looping over the reconstructed Muons - for (std::vector::const_iterator iMuon = recoMuons->begin(); iMuon != recoMuons->end(); iMuon++) { - if (!(iMuon->isPFMuon() && iMuon->isGlobalMuon())) + for (const auto& iMuon : recoMuons) { + if (!(iMuon.isPFMuon() && iMuon.isGlobalMuon())) continue; - if (!(iMuon->passed(reco::Muon::CutBasedIdTight))) + if (!(iMuon.passed(reco::Muon::CutBasedIdTight))) continue; - if (!(iMuon->passed(reco::Muon::PFIsoTight))) + if (!(iMuon.passed(reco::Muon::PFIsoTight))) continue; - if (iMuon->pt() < minMuPt_ || fabs(iMuon->eta()) > maxMuEta_) + if (iMuon.pt() < minMuPt_ || std::abs(iMuon.eta()) > maxMuEta_) continue; //Looping over tracks for any good muon - for (std::vector::const_iterator iTrack = thePATTrackHandle->begin(); - iTrack != thePATTrackHandle->end(); - ++iTrack) { - if (!iTrack->quality(reco::Track::qualityByName("highPurity"))) + int indx(0); + for (const auto& iTrack : thePATTracks) { + reco::TrackRef trackRef = reco::TrackRef(&thePATTracks, indx); + indx++; + + if (!iTrack.quality(reco::Track::qualityByName("highPurity"))) continue; - if (fabs(iTrack->eta()) > maxTrackEta_ || fabs(iTrack->eta()) < minTrackEta_) + if (std::abs(iTrack.eta()) > maxTrackEta_ || std::abs(iTrack.eta()) < minTrackEta_) continue; - if (iTrack->pt() < minTrackPt_) + if (iTrack.pt() < minTrackPt_) continue; //Check if the track belongs to a primary vertex for isolation calculation - bool foundtrack = false; - GlobalPoint tkVtx; - for (unsigned int i = 0; i < vertices->size(); i++) { - reco::VertexRef vtx(vertices, i); - if (!vtx->isValid()) { - continue; - } - for (unsigned int j = 0; j < vtx->tracksSize(); j++) { - double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); - //Find the vertex track that is the same as the probe - if (dPt < 0.001) { - double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); - if (dR2 < 0.001 * 0.001) { - foundtrack = true; - GlobalPoint vert(vtx->x(), vtx->y(), vtx->z()); - tkVtx = vert; - break; - } - } - } - } + + unsigned int vtxIndex; + unsigned int tkIndex; + bool foundtrack = this->findTrackInVertices(trackRef, vertices, vtxIndex, tkIndex); + if (!foundtrack) continue; - reco::TransientTrack tk = transientTrackBuilder->build(*iTrack); + + reco::VertexRef vtx(&vertices, vtxIndex); + GlobalPoint tkVtx = GlobalPoint(vtx->x(), vtx->y(), vtx->z()); + + reco::TransientTrack tk = transientTrackBuilder->build(iTrack); TrajectoryStateClosestToPoint traj = tk.trajectoryStateClosestToPoint(tkVtx); double transDCA = traj.perigeeParameters().transverseImpactParameter(); double longDCA = traj.perigeeParameters().longitudinalImpactParameter(); - if (fabs(longDCA) > maxLongDCA_) + if (std::abs(longDCA) > maxLongDCA_) continue; - if (fabs(transDCA) > maxTransDCA_) + if (std::abs(transDCA) > maxTransDCA_) continue; // make a pair of TransientTracks to feed the vertexer std::vector tracksToVertex; - tracksToVertex.push_back(transientTrackBuilder->build(*iTrack)); - tracksToVertex.push_back(transientTrackBuilder->build(iMuon->globalTrack())); + tracksToVertex.push_back(tk); + tracksToVertex.push_back(transientTrackBuilder->build(iMuon.globalTrack())); // try to fit these two tracks to a common vertex KalmanVertexFitter vertexFitter; CachingVertex<5> fittedVertex = vertexFitter.vertex(tracksToVertex); @@ -204,31 +181,30 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup if (MuonTrackMass < minInvMass_ || MuonTrackMass > maxInvMass_) continue; - double trackIso = getTrackIsolation(iEvent, vertices, iTrack); + double trackIso = getTrackIsolation(trackRef, vertices); //Track iso returns -1 when it fails to find the vertex containing the track (already checked in track selection, but might as well make sure) if (trackIso < 0) continue; - double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(*iTrack)); + double ecalIso = getECALIsolation(iEvent, iSetup, transientTrackBuilder->build(iTrack)); if (trackIso > maxTrackIso_ || ecalIso > maxEcalIso_) continue; //A good tag/probe pair has been selected, now check for control or signal regions - if (iMuon->charge() == iTrack->charge()) { + if (iMuon.charge() == iTrack.charge()) { sameSign = true; } //If not same sign CR, need to check standalone muons for signal regions double staMinDr2 = 1000; double staMinDEoverE = -10; - if (!staTracks->empty()) { - for (reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); - ++staTrack) { - reco::TransientTrack track = transientTrackBuilder->build(*staTrack); + if (!staTracks.empty()) { + for (const auto& staTrack : staTracks) { + reco::TransientTrack track = transientTrackBuilder->build(staTrack); double dR2 = deltaR2(track.impactPointTSCP().momentum().eta(), track.impactPointTSCP().momentum().phi(), - (*iTrack).eta(), - (*iTrack).phi()); - double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - (*iTrack).p()) / (*iTrack).p(); + iTrack.eta(), + iTrack.phi()); + double staDE = (std::sqrt(track.impactPointTSCP().momentum().mag2()) - iTrack.p()) / iTrack.p(); if (dR2 < staMinDr2) { staMinDr2 = dR2; } @@ -280,17 +256,15 @@ bool DisappearingMuonsSkimming::filter(edm::Event& iEvent, const edm::EventSetup } bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, - edm::EDGetToken m_trigResultsToken, - std::vector m_muonPathsToPass) { + const edm::TriggerResults& triggerResults, + const std::vector& m_muonPathsToPass) { bool passTriggers = false; - edm::Handle triggerResults; - iEvent.getByToken(m_trigResultsToken, triggerResults); - const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults); + const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults); for (size_t i = 0; i < trigNames.size(); ++i) { const std::string& name = trigNames.triggerName(i); for (auto& pathName : m_muonPathsToPass) { if ((name.find(pathName) != std::string::npos)) { - if (triggerResults->accept(i)) { + if (triggerResults.accept(i)) { passTriggers = true; break; } @@ -300,57 +274,78 @@ bool DisappearingMuonsSkimming::passTriggers(const edm::Event& iEvent, return passTriggers; } -double DisappearingMuonsSkimming::getTrackIsolation(const edm::Event& iEvent, - edm::Handle vtxHandle, - std::vector::const_iterator& iTrack) { - bool foundtrack = false; - unsigned int vtxindex = -1; - unsigned int trackindex = -1; - double Isolation = 0; - for (unsigned int i = 0; i < vtxHandle->size(); i++) { - reco::VertexRef vtx(vtxHandle, i); - if (!vtx->isValid()) { +bool DisappearingMuonsSkimming::findTrackInVertices(const reco::TrackRef& tkToMatch, + const reco::VertexCollection& vertices, + unsigned int& vtxIndex, + unsigned int& trackIndex) { + // initialize indices + vtxIndex = -1; + trackIndex = -1; + + bool foundtrack{false}; + unsigned int idx = 0; + for (const auto& vtx : vertices) { + if (!vtx.isValid()) { + idx++; continue; } - for (unsigned int j = 0; j < vtx->tracksSize(); j++) { - double dPt = fabs(vtx->trackRefAt(j)->pt() - iTrack->pt()) / iTrack->pt(); - //Find the vertex track that is the same as the probe - if (dPt < 0.001) { - double dR2 = deltaR2(vtx->trackRefAt(j)->eta(), vtx->trackRefAt(j)->phi(), iTrack->eta(), iTrack->phi()); - if (dR2 < 0.001 * 0.001) { - vtxindex = i; - trackindex = j; - foundtrack = true; - break; - } - } + + const auto& thePVtracks{vtx.tracks()}; + std::vector thePVkeys; + thePVkeys.reserve(thePVtracks.size()); + for (const auto& tv : thePVtracks) { + thePVkeys.push_back(tv.key()); } + + auto result = std::find_if( + thePVkeys.begin(), thePVkeys.end(), [tkToMatch](const auto& tkRef) { return tkRef == tkToMatch.key(); }); + if (result != thePVkeys.end()) { + foundtrack = true; + trackIndex = std::distance(thePVkeys.begin(), result); + vtxIndex = idx; + } + if (foundtrack) + break; + + idx++; } + return foundtrack; +} + +double DisappearingMuonsSkimming::getTrackIsolation(const reco::TrackRef& tkToMatch, + const reco::VertexCollection& vertices) { + unsigned int vtxindex; + unsigned int trackIndex; + bool foundtrack = this->findTrackInVertices(tkToMatch, vertices, vtxindex, trackIndex); + + LogDebug("DisappearingMuonsSkimming") << "getTrackIsolation vtx Index: " << vtxindex + << " track Index: " << trackIndex; if (!foundtrack) { - return -1; + return -1.; } - reco::VertexRef primaryVtx(vtxHandle, vtxindex); + reco::VertexRef primaryVtx(&vertices, vtxindex); + double Isolation = 0; for (unsigned int i = 0; i < primaryVtx->tracksSize(); i++) { - if (i == trackindex) + if (i == trackIndex) continue; reco::TrackBaseRef secondarytrack = primaryVtx->trackRefAt(i); - if (deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) > + if (deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) > trackIsoConesize_ * trackIsoConesize_ || - deltaR2(iTrack->eta(), iTrack->phi(), secondarytrack->eta(), secondarytrack->phi()) < + deltaR2(tkToMatch.get()->eta(), tkToMatch.get()->phi(), secondarytrack->eta(), secondarytrack->phi()) < trackIsoInnerCone_ * trackIsoInnerCone_) continue; Isolation += secondarytrack->pt(); } - return Isolation / iTrack->pt(); + return Isolation / tkToMatch.get()->pt(); } double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, const edm::EventSetup& iSetup, - const reco::TransientTrack track) { + const reco::TransientTrack& track) { edm::Handle rechitsEE; iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsEE); @@ -371,7 +366,7 @@ double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos); math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z()); math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z()); - if (ROOT::Math::VectorUtil::DeltaR(idPositionRoot, trajRoot) < ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { + if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { eDR += (*hit).energy(); } } @@ -384,7 +379,7 @@ double DisappearingMuonsSkimming::getECALIsolation(const edm::Event& iEvent, TrajectoryStateClosestToPoint traj = track.trajectoryStateClosestToPoint(hitPos); math::XYZVector idPositionRoot(hitPos.x(), hitPos.y(), hitPos.z()); math::XYZVector trajRoot(traj.position().x(), traj.position().y(), traj.position().z()); - if (ROOT::Math::VectorUtil::DeltaR(idPositionRoot, trajRoot) < ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { + if (deltaR2(idPositionRoot, trajRoot) < ecalIsoConesize_ * ecalIsoConesize_ && (*hit).energy() > minEcalHitE_) { eDR += (*hit).energy(); } } @@ -434,11 +429,5 @@ void DisappearingMuonsSkimming::fillDescriptions(edm::ConfigurationDescriptions& descriptions.addWithDefaultLabel(desc); } -// ------------ method called once each job just before starting event loop ------------ -void DisappearingMuonsSkimming::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -void DisappearingMuonsSkimming::endJob() {} - //define this as a plug-in DEFINE_FWK_MODULE(DisappearingMuonsSkimming); diff --git a/Configuration/Skimming/test/test_DisMuon_cfg.py b/Configuration/Skimming/test/test_DisMuon_cfg.py new file mode 100644 index 0000000000000..d9d7d9dcc1ffa --- /dev/null +++ b/Configuration/Skimming/test/test_DisMuon_cfg.py @@ -0,0 +1,59 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process("testSkimming", Run3) + +# Message logger service + +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.enable = False +process.MessageLogger.DisappearingMuonsSkimming=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(100) + ), + DMRChecker = cms.untracked.PSet( limit = cms.untracked.int32(-1)), + DisappearingMuonsSkimming = cms.untracked.PSet( limit = cms.untracked.int32(-1)) + ) + +readFiles = cms.untracked.vstring( + '/store/relval/CMSSW_13_0_0_pre3/RelValZMM_14/GEN-SIM-RECO/PU_130X_mcRun3_2022_realistic_v2-v1/00000/04f597b5-14d3-44c8-851e-c5f46657d92a.root', +) + +process.source = cms.Source("PoolSource",fileNames = readFiles) +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32((800))) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '130X_mcRun3_2022_realistic_v2', '') + +process.load("Configuration.Skimming.PDWG_EXODisappMuon_cff") +# Additional output definition +process.SKIMStreamEXODisappMuon = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('EXODisappMuonPath') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('AODSIM'), + filterName = cms.untracked.string('EXODisappMuon') + #filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + fileName = cms.untracked.string('EXODisappMuon.root'), + outputCommands = process.EXODisappMuonSkimContent.outputCommands +) + +process.EXODisappMuonPath = cms.Path(process.EXODisappMuonSkimSequence) +process.SKIMStreamEXODisappMuonOutPath = cms.EndPath(process.SKIMStreamEXODisappMuon) + +# Schedule definition +process.schedule = cms.Schedule(process.EXODisappMuonPath,process.SKIMStreamEXODisappMuonOutPath) diff --git a/Configuration/Skimming/test/test_EXOLLPJetHCAL_SKIM.py b/Configuration/Skimming/test/test_EXOLLPJetHCAL_SKIM.py new file mode 100644 index 0000000000000..57915d7452dd2 --- /dev/null +++ b/Configuration/Skimming/test/test_EXOLLPJetHCAL_SKIM.py @@ -0,0 +1,403 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: skims -s SKIM:EXOLLPJetHCAL --dasquery=file=/store/relval/CMSSW_12_4_11/DisplacedJet/RECO/124X_dataRun3_Prompt_v4_gtval_RelVal_2022D-v1/2580000/1e9b47ed-c192-4f49-9e3d-6fac61586946.root -n 100 --conditions 120X_mcRun3_2021_realistic_v6 --python_filename=test_EXOLLPJetHCAL_SKIM.py --processName=SKIMEXOLLPJetHCAL --no_exec --data +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('SKIMEXOLLPJetHCAL') + +# 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('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Skims_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1000), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('/store/relval/CMSSW_12_4_11/DisplacedJet/RECO/124X_dataRun3_Prompt_v4_gtval_RelVal_2022D-v1/2580000/1e9b47ed-c192-4f49-9e3d-6fac61586946.root'), + secondaryFileNames = cms.untracked.vstring() +) + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + accelerators = cms.untracked.vstring('*'), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + dumpOptions = cms.untracked.bool(False), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(0) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + holdsReferencesToDeleteEarly = cms.untracked.VPSet(), + makeTriggerResults = cms.obsolete.untracked.bool, + modulesToIgnoreForDeleteEarly = cms.untracked.vstring(), + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(0), + 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('skims nevts:100'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.RECOSIMoutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string(''), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('skims_SKIM.root'), + outputCommands = process.RECOSIMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition +process.SKIMStreamEXOLLPJetHCAL = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('EXOLLPJetHCALPath') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('AOD'), + filterName = cms.untracked.string('EXOLLPJetHCAL') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(5242880), + fileName = cms.untracked.string('EXOLLPJetHCAL.root'), + outputCommands = cms.untracked.vstring( ( + 'drop *', + 'drop *', + 'keep ClusterSummary_clusterSummaryProducer_*_*', + 'keep *_dt4DSegments_*_*', + 'keep *_dt4DCosmicSegments_*_*', + 'keep *_cscSegments_*_*', + 'keep *_rpcRecHits_*_*', + 'keep *_dt1DRecHits_*_*', + 'keep *_csc2DRecHits_*_*', + 'keep *_castorreco_*_*', + 'keep *_reducedHcalRecHits_*_*', + 'keep HcalUnpackerReport_castorDigis_*_*', + 'keep HcalUnpackerReport_hcalDigiAlCaMB_*_*', + 'keep HcalUnpackerReport_hcalDigis_*_*', + 'keep *_selectDigi_*_*', + 'keep EcalRecHitsSorted_reducedEcalRecHitsEB_*_*', + 'keep EcalRecHitsSorted_reducedEcalRecHitsEE_*_*', + 'keep EcalRecHitsSorted_reducedEcalRecHitsES_*_*', + 'keep recoSuperClusters_correctedHybridSuperClusters_*_*', + 'keep recoCaloClusters_hybridSuperClusters_*_*', + 'keep recoSuperClusters_hybridSuperClusters_uncleanOnlyHybridSuperClusters_*', + 'keep recoCaloClusters_multi5x5SuperClusters_multi5x5EndcapBasicClusters_*', + 'keep recoSuperClusters_correctedMulti5x5SuperClustersWithPreshower_*_*', + 'keep recoPreshowerClusters_multi5x5SuperClustersWithPreshower_*_*', + 'keep recoPreshowerClusterShapes_multi5x5PreshowerClusterShape_*_*', + 'keep recoSuperClusters_particleFlowSuperClusterECAL_*_*', + 'keep recoCaloClusters_particleFlowSuperClusterECAL_*_*', + 'keep recoSuperClusters_particleFlowSuperClusterOOTECAL_*_*', + 'keep recoCaloClusters_particleFlowSuperClusterOOTECAL_*_*', + 'keep recoTracks_GsfGlobalElectronTest_*_*', + 'keep recoGsfTracks_electronGsfTracks_*_*', + 'keep recoTracks_generalTracks_*_*', + 'keep recoTracks_conversionStepTracks_*_*', + 'keep recoTracks_beamhaloTracks_*_*', + 'keep recoTracks_ctfPixelLess_*_*', + 'keep *_dedxHarmonic2_*_*', + 'keep *_dedxPixelHarmonic2_*_*', + 'keep *_dedxHitInfo_*_*', + 'keep *_trackExtrapolator_*_*', + 'keep *_generalTracks_MVAValues_*', + 'keep *_generalTracks_MVAVals_*', + 'keep recoCaloJets_ak4CaloJets_*_*', + 'keep *_ak4CaloJets_rho_*', + 'keep *_ak4CaloJets_sigma_*', + 'keep *_ak4PFJetsCHS_*_*', + 'keep floatedmValueMap_puppi_*_*', + 'keep *_ak4PFJetsPuppi_*_*', + 'keep *_ak8PFJetsPuppi_*_*', + 'keep *_ak8PFJetsPuppiSoftDrop_*_*', + 'keep recoPFJets_ak4PFJets_*_*', + 'keep *_ak4PFJets_rho_*', + 'keep *_ak4PFJets_sigma_*', + 'keep *_JetPlusTrackZSPCorJetAntiKt4_*_*', + 'keep *_caloTowers_*_*', + 'keep *_CastorTowerReco_*_*', + 'keep *_ak4JetTracksAssociatorAtVertex_*_*', + 'keep *_ak4JetTracksAssociatorAtVertexPF_*_*', + 'keep *_ak4JetTracksAssociatorExplicit_*_*', + 'keep *_ak4JetExtender_*_*', + 'keep *_ak4JetID_*_*', + 'keep recoBasicJets_ak5CastorJets_*_*', + 'keep *_ak5CastorJets_rho_*', + 'keep *_ak5CastorJets_sigma_*', + 'keep *_ak5CastorJetID_*_*', + 'keep recoBasicJets_ak7CastorJets_*_*', + 'keep *_ak7CastorJets_rho_*', + 'keep *_ak7CastorJets_sigma_*', + 'keep *_ak7CastorJetID_*_*', + 'keep *_fixedGridRhoAll_*_*', + 'keep *_fixedGridRhoFastjetAll_*_*', + 'keep *_fixedGridRhoFastjetAllTmp_*_*', + 'keep *_fixedGridRhoFastjetCentral_*_*', + 'keep *_fixedGridRhoFastjetAllCalo_*_*', + 'keep *_fixedGridRhoFastjetCentralCalo_*_*', + 'keep *_fixedGridRhoFastjetCentralChargedPileUp_*_*', + 'keep *_fixedGridRhoFastjetCentralNeutral_*_*', + 'keep *_ak8PFJetsPuppiSoftDropMass_*_*', + 'keep recoCaloMETs_caloMet_*_*', + 'keep recoCaloMETs_caloMetBE_*_*', + 'keep recoCaloMETs_caloMetBEFO_*_*', + 'keep recoCaloMETs_caloMetM_*_*', + 'keep recoPFMETs_pfMet_*_*', + 'keep recoPFMETs_pfChMet_*_*', + 'keep floatedmValueMap_puppiNoLep_*_*', + 'keep recoPFMETs_pfMetPuppi_*_*', + 'keep recoMuonMETCorrectionDataedmValueMap_muonMETValueMapProducer_*_*', + 'keep HcalNoiseSummary_hcalnoise_*_*', + 'keep recoGlobalHaloData_GlobalHaloData_*_*', + 'keep recoCSCHaloData_CSCHaloData_*_*', + 'keep recoBeamHaloSummary_BeamHaloSummary_*_*', + 'keep recoMuons_muons_*_*', + 'keep booledmValueMap_muons_*_*', + 'keep doubleedmValueMap_muons_muPFMean*_*', + 'keep doubleedmValueMap_muons_muPFSum*_*', + 'keep *_muons_muonShowerInformation_*', + 'keep recoMuonTimeExtraedmValueMap_muons_*_*', + 'keep recoMuonCosmicCompatibilityedmValueMap_muons_*_*', + 'keep uintedmValueMap_muons_*_*', + 'keep *_particleFlow_muons_*', + 'keep recoMuons_displacedMuons_*_*', + 'keep booledmValueMap_displacedMuons_*_*', + 'keep doubleedmValueMap_displacedMuons_dispMuPFMean*_*', + 'keep doubleedmValueMap_displacedMuons_dispMuPFSum*_*', + 'keep recoMuonTimeExtraedmValueMap_displacedMuons_*_*', + 'keep uintedmValueMap_displacedMuons_*_*', + 'keep *_particleFlow_displacedMuons_*', + 'keep recoTracks_standAloneMuons_*_*', + 'keep recoTrackExtras_standAloneMuons_*_*', + 'keep TrackingRecHitsOwned_standAloneMuons_*_*', + 'keep recoTracks_globalMuons_*_*', + 'keep recoTrackExtras_globalMuons_*_*', + 'keep recoTracks_tevMuons_*_*', + 'keep recoTrackExtras_tevMuons_*_*', + 'keep recoTracks_generalTracks_*_*', + 'keep recoTracks_displacedTracks_*_*', + 'keep recoTracksToOnerecoTracksAssociation_tevMuons_*_*', + 'keep recoTracks_displacedGlobalMuons_*_*', + 'keep recoTrackExtras_displacedGlobalMuons_*_*', + 'keep TrackingRecHitsOwned_displacedGlobalMuons_*_*', + 'keep recoTracks_cosmicMuons_*_*', + 'keep recoMuons_muonsFromCosmics_*_*', + 'keep recoTracks_cosmicMuons1Leg_*_*', + 'keep recoMuons_muonsFromCosmics1Leg_*_*', + 'keep recoTracks_refittedStandAloneMuons_*_*', + 'keep recoTrackExtras_refittedStandAloneMuons_*_*', + 'keep TrackingRecHitsOwned_refittedStandAloneMuons_*_*', + 'keep recoTracks_displacedStandAloneMuons__*', + 'keep recoTrackExtras_displacedStandAloneMuons_*_*', + 'keep TrackingRecHitsOwned_displacedStandAloneMuons_*_*', + 'keep *_muonReducedTrackExtras_*_*', + 'keep *_displacedMuonReducedTrackExtras_*_*', + 'keep *_softPFElectronBJetTags_*_*', + 'keep *_softPFMuonBJetTags_*_*', + 'keep *_pfTrackCountingHighEffBJetTags_*_*', + 'keep *_pfJetProbabilityBJetTags_*_*', + 'keep *_pfJetBProbabilityBJetTags_*_*', + 'keep *_pfSimpleSecondaryVertexHighEffBJetTags_*_*', + 'keep *_pfSimpleInclusiveSecondaryVertexHighEffBJetTags_*_*', + 'keep *_pfCombinedSecondaryVertexV2BJetTags_*_*', + 'keep *_pfCombinedInclusiveSecondaryVertexV2BJetTags_*_*', + 'keep *_pfGhostTrackBJetTags_*_*', + 'keep *_pfCombinedMVAV2BJetTags_*_*', + 'keep *_inclusiveCandidateSecondaryVertices_*_*', + 'keep *_inclusiveCandidateSecondaryVerticesCvsL_*_*', + 'keep *_pfCombinedCvsLJetTags_*_*', + 'keep *_pfCombinedCvsBJetTags_*_*', + 'keep *_pfChargeBJetTags_*_*', + 'keep *_pfDeepCSVJetTags_*_*', + 'keep *_pfDeepCMVAJetTags_*_*', + 'keep *_pixelClusterTagInfos_*_*', + 'keep recoRecoTauPiZeros_hpsPFTauProducer_pizeros_*', + 'keep recoPFTaus_hpsPFTauProducer_*_*', + 'keep *_hpsPFTauBasicDiscriminators_*_*', + 'keep *_hpsPFTauBasicDiscriminatorsdR03_*_*', + 'keep *_hpsPFTauDiscriminationByDeadECALElectronRejection_*_*', + 'keep *_hpsPFTauDiscriminationByDecayModeFinding_*_*', + 'keep *_hpsPFTauDiscriminationByDecayModeFindingNewDMs_*_*', + 'keep *_hpsPFTauDiscriminationByDecayModeFindingOldDMs_*_*', + 'keep *_hpsPFTauDiscriminationByMuonRejection3_*_*', + 'keep *_hpsPFTauTransverseImpactParameters_*_*', + 'keep *_offlinePrimaryVertices__*', + 'keep *_offlinePrimaryVerticesWithBS_*_*', + 'keep *_offlinePrimaryVerticesFromCosmicTracks_*_*', + 'keep *_nuclearInteractionMaker_*_*', + 'keep *_generalV0Candidates_*_*', + 'keep *_inclusiveSecondaryVertices_*_*', + 'keep recoGsfElectronCores_gsfElectronCores_*_*', + 'keep recoGsfElectronCores_gedGsfElectronCores_*_*', + 'keep recoGsfElectrons_gsfElectrons_*_*', + 'keep recoGsfElectrons_gedGsfElectrons_*_*', + 'keep recoGsfElectronCores_uncleanedOnlyGsfElectronCores_*_*', + 'keep recoGsfElectrons_uncleanedOnlyGsfElectrons_*_*', + 'keep floatedmValueMap_eidRobustLoose_*_*', + 'keep floatedmValueMap_eidRobustTight_*_*', + 'keep floatedmValueMap_eidRobustHighEnergy_*_*', + 'keep floatedmValueMap_eidLoose_*_*', + 'keep floatedmValueMap_eidTight_*_*', + 'keep *_egmGedGsfElectronPFIsolation_*_*', + 'keep recoPhotonCores_gedPhotonCore_*_*', + 'keep recoPhotons_gedPhotons_*_*', + 'keep *_particleBasedIsolation_*_*', + 'keep recoPhotonCores_photonCore_*_*', + 'keep recoPhotons_photons_*_*', + 'keep recoPhotonCores_ootPhotonCore_*_*', + 'keep recoPhotons_ootPhotons_*_*', + 'keep recoConversions_conversions_*_*', + 'drop recoConversions_conversions_uncleanedConversions_*', + 'keep recoConversions_mustacheConversions_*_*', + 'keep *_gsfTracksOpenConversions_*_*', + 'keep recoConversions_allConversions_*_*', + 'keep recoConversions_allConversionsOldEG_*_*', + 'keep recoTracks_ckfOutInTracksFromConversions_*_*', + 'keep recoTracks_ckfInOutTracksFromConversions_*_*', + 'keep recoConversions_uncleanedOnlyAllConversions_*_*', + 'keep recoTracks_uncleanedOnlyCkfOutInTracksFromConversions_*_*', + 'keep recoTracks_uncleanedOnlyCkfInOutTracksFromConversions_*_*', + 'keep *_PhotonIDProd_*_*', + 'keep *_PhotonIDProdGED_*_*', + 'keep *_hfRecoEcalCandidate_*_*', + 'keep *_hfEMClusters_*_*', + 'keep *_gedGsfElectronCores_*_*', + 'keep *_gedGsfElectrons_*_*', + 'keep recoCaloClusters_lowPtGsfElectronSuperClusters_*_*', + 'keep recoGsfElectrons_lowPtGsfElectrons_*_*', + 'keep recoGsfElectronCores_lowPtGsfElectronCores_*_*', + 'keep recoGsfTracks_lowPtGsfEleGsfTracks_*_*', + 'keep *_lowPtGsfToTrackLinks_*_*', + 'keep recoSuperClusters_lowPtGsfElectronSuperClusters_*_*', + 'keep floatedmValueMap_lowPtGsfElectronSeedValueMaps_*_*', + 'keep floatedmValueMap_rekeyLowPtGsfElectronSeedValueMaps_*_*', + 'keep floatedmValueMap_lowPtGsfElectronID_*_*', + 'keep recoPFRecHits_particleFlowRecHitECAL_Cleaned_*', + 'keep recoPFRecHits_particleFlowRecHitHBHE_Cleaned_*', + 'keep recoPFRecHits_particleFlowRecHitHF_Cleaned_*', + 'keep recoPFRecHits_particleFlowRecHitHO_Cleaned_*', + 'keep recoPFRecHits_particleFlowRecHitPS_Cleaned_*', + 'keep recoCaloClusters_particleFlowEGamma_*_*', + 'keep recoSuperClusters_particleFlowEGamma_*_*', + 'keep recoCaloClusters_particleFlowSuperClusterECAL_*_*', + 'keep recoSuperClusters_particleFlowSuperClusterECAL_*_*', + 'keep recoConversions_particleFlowEGamma_*_*', + 'keep recoPFCandidates_particleFlow_*_*', + 'keep recoPFCandidates_particleFlowTmp_AddedMuonsAndHadrons_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedCosmicsMuons_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedFakeMuons_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedHF_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedPunchThroughMuons_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedPunchThroughNeutralHadrons_*', + 'keep recoPFCandidates_particleFlowTmp_CleanedTrackerAndGlobalMuons_*', + 'keep *_particleFlow_electrons_*', + 'keep *_particleFlow_photons_*', + 'keep *_particleFlow_muons_*', + 'keep recoCaloClusters_pfElectronTranslator_*_*', + 'keep recoPreshowerClusters_pfElectronTranslator_*_*', + 'keep recoSuperClusters_pfElectronTranslator_*_*', + 'keep recoCaloClusters_pfPhotonTranslator_*_*', + 'keep recoPreshowerClusters_pfPhotonTranslator_*_*', + 'keep recoSuperClusters_pfPhotonTranslator_*_*', + 'keep recoPhotons_pfPhotonTranslator_*_*', + 'keep recoPhotonCores_pfPhotonTranslator_*_*', + 'keep recoConversions_pfPhotonTranslator_*_*', + 'keep *_particleFlowPtrs_*_*', + 'keep *_particleFlowTmpPtrs_*_*', + 'keep *_chargedHadronPFTrackIsolation_*_*', + 'keep *_offlineBeamSpot_*_*', + 'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*', + 'keep *_l1GtRecord_*_*', + 'keep *_l1GtTriggerMenuLite_*_*', + 'keep *_conditionsInEdm_*_*', + 'keep *_l1extraParticles_*_*', + 'keep *_l1L1GtObjectMap_*_*', + 'keep LumiSummary_lumiProducer_*_*', + 'drop *_hlt*_*_*', + 'keep GlobalObjectMapRecord_hltGtStage2ObjectMap_*_*', + 'keep edmTriggerResults_*_*_*', + 'keep triggerTriggerEvent_*_*_*', + 'keep *_hltFEDSelectorL1_*_*', + 'keep *_hltScoutingEgammaPacker_*_*', + 'keep *_hltScoutingMuonPacker_*_*', + 'keep *_hltScoutingPFPacker_*_*', + 'keep *_hltScoutingPrimaryVertexPacker_*_*', + 'keep *_hltScoutingTrackPacker_*_*', + 'keep edmTriggerResults_*_*_*', + 'keep L1AcceptBunchCrossings_scalersRawToDigi_*_*', + 'keep L1TriggerScalerss_scalersRawToDigi_*_*', + 'keep Level1TriggerScalerss_scalersRawToDigi_*_*', + 'keep LumiScalerss_scalersRawToDigi_*_*', + 'keep BeamSpotOnlines_scalersRawToDigi_*_*', + 'keep DcsStatuss_scalersRawToDigi_*_*', + 'keep CTPPSRecord_onlineMetaDataDigis_*_*', + 'keep DCSRecord_onlineMetaDataDigis_*_*', + 'keep OnlineLuminosityRecord_onlineMetaDataDigis_*_*', + 'keep recoBeamSpot_onlineMetaDataDigis_*_*', + 'keep *_tcdsDigis_*_*', + 'keep *_logErrorHarvester_*_*', + 'keep FEDRawDataCollection_rawDataCollector_*_*', + 'keep FEDRawDataCollection_source_*_*', + 'drop *_MEtoEDMConverter_*_*', + 'drop *_*_*_SKIM', + 'keep *_hbhereco__*' + ) ) +) + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '120X_mcRun3_2021_realistic_v6', '') + +# Path and EndPath definitions +process.RECOSIMoutput_step = cms.EndPath(process.RECOSIMoutput) +process.SKIMStreamEXOLLPJetHCALOutPath = cms.EndPath(process.SKIMStreamEXOLLPJetHCAL) + +# Schedule definition +process.schedule = cms.Schedule(process.EXOLLPJetHCALPath,process.RECOSIMoutput_step,process.SKIMStreamEXOLLPJetHCALOutPath) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + + + +# Customisation from command line + +#Have logErrorHarvester wait for the same EDProducers to finish as those providing data for the OutputModule +from FWCore.Modules.logErrorHarvester_cff import customiseLogErrorHarvesterUsingOutputCommands +process = customiseLogErrorHarvesterUsingOutputCommands(process) + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index d3d5de80dd970..9b1fc2834eacb 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -34,6 +34,7 @@ def __init__(self): 'Run2_2018_highBetaStar', 'Run2_2018_noMkFit', 'Run3', + 'Run3_2023', 'Run3_noMkFit', 'Run3_pp_on_PbPb', 'Run3_pp_on_PbPb_approxSiStripClusters', @@ -80,6 +81,7 @@ def __init__(self): 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_106Xv2', 'run3_nanoAOD_122', 'run3_nanoAOD_124', + 'run3_ecal_devel', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', 'bParking'] diff --git a/Configuration/StandardSequences/python/ReconstructionHeavyIons_cff.py b/Configuration/StandardSequences/python/ReconstructionHeavyIons_cff.py index 15826a5c2cf25..4ebf51cca6251 100644 --- a/Configuration/StandardSequences/python/ReconstructionHeavyIons_cff.py +++ b/Configuration/StandardSequences/python/ReconstructionHeavyIons_cff.py @@ -8,7 +8,7 @@ from RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi import * from RecoLocalTracker.Configuration.RecoLocalTrackerHeavyIons_cff import * from RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi import * -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * # Ecal from RecoLocalCalo.Configuration.ecalLocalRecoSequence_cff import * @@ -33,7 +33,7 @@ from RecoHI.HiEgammaAlgos.HiElectronSequence_cff import * #-------------------------------------------------------------------------- -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone( src = 'siPixelClustersPreSplitting' ) diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index 30e3cdec61f25..d01b11b329a04 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -9,7 +9,7 @@ from RecoParticleFlow.PFClusterProducer.particleFlowCluster_cff import * from TrackingTools.Configuration.TrackingTools_cff import * from RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi import * -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * from RecoHGCal.Configuration.recoHGCAL_cff import * from Configuration.Eras.Modifier_fastSim_cff import fastSim @@ -26,7 +26,7 @@ # Higher level objects from RecoVertex.Configuration.RecoVertex_cff import * from RecoEgamma.Configuration.RecoEgamma_cff import * -from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * +from RecoTracker.Configuration.RecoPixelVertexing_cff import * from RecoJets.Configuration.RecoJetsGlobal_cff import * diff --git a/Configuration/StandardSequences/python/VtxSmeared.py b/Configuration/StandardSequences/python/VtxSmeared.py index b58fb615e430c..ed984001a78dd 100644 --- a/Configuration/StandardSequences/python/VtxSmeared.py +++ b/Configuration/StandardSequences/python/VtxSmeared.py @@ -68,6 +68,7 @@ 'Realistic25ns900GeV2021Collision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic25ns900GeV2021Collision_cfi', 'Realistic25ns13p6TeVEarly2022Collision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic25ns13p6TeVEarly2022Collision_cfi', 'Realistic25ns13p6TeVEOY2022Collision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic25ns13p6TeVEOY2022Collision_cfi', + 'Realistic25ns13p6TeVEarly2023Collision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic25ns13p6TeVEarly2023Collision_cfi', 'Nominal2022PbPbCollision' : 'IOMC.EventVertexGenerators.VtxSmearedNominal2022PbPbCollision_cfi', 'Realistic2022PbPbCollision' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic2022PbPbCollision_cfi', } diff --git a/DQM/BeamMonitor/plugins/AlcaBeamMonitor.cc b/DQM/BeamMonitor/plugins/AlcaBeamMonitor.cc index 8246856e2891c..efdd24ab55848 100644 --- a/DQM/BeamMonitor/plugins/AlcaBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/AlcaBeamMonitor.cc @@ -60,20 +60,20 @@ AlcaBeamMonitor::AlcaBeamMonitor(const ParameterSet& ps) histoByCategoryNames_.insert(pair("run", "Coordinate")); histoByCategoryNames_.insert(pair("run", "PrimaryVertex fit-DataBase")); histoByCategoryNames_.insert(pair("run", "PrimaryVertex fit-BeamFit")); - histoByCategoryNames_.insert(pair("run", "PrimaryVertex fit-Scalers")); + histoByCategoryNames_.insert(pair("run", "PrimaryVertex fit-Online")); histoByCategoryNames_.insert(pair("run", "PrimaryVertex-DataBase")); histoByCategoryNames_.insert(pair("run", "PrimaryVertex-BeamFit")); - histoByCategoryNames_.insert(pair("run", "PrimaryVertex-Scalers")); + histoByCategoryNames_.insert(pair("run", "PrimaryVertex-Online")); histoByCategoryNames_.insert(pair("lumi", "Lumibased BeamSpotFit")); histoByCategoryNames_.insert(pair("lumi", "Lumibased PrimaryVertex")); histoByCategoryNames_.insert(pair("lumi", "Lumibased DataBase")); - histoByCategoryNames_.insert(pair("lumi", "Lumibased Scalers")); + histoByCategoryNames_.insert(pair("lumi", "Lumibased Online")); histoByCategoryNames_.insert(pair("lumi", "Lumibased PrimaryVertex-DataBase fit")); - histoByCategoryNames_.insert(pair("lumi", "Lumibased PrimaryVertex-Scalers fit")); - histoByCategoryNames_.insert(pair("validation", "Lumibased Scalers-DataBase fit")); + histoByCategoryNames_.insert(pair("lumi", "Lumibased PrimaryVertex-Online fit")); + histoByCategoryNames_.insert(pair("validation", "Lumibased Online-DataBase fit")); histoByCategoryNames_.insert(pair("validation", "Lumibased PrimaryVertex-DataBase")); - histoByCategoryNames_.insert(pair("validation", "Lumibased PrimaryVertex-Scalers")); + histoByCategoryNames_.insert(pair("validation", "Lumibased PrimaryVertex-Online")); } for (vector::iterator itV = varNamesV_.begin(); itV != varNamesV_.end(); itV++) { @@ -115,8 +115,8 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& if (itMM->first == "Coordinate") { itMM->second = ibooker.book1D(name, title, 1001, -0.2525, 0.2525); } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" || - itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" || - itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") { + itMM->first == "PrimaryVertex fit-Online" || itMM->first == "PrimaryVertex-DataBase" || + itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Online") { itMM->second = ibooker.book1D(name, title, 1001, -0.02525, 0.02525); } else { //assert(0); @@ -125,10 +125,10 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& if (itMM->first == "Coordinate") { itMM->second = ibooker.book1D(name, title, 101, -5.05, 5.05); } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" || - itMM->first == "PrimaryVertex fit-Scalers") { + itMM->first == "PrimaryVertex fit-Online") { itMM->second = ibooker.book1D(name, title, 101, -0.505, 0.505); } else if (itMM->first == "PrimaryVertex-DataBase" || itMM->first == "PrimaryVertex-BeamFit" || - itMM->first == "PrimaryVertex-Scalers") { + itMM->first == "PrimaryVertex-Online") { itMM->second = ibooker.book1D(name, title, 1001, -5.005, 5.005); } else { //assert(0); @@ -137,8 +137,8 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& if (itMM->first == "Coordinate") { itMM->second = ibooker.book1D(name, title, 100, 0, 0.015); } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" || - itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" || - itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") { + itMM->first == "PrimaryVertex fit-Online" || itMM->first == "PrimaryVertex-DataBase" || + itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Online") { itMM->second = nullptr; } else { //assert(0); @@ -147,8 +147,8 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& if (itMM->first == "Coordinate") { itMM->second = ibooker.book1D(name, title, 110, 0, 11); } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" || - itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" || - itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") { + itMM->first == "PrimaryVertex fit-Online" || itMM->first == "PrimaryVertex-DataBase" || + itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Online") { itMM->second = ibooker.book1D(name, title, 101, -5.05, 5.05); } else { //assert(0); @@ -160,8 +160,8 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& if (itMM->first == "Coordinate") { itMM->second->setAxisTitle(itM->first + "_{0} (cm)", 1); } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" || - itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" || - itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") { + itMM->first == "PrimaryVertex fit-Online" || itMM->first == "PrimaryVertex-DataBase" || + itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Online") { itMM->second->setAxisTitle(itMM->first + " " + itM->first + "_{0} (cm)", 1); } itMM->second->setAxisTitle("Entries", 2); @@ -181,11 +181,11 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& ibooker.setCurrentFolder(monitorName_ + "Debug"); itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5); itMMM->second->setEfficiencyFlag(); - } else if (itMM->first == "validation" && itMMM->first == "Lumibased Scalers-DataBase fit") { + } else if (itMM->first == "validation" && itMMM->first == "Lumibased Online-DataBase fit") { ibooker.setCurrentFolder(monitorName_ + "Validation"); itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5); itMMM->second->setEfficiencyFlag(); - } else if (itMM->first == "validation" && itMMM->first != "Lumibased Scalers-DataBase fit" && + } else if (itMM->first == "validation" && itMMM->first != "Lumibased Online-DataBase fit" && (itM->first == "x" || itM->first == "y" || itM->first == "z")) { ibooker.setCurrentFolder(monitorName_ + "Validation"); itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5); @@ -224,13 +224,12 @@ void AlcaBeamMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& } //---------------------------------------------------------------------------------------------------------------------- -std::shared_ptr AlcaBeamMonitor::globalBeginLuminosityBlock(const LuminosityBlock& iLumi, - const EventSetup& iSetup) const { +std::shared_ptr AlcaBeamMonitor::globalBeginLuminosityBlock( + const LuminosityBlock& iLumi, const EventSetup& iSetup) const { // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type! - vertices_.clear(); - beamSpotsMap_.clear(); - processedLumis_.push_back(iLumi.id().luminosityBlock()); + auto beamSpotInfo = std::make_shared(); + //Read BeamSpot from DB ESHandle bsDBHandle; try { @@ -252,10 +251,10 @@ std::shared_ptr AlcaBeamMonitor::globalBeginLuminosity } } - beamSpotsMap_["DB"] = + beamSpotInfo->beamSpotMap_["DB"] = BeamSpot(apoint, spotDB->sigmaZ(), spotDB->dxdz(), spotDB->dydz(), spotDB->beamWidthX(), matrix); - BeamSpot* aSpot = &(beamSpotsMap_["DB"]); + BeamSpot* aSpot = &(beamSpotInfo->beamSpotMap_["DB"]); aSpot->setBeamWidthY(spotDB->beamWidthY()); aSpot->setEmittanceX(spotDB->emittanceX()); @@ -272,7 +271,7 @@ std::shared_ptr AlcaBeamMonitor::globalBeginLuminosity } else { LogInfo("AlcaBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock(); } - return nullptr; + return beamSpotInfo; } //---------------------------------------------------------------------------------------------------------------------- @@ -282,45 +281,47 @@ void AlcaBeamMonitor::analyze(const Event& iEvent, const EventSetup& iSetup) { //------ PVFitter thePVFitter_->readEvent(iEvent); - if (beamSpotsMap_.find("DB") != beamSpotsMap_.end()) { + auto beamSpotInfo = luminosityBlockCache(iEvent.getLuminosityBlock().index()); + if (beamSpotInfo->beamSpotMap_.find("DB") != beamSpotInfo->beamSpotMap_.end()) { //------ Tracks Handle TrackCollection; iEvent.getByToken(trackLabel_, TrackCollection); const reco::TrackCollection* tracks = TrackCollection.product(); for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { hD0Phi0_->Fill(track->phi(), -1 * track->dxy()); - hDxyBS_->Fill(-1 * track->dxy(beamSpotsMap_["DB"].position())); + hDxyBS_->Fill(-1 * track->dxy(beamSpotInfo->beamSpotMap_["DB"].position())); } } //------ Primary Vertices Handle PVCollection; if (iEvent.getByToken(primaryVertexLabel_, PVCollection)) { - vertices_.push_back(*PVCollection.product()); + beamSpotInfo->vertices_.push_back(*PVCollection.product()); } - if (beamSpotsMap_.find("SC") == beamSpotsMap_.end()) { + if (beamSpotInfo->beamSpotMap_.find("SC") == beamSpotInfo->beamSpotMap_.end()) { //BeamSpot from file for this stream is = to the scalar BeamSpot - Handle recoBeamSpotHandle; - try { - iEvent.getByToken(scalerLabel_, recoBeamSpotHandle); - } catch (cms::Exception& exception) { - LogInfo("AlcaBeamMonitor") << exception.what(); - return; - } - beamSpotsMap_["SC"] = *recoBeamSpotHandle; - if (beamSpotsMap_["SC"].BeamWidthX() != 0) { - beamSpotsMap_["SC"].setType(reco::BeamSpot::Tracker); + if (Handle recoBeamSpotHandle = iEvent.getHandle(scalerLabel_)) { + beamSpotInfo->beamSpotMap_["SC"] = *recoBeamSpotHandle; + if (beamSpotInfo->beamSpotMap_["SC"].BeamWidthX() != 0) { + beamSpotInfo->beamSpotMap_["SC"].setType(reco::BeamSpot::Tracker); + } else { + beamSpotInfo->beamSpotMap_["SC"].setType(reco::BeamSpot::Fake); + } } else { - beamSpotsMap_["SC"].setType(reco::BeamSpot::Fake); + LogWarning("AlcaBeamMonitor") << "No BeamSpot from scalers is available"; + return; } } } //---------------------------------------------------------------------------------------------------------------------- void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, const EventSetup& iSetup) { + processedLumis_.push_back(iLumi.id().luminosityBlock()); + + auto beamSpotInfo = luminosityBlockCache(iLumi.index()); if (theBeamFitter_->runPVandTrkFitter()) { - beamSpotsMap_["BF"] = theBeamFitter_->getBeamSpot(); + beamSpotInfo->beamSpotMap_["BF"] = theBeamFitter_->getBeamSpot(); } theBeamFitter_->resetTrkVector(); theBeamFitter_->resetLSRange(); @@ -328,7 +329,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con theBeamFitter_->resetPVFitter(); if (thePVFitter_->runFitter()) { - beamSpotsMap_["PV"] = thePVFitter_->getBeamSpot(); + beamSpotInfo->beamSpotMap_["PV"] = thePVFitter_->getBeamSpot(); } thePVFitter_->resetAll(); @@ -338,7 +339,9 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con MonitorElement* histo = nullptr; for (vector::iterator itV = varNamesV_.begin(); itV != varNamesV_.end(); itV++) { resultsMap.clear(); - for (BeamSpotContainer::iterator itBS = beamSpotsMap_.begin(); itBS != beamSpotsMap_.end(); itBS++) { + for (BeamSpotContainer::iterator itBS = beamSpotInfo->beamSpotMap_.begin(); + itBS != beamSpotInfo->beamSpotMap_.end(); + itBS++) { if (itBS->second.type() == BeamSpot::Tracker) { if (*itV == "x") { resultsMap[itBS->first] = pair(itBS->second.x0(), itBS->second.x0Error()); @@ -360,7 +363,9 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con } } vertexResults.clear(); - for (vector::iterator itPV = vertices_.begin(); itPV != vertices_.end(); itPV++) { + for (vector::iterator itPV = beamSpotInfo->vertices_.begin(); + itPV != beamSpotInfo->vertices_.end(); + itPV++) { if (!itPV->empty()) { for (VertexCollection::const_iterator pv = itPV->begin(); pv != itPV->end(); pv++) { if (pv->isFake() || pv->tracksSize() < 10) @@ -385,7 +390,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con if ((histo = histosMap_[*itV][itM->first][itM->second]) == nullptr) continue; if (itM->second == "Coordinate") { - if (beamSpotsMap_.find("DB") != beamSpotsMap_.end()) { + if (beamSpotInfo->beamSpotMap_.find("DB") != beamSpotInfo->beamSpotMap_.end()) { histo->Fill(resultsMap["DB"].first); } } else if (itM->second == "PrimaryVertex fit-DataBase") { @@ -396,7 +401,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("BF") != resultsMap.end()) { histo->Fill(resultsMap["PV"].first - resultsMap["BF"].first); } - } else if (itM->second == "PrimaryVertex fit-Scalers") { + } else if (itM->second == "PrimaryVertex fit-Online") { if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) { histo->Fill(resultsMap["PV"].first - resultsMap["SC"].first); } @@ -414,7 +419,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con histo->Fill(itPV->first - resultsMap["BF"].first); } } - } else if (itM->second == "PrimaryVertex-Scalers") { + } else if (itM->second == "PrimaryVertex-Online") { if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) { for (vector >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end(); itPV++) { @@ -436,7 +441,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["DB"].first); histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["DB"].second); } - } else if (itM->second == "Lumibased Scalers") { + } else if (itM->second == "Lumibased Online") { if (resultsMap.find("SC") != resultsMap.end()) { histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["SC"].first); histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["SC"].second); @@ -447,13 +452,13 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con histo->setBinError(iLumi.id().luminosityBlock(), std::sqrt(std::pow(resultsMap["PV"].second, 2) + std::pow(resultsMap["DB"].second, 2))); } - } else if (itM->second == "Lumibased PrimaryVertex-Scalers fit") { + } else if (itM->second == "Lumibased PrimaryVertex-Online fit") { if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) { histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["PV"].first - resultsMap["SC"].first); histo->setBinError(iLumi.id().luminosityBlock(), std::sqrt(std::pow(resultsMap["PV"].second, 2) + std::pow(resultsMap["SC"].second, 2))); } - } else if (itM->second == "Lumibased Scalers-DataBase fit") { + } else if (itM->second == "Lumibased Online-DataBase fit") { if (resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()) { histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["SC"].first - resultsMap["DB"].first); histo->setBinError(iLumi.id().luminosityBlock(), @@ -468,7 +473,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con std::sqrt(std::pow((*itPV).second, 2) + std::pow(resultsMap["DB"].second, 2))); } } - } else if (itM->second == "Lumibased PrimaryVertex-Scalers") { + } else if (itM->second == "Lumibased PrimaryVertex-Online") { if (resultsMap.find("SC") != resultsMap.end() && !vertexResults.empty()) { for (vector >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end(); itPV++) { @@ -478,7 +483,7 @@ void AlcaBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, con } } } - // else if(itM->second == "Lumibased Scalers-DataBase"){ + // else if(itM->second == "Lumibased Online-DataBase"){ // if(resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){ // itHHH->second->Fill(bin,resultsMap["SC"].first-resultsMap["DB"].first); // } @@ -518,7 +523,7 @@ void AlcaBeamMonitor::dqmEndRun(edm::Run const&, edm::EventSetup const&) { for (int bin = 1; bin <= itHHH->second->getTH1()->GetNbinsX(); bin++) { if (itHHH->second->getTH1()->GetBinError(bin) != 0 || itHHH->second->getTH1()->GetBinContent(bin) != 0) { if (itHHH->first == "Lumibased BeamSpotFit" || itHHH->first == "Lumibased PrimaryVertex" || - itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Scalers") { + itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Online") { if (min > itHHH->second->getTH1()->GetBinContent(bin)) { min = itHHH->second->getTH1()->GetBinContent(bin); } @@ -526,10 +531,10 @@ void AlcaBeamMonitor::dqmEndRun(edm::Run const&, edm::EventSetup const&) { max = itHHH->second->getTH1()->GetBinContent(bin); } } else if (itHHH->first == "Lumibased PrimaryVertex-DataBase fit" || - itHHH->first == "Lumibased PrimaryVertex-Scalers fit" || - itHHH->first == "Lumibased Scalers-DataBase fit" || + itHHH->first == "Lumibased PrimaryVertex-Online fit" || + itHHH->first == "Lumibased Online-DataBase fit" || itHHH->first == "Lumibased PrimaryVertex-DataBase" || - itHHH->first == "Lumibased PrimaryVertex-Scalers") { + itHHH->first == "Lumibased PrimaryVertex-Online") { if (minDelta > itHHH->second->getTH1()->GetBinContent(bin)) { minDelta = itHHH->second->getTH1()->GetBinContent(bin); } @@ -549,7 +554,7 @@ void AlcaBeamMonitor::dqmEndRun(edm::Run const&, edm::EventSetup const&) { itHHH++) { if (itHHH->second != nullptr) { if (itHHH->first == "Lumibased BeamSpotFit" || itHHH->first == "Lumibased PrimaryVertex" || - itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Scalers") { + itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Online") { if ((max == -bigNumber && min == bigNumber) || max - min == 0) { itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01); itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01); @@ -558,10 +563,10 @@ void AlcaBeamMonitor::dqmEndRun(edm::Run const&, edm::EventSetup const&) { itHHH->second->getTH1()->SetMaximum(max + 0.1 * (max - min)); } } else if (itHHH->first == "Lumibased PrimaryVertex-DataBase fit" || - itHHH->first == "Lumibased PrimaryVertex-Scalers fit" || - itHHH->first == "Lumibased Scalers-DataBase fit" || + itHHH->first == "Lumibased PrimaryVertex-Online fit" || + itHHH->first == "Lumibased Online-DataBase fit" || itHHH->first == "Lumibased PrimaryVertex-DataBase" || - itHHH->first == "Lumibased PrimaryVertex-Scalers") { + itHHH->first == "Lumibased PrimaryVertex-Online") { if ((maxDelta == -bigNumber && minDelta == bigNumber) || maxDelta - minDelta == 0) { itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01); itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01); diff --git a/DQM/BeamMonitor/plugins/AlcaBeamMonitor.h b/DQM/BeamMonitor/plugins/AlcaBeamMonitor.h index 0d708d8bcaa51..56fcca62531d5 100644 --- a/DQM/BeamMonitor/plugins/AlcaBeamMonitor.h +++ b/DQM/BeamMonitor/plugins/AlcaBeamMonitor.h @@ -28,10 +28,14 @@ class BeamFitter; class PVFitter; namespace alcabeammonitor { - struct NoCache {}; + struct BeamSpotInfo { + std::vector vertices_; + typedef std::map BeamSpotContainer; + BeamSpotContainer beamSpotMap_; + }; } // namespace alcabeammonitor -class AlcaBeamMonitor : public DQMOneEDAnalyzer> { +class AlcaBeamMonitor : public DQMOneEDAnalyzer> { public: AlcaBeamMonitor(const edm::ParameterSet&); static void fillDescriptions(edm::ConfigurationDescriptions&); @@ -39,8 +43,8 @@ class AlcaBeamMonitor : public DQMOneEDAnalyzer globalBeginLuminosityBlock(const edm::LuminosityBlock& iLumi, - const edm::EventSetup& iSetup) const override; + std::shared_ptr globalBeginLuminosityBlock( + const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) const override; void globalEndLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) override; void dqmEndRun(edm::Run const&, edm::EventSetup const&) override; @@ -65,8 +69,7 @@ class AlcaBeamMonitor : public DQMOneEDAnalyzer theBeamFitter_; std::unique_ptr thePVFitter_; - mutable int numberOfProcessedLumis_; - mutable std::vector processedLumis_; + std::vector processedLumis_; // MonitorElements: MonitorElement* hD0Phi0_; @@ -74,12 +77,10 @@ class AlcaBeamMonitor : public DQMOneEDAnalyzer varNamesV_; //x,y,z,sigmax(y,z) std::multimap histoByCategoryNames_; //run, lumi - mutable std::vector vertices_; }; #endif diff --git a/DQM/BeamMonitor/plugins/OnlineBeamMonitor.cc b/DQM/BeamMonitor/plugins/OnlineBeamMonitor.cc index 76758d19a993a..a7b6edd823fa1 100644 --- a/DQM/BeamMonitor/plugins/OnlineBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/OnlineBeamMonitor.cc @@ -172,11 +172,12 @@ std::function myStringFunctor }; //---------------------------------------------------------------------------------------------------------------------- -std::shared_ptr OnlineBeamMonitor::globalBeginLuminosityBlock( +std::shared_ptr OnlineBeamMonitor::globalBeginLuminosityBlock( const LuminosityBlock& iLumi, const EventSetup& iSetup) const { // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type! - processedLumis_.push_back(iLumi.id().luminosityBlock()); + auto beamSpotInfo = std::make_shared(); + //Read BeamSpot from DB ESHandle bsHLTHandle; ESHandle bsLegacyHandle; @@ -214,9 +215,10 @@ std::shared_ptr OnlineBeamMonitor::globalBeginLumino } } - beamSpotsMap_["HLT"] = BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix); + beamSpotInfo->beamSpotsMap_["HLT"] = + BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix); - BeamSpot* aSpot = &(beamSpotsMap_["HLT"]); + BeamSpot* aSpot = &(beamSpotInfo->beamSpotsMap_["HLT"]); aSpot->setBeamWidthY(spotDB.beamWidthY()); aSpot->setEmittanceX(spotDB.emittanceX()); @@ -254,10 +256,10 @@ std::shared_ptr OnlineBeamMonitor::globalBeginLumino } } - beamSpotsMap_["Legacy"] = + beamSpotInfo->beamSpotsMap_["Legacy"] = BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix); - BeamSpot* aSpot = &(beamSpotsMap_["Legacy"]); + BeamSpot* aSpot = &(beamSpotInfo->beamSpotsMap_["Legacy"]); aSpot->setBeamWidthY(spotDB.beamWidthY()); aSpot->setEmittanceX(spotDB.emittanceX()); @@ -288,10 +290,10 @@ std::shared_ptr OnlineBeamMonitor::globalBeginLumino } } - beamSpotsMap_["Transient"] = + beamSpotInfo->beamSpotsMap_["Transient"] = BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix); - BeamSpot* aSpot = &(beamSpotsMap_["Transient"]); + BeamSpot* aSpot = &(beamSpotInfo->beamSpotsMap_["Transient"]); aSpot->setBeamWidthY(spotDB.beamWidthY()); aSpot->setEmittanceX(spotDB.emittanceX()); @@ -316,16 +318,16 @@ std::shared_ptr OnlineBeamMonitor::globalBeginLumino } //int lastLumiAnalyzed_ = iLumi.id().luminosityBlock(); - if (beamSpotsMap_.find("Transient") != beamSpotsMap_.end()) { - if (beamSpotsMap_.find("HLT") != beamSpotsMap_.end() && - beamSpotsMap_["Transient"].x0() == beamSpotsMap_["HLT"].x0()) { + if (beamSpotInfo->beamSpotsMap_.find("Transient") != beamSpotInfo->beamSpotsMap_.end()) { + if (beamSpotInfo->beamSpotsMap_.find("HLT") != beamSpotInfo->beamSpotsMap_.end() && + beamSpotInfo->beamSpotsMap_["Transient"].x0() == beamSpotInfo->beamSpotsMap_["HLT"].x0()) { // lastLumiAnalyzed_ = lastLumiHLT_; startTimeStamp_ = startTimeStampHLT_; stopTimeStamp_ = stopTimeStampHLT_; lumiRange_ = lumiRangeHLT_; - } else if (beamSpotsMap_.find("Legacy") != beamSpotsMap_.end() && - beamSpotsMap_["Transient"].x0() == beamSpotsMap_["Legacy"].x0()) { + } else if (beamSpotInfo->beamSpotsMap_.find("Legacy") != beamSpotInfo->beamSpotsMap_.end() && + beamSpotInfo->beamSpotsMap_["Transient"].x0() == beamSpotInfo->beamSpotsMap_["Legacy"].x0()) { //lastLumiAnalyzed_ = lastLumiLegacy_; startTimeStamp_ = startTimeStampLegacy_; stopTimeStamp_ = stopTimeStampLegacy_; @@ -368,19 +370,22 @@ std::shared_ptr OnlineBeamMonitor::globalBeginLumino } else { LogInfo("OnlineBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock(); } - return nullptr; + return beamSpotInfo; } //---------------------------------------------------------------------------------------------------------------------- void OnlineBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, const EventSetup& iSetup) { + processedLumis_.push_back(iLumi.id().luminosityBlock()); + auto beamSpotInfo = luminosityBlockCache(iLumi.index()); + //Setting up the choice - if (beamSpotsMap_.find("Transient") != beamSpotsMap_.end()) { - if (beamSpotsMap_.find("HLT") != beamSpotsMap_.end() && - beamSpotsMap_["Transient"].x0() == beamSpotsMap_["HLT"].x0()) { + if (beamSpotInfo->beamSpotsMap_.find("Transient") != beamSpotInfo->beamSpotsMap_.end()) { + if (beamSpotInfo->beamSpotsMap_.find("HLT") != beamSpotInfo->beamSpotsMap_.end() && + beamSpotInfo->beamSpotsMap_["Transient"].x0() == beamSpotInfo->beamSpotsMap_["HLT"].x0()) { bsChoice_->Fill(iLumi.id().luminosityBlock(), 1); bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05); - } else if (beamSpotsMap_.find("Legacy") != beamSpotsMap_.end() && - beamSpotsMap_["Transient"].x0() == beamSpotsMap_["Legacy"].x0()) { + } else if (beamSpotInfo->beamSpotsMap_.find("Legacy") != beamSpotInfo->beamSpotsMap_.end() && + beamSpotInfo->beamSpotsMap_["Transient"].x0() == beamSpotInfo->beamSpotsMap_["Legacy"].x0()) { bsChoice_->Fill(iLumi.id().luminosityBlock(), -1); bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05); } else { @@ -398,7 +403,7 @@ void OnlineBeamMonitor::globalEndLuminosityBlock(const LuminosityBlock& iLumi, c MonitorElement* histo = nullptr; for (const auto& itV : varNamesV_) { resultsMap.clear(); - for (const auto& itBS : beamSpotsMap_) { + for (const auto& itBS : beamSpotInfo->beamSpotsMap_) { if (itBS.second.type() == BeamSpot::Tracker) { if (itV == "x") { resultsMap[itBS.first] = pair(itBS.second.x0(), itBS.second.x0Error()); diff --git a/DQM/BeamMonitor/plugins/OnlineBeamMonitor.h b/DQM/BeamMonitor/plugins/OnlineBeamMonitor.h index 21dd029aa9807..5ffd098d0f77e 100644 --- a/DQM/BeamMonitor/plugins/OnlineBeamMonitor.h +++ b/DQM/BeamMonitor/plugins/OnlineBeamMonitor.h @@ -26,18 +26,21 @@ #include "CondFormats/DataRecord/interface/BeamSpotTransientObjectsRcd.h" namespace onlinebeammonitor { - struct NoCache {}; + struct BeamSpotInfo { + typedef std::map BeamSpotContainer; + BeamSpotContainer beamSpotsMap_; + }; } // namespace onlinebeammonitor -class OnlineBeamMonitor : public DQMOneEDAnalyzer> { +class OnlineBeamMonitor : public DQMOneEDAnalyzer> { public: OnlineBeamMonitor(const edm::ParameterSet&); static void fillDescriptions(edm::ConfigurationDescriptions&); protected: void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - std::shared_ptr globalBeginLuminosityBlock(const edm::LuminosityBlock& iLumi, - const edm::EventSetup& iSetup) const override; + std::shared_ptr globalBeginLuminosityBlock( + const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) const override; void globalEndLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) override; void dqmEndRun(edm::Run const&, edm::EventSetup const&) override; @@ -59,13 +62,11 @@ class OnlineBeamMonitor : public DQMOneEDAnalyzer processedLumis_; + std::vector processedLumis_; // MonitorElements: MonitorElement* bsChoice_; //Containers - mutable BeamSpotContainer beamSpotsMap_; HistosContainer histosMap_; PositionContainer positionsMap_; std::vector varNamesV_; //x,y,z,sigmax(y,z) diff --git a/DQM/BeamMonitor/test/BuildFile.xml b/DQM/BeamMonitor/test/BuildFile.xml index 32131ce1cbfd0..113855dc1c1d9 100644 --- a/DQM/BeamMonitor/test/BuildFile.xml +++ b/DQM/BeamMonitor/test/BuildFile.xml @@ -2,7 +2,4 @@ - - - - + diff --git a/DQM/BeamMonitor/test/runTest.cpp b/DQM/BeamMonitor/test/runTest.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/DQM/BeamMonitor/test/runTest.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/DQM/BeamMonitor/test/testOnlineBeamMonitor.sh b/DQM/BeamMonitor/test/testOnlineBeamMonitor.sh index da9d3c8280fcd..4b3376f030f2a 100755 --- a/DQM/BeamMonitor/test/testOnlineBeamMonitor.sh +++ b/DQM/BeamMonitor/test/testOnlineBeamMonitor.sh @@ -3,4 +3,4 @@ function die { echo $1: status $2 ; exit $2; } echo "TESTING OnlineBeamMonitor ..." -cmsRun ${LOCAL_TEST_DIR}/Online_BeamMonitor_file.py maxEvents=10 || die "Failure running Online_BeamMonitor_file.py" $? +cmsRun ${SCRAM_TEST_PATH}/Online_BeamMonitor_file.py maxEvents=10 || die "Failure running Online_BeamMonitor_file.py" $? diff --git a/DQM/CSCMonitorModule/plugins/CSCDQM_Cache.cc b/DQM/CSCMonitorModule/plugins/CSCDQM_Cache.cc index 33e70fd53214b..a06d424fe7693 100644 --- a/DQM/CSCMonitorModule/plugins/CSCDQM_Cache.cc +++ b/DQM/CSCMonitorModule/plugins/CSCDQM_Cache.cc @@ -162,71 +162,71 @@ namespace cscdqm { data[id] = mo; } else - /** FED MO */ - if (typeid(histo) == FEDHistoDefT) { - HwId fedId = histo.getFEDId(); + /** FED MO */ + if (typeid(histo) == FEDHistoDefT) { + HwId fedId = histo.getFEDId(); - if (fedPointerValue != fedId) { - fedPointer = fedData.find(fedId); - } + if (fedPointerValue != fedId) { + fedPointer = fedData.find(fedId); + } - if (fedPointer == fedData.end()) { - MonitorObject** mos = new MonitorObject*[h::namesSize]; - for (unsigned int i = 0; i < h::namesSize; i++) - mos[i] = nullptr; - fedPointer = fedData.insert(fedData.end(), std::make_pair(fedId, mos)); - } + if (fedPointer == fedData.end()) { + MonitorObject** mos = new MonitorObject*[h::namesSize]; + for (unsigned int i = 0; i < h::namesSize; i++) + mos[i] = nullptr; + fedPointer = fedData.insert(fedData.end(), std::make_pair(fedId, mos)); + } - fedPointer->second[id] = mo; - fedPointerValue = fedId; + fedPointer->second[id] = mo; + fedPointerValue = fedId; - } else + } else /** DDU MO */ if (typeid(histo) == DDUHistoDefT) { - HwId dduId = histo.getDDUId(); + HwId dduId = histo.getDDUId(); - if (dduPointerValue != dduId) { - dduPointer = dduData.find(dduId); - } + if (dduPointerValue != dduId) { + dduPointer = dduData.find(dduId); + } - if (dduPointer == dduData.end()) { - MonitorObject** mos = new MonitorObject*[h::namesSize]; - for (unsigned int i = 0; i < h::namesSize; i++) - mos[i] = nullptr; - dduPointer = dduData.insert(dduData.end(), std::make_pair(dduId, mos)); - } + if (dduPointer == dduData.end()) { + MonitorObject** mos = new MonitorObject*[h::namesSize]; + for (unsigned int i = 0; i < h::namesSize; i++) + mos[i] = nullptr; + dduPointer = dduData.insert(dduData.end(), std::make_pair(dduId, mos)); + } - dduPointer->second[id] = mo; - dduPointerValue = dduId; + dduPointer->second[id] = mo; + dduPointerValue = dduId; - } else + } else - /** CSC MO */ - if (typeid(histo) == CSCHistoDefT) { - HwId crateId = histo.getCrateId(); - HwId dmbId = histo.getDMBId(); - HwId addId = histo.getAddId(); + /** CSC MO */ + if (typeid(histo) == CSCHistoDefT) { + HwId crateId = histo.getCrateId(); + HwId dmbId = histo.getDMBId(); + HwId addId = histo.getAddId(); - CSCHistoKeyType histoKey(id, addId, mo); + CSCHistoKeyType histoKey(id, addId, mo); - if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) { - cscPointer = cscData.find(boost::make_tuple(crateId, dmbId)); - } + if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) { + cscPointer = cscData.find(boost::make_tuple(crateId, dmbId)); + } - if (cscPointer == cscData.end()) { - CSCKeyType cscKey(crateId, dmbId); - cscPointer = cscData.insert(cscData.end(), cscKey); - } - CSCHistoMapType* mos = const_cast(&cscPointer->mos); - mos->insert(histoKey); + if (cscPointer == cscData.end()) { + CSCKeyType cscKey(crateId, dmbId); + cscPointer = cscData.insert(cscData.end(), cscKey); + } + CSCHistoMapType* mos = const_cast(&cscPointer->mos); + mos->insert(histoKey); - } else + } else - /** Parameter MO */ - if (typeid(histo) == ParHistoDefT) { - data[id] = mo; - } + /** Parameter MO */ + if (typeid(histo) == ParHistoDefT) { + data[id] = mo; + } /** Add histo (if mo is not null!) into lookup list */ if (mo) { diff --git a/DQM/CSCMonitorModule/plugins/CSCDQM_Collection.cc b/DQM/CSCMonitorModule/plugins/CSCDQM_Collection.cc index f0a4dc965d306..d65a795c66917 100644 --- a/DQM/CSCMonitorModule/plugins/CSCDQM_Collection.cc +++ b/DQM/CSCMonitorModule/plugins/CSCDQM_Collection.cc @@ -81,43 +81,43 @@ namespace cscdqm { } else - /// - /// Load histogram - /// - if (nodeName == XML_BOOK_HISTOGRAM) { - CoHistoProps hp; - - DOMElement* el = dynamic_cast(node); - if (el->hasAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))) { - std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF)))); - - CoHistoProps d = definitions[id]; - for (CoHistoProps::iterator it = d.begin(); it != d.end(); it++) { - hp[it->first] = it->second; + /// + /// Load histogram + /// + if (nodeName == XML_BOOK_HISTOGRAM) { + CoHistoProps hp; + + DOMElement* el = dynamic_cast(node); + if (el->hasAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF))) { + std::string id(XMLString::transcode(el->getAttribute(XMLString::transcode(XML_BOOK_DEFINITION_REF)))); + + CoHistoProps d = definitions[id]; + for (CoHistoProps::iterator it = d.begin(); it != d.end(); it++) { + hp[it->first] = it->second; + } } - } - getNodeProperties(node, hp); + getNodeProperties(node, hp); - std::string name = hp[XML_BOOK_HISTO_NAME]; - std::string prefix = hp[XML_BOOK_HISTO_PREFIX]; + std::string name = hp[XML_BOOK_HISTO_NAME]; + std::string prefix = hp[XML_BOOK_HISTO_PREFIX]; - // Check if this histogram is an ON DEMAND histogram? - hp[XML_BOOK_ONDEMAND] = - (Utility::regexMatch(REGEXP_ONDEMAND, name) ? XML_BOOK_ONDEMAND_TRUE : XML_BOOK_ONDEMAND_FALSE); + // Check if this histogram is an ON DEMAND histogram? + hp[XML_BOOK_ONDEMAND] = + (Utility::regexMatch(REGEXP_ONDEMAND, name) ? XML_BOOK_ONDEMAND_TRUE : XML_BOOK_ONDEMAND_FALSE); - LOG_DEBUG << "[Collection::load] loading " << prefix << "::" << name - << " XML_BOOK_ONDEMAND = " << hp[XML_BOOK_ONDEMAND]; + LOG_DEBUG << "[Collection::load] loading " << prefix << "::" << name + << " XML_BOOK_ONDEMAND = " << hp[XML_BOOK_ONDEMAND]; - CoHistoMap::iterator it = collection.find(prefix); - if (it == collection.end()) { - CoHisto h; - h[name] = hp; - collection[prefix] = h; - } else { - it->second.insert(make_pair(name, hp)); + CoHistoMap::iterator it = collection.find(prefix); + if (it == collection.end()) { + CoHisto h; + h[name] = hp; + collection[prefix] = h; + } else { + it->second.insert(make_pair(name, hp)); + } } - } } } diff --git a/DQM/CSCMonitorModule/plugins/CSCDQM_Configuration.h b/DQM/CSCMonitorModule/plugins/CSCDQM_Configuration.h index 032af1c2d92b9..ff1da1c1f8b56 100644 --- a/DQM/CSCMonitorModule/plugins/CSCDQM_Configuration.h +++ b/DQM/CSCMonitorModule/plugins/CSCDQM_Configuration.h @@ -66,63 +66,57 @@ * Sequence of Global Parameters. Add new line or edit existing in form: * (( type (C++), name (upper case), default value, "description" )) \ */ -#define CONFIG_PARAMETERS_SEQ \ - \ - ((bool, PROCESS_DDU, true, "enter DDU (and latter Chamber) sections (EventProcessor flag)"))( \ - (bool, PROCESS_CSC, true, "enter Chamber section (EventProcessor flag)"))( \ - (bool, PROCESS_EFF_HISTOS, true, "calculate efficiency histograms (Dispatcher flag)"))(( \ - bool, PROCESS_EFF_PARAMETERS, true, "calculate efficiency parameters (EventProcessor flag)"))(( \ - bool, BINCHECKER_CRC_ALCT, false, "check ALCT CRC (CSCDCCExaminer flag)"))(( \ - bool, BINCHECKER_CRC_CLCT, false, "check CLCT CRC (CSCDCCExaminer flag)"))(( \ - bool, BINCHECKER_CRC_CFEB, false, "check CFEB CRC (CSCDCCExaminer flag)"))(( \ - bool, BINCHECKER_MODE_DDU, true, "set DDU mode (CSCDCCExaminer flag)"))(( \ - bool, BINCHECKER_OUTPUT, false, "print 1 and 2 output (CSCDCCExaminer flag)"))(( \ - bool, \ - FRAEFF_AUTO_UPDATE, \ - false, \ - "start fractional and efficiency histogram update automatically (Dispatcher flag)"))(( \ - bool, \ - FRAEFF_SEPARATE_THREAD, \ - false, \ - "start fractional and efficiency histogram update on separate thread (EventProcessor flag)"))(( \ - bool, PRINT_STATS_ON_EXIT, true, "print statistics on exit (destruction)"))(( \ - bool, IN_FULL_STANDBY, true, "full detector is in standby mode from the beginning of the run"))(( \ - std::string, BOOKING_XML_FILE, "", "histogram description (booking) file in XML format (Collection)"))(( \ - std::string, FOLDER_EMU, "", "root file folder name to be used for EMU histograms (EventProcessor)"))(( \ - std::string, FOLDER_DDU, "", "root file folder name to be used for DDU histograms (EventProcessor)"))(( \ - std::string, FOLDER_CSC, "", "root file folder name to be used for CSC histograms (EventProcessor)"))(( \ - std::string, FOLDER_PAR, "", "root file folder name to be used for parameters (EventProcessor)"))(( \ - unsigned int, \ - DDU_CHECK_MASK, \ - 0xFFFFFFFF, \ - "mask for cumulative EmuFileReader DDU error flags (EventProcessor)"))(( \ - unsigned int, DDU_BINCHECK_MASK, 0x02080016, "mask for DDU level examiner errors (CSCDCCExaminer)"))(( \ - unsigned int, BINCHECK_MASK, 0xFFFFFFFF, "mask for chamber level examiner errors (CSCDCCExaminer)"))(( \ - unsigned int, \ - FRAEFF_AUTO_UPDATE_START, \ - 5, \ - "event number to start automatic fractional and efficiency histogram updates from (Dispatcer)"))(( \ - unsigned int, \ - FRAEFF_AUTO_UPDATE_FREQ, \ - 1, \ - "frequency in events to perform automatic fractional and efficiency histogram updates (Dispatcher)"))(( \ - double, \ - EFF_COLD_THRESHOLD, \ - 0.1, \ - "threshold in fraction to check for cold (not reporting) HW (EventProcessor)"))(( \ - double, EFF_COLD_SIGFAIL, 5.0, "statistical significance for cold (not reporting) HW (EventProcessor)"))(( \ - double, EFF_HOT_THRESHOLD, 0.1, "threshold in fraction to check for hot HW (EventProcessor)"))(( \ - double, EFF_HOT_SIGFAIL, 5.0, "statistical significance for hot HW (EventProcessor)"))(( \ - double, EFF_ERR_THRESHOLD, 0.1, "threshold in fraction to check for errors in HW (EventProcessor)"))(( \ - double, EFF_ERR_SIGFAIL, 5.0, "statistical significance for errors in HW (EventProcessor)"))(( \ - double, \ - EFF_NODATA_THRESHOLD, \ - 0.1, \ - "threshold in fraction to check for not reporting elements in HW (EventProcessor)"))(( \ - double, EFF_NODATA_SIGFAIL, 5.0, "statistical significance for not reportingelements in HW (EventProcessor)"))(( \ - unsigned int, EVENTS_ECHO, 1000, "frequency in events to print echo message (EventProcessor)"))(( \ - std::string, FOLDER_FED, "", "root file folder name to be used for FED histograms (EventProcessor)"))(( \ - bool, PREBOOK_ALL_HISTOS, true, "pre-book all FED, DDU, CSC histogragrams before run begins")) +#define CONFIG_PARAMETERS_SEQ \ + \ + ((bool, PROCESS_DDU, true, "enter DDU (and latter Chamber) sections (EventProcessor flag)"))( \ + (bool, PROCESS_CSC, true, "enter Chamber section (EventProcessor flag)"))( \ + (bool, PROCESS_EFF_HISTOS, true, "calculate efficiency histograms (Dispatcher flag)"))( \ + (bool, PROCESS_EFF_PARAMETERS, true, "calculate efficiency parameters (EventProcessor flag)"))( \ + (bool, BINCHECKER_CRC_ALCT, false, "check ALCT CRC (CSCDCCExaminer flag)"))( \ + (bool, BINCHECKER_CRC_CLCT, false, "check CLCT CRC (CSCDCCExaminer flag)"))( \ + (bool, BINCHECKER_CRC_CFEB, false, "check CFEB CRC (CSCDCCExaminer flag)"))( \ + (bool, BINCHECKER_MODE_DDU, true, "set DDU mode (CSCDCCExaminer flag)"))( \ + (bool, BINCHECKER_OUTPUT, false, "print 1 and 2 output (CSCDCCExaminer flag)"))( \ + (bool, \ + FRAEFF_AUTO_UPDATE, \ + false, \ + "start fractional and efficiency histogram update automatically (Dispatcher flag)"))( \ + (bool, \ + FRAEFF_SEPARATE_THREAD, \ + false, \ + "start fractional and efficiency histogram update on separate thread (EventProcessor flag)"))( \ + (bool, PRINT_STATS_ON_EXIT, true, "print statistics on exit (destruction)"))( \ + (bool, IN_FULL_STANDBY, true, "full detector is in standby mode from the beginning of the run"))( \ + (std::string, BOOKING_XML_FILE, "", "histogram description (booking) file in XML format (Collection)"))( \ + (std::string, FOLDER_EMU, "", "root file folder name to be used for EMU histograms (EventProcessor)"))( \ + (std::string, FOLDER_DDU, "", "root file folder name to be used for DDU histograms (EventProcessor)"))( \ + (std::string, FOLDER_CSC, "", "root file folder name to be used for CSC histograms (EventProcessor)"))( \ + (std::string, FOLDER_PAR, "", "root file folder name to be used for parameters (EventProcessor)"))(( \ + unsigned int, DDU_CHECK_MASK, 0xFFFFFFFF, "mask for cumulative EmuFileReader DDU error flags (EventProcessor)"))( \ + (unsigned int, DDU_BINCHECK_MASK, 0x02080016, "mask for DDU level examiner errors (CSCDCCExaminer)"))( \ + (unsigned int, BINCHECK_MASK, 0xFFFFFFFF, "mask for chamber level examiner errors (CSCDCCExaminer)"))( \ + (unsigned int, \ + FRAEFF_AUTO_UPDATE_START, \ + 5, \ + "event number to start automatic fractional and efficiency histogram updates from (Dispatcer)"))( \ + (unsigned int, \ + FRAEFF_AUTO_UPDATE_FREQ, \ + 1, \ + "frequency in events to perform automatic fractional and efficiency histogram updates (Dispatcher)"))(( \ + double, EFF_COLD_THRESHOLD, 0.1, "threshold in fraction to check for cold (not reporting) HW (EventProcessor)"))( \ + (double, EFF_COLD_SIGFAIL, 5.0, "statistical significance for cold (not reporting) HW (EventProcessor)"))( \ + (double, EFF_HOT_THRESHOLD, 0.1, "threshold in fraction to check for hot HW (EventProcessor)"))( \ + (double, EFF_HOT_SIGFAIL, 5.0, "statistical significance for hot HW (EventProcessor)"))( \ + (double, EFF_ERR_THRESHOLD, 0.1, "threshold in fraction to check for errors in HW (EventProcessor)"))( \ + (double, EFF_ERR_SIGFAIL, 5.0, "statistical significance for errors in HW (EventProcessor)"))( \ + (double, \ + EFF_NODATA_THRESHOLD, \ + 0.1, \ + "threshold in fraction to check for not reporting elements in HW (EventProcessor)"))( \ + (double, EFF_NODATA_SIGFAIL, 5.0, "statistical significance for not reportingelements in HW (EventProcessor)"))( \ + (unsigned int, EVENTS_ECHO, 1000, "frequency in events to print echo message (EventProcessor)"))( \ + (std::string, FOLDER_FED, "", "root file folder name to be used for FED histograms (EventProcessor)"))( \ + (bool, PREBOOK_ALL_HISTOS, true, "pre-book all FED, DDU, CSC histogragrams before run begins")) /** * Global Parameter Manipulation macros. diff --git a/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc b/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc index 7920ec8c8495c..e5f62aef6d4b8 100644 --- a/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSCommonDQMSource.cc @@ -6,7 +6,6 @@ * ****************************************************************************/ -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -45,7 +44,7 @@ class CTPPSCommonDQMSource : public DQMOneEDAnalyzer ctppsRecordToken; const edm::EDGetTokenT> tokenLocalTrackLite; @@ -143,17 +142,19 @@ void CTPPSCommonDQMSource::GlobalPlots::Init(DQMStore::IBooker &ibooker) { ya->SetBinLabel(5, "45, 220, FR-BT"); ya->SetBinLabel(6, "45, 220, FR-HR"); ya->SetBinLabel(7, "45, 220, FR-TP"); - ya->SetBinLabel(8, "45, 220, NR-BP"); - ya->SetBinLabel(9, "45, 220, NR-TP"); - ya->SetBinLabel(10, "56, 210, FR-BT"); - ya->SetBinLabel(11, "56, 210, FR-HR"); - ya->SetBinLabel(12, "56, 210, FR-TP"); - ya->SetBinLabel(13, "56, 220, C1"); - ya->SetBinLabel(14, "56, 220, FR-BT"); - ya->SetBinLabel(15, "56, 220, FR-HR"); - ya->SetBinLabel(16, "56, 220, FR-TP"); - ya->SetBinLabel(17, "56, 220, NR-BP"); - ya->SetBinLabel(18, "56, 220, NR-TP"); + ya->SetBinLabel(8, "45, 220, NR-BT"); + ya->SetBinLabel(9, "45, 220, NR-HR"); + ya->SetBinLabel(10, "45, 220, NR-TP"); + ya->SetBinLabel(11, "56, 210, FR-BT"); + ya->SetBinLabel(12, "56, 210, FR-HR"); + ya->SetBinLabel(13, "56, 210, FR-TP"); + ya->SetBinLabel(14, "56, 220, C1"); + ya->SetBinLabel(15, "56, 220, FR-BT"); + ya->SetBinLabel(16, "56, 220, FR-HR"); + ya->SetBinLabel(17, "56, 220, FR-TP"); + ya->SetBinLabel(18, "56, 220, NR-BT"); + ya->SetBinLabel(19, "56, 220, NR-HR"); + ya->SetBinLabel(20, "56, 220, NR-TP"); } h_trackCorr_hor = ibooker.book2D("track correlation hor", "ctpps_common_rp_hor", 8, -0.5, 7.5, 8, -0.5, 7.5); diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index 0e6aacbf3d438..e7a4e6d5bba6c 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -9,7 +9,6 @@ * ****************************************************************************/ -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index 910082fc8b875..99ca49e4acf39 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -7,7 +7,6 @@ * *******************************************/ -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -28,6 +27,9 @@ #include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" #include "DataFormats/Common/interface/TriggerResults.h" +#include "CondFormats/DataRecord/interface/CTPPSPixelDAQMappingRcd.h" +#include "CondFormats/PPSObjects/interface/CTPPSPixelDAQMapping.h" + #include //----------------------------------------------------------------------------- @@ -50,7 +52,9 @@ class CTPPSPixelDQMSource : public DQMEDAnalyzer { edm::EDGetTokenT> tokenCluster; edm::EDGetTokenT> tokenTrack; edm::EDGetTokenT tokenTrigResults; + edm::ESGetToken tokenPixelDAQMapping; std::string randomHLTPath; + std::string mappingLabel; static constexpr int NArms = 2; static constexpr int NStationMAX = 3; // in an arm @@ -219,6 +223,8 @@ CTPPSPixelDQMSource::CTPPSPixelDQMSource(const edm::ParameterSet &ps) tokenCluster = consumes>(ps.getUntrackedParameter("tagRPixCluster")); tokenTrack = consumes>(ps.getUntrackedParameter("tagRPixLTrack")); tokenTrigResults = consumes(ps.getUntrackedParameter("tagTrigResults")); + tokenPixelDAQMapping = esConsumes(); + mappingLabel = ps.getUntrackedParameter("mappingLabel"); offlinePlots = ps.getUntrackedParameter("offlinePlots", true); onlinePlots = ps.getUntrackedParameter("onlinePlots", true); @@ -525,7 +531,7 @@ void CTPPSPixelDQMSource::bookHistograms(DQMStore::IBooker &ibooker, edm::Run co 0., double(NplaneMAX * NROCsMAX), 0., - rpixValues::ROCSizeInX *rpixValues::ROCSizeInY, + rpixValues::ROCSizeInX * rpixValues::ROCSizeInY, ""); hp2HitsMultROC_LS[indexP]->getTProfile2D()->SetOption("colz"); hp2HitsMultROC_LS[indexP]->getTProfile2D()->SetMinimum(1.0e-10); @@ -690,6 +696,8 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const Handle hltResults; event.getByToken(tokenTrigResults, hltResults); + const CTPPSPixelDAQMapping *mapping = &eventSetup.getData(tokenPixelDAQMapping); + if (onlinePlots) { hBX->Fill(event.bunchCrossing()); hBXshort->Fill(event.bunchCrossing()); @@ -850,13 +858,13 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const } // if(pixDigi.isValid()) { if (pixError.isValid()) { + std::map rocMapping = mapping->ROCMapping; for (const auto &ds_error : *pixError) { int idet = getDet(ds_error.id); if (idet != DetId::VeryForward) { if (idet == 15) { //dummy det id: store in a plot with fed info for (DetSet::const_iterator dit = ds_error.begin(); dit != ds_error.end(); ++dit) { - h2ErrorCodeUnidDet->Fill(dit->errorType(), dit->fedId()); // recover fed channel number int chanNmbr = -1; if (dit->errorType() == 32 || dit->errorType() == 33 || dit->errorType() == 34) { @@ -866,6 +874,30 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const uint32_t errorWord = dit->errorWord32(); chanNmbr = (errorWord >> LINK_shift) & LINK_mask; } + + // recover detector Id from chanNmbr and fedId + CTPPSPixelFramePosition fPos(dit->fedId(), 0, chanNmbr, 0); // frame position for ROC 0 + std::map::const_iterator mit; + int index = -1; + int plane = -1; + bool goodRecovery = false; + mit = rocMapping.find(fPos); + if (mit != rocMapping.end()) { + CTPPSPixelROCInfo rocInfo = (*mit).second; + CTPPSPixelDetId recoveredDetId(rocInfo.iD); + plane = recoveredDetId.plane(); + index = getRPindex(recoveredDetId.arm(), recoveredDetId.station(), recoveredDetId.rp()); + if (RPindexValid[index] && !isPlanePlotsTurnedOff[recoveredDetId.arm()][recoveredDetId.station()] + [recoveredDetId.rp()][recoveredDetId.plane()]) + goodRecovery = true; + } // if (mit != rocMapping.end()) + + if (goodRecovery) { + h2ErrorCodeRP[index]->Fill(dit->errorType(), plane); + } else { + h2ErrorCodeUnidDet->Fill(dit->errorType(), dit->fedId()); + } + bool fillFED = false; int iFed = dit->fedId() - minFedNumber; if (iFed >= 0 && iFed < numberOfFeds) @@ -921,42 +953,74 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const int t6 = (errorWord >> DB6_shift) & DataBit_mask; int t7 = (errorWord >> DB7_shift) & DataBit_mask; if (t0 == 1) { - h2TBMMessageUnidDet->Fill(0, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(0, plane); + } else { + h2TBMMessageUnidDet->Fill(0, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(0, chanNmbr); } if (t1 == 1) { - h2TBMMessageUnidDet->Fill(1, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(1, plane); + } else { + h2TBMMessageUnidDet->Fill(1, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(1, chanNmbr); } if (t2 == 1) { - h2TBMMessageUnidDet->Fill(2, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(2, plane); + } else { + h2TBMMessageUnidDet->Fill(2, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(2, chanNmbr); } if (t3 == 1) { - h2TBMMessageUnidDet->Fill(3, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(3, plane); + } else { + h2TBMMessageUnidDet->Fill(3, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(3, chanNmbr); } if (t4 == 1) { - h2TBMMessageUnidDet->Fill(4, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(4, plane); + } else { + h2TBMMessageUnidDet->Fill(4, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(4, chanNmbr); } if (t5 == 1) { - h2TBMMessageUnidDet->Fill(5, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(5, plane); + } else { + h2TBMMessageUnidDet->Fill(5, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(5, chanNmbr); } if (t6 == 1) { - h2TBMMessageUnidDet->Fill(6, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(6, plane); + } else { + h2TBMMessageUnidDet->Fill(6, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(6, chanNmbr); } if (t7 == 1) { - h2TBMMessageUnidDet->Fill(7, dit->fedId()); + if (goodRecovery) { + h2TBMMessageRP[index]->Fill(7, plane); + } else { + h2TBMMessageUnidDet->Fill(7, dit->fedId()); + } if (fillFED) h2TBMMessageFED[iFed]->Fill(7, chanNmbr); } @@ -965,27 +1029,47 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits); uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask; if (stateMach == 0) { - h2TBMTypeUnidDet->Fill(0, dit->fedId()); + if (goodRecovery) { + h2TBMTypeRP[index]->Fill(0, plane); + } else { + h2TBMTypeUnidDet->Fill(0, dit->fedId()); + } if (fillFED) h2TBMTypeFED[iFed]->Fill(0, chanNmbr); } else { if (((stateMach >> DB0_shift) & DataBit_mask) == 1) { - h2TBMTypeUnidDet->Fill(1, dit->fedId()); + if (goodRecovery) { + h2TBMTypeRP[index]->Fill(1, plane); + } else { + h2TBMTypeUnidDet->Fill(1, dit->fedId()); + } if (fillFED) h2TBMTypeFED[iFed]->Fill(1, chanNmbr); } if (((stateMach >> DB1_shift) & DataBit_mask) == 1) { - h2TBMTypeUnidDet->Fill(2, dit->fedId()); + if (goodRecovery) { + h2TBMTypeRP[index]->Fill(2, plane); + } else { + h2TBMTypeUnidDet->Fill(2, dit->fedId()); + } if (fillFED) h2TBMTypeFED[iFed]->Fill(2, chanNmbr); } if (((stateMach >> DB2_shift) & DataBit_mask) == 1) { - h2TBMTypeUnidDet->Fill(3, dit->fedId()); + if (goodRecovery) { + h2TBMTypeRP[index]->Fill(3, plane); + } else { + h2TBMTypeUnidDet->Fill(3, dit->fedId()); + } if (fillFED) h2TBMTypeFED[iFed]->Fill(3, chanNmbr); } if (((stateMach >> DB3_shift) & DataBit_mask) == 1) { - h2TBMTypeUnidDet->Fill(4, dit->fedId()); + if (goodRecovery) { + h2TBMTypeRP[index]->Fill(4, plane); + } else { + h2TBMTypeUnidDet->Fill(4, dit->fedId()); + } if (fillFED) h2TBMTypeFED[iFed]->Fill(4, chanNmbr); } @@ -995,7 +1079,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const &event, edm::EventSetup const h2ErrorCodeFED[iFed]->Fill(dit->errorType(), chanNmbr); } continue; - } + } // if idet == 15 if (verbosity > 1) LogPrint("CTPPSPixelDQMSource") << "not CTPPS: ds_error.id" << ds_error.id; continue; diff --git a/DQM/CTPPS/plugins/CTPPSRandomDQMSource.cc b/DQM/CTPPS/plugins/CTPPSRandomDQMSource.cc new file mode 100644 index 0000000000000..9c3734d8e8e96 --- /dev/null +++ b/DQM/CTPPS/plugins/CTPPSRandomDQMSource.cc @@ -0,0 +1,201 @@ +/****************************************** + * + * This is a part of CTPPSDQM software. + * Authors: + * A. Bellora (Universita' e INFN Torino) + * + *******************************************/ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + +#include "DataFormats/Common/interface/DetSetVector.h" + +#include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" +#include "DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h" + +#include + +//----------------------------------------------------------------------------- + +class CTPPSRandomDQMSource : public DQMEDAnalyzer { +public: + CTPPSRandomDQMSource(const edm::ParameterSet &ps); + ~CTPPSRandomDQMSource() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + +protected: + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override; + +private: + edm::EDGetTokenT> const tokenDigi_; + + static constexpr int kNArms_ = 2; + static constexpr int kNStationMAX_ = 3; // in an arm + static constexpr int kNRPotsMAX_ = 6; // per station + static constexpr int kNplaneMAX_ = 6; // per RPot + static constexpr int kFirstRPn_ = 3, kLastRPn_ = 4; + static constexpr int kStationIDMAX_ = 4; // possible range of ID + static constexpr int kRPotsIDMAX_ = 8; // possible range of ID + + const std::string folderName_ = "PPSRANDOM/RandomPixel"; + + unsigned int rpStatusWord_ = 0x8008; // 220_fr_hr(stn2rp3)+ 210_fr_hr + int rpStatus_[kStationIDMAX_][kRPotsIDMAX_]; // symmetric in both arms + int stationStatus_[kStationIDMAX_]; // symmetric in both arms + const int kIndexNotValid = 0; + + MonitorElement *hBX_; + + static constexpr int kRPotsTotalNumber_ = kNArms_ * kNStationMAX_ * kNRPotsMAX_; + + int RPindexValid_[kRPotsTotalNumber_]; + MonitorElement *h2HitsVsBXRandoms_[kRPotsTotalNumber_]; + + int getRPindex(int arm, int station, int rp) const { + if (arm < 0 || station < 0 || rp < 0) + return (kIndexNotValid); + if (arm > 1 || station >= kNStationMAX_ || rp >= kNRPotsMAX_) + return (kIndexNotValid); + int rc = (arm * kNStationMAX_ + station) * kNRPotsMAX_ + rp; + return (rc); + } +}; + +//------------------------------------------------------------------------------- + +CTPPSRandomDQMSource::CTPPSRandomDQMSource(const edm::ParameterSet &ps) + : tokenDigi_(consumes>(ps.getParameter("tagRPixDigi"))), + folderName_(ps.getUntrackedParameter("folderName", "PPSRANDOM/RandomPixel")), + rpStatusWord_(ps.getUntrackedParameter("RPStatusWord", 0x8008)) { + for (int stn = 0; stn < kStationIDMAX_; stn++) { + stationStatus_[stn] = 0; + for (int rp = 0; rp < kRPotsIDMAX_; rp++) + rpStatus_[stn][rp] = 0; + } + + unsigned int rpSts = rpStatusWord_ << 1; + for (int stn = 0; stn < kNStationMAX_; stn++) { + int stns = 0; + for (int rp = 0; rp < kNRPotsMAX_; rp++) { + rpSts = (rpSts >> 1); + rpStatus_[stn][rp] = rpSts & 1; + if (rpStatus_[stn][rp] > 0) + stns = 1; + } + stationStatus_[stn] = stns; + } + + for (int index = 0; index < 2 * 3 * kNRPotsMAX_; index++) + RPindexValid_[index] = 0; +} + +//-------------------------------------------------------------------------- + +void CTPPSRandomDQMSource::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) { + ibooker.cd(); + ibooker.setCurrentFolder(folderName_); + + hBX_ = ibooker.book1D("events per BX", "ctpps_pixel;Event.BX", 4002, -1.5, 4000. + 0.5); + + for (int arm = 0; arm < kNArms_; arm++) { + CTPPSDetId ID(CTPPSDetId::sdTrackingPixel, arm, 0); + std::string sd; + ID.armName(sd, CTPPSDetId::nShort); + sd = folderName_ + "/sector " + sd; + + ibooker.setCurrentFolder(sd); + + for (int stn = 0; stn < kNStationMAX_; stn++) { + if (stationStatus_[stn] == 0) + continue; + ID.setStation(stn); + std::string stnd; + CTPPSDetId(ID.stationId()).stationName(stnd, CTPPSDetId::nShort); + stnd = sd + "/station " + stnd; + + ibooker.setCurrentFolder(stnd); + + for (int rp = kFirstRPn_; rp < kLastRPn_; rp++) { // only installed pixel pots + ID.setRP(rp); + std::string rpd, rpTitle; + CTPPSDetId(ID.rpId()).rpName(rpTitle, CTPPSDetId::nFull); + CTPPSDetId(ID.rpId()).rpName(rpd, CTPPSDetId::nShort); + rpd = stnd + "/" + rpd; + + ibooker.setCurrentFolder(rpd); + + int indexP = getRPindex(arm, stn, rp); + RPindexValid_[indexP] = 1; + + h2HitsVsBXRandoms_[indexP] = ibooker.book2D("Digi per plane per BX - random triggers", + rpTitle + ";Event.BX;Plane", + 4002, + -1.5, + 4000. + 0.5, + kNplaneMAX_, + 0, + kNplaneMAX_); + h2HitsVsBXRandoms_[indexP]->getTH2F()->SetOption("colz"); + + } // end for(int rp=0; rpFill(event.bunchCrossing()); + + for (int arm = 0; arm < 2; arm++) { + for (int stn = 0; stn < kNStationMAX_; stn++) { + if (!stationStatus_[stn]) + continue; + for (int rp = 0; rp < kNRPotsMAX_; rp++) { + if (!rpStatus_[stn][rp]) + continue; + int index = getRPindex(arm, stn, rp); + if (RPindexValid_[index] == 0) + continue; + + for (int p = 0; p < kNplaneMAX_; p++) { + CTPPSPixelDetId planeId(arm, stn, rp, p); + auto pix_d = pixDigi->find(planeId.rawId()); + if (pix_d != pixDigi->end()) { + int n_digis = pix_d->size(); + h2HitsVsBXRandoms_[index]->Fill(event.bunchCrossing(), p, n_digis); + } + } + } // end for (int rp=0; rp("tagRPixDigi", edm::InputTag("ctppsPixelDigisAlCaRecoProducer", "")); + desc.addUntracked("folderName", "PPSRANDOM/RandomPixel"); + desc.addUntracked("RPStatusWord", 0x8008); + descriptions.add("ctppsRandomDQMSource", desc); +} + +//--------------------------------------------------------------------------- +DEFINE_FWK_MODULE(CTPPSRandomDQMSource); diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index b44cb02db3d11..e1a7cce5f6063 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -17,6 +17,8 @@ from DQM.CTPPS.ctppsCommonDQMSource_cfi import * +from DQM.CTPPS.ctppsRandomDQMSource_cfi import * + # sequences used by the online DQM in normal running ctppsCommonDQMSourceOnline = ctppsCommonDQMSource.clone( makeProtonRecoPlots = False @@ -51,6 +53,14 @@ makeProtonRecoPlots = True ) +# sequences used by the dedicated random trigger stream +_ctppsDQMRandomSource = cms.Sequence( + ctppsRandomDQMSource +) + +_ctppsDQMRandomHarvest = cms.Sequence( +) + #Check if perLSsaving is enabled to mask MEs vs LS from Configuration.ProcessModifiers.dqmPerLSsaving_cff import dqmPerLSsaving dqmPerLSsaving.toModify(ctppsDiamondDQMSource, perLSsaving=True) @@ -81,6 +91,12 @@ ) +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +ctpps_2016.toReplaceWith( + _ctppsDQMOfflineSource, + cms.Sequence( + ) +) # the actually used sequences must be empty for pre-PPS data from Configuration.Eras.Modifier_ctpps_cff import ctpps @@ -99,3 +115,8 @@ ctppsDQMOfflineHarvest = cms.Sequence() ctpps.toReplaceWith(ctppsDQMOfflineSource, _ctppsDQMOfflineSource) ctpps.toReplaceWith(ctppsDQMOfflineHarvest, _ctppsDQMOfflineHarvest) + +ctppsDQMRandomSource = cms.Sequence() +ctppsDQMRandomHarvest = cms.Sequence() +ctpps.toReplaceWith(ctppsDQMRandomSource, _ctppsDQMRandomSource) +ctpps.toReplaceWith(ctppsDQMRandomHarvest, _ctppsDQMRandomHarvest) diff --git a/DQM/CTPPS/python/ctppsPixelDQMSource_cfi.py b/DQM/CTPPS/python/ctppsPixelDQMSource_cfi.py index 79e69e18a14cf..e58d019f6c99e 100644 --- a/DQM/CTPPS/python/ctppsPixelDQMSource_cfi.py +++ b/DQM/CTPPS/python/ctppsPixelDQMSource_cfi.py @@ -8,13 +8,14 @@ tagRPixCluster = cms.untracked.InputTag("ctppsPixelClusters", ""), tagRPixLTrack = cms.untracked.InputTag("ctppsPixelLocalTracks", ""), tagTrigResults = cms.untracked.InputTag("TriggerResults","","HLT"), + mappingLabel = cms.untracked.string("RPix"), RPStatusWord = cms.untracked.uint32(0x8008), # rpots in readout:220_fr_hr; 210_fr_hr verbosity = cms.untracked.uint32(0), randomHLTPath = cms.untracked.string("HLT_Random_v3"), offlinePlots = cms.untracked.bool(False), onlinePlots = cms.untracked.bool(True), turnOffPlanePlots = cms.untracked.vstring(), # add tags for planes to be shut off, - # e.g. "0_2_3_4" for arm 0 station 2 rp 3 plane 4 + # e.g. "0_2_3_4" for arm 0 station 2 rp 3 plane 4 ) ctppsPixelDQMOfflineSource = DQMEDAnalyzer('CTPPSPixelDQMSource', @@ -23,11 +24,12 @@ tagRPixCluster = cms.untracked.InputTag("ctppsPixelClusters", ""), tagRPixLTrack = cms.untracked.InputTag("ctppsPixelLocalTracks", ""), tagTrigResults = cms.untracked.InputTag("TriggerResults","","HLT"), + mappingLabel = cms.untracked.string("RPix"), RPStatusWord = cms.untracked.uint32(0x8008), # rpots in readout: 220_fr_hr; 210_fr_hr verbosity = cms.untracked.uint32(0), randomHLTPath = cms.untracked.string("HLT_Random_v3"), offlinePlots = cms.untracked.bool(True), onlinePlots = cms.untracked.bool(False), turnOffPlanePlots = cms.untracked.vstring(), # add tags for planes to be shut off, - # e.g. "0_2_3_4" for arm 0 station 2 rp 3 plane 4 + # e.g. "0_2_3_4" for arm 0 station 2 rp 3 plane 4 ) diff --git a/DQM/CTPPS/python/totemRPDQMSource_cfi.py b/DQM/CTPPS/python/totemRPDQMSource_cfi.py index 6c8f352606209..72370f93e7fcc 100644 --- a/DQM/CTPPS/python/totemRPDQMSource_cfi.py +++ b/DQM/CTPPS/python/totemRPDQMSource_cfi.py @@ -2,7 +2,7 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer totemRPDQMSource = DQMEDAnalyzer('TotemRPDQMSource', - tagStatus = cms.InputTag("totemRPRawToDigi", "TrackingStrip"), + tagStatus = cms.untracked.InputTag("totemRPRawToDigi", "TrackingStrip"), tagDigi = cms.untracked.InputTag("totemRPRawToDigi", "TrackingStrip"), tagCluster = cms.untracked.InputTag("totemRPClusterProducer"), tagRecHit = cms.untracked.InputTag("totemRPRecHitProducer"), diff --git a/DQM/CTPPS/test/pps_random_dqm_test_from_alcaraw_cfg.py b/DQM/CTPPS/test/pps_random_dqm_test_from_alcaraw_cfg.py new file mode 100644 index 0000000000000..7cb77ad19b70b --- /dev/null +++ b/DQM/CTPPS/test/pps_random_dqm_test_from_alcaraw_cfg.py @@ -0,0 +1,62 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process('ctppsRandomDQMfromRAW', ctpps) + +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# load DQM framework +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = "CTPPS" +process.dqmEnv.eventInfoFolder = "EventInfo" +process.dqmSaver.path = "" +process.dqmSaver.tag = "CTPPS" + +# raw data source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + '/store/group/dpg_ctpps/comm_ctpps/PixelRandomTrigger2023/outputExpressPPSRandom.root' + ), + + inputCommands = cms.untracked.vstring( + 'drop *', + 'keep FEDRawDataCollection_*_*_*' + ) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +# global tag - conditions for P5 cluster +process.load("DQM.Integration.config.FrontierCondition_GT_cfi") + +# raw-to-digi conversion +from EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff import ctppsPixelDigis as _ctppsPixelDigis +process.ctppsPixelDigisAlCaRecoProducer = _ctppsPixelDigis.clone(inputLabel = 'hltPPSCalibrationRaw') + +# CTPPS DQM modules +process.load("DQM.CTPPS.ctppsDQM_cff") + +process.path = cms.Path( + process.ctppsPixelDigisAlCaRecoProducer * + process.ctppsDQMRandomSource * + process.ctppsDQMRandomHarvest +) + +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/DQM/CastorMonitor/interface/CastorMonitorModule.h b/DQM/CastorMonitor/interface/CastorMonitorModule.h index 649f72612fa40..21b10b7f1d2af 100644 --- a/DQM/CastorMonitor/interface/CastorMonitorModule.h +++ b/DQM/CastorMonitor/interface/CastorMonitorModule.h @@ -14,7 +14,6 @@ #include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" #include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h" #include "DataFormats/L1Trigger/interface/BXVector.h" -#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h" #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -98,8 +97,6 @@ class CastorMonitorModule : public DQMOneEDAnalyzer<> { edm::ESGetToken castorDbServiceToken_; - // std::shared_ptr gtUtil_; - std::unique_ptr RecHitMon_; std::unique_ptr DigiMon_; std::unique_ptr LedMon_; diff --git a/DQM/EcalMonitorClient/interface/MLClient.h b/DQM/EcalMonitorClient/interface/MLClient.h index d8d8a2af92ba8..777e1de6bbf29 100644 --- a/DQM/EcalMonitorClient/interface/MLClient.h +++ b/DQM/EcalMonitorClient/interface/MLClient.h @@ -18,22 +18,48 @@ namespace ecaldqm { private: void setParams(edm::ParameterSet const&) override; - //Each Ecal Barrel occupancy map is plotted at the tower level - //34 towers in the eta and 72 towers in the phi directions - static const int nEtaTowers = 34; - static const int nPhiTowers = 72; - //After padding with two rows above and below to prevent the edge effect, 36 towers in eta direction - static const int nEtaTowersPad = 36; - float MLThreshold_; - float PUcorr_slope_; - float PUcorr_intercept_; - size_t nLS = 3; //No.of lumisections to add the occupancy over + //Occcupancy map is plotted at the tower level + //For the EB: 34 towers in the eta and 72 towers in the phi directions + static const int nEBEtaTowers = 34; + static const int nEBPhiTowers = 72; + //For the EE: 20 towers in the eta and 20 towers in the phi directions + static const int nEEEtaTowers = 20; + static const int nEEPhiTowers = 20; + //After padding with two rows above and below to prevent the edge effect + //For EB: 36 towers in eta direction + //For EE: padding on all four sides, 22 towers in both eta and phi directions. + static const int nEBEtaTowersPad = 36; + static const int nEETowersPad = 22; + float EBThreshold_; + float EEpThreshold_; + float EEmThreshold_; + float EB_PUcorr_slope_; + float EEp_PUcorr_slope_; + float EEm_PUcorr_slope_; + float EB_PUcorr_intercept_; + float EEp_PUcorr_intercept_; + float EEm_PUcorr_intercept_; + + size_t nLS = 4; //No.of lumisections to add the occupancy over size_t nLSloss = 6; //No.of lumisections to multiply the loss over + int nbadtowerEB; //count the no.of bad towers flagged by the ML model. + int nbadtowerEE; + int LScount = 0; //count no.of lumisections over which the MLquality is made. + + std::deque NEventQ; //To keep the no.of events in each occupancy plot - std::deque NEventQ; //To keep the no.of events in each occupancy plot - std::deque> ebOccMap1dQ; //To keep the input occupancy plots to be summed - std::vector avgOcc_; //To keep the average occupancy to do response correction - std::deque>> lossMap2dQ; //To keep the ML losses to be multiplied + //To keep the input occupancy plots to be summed + std::deque> ebOccMap1dQ; + std::deque> eepOccMap1dQ; + std::deque> eemOccMap1dQ; + //To keep the average occupancy to do response correction + std::vector EBavgOcc; + std::vector EEpavgOcc; + std::vector EEmavgOcc; + //To keep the ML losses to be multiplied + std::deque>> EBlossMap2dQ; + std::deque>> EEplossMap2dQ; + std::deque>> EEmlossMap2dQ; }; } // namespace ecaldqm diff --git a/DQM/EcalMonitorClient/python/MLClient_cfi.py b/DQM/EcalMonitorClient/python/MLClient_cfi.py index b5aca211b590a..61c4df38bc52c 100644 --- a/DQM/EcalMonitorClient/python/MLClient_cfi.py +++ b/DQM/EcalMonitorClient/python/MLClient_cfi.py @@ -2,395 +2,40 @@ from DQM.EcalMonitorTasks.OccupancyTask_cfi import ecalOccupancyTask -#parameters dervied from training -MLThreshold = 0.1761 -PUcorr_slope = 8625.62354249 -PUcorr_intercept= 354776.97564344 -#Avg Occupancy of 2018 data -avgOcc = (1.4228867,1.4111477,1.4235557,1.403253 ,1.2926203,1.3110067,1.4317631, - 1.3582464,1.3350165,1.3870461,1.4315553,1.4340966,1.3463646,1.4664359, - 1.4383692,1.4883132,1.4921986,1.4414848,1.4935918,1.5053873,1.4814812, - 1.4806937,1.4688585,1.3852754,1.2133822,1.217942 ,1.2934631,1.2623638, - 1.4084297,1.2852081,1.3383209,1.3197039,1.2672714,1.2089411,1.2792134, - 1.2820784,1.2973225,1.2019042,0.0000001,1.2586329,1.424472 ,1.4129552, - 1.5303715,1.5035893,1.3739808,1.4674091,1.3101934,1.3559604,1.3654169, - 1.3723816,1.351616 ,1.3782867,1.6634412,1.6218939,1.5776167,1.5967489, - 1.4352198,1.4457697,1.5257363,1.5936497,1.2177914,1.1892394,1.2968882, - 1.2645309,1.333104 ,1.246442 ,1.2484925,1.2413881,1.3511598,1.3742812, - 1.3659753,1.3767184,1.4228867,1.4111477,1.4235557,1.403253 ,1.2926203, - 1.3110067,1.4317631,1.3582464,1.3350165,1.3870461,1.4315553,1.4340966, - 1.3463646,1.4664359,1.4383692,1.4883132,1.4921986,1.4414848,1.4935918, - 1.5053873,1.4814812,1.4806937,1.4688585,1.3852754,1.2133822,1.217942 , - 1.2934631,1.2623638,1.4084297,1.2852081,1.3383209,1.3197039,1.2672714, - 1.2089411,1.2792134,1.2820784,1.2973225,1.2019042,0.0000001,1.2586329, - 1.424472 ,1.4129552,1.5303715,1.5035893,1.3739808,1.4674091,1.3101934, - 1.3559604,1.3654169,1.3723816,1.351616 ,1.3782867,1.6634412,1.6218939, - 1.5776167,1.5967489,1.4352198,1.4457697,1.5257363,1.5936497,1.2177914, - 1.1892394,1.2968882,1.2645309,1.333104 ,1.246442 ,1.2484925,1.2413881, - 1.3511598,1.3742812,1.3659753,1.3767184,1.1556679,1.3391551,1.373256 , - 1.3540887,1.2471408,1.2453951,1.2790504,1.3212276,1.3020328,1.3587664, - 1.3487176,1.3814243,1.3593339,1.3286781,1.2952926,1.3192601,1.4060221, - 1.4540101,1.4574795,1.3729581,1.4051903,1.3568325,1.3918067,1.4169109, - 1.3129637,1.2971104,1.2642334,1.289142 ,1.3558336,1.2786664,1.296219 , - 1.298685 ,1.2628139,1.2494673,1.294434 ,1.2733648,1.2478417,1.1872551, - 1.2146964,2.0395069,1.5262315,1.4894062,1.4284101,1.4169872,1.352527 , - 1.3618537,1.3673831,1.334716 ,1.3480678,1.4098777,1.4061071,1.3918567, - 1.5523838,1.5230404,1.4913341,1.4753877,1.4160846,1.4024036,1.4175566, - 1.4888357,1.2680489,1.2883663,1.3472272,1.3023057,1.3586241,1.3383816, - 1.2996044,1.3184984,1.3418843,1.3903407,1.4139845,1.4251099,1.305113 , - 1.2633995,1.2851918,1.2743814,1.1825788,1.2547469,1.2440559,1.2770063, - 1.2717891,1.3396428,1.3710004,1.3859975,1.2798804,1.2516749,1.2677492, - 1.2683048,1.2613889,1.2783653,1.2966883,1.2827859,1.3206561,1.3148078, - 1.2636309,1.3001962,1.2161207,1.1910689,1.1688411,1.1911243,1.2880307, - 1.2225945,1.2570652,1.2086593,1.2767646,1.2320539,1.1953772,1.2159386, - 1.2037021,1.1857734,1.1674342,1.1956853,1.3138844,1.2758864,1.2300162, - 0.6665614,1.3036094,1.3088627,1.2554388,1.2967263,1.2841691,1.2875917, - 1.3089112,1.3331639,1.266067 ,1.2455457,1.2334898,1.2674097,1.276027 , - 1.1690655,1.1995609,1.199487 ,1.1338224,1.1563799,1.2194781,1.2064027, - 1.2493043,1.2673064,1.2891188,1.2735461,1.2408122,1.2415621,1.254231 , - 1.2100532,1.226575 ,1.2035872,1.2445701,1.1773577,1.1374254,1.1708428, - 1.1746327,1.1776469,1.2238355,1.2399627,1.2557915,1.2581828,1.1821021, - 1.1796409,1.2347831,1.248196 ,1.2299678,1.2151593,1.2597338,1.2399808, - 1.1583205,1.1536306,1.2159789,1.3336231,1.1655421,1.1663706,1.5020412, - 1.1574144,1.1892532,1.1677798,1.1635669,1.1543789,1.3043314,1.1876005, - 0.9521286,1.2199527,1.0653542,1.0589734,1.117103 ,1.0546287,1.2312565, - 1.1999464,1.1566527,1.1649921,1.246702 ,1.2841538,1.2533325,1.180725 , - 1.2153618,1.2312846,1.3220999,1.1518214,1.1985146,1.1956019,1.2026757, - 1.220378 ,1.2158185,1.1656332,1.1459147,1.1440367,0.0000001,1.106721 , - 1.2046571,1.1799783,1.1971282,1.2399644,1.2104925,1.1782469,1.2648659, - 1.2725782,1.2706518,1.2750179,1.1781482,1.1746165,1.1428392,1.1554896, - 1.08052 ,1.1252075,1.0796442,1.0661097,1.1994307,1.1427931,1.1547704, - 1.1450479,1.1638263,1.1558805,1.1312499,1.1190377,1.1767929,1.1355052, - 1.1739364,1.1897258,1.1543195,1.2075775,1.1802915,1.1443394,1.0686296, - 1.0484798,1.1059129,1.1041118,1.0907497,1.0863662,1.0989137,1.1160423, - 1.1354574,1.0911841,1.0848287,1.0849218,1.0303825,1.0509577,1.1060627, - 1.0906715,1.163807 ,1.1446611,1.1357274,1.1637452,1.1761752,1.1996605, - 1.1433704,1.1708797,1.0934016,1.1287714,1.1213528,0.9135892,1.1128932, - 1.1062543,1.0822164,1.1020374,1.1105623,1.0700424,1.0619079,1.1016523, - 1.0585421,1.0115267,1.031876 ,1.0759147,1.1201001,1.1058998,1.0973803, - 1.1015209,1.1435407,1.14981 ,1.1311004,1.1691828,1.1759555,1.1401734, - 1.1672325,1.1874546,1.0948305,1.0863739,1.1059391,1.0986216,1.1788837, - 1.1270268,1.1239996,1.1002039,1.1389588,1.141233 ,1.083227 ,1.0877259, - 1.1431438,1.1221772,1.1199503,1.1654431,1.1736141,1.1989235,1.1978018, - 1.167959 ,1.0133513,1.0567273,1.0395187,1.0680603,1.0610994,1.0597148, - 1.0684566,1.0339921,1.1405144,1.1203558,1.0788041,1.0960815,1.0242732, - 0.9811422,1.0137647,1.0043021,1.1159075,1.1183313,1.1035389,1.1150508, - 1.117763 ,1.1088306,1.0894555,1.1437987,1.1288823,1.1197007,1.1289188, - 1.1122833,1.1094319,1.0663022,1.0441525,1.0901659,1.1118773,1.1093612, - 1.0880778,1.0673048,1.0135869,0.9895969,1.0111624,0.994159 ,1.157239 , - 1.1461102,1.0853236,1.0694305,1.2243338,1.1992161,1.1530303,1.2302727, - 1.1132525,1.0987779,1.1112196,1.0841962,1.1152277,1.0965806,1.1059502, - 1.0867471,1.1308132,1.1056805,1.0888016,1.073627 ,1.1095271,1.0971298, - 1.0672264,1.0892332,1.1054503,1.0687332,1.0934203,1.1355063,1.24187 , - 1.2197568,1.2120614,1.1968735,1.0238991,0.9819736,0.9891209,1.0145121, - 1.0608021,1.0184129,1.0311555,1.0517814,1.1033106,1.0689223,1.0606674, - 1.0605292,1.0284557,0.971954 ,0.9526132,1.04703 ,1.128279 ,1.0795844, - 1.0738314,1.107188 ,1.1450828,1.1231935,1.0905402,1.1256251,1.1096694, - 1.0497596,1.0524868,1.0812023,1.0472693,1.0021344,1.0382787,1.0649058, - 1.0950122,1.0948782,1.0399659,1.0673079,1.0342895,1.0013512,0.9988917, - 1.0112954,1.0890151,1.042002 ,1.041176 ,1.0243192,1.1275606,1.1135633, - 1.1377431,1.1745214,1.1230987,1.0614204,1.0361215,1.1119354,1.0850902, - 1.0927483,1.1078453,1.077041 ,1.0753678,1.0642383,1.067675 ,1.1028837, - 1.0942855,1.0852079,1.0798481,1.088132 ,1.1058763,1.0810122,1.0625142, - 1.1011781,1.1856151,1.196195 ,1.1612228,1.1422418,0.9793076,0.9765419, - 0.9804395,1.0156407,1.0480926,1.0464298,1.0522102,1.0688092,1.1212629, - 1.0395747,0.9926344,1.0080917,1.0007402,0.9855192,0.9907292,0.9954209, - 1.1032989,1.0986856,1.1330308,1.1098777,1.1356755,1.1181957,1.113232 , - 1.1295322,1.1084793,1.0193369,1.0491607,1.0724577,1.0785445,1.0371226, - 0.0036721,1.0269073,1.0965271,1.0695037,1.0664477,1.087617 ,0.9891936, - 0.9989811,1.0070362,1.0190035,1.0781424,1.0664753,1.0687553,1.0421116, - 1.1388807,1.1237614,1.1355482,1.1830119,1.0553507,1.044697 ,1.0408233, - 1.0398819,1.0669746,1.0332361,1.0301825,0.9893497,1.059479 ,1.0278772, - 1.0176086,1.0205175,1.0467259,1.0548677,1.0646734,1.0527669,1.0866866, - 1.0472943,1.0426059,1.0849829,1.0999873,1.1246853,1.1031482,1.0814158, - 0.9405594,0.9336581,0.9254869,0.9352036,1.0345708,0.9965525,0.9950148, - 1.0257301,1.1129664,0.9780049,0.9502401,0.9700456,1.0284607,1.0213796, - 0.9910805,1.0367672,1.0796332,1.0587161,1.0674927,1.0761822,1.0794786, - 1.0831254,1.0830816,1.1075894,0.0126334,0.92802 ,0.9371951,0.9496164, - 1.0454251,1.0489166,1.0143294,1.0061715,1.0771358,1.0521995,1.0829998, - 1.0526272,0.9770707,0.9811446,0.9211687,0.947929 ,1.0504178,0.0000001, - 1.0035456,1.0284821,1.1091976,1.0872326,1.0880209,1.133727 ,1.014713 , - 0.9581099,0.9811009,1.0093567,1.0370228,0.989569 ,0.9988301,0.9841469, - 0.9527792,0.9855899,0.9826103,0.9610231,1.0160042,0.9992726,1.0005047, - 0.9965398,1.0511478,0.9744592,1.0089016,1.0331134,1.0977989,1.0927752, - 1.0878357,1.0548981,0.9570927,0.9533063,0.9489567,0.9408886,0.9869403, - 0.9708263,0.9788091,0.9671838,0.9488644,0.9382011,0.9179539,0.9175838, - 0.9908231,0.933664 ,0.9034764,0.929096 ,1.0545647,0.9846775,1.0010679, - 0.9964607,1.0280262,1.0288763,0.9798051,0.9853348,0.9509227,0.9410004, - 0.8996611,0.9309286,1.0092912,0.9800311,0.9862539,0.9823382,0.9956134, - 0.9848503,0.9927089,0.9988752,0.9427151,0.9123654,0.9192433,0.9211756, - 0.9682457,0.9614248,0.940841 ,2.9108264,1.0182347,1.0328737,1.0335125, - 1.0162688,0.9742591,0.9400508,0.9223933,0.9612672,0.9902653,0.9835137, - 0.9622135,0.9489338,0.9200854,0.9142317,0.9246915,0.9710323,0.9510582, - 0.986548 ,0.9715658,0.9551507,0.9795502,0.9373934,0.9590609,0.9864878, - 1.0536214,1.0606204,1.0470799,1.0450804,0.9423648,0.9130962,1.2390996, - 0.9090152,0.9728571,0.9594254,0.9378965,0.9442697,0.9128348,0.9111411, - 0.8573027,0.9057387,0.8775638,0.8585867,0.871328 ,0.8851443,1.0256898, - 0.9997756,1.0087074,0.9802992,1.0048345,0.986007 ,0.9939928,0.9924014, - 0.9393591,0.8975831,0.9569556,0.9221528,1.0005504,0.9573966,0.9446875, - 0.9525049,0.9864134,0.9616978,0.9709904,0.9688258,0.9331638,0.8939223, - 0.9041911,0.9179978,0.9570236,0.9535987,0.9462896,0.9406717,1.0385262, - 1.0471946,1.0040003,1.0764723,0.9440772,0.9303069,0.9388188,0.9624437, - 0.9522971,0.9236505,0.921064 ,0.9153899,0.9239462,0.9149684,0.9110753, - 0.9250061,0.9977021,0.9575272,0.9395442,0.9242274,0.8905004,1.215517 , - 0.9538251,0.9689807,1.0420041,1.0098691,1.0688168,0.9420413,0.9071479, - 0.9233371,0.8648853,0.9046464,0.944227 ,0.9231179,0.9260064,0.9462502, - 0.8824298,0.0000001,0.8896712,0.9343744,0.9496966,0.9062078,0.9076006, - 0.8920029,0.9911788,0.9509735,0.9620247,0.9532838,0.9553664,0.966219 , - 0.9766419,0.9830272,0.9704874,0.9066846,0.9014828,0.9114758,0.9525748, - 0.9449465,0.9234739,0.9165454,0.9440705,0.9461663,0.936758 ,0.9713703, - 0.9236538,0.9208513,0.891026 ,0.8855084,0.9444764,0.9177411,0.9162141, - 0.9445439,1.0220059,1.0118829,1.0278999,1.0203037,0.9124752,0.8955967, - 0.9001777,0.8839747,0.8924397,0.884959 ,0.9014532,0.8925565,0.7268787, - 0.8359309,0.8754961,0.8911034,0.9268813,0.9161255,0.9086187,0.853088 , - 0.9073059,0.8781778,0.9306351,0.9155804,0.9369089,0.9953336,0.9929911, - 0.9851077,0.8977557,0.8955045,0.8884436,0.8941315,0.921898 ,0.8701018, - 0.9078636,0.8981934,0.8977088,0.8691131,0.8413706,0.8976212,0.876539 , - 1.4657505,0.8280094,0.8627123,0.9547047,0.9364532,0.9272763,0.9186774, - 0.941437 ,0.9263571,0.9280555,0.9123494,0.9105576,0.9997209,0.9331673, - 0.9702676,0.911276 ,0.8823292,0.9235324,0.915177 ,0.9073598,0.8663465, - 0.8806252,0.8953832,0.8542768,0.8170022,0.8364354,0.8324253,0.9117646, - 0.8914846,0.882292 ,0.8745112,0.9651436,0.9339125,0.908168 ,0.8983836, - 1.0204283,1.014069 ,0.8514856,0.8366709,0.0000001,0.8435681,0.8716656, - 0.8663046,0.8687047,0.8607368,0.853239 ,0.8538001,0.9117879,0.8984275, - 0.9074128,0.8910619,0.9175624,0.9058829,0.9104028,0.9016951,0.9979504, - 1.0018495,0.9727136,0.9829723,0.8593063,0.8864803,0.8331164,0.8243229, - 0.8761157,0.84732 ,0.8649628,0.8924447,0.8528641,0.8461951,0.8256967, - 0.8219401,0.8493258,0.8396199,0.8288802,0.8688241,0.9221398,0.9144458, - 0.9145495,0.8767081,0.9111733,0.9246608,0.9190454,0.9145585,0.8979622, - 0.9213055,0.9043622,0.9187738,0.8733439,0.9010628,0.8879052,0.8862385, - 0.886833 ,0.8412263,0.8744929,0.8971784,0.7947825,0.7808067,0.720468 , - 0.7835823,0.8811975,0.8858461,0.8736796,0.8753381,0.9216196,0.9133907, - 0.877441 ,0.9787805,0.8858882,1.0329753,0.8817087,0.0000001,0.8540137, - 0.8454756,0.8776406,0.8772608,0.878461 ,0.817844 ,0.8320211,0.7978509, - 0.9232702,0.9232559,0.9103069,0.9115226,0.9466796,0.9346468,0.9280509, - 0.9378798,0.9828502,0.9918494,0.9742755,0.9657697,0.8602819,0.8742782, - 0.8663973,0.8632851,0.9069272,0.8904232,0.892713 ,0.9054623,0.8925498, - 0.868188 ,0.8912911,0.8767484,0.8553541,0.8425062,0.8211766,0.8539204, - 0.9321883,0.9126161,0.9168343,0.8570537,0.8895695,0.8795208,0.9255748, - 0.9180104,0.9300255,0.9378335,0.9242839,0.9336899,0.920904 ,2.8812766, - 0.9271864,0.8993225,0.8857986,0.8936499,0.8895433,0.8900022,0.8410531, - 0.8081046,0.8150144,0.8173641,0.8881866,0.8837494,0.8417418,0.8877832, - 0.9664047,0.9465755,0.8891603,1.0593798,1.0501429,1.0378563,0.9041524, - 0.9222154,0.9227488,0.8894223,1.1206282,0.8359311,1.1750071,0.8632696, - 0.0000001,0.8440654,0.9061905,0.9033526,0.9075296,0.9265232,0.9251202, - 0.9390653,0.9226105,0.935118 ,1.0248573,0.9950228,1.016836 ,1.0150337, - 0.8846998,0.8870716,0.8825005,0.8993919,0.9015642,0.917635 ,0.9108042, - 0.9158255,0.8933692,0.8818774,0.8733479,0.8590702,0.8610741,0.8412985, - 0.8419823,0.8535126,0.9552853,0.9233503,0.9074404,0.8874421,0.0000001, - 0.9037543,0.9428068,0.9528409,0.8795176,0.8777585,0.9160822,0.9397873, - 0.9309441,0.9063056,0.9192985,0.9255057,0.9270568,0.9176704,0.9140722, - 0.9111696,0.8597785,0.8489559,0.843753 ,0.8581451,0.9068368,0.8959244, - 0.9229929,0.871972 ,0.9834073,0.9476991,0.9360896,1.081524 ,0.9255442, - 0.9070221,0.9115756,0.9298295,0.9134066,0.9056591,0.9027434,0.8674105, - 0.9019305,0.8612094,0.8585056,0.854815 ,0.0000001,0.9021256,0.9177787, - 0.9240243,0.9644239,0.9404687,0.9274049,0.9379409,1.0399606,1.033352 , - 1.0249641,1.0473272,0.8932669,0.9111941,0.8852406,0.8920174,0.9242499, - 0.9056967,0.9006191,0.9015262,0.9182317,0.9183906,0.9038095,0.904799 , - 0.8838023,0.8785893,0.8584824,0.8979258,0.9706077,0.9469935,0.9398977, - 0.894461 ,0.93994 ,0.923337 ,0.9488781,0.9627277,0.9054735,0.9163985, - 0.8944787,0.9150251,1.0493075,0.9096289,0.9115776,0.9412426,0.9343278, - 0.9121064,0.9117633,0.9251044,0.8971121,0.8652557,0.8633423,0.8604623, - 0.9248523,0.9076622,0.917069 ,0.8871456,0.7269943,0.9629616,0.9667225, - 0.9250519,0.9176884,0.8880241,0.9236936,0.9247792,1.0054232,1.0092628, - 0.9994277,0.9991693,0.9058928,0.91171 ,0.9149265,0.915843 ,0.8517995, - 1.2385432,0.8757702,0.8800565,0.9347579,0.9362207,0.9103072,0.9455385, - 0.8727469,0.8400666,0.8438162,0.8415763,0.9646621,0.9707538,0.9637925, - 0.9641757,0.9592127,0.952417 ,0.943792 ,0.925786 ,0.9483845,0.9503665, - 0.9362003,0.9343288,0.9373538,0.9214206,0.9170751,0.9483343,0.9092611, - 0.9025595,0.9094557,0.8846688,0.9492338,0.9302807,0.9313844,0.9440831, - 0.9525137,0.9451442,0.9452839,0.9544351,1.036723 ,1.0263921,0.9881323, - 0.9197441,0.9673854,0.9597923,0.9846507,0.9979741,0.9559562,0.9387934, - 0.9402372,0.9639017,0.9070854,0.9081604,0.8969148,0.8985816,0.8914095, - 0.9212565,0.9167472,0.9287409,0.902436 ,0.8889644,0.8948577,0.9066438, - 0.9909534,0.9763708,0.9878008,0.9885211,0.8955337,0.8991327,0.8798093, - 0.8914046,0.8749264,0.8727064,0.8536081,0.8715125,0.8831692,0.8919016, - 0.890573 ,0.8926457,0.8800267,0.8306233,0.0000001,0.8467921,0.9303848, - 0.9340462,0.9263893,0.9474682,0.9142375,0.9178317,0.8966044,0.8933908, - 1.0630243,0.9105239,0.8925556,0.908989 ,0.9122123,0.894343 ,0.9251699, - 0.9552048,0.900656 ,0.8886392,0.9272086,0.8625895,0.9300183,0.934134 , - 0.9291555,0.9527701,0.9416874,0.9565993,0.9468805,0.9310883,0.9963626, - 0.981036 ,0.9834724,0.8948759,0.8951459,0.9467054,1.045526 ,0.9973741, - 0.9467732,0.9394466,0.9388553,0.9175566,0.8865193,0.8930401,0.8786154, - 0.8805791,0.9849347,0.8849503,0.9020472,0.9081354,0.8883678,0.8618975, - 0.8621318,0.8847593,0.9791163,0.9981784,0.9598348,0.9630426,0.8954888, - 0.9089435,0.906523 ,0.9254694,0.8724284,1.549498 ,0.854642 ,0.8899876, - 0.884106 ,0.8911538,0.8788657,0.8989016,0.8683069,0.8187966,0.8331737, - 0.8169547,0.9497713,0.9372764,0.9718387,0.9716983,0.8817951,0.9177381, - 0.9272385,0.9305192,0.9138 ,0.8917226,0.9022007,0.8728969,0.8857559, - 0.8511966,0.8776945,0.9188874,0.8799872,0.8727769,0.8972793,0.8775748, - 0.9025099,0.9059016,0.9018834,0.9358472,0.9280242,0.9306515,0.930319 , - 0.9408762,0.9894212,0.9801961,0.9481966,0.930518 ,0.9068527,0.926452 , - 0.9481174,0.9932294,0.9508854,0.9168876,0.8955552,0.9298086,0.8856096, - 0.8778232,0.8678781,0.8428098,0.8649303,0.8521905,0.8853881,0.896262 , - 0.8637611,0.8508386,0.8579808,0.8781487,0.9782724,0.9819542,0.967945 , - 0.9718521,0.8657284,0.8617702,0.8596571,0.8718904,0.815865 ,0.9508535, - 0.8448715,0.8618798,0.9203976,0.8956626,0.9108895,0.9208714,0.8267219, - 0.8333327,0.8175609,0.8405349,0.9207596,0.9302374,0.922721 ,0.9375702, - 0.8972806,0.9022034,0.9092163,0.8919818,0.9115573,0.8941678,0.9727003, - 0.8788491,0.8066372,0.8540529,0.8720537,0.9097501,0.881356 ,0.8739368, - 0.9094095,0.8718069,0.9059213,0.9068483,0.8904512,0.903352 ,0.9266117, - 0.9053527,0.8990905,0.9183056,0.9928399,0.9813229,0.9759782,0.9492933, - 0.9382915,0.9312818,0.9518742,0.9820717,0.9150143,0.8835462,0.905087 , - 0.9380701,0.8669695,0.8730215,0.8537797,0.842343 ,0.8181646,0.8662508, - 0.8914459,0.8917838,0.8953646,0.8582759,0.8843335,0.9019104,0.9775726, - 0.9695851,0.9684169,0.9945092,0.8906423,0.9011754,0.8905966,0.9067472, - 0.8615755,0.8759038,0.8511059,0.8939573,0.9214789,0.8934948,0.9003874, - 0.9254834,0.8977927,0.8781966,0.8783478,0.8897681,0.9544448,0.9752168, - 0.9538611,0.9523727,0.8953019,0.8955504,0.8835472,0.9036127,0.9425184, - 0.9428679,0.9121487,0.8942021,0.8973826,0.8607216,0.8798548,0.9563062, - 0.9242093,0.8927971,0.9064167,0.8659616,0.9165348,0.9324718,0.9197962, - 0.9270453,0.9173116,0.9100388,0.8664268,0.9012297,0.9287284,0.9629037, - 0.9950356,1.0044856,0.9998307,0.9981116,1.0173699,1.0312284,0.9523295, - 0.927979 ,0.9188983,0.9468584,0.8899338,0.8799069,0.8932109,0.8625482, - 0.8758663,0.8662992,0.8897169,0.8896759,0.9471669,0.8646078,0.9203457, - 0.9465771,1.0671935,1.0762529,1.0574509,1.0543979,0.950247 ,0.9430968, - 0.9417606,0.960602 ,0.8665491,0.8781953,0.8720518,0.8933613,0.9384555, - 0.9348907,0.9343287,0.9597977,0.9400162,0.9181851,0.9304919,0.9181332, - 0.9856796,0.989359 ,0.979789 ,0.9625634,1.0298804,0.9681855,0.926324 , - 0.9493014,0.952226 ,0.9659102,0.9622204,0.9933803,0.9975445,0.9534022, - 0.9508471,1.0023971,0.925873 ,0.9181251,0.9037386,0.9369083,0.9686341, - 0.951229 ,0.9527286,0.9704438,0.952726 ,0.9563661,0.9672213,0.9009546, - 0.891305 ,0.9141365,0.9042941,0.9908844,1.02451 ,1.0002937,1.0145459, - 1.0238333,0.9640087,0.9803975,0.9345359,0.9562771,0.9798419,0.9632123, - 0.9474075,0.9594575,0.9523167,0.9568143,0.9725029,0.9635358,0.8913772, - 0.9376766,0.9153062,0.9443082,1.0907506,1.0779955,1.0835589,1.077103 , - 0.94592 ,0.9423046,0.9353216,1.0058889,0.8812236,0.8900912,0.8739714, - 0.908954 ,0.9684916,0.9758947,0.9528789,0.9715638,0.9147444,0.9392554, - 0.9166325,0.9577266,1.0328426,1.0275623,0.9930462,1.0105317,1.0487862, - 1.0094688,0.9696991,0.9790145,0.9874703,0.9714156,1.0046459,0.9714112, - 0.9987967,0.9554723,0.9812179,1.0174359,0.9316527,0.9212265,0.9473284, - 0.9529327,0.9768106,0.9761072,0.9925398,1.0105116,0.9765943,0.9735287, - 0.9720789,0.9780715,0.8837507,0.9996244,1.0094591,0.963135 ,1.0569199, - 1.0577636,1.0485023,1.0917665,1.0001658,0.9943501,0.994733 ,0.9737829, - 0.9874289,0.9499856,0.9437758,0.9718275,0.9466712,0.9368256,0.9245117, - 0.9746943,0.9231877,0.94381 ,0.9099722,0.9743401,1.0912923,1.0798532, - 1.0705048,1.0671401,1.0020626,0.9723217,0.9538407,1.0237085,0.9082063, - 0.9232261,0.9122615,0.9056468,1.0189087,1.0061275,1.0277444,1.0416385, - 0.962988 ,0.9448321,0.9274885,0.9500597,1.0350192,1.0535637,1.0434896, - 1.0389384,1.0624195,1.0245159,1.0062119,1.0112492,0.9908073,1.0161494, - 1.0189636,1.0372617,1.0417999,0.9965699,0.98918 ,1.0221821,0.9552784, - 0.9465883,0.9436496,0.9627379,0.9957007,0.9908555,1.0349085,1.051325 , - 1.028265 ,0.9742572,0.9853188,1.0277784,1.0784379,1.0248644,1.003191 , - 1.053859 ,1.0747 ,1.0681137,1.0964813,1.1012894,1.0878161,1.0215803, - 1.0319945,1.0705597,1.0117067,1.0089118,0.9623004,0.9945062,0.9931936, - 0.9826046,0.9807656,0.9893571,0.9855912,0.9956348,1.0180117,1.0992355, - 1.1510247,1.1642762,1.1348028,1.173378 ,1.0495415,1.0537665,1.0280858, - 1.0769577,0.9539952,0.9503716,0.9480621,0.9564386,1.0447392,1.055281 , - 1.0632157,1.0446833,0.9611291,0.9580613,1.0140576,1.0192964,1.1120509, - 1.0763414,1.0876051,1.0807177,1.0965352,1.0385919,1.0403399,1.010437 , - 1.0453093,1.0263721,1.0174105,1.0635544,1.0635546,1.0340421,0.9741846, - 1.0584152,1.0422455,0.9897347,0.9849003,1.0250511,1.0373392,1.0450774, - 1.0938035,1.0942651,1.0443715,1.0503259,1.057446 ,1.0592597,1.0620625, - 1.1111387,1.1216173,1.07478 ,1.1132259,1.1209106,1.1106815,1.1423119, - 1.1024584,1.1221232,1.0857874,1.119742 ,1.0454632,1.0458753,1.0386395, - 1.0446345,1.0093486,1.031795 ,1.0488297,1.0821855,1.0077721,0.989686 , - 1.0048161,1.0512829,1.1880068,1.1788449,1.1607702,1.1446868,1.0427889, - 1.0694175,1.0607653,1.0898038,1.0094677,0.9899454,1.0312396,1.035437 , - 1.1059195,1.1086949,1.0641108,1.0961732,0.9638143,0.9419206,0.9821325, - 1.029164 ,1.1191941,1.1493175,1.1181508,1.1407369,1.1214831,1.0663868, - 1.0815727,1.1323632,1.080952 ,1.0808178,1.0681598,1.0592092,1.1199073, - 1.0957614,1.0681812,1.095979 ,1.0511014,1.0613471,1.0412358,1.0636799, - 1.1067268,1.0797632,1.0823264,1.1153238,1.1133441,1.0766457,1.0854424, - 1.0825747,1.0796758,1.077734 ,1.0952778,1.0772076,1.116454 ,1.1395183, - 1.1075819,1.1624501,1.1176701,1.0958973,1.1218029,1.1186683,1.0628506, - 1.1145004,1.082948 ,2.0175941,1.0875287,1.1025825,1.0269455,1.051285 , - 1.0476145,1.0404844,1.04963 ,1.0591438,1.1902895,1.2070227,1.070815 , - 1.1989648,1.0498666,1.0610474,1.0391423,1.1304657,1.0339167,0.9998445, - 1.0041345,1.0160474,1.0799819,1.0712526,1.0879661,1.1218227,1.009931 , - 0.9974062,1.0133066,1.0665259,1.146356 ,1.11963 ,1.1033186,1.1570126, - 1.0548068,1.0348623,1.0482756,1.0204102,1.1040101,1.0592386,0.0000001, - 1.0342314,1.103851 ,1.1129369,1.086817 ,1.1150911,1.0553069,1.1031967, - 1.0349835,1.0537988,1.057883 ,1.0326748,1.0403845,1.0982782,1.1092652, - 1.1100249,1.0888118,1.2074842,1.0731583,1.0833149,1.0942907,1.1083862, - 1.1723955,1.1690109,1.1536716,1.1711152,1.0897936,1.0986527,1.1139878, - 1.1540499,1.1051458,1.0760595,1.0817837,1.0871581,1.0496042,1.0790346, - 1.0484509,1.0936309,1.1005198,1.0929288,1.0838492,1.0982997,1.1599445, - 1.1893239,1.1655681,1.2092586,1.0883923,0.0000001,1.0871845,1.1466825, - 1.0404817,1.0230678,1.0366768,1.0639437,1.1151003,1.1272596,1.1084887, - 1.172429 ,1.0334686,1.056801 ,1.0597215,1.1326951,1.1498877,1.1962935, - 1.1868553,1.197981 ,1.1254083,1.1704431,1.1394123,1.1020141,1.1297313, - 1.0543509,1.0454857,1.0557848,1.1286277,1.1447449,1.1176616,1.1541518, - 1.0896667,1.0803887,1.0532128,1.092551 ,1.1030624,1.1308889,1.1280392, - 1.1362039,1.1384581,1.1629614,1.1217985,1.1243501,1.1104747,1.1264488, - 1.1229146,1.1263402,1.1778469,1.1807829,1.1596237,1.2130113,1.1391164, - 1.1422114,1.1164465,1.1751232,1.1258872,1.099769 ,1.0997097,1.1154337, - 1.0979413,1.1053877,1.1027399,1.1099522,1.0839096,1.0836432,1.0714954, - 1.1008861,1.2654308,1.2331656,1.2076157,1.1879531,1.0935781,1.7174256, - 1.1764588,1.1788416,1.0990402,1.0679119,1.045539 ,1.0417056,1.1428436, - 1.11865 ,1.1203463,1.1667153,1.0560808,1.059954 ,1.0763974,1.0821347, - 1.1756307,1.2023616,1.1829935,1.1883497,1.0870489,1.095404 ,1.1019858, - 1.1221294,1.0918556,1.1270142,1.1056459,1.1165003,1.1656616,1.1915104, - 0.002418 ,1.1863734,1.1364913,1.1363342,1.1130465,1.110378 ,1.1059235, - 1.1423405,1.1317402,1.1555637,1.19754 ,1.2092884,1.1779846,1.1680648, - 1.0450194,1.0761367,1.0764713,1.0921346,1.2287006,1.1786282,1.1539404, - 1.1696078,1.1572577,1.1409811,1.1399884,1.1648638,1.1468616,1.1229811, - 1.126923 ,1.1402842,1.0744516,1.1010847,1.1182138,1.129174 ,1.1766611, - 1.1814339,1.1808836,1.2256684,1.1890299,1.09418 ,1.2673656,1.2581869, - 1.1922612,1.2071455,1.1834393,1.189612 ,1.1241446,1.1361836,1.2856306, - 1.0855542,1.1677229,1.129777 ,1.1726019,1.1948112,1.177284 ,1.1930918, - 1.2184905,1.2298344,1.2539822,1.2478415,1.2095121,1.2372787,1.1454738, - 3.1246946,1.1560615,1.1634603,1.2031316,1.1657577,1.1755668,1.1764408, - 1.2373508,1.2221774,1.2183428,1.238299 ,1.1809549,1.191622 ,1.151616 , - 1.2120161,1.1659451,1.1903535,1.1537067,1.2121307,1.2561139,1.2496953, - 1.2179667,1.1991129,1.0504661,1.1208445,1.0576257,1.0786569,1.2795471, - 1.2460271,1.2595681,1.2700136,1.2370667,1.2096518,1.1916556,1.193431 , - 1.0698317,1.144996 ,1.0978631,1.1083387,1.1395663,1.1424139,1.1672275, - 1.1997005,1.2066722,1.2632322,1.2644491,1.2359862,1.30099 ,1.3310392, - 1.3187488,1.3390772,1.2772553,1.2618415,1.2443427,1.2669835,1.1606162, - 1.1572101,1.166028 ,1.1820868,1.237196 ,1.2618593,1.2292744,1.2615335, - 1.2021271,1.2560732,1.0985605,1.1192125,1.2854187,1.2854668,1.2659054, - 1.2904642,1.204288 ,1.2769686,1.22887 ,1.2694381,1.262182 ,1.2492793, - 1.2524626,1.2057602,1.285684 ,1.3115458,1.3069377,1.3391898,1.2591854, - 1.2057227,1.2264768,1.2316214,1.2125773,1.228851 ,1.2327005,1.2707509, - 1.2734746,1.3064344,1.2484472,1.2517314,1.3417968,1.3300421,1.3112333, - 1.3796477,1.2670193,1.2653888,1.3392452,1.3002052,1.2524494,1.254415 , - 1.2804451,1.2688684,1.2028832,1.1860383,1.1875746,1.1912442,0.0000001, - 1.2032371,1.2014136,1.231438 ,1.3126636,1.331844 ,1.3611454,1.4050549, - 1.4224403,1.4060786,1.3756822,1.3766484,1.3069599,1.2942712,1.2930294, - 1.3145667,1.3122438,1.2794976,1.2148988,1.3100493,1.3224905,1.3191464, - 1.3389342,1.361294 ,1.2701417,1.3292892,1.1934788,1.2651747,1.5510794, - 1.4734362,1.4419538,1.4431967,1.2666522,1.2626339,1.2941803,1.3723079, - 1.3035368,1.3176153,1.2581673,1.2753432,1.3376918,1.3208125,1.3536242, - 1.4160626,1.4042524,1.344823 ,1.2438911,1.2328366,1.3651066,1.3063282, - 1.3048015,1.4230167,1.35694 ,1.4077983,1.3601282,1.3300114,1.3991088, - 1.4520401,1.4256567,1.3559659,1.4381483,1.4401627,1.3999768,1.4125986, - 1.5223697,1.4434851,1.4603108,1.5000014,1.2174413,1.2294974,1.2586482, - 1.216323 ,1.2512149,1.2926644,1.2528789,1.2970006,1.3622391,1.3856924, - 1.4004105,1.4416406,1.4794058,1.4634441,1.4094539,1.4000301,1.3603994, - 1.3507206,1.2953093,1.3714509,1.2608073,1.2605048,1.1679753,1.2375603, - 1.301859 ,1.3278127,1.3557078,1.3832617,1.2936115,1.3297484,1.3304836, - 1.3198843,1.5357888,1.5275854,1.4613336,1.3965021,1.2506508,1.2348884, - 1.2870482,1.3202029,1.3375303,0.0000001,1.298619 ,1.3328781,1.4041303, - 1.4315721,1.3459045,1.3987832,1.4487712,1.3514799,1.3224082,1.3118832, - 0.7346643,1.4961067,1.5317262,1.5882863,1.3276595,1.3988692,1.3189229, - 1.3246715,1.4484233,1.459936 ,1.4757891,1.4265023,1.3769624,1.4194289, - 1.4359689,1.4053208,1.5716549,1.5246555,1.4746208,1.34677 ,1.2433277, - 1.2356131,1.2907763,1.2757168,1.3311623,1.3449943,1.2992672,0.0000001, - 1.3622391,1.3856924,1.4004105,1.4416406,1.4794058,1.4634441,1.4094539, - 1.4000301,1.3603994,1.3507206,1.2953093,1.3714509,1.2608073,1.2605048, - 1.1679753,1.2375603,1.301859 ,1.3278127,1.3557078,1.3832617,1.2936115, - 1.3297484,1.3304836,1.3198843,1.5357888,1.5275854,1.4613336,1.3965021, - 1.2506508,1.2348884,1.2870482,1.3202029,1.3375303,0.0000001,1.298619 , - 1.3328781,1.4041303,1.4315721,1.3459045,1.3987832,1.4487712,1.3514799, - 1.3224082,1.3118832,0.7346643,1.4961067,1.5317262,1.5882863,1.3276595, - 1.3988692,1.3189229,1.3246715,1.4484233,1.459936 ,1.4757891,1.4265023, - 1.3769624,1.4194289,1.4359689,1.4053208,1.5716549,1.5246555,1.4746208, - 1.34677 ,1.2433277,1.2356131,1.2907763,1.2757168,1.3311623,1.3449943, - 1.2992672,0.0000001) +#parameters derived from training +EBThreshold = 0.1761 +EEpThreshold = 0.0003009 +EEmThreshold = 0.0004360 + +EB_PUcorr_slope = 9087.286563128135 +EB_PUcorr_intercept = 391987.0277612837 + +EEp_PUcorr_slope = 2.097273231210836457e+03 +EEp_PUcorr_intercept= 4.905224959496531665e+04 + +EEm_PUcorr_slope = 2.029645065864053095e+03 +EEm_PUcorr_intercept= 4.874167219924630626e+04 ecalMLClient = cms.untracked.PSet( params = cms.untracked.PSet( - MLThreshold = cms.untracked.double(MLThreshold), - PUcorr_slope = cms.untracked.double(PUcorr_slope), - PUcorr_intercept = cms.untracked.double(PUcorr_intercept), - avgOcc = cms.untracked.vdouble(avgOcc) + EBThreshold = cms.untracked.double(EBThreshold), + EEpThreshold = cms.untracked.double(EEpThreshold), + EEmThreshold = cms.untracked.double(EEmThreshold), + EB_PUcorr_slope = cms.untracked.double(EB_PUcorr_slope), + EB_PUcorr_intercept = cms.untracked.double(EB_PUcorr_intercept), + EEp_PUcorr_slope = cms.untracked.double(EEp_PUcorr_slope), + EEp_PUcorr_intercept = cms.untracked.double(EEp_PUcorr_intercept), + EEm_PUcorr_slope = cms.untracked.double(EEm_PUcorr_slope), + EEm_PUcorr_intercept = cms.untracked.double(EEm_PUcorr_intercept) ), sources = cms.untracked.PSet( DigiAllByLumi = ecalOccupancyTask.MEs.DigiAllByLumi, AELoss = ecalOccupancyTask.MEs.AELoss, + AEReco = ecalOccupancyTask.MEs.AEReco, PU = ecalOccupancyTask.MEs.PU, - NumEvents = ecalOccupancyTask.MEs.NEvents + NumEvents = ecalOccupancyTask.MEs.NEvents, + BadTowerCount = ecalOccupancyTask.MEs.BadTowerCount, + BadTowerCountNorm = ecalOccupancyTask.MEs.BadTowerCountNorm ), MEs = cms.untracked.PSet( MLQualitySummary = cms.untracked.PSet( @@ -406,6 +51,13 @@ otype = cms.untracked.string('Ecal2P'), btype = cms.untracked.string('Trend'), description = cms.untracked.string('Trend of the number of events in an image fed into the ML model') + ), + TrendMLBadTower = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/Number of bad towers from MLDQM %(prefix)s'), + kind = cms.untracked.string('TProfile'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of bad towers flagged by the MLDQM model') ) ) ) diff --git a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py index 9b04723e7a36c..1ee16bc6dec22 100644 --- a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py +++ b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py @@ -8,7 +8,7 @@ toleranceLow = 25.0 toleranceHigh = 40.0 toleranceHighFwd = 100.0 -toleranceRMS = 3.0 +toleranceRMS = 6.0 toleranceRMSFwd = 6.0 ecalPresampleClient = cms.untracked.PSet( diff --git a/DQM/EcalMonitorClient/src/MLClient.cc b/DQM/EcalMonitorClient/src/MLClient.cc index 7154f3859e773..38bbef854478c 100644 --- a/DQM/EcalMonitorClient/src/MLClient.cc +++ b/DQM/EcalMonitorClient/src/MLClient.cc @@ -1,7 +1,5 @@ #include "DQM/EcalMonitorClient/interface/MLClient.h" -#include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h" - #include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h" #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" @@ -12,16 +10,25 @@ #include "DQM/EcalCommon/interface/MESetNonObject.h" +#include +#include + using namespace cms::Ort; namespace ecaldqm { MLClient::MLClient() : DQWorkerClient() { qualitySummaries_.insert("MLQualitySummary"); } void MLClient::setParams(edm::ParameterSet const& _params) { - MLThreshold_ = _params.getUntrackedParameter("MLThreshold"); - PUcorr_slope_ = _params.getUntrackedParameter("PUcorr_slope"); - PUcorr_intercept_ = _params.getUntrackedParameter("PUcorr_intercept"); - avgOcc_ = _params.getUntrackedParameter>("avgOcc"); + EBThreshold_ = _params.getUntrackedParameter("EBThreshold"); + EEpThreshold_ = _params.getUntrackedParameter("EEpThreshold"); + EEmThreshold_ = _params.getUntrackedParameter("EEmThreshold"); + EB_PUcorr_slope_ = _params.getUntrackedParameter("EB_PUcorr_slope"); + EB_PUcorr_intercept_ = _params.getUntrackedParameter("EB_PUcorr_intercept"); + EEp_PUcorr_slope_ = _params.getUntrackedParameter("EEp_PUcorr_slope"); + EEp_PUcorr_intercept_ = _params.getUntrackedParameter("EEp_PUcorr_intercept"); + EEm_PUcorr_slope_ = _params.getUntrackedParameter("EEm_PUcorr_slope"); + EEm_PUcorr_intercept_ = _params.getUntrackedParameter("EEm_PUcorr_intercept"); + if (!onlineMode_) { MEs_.erase(std::string("MLQualitySummary")); MEs_.erase(std::string("EventsperMLImage")); @@ -29,12 +36,17 @@ namespace ecaldqm { sources_.erase(std::string("NumEvents")); sources_.erase(std::string("DigiAllByLumi")); sources_.erase(std::string("AELoss")); + sources_.erase(std::string("BadTowerCount")); + sources_.erase(std::string("BadTowerCountNorm")); } } void MLClient::producePlots(ProcessType) { if (!onlineMode_) return; + nbadtowerEB = 0; + nbadtowerEE = 0; + using namespace std; MESet& meMLQualitySummary(MEs_.at("MLQualitySummary")); MESet& meEventsperMLImage(MEs_.at("EventsperMLImage")); @@ -45,8 +57,9 @@ namespace ecaldqm { //Get the no.of events and the PU per LS calculated in OccupancyTask int nEv = sNumEvents.getFloatValue(); double pu = sPU.getFloatValue(); + //Do not compute ML quality if PU is non existent. - if (pu < 0.) { + if (pu <= 0.) { return; } uint32_t mask(1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR | @@ -68,22 +81,48 @@ namespace ecaldqm { //This padding is then removed during inference on the model output. //Get the histogram of the input digi occupancy per lumisection. + TH2F* hEEmDigiMap((sources_.at("DigiAllByLumi")).getME(0)->getTH2F()); TH2F* hEbDigiMap((sources_.at("DigiAllByLumi")).getME(1)->getTH2F()); + TH2F* hEEpDigiMap((sources_.at("DigiAllByLumi")).getME(2)->getTH2F()); + + size_t nEBTowers = nEBEtaTowers * nEBPhiTowers; //Each EB occupancy map is of size 34x72 towers + size_t nEETowers = nEEEtaTowers * nEEPhiTowers; //Each EE occupancy map is of size 20x20 towers + + //Vectors to feed into the ML network + std::vector ebOccMap1dCumulPad; + std::vector eemOccMap1dCumulPad; + std::vector eepOccMap1dCumulPad; + + //Array to store occupancy maps + std::valarray ebOccMap1d(nEBTowers); + std::valarray eemOccMap1d(nEETowers); + std::valarray eepOccMap1d(nEETowers); - size_t nTowers = nEtaTowers * nPhiTowers; //Each occupancy map is of size 34x72 towers - std::vector ebOccMap1dCumulPad; //Vector to feed into the ML network - std::valarray ebOccMap1d(nTowers); //Array to store occupancy map of size 34x72 //Store the values from the input histogram into the array //to do preprocessing for (int i = 0; i < hEbDigiMap->GetNbinsY(); i++) { //NbinsY = 34, NbinsX = 72 for (int j = 0; j < hEbDigiMap->GetNbinsX(); j++) { int bin = hEbDigiMap->GetBin(j + 1, i + 1); - int k = (i * nPhiTowers) + j; + int k = (i * nEBPhiTowers) + j; ebOccMap1d[k] = hEbDigiMap->GetBinContent(bin); } } ebOccMap1dQ.push_back(ebOccMap1d); //Queue which stores input occupancy maps for nLS lumis - NEventQ.push_back(nEv); //Queue which stores the no.of events per LS for nLS lumis + + for (int i = 0; i < hEEpDigiMap->GetNbinsY(); i++) { //NbinsY = 20, NbinsX = 20 + for (int j = 0; j < hEEpDigiMap->GetNbinsX(); j++) { + int bin = hEEpDigiMap->GetBin(j + 1, i + 1); + int k = (i * nEEPhiTowers) + j; + eemOccMap1d[k] = hEEmDigiMap->GetBinContent(bin); + eepOccMap1d[k] = hEEpDigiMap->GetBinContent(bin); + } + } + + //Queue which stores input occupancy maps for nLS lumis + eemOccMap1dQ.push_back(eemOccMap1d); + eepOccMap1dQ.push_back(eepOccMap1d); + + NEventQ.push_back(nEv); //Queue which stores the no.of events per LS for nLS lumis if (NEventQ.size() < nLS) { return; //Should have nLS lumis to add the occupancy over. @@ -93,48 +132,139 @@ namespace ecaldqm { } if (ebOccMap1dQ.size() > nLS) { ebOccMap1dQ.pop_front(); //Same conditon for the input occupancy maps. + eemOccMap1dQ.pop_front(); + eepOccMap1dQ.pop_front(); } int TNum = 0; for (size_t i = 0; i < nLS; i++) { TNum += NEventQ[i]; //Total no.of events over nLS lumis } - if (TNum < 200) { - return; //The total no.of events should be atleast 200 over nLS for meaningful statistics + + if (TNum < 400) { + return; //The total no.of events should be atleast 400 over nLS for meaningful statistics } //Fill the ME to monitor the trend of the total no.of events in each input image to the ML model meEventsperMLImage.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), double(TNum)); - //Array to hold the sum of inputs, which make atleast 200 events. - std::valarray ebOccMap1dCumul(0., nTowers); + //Array to hold the sum of inputs, which make atleast 400 events. + std::valarray ebOccMap1dCumul(0., nEBTowers); + std::valarray eemOccMap1dCumul(0., nEETowers); + std::valarray eepOccMap1dCumul(0., nEETowers); + //Sum the input arrays of nLS. for (size_t i = 0; i < ebOccMap1dQ.size(); i++) { - ebOccMap1dCumul += ebOccMap1dQ[i]; //Sum the input arrays of N LS. + ebOccMap1dCumul += ebOccMap1dQ[i]; + eemOccMap1dCumul += eemOccMap1dQ[i]; + eepOccMap1dCumul += eepOccMap1dQ[i]; } + //Applying PU correction derived from training - ebOccMap1dCumul = ebOccMap1dCumul / (PUcorr_slope_ * pu + PUcorr_intercept_); + ebOccMap1dCumul = ebOccMap1dCumul / (EB_PUcorr_slope_ * pu + EB_PUcorr_intercept_); + eemOccMap1dCumul = eemOccMap1dCumul / (EEm_PUcorr_slope_ * pu + EEm_PUcorr_intercept_); + eepOccMap1dCumul = eepOccMap1dCumul / (EEp_PUcorr_slope_ * pu + EEp_PUcorr_intercept_); - //Scaling up to match input dimensions. 36*72 used instead of 34*72 to accommodate the additional padding - //of 2 rows to prevent the "edge effect" which is done below - ebOccMap1dCumul = ebOccMap1dCumul * (nEtaTowersPad * nPhiTowers); + //Scaling up to match input dimensions. + ebOccMap1dCumul = ebOccMap1dCumul * (nEBEtaTowers * nEBPhiTowers); + eemOccMap1dCumul = eemOccMap1dCumul * nEEEtaTowers * nEEPhiTowers; //(nEETowersPad * nEETowersPad); + eepOccMap1dCumul = eepOccMap1dCumul * nEEEtaTowers * nEEPhiTowers; //(nEETowersPad * nEETowersPad); //Correction for no.of events in each input image as originally model trained with 500 events per image ebOccMap1dCumul = ebOccMap1dCumul * (500. / TNum); + eemOccMap1dCumul = eemOccMap1dCumul * (500. / TNum); + eepOccMap1dCumul = eepOccMap1dCumul * (500. / TNum); + + std::vector> ebOccMap2dCumul(nEBEtaTowers, std::vector(nEBPhiTowers, 0.)); + //Convert 1dCumul to 2d + for (size_t i = 0; i < nEBEtaTowers; i++) { + for (size_t j = 0; j < nEBPhiTowers; j++) { + int k = (i * nEBPhiTowers) + j; + ebOccMap2dCumul[i][j] = ebOccMap1dCumul[k]; + } + } + + std::vector pad_top; + std::vector pad_bottom; + std::vector pad_left; + std::vector pad_right; + + pad_top = ebOccMap2dCumul[0]; + pad_bottom = ebOccMap2dCumul[ebOccMap2dCumul.size() - 1]; + + ebOccMap2dCumul.insert(ebOccMap2dCumul.begin(), pad_top); + ebOccMap2dCumul.push_back(pad_bottom); - //The pre-processed input is now fed into the input tensor vector which will go into the ML model - ebOccMap1dCumulPad.assign(std::begin(ebOccMap1dCumul), std::end(ebOccMap1dCumul)); + //// Endcaps /// + std::vector> eemOccMap2dCumul(nEEEtaTowers, std::vector(nEEPhiTowers, 0.)); + std::vector> eepOccMap2dCumul(nEEEtaTowers, std::vector(nEEPhiTowers, 0.)); - //Replicate and pad with the first and last row to prevent the edge effect - for (int k = 0; k < nPhiTowers; k++) { - float val = ebOccMap1dCumulPad[nPhiTowers - 1]; - ebOccMap1dCumulPad.insert(ebOccMap1dCumulPad.begin(), - val); //padding in the beginning with the first row elements + for (size_t i = 0; i < nEEEtaTowers; i++) { + for (size_t j = 0; j < nEEPhiTowers; j++) { + int k = (i * nEEPhiTowers) + j; + eemOccMap2dCumul[i][j] = eemOccMap1dCumul[k]; + eepOccMap2dCumul[i][j] = eepOccMap1dCumul[k]; + } } - int size = ebOccMap1dCumulPad.size(); - for (int k = (size - nPhiTowers); k < size; k++) { - float val = ebOccMap1dCumulPad[k]; - ebOccMap1dCumulPad.push_back(val); //padding at the end with the last row elements + // EE - // + pad_top.clear(); + pad_bottom.clear(); + pad_left.clear(); + pad_right.clear(); + + pad_top = eemOccMap2dCumul[0]; + pad_bottom = eemOccMap2dCumul[eemOccMap2dCumul.size() - 1]; + + eemOccMap2dCumul.insert(eemOccMap2dCumul.begin(), pad_top); + eemOccMap2dCumul.push_back(pad_bottom); + + for (auto& row : eemOccMap2dCumul) { + pad_left.push_back(row[0]); + pad_right.push_back(row[row.size() - 1]); + } + + std::size_t Lindex = 0; + std::size_t Rindex = 0; + + for (auto& row : eemOccMap2dCumul) { + row.insert(row.begin(), pad_left[Lindex++]); + row.insert(row.end(), pad_right[Rindex++]); + } + + // EE + // + pad_top.clear(); + pad_bottom.clear(); + + pad_top = eepOccMap2dCumul[0]; + pad_bottom = eepOccMap2dCumul[eepOccMap2dCumul.size() - 1]; + + eepOccMap2dCumul.insert(eepOccMap2dCumul.begin(), pad_top); + eepOccMap2dCumul.push_back(pad_bottom); + + for (auto& row : eepOccMap2dCumul) { + pad_left.push_back(row[0]); + pad_right.push_back(row[row.size() - 1]); + } + + Lindex = 0; + Rindex = 0; + + for (auto& row : eepOccMap2dCumul) { + row.insert(row.begin(), pad_left[Lindex++]); + row.insert(row.end(), pad_right[Rindex++]); + } + + //The pre-processed input is now fed into the 1D input tensor vector which will go into the ML model + for (auto& row : ebOccMap2dCumul) { + ebOccMap1dCumulPad.insert(ebOccMap1dCumulPad.end(), row.begin(), row.end()); + } + + for (auto& row : eemOccMap2dCumul) { + eemOccMap1dCumulPad.insert(eemOccMap1dCumulPad.end(), row.begin(), row.end()); + } + + for (auto& row : eepOccMap2dCumul) { + eepOccMap1dCumulPad.insert(eepOccMap1dCumulPad.end(), row.begin(), row.end()); } ///// Model Inference ////// @@ -164,25 +294,26 @@ namespace ecaldqm { Ort::AllocatorWithDefaultOptions allocator; - const char* inputName = session.GetInputName(0, allocator); + // Strings returned by session.GetInputNameAllocated are temporary, need to copy them before they are deallocated + std::string inputName{session.GetInputNameAllocated(0, allocator).get()}; Ort::TypeInfo inputTypeInfo = session.GetInputTypeInfo(0); auto inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo(); std::vector inputDims = inputTensorInfo.GetShape(); - const char* outputName = session.GetOutputName(0, allocator); + std::string outputName{session.GetOutputNameAllocated(0, allocator).get()}; Ort::TypeInfo outputTypeInfo = session.GetOutputTypeInfo(0); auto outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo(); std::vector outputDims = outputTensorInfo.GetShape(); - size_t TensorSize = nEtaTowersPad * nPhiTowers; + size_t TensorSize = nEBEtaTowersPad * nEBPhiTowers; std::vector ebRecoOccMap1dPad(TensorSize); //To store the output reconstructed occupancy - std::vector inputNames{inputName}; - std::vector outputNames{outputName}; + std::vector inputNames{inputName.c_str()}; + std::vector outputNames{outputName.c_str()}; std::vector inputTensors; std::vector outputTensors; @@ -202,63 +333,281 @@ namespace ecaldqm { outputTensors.data(), 1); + //Endcaps + // EE- // + + inputDims.clear(); + outputDims.clear(); + inputNames.clear(); + outputNames.clear(); + inputTensors.clear(); + outputTensors.clear(); + + modelFilepath = edm::FileInPath("DQM/EcalMonitorClient/data/onnxModels/EEm_resnet2018.onnx").fullPath(); + + Ort::Session EEm_session(env, modelFilepath.c_str(), sessionOptions); + + inputName = EEm_session.GetInputNameAllocated(0, allocator).get(); + + inputTypeInfo = EEm_session.GetInputTypeInfo(0); + auto EEm_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo(); + + inputDims = EEm_inputTensorInfo.GetShape(); + + outputName = EEm_session.GetOutputNameAllocated(0, allocator).get(); + + //Ort::TypeInfo + outputTypeInfo = EEm_session.GetOutputTypeInfo(0); + auto EEm_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo(); + + outputDims = EEm_outputTensorInfo.GetShape(); + + size_t EE_TensorSize = nEETowersPad * nEETowersPad; + std::vector eemRecoOccMap1dPad(EE_TensorSize); //To store the output reconstructed occupancy + + inputNames.push_back(inputName.c_str()); + outputNames.push_back(outputName.c_str()); + + //Ort::MemoryInfo + memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); + inputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, eemOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size())); + + outputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, eemRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size())); + + EEm_session.Run(Ort::RunOptions{nullptr}, + inputNames.data(), + inputTensors.data(), + 1, + outputNames.data(), + outputTensors.data(), + 1); + + // EE+ // + inputDims.clear(); + outputDims.clear(); + inputNames.clear(); + outputNames.clear(); + inputTensors.clear(); + outputTensors.clear(); + + modelFilepath = edm::FileInPath("DQM/EcalMonitorClient/data/onnxModels/EEp_resnet2018.onnx").fullPath(); + + Ort::Session EEp_session(env, modelFilepath.c_str(), sessionOptions); + + inputName = EEp_session.GetInputNameAllocated(0, allocator).get(); + + inputTypeInfo = EEp_session.GetInputTypeInfo(0); + auto EEp_inputTensorInfo = inputTypeInfo.GetTensorTypeAndShapeInfo(); + + inputDims = EEp_inputTensorInfo.GetShape(); + + outputName = EEp_session.GetOutputNameAllocated(0, allocator).get(); + + outputTypeInfo = EEp_session.GetOutputTypeInfo(0); + + auto EEp_outputTensorInfo = outputTypeInfo.GetTensorTypeAndShapeInfo(); + + outputDims = EEp_outputTensorInfo.GetShape(); + + std::vector eepRecoOccMap1dPad(EE_TensorSize); //To store the output reconstructed occupancy + + inputNames.push_back(inputName.c_str()); + outputNames.push_back(outputName.c_str()); + + //Ort::MemoryInfo + memoryInfo = Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault); + inputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, eepOccMap1dCumulPad.data(), EE_TensorSize, inputDims.data(), inputDims.size())); + + outputTensors.push_back(Ort::Value::CreateTensor( + memoryInfo, eepRecoOccMap1dPad.data(), EE_TensorSize, outputDims.data(), outputDims.size())); + + EEp_session.Run(Ort::RunOptions{nullptr}, + inputNames.data(), + inputTensors.data(), + 1, + outputNames.data(), + outputTensors.data(), + 1); + ///Inference on the output from the model/// //2D Loss map to store tower by tower loss between the output (reconstructed) and input occupancies, //Have same dimensions as the occupancy plot - std::valarray> lossMap2d(std::valarray(nPhiTowers), nEtaTowers); + std::valarray> EBlossMap2d(std::valarray(nEBPhiTowers), nEBEtaTowers); + std::valarray> EEmlossMap2d(std::valarray(nEEPhiTowers), nEEEtaTowers); + std::valarray> EEplossMap2d(std::valarray(nEEPhiTowers), nEEEtaTowers); //1D val arrays to store row wise information corresponding to the reconstructed, input and average occupancies, and loss. //and to do element wise (tower wise) operations on them to calculate the MSE loss between the reco and input occupancy. - std::valarray recoOcc1d(0., nPhiTowers); - std::valarray inputOcc1d(0., nPhiTowers); - std::valarray avgOcc1d(0., nPhiTowers); - std::valarray loss_; + std::valarray EBrecoOcc1d(0., nEBPhiTowers); + std::valarray EBinputOcc1d(0., nEBPhiTowers); + std::valarray EBavgOcc1d(0., nEBPhiTowers); + std::valarray EBloss_; + + std::valarray EEmrecoOcc1d(0., nEEPhiTowers); + std::valarray EEminputOcc1d(0., nEEPhiTowers); + std::valarray EEmavgOcc1d(0., nEEPhiTowers); + std::valarray EEmloss_; + + std::valarray EEprecoOcc1d(0., nEEPhiTowers); + std::valarray EEpinputOcc1d(0., nEEPhiTowers); + std::valarray EEpavgOcc1d(0., nEEPhiTowers); + std::valarray EEploss_; + + std::string EBOccpath = + edm::FileInPath("DQM/EcalMonitorClient/data/MLAvgOccupancy/EB_avgocc_Run2022_500ev.dat").fullPath(); + std::ifstream inFile; + double val; + inFile.open((EBOccpath).c_str()); + while (inFile) { + inFile >> val; + if (inFile.eof()) + break; + EBavgOcc.push_back(val); + } + inFile.close(); + + std::string EEmOccpath = + edm::FileInPath("DQM/EcalMonitorClient/data/MLAvgOccupancy/EEm_avgocc_Run2022_500ev.dat").fullPath(); + inFile.open((EEmOccpath).c_str()); + while (inFile) { + inFile >> val; + if (inFile.eof()) + break; + EEmavgOcc.push_back(val); + } + inFile.close(); + + std::string EEpOccpath = + edm::FileInPath("DQM/EcalMonitorClient/data/MLAvgOccupancy/EEp_avgocc_Run2022_500ev.dat").fullPath(); + inFile.open((EEpOccpath).c_str()); + while (inFile) { + inFile >> val; + if (inFile.eof()) + break; + EEpavgOcc.push_back(val); + } + inFile.close(); //Loss calculation //Ignore the top and bottom replicated padded rows when doing inference - //by making index i run over (1,35) instead of (0,36) - for (int i = 1; i < 35; i++) { - for (int j = 0; j < nPhiTowers; j++) { - int k = (i * nPhiTowers) + j; - recoOcc1d[j] = ebRecoOccMap1dPad[k]; - inputOcc1d[j] = ebOccMap1dCumulPad[k]; - avgOcc1d[j] = avgOcc_[k]; + //by making index i run over (1,35) instead of (0,36) for EB, and over (1,21) for EE + + MESet const& sAEReco(sources_.at("AEReco")); + TH2F* hEBRecoMap2d(sAEReco.getME(1)->getTH2F()); + + for (int i = 1; i < nEBEtaTowersPad - 1; i++) { + for (int j = 0; j < nEBPhiTowers; j++) { + int k = (i * nEBPhiTowers) + j; + int bin_ = hEBRecoMap2d->GetBin(j + 1, i); + EBrecoOcc1d[j] = ebRecoOccMap1dPad[k]; + EBinputOcc1d[j] = ebOccMap1dCumulPad[k]; + EBavgOcc1d[j] = EBavgOcc[k]; + double content = ebRecoOccMap1dPad[k]; + hEBRecoMap2d->SetBinContent(bin_, content); } //Calculate the MSE loss = (output-input)^2, with avg response correction - loss_ = std::pow((recoOcc1d / avgOcc1d - inputOcc1d / avgOcc1d), 2); - lossMap2d[i - 1] = (loss_); + EBloss_ = std::pow((EBrecoOcc1d / EBavgOcc1d - EBinputOcc1d / EBavgOcc1d), 2); + EBlossMap2d[i - 1] = (EBloss_); } - lossMap2dQ.push_back(lossMap2d); //Store each loss map from the output in the queue - if (lossMap2dQ.size() > nLSloss) { - lossMap2dQ.pop_front(); //Keep exactly nLSloss loss maps to multiply + TH2F* hEEmRecoMap2d(sAEReco.getME(0)->getTH2F()); + TH2F* hEEpRecoMap2d(sAEReco.getME(2)->getTH2F()); + + for (int i = 1; i < nEETowersPad - 1; i++) { + for (int j = 0; j < nEEPhiTowers; j++) { + int k = (i * nEETowersPad) + j + 1; + int bin_ = hEEmRecoMap2d->GetBin(j + 1, i); + + EEmrecoOcc1d[j] = eemRecoOccMap1dPad[k]; + EEminputOcc1d[j] = eemOccMap1dCumulPad[k]; + EEmavgOcc1d[j] = EEmavgOcc[k]; + double EEmcontent = eemRecoOccMap1dPad[k]; + hEEmRecoMap2d->SetBinContent(bin_, EEmcontent); + + EEprecoOcc1d[j] = eepRecoOccMap1dPad[k]; + EEpinputOcc1d[j] = eepOccMap1dCumulPad[k]; + EEpavgOcc1d[j] = EEpavgOcc[k]; + double EEpcontent = eepRecoOccMap1dPad[k]; + hEEpRecoMap2d->SetBinContent(bin_, EEpcontent); + } + //Calculate the MSE loss = (output-input)^2, with avg response correction + EEmloss_ = std::pow((EEmrecoOcc1d / EEmavgOcc1d - EEminputOcc1d / EEmavgOcc1d), 2); + EEmlossMap2d[i - 1] = (EEmloss_); + + EEploss_ = std::pow((EEprecoOcc1d / EEpavgOcc1d - EEpinputOcc1d / EEpavgOcc1d), 2); + EEplossMap2d[i - 1] = (EEploss_); + } + + //Store each loss map from the output in the queue + EBlossMap2dQ.push_back(EBlossMap2d); + EEmlossMap2dQ.push_back(EEmlossMap2d); + EEplossMap2dQ.push_back(EEplossMap2d); + + //Keep exactly nLSloss loss maps to multiply + if (EBlossMap2dQ.size() > nLSloss) { + EBlossMap2dQ.pop_front(); + EEmlossMap2dQ.pop_front(); + EEplossMap2dQ.pop_front(); } - if (lossMap2dQ.size() < nLSloss) { //Exit if there are not nLSloss loss maps + if (EBlossMap2dQ.size() < nLSloss) { //Exit if there are not nLSloss loss maps return; } + //To hold the final multiplied loss - std::valarray> lossMap2dMult(std::valarray(1., nPhiTowers), nEtaTowers); + std::valarray> EBlossMap2dMult(std::valarray(1., nEBPhiTowers), nEBEtaTowers); + std::valarray> EEmlossMap2dMult(std::valarray(1., nEEPhiTowers), nEEEtaTowers); + std::valarray> EEplossMap2dMult(std::valarray(1., nEEPhiTowers), nEEEtaTowers); //Multiply together the last nLSloss loss maps //So that real anomalies which persist with time are enhanced and fluctuations are suppressed. - for (size_t i = 0; i < lossMap2dQ.size(); i++) { - lossMap2dMult *= lossMap2dQ[i]; + for (size_t i = 0; i < EBlossMap2dQ.size(); i++) { + EBlossMap2dMult *= EBlossMap2dQ[i]; + EEmlossMap2dMult *= EEmlossMap2dQ[i]; + EEplossMap2dMult *= EEplossMap2dQ[i]; } //Fill the AELoss ME with the values of this time multiplied loss map - MESet const& sAELoss(sources_.at("AELoss")); - TH2F* hLossMap2dMult(sAELoss.getME(1)->getTH2F()); - for (int i = 0; i < hLossMap2dMult->GetNbinsY(); i++) { - for (int j = 0; j < hLossMap2dMult->GetNbinsX(); j++) { - int bin_ = hLossMap2dMult->GetBin(j + 1, i + 1); - double content = lossMap2dMult[i][j]; - hLossMap2dMult->SetBinContent(bin_, content); + //MESet const& sAELoss(sources_.at("AELoss")); + MESet& sAELoss(sources_.at("AELoss")); + + TH2F* hEBLossMap2dMult(sAELoss.getME(1)->getTH2F()); + + for (int i = 0; i < hEBLossMap2dMult->GetNbinsY(); i++) { + for (int j = 0; j < hEBLossMap2dMult->GetNbinsX(); j++) { + int bin_ = hEBLossMap2dMult->GetBin(j + 1, i + 1); + double content = EBlossMap2dMult[i][j]; + hEBLossMap2dMult->SetBinContent(bin_, content); } } + + TH2F* hEEmLossMap2dMult(sAELoss.getME(0)->getTH2F()); + TH2F* hEEpLossMap2dMult(sAELoss.getME(2)->getTH2F()); + + for (int i = 0; i < hEEmLossMap2dMult->GetNbinsY(); i++) { + for (int j = 0; j < hEEmLossMap2dMult->GetNbinsX(); j++) { + int bin_ = hEEmLossMap2dMult->GetBin(j + 1, i + 1); + + double EEmcontent = EEmlossMap2dMult[i][j]; + hEEmLossMap2dMult->SetBinContent(bin_, EEmcontent); + + double EEpcontent = EEplossMap2dMult[i][j]; + hEEpLossMap2dMult->SetBinContent(bin_, EEpcontent); + } + } + ///////////////////// ML Quality Summary ///////////////////// //Apply the quality threshold on the time multiplied loss map stored in the ME AELoss //If anomalous, the tower entry will have a large loss value. If good, the value will be close to zero. + MESet& meBadTowerCount(sources_.at("BadTowerCount")); + MESet& meBadTowerCountNorm(sources_.at("BadTowerCountNorm")); + MESet& meTrendMLBadTower(MEs_.at("TrendMLBadTower")); + + LScount++; + MESet::const_iterator dAEnd(sAELoss.end(GetElectronicsMap())); for (MESet::const_iterator dItr(sAELoss.beginChannel(GetElectronicsMap())); dItr != dAEnd; dItr.toNextChannel(GetElectronicsMap())) { @@ -267,15 +616,40 @@ namespace ecaldqm { bool doMaskML(meMLQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap())); float entries(dItr->getBinContent()); + int quality(doMaskML ? kMGood : kGood); + float MLThreshold; + + if (id.subdetId() == EcalEndcap) { + EEDetId eeid(id); + if (eeid.zside() > 0) + MLThreshold = EEpThreshold_; + else + MLThreshold = EEmThreshold_; + } else { + MLThreshold = EBThreshold_; + } + //If a trigger tower entry is greater than the ML threshold, set it to Bad quality, otherwise Good. - if (entries > MLThreshold_) { + if (entries > MLThreshold) { quality = doMaskML ? kMBad : kBad; + meBadTowerCount.fill(getEcalDQMSetupObjects(), id); + if (id.subdetId() == EcalEndcap) + nbadtowerEE++; + else + nbadtowerEB++; } //Fill the quality summary with the quality of the given tower id. meMLQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, double(quality)); + + double badtowcount(meBadTowerCount.getBinContent(getEcalDQMSetupObjects(), id)); + meBadTowerCountNorm.setBinContent(getEcalDQMSetupObjects(), id, double(badtowcount / LScount)); } // ML Quality Summary - } // producePlots() + + meTrendMLBadTower.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), double(nbadtowerEB)); + meTrendMLBadTower.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), double(nbadtowerEE)); + + } // producePlots() DEFINE_ECALDQM_WORKER(MLClient); } // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py b/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py index 3a02e5e06c7b0..852e1c1e04997 100644 --- a/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/OccupancyTask_cfi.py @@ -261,12 +261,19 @@ description = cms.untracked.string('Trend of the pile up per lumisection') ), AELoss = cms.untracked.PSet( - path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT AE Loss'), + path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT AE Loss%(suffix)s'), kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('SuperCrystal'), description = cms.untracked.string('AE Loss from inference') ), + AEReco = cms.untracked.PSet( + path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT AE Reco%(suffix)s'), + kind = cms.untracked.string('TH2F'), + otype = cms.untracked.string('Ecal3P'), + btype = cms.untracked.string('SuperCrystal'), + description = cms.untracked.string('AE Reco') + ), PU = cms.untracked.PSet( path = cms.untracked.string('Ecal/EventInfo/PU in the lumi'), kind = cms.untracked.string('REAL'), @@ -280,9 +287,21 @@ otype = cms.untracked.string('None'), btype = cms.untracked.string('User'), description = cms.untracked.string('Number of events in this lumisection') + ), + BadTowerCount = cms.untracked.PSet( + path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT ML bad tower count%(suffix)s'), + kind = cms.untracked.string('TH2F'), + otype = cms.untracked.string('Ecal3P'), + btype = cms.untracked.string('SuperCrystal'), + description = cms.untracked.string('Count of bad towers flagged by the ML model.') + ), + BadTowerCountNorm = cms.untracked.PSet( + path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT ML bad tower count normalized%(suffix)s'), + kind = cms.untracked.string('TH2F'), + otype = cms.untracked.string('Ecal3P'), + btype = cms.untracked.string('SuperCrystal'), + description = cms.untracked.string('Count of bad towers flagged by the ML model normalized by the no.of LS') ) - - # TPDigiProjPhi = cms.untracked.PSet( # path = cms.untracked.string('%(subdet)s/%(prefix)sOccupancyTask/%(prefix)sOT TP digi occupancy%(suffix)s projection phi'), # kind = cms.untracked.string('TH1F'), diff --git a/DQM/EcalMonitorTasks/src/EnergyTask.cc b/DQM/EcalMonitorTasks/src/EnergyTask.cc index 7670fce2e20dd..775882335db8a 100644 --- a/DQM/EcalMonitorTasks/src/EnergyTask.cc +++ b/DQM/EcalMonitorTasks/src/EnergyTask.cc @@ -39,13 +39,13 @@ namespace ecaldqm { MESet& meHit(MEs_.at("Hit")); MESet& meHitAll(MEs_.at("HitAll")); - uint32_t neitherGoodNorPoorCalib(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kPoorCalib)); - uint32_t neitherGoodNorOOT(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime)); + uint32_t goodORPoorCalibBits(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kPoorCalib); + uint32_t goodOROOTBits(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime); for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) { - if (isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorPoorCalib)) + if (isPhysicsRun_ && !hitItr->checkFlagMask(goodORPoorCalibBits)) continue; - if (!isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorOOT)) + if (!isPhysicsRun_ && !hitItr->checkFlagMask(goodOROOTBits)) continue; float energy(hitItr->energy()); diff --git a/DQM/EcalMonitorTasks/src/OccupancyTask.cc b/DQM/EcalMonitorTasks/src/OccupancyTask.cc index 14bd4e995b18e..205ef11d7d2e1 100644 --- a/DQM/EcalMonitorTasks/src/OccupancyTask.cc +++ b/DQM/EcalMonitorTasks/src/OccupancyTask.cc @@ -20,6 +20,7 @@ namespace ecaldqm { MEs_.erase(std::string("TrendEventsperLumi")); MEs_.erase(std::string("TrendPUperLumi")); MEs_.erase(std::string("AELoss")); + MEs_.erase(std::string("AEReco")); } } @@ -124,9 +125,11 @@ namespace ecaldqm { MESet& meDigi1D(MEs_.at("Digi1D")); MESet& meTrendNDigi(MEs_.at("TrendNDigi")); MESet* meAELoss = nullptr; - if (onlineMode_) + MESet* meAEReco = nullptr; + if (onlineMode_) { meAELoss = &MEs_.at("AELoss"); - + meAEReco = &MEs_.at("AEReco"); + } std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) { DetId id(digi.id()); meDigi.fill(getEcalDQMSetupObjects(), id); @@ -135,8 +138,10 @@ namespace ecaldqm { meDigiAll.fill(getEcalDQMSetupObjects(), id); meDigiAllByLumi.fill(getEcalDQMSetupObjects(), id); meDigiDCC.fill(getEcalDQMSetupObjects(), id); - if (onlineMode_) + if (onlineMode_) { meAELoss->fill(getEcalDQMSetupObjects(), id); + meAEReco->fill(getEcalDQMSetupObjects(), id); + } }); int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap); @@ -193,7 +198,7 @@ namespace ecaldqm { MESet& meRecHitThr1D(MEs_.at("RecHitThr1D")); MESet& meTrendNRecHitThr(MEs_.at("TrendNRecHitThr")); - uint32_t mask(~(0x1 << EcalRecHit::kGood)); + uint32_t goodBits(0x1 << EcalRecHit::kGood); double nFiltered(0.); float nRHThrp(0), nRHThrm(0); @@ -205,7 +210,7 @@ namespace ecaldqm { meRecHitProjEta.fill(getEcalDQMSetupObjects(), id); meRecHitProjPhi.fill(getEcalDQMSetupObjects(), id); - if (!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_) { + if (hit.checkFlagMask(goodBits) && hit.energy() > recHitThreshold_) { meRecHitThrProjEta.fill(getEcalDQMSetupObjects(), id); meRecHitThrProjPhi.fill(getEcalDQMSetupObjects(), id); meRecHitThrAll.fill(getEcalDQMSetupObjects(), id); diff --git a/DQM/EcalMonitorTasks/src/TimingTask.cc b/DQM/EcalMonitorTasks/src/TimingTask.cc index bb00f7d266dae..5bd6b365ed5aa 100644 --- a/DQM/EcalMonitorTasks/src/TimingTask.cc +++ b/DQM/EcalMonitorTasks/src/TimingTask.cc @@ -69,11 +69,11 @@ namespace ecaldqm { MESet& meTime1D(MEs_.at("Time1D")); MESet& meChi2(MEs_.at("Chi2")); - uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime))); + uint32_t goodOROOTBits(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime); int signedSubdet; std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) { - if (hit.checkFlagMask(mask)) + if (!hit.checkFlagMask(goodOROOTBits)) return; DetId id(hit.id()); diff --git a/DQM/GEM/python/gem_dqm_offline_client_cff.py b/DQM/GEM/python/gem_dqm_offline_client_cff.py index 03eb7daae33a5..84fa7e81ec400 100644 --- a/DQM/GEM/python/gem_dqm_offline_client_cff.py +++ b/DQM/GEM/python/gem_dqm_offline_client_cff.py @@ -3,8 +3,11 @@ from DQM.GEM.GEMDQMHarvester_cfi import * from DQM.GEM.gemEfficiencyHarvester_cff import * +from DQMOffline.MuonDPG.gemTnPEfficiencyClient_cfi import * + gemClients = cms.Sequence( GEMDQMHarvester * gemEfficiencyHarvesterTightGlb * - gemEfficiencyHarvesterSta + gemEfficiencyHarvesterSta * + gemTnPEfficiencyClient ) diff --git a/DQM/GEM/python/gem_dqm_offline_source_cff.py b/DQM/GEM/python/gem_dqm_offline_source_cff.py index 762feec518e57..070ae588e82c7 100644 --- a/DQM/GEM/python/gem_dqm_offline_source_cff.py +++ b/DQM/GEM/python/gem_dqm_offline_source_cff.py @@ -5,6 +5,8 @@ from DQM.GEM.GEMDAQStatusSource_cfi import * from DQM.GEM.gemEfficiencyAnalyzer_cff import * +from DQMOffline.MuonDPG.gemTnPEfficiencyTask_cfi import * + GEMDigiSource.runType = "offline" GEMRecHitSource.runType = "offline" GEMDAQStatusSource.runType = "offline" @@ -14,5 +16,6 @@ GEMRecHitSource * GEMDAQStatusSource * gemEfficiencyAnalyzerTightGlbSeq * - gemEfficiencyAnalyzerStaSeq + gemEfficiencyAnalyzerStaSeq * + gemTnPEfficiencyMonitor ) diff --git a/DQM/HLTEvF/plugins/TriggerBxMonitor.cc b/DQM/HLTEvF/plugins/TriggerBxMonitor.cc index 82096793b59d0..f1b456cbc836c 100644 --- a/DQM/HLTEvF/plugins/TriggerBxMonitor.cc +++ b/DQM/HLTEvF/plugins/TriggerBxMonitor.cc @@ -100,9 +100,10 @@ class TriggerBxMonitor : public DQMGlobalEDAnalyzer { }; // module configuration - const edm::ESGetToken m_l1tMenuToken; - const edm::EDGetTokenT m_l1t_results; - const edm::EDGetTokenT m_hlt_results; + const edm::ESGetToken m_l1tMenu_token; + const edm::InputTag m_l1t_results_inputTag; + const edm::EDGetTokenT m_l1t_results_token; + const edm::EDGetTokenT m_hlt_results_token; const std::string m_dqm_path; const bool m_make_1d_plots; const bool m_make_2d_plots; @@ -125,13 +126,14 @@ void TriggerBxMonitor::fillDescriptions(edm::ConfigurationDescriptions& descript TriggerBxMonitor::TriggerBxMonitor(edm::ParameterSet const& config) : // module configuration - m_l1tMenuToken{esConsumes()}, - m_l1t_results(consumes(config.getUntrackedParameter("l1tResults"))), - m_hlt_results(consumes(config.getUntrackedParameter("hltResults"))), - m_dqm_path(config.getUntrackedParameter("dqmPath")), - m_make_1d_plots(config.getUntrackedParameter("make1DPlots")), - m_make_2d_plots(config.getUntrackedParameter("make2DPlots")), - m_ls_range(config.getUntrackedParameter("lsRange")) {} + m_l1tMenu_token{esConsumes()}, + m_l1t_results_inputTag{config.getUntrackedParameter("l1tResults")}, + m_l1t_results_token{consumes(m_l1t_results_inputTag)}, + m_hlt_results_token{consumes(config.getUntrackedParameter("hltResults"))}, + m_dqm_path{config.getUntrackedParameter("dqmPath")}, + m_make_1d_plots{config.getUntrackedParameter("make1DPlots")}, + m_make_2d_plots{config.getUntrackedParameter("make2DPlots")}, + m_ls_range{config.getUntrackedParameter("lsRange")} {} void TriggerBxMonitor::dqmBeginRun(edm::Run const& run, edm::EventSetup const& setup, @@ -159,7 +161,7 @@ void TriggerBxMonitor::dqmBeginRun(edm::Run const& run, // initialise the HLTConfigProvider bool changed = true; edm::EDConsumerBase::Labels labels; - labelsForToken(m_hlt_results, labels); + labelsForToken(m_hlt_results_token, labels); if (histograms.hltConfig.init(run, setup, labels.process, changed)) { if (m_make_1d_plots) { histograms.hlt_bx.clear(); @@ -228,7 +230,7 @@ void TriggerBxMonitor::bookHistograms(DQMStore::IBooker& booker, // book the individual histograms for the L1 triggers that are included in the L1 menu booker.setCurrentFolder(m_dqm_path + "/L1T"); - auto const& l1tMenu = setup.getData(m_l1tMenuToken); + auto const& l1tMenu = setup.getData(m_l1tMenu_token); for (auto const& keyval : l1tMenu.getAlgorithmMap()) { unsigned int bit = keyval.second.getIndex(); std::string const& name = fmt::sprintf("%s (bit %d)", keyval.first, bit); @@ -295,10 +297,18 @@ void TriggerBxMonitor::dqmAnalyze(edm::Event const& event, // monitor the bx distribution for the L1 triggers { - auto const& bxvector = event.get(m_l1t_results); - if (not bxvector.isEmpty(0)) { - auto const& results = bxvector.at(0, 0); - for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i) + auto const& algBlkBxVecHandle = event.getHandle(m_l1t_results_token); + if (not algBlkBxVecHandle.isValid()) { + edm::LogError("TriggerBxMonitor") + << "L1 trigger results with label [" << m_l1t_results_inputTag.encode() + << "] not present or invalid. MonitorElements of L1T results not filled for this event."; + } else if (algBlkBxVecHandle->isEmpty(0)) { + edm::LogError("TriggerBxMonitor") + << "L1 trigger results with label [" << m_l1t_results_inputTag.encode() + << "] empty for BX=0. MonitorElements of L1T results not filled for this event."; + } else { + auto const& results = algBlkBxVecHandle->at(0, 0); + for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i) { if (results.getAlgoDecisionFinal(i)) { if (m_make_1d_plots and histograms.l1t_bx.at(i)) histograms.l1t_bx[i]->Fill(bx); @@ -306,12 +316,13 @@ void TriggerBxMonitor::dqmAnalyze(edm::Event const& event, histograms.l1t_bx_2d[i]->Fill(bx, ls); histograms.l1t_bx_all->Fill(bx, i); } + } } } // monitor the bx distribution for the HLT triggers if (histograms.hltConfig.inited()) { - auto const& hltResults = event.get(m_hlt_results); + auto const& hltResults = event.get(m_hlt_results_token); for (unsigned int i = 0; i < hltResults.size(); ++i) { if (hltResults.at(i).accept()) { if (m_make_1d_plots and histograms.hlt_bx.at(i)) diff --git a/DQM/HLTEvF/plugins/TriggerRatesMonitor.cc b/DQM/HLTEvF/plugins/TriggerRatesMonitor.cc index e0ab981bfd6a9..ccb77f916582b 100644 --- a/DQM/HLTEvF/plugins/TriggerRatesMonitor.cc +++ b/DQM/HLTEvF/plugins/TriggerRatesMonitor.cc @@ -131,9 +131,10 @@ class TriggerRatesMonitor : public DQMGlobalEDAnalyzer { }; // module configuration - const edm::ESGetToken m_l1tMenuToken; - const edm::EDGetTokenT m_l1t_results; - const edm::EDGetTokenT m_hlt_results; + const edm::ESGetToken m_l1tMenu_token; + const edm::InputTag m_l1t_results_inputTag; + const edm::EDGetTokenT m_l1t_results_token; + const edm::EDGetTokenT m_hlt_results_token; const std::string m_dqm_path; const uint32_t m_lumisections_range; }; @@ -152,11 +153,12 @@ void TriggerRatesMonitor::fillDescriptions(edm::ConfigurationDescriptions &descr TriggerRatesMonitor::TriggerRatesMonitor(edm::ParameterSet const &config) : // module configuration - m_l1tMenuToken{esConsumes()}, - m_l1t_results(consumes(config.getUntrackedParameter("l1tResults"))), - m_hlt_results(consumes(config.getUntrackedParameter("hltResults"))), - m_dqm_path(config.getUntrackedParameter("dqmPath")), - m_lumisections_range(config.getUntrackedParameter("lumisectionRange")) {} + m_l1tMenu_token{esConsumes()}, + m_l1t_results_inputTag{config.getUntrackedParameter("l1tResults")}, + m_l1t_results_token{consumes(m_l1t_results_inputTag)}, + m_hlt_results_token{consumes(config.getUntrackedParameter("hltResults"))}, + m_dqm_path{config.getUntrackedParameter("dqmPath")}, + m_lumisections_range{config.getUntrackedParameter("lumisectionRange")} {} void TriggerRatesMonitor::dqmBeginRun(edm::Run const &run, edm::EventSetup const &setup, @@ -171,7 +173,7 @@ void TriggerRatesMonitor::dqmBeginRun(edm::Run const &run, // initialise the HLTConfigProvider bool changed = true; edm::EDConsumerBase::Labels labels; - labelsForToken(m_hlt_results, labels); + labelsForToken(m_hlt_results_token, labels); if (histograms.hltConfig.init(run, setup, labels.process, changed)) { // number of trigger paths in labels.process auto const nTriggers = histograms.hltConfig.size(); @@ -257,7 +259,7 @@ void TriggerRatesMonitor::bookHistograms(DQMStore::IBooker &booker, // book the rate histograms for the L1T triggers that are included in the L1T menu booker.setCurrentFolder(m_dqm_path + "/L1T"); - auto const &l1tMenu = setup.getData(m_l1tMenuToken); + auto const &l1tMenu = setup.getData(m_l1tMenu_token); for (auto const &keyval : l1tMenu.getAlgorithmMap()) { unsigned int const bit = keyval.second.getIndex(); if (bit >= histograms.l1t_counts.size()) { @@ -357,9 +359,17 @@ void TriggerRatesMonitor::dqmAnalyze(edm::Event const &event, histograms.tcds_counts[event.experimentType()]->Fill(lumisection); // monitor the rates of L1T triggers - auto const &bxvector = event.get(m_l1t_results); - if (not bxvector.isEmpty(0)) { - auto const &results = bxvector.at(0, 0); + auto const &algBlkBxVecHandle = event.getHandle(m_l1t_results_token); + if (not algBlkBxVecHandle.isValid()) { + edm::LogError("TriggerRatesMonitor") + << "L1 trigger results with label [" << m_l1t_results_inputTag.encode() + << "] not present or invalid. MonitorElements of L1T results not filled for this event."; + } else if (algBlkBxVecHandle->isEmpty(0)) { + edm::LogError("TriggerRatesMonitor") + << "L1 trigger results with label [" << m_l1t_results_inputTag.encode() + << "] empty for BX=0. MonitorElements of L1T results not filled for this event."; + } else { + auto const &results = algBlkBxVecHandle->at(0, 0); for (unsigned int i = 0; i < GlobalAlgBlk::maxPhysicsTriggers; ++i) if (results.getAlgoDecisionFinal(i)) if (histograms.l1t_counts[i]) @@ -368,7 +378,7 @@ void TriggerRatesMonitor::dqmAnalyze(edm::Event const &event, // monitor the rates of HLT triggers, datasets and streams if (histograms.hltConfig.inited()) { - auto const &hltResults = event.get(m_hlt_results); + auto const &hltResults = event.get(m_hlt_results_token); if (hltResults.size() != histograms.hltIndices.size()) { edm::LogError("TriggerRatesMonitor") << "This should never happen: the number of HLT paths has changed since the beginning of the run" diff --git a/DQM/HLTEvF/test/testTriggerMonitors.sh b/DQM/HLTEvF/test/testTriggerMonitors.sh index 507d445c664fc..7cb566490a1a2 100755 --- a/DQM/HLTEvF/test/testTriggerMonitors.sh +++ b/DQM/HLTEvF/test/testTriggerMonitors.sh @@ -7,10 +7,8 @@ function die { } # run test job -TESTDIR="${LOCALTOP}"/src/DQM/HLTEvF/test - -cmsRun "${TESTDIR}"/testTriggerMonitors_dqm_cfg.py \ +cmsRun "${SCRAM_TEST_PATH}"/testTriggerMonitors_dqm_cfg.py \ || die "Failure running testTriggerMonitors_dqm_cfg.py" $? -cmsRun "${TESTDIR}"/testTriggerMonitors_harvesting_cfg.py \ +cmsRun "${SCRAM_TEST_PATH}"/testTriggerMonitors_harvesting_cfg.py \ || die "Failure running testTriggerMonitors_harvesting_cfg.py" $? 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 fde60eb802425..48131b4e4bde6 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -6,7 +6,7 @@ BSOnlineRecordName = 'BeamSpotOnlineLegacyObjectsRcd' BSOnlineTag = 'BeamSpotOnlineLegacy' BSOnlineJobName = 'BeamSpotOnlineLegacy' -BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +BSOnlineOmsServiceUrl = 'http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' useLockRecords = True import sys @@ -91,6 +91,11 @@ # Swap offline <-> online BeamSpot as in Express and HLT import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() + +# for running offline enhance the time validity of the online beamspot in DB +if ((not live) or process.isDqmPlayback.value): + process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6)) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() @@ -121,7 +126,7 @@ process.load("Configuration.StandardSequences.RawToDigi_Data_cff") process.load("RecoLocalTracker.Configuration.RecoLocalTracker_cff") process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone( src = 'siPixelClustersPreSplitting' ) @@ -329,11 +334,11 @@ process.dqmBeamMonitor.PVFitter.minNrVerticesForFit = 20 process.dqmBeamMonitor.PVFitter.minVertexNdf = 10 -process.dqmBeamMonitor.PVFitter.errorScale = 1.0 +process.dqmBeamMonitor.PVFitter.errorScale = 1.2 #---------------------------- # Pixel tracks/vertices reco -process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") +process.load("RecoTracker.Configuration.RecoPixelVertexing_cff") from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * process.pixelVertices = pixelVertices.clone( TkFilterParameters = dict( minPt = process.pixelTracksTrackingRegions.RegionPSet.ptMin) @@ -435,14 +440,7 @@ print("Configured frontierKey", options.runUniqueKey) #-------- -# Do no run on events with pixel or strip with HV off - -process.stripTrackerHVOn = cms.EDFilter( "DetectorStateFilter", - DCSRecordLabel = cms.untracked.InputTag( "onlineMetaDataDigis" ), - DcsStatusLabel = cms.untracked.InputTag( "scalersRawToDigi" ), - DebugOn = cms.untracked.bool( False ), - DetectorType = cms.untracked.string( "sistrip" ) -) +# Do no run on events with pixel with HV off process.pixelTrackerHVOn = cms.EDFilter( "DetectorStateFilter", DCSRecordLabel = cms.untracked.InputTag( "onlineMetaDataDigis" ), @@ -458,7 +456,6 @@ * process.tcdsDigis * process.onlineMetaDataDigis * process.pixelTrackerHVOn - * process.stripTrackerHVOn * process.dqmTKStatus * process.hltTriggerTypeFilter * process.dqmcommon @@ -470,7 +467,6 @@ * process.tcdsDigis * process.onlineMetaDataDigis * process.pixelTrackerHVOn - * process.stripTrackerHVOn * process.dqmTKStatus * process.hltTriggerTypeFilter * process.filter_step # the only extra: pix-multi filter 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 2663d38c97563..589cb0bd790f5 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -7,7 +7,7 @@ BSOnlineRecordName = 'BeamSpotOnlineLegacyObjectsRcd' BSOnlineTag = 'BeamSpotOnlineFakeLegacy' BSOnlineJobName = 'BeamSpotOnlineFakeLegacy' -BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +BSOnlineOmsServiceUrl = 'http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' useLockRecords = True import sys if 'runkey=hi_run' in sys.argv: 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 48cd2447356dd..3f3b6fba6e2d2 100644 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -6,7 +6,7 @@ BSOnlineRecordName = 'BeamSpotOnlineHLTObjectsRcd' BSOnlineTag = 'BeamSpotOnlineHLT' BSOnlineJobName = 'BeamSpotOnlineHLT' -BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +BSOnlineOmsServiceUrl = 'http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' useLockRecords = True import sys @@ -145,6 +145,11 @@ # Swap offline <-> online BeamSpot as in Express and HLT import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() + +# for running offline enhance the time validity of the online beamspot in DB +if ((not live) or process.isDqmPlayback.value): + process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6)) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() 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 5f46124512b45..6dbdc97fa5e4a 100644 --- a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py @@ -6,7 +6,7 @@ BSOnlineRecordName = 'BeamSpotOnlineHLTObjectsRcd' BSOnlineTag = 'BeamSpotOnlineFakeHLT' BSOnlineJobName = 'BeamSpotOnlineFakeHLT' -BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +BSOnlineOmsServiceUrl = 'http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' useLockRecords = True import sys 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 1e990f8318baf..d91ba52ffc396 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -90,10 +90,10 @@ #---------------------------- # Pixel-Tracks&Vertices Config #---------------------------- -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone(src = 'siPixelClustersPreSplitting') process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi") -process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") +process.load("RecoTracker.Configuration.RecoPixelVertexing_cff") from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * process.pixelVertices = pixelVertices.clone( TkFilterParameters = dict( diff --git a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py index 4cf721d4f13de..1511240542840 100644 --- a/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_clientPB-live_cfg.py @@ -47,9 +47,9 @@ process.fastTimerServiceClient.onlineLumiME = dict( folder = 'HLT/LumiMonitoring', name = 'lumiVsLS', - nbins = 5000, + nbins = 6000, xmin = 0, - xmax = 20000 + xmax = 30000, ) # ThroughputService client @@ -63,13 +63,10 @@ folder = cms.string("HLT/PSMonitoring"), name = cms.string("psColumnVSlumi"), doXaxis = cms.bool( True ), - nbinsX = cms.int32( 5000), - xminX = cms.double( 0.), - xmaxX = cms.double(20000.), + nbinsX = cms.int32( 6000 ), + xminX = cms.double( 0. ), + xmaxX = cms.double( 30000. ), doYaxis = cms.bool( False ), - nbinsY = cms.int32 ( 8), - xminY = cms.double( 0.), - xmaxY = cms.double( 8.), ), me1 = cms.PSet( folder = cms.string("HLT/LumiMonitoring"), diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index cc04e270abfef..e23d84981f9ab 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -40,9 +40,9 @@ process.HLTSiStripClusterChargeCutNone = cms.PSet( value = cms.double( -1.0 ) ) process.ClusterShapeHitFilterESProducer = cms.ESProducer( "ClusterShapeHitFilterESProducer", ComponentName = cms.string( "ClusterShapeHitFilter" ), - PixelShapeFileL1 = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_loose.par" ), + PixelShapeFileL1 = cms.string( "RecoTracker/PixelLowPtUtilities/data/pixelShapePhase1_loose.par" ), clusterChargeCut = cms.PSet( refToPSet_ = cms.string( "HLTSiStripClusterChargeCutNone" ) ), - PixelShapeFile = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_noL1.par" ) + PixelShapeFile = cms.string( "RecoTracker/PixelLowPtUtilities/data/pixelShapePhase1_noL1.par" ) ) #SiStrip Local Reco process.load("CalibTracker.SiStripCommon.TkDetMapESProducer_cfi") diff --git a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py index c6a9165e22793..98cc2d229ad10 100644 --- a/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/onlinebeammonitor_dqm_sourceclient-live_cfg.py @@ -122,6 +122,10 @@ process.dqmSaverPB.tag = 'OnlineBeamMonitor' process.dqmSaverPB.runNumber = options.runNumber +# for running offline enhance the time validity of the online beamspot in DB +if (unitTest or process.isDqmPlayback.value): + process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6)) + #----------------------------- # BeamMonitor #----------------------------- diff --git a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py index 5a0d3121ed411..ad72f83bb39bc 100644 --- a/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixel_dqm_sourceclient-live_cfg.py @@ -128,13 +128,17 @@ if (process.runType.getRunType() == process.runType.cosmic_run or process.runType.getRunType() == process.runType.cosmic_run_stage1): process.load("RecoTracker.Configuration.RecoTrackerP5_cff") process.load("Configuration.StandardSequences.ReconstructionCosmics_cff") - process.load("RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi") + process.load("RecoTracker.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi") else: process.load("Configuration.StandardSequences.Reconstruction_cff") import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() +# for running offline enhance the time validity of the online beamspot in DB +if ((not live) or process.isDqmPlayback.value): + process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6)) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() @@ -223,7 +227,7 @@ from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import * process.PixelLayerTriplets.BPix.HitProducer = cms.string('siPixelRecHitsPreSplitting') process.PixelLayerTriplets.FPix.HitProducer = cms.string('siPixelRecHitsPreSplitting') - from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * + from RecoTracker.PixelTrackFitting.PixelTracks_cff import * process.pixelTracksHitTriplets.SeedComparitorPSet.clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' process.RecoForDQM_TrkReco = cms.Sequence(process.offlineBeamSpot*process.MeasurementTrackerEventPreSplitting*process.siPixelClusterShapeCachePreSplitting*process.recopixelvertexing*process.InitialStepPreSplitting) diff --git a/DQM/Integration/python/clients/ppsrandom_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ppsrandom_dqm_sourceclient-live_cfg.py new file mode 100644 index 0000000000000..8240ed8331816 --- /dev/null +++ b/DQM/Integration/python/clients/ppsrandom_dqm_sourceclient-live_cfg.py @@ -0,0 +1,97 @@ +import FWCore.ParameterSet.Config as cms + +import sys +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('CTPPSDQM', Run3) + +test = False +unitTest = False + +if 'unitTest=True' in sys.argv: + unitTest=True + +# event source +if unitTest: + process.load("DQM.Integration.config.unittestinputsource_cfi") + from DQM.Integration.config.unittestinputsource_cfi import options +elif not test: + # for live online DQM in P5 + process.load("DQM.Integration.config.inputsource_cfi") + from DQM.Integration.config.inputsource_cfi import options +else: + # for testing in lxplus + process.load("DQM.Integration.config.fileinputsource_cfi") + from DQM.Integration.config.fileinputsource_cfi import options + process.source.fileNames = cms.untracked.vstring( + "/store/group/dpg_ctpps/comm_ctpps/PixelRandomTrigger2023/outputExpressPPSRandom.root" + ) + process.source.inputCommands = cms.untracked.vstring( + 'drop *', + 'keep FEDRawDataCollection_*_*_*' + ) + +process.source.streamLabel = "streamDQMPPSRandom" + +# DQM environment +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = 'PPSRANDOM' +process.dqmSaver.tag = 'PPSRANDOM' +process.dqmSaver.runNumber = options.runNumber +process.dqmSaverPB.tag = 'PPSRANDOM' +process.dqmSaverPB.runNumber = options.runNumber + +if test: + process.dqmSaver.path = "." + process.dqmSaverPB.path = "./pb" + +process.load("DQMServices.Components.DQMProvInfo_cfi") + +# message logger +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet(threshold = cms.untracked.string('WARNING')) +) + +# global tag - conditions for P5 cluster +process.load("DQM.Integration.config.FrontierCondition_GT_cfi") + +# raw-to-digi conversion +from EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff import ctppsPixelDigis as _ctppsPixelDigis +process.ctppsPixelDigisAlCaRecoProducer = _ctppsPixelDigis.clone(inputLabel = 'hltPPSCalibrationRaw') + +# loading Meta tags used by commonDQM +process.load('EventFilter.OnlineMetaDataRawToDigi.onlineMetaDataRawToDigi_cfi') +process.onlineMetaDataDigis = cms.EDProducer('OnlineMetaDataRawToDigi') + + +# DQM Modules +process.load("DQM.CTPPS.ctppsDQM_cff") + +# processing path +process.recoStep = cms.Sequence( + process.ctppsPixelDigisAlCaRecoProducer * + process.onlineMetaDataDigis +) + +process.dqmModules = cms.Sequence( + process.ctppsDQMRandomSource * + process.ctppsDQMRandomHarvest +) + +process.path = cms.Path( + process.recoStep * + process.dqmModules * + + process.dqmEnv * + process.dqmSaver * + process.dqmSaverPB +) + +process.schedule = cms.Schedule(process.path) + +process.dqmProvInfo.runType = process.runType.getRunTypeName() + +# Process customizations included here +from DQM.Integration.config.online_customizations_cfi import * +print("Final Source settings:", process.source) +process = customise(process) diff --git a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py index bff0bc30e8586..bceef684d013d 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -123,6 +123,10 @@ import RecoVertex.BeamSpotProducer.onlineBeamSpotESProducer_cfi as _mod process.BeamSpotESProducer = _mod.onlineBeamSpotESProducer.clone() +# for running offline enhance the time validity of the online beamspot in DB +if ((not live) or process.isDqmPlayback.value): + process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6)) + import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone() @@ -390,7 +394,7 @@ from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import * process.PixelLayerTriplets.BPix.HitProducer = cms.string('siPixelRecHitsPreSplitting') process.PixelLayerTriplets.FPix.HitProducer = cms.string('siPixelRecHitsPreSplitting') - from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * + from RecoTracker.PixelTrackFitting.PixelTracks_cff import * process.pixelTracksHitTriplets.SeedComparitorPSet.clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' process.RecoForDQM_TrkReco = cms.Sequence(process.offlineBeamSpot*process.MeasurementTrackerEventPreSplitting*process.siPixelClusterShapeCachePreSplitting*process.recopixelvertexing*process.InitialStepPreSplitting) @@ -636,7 +640,7 @@ from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import * process.PixelLayerTriplets.BPix.HitProducer = 'siPixelRecHitsPreSplitting' process.PixelLayerTriplets.FPix.HitProducer = 'siPixelRecHitsPreSplitting' - from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * + from RecoTracker.PixelTrackFitting.PixelTracks_cff import * process.pixelTracksHitTriplets.SeedComparitorPSet.clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting' process.RecoForDQM_TrkReco = cms.Sequence(process.offlineBeamSpot*process.MeasurementTrackerEventPreSplitting*process.siPixelClusterShapeCachePreSplitting*process.recopixelvertexing*process.InitialStepPreSplitting) diff --git a/DQM/Integration/test/BuildFile.xml b/DQM/Integration/test/BuildFile.xml index 70efac6554c41..bfd02a4c970c0 100644 --- a/DQM/Integration/test/BuildFile.xml +++ b/DQM/Integration/test/BuildFile.xml @@ -1,6 +1,3 @@ - - - diff --git a/DQM/L1TMonitor/interface/L1TStage2MuonShowerComp.h b/DQM/L1TMonitor/interface/L1TStage2MuonShowerComp.h index 79cf7f7308798..20ea43a121633 100644 --- a/DQM/L1TMonitor/interface/L1TStage2MuonShowerComp.h +++ b/DQM/L1TMonitor/interface/L1TStage2MuonShowerComp.h @@ -23,11 +23,21 @@ class L1TStage2MuonShowerComp : public DQMEDAnalyzer { void analyze(const edm::Event&, const edm::EventSetup&) override; private: - enum variables { BXRANGEGOOD = 1, BXRANGEBAD, NSHOWERGOOD, NSHOWERBAD, SHOWERALL, SHOWERGOOD, NOMINALBAD, TIGHTBAD }; - enum ratioVariables { RBXRANGE = 1, RNSHOWER, RSHOWER, RNOMINAL, RTIGHT }; - int numSummaryBins_{TIGHTBAD}; - int numErrBins_{RTIGHT}; - bool incBin_[RTIGHT + 1]; + enum variables { + BXRANGEGOOD = 1, + BXRANGEBAD, + NSHOWERGOOD, + NSHOWERBAD, + SHOWERALL, + SHOWERGOOD, + NOMINALBAD, + TIGHTBAD, + LOOSEBAD + }; + enum ratioVariables { RBXRANGE = 1, RNSHOWER, RSHOWER, RNOMINAL, RTIGHT, RLOOSE }; + int numSummaryBins_{LOOSEBAD}; + int numErrBins_{RLOOSE}; + bool incBin_[RLOOSE + 1]; edm::EDGetTokenT showerToken1_; edm::EDGetTokenT showerToken2_; @@ -50,6 +60,7 @@ class L1TStage2MuonShowerComp : public DQMEDAnalyzer { MonitorElement* showerColl2nShowers_; MonitorElement* showerColl2ShowerTypeVsBX_; + static constexpr unsigned IDX_LOOSE_SHOWER{3}; static constexpr unsigned IDX_TIGHT_SHOWER{2}; static constexpr unsigned IDX_NOMINAL_SHOWER{1}; }; diff --git a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonShowerComp.h b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonShowerComp.h index 5bf7ed4100a1c..91ec01e225862 100644 --- a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonShowerComp.h +++ b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonShowerComp.h @@ -23,12 +23,22 @@ class L1TStage2RegionalMuonShowerComp : public DQMEDAnalyzer { void analyze(const edm::Event&, const edm::EventSetup&) override; private: - enum variables { BXRANGEGOOD = 1, BXRANGEBAD, NSHOWERGOOD, NSHOWERBAD, SHOWERALL, SHOWERGOOD, NOMINALBAD, TIGHTBAD }; - enum ratioVariables { RBXRANGE = 1, RNSHOWER, RSHOWER, RNOMINAL, RTIGHT }; + enum variables { + BXRANGEGOOD = 1, + BXRANGEBAD, + NSHOWERGOOD, + NSHOWERBAD, + SHOWERALL, + SHOWERGOOD, + NOMINALBAD, + TIGHTBAD, + LOOSEBAD + }; + enum ratioVariables { RBXRANGE = 1, RNSHOWER, RSHOWER, RNOMINAL, RTIGHT, RLOOSE }; enum tfs { EMTFNEGBIN = 1, EMTFPOSBIN }; - int numSummaryBins_{TIGHTBAD}; - int numErrBins_{RTIGHT}; - bool incBin_[RTIGHT + 1]; + int numSummaryBins_{LOOSEBAD}; + int numErrBins_{RLOOSE}; + bool incBin_[RLOOSE + 1]; edm::EDGetTokenT showerToken1_; edm::EDGetTokenT showerToken2_; @@ -55,6 +65,7 @@ class L1TStage2RegionalMuonShowerComp : public DQMEDAnalyzer { MonitorElement* showerColl2ShowerTypeVsBX_; MonitorElement* showerColl2ProcessorVsBX_; + static constexpr unsigned IDX_LOOSE_SHOWER{3}; static constexpr unsigned IDX_TIGHT_SHOWER{2}; static constexpr unsigned IDX_NOMINAL_SHOWER{1}; }; diff --git a/DQM/L1TMonitor/interface/L1TStage2uGMT.h b/DQM/L1TMonitor/interface/L1TStage2uGMT.h index a508f006a38f6..c80851b82c354 100644 --- a/DQM/L1TMonitor/interface/L1TStage2uGMT.h +++ b/DQM/L1TMonitor/interface/L1TStage2uGMT.h @@ -203,6 +203,7 @@ class L1TStage2uGMT : public DQMEDAnalyzer { MonitorElement* ugmtMuMuDPhiEneg; MonitorElement* ugmtMuMuDREneg; + static constexpr unsigned IDX_LOOSE_SHOWER{3}; static constexpr unsigned IDX_TIGHT_SHOWER{2}; static constexpr unsigned IDX_NOMINAL_SHOWER{1}; }; diff --git a/DQM/L1TMonitor/interface/L1TStage2uGMTInputBxDistributions.h b/DQM/L1TMonitor/interface/L1TStage2uGMTInputBxDistributions.h index 05a99175ddded..e00f27f63e892 100644 --- a/DQM/L1TMonitor/interface/L1TStage2uGMTInputBxDistributions.h +++ b/DQM/L1TMonitor/interface/L1TStage2uGMTInputBxDistributions.h @@ -52,6 +52,7 @@ class L1TStage2uGMTInputBxDistributions : public DQMEDAnalyzer { MonitorElement* ugmtEMTFBXvsProcessor; MonitorElement* ugmtBXvsLink; + static constexpr unsigned IDX_LOOSE_SHOWER{3}; static constexpr unsigned IDX_TIGHT_SHOWER{2}; static constexpr unsigned IDX_NOMINAL_SHOWER{1}; }; diff --git a/DQM/L1TMonitor/src/L1TStage2MuonShowerComp.cc b/DQM/L1TMonitor/src/L1TStage2MuonShowerComp.cc index 581202d783102..173c411764602 100644 --- a/DQM/L1TMonitor/src/L1TStage2MuonShowerComp.cc +++ b/DQM/L1TMonitor/src/L1TStage2MuonShowerComp.cc @@ -56,6 +56,7 @@ void L1TStage2MuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, const e summary_->setBinLabel(SHOWERGOOD, "# matching showers", 1); summary_->setBinLabel(NOMINALBAD, "nominal shower mismatch", 1); summary_->setBinLabel(TIGHTBAD, "tight shower mismatch", 1); + summary_->setBinLabel(LOOSEBAD, "loose shower mismatch", 1); errorSummaryNum_ = ibooker.book1D("errorSummaryNum", summaryTitle_.c_str(), @@ -67,6 +68,7 @@ void L1TStage2MuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, const e errorSummaryNum_->setBinLabel(RSHOWER, "mismatching showers", 1); errorSummaryNum_->setBinLabel(RNOMINAL, "nominal shower mismatch", 1); errorSummaryNum_->setBinLabel(RTIGHT, "tight shower mismatch", 1); + errorSummaryNum_->setBinLabel(RLOOSE, "loose shower mismatch", 1); // Change the label for those bins that will be ignored for (int i = 1; i <= errorSummaryNum_->getNbinsX(); i++) { @@ -100,13 +102,14 @@ void L1TStage2MuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, const e 7, -3.5, 3.5, - 2, + 3, 1, - 3); + 4); showerColl1ShowerTypeVsBX_->setAxisTitle("BX", 1); showerColl1ShowerTypeVsBX_->setAxisTitle("Shower type", 2); - showerColl1ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl1ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_LOOSE_SHOWER, "TwoLoose", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); showerColl2BxRange_ = ibooker.book1D("showerBxRangeColl2", (showerColl2Title_ + " mismatching BX range").c_str(), 11, -5.5, 5.5); @@ -119,13 +122,14 @@ void L1TStage2MuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, const e 7, -3.5, 3.5, - 2, + 3, 1, - 3); + 4); showerColl2ShowerTypeVsBX_->setAxisTitle("BX", 1); showerColl2ShowerTypeVsBX_->setAxisTitle("Shower type", 2); - showerColl2ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl2ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_LOOSE_SHOWER, "TwoLoose", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); } void L1TStage2MuonShowerComp::analyze(const edm::Event& e, const edm::EventSetup& c) { @@ -184,6 +188,9 @@ void L1TStage2MuonShowerComp::analyze(const edm::Event& e, const edm::EventSetup if (showerIt1->isOneTightInTime()) { showerColl1ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt1->isTwoLooseDiffSectorsInTime()) { + showerColl1ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } } } else { showerIt2 = showerBxColl2->begin(iBx) + showerBxColl1->size(iBx); @@ -194,6 +201,9 @@ void L1TStage2MuonShowerComp::analyze(const edm::Event& e, const edm::EventSetup if (showerIt2->isOneTightInTime()) { showerColl2ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt2->isTwoLooseDiffSectorsInTime()) { + showerColl2ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } } } } else { @@ -238,6 +248,9 @@ void L1TStage2MuonShowerComp::analyze(const edm::Event& e, const edm::EventSetup if (showerIt1->isOneTightInTime()) { showerColl1ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt1->isTwoLooseDiffSectorsInTime()) { + showerColl1ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } if (showerIt2->isOneNominalInTime()) { showerColl2ShowerTypeVsBX_->Fill(IDX_NOMINAL_SHOWER, iBx); @@ -245,6 +258,9 @@ void L1TStage2MuonShowerComp::analyze(const edm::Event& e, const edm::EventSetup if (showerIt2->isOneTightInTime()) { showerColl2ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt2->isTwoLooseDiffSectorsInTime()) { + showerColl2ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } } else { summary_->Fill(SHOWERGOOD); } diff --git a/DQM/L1TMonitor/src/L1TStage2RegionalMuonShowerComp.cc b/DQM/L1TMonitor/src/L1TStage2RegionalMuonShowerComp.cc index 86d44a3600f41..472101b77d1f6 100644 --- a/DQM/L1TMonitor/src/L1TStage2RegionalMuonShowerComp.cc +++ b/DQM/L1TMonitor/src/L1TStage2RegionalMuonShowerComp.cc @@ -60,6 +60,7 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, summary_->setBinLabel(SHOWERGOOD, "# matching showers", 1); summary_->setBinLabel(NOMINALBAD, "nominal shower mismatch", 1); summary_->setBinLabel(TIGHTBAD, "tight shower mismatch", 1); + summary_->setBinLabel(LOOSEBAD, "loose shower mismatch", 1); errorSummaryNum_ = ibooker.book1D("errorSummaryNum", summaryTitle_.c_str(), @@ -71,6 +72,7 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, errorSummaryNum_->setBinLabel(RSHOWER, "mismatching showers", 1); errorSummaryNum_->setBinLabel(RNOMINAL, "nominal shower mismatch", 1); errorSummaryNum_->setBinLabel(RTIGHT, "tight shower mismatch", 1); + errorSummaryNum_->setBinLabel(RLOOSE, "loose shower mismatch", 1); // Change the label for those bins that will be ignored for (int i = 1; i <= errorSummaryNum_->getNbinsX(); i++) { @@ -105,9 +107,9 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, 12, 1, 13, - 2, + 3, 1, - 3); + 4); showerColl1ShowerTypeVsProcessor_->setAxisTitle("Processor", 1); showerColl1ShowerTypeVsProcessor_->setBinLabel(12, "+6", 1); showerColl1ShowerTypeVsProcessor_->setBinLabel(11, "+5", 1); @@ -122,20 +124,22 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, showerColl1ShowerTypeVsProcessor_->setBinLabel(2, "-2", 1); showerColl1ShowerTypeVsProcessor_->setBinLabel(1, "-1", 1); showerColl1ShowerTypeVsProcessor_->setAxisTitle("Shower type", 2); - showerColl1ShowerTypeVsProcessor_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl1ShowerTypeVsProcessor_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl1ShowerTypeVsProcessor_->setBinLabel(IDX_LOOSE_SHOWER, "OneLoose", 2); + showerColl1ShowerTypeVsProcessor_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl1ShowerTypeVsProcessor_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); showerColl1ShowerTypeVsBX_ = ibooker.book2D("showerColl1ShowerTypeVsBX", showerColl1Title_ + " mismatching shower type occupancy per BX", 7, -3.5, 3.5, - 2, + 3, 1, - 3); + 4); showerColl1ShowerTypeVsBX_->setAxisTitle("BX", 1); showerColl1ShowerTypeVsBX_->setAxisTitle("Shower type", 2); - showerColl1ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl1ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_LOOSE_SHOWER, "OneLoose", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl1ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); showerColl1ProcessorVsBX_ = ibooker.book2D("showerColl1ProcessorVsBX", showerColl1Title_ + " mismatching shower BX occupancy per sector", 7, @@ -171,9 +175,9 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, 12, 1, 13, - 2, + 3, 1, - 3); + 4); showerColl2ShowerTypeVsProcessor_->setAxisTitle("Processor", 1); showerColl2ShowerTypeVsProcessor_->setBinLabel(12, "+6", 1); showerColl2ShowerTypeVsProcessor_->setBinLabel(11, "+5", 1); @@ -188,20 +192,22 @@ void L1TStage2RegionalMuonShowerComp::bookHistograms(DQMStore::IBooker& ibooker, showerColl2ShowerTypeVsProcessor_->setBinLabel(2, "-2", 1); showerColl2ShowerTypeVsProcessor_->setBinLabel(1, "-1", 1); showerColl2ShowerTypeVsProcessor_->setAxisTitle("Shower type", 2); - showerColl2ShowerTypeVsProcessor_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl2ShowerTypeVsProcessor_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl2ShowerTypeVsProcessor_->setBinLabel(IDX_LOOSE_SHOWER, "OneLoose", 2); + showerColl2ShowerTypeVsProcessor_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl2ShowerTypeVsProcessor_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); showerColl2ShowerTypeVsBX_ = ibooker.book2D("showerColl2ShowerTypeVsBX", showerColl2Title_ + " mismatching shower type occupancy per BX", 7, -3.5, 3.5, - 2, + 3, 1, - 3); + 4); showerColl2ShowerTypeVsBX_->setAxisTitle("BX", 1); showerColl2ShowerTypeVsBX_->setAxisTitle("Shower type", 2); - showerColl2ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - showerColl2ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "OneLoose", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + showerColl2ShowerTypeVsBX_->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); showerColl2ProcessorVsBX_ = ibooker.book2D("showerColl2ProcessorVsBX", showerColl2Title_ + " mismatching shower BX occupancy per sector", 7, @@ -287,6 +293,12 @@ void L1TStage2RegionalMuonShowerComp::analyze(const edm::Event& e, const edm::Ev showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); showerColl1ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt1->isOneLooseInTime()) { + showerColl1ShowerTypeVsProcessor_->Fill( + IDX_LOOSE_SHOWER, + showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); + showerColl1ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } showerColl1ProcessorVsBX_->Fill( showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), iBx); } @@ -305,6 +317,12 @@ void L1TStage2RegionalMuonShowerComp::analyze(const edm::Event& e, const edm::Ev showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); showerColl2ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt2->isOneLooseInTime()) { + showerColl2ShowerTypeVsProcessor_->Fill( + IDX_LOOSE_SHOWER, + showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); + showerColl2ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } showerColl2ProcessorVsBX_->Fill( showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), iBx); } @@ -339,6 +357,14 @@ void L1TStage2RegionalMuonShowerComp::analyze(const edm::Event& e, const edm::Ev errorSummaryNum_->Fill(RTIGHT); } } + if (showerIt1->isOneLooseInTime() != showerIt2->isOneLooseInTime()) { + showerMismatch = true; + summary_->Fill(LOOSEBAD); + if (incBin_[RLOOSE]) { + showerSelMismatch = true; + errorSummaryNum_->Fill(RLOOSE); + } + } if (incBin_[RSHOWER] && showerSelMismatch) { errorSummaryNum_->Fill(RSHOWER); } @@ -356,6 +382,12 @@ void L1TStage2RegionalMuonShowerComp::analyze(const edm::Event& e, const edm::Ev showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); showerColl1ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt1->isOneLooseInTime()) { + showerColl1ShowerTypeVsProcessor_->Fill( + IDX_LOOSE_SHOWER, + showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); + showerColl1ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } showerColl1ProcessorVsBX_->Fill( showerIt1->processor() + 1 + (showerIt1->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), iBx); @@ -371,6 +403,12 @@ void L1TStage2RegionalMuonShowerComp::analyze(const edm::Event& e, const edm::Ev showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); showerColl2ShowerTypeVsBX_->Fill(IDX_TIGHT_SHOWER, iBx); } + if (showerIt2->isOneLooseInTime()) { + showerColl2ShowerTypeVsProcessor_->Fill( + IDX_LOOSE_SHOWER, + showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); + showerColl2ShowerTypeVsBX_->Fill(IDX_LOOSE_SHOWER, iBx); + } showerColl2ProcessorVsBX_->Fill( showerIt2->processor() + 1 + (showerIt2->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), iBx); diff --git a/DQM/L1TMonitor/src/L1TStage2uGMT.cc b/DQM/L1TMonitor/src/L1TStage2uGMT.cc index ca07458eb827e..b187aa494e821 100644 --- a/DQM/L1TMonitor/src/L1TStage2uGMT.cc +++ b/DQM/L1TMonitor/src/L1TStage2uGMT.cc @@ -243,7 +243,7 @@ void L1TStage2uGMT::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, ibooker.setCurrentFolder(monitorDir_ + "/EMTFInput/Muon showers"); ugmtEMTFShowerTypeOccupancyPerSector = ibooker.book2D( - "ugmtEMTFShowerTypeOccupancyPerSector", "Shower type occupancy per sector", 12, 1, 13, 2, 1, 3); + "ugmtEMTFShowerTypeOccupancyPerSector", "Shower type occupancy per sector", 12, 1, 13, 3, 1, 4); ugmtEMTFShowerTypeOccupancyPerSector->setAxisTitle("Processor", 1); ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(12, "+6", 1); ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(11, "+5", 1); @@ -258,8 +258,9 @@ void L1TStage2uGMT::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(2, "-2", 1); ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(1, "-1", 1); ugmtEMTFShowerTypeOccupancyPerSector->setAxisTitle("Shower type", 2); - ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_LOOSE_SHOWER, "OneLoose", 2); + ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); } // inter-TF muon correlations @@ -510,11 +511,12 @@ void L1TStage2uGMT::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, if (hadronicShowers_) { ugmtMuonShowerTypeOccupancyPerBx = - ibooker.book2D("ugmtMuonShowerTypeOccupancyPerBx", "Shower type occupancy per BX", 7, -3.5, 3.5, 2, 1, 3); + ibooker.book2D("ugmtMuonShowerTypeOccupancyPerBx", "Shower type occupancy per BX", 7, -3.5, 3.5, 3, 1, 4); ugmtMuonShowerTypeOccupancyPerBx->setAxisTitle("BX", 1); ugmtMuonShowerTypeOccupancyPerBx->setAxisTitle("Shower type", 2); - ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); - ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); + ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_LOOSE_SHOWER, "TwoLoose", 2); + ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2); + ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2); } ugmtMuonBXvshwPt = @@ -859,6 +861,11 @@ void L1TStage2uGMT::analyze(const edm::Event& e, const edm::EventSetup& c) { shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), IDX_TIGHT_SHOWER); } + if (shower->isOneLooseInTime()) { + ugmtEMTFShowerTypeOccupancyPerSector->Fill( + shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0), + IDX_LOOSE_SHOWER); + } } } } @@ -1096,6 +1103,9 @@ void L1TStage2uGMT::analyze(const edm::Event& e, const edm::EventSetup& c) { if (shower->isOneTightInTime()) { ugmtMuonShowerTypeOccupancyPerBx->Fill(itBX, IDX_TIGHT_SHOWER); } + if (shower->isTwoLooseDiffSectorsInTime()) { + ugmtMuonShowerTypeOccupancyPerBx->Fill(itBX, IDX_LOOSE_SHOWER); + } } } } diff --git a/DQM/L1TMonitor/src/L1TStage2uGMTInputBxDistributions.cc b/DQM/L1TMonitor/src/L1TStage2uGMTInputBxDistributions.cc index a4a535770380c..3725ae85a1a7e 100644 --- a/DQM/L1TMonitor/src/L1TStage2uGMTInputBxDistributions.cc +++ b/DQM/L1TMonitor/src/L1TStage2uGMTInputBxDistributions.cc @@ -63,9 +63,10 @@ void L1TStage2uGMTInputBxDistributions::bookHistograms(DQMStore::IBooker& ibooke ibooker.setCurrentFolder(monitorDir_ + "/EMTFInput/Muon showers"); ugmtEMTFShowerTypeOccupancyPerBx = - ibooker.book2D("ugmtEMTFShowerTypeOccupancyPerBx", "Shower type occupancy per BX", 7, -3.5, 3.5, 2, 1, 3); + ibooker.book2D("ugmtEMTFShowerTypeOccupancyPerBx", "Shower type occupancy per BX", 7, -3.5, 3.5, 3, 1, 4); ugmtEMTFShowerTypeOccupancyPerBx->setAxisTitle("BX", 1); ugmtEMTFShowerTypeOccupancyPerBx->setAxisTitle("Shower type", 2); + ugmtEMTFShowerTypeOccupancyPerBx->setBinLabel(IDX_LOOSE_SHOWER, "Loose", 2); ugmtEMTFShowerTypeOccupancyPerBx->setBinLabel(IDX_TIGHT_SHOWER, "Tight", 2); ugmtEMTFShowerTypeOccupancyPerBx->setBinLabel(IDX_NOMINAL_SHOWER, "Nominal", 2); @@ -215,6 +216,11 @@ void L1TStage2uGMTInputBxDistributions::analyze(const edm::Event& e, const edm:: itBX, shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); ugmtEMTFShowerTypeOccupancyPerBx->Fill(itBX, IDX_TIGHT_SHOWER); } + if (shower->isOneLooseInTime()) { + ugmtEMTFShowerSectorOccupancyPerBx->Fill( + itBX, shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0)); + ugmtEMTFShowerTypeOccupancyPerBx->Fill(itBX, IDX_LOOSE_SHOWER); + } } } } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc index ecac8989df441..3f5e3c6f6bc21 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc @@ -221,17 +221,17 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hCharge_->Fill(helper::charge(tsoaCPU.view(), it), helper::charge(tsoaGPU.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaCPU.view(), it), helper::nHits(tsoaGPU.view(), closestTkidx)); hnLayers_->Fill(tsoaCPU.view()[it].nLayers(), tsoaGPU.view()[closestTkidx].nLayers()); - hpt_->Fill(tsoaCPU.view()[it].pt(), tsoaGPU.view()[closestTkidx].pt()); - hptLogLog_->Fill(tsoaCPU.view()[it].pt(), tsoaGPU.view()[closestTkidx].pt()); + hpt_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); + hptLogLog_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); heta_->Fill(etaCPU, tsoaGPU.view()[closestTkidx].eta()); - hphi_->Fill(etaCPU, helper::phi(tsoaGPU.view(), closestTkidx)); + hphi_->Fill(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx)); hz_->Fill(zipCPU, helper::zip(tsoaGPU.view(), closestTkidx)); htip_->Fill(tipCPU, helper::tip(tsoaGPU.view(), closestTkidx)); - hptdiffMatched_->Fill(tsoaCPU.view()[it].pt() - tsoaGPU.view()[closestTkidx].pt()); + hptdiffMatched_->Fill(ptCPU - tsoaGPU.view()[closestTkidx].pt()); hCurvdiffMatched_->Fill((helper::charge(tsoaCPU.view(), it) / tsoaCPU.view()[it].pt()) - (helper::charge(tsoaGPU.view(), closestTkidx) / tsoaGPU.view()[closestTkidx].pt())); hetadiffMatched_->Fill(etaCPU - tsoaGPU.view()[closestTkidx].eta()); - hphidiffMatched_->Fill(reco::deltaPhi(etaCPU, helper::phi(tsoaGPU.view(), closestTkidx))); + hphidiffMatched_->Fill(reco::deltaPhi(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx))); hzdiffMatched_->Fill(zipCPU - helper::zip(tsoaGPU.view(), closestTkidx)); htipdiffMatched_->Fill(tipCPU - helper::tip(tsoaGPU.view(), closestTkidx)); hpt_eta_tkAllCPUMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py index a2e0da8bddb68..5b409b5b7fa6f 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OfflineDQM_source_cff.py @@ -25,7 +25,7 @@ -from RecoPixelVertexing.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * +from RecoTracker.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import * from DQM.SiPixelPhase1Track.SiPixelPhase1EfficiencyExtras_cfi import * diff --git a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml index 9445daca14d82..a0c196d8fa185 100644 --- a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml +++ b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml @@ -1,6 +1,6 @@ - + diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1ResidualsExtra.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1ResidualsExtra.cc index 12ffbbd835709..cb15ea5fdc213 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1ResidualsExtra.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1ResidualsExtra.cc @@ -76,10 +76,10 @@ void SiPixelPhase1ResidualsExtra::bookMEs(DQMStore::IBooker& iBooker) { iBooker.setCurrentFolder(topFolderName_ + "/PXBarrel"); for (std::string layer : {"1", "2", "3", "4"}) { - float mean_range = 100.; + float mean_range = 20.; float rms_range = 200.; if (layer == "1") { - mean_range = 200.; + mean_range = 50.; rms_range = 1000.; } residuals_["residual_mean_x_Inner_PXLayer_" + layer] = @@ -136,64 +136,64 @@ void SiPixelPhase1ResidualsExtra::bookMEs(DQMStore::IBooker& iBooker) { "NormRes_mean_x_Inner_PXLayer_" + layer, "Mean of Normalized Track Residuals X Inner Modules for Layer " + layer + ";mean((x_rec-x_pred)/x_err)", 100, - -1 * 5, - 5); + -1 * 1, + 1); DRnR_["NormRes_mean_x_Outer_PXLayer_" + layer] = iBooker.book1D( "NormRes_mean_x_Outer_PXLayer_" + layer, "Mean of Normalized Track Residuals X Outer Modules for Layer " + layer + ";mean((x_rec-x_pred)/x_err)", 100, - -1 * 5, - 5); + -1 * 1, + 1); DRnR_["NormRes_mean_y_Inner_PXLayer_" + layer] = iBooker.book1D( "NormRes_mean_y_Inner_PXLayer_" + layer, "Mean of Normalized Track Residuals Y Inner Modules for Layer " + layer + ";mean((y_rec-y_pred)/y_err)", 100, - -1 * 5, - 5); + -1 * 1, + 1); DRnR_["NormRes_mean_y_Outer_PXLayer_" + layer] = iBooker.book1D( "NormRes_mean_y_Outer_PXLayer_" + layer, "Mean of Normalized Track Residuals Y Outer Modules for Layer " + layer + ";mean((y_rec-y_pred)/y_err)", 100, - -1 * 5, - 5); + -1 * 1, + 1); DRnR_["DRnR_x_Inner_PXLayer_" + layer] = iBooker.book1D( "DRnR_x_Inner_PXLayer_" + layer, "RMS of Normalized Track Residuals X Inner Modules for Layer " + layer + ";rms((x_rec-x_pred)/x_err)", 100, 0., - 5); + 2); DRnR_["DRnR_x_Outer_PXLayer_" + layer] = iBooker.book1D( "DRnR_x_Outer_PXLayer_" + layer, "RMS of Normalized Track Residuals X Outer Modules for Layer " + layer + ";rms((x_rec-x_pred)/x_err)", 100, 0., - 5); + 2); DRnR_["DRnR_y_Inner_PXLayer_" + layer] = iBooker.book1D( "DRnR_y_Inner_PXLayer_" + layer, "RMS of Normalized Track Residuals Y Inner Modules for Layer " + layer + ";rms((y_rec-y_pred)/y_err)", 100, 0., - 5); + 2); DRnR_["DRnR_y_Outer_PXLayer_" + layer] = iBooker.book1D( "DRnR_y_Outer_PXLayer_" + layer, "RMS of Normalized Track Residuals Y Outer Modules for Layer " + layer + ";rms((y_rec-y_pred)/y_err)", 100, 0., - 5); + 2); } //New residual plots for the PXForward separated by inner and outer modules iBooker.setCurrentFolder(topFolderName_ + "/PXForward"); residuals_["residual_mean_x_Inner"] = iBooker.book1D( - "residual_mean_x_Inner", "Mean of Track Residuals X Inner Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.); + "residual_mean_x_Inner", "Mean of Track Residuals X Inner Modules;mean(x_rec-x_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_x_Outer"] = iBooker.book1D( - "residual_mean_x_Outer", "Mean of Track Residuals X Outer Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.); + "residual_mean_x_Outer", "Mean of Track Residuals X Outer Modules;mean(x_rec-x_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_y_Inner"] = iBooker.book1D( - "residual_mean_y_Inner", "Mean of Track Residuals Y Inner Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.); + "residual_mean_y_Inner", "Mean of Track Residuals Y Inner Modules;mean(y_rec-y_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_y_Outer"] = iBooker.book1D( - "residual_mean_y_Outer", "Mean of Track Residuals Y Outer Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.); + "residual_mean_y_Outer", "Mean of Track Residuals Y Outer Modules;mean(y_rec-y_pred)[#mum]", 100, -20., 20.); residuals_["residual_rms_x_Inner"] = iBooker.book1D( "residual_rms_x_Inner", "RMS of Track Residuals X Inner Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.); @@ -208,47 +208,47 @@ void SiPixelPhase1ResidualsExtra::bookMEs(DQMStore::IBooker& iBooker) { iBooker.book1D("NormRes_mean_x_Inner", "Mean of Normalized Track Residuals X Inner Modules;mean((x_rec-x_pred)/x_err)", 100, - -5., - 5.); + -1., + 1.); DRnR_["NormRes_mean_x_Outer"] = iBooker.book1D("NormRes_mean_x_Outer", "Mean of Normalized Track Residuals X Outer Modules;mean((x_rec-x_pred)/x_err)", 100, - -5., - 5.); + -1., + 1.); DRnR_["NormRes_mean_y_Inner"] = iBooker.book1D("NormRes_mean_y_Inner", "Mean of Normalized Track Residuals Y Inner Modules;mean((y_rec-y_pred)/y_err)", 100, - -5., - 5.); + -1., + 1.); DRnR_["NormRes_mean_y_Outer"] = iBooker.book1D("NormRes_mean_y_Outer", "Mean of Normalized Track Residuals Y Outer Modules;mean((y_rec-y_pred)/y_err)", 100, - -5., - 5.); + -1., + 1.); DRnR_["DRnR_x_Inner"] = iBooker.book1D( - "DRnR_x_Inner", "RMS of Normalized Track Residuals X Inner Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 5.); + "DRnR_x_Inner", "RMS of Normalized Track Residuals X Inner Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 2.); DRnR_["DRnR_x_Outer"] = iBooker.book1D( - "DRnR_x_Outer", "RMS of Normalized Track Residuals X Outer Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 5.); + "DRnR_x_Outer", "RMS of Normalized Track Residuals X Outer Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 2.); DRnR_["DRnR_y_Inner"] = iBooker.book1D( - "DRnR_y_Inner", "RMS of Normalized Track Residuals Y Inner Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 5.); + "DRnR_y_Inner", "RMS of Normalized Track Residuals Y Inner Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 2.); DRnR_["DRnR_y_Outer"] = iBooker.book1D( - "DRnR_y_Outer", "RMS of Normalized Track Residuals Y Outer Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 5.); + "DRnR_y_Outer", "RMS of Normalized Track Residuals Y Outer Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 2.); //New residual plots for the PXForward separated by positive and negative side iBooker.setCurrentFolder(topFolderName_ + "/PXForward"); residuals_["residual_mean_x_pos"] = iBooker.book1D( - "residual_mean_x_pos", "Mean of Track Residuals X pos. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.); + "residual_mean_x_pos", "Mean of Track Residuals X pos. Side;mean(x_rec-x_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_x_neg"] = iBooker.book1D( - "residual_mean_x_neg", "Mean of Track Residuals X neg. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.); + "residual_mean_x_neg", "Mean of Track Residuals X neg. Side;mean(x_rec-x_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_y_pos"] = iBooker.book1D( - "residual_mean_y_pos", "Mean of Track Residuals Y pos. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.); + "residual_mean_y_pos", "Mean of Track Residuals Y pos. Side;mean(y_rec-y_pred)[#mum]", 100, -20., 20.); residuals_["residual_mean_y_neg"] = iBooker.book1D( - "residual_mean_y_neg", "Mean of Track Residuals Y neg. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.); + "residual_mean_y_neg", "Mean of Track Residuals Y neg. Side;mean(y_rec-y_pred)[#mum]", 100, -20., 20.); residuals_["residual_rms_x_pos"] = iBooker.book1D("residual_rms_x_pos", "RMS of Track Residuals X pos. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.); @@ -260,22 +260,22 @@ void SiPixelPhase1ResidualsExtra::bookMEs(DQMStore::IBooker& iBooker) { iBooker.book1D("residual_rms_y_neg", "RMS of Track Residuals Y neg. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.); //Normalized Residuals pos/neg DRnR_["NormRes_mean_x_pos"] = iBooker.book1D( - "NormRes_mean_x_pos", "Mean of Normalized Track Residuals X pos. Side;mean((x_rec-x_pred)/x_err)", 100, -5., 5.); + "NormRes_mean_x_pos", "Mean of Normalized Track Residuals X pos. Side;mean((x_rec-x_pred)/x_err)", 100, -1., 1.); DRnR_["NormRes_mean_x_neg"] = iBooker.book1D( - "NormRes_mean_x_neg", "Mean of Normalized Track Residuals X neg. Side;mean((x_rec-x_pred)/x_err)", 100, -5., 5.); + "NormRes_mean_x_neg", "Mean of Normalized Track Residuals X neg. Side;mean((x_rec-x_pred)/x_err)", 100, -1., 1.); DRnR_["NormRes_mean_y_pos"] = iBooker.book1D( - "NormRes_mean_y_pos", "Mean of Normalized Track Residuals Y pos. Side;mean((y_rec-y_pred)/y_err)", 100, -5., 5.); + "NormRes_mean_y_pos", "Mean of Normalized Track Residuals Y pos. Side;mean((y_rec-y_pred)/y_err)", 100, -1., 1.); DRnR_["NormRes_mean_y_neg"] = iBooker.book1D( - "NormRes_mean_y_neg", "Mean of Normalized Track Residuals Y neg. Side;mean((y_rec-y_pred)/y_err)", 100, -5., 5.); + "NormRes_mean_y_neg", "Mean of Normalized Track Residuals Y neg. Side;mean((y_rec-y_pred)/y_err)", 100, -1., 1.); DRnR_["DRnR_x_pos"] = iBooker.book1D( - "DRnR_x_pos", "RMS of Normalized Track Residuals X pos. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 5.); + "DRnR_x_pos", "RMS of Normalized Track Residuals X pos. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 2.); DRnR_["DRnR_x_neg"] = iBooker.book1D( - "DRnR_x_neg", "RMS of Normalized Track Residuals X neg. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 5.); + "DRnR_x_neg", "RMS of Normalized Track Residuals X neg. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 2.); DRnR_["DRnR_y_pos"] = iBooker.book1D( - "DRnR_y_pos", "RMS of Normalized Track Residuals Y pos. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 5.); + "DRnR_y_pos", "RMS of Normalized Track Residuals Y pos. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 2.); DRnR_["DRnR_y_neg"] = iBooker.book1D( - "DRnR_y_neg", "RMS of Normalized Track Residuals Y neg. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 5.); + "DRnR_y_neg", "RMS of Normalized Track Residuals Y neg. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 2.); //Reset the iBooker iBooker.setCurrentFolder("PixelPhase1/"); diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 4f57ba4617981..e0772b2f3cf7e 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -29,7 +29,7 @@ #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "RecoTracker/Record/interface/CkfComponentsRecord.h" -#include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" +#include "RecoTracker/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h" #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" diff --git a/DQM/SiStripMonitorClient/python/RecoForDQM_cff.py b/DQM/SiStripMonitorClient/python/RecoForDQM_cff.py index 06fe407f1f6f7..004ca3bc88986 100644 --- a/DQM/SiStripMonitorClient/python/RecoForDQM_cff.py +++ b/DQM/SiStripMonitorClient/python/RecoForDQM_cff.py @@ -21,7 +21,7 @@ from RecoVertex.BeamSpotProducer.BeamSpot_cff import * # Pixel Vertex -from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * +from RecoTracker.Configuration.RecoPixelVertexing_cff import * # Reconstruction Sequence RecoForDQMCollision = cms.Sequence(siPixelDigis*siStripDigis*trackerlocalreco*offlineBeamSpot*recopixelvertexing*ckftracks) diff --git a/DQM/SiStripMonitorClient/test/BuildFile.xml b/DQM/SiStripMonitorClient/test/BuildFile.xml index 8a7122cadca52..1b390c2c801f1 100644 --- a/DQM/SiStripMonitorClient/test/BuildFile.xml +++ b/DQM/SiStripMonitorClient/test/BuildFile.xml @@ -1,9 +1,3 @@ - - - - + - - - - + diff --git a/DQM/SiStripMonitorClient/test/TestDriver.cpp b/DQM/SiStripMonitorClient/test/TestDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/DQM/SiStripMonitorClient/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh index 8d71811739e19..78d64afb63cea 100755 --- a/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh +++ b/DQM/SiStripMonitorClient/test/test_SiStripDQM_OfflineTkMap.sh @@ -7,8 +7,8 @@ COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $DQMFILE` STATUS=$? echo "xrdfs command status = "$STATUS if [ $STATUS -eq 0 ]; then - echo "Using file ${DQMFILE} and run ${RUN}. Running in ${LOCAL_TEST_DIR}." - (cmsRun "${LOCAL_TEST_DIR}/SiStripDQM_OfflineTkMap_Template_cfg_DB.py" globalTag="$GT" runNumber="$RUN" dqmFile=" root://cms-xrd-global.cern.ch//$DQMFILE" detIdInfoFile="file.root") || die 'failed running SiStripDQM_OfflineTkMap_Template_cfg_DB.py' $? + echo "Using file ${DQMFILE} and run ${RUN}. Running in ${SCRAM_TEST_PATH}." + (cmsRun "${SCRAM_TEST_PATH}/SiStripDQM_OfflineTkMap_Template_cfg_DB.py" globalTag="$GT" runNumber="$RUN" dqmFile=" root://cms-xrd-global.cern.ch//$DQMFILE" detIdInfoFile="file.root") || die 'failed running SiStripDQM_OfflineTkMap_Template_cfg_DB.py' $? else die "SKIPPING test, file ${DQMFILE} not found" 0 fi diff --git a/DQM/SiStripMonitorClient/test/test_TreeAndTkMapProducer.sh b/DQM/SiStripMonitorClient/test/test_TreeAndTkMapProducer.sh index c7454204fe437..3f901dcd737a3 100755 --- a/DQM/SiStripMonitorClient/test/test_TreeAndTkMapProducer.sh +++ b/DQM/SiStripMonitorClient/test/test_TreeAndTkMapProducer.sh @@ -5,10 +5,10 @@ COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $DQMFILE` STATUS=$? echo "xrdfs command status = "$STATUS if [ $STATUS -eq 0 ]; then - echo "Using file ${DQMFILE} Running in ${LOCAL_TEST_DIR}." + echo "Using file ${DQMFILE} Running in ${SCRAM_TEST_PATH}." xrdcp root://cms-xrd-global.cern.ch//$DQMFILE DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root - (python3 ${LOCAL_TEST_DIR}/../scripts/PhaseITreeProducer.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root) || die 'failed running PhaseITreeProducer.py' $? - (python3 ${LOCAL_TEST_DIR}/../scripts/TH2PolyOfflineMaps.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root 3000 2000 ) || die 'failed running TH2PolyOfflineMaps.py' $? + (python3 ${SCRAM_TEST_PATH}/../scripts/PhaseITreeProducer.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root) || die 'failed running PhaseITreeProducer.py' $? + (python3 ${SCRAM_TEST_PATH}/../scripts/TH2PolyOfflineMaps.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root 3000 2000 ) || die 'failed running TH2PolyOfflineMaps.py' $? else die "SKIPPING test, file ${DQMFILE} not found" 0 fi diff --git a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h index 2f6f809ce4c91..ba6fb36ea7d91 100644 --- a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h +++ b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h @@ -231,10 +231,14 @@ class SiStripMonitorTrack : public DQMEDAnalyzer { struct SubDetMEs { int totNClustersOnTrack = 0; int totNClustersOffTrack = 0; + int totNClustersOnTrackMono = 0; + int totNClustersOnTrackStereo = 0; MonitorElement* nClustersOnTrack = nullptr; MonitorElement* nClustersTrendOnTrack = nullptr; MonitorElement* nClustersOffTrack = nullptr; MonitorElement* nClustersTrendOffTrack = nullptr; + MonitorElement* nClustersOnTrackMono = nullptr; + MonitorElement* nClustersOnTrackStereo = nullptr; MonitorElement* ClusterGain = nullptr; MonitorElement* ClusterStoNCorrOnTrack = nullptr; MonitorElement* ClusterStoNCorrThinOnTrack = nullptr; diff --git a/DQM/SiStripMonitorTrack/python/SiStripMonitorTrack_cfi.py b/DQM/SiStripMonitorTrack/python/SiStripMonitorTrack_cfi.py index e627ea32c1076..6bff7b9a48791 100644 --- a/DQM/SiStripMonitorTrack/python/SiStripMonitorTrack_cfi.py +++ b/DQM/SiStripMonitorTrack/python/SiStripMonitorTrack_cfi.py @@ -35,6 +35,11 @@ xmin = cms.double(-0.5), xmax = cms.double(2999.5) ), + + TH1nClustersOnStereo = cms.PSet( Nbinx = cms.int32(50), + xmin = cms.double(-0.5), + xmax = cms.double(2999.5) + ), TH1nClustersOff = cms.PSet( Nbinx = cms.int32(100), xmin = cms.double(-0.5), diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index af024708468b1..55404eb338f2f 100644 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -146,6 +146,12 @@ void SiStripMonitorTrack::analyze(const edm::Event& e, const edm::EventSetup& iS if (subdet_mes.totNClustersOnTrack > 0) { fillME(subdet_mes.nClustersOnTrack, subdet_mes.totNClustersOnTrack); } + if (subdet_mes.totNClustersOnTrackMono > 0) { + fillME(subdet_mes.nClustersOnTrackMono, subdet_mes.totNClustersOnTrackMono); + } + if (subdet_mes.totNClustersOnTrackStereo > 0) { + fillME(subdet_mes.nClustersOnTrackStereo, subdet_mes.totNClustersOnTrackStereo); + } fillME(subdet_mes.nClustersOffTrack, subdet_mes.totNClustersOffTrack); fillME(subdet_mes.nClustersTrendOnTrack, iLumisection, subdet_mes.totNClustersOnTrack); fillME(subdet_mes.nClustersTrendOffTrack, iLumisection, subdet_mes.totNClustersOffTrack); @@ -156,6 +162,13 @@ void SiStripMonitorTrack::analyze(const edm::Event& e, const edm::EventSetup& iS if (subdet_mes.totNClustersOnTrack > 0) { fillME(subdet_mes.nClustersOnTrack, subdet_mes.totNClustersOnTrack); } + if (subdet_mes.totNClustersOnTrackMono > 0) { + fillME(subdet_mes.nClustersOnTrackMono, subdet_mes.totNClustersOnTrackMono); + } + if (subdet_mes.totNClustersOnTrackStereo > 0) { + fillME(subdet_mes.nClustersOnTrackStereo, subdet_mes.totNClustersOnTrackStereo); + } + fillME(subdet_mes.nClustersOffTrack, subdet_mes.totNClustersOffTrack); } } @@ -704,6 +717,13 @@ void SiStripMonitorTrack::bookSubDetMEs(DQMStore::IBooker& ibooker, std::string& theSubDetMEs.nClustersOnTrack->setAxisTitle(axisName); theSubDetMEs.nClustersOnTrack->setStatOverflows(kTRUE); + // TotalNumber of Cluster OnTrack + completeName = "Summary_TotalNumberOfClusters_OnTrackStereo" + subdet_tag; + axisName = "Number of on-track stereo clusters in " + name; + theSubDetMEs.nClustersOnTrackStereo = bookME1D(ibooker, "TH1nClustersOnStereo", completeName.c_str()); + theSubDetMEs.nClustersOnTrackStereo->setAxisTitle(axisName); + theSubDetMEs.nClustersOnTrackStereo->setStatOverflows(kTRUE); + // TotalNumber of Cluster OffTrack completeName = "Summary_TotalNumberOfClusters_OffTrack" + subdet_tag; axisName = "Number of off-track clusters in " + name; @@ -1552,8 +1572,13 @@ bool SiStripMonitorTrack::clusterInfos(SiStripClusterInfo* cluster, } if (flag == OnTrack) { - if (MEs.iSubdet != nullptr) + if (MEs.iSubdet != nullptr) { MEs.iSubdet->totNClustersOnTrack++; + if (StripSubdetector(detid).stereo() == 1) + MEs.iSubdet->totNClustersOnTrackStereo++; + else + MEs.iSubdet->totNClustersOnTrackMono++; + } // layerMEs if (MEs.iLayer != nullptr) { if (noise > 0.0) diff --git a/DQM/TrackerCommon/test/BuildFile.xml b/DQM/TrackerCommon/test/BuildFile.xml index 9d5be9741b38c..f7db4cffe77b1 100644 --- a/DQM/TrackerCommon/test/BuildFile.xml +++ b/DQM/TrackerCommon/test/BuildFile.xml @@ -1,6 +1 @@ - - - - - - + diff --git a/DQM/TrackerCommon/test/test_DetectorStateFilter.cpp b/DQM/TrackerCommon/test/test_DetectorStateFilter.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/DQM/TrackerCommon/test/test_DetectorStateFilter.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/DQM/TrackerCommon/test/test_DetectorStateFilter.sh b/DQM/TrackerCommon/test/test_DetectorStateFilter.sh index 2aa6a205d7532..f0be7dd6ee6ca 100755 --- a/DQM/TrackerCommon/test/test_DetectorStateFilter.sh +++ b/DQM/TrackerCommon/test/test_DetectorStateFilter.sh @@ -28,11 +28,11 @@ INPUTFILE="/store/express/Commissioning2020/ExpressCosmics/FEVT/Express-v1/000/3 # test Pixel printf "TESTING Pixels ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/test_DetectorStateFilter_cfg.py maxEvents=10 isStrip=False inputFiles=$INPUTFILE outputFile=outPixels.root || die "Failure filtering on pixels" $? +cmsRun ${SCRAM_TEST_PATH}/test_DetectorStateFilter_cfg.py maxEvents=10 isStrip=False inputFiles=$INPUTFILE outputFile=outPixels.root || die "Failure filtering on pixels" $? # test Strips printf "TESTING Strips ...\n\n" -cmsRun ${LOCAL_TEST_DIR}/test_DetectorStateFilter_cfg.py maxEvents=10 isStrip=True inputFiles=$INPUTFILE outputFile=outStrips.root || die "Failure filtering on strips" $? +cmsRun ${SCRAM_TEST_PATH}/test_DetectorStateFilter_cfg.py maxEvents=10 isStrip=True inputFiles=$INPUTFILE outputFile=outStrips.root || die "Failure filtering on strips" $? # count events pixelCounts=`countEvents outPixels_numEvent10.root` diff --git a/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h b/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h index 94100294294fc..3e963d1fba134 100644 --- a/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h +++ b/DQM/TrackingMonitor/interface/TrackSplittingMonitor.h @@ -40,22 +40,22 @@ class TProfile; class TrackSplittingMonitor : public DQMEDAnalyzer { public: explicit TrackSplittingMonitor(const edm::ParameterSet&); - ~TrackSplittingMonitor() override; + ~TrackSplittingMonitor() override = default; void analyze(const edm::Event&, const edm::EventSetup&) override; void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void doProfileX(TH2* th2, MonitorElement* me); void doProfileX(MonitorElement* th2m, MonitorElement* me); // ----------member data --------------------------- - - // unsigned int minTracks_; + static constexpr double cmToUm = 10.e4; + static constexpr double radToUrad = 10.e3; + static constexpr double sqrt2 = 1.41421356237; std::string histname; //for naming the histograms according to algorithm used - - DQMStore* dqmStore_; edm::ParameterSet conf_; const edm::ESGetToken mfToken_; @@ -70,18 +70,16 @@ class TrackSplittingMonitor : public DQMEDAnalyzer { const CSCGeometry* cscGeometry; const RPCGeometry* rpcGeometry; - edm::InputTag splitTracks_; - edm::InputTag splitMuons_; - edm::EDGetTokenT > splitTracksToken_; - edm::EDGetTokenT > splitMuonsToken_; - - bool plotMuons_; - int pixelHitsPerLeg_; - int totalHitsPerLeg_; - double d0Cut_; - double dzCut_; - double ptCut_; - double norchiCut_; + const edm::EDGetTokenT > splitTracksToken_; + const edm::EDGetTokenT > splitMuonsToken_; + + const bool plotMuons_; + const int pixelHitsPerLeg_; + const int totalHitsPerLeg_; + const double d0Cut_; + const double dzCut_; + const double ptCut_; + const double norchiCut_; // histograms MonitorElement* ddxyAbsoluteResiduals_tracker_; diff --git a/DQM/TrackingMonitor/python/TrackSplittingMonitor_cfi.py b/DQM/TrackingMonitor/python/TrackSplittingMonitor_cfi.py index 5d16a02b9989f..2a01053b53f88 100644 --- a/DQM/TrackingMonitor/python/TrackSplittingMonitor_cfi.py +++ b/DQM/TrackingMonitor/python/TrackSplittingMonitor_cfi.py @@ -5,47 +5,35 @@ import FWCore.ParameterSet.Config as cms -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -TrackSplitMonitor = DQMEDAnalyzer('TrackSplittingMonitor', - - FolderName = cms.string('TrackSplitMonitoring'), - - splitTrackCollection = cms.InputTag("splittedTracksP5"), - splitMuonCollection = cms.InputTag("splitMuons"), - ifPlotMuons = cms.bool(True), - - pixelHitsPerLeg = cms.int32( 1 ), - totalHitsPerLeg = cms.int32( 6 ), - d0Cut = cms.double( 12.0 ), - dzCut = cms.double( 25.0 ), - ptCut = cms.double( 4.0 ), - norchiCut = cms.double( 100.0 ), - - ddxyBin = cms.int32(100), - ddxyMin = cms.double(-200.0), - ddxyMax = cms.double(200.0), - - ddzBin = cms.int32(100), - ddzMin = cms.double(-400.0), - ddzMax = cms.double(400.0), - - dphiBin = cms.int32(100), - dphiMin = cms.double(-0.01), - dphiMax = cms.double(0.01), - - dthetaBin = cms.int32(100), - dthetaMin = cms.double(-0.01), - dthetaMax = cms.double(0.01), - - dptBin = cms.int32(100), - dptMin = cms.double(-5.0), - dptMax = cms.double(5.0), - - dcurvBin = cms.int32(100), - dcurvMin = cms.double(-0.005), - dcurvMax = cms.double(0.005), - - normBin = cms.int32(100), - normMin = cms.double(-5.0), - normMax = cms.double(5.0) -) +from DQM.TrackingMonitor.trackSplittingMonitor_cfi import trackSplittingMonitor +TrackSplitMonitor = trackSplittingMonitor.clone(FolderName = cms.string('TrackSplitMonitoring'), + splitTrackCollection = "splittedTracksP5", + splitMuonCollection = "splitMuons", + ifPlotMuons = True, + pixelHitsPerLeg = 1, + totalHitsPerLeg = 6 , + d0Cut = 12.0 , + dzCut = 25.0 , + ptCut = 4.0 , + norchiCut = 100.0 , + ddxyBin = 100 , + ddxyMin = -200.0 , + ddxyMax = 200.0 , + ddzBin = 100, + ddzMin = -400.0, + ddzMax = 400.0, + dphiBin = 100, + dphiMin = -0.01, + dphiMax = 0.01, + dthetaBin = 100, + dthetaMin = -0.01, + dthetaMax = 0.01, + dptBin = 100, + dptMin = -5.0, + dptMax = 5.0, + dcurvBin = 100, + dcurvMin = -0.005, + dcurvMax = 0.005, + normBin = 100, + normMin = -5.0, + normMax = 5.0) diff --git a/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc b/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc index 5c81a747fb6f0..997265c5c4868 100644 --- a/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackSplittingMonitor.cc @@ -20,40 +20,29 @@ #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -//#include "DQM/TrackingMonitor/interface/TrackAnalyzer.h" + #include TrackSplittingMonitor::TrackSplittingMonitor(const edm::ParameterSet& iConfig) - : dqmStore_(edm::Service().operator->()), - conf_(iConfig), + : conf_(iConfig), mfToken_(esConsumes()), tkGeomToken_(esConsumes()), dtGeomToken_(esConsumes()), cscGeomToken_(esConsumes()), - rpcGeomToken_(esConsumes()) { - splitTracks_ = conf_.getParameter("splitTrackCollection"); - splitMuons_ = conf_.getParameter("splitMuonCollection"); - splitTracksToken_ = consumes >(splitTracks_); - splitMuonsToken_ = mayConsume >(splitMuons_); - - plotMuons_ = conf_.getParameter("ifPlotMuons"); - - // cuts - pixelHitsPerLeg_ = conf_.getParameter("pixelHitsPerLeg"); - totalHitsPerLeg_ = conf_.getParameter("totalHitsPerLeg"); - d0Cut_ = conf_.getParameter("d0Cut"); - dzCut_ = conf_.getParameter("dzCut"); - ptCut_ = conf_.getParameter("ptCut"); - norchiCut_ = conf_.getParameter("norchiCut"); -} - -TrackSplittingMonitor::~TrackSplittingMonitor() = default; + rpcGeomToken_(esConsumes()), + splitTracksToken_(consumes >(conf_.getParameter("splitTrackCollection"))), + splitMuonsToken_(mayConsume >(conf_.getParameter("splitMuonCollection"))), + plotMuons_(conf_.getParameter("ifPlotMuons")), + pixelHitsPerLeg_(conf_.getParameter("pixelHitsPerLeg")), + totalHitsPerLeg_(conf_.getParameter("totalHitsPerLeg")), + d0Cut_(conf_.getParameter("d0Cut")), + dzCut_(conf_.getParameter("dzCut")), + ptCut_(conf_.getParameter("ptCut")), + norchiCut_(conf_.getParameter("norchiCut")) {} void TrackSplittingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& /* iRun */, - edm::EventSetup const& /* iSetup */) - -{ + edm::EventSetup const& /* iSetup */) { std::string MEFolderName = conf_.getParameter("FolderName"); ibooker.setCurrentFolder(MEFolderName); @@ -142,33 +131,33 @@ void TrackSplittingMonitor::bookHistograms(DQMStore::IBooker& ibooker, } ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta d_{xy})/#sqrt{2} [#mum]"); - ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta d_{z})/#sqrt{2} [#mum]"); - ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta #phi)/#sqrt{2} [mrad]"); - ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta #theta)/#sqrt{2} [mrad]"); - ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta pT)/#sqrt{2} [GeV]"); - ddxyAbsoluteResiduals_tracker_->setAxisTitle("(#delta (1/pT))/#sqrt{2} [GeV^{-1}]"); - - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta d_{xy}/#sigma(d_{xy}"); - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta d_{z}/#sigma(d_{z})"); - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta #phi/#sigma(d_{#phi})"); - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta #theta/#sigma(d_{#theta})"); - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta p_{T}/#sigma(p_{T})"); - ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta 1/p_{T}/#sigma(1/p_{T})"); + ddzAbsoluteResiduals_tracker_->setAxisTitle("(#delta d_{z})/#sqrt{2} [#mum]"); + dphiAbsoluteResiduals_tracker_->setAxisTitle("(#delta #phi)/#sqrt{2} [mrad]"); + dthetaAbsoluteResiduals_tracker_->setAxisTitle("(#delta #theta)/#sqrt{2} [mrad]"); + dptAbsoluteResiduals_tracker_->setAxisTitle("(#delta p_{T})/#sqrt{2} [GeV]"); + dcurvAbsoluteResiduals_tracker_->setAxisTitle("(#delta (1/p_{T}))/#sqrt{2} [GeV^{-1}]"); + + ddxyNormalizedResiduals_tracker_->setAxisTitle("#delta d_{xy}/#sigma(d_{xy})"); + ddzNormalizedResiduals_tracker_->setAxisTitle("#delta d_{z}/#sigma(d_{z})"); + dphiNormalizedResiduals_tracker_->setAxisTitle("#delta #phi/#sigma(d_{#phi})"); + dthetaNormalizedResiduals_tracker_->setAxisTitle("#delta #theta/#sigma(d_{#theta})"); + dptNormalizedResiduals_tracker_->setAxisTitle("#delta p_{T}/#sigma(p_{T})"); + dcurvNormalizedResiduals_tracker_->setAxisTitle("#delta 1/p_{T}/#sigma(1/p_{T})"); if (plotMuons_) { ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta d_{xy})/#sqrt{2} [#mum]"); - ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta d_{z})/#sqrt{2} [#mum]"); - ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta #phi)/#sqrt{2} [mrad]"); - ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta #theta)/#sqrt{2} [mrad]"); - ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta pT)/#sqrt{2} [GeV]"); - ddxyAbsoluteResiduals_global_->setAxisTitle("(#delta (1/pT))/#sqrt{2} [GeV^{-1}]"); - - ddxyNormalizedResiduals_global_->setAxisTitle("#delta d_{xy}/#sigma(d_{xy}"); - ddxyNormalizedResiduals_global_->setAxisTitle("#delta d_{z}/#sigma(d_{z})"); - ddxyNormalizedResiduals_global_->setAxisTitle("#delta #phi/#sigma(d_{#phi})"); - ddxyNormalizedResiduals_global_->setAxisTitle("#delta #theta/#sigma(d_{#theta})"); - ddxyNormalizedResiduals_global_->setAxisTitle("#delta p_{T}/#sigma(p_{T})"); - ddxyNormalizedResiduals_global_->setAxisTitle("#delta 1/p_{T}/#sigma(1/p_{T})"); + ddzAbsoluteResiduals_global_->setAxisTitle("(#delta d_{z})/#sqrt{2} [#mum]"); + dphiAbsoluteResiduals_global_->setAxisTitle("(#delta #phi)/#sqrt{2} [mrad]"); + dthetaAbsoluteResiduals_global_->setAxisTitle("(#delta #theta)/#sqrt{2} [mrad]"); + dptAbsoluteResiduals_global_->setAxisTitle("(#delta p_{T})/#sqrt{2} [GeV]"); + dcurvAbsoluteResiduals_global_->setAxisTitle("(#delta (1/p_{T}))/#sqrt{2} [GeV^{-1}]"); + + ddxyNormalizedResiduals_global_->setAxisTitle("#delta d_{xy}/#sigma(d_{xy})"); + ddzNormalizedResiduals_global_->setAxisTitle("#delta d_{z}/#sigma(d_{z})"); + dphiNormalizedResiduals_global_->setAxisTitle("#delta #phi/#sigma(d_{#phi})"); + dthetaNormalizedResiduals_global_->setAxisTitle("#delta #theta/#sigma(d_{#theta})"); + dptNormalizedResiduals_global_->setAxisTitle("#delta p_{T}/#sigma(p_{T})"); + dcurvNormalizedResiduals_global_->setAxisTitle("#delta 1/p_{T}/#sigma(1/p_{T})"); } } @@ -205,10 +194,10 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe // looping through the hits for track 1 double nRechits1 = 0; double nRechitinBPIX1 = 0; - for (trackingRecHit_iterator iHit = track1.recHitsBegin(); iHit != track1.recHitsEnd(); ++iHit) { - if ((*iHit)->isValid()) { + for (auto const& iHit : track1.recHits()) { + if (iHit->isValid()) { nRechits1++; - int type = (*iHit)->geographicalId().subdetId(); + int type = iHit->geographicalId().subdetId(); if (type == int(PixelSubdetector::PixelBarrel)) { ++nRechitinBPIX1; } @@ -217,10 +206,10 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe // looping through the hits for track 2 double nRechits2 = 0; double nRechitinBPIX2 = 0; - for (trackingRecHit_iterator iHit = track2.recHitsBegin(); iHit != track2.recHitsEnd(); ++iHit) { - if ((*iHit)->isValid()) { + for (auto const& iHit : track2.recHits()) { + if (iHit->isValid()) { nRechits2++; - int type = (*iHit)->geographicalId().subdetId(); + int type = iHit->geographicalId().subdetId(); if (type == int(PixelSubdetector::PixelBarrel)) { ++nRechitinBPIX2; } @@ -243,10 +232,11 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe // basic selection // pixel hits and total hits - if ((nRechitinBPIX1 >= pixelHitsPerLeg_) && (nRechitinBPIX1 >= pixelHitsPerLeg_) && + if ((nRechitinBPIX1 >= pixelHitsPerLeg_) && (nRechitinBPIX2 >= pixelHitsPerLeg_) && (nRechits1 >= totalHitsPerLeg_) && (nRechits2 >= totalHitsPerLeg_)) { // dca cut - if (((fabs(d01) < d0Cut_)) && (fabs(d02) < d0Cut_) && (fabs(dz2) < dzCut_) && (fabs(dz2) < dzCut_)) { + if (((std::abs(d01) < d0Cut_)) && (std::abs(d02) < d0Cut_) && (std::abs(dz1) < dzCut_) && + (std::abs(dz2) < dzCut_)) { // pt cut if ((pt1 + pt2) / 2 < ptCut_) { // chi2 cut @@ -272,20 +262,20 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe double pt1ErrVal = track1.ptError(); double pt2ErrVal = track2.ptError(); - ddxyAbsoluteResiduals_tracker_->Fill(10000.0 * ddxyVal / sqrt(2.0)); - ddxyAbsoluteResiduals_tracker_->Fill(10000.0 * ddzVal / sqrt(2.0)); - ddxyAbsoluteResiduals_tracker_->Fill(1000.0 * dphiVal / sqrt(2.0)); - ddxyAbsoluteResiduals_tracker_->Fill(1000.0 * dthetaVal / sqrt(2.0)); - ddxyAbsoluteResiduals_tracker_->Fill(dptVal / sqrt(2.0)); - ddxyAbsoluteResiduals_tracker_->Fill(dcurvVal / sqrt(2.0)); + ddxyAbsoluteResiduals_tracker_->Fill(cmToUm * ddxyVal / sqrt2); + ddzAbsoluteResiduals_tracker_->Fill(cmToUm * ddzVal / sqrt2); + dphiAbsoluteResiduals_tracker_->Fill(radToUrad * dphiVal / sqrt2); + dthetaAbsoluteResiduals_tracker_->Fill(radToUrad * dthetaVal / sqrt2); + dptAbsoluteResiduals_tracker_->Fill(dptVal / sqrt2); + dcurvAbsoluteResiduals_tracker_->Fill(dcurvVal / sqrt2); ddxyNormalizedResiduals_tracker_->Fill(ddxyVal / sqrt(d01ErrVal * d01ErrVal + d02ErrVal * d02ErrVal)); - ddxyNormalizedResiduals_tracker_->Fill(ddzVal / sqrt(dz1ErrVal * dz1ErrVal + dz2ErrVal * dz2ErrVal)); - ddxyNormalizedResiduals_tracker_->Fill(dphiVal / sqrt(phi1ErrVal * phi1ErrVal + phi2ErrVal * phi2ErrVal)); - ddxyNormalizedResiduals_tracker_->Fill(dthetaVal / - sqrt(theta1ErrVal * theta1ErrVal + theta2ErrVal * theta2ErrVal)); - ddxyNormalizedResiduals_tracker_->Fill(dptVal / sqrt(pt1ErrVal * pt1ErrVal + pt2ErrVal * pt2ErrVal)); - ddxyNormalizedResiduals_tracker_->Fill( + ddzNormalizedResiduals_tracker_->Fill(ddzVal / sqrt(dz1ErrVal * dz1ErrVal + dz2ErrVal * dz2ErrVal)); + dphiNormalizedResiduals_tracker_->Fill(dphiVal / sqrt(phi1ErrVal * phi1ErrVal + phi2ErrVal * phi2ErrVal)); + dthetaNormalizedResiduals_tracker_->Fill(dthetaVal / + sqrt(theta1ErrVal * theta1ErrVal + theta2ErrVal * theta2ErrVal)); + dptNormalizedResiduals_tracker_->Fill(dptVal / sqrt(pt1ErrVal * pt1ErrVal + pt2ErrVal * pt2ErrVal)); + dcurvNormalizedResiduals_tracker_->Fill( dcurvVal / sqrt(pow(pt1ErrVal, 2) / pow(pt1, 4) + pow(pt2ErrVal, 2) / pow(pt2, 4))); // if do the same for split muons @@ -347,12 +337,12 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe double pt1ErrValGlb = glb1->ptError(); double pt2ErrValGlb = glb2->ptError(); - ddxyAbsoluteResiduals_global_->Fill(10000.0 * ddxyValGlb / sqrt(2.0)); - ddxyAbsoluteResiduals_global_->Fill(10000.0 * ddzValGlb / sqrt(2.0)); - ddxyAbsoluteResiduals_global_->Fill(1000.0 * dphiValGlb / sqrt(2.0)); - ddxyAbsoluteResiduals_global_->Fill(1000.0 * dthetaValGlb / sqrt(2.0)); - ddxyAbsoluteResiduals_global_->Fill(dptValGlb / sqrt(2.0)); - ddxyAbsoluteResiduals_global_->Fill(dcurvValGlb / sqrt(2.0)); + ddxyAbsoluteResiduals_global_->Fill(cmToUm * ddxyValGlb / sqrt2); + ddzAbsoluteResiduals_global_->Fill(cmToUm * ddzValGlb / sqrt2); + dphiAbsoluteResiduals_global_->Fill(radToUrad * dphiValGlb / sqrt2); + dthetaAbsoluteResiduals_global_->Fill(radToUrad * dthetaValGlb / sqrt2); + dptAbsoluteResiduals_global_->Fill(dptValGlb / sqrt2); + dcurvAbsoluteResiduals_global_->Fill(dcurvValGlb / sqrt2); ddxyNormalizedResiduals_global_->Fill(ddxyValGlb / sqrt(d01ErrValGlb * d01ErrValGlb + d02ErrValGlb * d02ErrValGlb)); @@ -376,4 +366,43 @@ void TrackSplittingMonitor::analyze(const edm::Event& iEvent, const edm::EventSe } } +void TrackSplittingMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment( + "Validates track parameters resolution by splitting cosmics tracks at the PCA and comparing the parameters of " + "the two halves"); + desc.add("FolderName", "TrackSplitMonitoring"); + desc.add("splitTrackCollection", edm::InputTag("splittedTracksP5")); + desc.add("splitMuonCollection", edm::InputTag("splitMuons")); + desc.add("ifPlotMuons", true); + desc.add("pixelHitsPerLeg", 1); + desc.add("totalHitsPerLeg", 6); + desc.add("d0Cut", 12.0); + desc.add("dzCut", 25.0); + desc.add("ptCut", 4.0); + desc.add("norchiCut", 100.0); + desc.add("ddxyBin", 100); + desc.add("ddxyMin", -200.0); + desc.add("ddxyMax", 200.0); + desc.add("ddzBin", 100); + desc.add("ddzMin", -400.0); + desc.add("ddzMax", 400.0); + desc.add("dphiBin", 100); + desc.add("dphiMin", -0.01); + desc.add("dphiMax", 0.01); + desc.add("dthetaBin", 100); + desc.add("dthetaMin", -0.01); + desc.add("dthetaMax", 0.01); + desc.add("dptBin", 100); + desc.add("dptMin", -5.0); + desc.add("dptMax", 5.0); + desc.add("dcurvBin", 100); + desc.add("dcurvMin", -0.005); + desc.add("dcurvMax", 0.005); + desc.add("normBin", 100); + desc.add("normMin", -5.); + desc.add("normMax", 5.); + descriptions.addWithDefaultLabel(desc); +} + DEFINE_FWK_MODULE(TrackSplittingMonitor); diff --git a/DQM/TrackingMonitor/src/TrackingMonitor.cc b/DQM/TrackingMonitor/src/TrackingMonitor.cc index 95ff105c96264..d1f14a03303b2 100644 --- a/DQM/TrackingMonitor/src/TrackingMonitor.cc +++ b/DQM/TrackingMonitor/src/TrackingMonitor.cc @@ -524,25 +524,25 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& histname = "NumberEventsVsLUMI"; NumberEventsOfVsLUMI = ibooker.book1D(histname, histname, LUMIBin, LUMIMin, LUMIMax); - NumberEventsOfVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberEventsOfVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberEventsOfVsLUMI->setAxisTitle("Number of events", 2); histname = "NumberOfTracksVsLUMI"; NumberOfTracksVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, TKNoMin, TKNoMax * 3, ""); - NumberOfTracksVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfTracksVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfTracksVsLUMI->setAxisTitle("Mean number of vertices", 2); if (doFractionPlot_) { histname = "GoodTracksFractionVsLUMI"; GoodTracksFractionVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, 0., 1.1, ""); - GoodTracksFractionVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + GoodTracksFractionVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); GoodTracksFractionVsLUMI->setAxisTitle("Mean number of vertices", 2); } histname = "NumberOfRecHitsPerTrackVsLUMI"; NumberOfRecHitsPerTrackVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, RecHitMin, RecHitMax * 5, ""); - NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfRecHitsPerTrackVsLUMI->setAxisTitle("Mean number of vertices", 2); double PVMin = conf->getParameter("PVMin"); @@ -550,13 +550,13 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& histname = "NumberOfGoodPVtxVsLUMI"; NumberOfGoodPVtxVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); - NumberOfGoodPVtxVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfGoodPVtxVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfGoodPVtxVsLUMI->setAxisTitle("Mean number of vertices", 2); histname = "NumberOfGoodPVtxWO0VsLUMI"; NumberOfGoodPVtxWO0VsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, PVMin, 3. * PVMax, ""); - NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfGoodPVtxWO0VsLUMI->setAxisTitle("Mean number of vertices", 2); double NClusPxMin = conf->getParameter("NClusPxMin"); @@ -564,7 +564,7 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& histname = "NumberOfPixelClustersVsGoodPVtx"; NumberOfPixelClustersVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusPxMin, 3. * NClusPxMax, ""); - NumberOfPixelClustersVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfPixelClustersVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfPixelClustersVsLUMI->setAxisTitle("Mean number of pixel clusters", 2); double NClusStrMin = conf->getParameter("NClusStrMin"); @@ -572,7 +572,7 @@ void TrackingMonitor::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& histname = "NumberOfStripClustersVsLUMI"; NumberOfStripClustersVsLUMI = ibooker.bookProfile(histname, histname, LUMIBin, LUMIMin, LUMIMax, NClusStrMin, 3. * NClusStrMax, ""); - NumberOfStripClustersVsLUMI->setAxisTitle("online lumi [10e30 Hz cm^{-2}]", 1); + NumberOfStripClustersVsLUMI->setAxisTitle("online lumi [1e30 Hz cm^{-2}]", 1); NumberOfStripClustersVsLUMI->setAxisTitle("Mean number of strip clusters", 2); } diff --git a/DQM/TrackingMonitorSource/python/EDModules2monitor_cfi.py b/DQM/TrackingMonitorSource/python/EDModules2monitor_cfi.py index 532e686b1aa7f..d2fcf9cfa5683 100644 --- a/DQM/TrackingMonitorSource/python/EDModules2monitor_cfi.py +++ b/DQM/TrackingMonitorSource/python/EDModules2monitor_cfi.py @@ -16,23 +16,23 @@ # apparentely there are not LogError in RecoLocalTracker/SubCollectionProducers/src/TrackClusterRemover.cc pluginsMonName['Clusterizer'] = cms.string ( 'TrackClusterRemover' ) -modulesLabel ['Clusterizer'] = cms.vstring( 'lowPtTripletStepClusters', 'pixelPairStepClusters', 'detachedTripletStepClusters', 'mixedTripletStepClusters', 'pixelLessStepClusters', 'tobTecStepClusters', 'displacedGeneralStepClusters' ) # TrackClusterRemover +modulesLabel ['Clusterizer'] = cms.vstring( 'lowPtTripletStepClusters', 'pixelPairStepClusters', 'detachedTripletStepClusters', 'mixedTripletStepClusters', 'pixelLessStepClusters', 'tobTecStepClusters', 'displacedGeneralStepClusters', 'displacedRegionalStepClusters' ) # TrackClusterRemover categories ['Clusterizer'] = cms.vstring( ) # initialStepSeeds,lowPtTripletStepSeeds, pixelPairStepSeeds, detachedTripletStepSeeds, : TooManyClusters (SeedGeneratorFromRegionHitsEDProducer), # photonConvTrajSeedFromSingleLeg : (PhotonConversionTrajectorySeedProducerFromSingleLeg) pluginsMonName['Seeding'] = cms.string ( 'Seeding' ) -modulesLabel ['Seeding'] = cms.vstring( 'initialStepSeeds', 'lowPtTripletStepSeeds', 'pixelPairStepSeeds', 'detachedTripletStepSeeds', 'mixedTripletStepSeedsA', 'mixedTripletStepSeedsB', 'mixedTripletStepSeeds', 'pixelLessStepSeeds', 'tobTecStepSeeds', 'displacedGeneralStepSeeds','photonConvTrajSeedFromSingleLeg') +modulesLabel ['Seeding'] = cms.vstring( 'initialStepSeeds', 'lowPtTripletStepSeeds', 'pixelPairStepSeeds', 'detachedTripletStepSeeds', 'mixedTripletStepSeedsA', 'mixedTripletStepSeedsB', 'mixedTripletStepSeeds', 'pixelLessStepSeeds', 'tobTecStepSeeds', 'displacedGeneralStepSeeds', 'displacedRegionalStepSeeds' ,'photonConvTrajSeedFromSingleLeg') categories ['Seeding'] = cms.vstring( 'TooManyClusters', 'TooManyPairs', 'TooManyTriplets', 'TooManySeeds' ) # RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc pluginsMonName['TrackCandidate'] = cms.string ( 'TrackCandidate' ) -modulesLabel ['TrackCandidate'] = cms.vstring( 'initialStepTrackCandidates', 'lowPtTripletStepTrackCandidates', 'pixelPairStepTrackCandidates', 'detachedTripletStepTrackCandidates', 'mixedTripletStepTrackCandidates', 'pixelLessStepTrackCandidates', 'tobTecStepTrackCandidates', 'displacedGeneralStepTrackCandidates', 'convTrackCandidates' ) +modulesLabel ['TrackCandidate'] = cms.vstring( 'initialStepTrackCandidates', 'lowPtTripletStepTrackCandidates', 'pixelPairStepTrackCandidates', 'detachedTripletStepTrackCandidates', 'mixedTripletStepTrackCandidates', 'pixelLessStepTrackCandidates', 'tobTecStepTrackCandidates', 'displacedGeneralStepTrackCandidates', 'displacedRegionalStepTrackCandidates', 'convTrackCandidates' ) categories ['TrackCandidate'] = cms.vstring( 'TooManySeeds', 'CkfPattern', 'BaseCkfTrajectoryBuilder_InfiniteLoop' ) # TrackProducer:FailedPropagation pluginsMonName['TrackFinder'] = cms.string ( 'TrackFinder' ) -modulesLabel ['TrackFinder'] = cms.vstring( 'pixelTracks', 'initialStepTracks', 'lowPtTripletStepTracks', 'pixelPairStepTracks', 'detachedTripletStepTracks', 'mixedTripletStepTracks', 'pixelLessStepTracks', 'tobTecStepTracks', 'displacedGeneralStepTracks', 'generalTracks' ) +modulesLabel ['TrackFinder'] = cms.vstring( 'pixelTracks', 'initialStepTracks', 'lowPtTripletStepTracks', 'pixelPairStepTracks', 'detachedTripletStepTracks', 'mixedTripletStepTracks', 'pixelLessStepTracks', 'tobTecStepTracks', 'displacedGeneralStepTracks', 'displacedRegionalStepTracks', 'generalTracks' ) categories ['TrackFinder'] = cms.vstring( 'FailedPropagation' ) @@ -63,6 +63,9 @@ 'displacedGeneralStepSeeds_iter7', 'displacedGeneralStepTrackCandidates_iter7', 'displacedGeneralStepTracks_iter7', + 'displacedRegionalStepSeeds_iter8', + 'displacedRegionalStepTrackCandidates_iter8', + 'displacedRegionalStepTracks_iter8', 'photonConvTrajSeedFromSingleLeg', 'convTrackCandidates', 'convStepTracks', @@ -101,7 +104,10 @@ 'tobTecStepTracks_iter6', 'displacedGeneralStepSeeds_iter7', 'displacedGeneralStepTrackCandidates_iter7', - 'displacedGeneralStepTracks_iter7' + 'displacedGeneralStepTracks_iter7', + 'displacedRegionalStepSeeds_iter8', + 'displacedRegionalStepTrackCandidates_iter8', + 'displacedRegionalStepTracks_iter8' ) categories['IterTracking'] = cms.vstring( 'TooManyClusters', diff --git a/DQM/TrackingMonitorSource/python/IterTrackingModules4seedMonitoring_cfi.py b/DQM/TrackingMonitorSource/python/IterTrackingModules4seedMonitoring_cfi.py index d190825a528e6..83a5e94955183 100644 --- a/DQM/TrackingMonitorSource/python/IterTrackingModules4seedMonitoring_cfi.py +++ b/DQM/TrackingMonitorSource/python/IterTrackingModules4seedMonitoring_cfi.py @@ -160,6 +160,18 @@ clusterMax = cms.double(100000), ) +seedMonitoring['displacedRegionalStep'] = cms.PSet( + seedInputTag = cms.InputTag("displacedRegionalStepSeeds"), + trackCandInputTag= cms.InputTag("displacedRegionalStepTrackCandidates"), + trackSeedSizeBin = cms.int32(400), + trackSeedSizeMin = cms.double(0), + trackSeedSizeMax = cms.double(100000), + TCSizeMax = cms.double(199.5), + clusterLabel = cms.vstring('Strip'), + clusterBin = cms.int32(100), + clusterMax = cms.double(100000), +) + seedMonitoring['muonSeededStepOutInDisplaced'] = cms.PSet( seedInputTag = cms.InputTag("muonSeededSeedsOutInDisplaced"), trackCandInputTag = cms.InputTag("muonSeededTrackCandidatesOutInDisplacedg"), diff --git a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_cff.py b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_cff.py index 7d0649a3b6316..3362d3b16124b 100644 --- a/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_cff.py +++ b/DQM/TrackingMonitorSource/python/TrackingSourceConfig_Tier0_cff.py @@ -30,8 +30,8 @@ #TrackEffMon_bhmuon.FolderName = 'Tracking/TrackParameters/TrackEfficiency' # Split Tracking -from DQM.TrackingMonitor.TrackSplittingMonitor_cfi import * -TrackSplitMonitor.FolderName = 'Tracking/TrackParameters/SplitTracks' +# from DQM.TrackingMonitor.TrackSplittingMonitor_cfi import * +# TrackSplitMonitor.FolderName = 'Tracking/TrackParameters/SplitTracks' # DQM Services @@ -352,7 +352,7 @@ def _copyIfExists(mod, pset, name): # Sequence TrackingDQMSourceTier0 = cms.Sequence(cms.ignore(trackingDQMgoodOfflinePrimaryVertices)) # dEdx monitoring -TrackingDQMSourceTier0 += dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * TrackSplitMonitor * dqmInfoTracking +TrackingDQMSourceTier0 += dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * dqmInfoTracking #TrackMon_cosmicTk*TrackMon_ckf*TrackEffMon_ckf*TrackSplitMonitor*dqmInfoTracking # # temporary patch in order to have BXlumi # * lumiProducer @@ -399,7 +399,7 @@ def _copyIfExists(mod, pset, name): TrackingDQMSourceTier0Common = cms.Sequence(cms.ignore(trackingDQMgoodOfflinePrimaryVertices)) # dEdx monitoring -TrackingDQMSourceTier0Common += (dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * TrackSplitMonitor * dqmInfoTracking) +TrackingDQMSourceTier0Common += (dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * dqmInfoTracking) #TrackEffMon_ckf*TrackSplitMonitor*dqmInfoTracking) ## monitor track collections for tracks in selectedTracks : @@ -420,7 +420,7 @@ def _copyIfExists(mod, pset, name): TrackingDQMSourceTier0MinBias = cms.Sequence(cms.ignore(trackingDQMgoodOfflinePrimaryVertices)) # dEdx monitoring -TrackingDQMSourceTier0MinBias += dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * TrackSplitMonitor * dqmInfoTracking +TrackingDQMSourceTier0MinBias += dedxHarmonicSequence * dEdxMonCommon * dEdxHitMonCommon * TrackMon_ckf * dqmInfoTracking #TrackMon_cosmicTk*TrackMon_ckf*TrackEffMon_ckf*TrackSplitMonitor*dqmInfoTracking#TrackMon_ckf*TrackEffMon_ckf # * lumiProducer # monitor track collections diff --git a/DQMOffline/Alignment/interface/DiMuonMassBiasClient.h b/DQMOffline/Alignment/interface/DiMuonMassBiasClient.h index edddbf0ecbf85..6edef3b8b6c8b 100644 --- a/DQMOffline/Alignment/interface/DiMuonMassBiasClient.h +++ b/DQMOffline/Alignment/interface/DiMuonMassBiasClient.h @@ -81,9 +81,12 @@ class DiMuonMassBiasClient : public DQMEDHarvester { void bookMEs(DQMStore::IBooker& ibooker); void getMEsToHarvest(DQMStore::IGetter& igetter); diMuonMassBias::fitOutputs fitLineShape(TH1* hist, const bool& fitBackground = false) const; + void fitAndFillProfile(std::pair toHarvest, DQMStore::IBooker& iBooker); + void fitAndFillHisto(std::pair toHarvest, DQMStore::IBooker& iBooker); // data members const std::string TopFolder_; + const bool useTH1s_; const bool fitBackground_; const bool useRooCBShape_; const bool useRooCMSShape_; @@ -97,6 +100,10 @@ class DiMuonMassBiasClient : public DQMEDHarvester { std::vector MEtoHarvest_; // the histograms to be filled + std::map meanHistos_; + std::map widthHistos_; + + // the profiles to be filled std::map meanProfiles_; std::map widthProfiles_; diff --git a/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py b/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py index 1284aa875da09..17b5359da7f0d 100644 --- a/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py +++ b/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py @@ -83,7 +83,8 @@ ALCARECOTkAlDiMuonMassBiasDQM = DQMOffline.Alignment.DiMuonMassBiasMonitor_cfi.DiMuonMassBiasMonitor.clone( muonTracks = 'ALCARECO'+__trackCollName, - FolderName = "AlCaReco/"+__selectionName + FolderName = "AlCaReco/"+__selectionName, + DiMuMassConfig = dict(maxDeltaEta = 3.5) ) ALCARECOTkAlDiMuonAndVertexDQM = cms.Sequence(ALCARECOTkAlDiMuonAndVertexTkAlDQM + ALCARECOTkAlDiMuonAndVertexVtxDQM + ALCARECOTkAlDiMuonMassBiasDQM) diff --git a/DQMOffline/Alignment/src/DiMuonMassBiasClient.cc b/DQMOffline/Alignment/src/DiMuonMassBiasClient.cc index 6b1e49aca971f..108c73a46ef81 100644 --- a/DQMOffline/Alignment/src/DiMuonMassBiasClient.cc +++ b/DQMOffline/Alignment/src/DiMuonMassBiasClient.cc @@ -19,6 +19,7 @@ //----------------------------------------------------------------------------------- DiMuonMassBiasClient::DiMuonMassBiasClient(edm::ParameterSet const& iConfig) : TopFolder_(iConfig.getParameter("FolderName")), + useTH1s_(iConfig.getParameter("useTH1s")), fitBackground_(iConfig.getParameter("fitBackground")), useRooCBShape_(iConfig.getParameter("useRooCBShape")), useRooCMSShape_(iConfig.getParameter("useRooCMSShape")), @@ -85,12 +86,12 @@ void DiMuonMassBiasClient::bookMEs(DQMStore::IBooker& iBooker) const auto& xmax = ME->getAxisMax(1); MonitorElement* meanToBook = - iBooker.book1D(("Mean" + key), (title + ";" + xtitle + ";" + ytitle), nxbins, xmin, xmax); - meanProfiles_.insert({key, meanToBook}); + iBooker.book1D(("Mean" + key), (title + ";#LT M_{#mu^{-}#mu^{+}} #GT [GeV];" + ytitle), nxbins, xmin, xmax); + meanHistos_.insert({key, meanToBook}); MonitorElement* sigmaToBook = iBooker.book1D(("Sigma" + key), (title + ";" + xtitle + ";" + "#sigma of " + ytitle), nxbins, xmin, xmax); - widthProfiles_.insert({key, sigmaToBook}); + widthHistos_.insert({key, sigmaToBook}); } } @@ -113,6 +114,148 @@ void DiMuonMassBiasClient::getMEsToHarvest(DQMStore::IGetter& iGetter) } } +//----------------------------------------------------------------------------------- +void DiMuonMassBiasClient::fitAndFillProfile(std::pair toHarvest, + DQMStore::IBooker& iBooker) +//----------------------------------------------------------------------------------- +{ + const auto& key = toHarvest.first; + const auto& ME = toHarvest.second; + + if (debugMode_) + edm::LogPrint("DiMuonMassBiasClient") << "dealing with key: " << key << std::endl; + + if (ME == nullptr) { + edm::LogError("DiMuonMassBiasClient") << "could not find MonitorElement for key: " << key << std::endl; + return; + } + + const auto& title = ME->getTitle(); + const auto& xtitle = ME->getAxisTitle(1); + const auto& ytitle = ME->getAxisTitle(2); + + const auto& nxbins = ME->getNbinsX(); + const auto& xmin = ME->getAxisMin(1); + const auto& xmax = ME->getAxisMax(1); + + TProfile* p_mean = new TProfile(("Mean" + key).c_str(), + (title + ";" + xtitle + ";#LT M_{#mu^{-}#mu^{+}} #GT [GeV]").c_str(), + nxbins, + xmin, + xmax, + "g"); + + TProfile* p_width = new TProfile( + ("Sigma" + key).c_str(), (title + ";" + xtitle + ";#sigma of " + ytitle).c_str(), nxbins, xmin, xmax, "g"); + + p_mean->Sumw2(); + p_width->Sumw2(); + + TH2F* bareHisto = ME->getTH2F(); + for (int bin = 1; bin <= nxbins; bin++) { + const auto& xaxis = bareHisto->GetXaxis(); + const auto& low_edge = xaxis->GetBinLowEdge(bin); + const auto& high_edge = xaxis->GetBinUpEdge(bin); + + if (debugMode_) + edm::LogPrint("DiMuonMassBiasClient") << "dealing with bin: " << bin << " range: (" << std::setprecision(2) + << low_edge << "," << std::setprecision(2) << high_edge << ")"; + + TH1D* Proj = bareHisto->ProjectionY(Form("%s_proj_%i", key.c_str(), bin), bin, bin); + Proj->SetTitle(Form("%s #in (%.2f,%.2f), bin: %i", Proj->GetTitle(), low_edge, high_edge, bin)); + + diMuonMassBias::fitOutputs results = fitLineShape(Proj); + + if (results.isInvalid()) { + edm::LogWarning("DiMuonMassBiasClient") << "the current bin has invalid data" << std::endl; + continue; + } + + // fill the mean profiles + const Measurement1D& bias = results.getBias(); + + // ============================================= DISCLAIMER ================================================ + // N.B. this is sort of a hack in order to fill arbitrarily both central values and error bars of a TProfile. + // Choosing the option "g" in the constructor the bin error will be 1/sqrt(W(j)), where W(j) is the sum of weights. + // Filling the sum of weights with the 1 / err^2, the bin error automatically becomes "err". + // In order to avoid the central value to be shifted, that's divided by 1 / err^2 as well. + // For more information, please consult the https://root.cern.ch/doc/master/classTProfile.html + + p_mean->SetBinContent(bin, bias.value() / (bias.error() * bias.error())); + p_mean->SetBinEntries(bin, 1. / (bias.error() * bias.error())); + + if (debugMode_) + LogDebug("DiMuonBassBiasClient") << " Bin: " << bin << " value: " << bias.value() << " from profile ( " + << p_mean->GetBinContent(bin) << ") - error: " << bias.error() + << " from profile ( " << p_mean->GetBinError(bin) << " )"; + + // fill the width profiles + const Measurement1D& width = results.getWidth(); + + // see discussion above + p_width->SetBinContent(bin, width.value() / (width.error() * width.error())); + p_width->SetBinEntries(bin, 1. / (width.error() * width.error())); + } + + // now book the profiles + iBooker.setCurrentFolder(TopFolder_ + "/DiMuonMassBiasMonitor/MassBias/Profiles"); + MonitorElement* meanToBook = iBooker.bookProfile(p_mean->GetName(), p_mean); + meanProfiles_.insert({key, meanToBook}); + + MonitorElement* sigmaToBook = iBooker.bookProfile(p_width->GetName(), p_width); + widthProfiles_.insert({key, sigmaToBook}); + + delete p_mean; + delete p_width; +} + +//----------------------------------------------------------------------------------- +void DiMuonMassBiasClient::fitAndFillHisto(std::pair toHarvest, + DQMStore::IBooker& iBooker) +//----------------------------------------------------------------------------------- +{ + const auto& key = toHarvest.first; + const auto& ME = toHarvest.second; + + if (debugMode_) + edm::LogPrint("DiMuonMassBiasClient") << "dealing with key: " << key << std::endl; + + if (ME == nullptr) { + edm::LogError("DiMuonMassBiasClient") << "could not find MonitorElement for key: " << key << std::endl; + return; + } + + TH2F* bareHisto = ME->getTH2F(); + for (int bin = 1; bin <= ME->getNbinsX(); bin++) { + const auto& xaxis = bareHisto->GetXaxis(); + const auto& low_edge = xaxis->GetBinLowEdge(bin); + const auto& high_edge = xaxis->GetBinUpEdge(bin); + + if (debugMode_) + edm::LogPrint("DiMuonMassBiasClient") << "dealing with bin: " << bin << " range: (" << std::setprecision(2) + << low_edge << "," << std::setprecision(2) << high_edge << ")"; + TH1D* Proj = bareHisto->ProjectionY(Form("%s_proj_%i", key.c_str(), bin), bin, bin); + Proj->SetTitle(Form("%s #in (%.2f,%.2f), bin: %i", Proj->GetTitle(), low_edge, high_edge, bin)); + + diMuonMassBias::fitOutputs results = fitLineShape(Proj); + + if (results.isInvalid()) { + edm::LogWarning("DiMuonMassBiasClient") << "the current bin has invalid data" << std::endl; + continue; + } + + // fill the mean profiles + const Measurement1D& bias = results.getBias(); + meanHistos_[key]->setBinContent(bin, bias.value()); + meanHistos_[key]->setBinError(bin, bias.error()); + + // fill the width profiles + const Measurement1D& width = results.getWidth(); + widthHistos_[key]->setBinContent(bin, width.value()); + widthHistos_[key]->setBinError(bin, width.error()); + } +} + //----------------------------------------------------------------------------------- void DiMuonMassBiasClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) //----------------------------------------------------------------------------------- @@ -120,39 +263,19 @@ void DiMuonMassBiasClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGett edm::LogInfo("DiMuonMassBiasClient") << "DiMuonMassBiasClient::endLuminosityBlock"; getMEsToHarvest(igetter); - bookMEs(ibooker); - for (const auto& [key, ME] : harvestTargets_) { - if (debugMode_) - edm::LogPrint("DiMuonMassBiasClient") << "dealing with key: " << key << std::endl; - TH2F* bareHisto = ME->getTH2F(); - for (int bin = 1; bin <= ME->getNbinsX(); bin++) { - const auto& xaxis = bareHisto->GetXaxis(); - const auto& low_edge = xaxis->GetBinLowEdge(bin); - const auto& high_edge = xaxis->GetBinUpEdge(bin); - - if (debugMode_) - edm::LogPrint("DiMuonMassBiasClient") << "dealing with bin: " << bin << " range: (" << std::setprecision(2) - << low_edge << "," << std::setprecision(2) << high_edge << ")"; - TH1D* Proj = bareHisto->ProjectionY(Form("%s_proj_%i", key.c_str(), bin), bin, bin); - Proj->SetTitle(Form("%s #in (%.2f,%.2f), bin: %i", Proj->GetTitle(), low_edge, high_edge, bin)); - - diMuonMassBias::fitOutputs results = fitLineShape(Proj); - - if (results.isInvalid()) { - edm::LogWarning("DiMuonMassBiasClient") << "the current bin has invalid data" << std::endl; - continue; - } - - // fill the mean profiles - const Measurement1D& bias = results.getBias(); - meanProfiles_[key]->setBinContent(bin, bias.value()); - meanProfiles_[key]->setBinError(bin, bias.error()); + // book the histograms upfront + if (useTH1s_) { + bookMEs(ibooker); + } - // fill the width profiles - const Measurement1D& width = results.getWidth(); - widthProfiles_[key]->setBinContent(bin, width.value()); - widthProfiles_[key]->setBinError(bin, width.error()); + for (const auto& element : harvestTargets_) { + if (!useTH1s_) { + // if using profiles + this->fitAndFillProfile(element, ibooker); + } else { + // if using histograms + this->fitAndFillHisto(element, ibooker); } } } @@ -298,6 +421,7 @@ void DiMuonMassBiasClient::fillDescriptions(edm::ConfigurationDescriptions& desc { edm::ParameterSetDescription desc; desc.add("FolderName", "DiMuonMassBiasMonitor"); + desc.add("useTH1s", false); desc.add("fitBackground", false); desc.add("useRooCMSShape", false); desc.add("useRooCBShape", false); diff --git a/DQMOffline/Alignment/test/BuildFile.xml b/DQMOffline/Alignment/test/BuildFile.xml index d54049c4fe799..bc645702c6dec 100644 --- a/DQMOffline/Alignment/test/BuildFile.xml +++ b/DQMOffline/Alignment/test/BuildFile.xml @@ -1,4 +1 @@ - - - - + diff --git a/DQMOffline/Alignment/test/TestDriver.cpp b/DQMOffline/Alignment/test/TestDriver.cpp deleted file mode 100644 index 2f0e0c40064da..0000000000000 --- a/DQMOffline/Alignment/test/TestDriver.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/DQMOffline/Alignment/test/testDiMuonVertexMonitor.sh b/DQMOffline/Alignment/test/testDiMuonVertexMonitor.sh index 08790cf92d9c1..a112e44ae01dd 100755 --- a/DQMOffline/Alignment/test/testDiMuonVertexMonitor.sh +++ b/DQMOffline/Alignment/test/testDiMuonVertexMonitor.sh @@ -9,15 +9,15 @@ fi echo -e " Tesing on Z->mm \n\n" -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMValidator_cfg.py resonance=Z || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Z" $? -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMHarvester_cfg.py resonance=Z || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Z" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMValidator_cfg.py resonance=Z || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Z" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMHarvester_cfg.py resonance=Z || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Z" $? echo -e " Testing on J/psi -> mm \n\n" -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMValidator_cfg.py resonance=Jpsi || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Jpsi" $? -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMHarvester_cfg.py resonance=Jpsi || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Jpsi" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMValidator_cfg.py resonance=Jpsi || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Jpsi" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMHarvester_cfg.py resonance=Jpsi || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Jpsi" $? echo -e " Testing on Upsilon -> mm \n\n" -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMValidator_cfg.py resonance=Upsilon || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Upsilon" $? -cmsRun ${LOCAL_TEST_DIR}/DiMuonTkAlDQMHarvester_cfg.py resonance=Upsilon || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Upsilon" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMValidator_cfg.py resonance=Upsilon || die "Failure using DiMuonTkAlDQMValidator_cfg.py resonance=Upsilon" $? +cmsRun ${SCRAM_TEST_PATH}/DiMuonTkAlDQMHarvester_cfg.py resonance=Upsilon || die "Failure using DiMuonTkAlDQMHarvester_cfg.py resonance=Upsilon" $? diff --git a/DQMOffline/L1Trigger/interface/L1TTauOffline.h b/DQMOffline/L1Trigger/interface/L1TTauOffline.h index 4ec3b54f5d51e..4465cfb31f04b 100644 --- a/DQMOffline/L1Trigger/interface/L1TTauOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TTauOffline.h @@ -172,6 +172,9 @@ class L1TTauOffline : public DQMEDAnalyzer { std::vector m_trigIndices; + //V.M. 16.3.2023. Temporary variable for checking the anti-ele discriminator + bool m_AntiEleExists; + // Histograms MonitorElement* h_nVertex_; MonitorElement* h_tagAndProbeMass_; diff --git a/DQMOffline/L1Trigger/python/L1TTauOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TTauOffline_cfi.py index 1d3dc9bc1ad17..78363620fd3e8 100644 --- a/DQMOffline/L1Trigger/python/L1TTauOffline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TTauOffline_cfi.py @@ -31,7 +31,7 @@ l1tInputTag = cms.untracked.InputTag("caloStage2Digis:Tau"), vtxInputTag = cms.untracked.InputTag("offlinePrimaryVertices"), bsInputTag = cms.untracked.InputTag("offlineBeamSpot"), - triggerNames = cms.untracked.vstring("HLT_IsoMu18_v*","HLT_IsoMu20_v*","HLT_IsoMu22_v*","HLT_IsoMu24_v*","HLT_IsoMu27_v*"), + triggerNames = cms.untracked.vstring("HLT_IsoMu18_v*","HLT_IsoMu20_v*","HLT_IsoMu22_v*","HLT_IsoMu24_v*","HLT_IsoMu27_v*", "HLT_IsoMu30_v*"), trigInputTag = cms.untracked.InputTag("hltTriggerSummaryAOD", "", "HLT"), trigProcess = cms.untracked.string("HLT"), trigProcess_token = cms.untracked.InputTag("TriggerResults","","HLT"), diff --git a/DQMOffline/L1Trigger/src/L1TTauOffline.cc b/DQMOffline/L1Trigger/src/L1TTauOffline.cc index 5faf7ef570bf1..13b1a04649fdd 100644 --- a/DQMOffline/L1Trigger/src/L1TTauOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TTauOffline.cc @@ -533,10 +533,20 @@ bool L1TTauOffline::matchHlt(edm::Handle const& triggerEv trigger::TriggerObjectCollection trigObjs = triggerEvent->getObjects(); - for (auto trigIndexIt = m_trigIndices.begin(); trigIndexIt != m_trigIndices.end(); ++trigIndexIt) { - const vector moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt)); - const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt)) - 2; - + for (auto& trigIndex : m_trigIndices) { + const vector moduleLabels(m_hltConfig.moduleLabels(trigIndex)); + // V.M. 2023.03.08 Same issue as in the L1TMuonDQMOffline.cc - some modules are behind hltBoolEnd, but we want the last one before the "hltBoolEnd" + int moduleIndex = 999999; + for (int ii = moduleLabels.size() - 1; ii > 0; ii--) { + if (moduleLabels[ii] == "hltBoolEnd") { + moduleIndex = ii - 1; + break; + } + } + if (moduleIndex == 999999) { + edm::LogError("L1TMuonDQMOffline") << "Found no module label in trigger " << trigIndex; + continue; + } const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex], "", trigProcess_)); if (hltFilterIndex < triggerEvent->sizeFilters()) { @@ -553,7 +563,6 @@ bool L1TTauOffline::matchHlt(edm::Handle const& triggerEv } } } - return (matchDeltaR < m_MaxHltTauDR); } @@ -634,28 +643,29 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, edm::Handle antimu; iEvent.getByToken(AntiMuInputTag_, antimu); if (!antimu.isValid()) { - edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl; + edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator anti-mu"; return; } edm::Handle dmf; iEvent.getByToken(DecayModeFindingInputTag_, dmf); if (!dmf.isValid()) { - edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl; + edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator decay mode finding input"; return; } + m_AntiEleExists = true; edm::Handle antiele; iEvent.getByToken(AntiEleInputTag_, antiele); if (!antiele.isValid()) { - edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl; - return; + //V.M. 16.3.2023. Bypassing the return option for now, as the anti-ele discr. is not available. + m_AntiEleExists = false; } edm::Handle comb3T; iEvent.getByToken(comb3TInputTag_, comb3T); if (!comb3T.isValid()) { - edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl; + edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator comb3T"; return; } @@ -678,13 +688,15 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, } } { - const edm::Provenance* prov = antiele.provenance(); - const std::vector psetsFromProvenance = - edm::parameterSet(prov->stable(), iEvent.processHistory()) - .getParameter>("workingPoints"); - for (uint i = 0; i < psetsFromProvenance.size(); i++) { - if (psetsFromProvenance[i] == AntiEleWP_) - AntiEleWPIndex_ = i; + if (m_AntiEleExists) { + const edm::Provenance* prov = antiele.provenance(); + const std::vector psetsFromProvenance = + edm::parameterSet(prov->stable(), iEvent.processHistory()) + .getParameter>("workingPoints"); + for (unsigned int i = 0; i < psetsFromProvenance.size(); i++) { + if (psetsFromProvenance[i] == AntiEleWP_) + AntiEleWPIndex_ = i; + } } } { @@ -705,21 +717,26 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent, mytau.SetPtEtaPhiE(tauIt->pt(), tauIt->eta(), tauIt->phi(), tauIt->energy()); if ((*antimu)[tauCandidate].workingPoints.empty()) { - edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping" << std::endl; + edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping"; continue; } - if ((*antiele)[tauCandidate].workingPoints.empty()) { - edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping" << std::endl; - continue; + if (m_AntiEleExists) { + if ((*antiele)[tauCandidate].workingPoints.empty()) { + edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping"; + continue; + } } if ((*comb3T)[tauCandidate].workingPoints.empty()) { - edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping" << std::endl; + edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping"; continue; } + bool antiele_condition = true; + + if (m_AntiEleExists) + antiele_condition = (*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_]; if (fabs(tauIt->charge()) == 1 && fabs(tauIt->eta()) < 2.1 && tauIt->pt() > 20 && - (*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] && - (*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_] && (*dmf)[tauCandidate] > 0.5 && + (*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] && antiele_condition && (*dmf)[tauCandidate] > 0.5 && (*comb3T)[tauCandidate].workingPoints[comb3TWPIndex_]) { if (mymu.DeltaR(mytau) > 0.5 && (mymu + mytau).M() > 40 && (mymu + mytau).M() < 80 && m_TightMuons[0]->charge() * tauIt->charge() < 0) { diff --git a/DQMOffline/MuonDPG/plugins/GEMTnPEfficiencyTask.cc b/DQMOffline/MuonDPG/plugins/GEMTnPEfficiencyTask.cc new file mode 100644 index 0000000000000..f69a9a0054dc7 --- /dev/null +++ b/DQMOffline/MuonDPG/plugins/GEMTnPEfficiencyTask.cc @@ -0,0 +1,843 @@ +/* + * \file GEMTnPEfficiencyTask.cc + * \author Qianying + * + * \interited from the TnP framework of + * \author L. Lunerti - INFN Bologna + * + */ + +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DataFormats/MuonReco/interface/MuonSegmentMatch.h" +#include "DataFormats/MuonReco/interface/MuonGEMHitMatch.h" + +#include "DQMOffline/MuonDPG/interface/BaseTnPEfficiencyTask.h" + +class GEMTnPEfficiencyTask : public BaseTnPEfficiencyTask { +public: + /// Constructor + GEMTnPEfficiencyTask(const edm::ParameterSet& config); + + /// Destructor + ~GEMTnPEfficiencyTask() override; + +protected: + std::string topFolder() const override; + + void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& context) override; + + /// Analyze + void analyze(const edm::Event& event, const edm::EventSetup& context) override; +}; + +GEMTnPEfficiencyTask::GEMTnPEfficiencyTask(const edm::ParameterSet& config) : BaseTnPEfficiencyTask(config) { + LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: Constructor" << std::endl; +} + +GEMTnPEfficiencyTask::~GEMTnPEfficiencyTask() { + LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") + << "[GEMTnPEfficiencyTask]: analyzed " << m_nEvents << " events" << std::endl; +} + +void GEMTnPEfficiencyTask::bookHistograms(DQMStore::IBooker& iBooker, + edm::Run const& run, + edm::EventSetup const& context) { + BaseTnPEfficiencyTask::bookHistograms(iBooker, run, context); + + LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: bookHistograms" << std::endl; + + auto baseDir = topFolder() + "Task/"; + iBooker.setCurrentFolder(baseDir); + + MonitorElement* me_GEM_pass_Ch_region = + iBooker.book2D("GEM_nPassingProbe_Ch_region", "GEM_nPassingProbe_Ch_region", 2, -1.5, 1.5, 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_region = + iBooker.book2D("GEM_nFailingProbe_Ch_region", "GEM_nFailingProbe_Ch_region", 2, -1.5, 1.5, 36, 1, 37); + MonitorElement* me_GEM_pass_Ch_region_GE1 = + iBooker.book2D("GEM_nPassingProbe_Ch_region_GE1", "GEM_nPassingProbe_Ch_region_GE1", 4, 0, 4, 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_region_GE1 = + iBooker.book2D("GEM_nFailingProbe_Ch_region_GE1", "GEM_nFailingProbe_Ch_region_GE1", 4, 0, 4, 36, 1, 37); + MonitorElement* me_GEM_pass_Ch_region_GE1_NoL = + iBooker.book2D("GEM_nPassingProbe_Ch_region_GE1_NoL", "GEM_nPassingProbe_Ch_region_GE1_NoL", 2, 0, 2, 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_region_GE1_NoL = + iBooker.book2D("GEM_nFailingProbe_Ch_region_GE1_NoL", "GEM_nFailingProbe_Ch_region_GE1_NoL", 2, 0, 2, 36, 1, 37); + MonitorElement* me_GEM_pass_Ch_eta = + iBooker.book2D("GEM_nPassingProbe_Ch_eta", "GEM_nPassingProbe_Ch_eta", 24, 0, 2.4, 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_eta = + iBooker.book2D("GEM_nFailingProbe_Ch_eta", "GEM_nFailingProbe_Ch_eta", 24, 0, 2.4, 36, 1, 37); + MonitorElement* me_GEM_pass_Ch_phi = + iBooker.book2D("GEM_nPassingProbe_Ch_phi", "GEM_nPassingProbe_Ch_phi", 20, -TMath::Pi(), TMath::Pi(), 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_phi = + iBooker.book2D("GEM_nFailingProbe_Ch_phi", "GEM_nFailingProbe_Ch_phi", 20, -TMath::Pi(), TMath::Pi(), 36, 1, 37); + MonitorElement* me_GEM_pass_allCh_1D = + iBooker.book1D("GEM_nPassingProbe_allCh_1D", "GEM_nPassingProbe_allCh_1D", 2, -1.5, 1.5); + MonitorElement* me_GEM_fail_allCh_1D = + iBooker.book1D("GEM_nFailingProbe_allCh_1D", "GEM_nFailingProbe_allCh_1D", 2, -1.5, 1.5); + MonitorElement* me_GEM_pass_chamber_1D = + iBooker.book1D("GEM_nPassingProbe_chamber_1D", "GEM_nPassingProbe_chamber_1D", 36, 1, 37); + MonitorElement* me_GEM_fail_chamber_1D = + iBooker.book1D("GEM_nFailingProbe_chamber_1D", "GEM_nFailingProbe_chamber_1D", 36, 1, 37); + MonitorElement* me_GEM_pass_chamber_p1_1D = + iBooker.book1D("GEM_nPassingProbe_chamber_p1_1D", "GEM_nPassingProbe_chamber_p1_1D", 36, 1, 37); + MonitorElement* me_GEM_fail_chamber_p1_1D = + iBooker.book1D("GEM_nFailingProbe_chamber_p1_1D", "GEM_nFailingProbe_chamber_p1_1D", 36, 1, 37); + MonitorElement* me_GEM_pass_chamber_p2_1D = + iBooker.book1D("GEM_nPassingProbe_chamber_p2_1D", "GEM_nPassingProbe_chamber_p2_1D", 36, 1, 37); + MonitorElement* me_GEM_fail_chamber_p2_1D = + iBooker.book1D("GEM_nFailingProbe_chamber_p2_1D", "GEM_nFailingProbe_chamber_p2_1D", 36, 1, 37); + MonitorElement* me_GEM_pass_chamber_n1_1D = + iBooker.book1D("GEM_nPassingProbe_chamber_n1_1D", "GEM_nPassingProbe_chamber_n1_1D", 36, 1, 37); + MonitorElement* me_GEM_fail_chamber_n1_1D = + iBooker.book1D("GEM_nFailingProbe_chamber_n1_1D", "GEM_nFailingProbe_chamber_n1_1D", 36, 1, 37); + MonitorElement* me_GEM_pass_chamber_n2_1D = + iBooker.book1D("GEM_nPassingProbe_chamber_n2_1D", "GEM_nPassingProbe_chamber_n2_1D", 36, 1, 37); + MonitorElement* me_GEM_fail_chamber_n2_1D = + iBooker.book1D("GEM_nFailingProbe_chamber_n2_1D", "GEM_nFailingProbe_chamber_n2_1D", 36, 1, 37); + // + MonitorElement* me_GEM_pass_pt_1D = iBooker.book1D("GEM_nPassingProbe_pt_1D", "GEM_nPassingProbe_pt_1D", 20, 0, 100); + MonitorElement* me_GEM_fail_pt_1D = iBooker.book1D("GEM_nFailingProbe_pt_1D", "GEM_nFailingProbe_pt_1D", 20, 0, 100); + MonitorElement* me_GEM_pass_eta_1D = + iBooker.book1D("GEM_nPassingProbe_eta_1D", "GEM_nPassingProbe_eta_1D", 24, 0, 2.4); + MonitorElement* me_GEM_fail_eta_1D = + iBooker.book1D("GEM_nFailingProbe_eta_1D", "GEM_nFailingProbe_eta_1D", 24, 0, 2.4); + MonitorElement* me_GEM_pass_phi_1D = + iBooker.book1D("GEM_nPassingProbe_phi_1D", "GEM_nPassingProbe_phi_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_fail_phi_1D = + iBooker.book1D("GEM_nFailingProbe_phi_1D", "GEM_nFailingProbe_phi_1D", 20, -TMath::Pi(), TMath::Pi()); + /// + MonitorElement* me_GEM_pass_pt_p1_1D = + iBooker.book1D("GEM_nPassingProbe_pt_p1_1D", "GEM_nPassingProbe_pt_p1_1D", 20, 0, 100); + MonitorElement* me_GEM_fail_pt_p1_1D = + iBooker.book1D("GEM_nFailingProbe_pt_p1_1D", "GEM_nFailingProbe_pt_p1_1D", 20, 0, 100); + MonitorElement* me_GEM_pass_eta_p1_1D = + iBooker.book1D("GEM_nPassingProbe_eta_p1_1D", "GEM_nPassingProbe_eta_p1_1D", 24, 0, 2.4); + MonitorElement* me_GEM_fail_eta_p1_1D = + iBooker.book1D("GEM_nFailingProbe_eta_p1_1D", "GEM_nFailingProbe_eta_p1_1D", 24, 0, 2.4); + MonitorElement* me_GEM_pass_phi_p1_1D = + iBooker.book1D("GEM_nPassingProbe_phi_p1_1D", "GEM_nPassingProbe_phi_p1_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_fail_phi_p1_1D = + iBooker.book1D("GEM_nFailingProbe_phi_p1_1D", "GEM_nFailingProbe_phi_p1_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_pass_pt_p2_1D = + iBooker.book1D("GEM_nPassingProbe_pt_p2_1D", "GEM_nPassingProbe_pt_p2_1D", 20, 0, 100); + MonitorElement* me_GEM_fail_pt_p2_1D = + iBooker.book1D("GEM_nFailingProbe_pt_p2_1D", "GEM_nFailingProbe_pt_p2_1D", 20, 0, 100); + MonitorElement* me_GEM_pass_eta_p2_1D = + iBooker.book1D("GEM_nPassingProbe_eta_p2_1D", "GEM_nPassingProbe_eta_p2_1D", 24, 0, 2.4); + MonitorElement* me_GEM_fail_eta_p2_1D = + iBooker.book1D("GEM_nFailingProbe_eta_p2_1D", "GEM_nFailingProbe_eta_p2_1D", 24, 0, 2.4); + MonitorElement* me_GEM_pass_phi_p2_1D = + iBooker.book1D("GEM_nPassingProbe_phi_p2_1D", "GEM_nPassingProbe_phi_p2_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_fail_phi_p2_1D = + iBooker.book1D("GEM_nFailingProbe_phi_p2_1D", "GEM_nFailingProbe_phi_p2_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_pass_pt_n1_1D = + iBooker.book1D("GEM_nPassingProbe_pt_n1_1D", "GEM_nPassingProbe_pt_n1_1D", 20, 0, 100); + MonitorElement* me_GEM_fail_pt_n1_1D = + iBooker.book1D("GEM_nFailingProbe_pt_n1_1D", "GEM_nFailingProbe_pt_n1_1D", 20, 0, 100); + MonitorElement* me_GEM_pass_eta_n1_1D = + iBooker.book1D("GEM_nPassingProbe_eta_n1_1D", "GEM_nPassingProbe_eta_n1_1D", 24, 0, 2.4); + MonitorElement* me_GEM_fail_eta_n1_1D = + iBooker.book1D("GEM_nFailingProbe_eta_n1_1D", "GEM_nFailingProbe_eta_n1_1D", 24, 0, 2.4); + MonitorElement* me_GEM_pass_phi_n1_1D = + iBooker.book1D("GEM_nPassingProbe_phi_n1_1D", "GEM_nPassingProbe_phi_n1_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_fail_phi_n1_1D = + iBooker.book1D("GEM_nFailingProbe_phi_n1_1D", "GEM_nFailingProbe_phi_n1_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_pass_pt_n2_1D = + iBooker.book1D("GEM_nPassingProbe_pt_n2_1D", "GEM_nPassingProbe_pt_n2_1D", 20, 0, 100); + MonitorElement* me_GEM_fail_pt_n2_1D = + iBooker.book1D("GEM_nFailingProbe_pt_n2_1D", "GEM_nFailingProbe_pt_n2_1D", 20, 0, 100); + MonitorElement* me_GEM_pass_eta_n2_1D = + iBooker.book1D("GEM_nPassingProbe_eta_n2_1D", "GEM_nPassingProbe_eta_n2_1D", 24, 0, 2.4); + MonitorElement* me_GEM_fail_eta_n2_1D = + iBooker.book1D("GEM_nFailingProbe_eta_n2_1D", "GEM_nFailingProbe_eta_n2_1D", 24, 0, 2.4); + MonitorElement* me_GEM_pass_phi_n2_1D = + iBooker.book1D("GEM_nPassingProbe_phi_n2_1D", "GEM_nPassingProbe_phi_n2_1D", 20, -TMath::Pi(), TMath::Pi()); + MonitorElement* me_GEM_fail_phi_n2_1D = + iBooker.book1D("GEM_nFailingProbe_phi_n2_1D", "GEM_nFailingProbe_phi_n2_1D", 20, -TMath::Pi(), TMath::Pi()); + //// + MonitorElement* me_ME0_pass_chamber_1D = + iBooker.book1D("ME0_nPassingProbe_chamber_1D", "ME0_nPassingProbe_chamber_1D", 18, 1, 19); + MonitorElement* me_ME0_fail_chamber_1D = + iBooker.book1D("ME0_nFailingProbe_chamber_1D", "ME0_nFailingProbe_chamber_1D", 18, 1, 19); + MonitorElement* me_GEM_pass_Ch_region_layer_phase2 = iBooker.book2D( + "GEM_nPassingProbe_Ch_region_layer_phase2", "GEM_nPassingProbe_Ch_region_layer_phase2", 10, 0, 10, 36, 1, 37); + MonitorElement* me_GEM_fail_Ch_region_layer_phase2 = iBooker.book2D( + "GEM_nFailingProbe_Ch_region_layer_phase2", "GEM_nFailingProbe_Ch_region_layer_phase2", 10, 0, 10, 36, 1, 37); + + me_GEM_pass_allCh_1D->setBinLabel(1, "GE-11", 1); + me_GEM_pass_allCh_1D->setBinLabel(2, "GE11", 1); + me_GEM_pass_allCh_1D->setAxisTitle("Number of passing probes", 2); + + me_GEM_fail_allCh_1D->setBinLabel(1, "GE-11", 1); + me_GEM_fail_allCh_1D->setBinLabel(2, "GE11", 1); + me_GEM_fail_allCh_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_chamber_1D->setAxisTitle("Chamber", 1); + me_GEM_pass_chamber_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_chamber_1D->setAxisTitle("Chamber", 1); + me_GEM_fail_chamber_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_chamber_p1_1D->setAxisTitle("Chamber", 1); + me_GEM_pass_chamber_p1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_chamber_p1_1D->setAxisTitle("Chamber", 1); + me_GEM_fail_chamber_p1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_chamber_p2_1D->setAxisTitle("Chamber", 1); + me_GEM_pass_chamber_p2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_chamber_p2_1D->setAxisTitle("Chamber", 1); + me_GEM_fail_chamber_p2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_chamber_n1_1D->setAxisTitle("Chamber", 1); + me_GEM_pass_chamber_n1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_chamber_n1_1D->setAxisTitle("Chamber", 1); + me_GEM_fail_chamber_n1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_chamber_n2_1D->setAxisTitle("Chamber", 1); + me_GEM_pass_chamber_n2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_chamber_n2_1D->setAxisTitle("Chamber", 1); + me_GEM_fail_chamber_n2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_pt_1D->setAxisTitle("P_{T}", 1); + me_GEM_pass_pt_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_pt_1D->setAxisTitle("P_{T}", 1); + me_GEM_fail_pt_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_eta_1D->setAxisTitle("#eta", 1); + me_GEM_pass_eta_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_eta_1D->setAxisTitle("#eta", 1); + me_GEM_fail_eta_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_phi_1D->setAxisTitle("#phi", 1); + me_GEM_pass_phi_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_phi_1D->setAxisTitle("#phi", 1); + me_GEM_fail_phi_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_pt_p1_1D->setAxisTitle("P_{T}", 1); + me_GEM_pass_pt_p1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_pt_p1_1D->setAxisTitle("P_{T}", 1); + me_GEM_fail_pt_p1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_eta_p1_1D->setAxisTitle("#eta", 1); + me_GEM_pass_eta_p1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_eta_p1_1D->setAxisTitle("#eta", 1); + me_GEM_fail_eta_p1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_phi_p1_1D->setAxisTitle("#phi", 1); + me_GEM_pass_phi_p1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_phi_p1_1D->setAxisTitle("#phi", 1); + me_GEM_fail_phi_p1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_pt_p2_1D->setAxisTitle("P_{T}", 1); + me_GEM_pass_pt_p2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_pt_p2_1D->setAxisTitle("P_{T}", 1); + me_GEM_fail_pt_p2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_eta_p2_1D->setAxisTitle("#eta", 1); + me_GEM_pass_eta_p2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_eta_p2_1D->setAxisTitle("#eta", 1); + me_GEM_fail_eta_p2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_phi_p2_1D->setAxisTitle("#phi", 1); + me_GEM_pass_phi_p2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_phi_p2_1D->setAxisTitle("#phi", 1); + me_GEM_fail_phi_p2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_pt_n1_1D->setAxisTitle("P_{T}", 1); + me_GEM_pass_pt_n1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_pt_n1_1D->setAxisTitle("P_{T}", 1); + me_GEM_fail_pt_n1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_eta_n1_1D->setAxisTitle("#eta", 1); + me_GEM_pass_eta_n1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_eta_n1_1D->setAxisTitle("#eta", 1); + me_GEM_fail_eta_n1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_phi_n1_1D->setAxisTitle("#phi", 1); + me_GEM_pass_phi_n1_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_phi_n1_1D->setAxisTitle("#phi", 1); + me_GEM_fail_phi_n1_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_pt_n2_1D->setAxisTitle("P_{T}", 1); + me_GEM_pass_pt_n2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_pt_n2_1D->setAxisTitle("P_{T}", 1); + me_GEM_fail_pt_n2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_eta_n2_1D->setAxisTitle("#eta", 1); + me_GEM_pass_eta_n2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_eta_n2_1D->setAxisTitle("#eta", 1); + me_GEM_fail_eta_n2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_pass_phi_n2_1D->setAxisTitle("#phi", 1); + me_GEM_pass_phi_n2_1D->setAxisTitle("Number of passing probes", 2); + me_GEM_fail_phi_n2_1D->setAxisTitle("#phi", 1); + me_GEM_fail_phi_n2_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_fail_Ch_region->setBinLabel(1, "GE-11", 1); + me_GEM_fail_Ch_region->setBinLabel(2, "GE11", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_region->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_region->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_region->setAxisTitle("Number of failing probes", 3); + + me_GEM_pass_Ch_region->setBinLabel(1, "GE-11", 1); + me_GEM_pass_Ch_region->setBinLabel(2, "GE11", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_region->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_region->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_region->setAxisTitle("Number of passing probes", 3); + + me_GEM_fail_Ch_region_GE1->setBinLabel(1, "GE-1/1_L2", 1); + me_GEM_fail_Ch_region_GE1->setBinLabel(2, "GE-1/1_L1", 1); + me_GEM_fail_Ch_region_GE1->setBinLabel(3, "GE1/1_L1", 1); + me_GEM_fail_Ch_region_GE1->setBinLabel(4, "GE1/1_L2", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_region_GE1->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_region_GE1->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_region_GE1->setAxisTitle("Number of passing probes", 3); + + me_GEM_pass_Ch_region_GE1->setBinLabel(1, "GE-1/1_L2", 1); + me_GEM_pass_Ch_region_GE1->setBinLabel(2, "GE-1/1_L1", 1); + me_GEM_pass_Ch_region_GE1->setBinLabel(3, "GE1/1_L1", 1); + me_GEM_pass_Ch_region_GE1->setBinLabel(4, "GE1/1_L2", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_region_GE1->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_region_GE1->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_region_GE1->setAxisTitle("Number of passing probes", 3); + + me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(1, "GE-1", 1); + me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(2, "GE+1", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_region_GE1_NoL->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_region_GE1_NoL->setAxisTitle("Number of passing probes", 3); + + me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(1, "GE-1", 1); + me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(2, "GE+1", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_region_GE1_NoL->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_region_GE1_NoL->setAxisTitle("Number of passing probes", 3); + + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_eta->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_eta->setAxisTitle("#eta", 1); + me_GEM_fail_Ch_eta->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_eta->setAxisTitle("Number of failing probes", 3); + + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_eta->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_eta->setAxisTitle("#eta", 1); + me_GEM_pass_Ch_eta->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_eta->setAxisTitle("Number of passing probes", 3); + + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_phi->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_phi->setAxisTitle("#phi", 1); + me_GEM_fail_Ch_phi->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_phi->setAxisTitle("Number of failing probes", 3); + + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_phi->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_phi->setAxisTitle("#phi", 1); + me_GEM_pass_Ch_phi->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_phi->setAxisTitle("Number of passing probes", 3); + + for (int i = 1; i < 19; ++i) { + me_ME0_pass_chamber_1D->setBinLabel(i, std::to_string(i), 1); + } + me_ME0_pass_chamber_1D->setAxisTitle("Chamber", 1); + me_ME0_pass_chamber_1D->setAxisTitle("Number of passing probes", 2); + for (int i = 1; i < 19; ++i) { + me_ME0_fail_chamber_1D->setBinLabel(i, std::to_string(i), 1); + } + me_ME0_fail_chamber_1D->setAxisTitle("Chamber", 1); + me_ME0_fail_chamber_1D->setAxisTitle("Number of failing probes", 2); + + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(1, "GE-2/1_L2", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(2, "GE-2/1_L1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(3, "GE-1/1_L2", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(4, "GE-1/1_L1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(5, "GE0-1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(6, "GE0+1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(7, "GE1/1_L1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(8, "GE1/1_L2", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(9, "GE2/1_L1", 1); + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(10, "GE2/1_L2", 1); + for (int i = 1; i < 37; ++i) { + me_GEM_fail_Ch_region_layer_phase2->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_fail_Ch_region_layer_phase2->setAxisTitle("Chamber", 2); + me_GEM_fail_Ch_region_layer_phase2->setAxisTitle("Number of passing probes", 3); + + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(1, "GE-2/1_L2", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(2, "GE-2/1_L1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(3, "GE-1/1_L2", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(4, "GE-1/1_L1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(5, "GE0-1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(6, "GE0+1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(7, "GE1/1_L1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(8, "GE1/1_L2", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(9, "GE2/1_L1", 1); + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(10, "GE2/1_L2", 1); + + for (int i = 1; i < 37; ++i) { + me_GEM_pass_Ch_region_layer_phase2->setBinLabel(i, std::to_string(i), 2); + } + me_GEM_pass_Ch_region_layer_phase2->setAxisTitle("Chamber", 2); + me_GEM_pass_Ch_region_layer_phase2->setAxisTitle("Number of passing probes", 3); + + m_histos["GEM_nPassingProbe_Ch_region"] = me_GEM_pass_Ch_region; + m_histos["GEM_nFailingProbe_Ch_region"] = me_GEM_fail_Ch_region; + m_histos["GEM_nPassingProbe_Ch_region_GE1"] = me_GEM_pass_Ch_region_GE1; + m_histos["GEM_nFailingProbe_Ch_region_GE1"] = me_GEM_fail_Ch_region_GE1; + m_histos["GEM_nPassingProbe_Ch_region_GE1_NoL"] = me_GEM_pass_Ch_region_GE1_NoL; + m_histos["GEM_nFailingProbe_Ch_region_GE1_NoL"] = me_GEM_fail_Ch_region_GE1_NoL; + m_histos["GEM_nPassingProbe_Ch_eta"] = me_GEM_pass_Ch_eta; + m_histos["GEM_nFailingProbe_Ch_eta"] = me_GEM_fail_Ch_eta; + m_histos["GEM_nPassingProbe_Ch_phi"] = me_GEM_pass_Ch_phi; + m_histos["GEM_nFailingProbe_Ch_phi"] = me_GEM_fail_Ch_phi; + m_histos["GEM_nPassingProbe_allCh_1D"] = me_GEM_pass_allCh_1D; + m_histos["GEM_nFailingProbe_allCh_1D"] = me_GEM_fail_allCh_1D; + m_histos["GEM_nPassingProbe_chamber_1D"] = me_GEM_pass_chamber_1D; + m_histos["GEM_nFailingProbe_chamber_1D"] = me_GEM_fail_chamber_1D; + m_histos["GEM_nPassingProbe_chamber_p1_1D"] = me_GEM_pass_chamber_p1_1D; + m_histos["GEM_nFailingProbe_chamber_p1_1D"] = me_GEM_fail_chamber_p1_1D; + m_histos["GEM_nPassingProbe_chamber_p2_1D"] = me_GEM_pass_chamber_p2_1D; + m_histos["GEM_nFailingProbe_chamber_p2_1D"] = me_GEM_fail_chamber_p2_1D; + m_histos["GEM_nPassingProbe_chamber_n1_1D"] = me_GEM_pass_chamber_n1_1D; + m_histos["GEM_nFailingProbe_chamber_n1_1D"] = me_GEM_fail_chamber_n1_1D; + m_histos["GEM_nPassingProbe_chamber_n2_1D"] = me_GEM_pass_chamber_n2_1D; + m_histos["GEM_nFailingProbe_chamber_n2_1D"] = me_GEM_fail_chamber_n2_1D; + m_histos["GEM_nPassingProbe_pt_1D"] = me_GEM_pass_pt_1D; + m_histos["GEM_nFailingProbe_pt_1D"] = me_GEM_fail_pt_1D; + m_histos["GEM_nPassingProbe_eta_1D"] = me_GEM_pass_eta_1D; + m_histos["GEM_nFailingProbe_eta_1D"] = me_GEM_fail_eta_1D; + m_histos["GEM_nPassingProbe_phi_1D"] = me_GEM_pass_phi_1D; + m_histos["GEM_nFailingProbe_phi_1D"] = me_GEM_fail_phi_1D; + m_histos["GEM_nPassingProbe_pt_p1_1D"] = me_GEM_pass_pt_p1_1D; + m_histos["GEM_nFailingProbe_pt_p1_1D"] = me_GEM_fail_pt_p1_1D; + m_histos["GEM_nPassingProbe_eta_p1_1D"] = me_GEM_pass_eta_p1_1D; + m_histos["GEM_nFailingProbe_eta_p1_1D"] = me_GEM_fail_eta_p1_1D; + m_histos["GEM_nPassingProbe_phi_p1_1D"] = me_GEM_pass_phi_p1_1D; + m_histos["GEM_nFailingProbe_phi_p1_1D"] = me_GEM_fail_phi_p1_1D; + m_histos["GEM_nPassingProbe_pt_p2_1D"] = me_GEM_pass_pt_p2_1D; + m_histos["GEM_nFailingProbe_pt_p2_1D"] = me_GEM_fail_pt_p2_1D; + m_histos["GEM_nPassingProbe_eta_p2_1D"] = me_GEM_pass_eta_p2_1D; + m_histos["GEM_nFailingProbe_eta_p2_1D"] = me_GEM_fail_eta_p2_1D; + m_histos["GEM_nPassingProbe_phi_p2_1D"] = me_GEM_pass_phi_p2_1D; + m_histos["GEM_nFailingProbe_phi_p2_1D"] = me_GEM_fail_phi_p2_1D; + m_histos["GEM_nPassingProbe_pt_n1_1D"] = me_GEM_pass_pt_n1_1D; + m_histos["GEM_nFailingProbe_pt_n1_1D"] = me_GEM_fail_pt_n1_1D; + m_histos["GEM_nPassingProbe_eta_n1_1D"] = me_GEM_pass_eta_n1_1D; + m_histos["GEM_nFailingProbe_eta_n1_1D"] = me_GEM_fail_eta_n1_1D; + m_histos["GEM_nPassingProbe_phi_n1_1D"] = me_GEM_pass_phi_n1_1D; + m_histos["GEM_nFailingProbe_phi_n1_1D"] = me_GEM_fail_phi_n1_1D; + m_histos["GEM_nPassingProbe_pt_n2_1D"] = me_GEM_pass_pt_n2_1D; + m_histos["GEM_nFailingProbe_pt_n2_1D"] = me_GEM_fail_pt_n2_1D; + m_histos["GEM_nPassingProbe_eta_n2_1D"] = me_GEM_pass_eta_n2_1D; + m_histos["GEM_nFailingProbe_eta_n2_1D"] = me_GEM_fail_eta_n2_1D; + m_histos["GEM_nPassingProbe_phi_n2_1D"] = me_GEM_pass_phi_n2_1D; + m_histos["GEM_nFailingProbe_phi_n2_1D"] = me_GEM_fail_phi_n2_1D; + m_histos["ME0_nPassingProbe_chamber_1D"] = me_ME0_pass_chamber_1D; + m_histos["ME0_nFailingProbe_chamber_1D"] = me_ME0_fail_chamber_1D; + m_histos["GEM_nPassingProbe_Ch_region_layer_phase2"] = me_GEM_pass_Ch_region_layer_phase2; + m_histos["GEM_nFailingProbe_Ch_region_layer_phase2"] = me_GEM_fail_Ch_region_layer_phase2; + + std::string baseDir_ = topFolder() + "/detailed/"; + iBooker.setCurrentFolder(baseDir_); + m_histos["GEMhit_dx"] = iBooker.book1D("GEMhit_dx", "GEMhit_dx;probe dx [cm];Events", 100, 0., 10.); + m_histos["GEMseg_dx"] = iBooker.book1D("GEMseg_dx", "GEMseg_dx;probe dx [cm];Events", 100, 0., 20.); + + m_histos["GEMhit_x"] = iBooker.book1D("GEMhit_x", "GEMhit_x;probe x [cm];Events", 100, -10., 10.); + m_histos["GEMhit_x_GE2"] = iBooker.book1D("GEMhit_x_GE2", "GEMhit_x;probe x [cm];Events", 100, -10., 10.); + m_histos["Cham_x"] = iBooker.book1D("Cham_x", "Cham_x;probe x [cm];Events", 100, -10., 10.); + m_histos["Cham_x_GE2"] = iBooker.book1D("Cham_x_GE2", "Cham_x;probe x [cm];Events", 100, -10., 10.); + + m_histos["GEMhit_dx_GE2"] = iBooker.book1D("GEMhit_dx_GE2", "GEMhit_dx;probe dx [cm];Events", 100, 0., 10.); +} + +void GEMTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetup& context) { + BaseTnPEfficiencyTask::analyze(event, context); + + edm::Handle muons; + event.getByToken(m_muToken, muons); + + //GEM variables + std::vector> probe_coll_GEM_region; + std::vector> probe_coll_GEM_lay; + std::vector> probe_coll_GEM_chamber; + std::vector> probe_coll_GEM_pt; + std::vector> probe_coll_GEM_eta; + std::vector> probe_coll_GEM_phi; + std::vector> probe_coll_GEM_sta; + std::vector> probe_coll_GEM_dx; + std::vector probe_coll_GEM_staMatch; + + //ME0 variables + std::vector> probe_coll_ME0_region; + std::vector> probe_coll_ME0_roll; + std::vector> probe_coll_ME0_lay; + std::vector> probe_coll_ME0_chamber; + std::vector> probe_coll_ME0_pt; + std::vector> probe_coll_ME0_eta; + std::vector> probe_coll_ME0_phi; + std::vector> probe_coll_ME0_sta; + std::vector> probe_coll_ME0_dx; + std::vector probe_coll_ME0_staMatch; + + std::vector probe_indices; + if (!m_probeIndices.empty()) + probe_indices = m_probeIndices.back(); + + //Fill probe dx + subdetector coordinates + for (const auto i : probe_indices) { + //GEM variables + std::vector probe_GEM_region; + std::vector probe_GEM_sta; + std::vector probe_GEM_lay; + std::vector probe_GEM_chamber; + std::vector probe_GEM_pt; + std::vector probe_GEM_eta; + std::vector probe_GEM_phi; + std::vector probe_GEM_dx; + //std::vector probe_GEM_dx_seg; + uint8_t GEM_stationMatching = 0; + //ME0 variables + std::vector probe_ME0_region; + std::vector probe_ME0_roll; + std::vector probe_ME0_sta; + std::vector probe_ME0_lay; + std::vector probe_ME0_chamber; + std::vector probe_ME0_pt; + std::vector probe_ME0_eta; + std::vector probe_ME0_phi; + std::vector probe_ME0_dx; + uint8_t ME0_stationMatching = 0; + + bool gem_matched = false; // fill detailed plots only for probes matching GEM + + for (const auto& chambMatch : (*muons).at(i).matches()) { + // look in GEMs + if (chambMatch.detector() == MuonSubdetId::GEM) { + if (chambMatch.edgeX < m_borderCut && chambMatch.edgeY < m_borderCut) { + gem_matched = true; //fill detailed plots if at least one GEM match + + GEMDetId chId(chambMatch.id.rawId()); + + const int roll = chId.roll(); + const int region = chId.region(); + const int station = chId.station(); + const int layer = chId.layer(); + const int chamber = chId.chamber(); + const float pt = (*muons).at(i).pt(); + const float eta = (*muons).at(i).eta(); + const float phi = (*muons).at(i).phi(); + + reco::MuonGEMHitMatch closest_matchedHit; + double smallestDx = 99999.; + double matched_GEMHit_x = 99999.; + + for (auto& gemHit : chambMatch.gemHitMatches) { + float dx = std::abs(chambMatch.x - gemHit.x); + if (dx < smallestDx) { + smallestDx = dx; + closest_matchedHit = gemHit; + matched_GEMHit_x = gemHit.x; + } + } + + reco::MuonSegmentMatch closest_matchedSegment; + double smallestDx_seg = 99999.; + + for (auto& seg : chambMatch.gemMatches) { + float dx_seg = std::abs(chambMatch.x - seg.x); + if (dx_seg < smallestDx_seg) { + smallestDx_seg = dx_seg; + closest_matchedSegment = seg; + } + } + if (m_detailedAnalysis && gem_matched) { + m_histos.find("GEMhit_dx")->second->Fill(smallestDx); + m_histos.find("GEMhit_x")->second->Fill(matched_GEMHit_x); + m_histos.find("Cham_x")->second->Fill(chambMatch.x); + m_histos.find("GEMseg_dx")->second->Fill(smallestDx_seg); + if (station == 2) { + m_histos.find("GEMhit_dx_GE2")->second->Fill(smallestDx); + m_histos.find("GEMhit_x_GE2")->second->Fill(matched_GEMHit_x); + m_histos.find("Cham_x_GE2")->second->Fill(chambMatch.x); + } + } + + GEM_stationMatching = GEM_stationMatching | (1 << (station - 1)); + + probe_GEM_region.push_back(region); + probe_GEM_sta.push_back(station); + probe_GEM_lay.push_back(layer); + probe_GEM_chamber.push_back(chamber); + probe_GEM_pt.push_back(pt); + probe_GEM_eta.push_back(eta); + probe_GEM_phi.push_back(phi); + probe_GEM_dx.push_back(smallestDx); + //probe_GEM_dx.push_back(smallestDx_seg); + //probe_GEM_dx_seg.push_back(smallestDx_seg); + + if (station == 0) { + reco::MuonSegmentMatch closest_matchedSegment_ME0; + double smallestDx_ME0 = 99999.; + for (auto& seg : chambMatch.gemMatches) { + float dx = std::abs(chambMatch.x - seg.x); + if (dx < smallestDx_ME0) { + smallestDx_ME0 = dx; + closest_matchedSegment_ME0 = seg; + } + } + ME0_stationMatching = ME0_stationMatching | (1 << (station - 1)); + probe_ME0_region.push_back(region); + probe_ME0_roll.push_back(roll); + probe_ME0_sta.push_back(station); + probe_ME0_lay.push_back(layer); + probe_ME0_chamber.push_back(chamber); + probe_ME0_pt.push_back(pt); + probe_ME0_eta.push_back(eta); + probe_ME0_phi.push_back(phi); + probe_ME0_dx.push_back(smallestDx_ME0); + } + } + } else + continue; + } //loop over chamber matches + + //Fill detailed plots + if (m_detailedAnalysis && gem_matched) { + m_histos.find("probeEta")->second->Fill(abs((*muons).at(i).eta())); + m_histos.find("probePhi")->second->Fill((*muons).at(i).phi()); + m_histos.find("probeNumberOfMatchedStations")->second->Fill((*muons).at(i).numberOfMatchedStations()); + m_histos.find("probePt")->second->Fill((*muons).at(i).pt()); + //for(int ii=0; isecond->Fill(probe_GEM_dx[ii]); + // m_histos.find("GEMseg_dx")->second->Fill(probe_GEM_dx_seg[ii]); + //} + } + + //Fill GEM variables + probe_coll_GEM_region.push_back(probe_GEM_region); + probe_coll_GEM_sta.push_back(probe_GEM_sta); + probe_coll_GEM_lay.push_back(probe_GEM_lay); + probe_coll_GEM_chamber.push_back(probe_GEM_chamber); + probe_coll_GEM_pt.push_back(probe_GEM_pt); + probe_coll_GEM_eta.push_back(probe_GEM_eta); + probe_coll_GEM_phi.push_back(probe_GEM_phi); + probe_coll_GEM_dx.push_back(probe_GEM_dx); + probe_coll_GEM_staMatch.push_back(GEM_stationMatching); + + //Fill ME0 variables + probe_coll_ME0_region.push_back(probe_ME0_region); + probe_coll_ME0_roll.push_back(probe_ME0_roll); + probe_coll_ME0_sta.push_back(probe_ME0_sta); + probe_coll_ME0_lay.push_back(probe_ME0_lay); + probe_coll_ME0_chamber.push_back(probe_ME0_chamber); + probe_coll_ME0_pt.push_back(probe_ME0_pt); + probe_coll_ME0_eta.push_back(probe_ME0_eta); + probe_coll_ME0_phi.push_back(probe_ME0_phi); + probe_coll_ME0_dx.push_back(probe_ME0_dx); + probe_coll_ME0_staMatch.push_back(ME0_stationMatching); + + } //loop over probe collection + + //Loop over probes + for (unsigned i = 0; i < probe_indices.size(); ++i) { + uint8_t GEM_matchPatt = probe_coll_GEM_staMatch.at(i); + //uint8_t ME0_matchPatt = probe_coll_ME0_staMatch.at(i); + + //Loop over ME0 matches + unsigned nME0_matches = probe_coll_ME0_region.at(i).size(); + for (unsigned j = 0; j < nME0_matches; ++j) { + //ME0 variables + int ME0_region = probe_coll_ME0_region.at(i).at(j); + //int ME0_roll = probe_coll_ME0_roll.at(i).at(j); + int ME0_sta = probe_coll_ME0_sta.at(i).at(j); + //int ME0_lay = probe_coll_ME0_lay.at(i).at(j); + int ME0_chamber = probe_coll_ME0_chamber.at(i).at(j); + //float ME0_pt = probe_coll_ME0_pt.at(i).at(j); + float ME0_dx = probe_coll_ME0_dx.at(i).at(j); + //float ME0_eta = probe_coll_ME0_eta.at(i).at(j); + //float ME0_phi = probe_coll_ME0_phi.at(i).at(j); + + if (ME0_sta == 0) { + if (ME0_dx < m_dxCut) { + m_histos.find("ME0_nPassingProbe_chamber_1D")->second->Fill(ME0_chamber); + if (ME0_region < 0) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(4, ME0_chamber); + else if (ME0_region > 0) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(5, ME0_chamber); + } else { + m_histos.find("ME0_nFailingProbe_chamber_1D")->second->Fill(ME0_chamber); + if (ME0_region < 0) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(4, ME0_chamber); + else if (ME0_region > 0) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(5, ME0_chamber); + } + } + } + // + + //Loop over GEM matches + unsigned nGEM_matches = probe_coll_GEM_region.at(i).size(); + for (unsigned j = 0; j < nGEM_matches; ++j) { + //GEM variables + int GEM_region = probe_coll_GEM_region.at(i).at(j); + int GEM_sta = probe_coll_GEM_sta.at(i).at(j); + int GEM_lay = probe_coll_GEM_lay.at(i).at(j); + int GEM_chamber = probe_coll_GEM_chamber.at(i).at(j); + float GEM_pt = probe_coll_GEM_pt.at(i).at(j); + float GEM_dx = probe_coll_GEM_dx.at(i).at(j); + float GEM_eta = probe_coll_GEM_eta.at(i).at(j); + float GEM_phi = probe_coll_GEM_phi.at(i).at(j); + + //Fill GEM plots + if (((GEM_matchPatt & (1 << (GEM_sta - 1))) != 0) && GEM_sta != 0) //avoids 0 station matching + { + if (GEM_dx < m_dxCut) { + if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16) + continue; //exclude GE2 ch16 of Run3 + m_histos.find("GEM_nPassingProbe_Ch_region")->second->Fill(GEM_region, GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_eta")->second->Fill(abs(GEM_eta), GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_phi")->second->Fill(GEM_phi, GEM_chamber); + m_histos.find("GEM_nPassingProbe_allCh_1D")->second->Fill(GEM_region); + m_histos.find("GEM_nPassingProbe_chamber_1D")->second->Fill(GEM_chamber); + if (GEM_region < 0) { + if (GEM_sta == 2 and GEM_lay == 2) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(0, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 1) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(1, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 2) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(2, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 1) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(3, GEM_chamber); + } + if (GEM_region > 0) { + if (GEM_sta == 1 and GEM_lay == 1) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(6, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 2) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(7, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 1) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(8, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 2) + m_histos.find("GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(9, GEM_chamber); + } + if (GEM_region == -1 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_Ch_region_GE1_NoL")->second->Fill(0, GEM_chamber); + } else if (GEM_region == 1 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_Ch_region_GE1_NoL")->second->Fill(1, GEM_chamber); + } + + if (GEM_region == 1 && GEM_lay == 1 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_chamber_p1_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_region_GE1")->second->Fill(2, GEM_chamber); + m_histos.find("GEM_nPassingProbe_pt_p1_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nPassingProbe_eta_p1_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nPassingProbe_phi_p1_1D")->second->Fill(GEM_phi); + } else if (GEM_region == 1 && GEM_lay == 2 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_chamber_p2_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_region_GE1")->second->Fill(3, GEM_chamber); + m_histos.find("GEM_nPassingProbe_pt_p2_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nPassingProbe_eta_p2_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nPassingProbe_phi_p2_1D")->second->Fill(GEM_phi); + } else if (GEM_region == -1 && GEM_lay == 1 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_chamber_n1_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_region_GE1")->second->Fill(1, GEM_chamber); + m_histos.find("GEM_nPassingProbe_pt_n1_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nPassingProbe_eta_n1_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nPassingProbe_phi_n1_1D")->second->Fill(GEM_phi); + } else if (GEM_region == -1 && GEM_lay == 2 && GEM_sta == 1) { + m_histos.find("GEM_nPassingProbe_chamber_n2_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nPassingProbe_Ch_region_GE1")->second->Fill(0, GEM_chamber); + m_histos.find("GEM_nPassingProbe_pt_n2_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nPassingProbe_eta_n2_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nPassingProbe_phi_n2_1D")->second->Fill(GEM_phi); + } + m_histos.find("GEM_nPassingProbe_pt_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nPassingProbe_eta_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nPassingProbe_phi_1D")->second->Fill(GEM_phi); + } else { + if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16) + continue; + m_histos.find("GEM_nFailingProbe_Ch_region")->second->Fill(GEM_region, GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_eta")->second->Fill(abs(GEM_eta), GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_phi")->second->Fill(GEM_phi, GEM_chamber); + m_histos.find("GEM_nFailingProbe_allCh_1D")->second->Fill(GEM_region); + m_histos.find("GEM_nFailingProbe_chamber_1D")->second->Fill(GEM_chamber); + if (GEM_region < 0) { + if (GEM_sta == 2 and GEM_lay == 2) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(0, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 1) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(1, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 2) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(2, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 1) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(3, GEM_chamber); + } + if (GEM_region > 0) { + if (GEM_sta == 1 and GEM_lay == 1) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(6, GEM_chamber); + else if (GEM_sta == 1 and GEM_lay == 2) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(7, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 1) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(8, GEM_chamber); + else if (GEM_sta == 2 and GEM_lay == 2) + m_histos.find("GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(9, GEM_chamber); + } + if (GEM_region == -1 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_Ch_region_GE1_NoL")->second->Fill(0, GEM_chamber); + } else if (GEM_region == 1 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_Ch_region_GE1_NoL")->second->Fill(1, GEM_chamber); + } + // + if (GEM_region == 1 && GEM_lay == 1 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_chamber_p1_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_region_GE1")->second->Fill(2, GEM_chamber); + m_histos.find("GEM_nFailingProbe_pt_p1_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nFailingProbe_eta_p1_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nFailingProbe_phi_p1_1D")->second->Fill(GEM_phi); + } else if (GEM_region == 1 && GEM_lay == 2 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_chamber_p2_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_region_GE1")->second->Fill(3, GEM_chamber); + m_histos.find("GEM_nFailingProbe_pt_p2_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nFailingProbe_eta_p2_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nFailingProbe_phi_p2_1D")->second->Fill(GEM_phi); + } else if (GEM_region == -1 && GEM_lay == 1 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_chamber_n1_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_region_GE1")->second->Fill(1, GEM_chamber); + m_histos.find("GEM_nFailingProbe_pt_n1_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nFailingProbe_eta_n1_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nFailingProbe_phi_n1_1D")->second->Fill(GEM_phi); + } else if (GEM_region == -1 && GEM_lay == 2 && GEM_sta == 1) { + m_histos.find("GEM_nFailingProbe_chamber_n2_1D")->second->Fill(GEM_chamber); + m_histos.find("GEM_nFailingProbe_Ch_region_GE1")->second->Fill(0, GEM_chamber); + m_histos.find("GEM_nFailingProbe_pt_n2_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nFailingProbe_eta_n2_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nFailingProbe_phi_n2_1D")->second->Fill(GEM_phi); + } + m_histos.find("GEM_nFailingProbe_pt_1D")->second->Fill(GEM_pt); + m_histos.find("GEM_nFailingProbe_eta_1D")->second->Fill(abs(GEM_eta)); + m_histos.find("GEM_nFailingProbe_phi_1D")->second->Fill(GEM_phi); + } + } + } + } +} + +std::string GEMTnPEfficiencyTask::topFolder() const { return "GEM/Segment_TnP/"; }; + +DEFINE_FWK_MODULE(GEMTnPEfficiencyTask); diff --git a/DQMOffline/MuonDPG/python/gemTnPEfficiencyClient_cfi.py b/DQMOffline/MuonDPG/python/gemTnPEfficiencyClient_cfi.py new file mode 100644 index 0000000000000..f625f5a8a321c --- /dev/null +++ b/DQMOffline/MuonDPG/python/gemTnPEfficiencyClient_cfi.py @@ -0,0 +1,36 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + +gemTnPEfficiencyClient = DQMEDHarvester("TnPEfficiencyClient", + #Histogram names listed as "passProbeHistoName:failProbeHistoName" + subsystem = cms.untracked.string("GEM"), + #histoNames = cms.untracked.vstring("GEM_nPassingProbe_allCh:GEM_nFailingProbe_allCh", + histoNames = cms.untracked.vstring("GEM_nPassingProbe_allCh_1D:GEM_nFailingProbe_allCh_1D", + "GEM_nPassingProbe_chamber_1D:GEM_nFailingProbe_chamber_1D", + "GEM_nPassingProbe_chamber_p1_1D:GEM_nFailingProbe_chamber_p1_1D", + "GEM_nPassingProbe_chamber_p2_1D:GEM_nFailingProbe_chamber_p2_1D", + "GEM_nPassingProbe_chamber_n1_1D:GEM_nFailingProbe_chamber_n1_1D", + "GEM_nPassingProbe_chamber_n2_1D:GEM_nFailingProbe_chamber_n2_1D", + "GEM_nPassingProbe_pt_1D:GEM_nFailingProbe_pt_1D", + "GEM_nPassingProbe_eta_1D:GEM_nFailingProbe_eta_1D", + "GEM_nPassingProbe_phi_1D:GEM_nFailingProbe_phi_1D", + "GEM_nPassingProbe_pt_p1_1D:GEM_nFailingProbe_pt_p1_1D", + "GEM_nPassingProbe_eta_p1_1D:GEM_nFailingProbe_eta_p1_1D", + "GEM_nPassingProbe_phi_p1_1D:GEM_nFailingProbe_phi_p1_1D", + "GEM_nPassingProbe_pt_p2_1D:GEM_nFailingProbe_pt_p2_1D", + "GEM_nPassingProbe_eta_p2_1D:GEM_nFailingProbe_eta_p2_1D", + "GEM_nPassingProbe_phi_p2_1D:GEM_nFailingProbe_phi_p2_1D", + "GEM_nPassingProbe_pt_n1_1D:GEM_nFailingProbe_pt_n1_1D", + "GEM_nPassingProbe_eta_n1_1D:GEM_nFailingProbe_eta_n1_1D", + "GEM_nPassingProbe_phi_n1_1D:GEM_nFailingProbe_phi_n1_1D", + "GEM_nPassingProbe_pt_n2_1D:GEM_nFailingProbe_pt_n2_1D", + "GEM_nPassingProbe_eta_n2_1D:GEM_nFailingProbe_eta_n2_1D", + "GEM_nPassingProbe_phi_n2_1D:GEM_nFailingProbe_phi_n2_1D", + "GEM_nPassingProbe_Ch_region:GEM_nFailingProbe_Ch_region", + "GEM_nPassingProbe_Ch_region_GE1:GEM_nFailingProbe_Ch_region_GE1", + "GEM_nPassingProbe_Ch_region_GE1_NoL:GEM_nFailingProbe_Ch_region_GE1_NoL", + "GEM_nPassingProbe_Ch_eta:GEM_nFailingProbe_Ch_eta", + "GEM_nPassingProbe_Ch_phi:GEM_nFailingProbe_Ch_phi", + "ME0_nPassingProbe_chamber_1D:ME0_nFailingProbe_chamber_1D", + "GEM_nPassingProbe_Ch_region_layer_phase2:GEM_nFailingProbe_Ch_region_layer_phase2"), + diagnosticPrescale = cms.untracked.int32(1)) diff --git a/DQMOffline/MuonDPG/python/gemTnPEfficiencyTask_cfi.py b/DQMOffline/MuonDPG/python/gemTnPEfficiencyTask_cfi.py new file mode 100644 index 0000000000000..92fcb8af326ad --- /dev/null +++ b/DQMOffline/MuonDPG/python/gemTnPEfficiencyTask_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +gemTnPEfficiencyMonitor = DQMEDAnalyzer('GEMTnPEfficiencyTask', + # The muon object input tag + inputTagMuons = cms.untracked.InputTag('muons'), + inputTagPrimaryVertices = cms.untracked.InputTag('offlinePrimaryVertices'), + trigResultsTag = cms.untracked.InputTag("TriggerResults::HLT"), + trigEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD::HLT"), + # A string-based cut on muon variables + probeCut = cms.untracked.string('isTrackerMuon && (innerTrack.normalizedChi2 < 10) && (innerTrack.hitPattern.numberOfValidPixelHits > 0) && (innerTrack.hitPattern.trackerLayersWithMeasurement > 5) && ((isolationR03.sumPt)/(pt) < 0.1) && pt>10.' ), + probeDxyCut = cms.untracked.double(0.2), + probeDzCut = cms.untracked.double(0.5), + #Cut on muon ID: + # CutBasedIdLoose = 1UL << 0 + # CutBasedIdMedium = 1UL << 1 + # CutBasedIdMediumPrompt = 1UL << 2 + # CutBasedIdTight = 1UL << 3 + tagCut = cms.untracked.string('(selectors & 8) && ((isolationR03.sumPt)/(pt) < 0.05) && pt>24.'), + borderCut = cms.untracked.double(-10.), + lowPairMassCut = cms.untracked.double (80.), + highPairMassCut = cms.untracked.double (100.), + trigName = cms.untracked.string("HLT_IsoMu*"), + #cuts for passing probe definition + dx_cut = cms.untracked.double(10.), + # If true, enables detailed analysis plots + detailedAnalysis = cms.untracked.bool(True) +) diff --git a/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py b/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py index 4442298d60a35..d08b24e5e5af1 100644 --- a/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py +++ b/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py @@ -68,8 +68,8 @@ jet2PtBinning = [20,30,40,50,60,75,90,110,130,150,175,200,225,250,300], jet1EtaBinning = [-2.5,-2.25,-2.0,-1.75,-1.5,-1.25,-1.0,-0.75,-0.5,-0.25,0.,0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0,2.25,2.5], jet2EtaBinning = [-2.5,-2.25,-2.0,-1.75,-1.5,-1.25,-1.0,-0.75,-0.5,-0.25,0.,0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0,2.25,2.5], - jet1PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], - jet2PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], + jet1PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], + jet2PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], jet2PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], jet1PtBinning2d = [20,30,40,50,75,100,150,250,500], @@ -82,7 +82,7 @@ jet2PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,3.25,6], ## trigger for numerator and denominator numGenericTriggerEvent = dict( - hltPaths = ["HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBTagParticleNet_2BTagSum0p65_v*"], + hltPaths = ["HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PNet2BTagMean0p50_v*"], andOr = False, andOrHlt = True, #hltInputTag = "TriggerResults::reHLT", ## when testing in the DQM workflow (https://twiki.cern.ch/twiki/bin/viewauth/CMS/HLTValidationAndDQM) diff --git a/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py b/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py index 91077617109f9..2220adbbb2645 100644 --- a/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py +++ b/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py @@ -70,22 +70,21 @@ jet2PtBinning = [], jet1EtaBinning = [-2.5,-2.0,-1.5,-1.0,-0.5,0.,0.5,1.0,1.5,2.0,2.5], jet2EtaBinning = [], - jet1PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], + jet1PNETscoreBinning = [0,0.02,0.04,0.06,0.08,0.10,0.15,0.20,0.25,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1], jet2PNETscoreBinning = [], - jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], + jet1PNETscoreTransBinning = [0,0.02,0.04,0.06,0.08,0.1,0.15,0.2,0.4,0.6,0.8,1.0,2,3,6], jet2PNETscoreTransBinning = [], jet1PtBinning2d = [180,220,260,300,340,400,500,750,1250], jet2PtBinning2d = [], jet1EtaBinning2d = [-2.5,-2.0,-1.5,-1.0,-0.5,0.,0.5,1.0,1.5,2.0,2.5], jet2EtaBinning2d = [], - jet1PNETscoreBinning2d = [0,0.15,0.30,0.45,0.60,0.75,0.85,0.90,0.95,0.975,1], + jet1PNETscoreBinning2d = [0,0.03,0.06,0.08,0.12,0.18,0.25,0.35,0.50,0.70,0.90,1.0], jet2PNETscoreBinning2d = [], - jet1PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,3.25,6], + jet1PNETscoreTransBinning2d = [0,0.03,0.06,0.08,0.12,0.18,0.25,0.40,0.60,0.85,1.5,3,6], jet2PNETscoreTransBinning2d = [], ## trigger for numerator and denominator numGenericTriggerEvent = dict( - hltPaths = ["HLT_IsoMu50_AK8PFJet230_SoftDropMass40_PFAK8ParticleNetBB0p35_v*", - "HLT_Ele50_CaloIdVT_GsfTrkIdT_AK8PFJet230_SoftDropMass40_PFAK8ParticleNetBB0p35_v*"], + hltPaths = ["HLT_IsoMu50_AK8PFJet230_SoftDropMass40_PNetBB0p06_v*", "HLT_Ele50_CaloIdVT_GsfTrkIdT_AK8PFJet230_SoftDropMass40_PNetBB0p06_v*",], andOr = False, andOrHlt = True, #hltInputTag = "TriggerResults::reHLT", ## when testing in the DQM workflow (https://twiki.cern.ch/twiki/bin/viewauth/CMS/HLTValidationAndDQM) diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_cff.py index 7cab5cdcd830d..562025b0fd8f9 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_cff.py @@ -2,7 +2,7 @@ from DQMOffline.Trigger.SiPixel_OfflineMonitoring_Cluster_cff import * from DQMOffline.Trigger.SiPixel_OfflineMonitoring_TrackCluster_cff import * -from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * +from RecoTracker.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * from DQM.SiPixelMonitorTrack.RefitterForPixelDQM import * hltSiPixelClusterShapeCache = siPixelClusterShapeCache.clone(src = 'hltSiPixelClusters') diff --git a/DQMServices/Components/test/BuildFile.xml b/DQMServices/Components/test/BuildFile.xml index f6b28eba7b13c..27267ac2c504a 100644 --- a/DQMServices/Components/test/BuildFile.xml +++ b/DQMServices/Components/test/BuildFile.xml @@ -2,11 +2,5 @@ - - - - - - - - + + diff --git a/DQMServices/Components/test/runFastHadd.cpp b/DQMServices/Components/test/runFastHadd.cpp deleted file mode 100644 index fec9875dcae99..0000000000000 --- a/DQMServices/Components/test/runFastHadd.cpp +++ /dev/null @@ -1,8 +0,0 @@ -//------------------------------------------------------------ -// -// Driver for shell scripts. -// -//------------------------------------------------------------ - -#include "FWCore/Utilities/interface/TestHelper.h" -RUNTEST() diff --git a/DQMServices/Components/test/run_fastHadd_tests.sh b/DQMServices/Components/test/run_fastHadd_tests.sh index d29d5b937453e..065bda7cedf55 100755 --- a/DQMServices/Components/test/run_fastHadd_tests.sh +++ b/DQMServices/Components/test/run_fastHadd_tests.sh @@ -22,7 +22,7 @@ set_up() { generate() { echo "Generating files" - python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a produce -n $numFiles 2>&1 > /dev/null + python3 ${SCRAM_TEST_PATH}/test_fastHaddMerge.py -a produce -n $numFiles 2>&1 > /dev/null if [ $? -ne 0 ]; then exit $? @@ -65,7 +65,7 @@ hadd_merge() { check_hadd() { echo "Checking ROOT result..." - python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumRootFile 2>&1 > /dev/null + python3 ${SCRAM_TEST_PATH}/test_fastHaddMerge.py -a check -n $numFiles -c $cumRootFile 2>&1 > /dev/null if [ $? -ne 0 ]; then exit $? @@ -101,7 +101,7 @@ convertPB2ROOT() { check_fasthadd() { echo "Checking PB result... on ${cumPBFile_inROOT}" - python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFile_inROOT 2>&1 > /dev/null + python3 ${SCRAM_TEST_PATH}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFile_inROOT 2>&1 > /dev/null if [ $? -ne 0 ]; then exit $? @@ -135,7 +135,7 @@ convert() { check_fasthadd_parallel() { echo "Checking PB result... on ${cumPBFileThreaded_inROOT}" - python3 ${LOCAL_TEST_DIR}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFileThreaded_inROOT 2>&1 > /dev/null + python3 ${SCRAM_TEST_PATH}/test_fastHaddMerge.py -a check -n $numFiles -c $cumPBFileThreaded_inROOT 2>&1 > /dev/null if [ $? -ne 0 ]; then exit $? diff --git a/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py b/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py index 3f3458a925aa6..75f6c824eb934 100644 --- a/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py +++ b/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py @@ -55,6 +55,44 @@ "PixelPhase1/Tracks/PXForward/size_PXDisk_-2", "PixelPhase1/Tracks/PXForward/size_PXDisk_-3", "HLT/Vertexing/hltPixelVertices/hltPixelVertices/goodvtxNbr", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/Eff_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/Eff_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/Eff_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/Eff_pt", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/FakeRate_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/FakeRate_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/FakeRate_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/FakeRate_pt", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_pt", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_unMatched_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_unMatched_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_unMatched_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/mon_unMatched_pt", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_matched_eta", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_matched_hits", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_matched_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_matched_pt", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_phi", + "HLT/Tracking/ValidationWRTOffline/hltMergedWrtHighPurityPV/ref_pt", + "HLT/Tracking/pixelTracks/GeneralProperties/Chi2Prob_GenTk", + "HLT/Tracking/pixelTracks/GeneralProperties/Chi2oNDFVsEta_ImpactPoint_GenTk", + "HLT/Tracking/pixelTracks/GeneralProperties/DeltaZToPVZoom_GenTk", + "HLT/Tracking/pixelTracks/GeneralProperties/DistanceOfClosestApproachToPVVsPhi_GenTk", + "HLT/Tracking/pixelTracks/GeneralProperties/DistanceOfClosestApproachToPVZoom_GenTk", + "HLT/Tracking/pixelTracks/GeneralProperties/NumberOfTracks_GenTk", + "HLT/Tracking/tracks/GeneralProperties/Chi2Prob_GenTk", + "HLT/Tracking/tracks/GeneralProperties/Chi2oNDFVsEta_ImpactPoint_GenTk", + "HLT/Tracking/tracks/GeneralProperties/DeltaZToPVZoom_GenTk", + "HLT/Tracking/tracks/GeneralProperties/DistanceOfClosestApproachToPVVsPhi_GenTk", + "HLT/Tracking/tracks/GeneralProperties/DistanceOfClosestApproachToPVZoom_GenTk", + "HLT/Tracking/tracks/GeneralProperties/NumberOfTracks_GenTk", + "HLT/Tracking/tracks/LUMIanalysis/NumberEventsVsLUMI", + "HLT/Tracking/tracks/PUmonitoring/NumberEventsVsGoodPVtx", "PixelPhase1/Tracks/num_clusters_ontrack_PXBarrel", "PixelPhase1/Tracks/num_clusters_ontrack_PXForward", "PixelPhase1/Tracks/clusterposition_zphi_ontrack", diff --git a/DQMServices/Demo/test/BuildFile.xml b/DQMServices/Demo/test/BuildFile.xml index ad2932b8fae7f..043a9edee8170 100644 --- a/DQMServices/Demo/test/BuildFile.xml +++ b/DQMServices/Demo/test/BuildFile.xml @@ -6,6 +6,4 @@ - - - + diff --git a/DQMServices/Demo/test/TestRunner.cpp b/DQMServices/Demo/test/TestRunner.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/DQMServices/Demo/test/TestRunner.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/DQMServices/Demo/test/runtests.sh b/DQMServices/Demo/test/runtests.sh index c0a0f9db9ba6c..cb3bddd0dfc5f 100755 --- a/DQMServices/Demo/test/runtests.sh +++ b/DQMServices/Demo/test/runtests.sh @@ -2,14 +2,10 @@ set -e set -x -if [[ -z ${LOCAL_TEST_DIR} ]]; then - LOCAL_TEST_DIR=. -fi - # This is mainly to make sure nothing crashes. Checking the output for sanity is attempted but not really complete. # 1. Run a very simple configuration with all module types. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=alltypes.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=alltypes.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 # actually we'd expect 99, but the MEs by legacy modules are booked with JOB scope and cannot be saved to DQMIO. [ 78 = $(dqmiolistmes.py alltypes.root -r 1 | wc -l) ] [ 78 = $(dqmiolistmes.py alltypes.root -r 1 -l 1 | wc -l) ] @@ -20,52 +16,52 @@ cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=alltypes.root numberEventsIn # testonefilllumi also should have 5 entries in the histograms (9 more) # the "fillrun" module should have one entry in the histograms (9 total) and 0 in the scalars (2 total) -[ "0: 1, 0.0: 1, 1: 11, 100: 33, 200: 11, 5: 16, 5.0: 5" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 --summary)" ] +[ "0: 1, 0.0: 1, 1: 11, 100: 33, 200: 11, 5: 16, 5.0: 5" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 --summary)" ] # per lumi we see 20 in most histograms (4*9), and the current lumi number in the scalars (6 modules * 2). # the two fillumi modules should have one entry in each of the lumi histograms, (2*9 total) -[ "1: 28, 1.0: 6, 20: 44" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 1 --summary)" ] -[ "1: 22, 2: 6, 2.0: 6, 20: 44" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 2 --summary)" ] -[ "1: 22, 20: 44, 3: 6, 3.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 3 --summary)" ] -[ "1: 22, 20: 44, 4: 6, 4.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 4 --summary)" ] -[ "1: 22, 20: 44, 5: 6, 5.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 5 --summary)" ] +[ "1: 28, 1.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 1 --summary)" ] +[ "1: 22, 2: 6, 2.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 2 --summary)" ] +[ "1: 22, 20: 44, 3: 6, 3.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 3 --summary)" ] +[ "1: 22, 20: 44, 4: 6, 4.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 4 --summary)" ] +[ "1: 22, 20: 44, 5: 6, 5.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 5 --summary)" ] # just make sure we are not off by one -[ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 6 --summary)" ] +[ "" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 6 --summary)" ] # 2. Run multi-threaded. First we make a baseline file without legacy modules, since they might not work. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy-mt.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=nolegacy.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=nolegacy-mt.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10 # 3. Try enabling concurrent lumis. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy-cl.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10 nConcurrent=10 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=nolegacy-cl.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10 nConcurrent=10 # same math as above, just a few less modules, and more events. for f in nolegacy.root nolegacy-mt.root nolegacy-cl.root do - [ "0: 1, 0.0: 1, 1: 11, 1000: 22, 2000: 11, 5: 3, 5.0: 3" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 --summary)" ] - [ "1: 2, 1.0: 2, 200: 22" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 1 --summary)" ] - [ "2: 2, 2.0: 2, 200: 22" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 2 --summary)" ] - [ "200: 22, 3: 2, 3.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 3 --summary)" ] - [ "200: 22, 4: 2, 4.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 4 --summary)" ] - [ "200: 22, 5: 2, 5.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 5 --summary)" ] - [ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 6 --summary)" ] + [ "0: 1, 0.0: 1, 1: 11, 1000: 22, 2000: 11, 5: 3, 5.0: 3" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 --summary)" ] + [ "1: 2, 1.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 1 --summary)" ] + [ "2: 2, 2.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 2 --summary)" ] + [ "200: 22, 3: 2, 3.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 3 --summary)" ] + [ "200: 22, 4: 2, 4.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 4 --summary)" ] + [ "200: 22, 5: 2, 5.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 5 --summary)" ] + [ "" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 6 --summary)" ] done # 4. Try crossing a run boundary. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=multirun.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=multirun.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 dqmiodumpmetadata.py multirun.root | grep -q '4 runs, 12 lumisections' # 5. Now, make some chopped up files to try harvesting. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part1.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 # 1st half of 1st lumi -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part2.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part3.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3 -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part4.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2 # 3 more runs +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part1.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 # 1st half of 1st lumi +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part2.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part3.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part4.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2 # 3 more runs -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part2.root inputFiles=part3.root inputFiles=part4.root outfile=merged.root nomodules=True +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part2.root inputFiles=part3.root inputFiles=part4.root outfile=merged.root nomodules=True dqmiodumpmetadata.py merged.root | grep -q '4 runs, 12 lumisections' #dumproot() { root2sqlite.py -o $1.sqlite $1 ; echo '.dump' | sqlite3 $1.sqlite > $1.sqldump ; rm $1.sqlite ; } @@ -78,31 +74,31 @@ for k in uproot.open("'"$1"'").keys(): print(k)' } # we need to exclude MEs filled on run and lumi boundaries, since the split job *does* see a different number of begin/end run/lumi transitions. -cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 | grep -vE 'fillrun|filllumi') <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 | grep -vE 'fillrun|filllumi') -cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 3) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 3) -cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 -l 1 | grep -v filllumi) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 -l 1 | grep -v filllumi) -cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 -l 2) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 -l 2) +cmp <(${SCRAM_TEST_PATH}/dqmiodumpentries.py multirun.root -r 1 | grep -vE 'fillrun|filllumi') <(${SCRAM_TEST_PATH}/dqmiodumpentries.py merged.root -r 1 | grep -vE 'fillrun|filllumi') +cmp <(${SCRAM_TEST_PATH}/dqmiodumpentries.py multirun.root -r 3) <(${SCRAM_TEST_PATH}/dqmiodumpentries.py merged.root -r 3) +cmp <(${SCRAM_TEST_PATH}/dqmiodumpentries.py multirun.root -r 1 -l 1 | grep -v filllumi) <(${SCRAM_TEST_PATH}/dqmiodumpentries.py merged.root -r 1 -l 1 | grep -v filllumi) +cmp <(${SCRAM_TEST_PATH}/dqmiodumpentries.py multirun.root -r 1 -l 2) <(${SCRAM_TEST_PATH}/dqmiodumpentries.py merged.root -r 1 -l 2) # 6. A load test. #( if [[ `uname -m` != aarch64 ]] ; then ulimit -v 4000000 ; fi # limit available virtual memory - cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=huge.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=600 nThreads=10 nConcurrent=2 howmany=1000 nolegacy=True + cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=huge.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=600 nThreads=10 nConcurrent=2 howmany=1000 nolegacy=True #) # 7. Try writing a TDirectory file. -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=alltypes.root nomodules=True legacyoutput=True reScope=JOB +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=alltypes.root nomodules=True legacyoutput=True reScope=JOB # this number is rather messy: we have 66 per-lumi objecs (harvested), 66 per-run objects (no legacy output), one folder for each set of 11, # plus some higher-level folders and the ProvInfo hierarchy create by the FileSaver. [ 185 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | wc -l) ] -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 legacyoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 legacyoutput=True # we expect only the (per-job) legacy histograms here: 3*11 objects in 3 folders, plus 9 more for ProvInfo and higher-level folders. [ 51 = $(rootlist DQM_V0001_R000000001__EmptySource__DQMTests__DQMIO.root | wc -l) ] # 8. Try writing ProtoBuf files. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 protobufoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 protobufoutput=True -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=./run000001 outfile=pbdata.root nomodules=True protobufinput=True +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=./run000001 outfile=pbdata.root nomodules=True protobufinput=True [ 117 = $(dqmiolistmes.py pbdata.root -r 1 | wc -l) ] [ 78 = $(dqmiolistmes.py pbdata.root -r 1 -l 1 | wc -l) ] @@ -116,7 +112,7 @@ fastHadd convert -o streamDQMHistograms.root streamDQMHistograms.pb # 9. Try writing online files. This is really TDirectory files, but written via a different module. # Note that this does not really need to support multiple runs, but it appears it does. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 onlineoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 onlineoutput=True # here we expect full per-run output (99 objects), no per-lumi MEs, plus folders (9 + 10 higher-level). [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000001.root | wc -l) ] [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000002.root | wc -l) ] @@ -126,41 +122,41 @@ cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=300 numberEventsIn # 10. Try running some harvesting modules and check if their output makes it out. # Note that we pass the files out-of order here; the DQMIO input should sort them. -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part3.root inputFiles=part2.root legacyoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part3.root inputFiles=part2.root legacyoutput=True [ 1 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | grep -c 's=beginRun(1) endLumi(1,1) endLumi(1,2) endLumi(1,3) endRun(1) endJob() ') ] # The legacy harvester can only do per-run harvesting. [ 2 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | grep -c 's=beginRun(1) endLumi(1,1) endLumi(1,2) endLumi(1,3) endRun(1) ') ] # 11. Try MEtoEDM and EDMtoME. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=metoedm.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 metoedmoutput=True -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py outfile=edmtome.root inputFiles=metoedm.root nomodules=True metoedminput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=metoedm.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 metoedmoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py outfile=edmtome.root inputFiles=metoedm.root nomodules=True metoedminput=True [ 72 = $(dqmiolistmes.py edmtome.root -r 1 | wc -l) ] [ 72 = $(dqmiolistmes.py edmtome.root -r 1 -l 1 | wc -l) ] # again, no legacy module (run) output here due to JOB scope for legacy modules -[ "0: 1, 0.0: 1, 1: 10, 100: 30, 200: 10, 5: 15, 5.0: 5" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 --summary)" ] -[ "1: 26, 1.0: 6, 20: 40" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 1 --summary)" ] -[ "1: 20, 2: 6, 2.0: 6, 20: 40" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 2 --summary)" ] -[ "1: 20, 20: 40, 3: 6, 3.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 3 --summary)" ] -[ "1: 20, 20: 40, 4: 6, 4.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 4 --summary)" ] -[ "1: 20, 20: 40, 5: 6, 5.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 5 --summary)" ] -[ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 6 --summary)" ] - -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part1_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 # 1st half of 1st lumi -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part2_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part3_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3 -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part4_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2 # 3 more runs - -cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1_metoedm.root inputFiles=part2_metoedm.root inputFiles=part3_metoedm.root inputFiles=part4_metoedm.root outfile=metoedm_merged.root nomodules=True metoedminput=True +[ "0: 1, 0.0: 1, 1: 10, 100: 30, 200: 10, 5: 15, 5.0: 5" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 --summary)" ] +[ "1: 26, 1.0: 6, 20: 40" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 1 --summary)" ] +[ "1: 20, 2: 6, 2.0: 6, 20: 40" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 2 --summary)" ] +[ "1: 20, 20: 40, 3: 6, 3.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 3 --summary)" ] +[ "1: 20, 20: 40, 4: 6, 4.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 4 --summary)" ] +[ "1: 20, 20: 40, 5: 6, 5.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 5 --summary)" ] +[ "" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py edmtome.root -r 1 -l 6 --summary)" ] + +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part1_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 # 1st half of 1st lumi +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part2_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part3_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part4_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2 # 3 more runs + +cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=part1_metoedm.root inputFiles=part2_metoedm.root inputFiles=part3_metoedm.root inputFiles=part4_metoedm.root outfile=metoedm_merged.root nomodules=True metoedminput=True dqmiodumpmetadata.py metoedm_merged.root | grep -q '4 runs, 12 lumisections' # 12. Sanity checks. # this will mess up some of the files created earlier, disable for debugging. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root nEvents=0 -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0 -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0 legacyoutput=True -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0 protobufoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=empty.root nEvents=0 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=empty.root howmany=0 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=empty.root howmany=0 legacyoutput=True +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=empty.root howmany=0 protobufoutput=True # nLumisections might be a bit buggy (off by one) in EDM, but is fine here. -cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=noevents.root processingMode='RunsAndLumis' nLumisections=20 +cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=noevents.root processingMode='RunsAndLumis' nLumisections=20 [ 78 = $(dqmiolistmes.py noevents.root -r 1 | wc -l) ] [ 78 = $(dqmiolistmes.py noevents.root -r 1 -l 1 | wc -l) ] [ 78 = $(dqmiolistmes.py noevents.root -r 2 | wc -l) ] diff --git a/DQMServices/StreamerIO/test/RunStreamer.sh b/DQMServices/StreamerIO/test/RunStreamer.sh index 5160c027aed36..223b81542f685 100755 --- a/DQMServices/StreamerIO/test/RunStreamer.sh +++ b/DQMServices/StreamerIO/test/RunStreamer.sh @@ -9,7 +9,20 @@ echo "LOCAL_TEST_DIR = $SCRAM_TEST_PATH" RC=0 +rm -rf run000001 mkdir run000001 + +#test checksum with padded format +echo "{\"data\" :[10,10, \"teststreamfile.dat\"]}" > run000001/run1_ls1_test.jsn +cmsRun ${SCRAM_TEST_PATH}/streamOutPadding_cfg.py > outp 2>&1 || die "cmsRun streamOutPadding_cfg.py" $? +mv teststreamfile.dat run000001/teststreamfile.dat +cmsRun ${SCRAM_TEST_PATH}/streamOutAlt_cfg.py > outAlt 2>&1 || die "cmsRun streamOutAlt_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/streamOutExt_cfg.py > outExt 2>&1 || die "cmsRun streamOutExt_cfg.py" $? +timeout --signal SIGTERM 180 cmsRun ${SCRAM_TEST_PATH}/streamIn_cfg.py > inp 2>&1 || die "cmsRun streamIn_cfg.py" $? + +rm -rf run000001 +mkdir run000001 + #the initial json file to read echo "{\"data\" :[10,10, \"teststreamfile.dat\"]}" > run000001/run1_ls1_test.jsn cmsRun ${SCRAM_TEST_PATH}/streamOut_cfg.py > out 2>&1 || die "cmsRun streamOut_cfg.py" $? @@ -34,6 +47,9 @@ timeout --signal SIGTERM 180 cmsRun ${SCRAM_TEST_PATH}/streamInExt_cfg.py > ext ANS_OUT_SIZE=`grep -c CHECKSUM out` ANS_OUT=`grep CHECKSUM out` ANS_IN=`grep CHECKSUM in` +ANS_OUTP_SIZE=`grep -c CHECKSUM outp` +ANS_OUTP=`grep CHECKSUM outp` +ANS_INP=`grep CHECKSUM inp` if [ "${ANS_OUT_SIZE}" == "0" ] then @@ -47,4 +63,17 @@ then RC=1 fi +if [ "${ANS_OUTP_SIZE}" == "0" ] +then + echo "New Stream Padded Test Failed (out was not created)" + RC=1 +fi + +if [ "${ANS_OUTP}" != "${ANS_INP}" ] +then + echo "New Stream Padded Test Failed (out!=in)" + RC=1 +fi + + exit ${RC} diff --git a/DQMServices/StreamerIO/test/streamOutPadding_cfg.py b/DQMServices/StreamerIO/test/streamOutPadding_cfg.py new file mode 100644 index 0000000000000..72b0bba5cfce2 --- /dev/null +++ b/DQMServices/StreamerIO/test/streamOutPadding_cfg.py @@ -0,0 +1,51 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +options = VarParsing.VarParsing('analysis') + +options.register ('compAlgo', + 'ZLIB', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Compression Algorithm") + +options.parseArguments() + + +process = cms.Process("HLT") + +import FWCore.Framework.test.cmsExceptionsFatal_cff +process.options = FWCore.Framework.test.cmsExceptionsFatal_cff.options + +process.load("FWCore.MessageLogger.MessageLogger_cfi") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(50) +) + +process.source = cms.Source("EmptySource", + firstEvent = cms.untracked.uint64(10123456789) +) + +process.m1 = cms.EDProducer("StreamThingProducer", + instance_count = cms.int32(5), + array_size = cms.int32(2) +) + +process.m2 = cms.EDProducer("NonProducer") + +process.a1 = cms.EDAnalyzer("StreamThingAnalyzer", + product_to_get = cms.string('m1') +) + +process.out = cms.OutputModule("EventStreamFileWriter", + fileName = cms.untracked.string('teststreamfile.dat'), + padding = cms.untracked.uint32(4096), + compression_level = cms.untracked.int32(1), + use_compression = cms.untracked.bool(True), + compression_algorithm = cms.untracked.string(options.compAlgo), + max_event_size = cms.untracked.int32(7000000) +) + +process.p1 = cms.Path(process.m1*process.a1*process.m2) +process.end = cms.EndPath(process.out) diff --git a/DataFormats/BTauReco/interface/ParticleTransformerAK4Features.h b/DataFormats/BTauReco/interface/ParticleTransformerAK4Features.h index a790a7b2ca7d8..6b17fd05a2044 100644 --- a/DataFormats/BTauReco/interface/ParticleTransformerAK4Features.h +++ b/DataFormats/BTauReco/interface/ParticleTransformerAK4Features.h @@ -11,6 +11,7 @@ namespace btagbtvdeep { class ParticleTransformerAK4Features { public: + bool is_filled = true; std::vector sv_features; std::vector n_pf_features; diff --git a/DataFormats/CTPPSReco/src/classes_def.xml b/DataFormats/CTPPSReco/src/classes_def.xml index e0bf064a8f37e..4481af2770fbb 100644 --- a/DataFormats/CTPPSReco/src/classes_def.xml +++ b/DataFormats/CTPPSReco/src/classes_def.xml @@ -60,8 +60,11 @@ + + + + - @@ -187,8 +190,11 @@ + - + + + diff --git a/DataFormats/Common/README.md b/DataFormats/Common/README.md new file mode 100644 index 0000000000000..d77eaf0c8936a --- /dev/null +++ b/DataFormats/Common/README.md @@ -0,0 +1,10 @@ +# DataFormats/Common + +## `edm::TriggerResults` + +The class `edm::TriggerResults` is part of the RAW data, and any changes must be backwards compatible. In order to ensure it can be read by all future CMSSW releases, there is a `TestTriggerResultsFormat` unit test, which makes use of the `TestReadTriggerResults` analyzer and the `TestWriteTriggerResults` producer. The unit test checks that the object can be read properly from + +* a file in the same release as it was written +* files written by (some) earlier releases can be read + +If the persistent format of class `edm::TriggerResults` gets changed in the future, please adjust the `TestReadTriggerResults` and `TestWriteTriggerResults` modules accordingly. It is important that every member container has some content in this test. Please also add a new file to [https://github.com/cms-data/DataFormats-Common/](https://github.com/cms-data/DataFormats-Common/) repository, and update the `TestTriggerResultsFormat` unit test to read the newly created file. The file name should contain the release or pre-release with which it was written.` diff --git a/DataFormats/Common/interface/Ptr.h b/DataFormats/Common/interface/Ptr.h index 613bf0be4d5b4..09b819220b229 100644 --- a/DataFormats/Common/interface/Ptr.h +++ b/DataFormats/Common/interface/Ptr.h @@ -149,6 +149,8 @@ namespace edm { /// Checks if collection is in memory or available /// in the event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) bool isAvailable() const; /// Checks if this Ptr is transient (i.e. not persistable). diff --git a/DataFormats/Common/interface/Ref.h b/DataFormats/Common/interface/Ref.h index c5fbfcc4a10eb..396fcea17a66b 100644 --- a/DataFormats/Common/interface/Ref.h +++ b/DataFormats/Common/interface/Ref.h @@ -257,6 +257,8 @@ namespace edm { /// Checks if collection is in memory or available /// in the Event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) bool isAvailable() const; /// Checks if this ref is transient (i.e. not persistable). @@ -404,6 +406,8 @@ namespace edm { /// Checks if collection is in memory or available /// in the Event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) bool isAvailable() const; /// Checks if this ref is transient (i.e. not persistable). diff --git a/DataFormats/Common/interface/RefCoreWithIndex.h b/DataFormats/Common/interface/RefCoreWithIndex.h index 9098d28db108b..595cfeaba011d 100644 --- a/DataFormats/Common/interface/RefCoreWithIndex.h +++ b/DataFormats/Common/interface/RefCoreWithIndex.h @@ -88,7 +88,8 @@ namespace edm { // Checks if collection is in memory or available // in the Event. No type checking is done. - + // This function is potentially costly as it might cause a disk + // read (note that it does not cause the data to be cached locally) bool isAvailable() const { return toRefCore().isAvailable(); } //Convert to an equivalent RefCore. Needed for Ref specialization. diff --git a/DataFormats/Common/interface/RefProd.h b/DataFormats/Common/interface/RefProd.h index b5f40fd293bcf..c17a5f2d821ee 100644 --- a/DataFormats/Common/interface/RefProd.h +++ b/DataFormats/Common/interface/RefProd.h @@ -134,6 +134,8 @@ namespace edm { /// Checks if collection is in memory or available /// in the Event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) bool isAvailable() const { return product_.isAvailable(); } /// Checks if this RefProd is transient (i.e. not persistable). diff --git a/DataFormats/Common/interface/RefToBase.h b/DataFormats/Common/interface/RefToBase.h index d46226f0de93c..d12434a65b4a7 100644 --- a/DataFormats/Common/interface/RefToBase.h +++ b/DataFormats/Common/interface/RefToBase.h @@ -116,6 +116,8 @@ namespace edm { /// Checks if collection is in memory or available /// in the Event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) bool isAvailable() const { return holder_ ? holder_->isAvailable() : false; } bool isTransient() const { return holder_ ? holder_->isTransient() : false; } diff --git a/DataFormats/Common/interface/RefToBaseProd.h b/DataFormats/Common/interface/RefToBaseProd.h index bbac746d107fa..b046ea271419f 100644 --- a/DataFormats/Common/interface/RefToBaseProd.h +++ b/DataFormats/Common/interface/RefToBaseProd.h @@ -66,6 +66,12 @@ namespace edm { /// Checks for non-null bool isNonnull() const { return product_.isNonnull(); } + /// Checks if collection is in memory or available + /// in the Event. No type checking is done. + /// This function is potentially costly as it might cause a disk + /// read (note that it does not cause the data to be cached locally) + bool isAvailable() const { return product_.isAvailable(); } + /// Checks for null bool operator!() const { return isNull(); } diff --git a/DataFormats/Common/test/BuildFile.xml b/DataFormats/Common/test/BuildFile.xml index d8cede3486326..52965ce1b96d5 100644 --- a/DataFormats/Common/test/BuildFile.xml +++ b/DataFormats/Common/test/BuildFile.xml @@ -1,6 +1,16 @@ + + + + + + + + + + diff --git a/DataFormats/Common/test/TestReadTriggerResults.cc b/DataFormats/Common/test/TestReadTriggerResults.cc new file mode 100644 index 0000000000000..9bd2c4b351e73 --- /dev/null +++ b/DataFormats/Common/test/TestReadTriggerResults.cc @@ -0,0 +1,100 @@ +// -*- C++ -*- +// +// Package: DataFormats/Common +// Class: TestReadTriggerResults +// +/**\class edmtest::TestReadTriggerResults + Description: Used as part of tests that ensure the TriggerResults + data format can be persistently written and in a subsequent process + read. First, this is done using the current release version. In + addition, the output file of the write process should be saved + permanently each time its format changes. In unit tests, we read + each of those saved files to verify that all future releases can + read RAW data formats and Scouting data formats. +*/ +// Original Author: W. David Dagenhart +// Created: 18 April 2023 + +#include "DataFormats/Common/interface/TriggerResults.h" +#include "FWCore/Framework/interface/global/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include +#include + +namespace edmtest { + + class TestReadTriggerResults : public edm::global::EDAnalyzer<> { + public: + TestReadTriggerResults(edm::ParameterSet const&); + void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override; + void throwWithMessage(const char*) const; + static void fillDescriptions(edm::ConfigurationDescriptions&); + + private: + std::string expectedParameterSetID_; + std::vector expectedNames_; + std::vector expectedHLTStates_; + std::vector expectedModuleIndexes_; + edm::EDGetTokenT triggerResultsToken_; + }; + + TestReadTriggerResults::TestReadTriggerResults(edm::ParameterSet const& iPSet) + : expectedParameterSetID_(iPSet.getParameter("expectedParameterSetID")), + expectedNames_(iPSet.getParameter>("expectedNames")), + expectedHLTStates_(iPSet.getParameter>("expectedHLTStates")), + expectedModuleIndexes_(iPSet.getParameter>("expectedModuleIndexes")), + triggerResultsToken_(consumes(iPSet.getParameter("triggerResultsTag"))) {} + + void TestReadTriggerResults::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const { + auto const& triggerResults = iEvent.get(triggerResultsToken_); + std::string parameterSetID; + triggerResults.parameterSetID().toString(parameterSetID); + if (parameterSetID != expectedParameterSetID_) { + throwWithMessage("parameterSetID does not match expected value"); + } + if (triggerResults.getTriggerNames() != expectedNames_) { + throwWithMessage("names vector does not include expected values"); + } + if (expectedHLTStates_.size() != expectedModuleIndexes_.size()) { + throwWithMessage( + "test configuration error, expectedHLTStates and expectedModuleIndexes should have the same size"); + } + if (triggerResults.size() != expectedHLTStates_.size()) { + throwWithMessage("paths has unexpected size"); + } + for (unsigned int i = 0; i < expectedHLTStates_.size(); ++i) { + if (static_cast(triggerResults.state(i)) != expectedHLTStates_[i]) { + throwWithMessage("state has unexpected value"); + } + if (triggerResults.index(i) != expectedModuleIndexes_[i]) { + throwWithMessage("module index has unexpected value"); + } + } + } + + void TestReadTriggerResults::throwWithMessage(const char* msg) const { + throw cms::Exception("TestFailure") << "TestReadTriggerResults::analyze, " << msg; + } + + void TestReadTriggerResults::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("expectedParameterSetID"); + desc.add>("expectedNames"); + desc.add>("expectedHLTStates"); + desc.add>("expectedModuleIndexes"); + desc.add("triggerResultsTag"); + descriptions.addDefault(desc); + } +} // namespace edmtest + +using edmtest::TestReadTriggerResults; +DEFINE_FWK_MODULE(TestReadTriggerResults); diff --git a/DataFormats/Common/test/TestTriggerResultsFormat.sh b/DataFormats/Common/test/TestTriggerResultsFormat.sh new file mode 100755 index 0000000000000..d5d889d9aa3b1 --- /dev/null +++ b/DataFormats/Common/test/TestTriggerResultsFormat.sh @@ -0,0 +1,19 @@ +#!/bin/sh -ex + +function die { echo $1: status $2 ; exit $2; } + +LOCAL_TEST_DIR=${SCRAM_TEST_PATH} + +cmsRun ${LOCAL_TEST_DIR}/create_triggerresults_test_file_cfg.py || die 'Failure using create_triggerresults_test_file_cfg.py' $? + +file=testTriggerResults.root + +cmsRun ${LOCAL_TEST_DIR}/test_readTriggerResults_cfg.py "$file" || die "Failure using test_readTriggerResults_cfg.py $file" $? + +oldFiles="testTriggerResults_CMSSW_13_0_0.root testTriggerResults_CMSSW_13_1_0_pre3.root" +for file in $oldFiles; do + inputfile=$(edmFileInPath DataFormats/Common/data/$file) || die "Failure edmFileInPath DataFormats/Common/data/$file" $? + cmsRun ${LOCAL_TEST_DIR}/test_readTriggerResults_cfg.py "$inputfile" || die "Failed to read old file $file" $? +done + +exit 0 diff --git a/DataFormats/Common/test/TestWriteTriggerResults.cc b/DataFormats/Common/test/TestWriteTriggerResults.cc new file mode 100644 index 0000000000000..1a7abb4f34f40 --- /dev/null +++ b/DataFormats/Common/test/TestWriteTriggerResults.cc @@ -0,0 +1,87 @@ +// -*- C++ -*- +// +// Package: DataFormats/Common +// Class: TestWriteTriggerResults +// +/**\class edmtest::TestWriteTriggerResults + Description: Used as part of tests that ensure the TriggerResults + data format can be persistently written and in a subsequent process + read. First, this is done using the current release version. In + addition, the output file of the write process should be saved + permanently each time its format changes. In unit tests, we read + each of those saved files to verify that all future releases can + read all versions of RAW data formats and Scouting data formats. +*/ +// Original Author: W. David Dagenhart +// Created: 20 April 2023 + +#include "DataFormats/Common/interface/HLTGlobalStatus.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/Provenance/interface/ParameterSetID.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDPutToken.h" + +#include +#include +#include +#include + +namespace edmtest { + + class TestWriteTriggerResults : public edm::global::EDProducer<> { + public: + TestWriteTriggerResults(edm::ParameterSet const&); + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + + private: + std::string parameterSetID_; + std::vector names_; + std::vector hltStates_; + std::vector moduleIndexes_; + edm::EDPutTokenT triggerResultsPutToken_; + }; + + TestWriteTriggerResults::TestWriteTriggerResults(edm::ParameterSet const& iPSet) + : parameterSetID_(iPSet.getParameter("parameterSetID")), + names_(iPSet.getParameter>("names")), + hltStates_(iPSet.getParameter>("hltStates")), + moduleIndexes_(iPSet.getParameter>("moduleIndexes")), + triggerResultsPutToken_(produces()) {} + + void TestWriteTriggerResults::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const { + edm::HLTGlobalStatus hltGlobalStatus(hltStates_.size()); + for (unsigned int i = 0; i < hltStates_.size(); ++i) { + assert(i < moduleIndexes_.size()); + hltGlobalStatus[i] = edm::HLTPathStatus(static_cast(hltStates_[i]), moduleIndexes_[i]); + } + edm::ParameterSetID parameterSetID(parameterSetID_); + std::unique_ptr result; + if (names_.empty()) { + // names_ will always be empty except in extremely old data or monte carlo files + result = std::make_unique(hltGlobalStatus, parameterSetID); + } else { + // If names is not empty, the ParameterSetID is not set and default constructed + result = std::make_unique(hltGlobalStatus, names_); + } + iEvent.put(triggerResultsPutToken_, std::move(result)); + } + + void TestWriteTriggerResults::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("parameterSetID"); + desc.add>("names"); + desc.add>("hltStates"); + desc.add>("moduleIndexes"); + descriptions.addDefault(desc); + } +} // namespace edmtest + +using edmtest::TestWriteTriggerResults; +DEFINE_FWK_MODULE(TestWriteTriggerResults); diff --git a/DataFormats/Common/test/create_triggerresults_test_file_cfg.py b/DataFormats/Common/test/create_triggerresults_test_file_cfg.py new file mode 100644 index 0000000000000..633f00a3fa1eb --- /dev/null +++ b/DataFormats/Common/test/create_triggerresults_test_file_cfg.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("PROD") + +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.source = cms.Source("EmptySource") +process.maxEvents.input = 1 + +process.triggerResultsProducer = cms.EDProducer("TestWriteTriggerResults", + # Test values below are meaningless. We just make sure when we read + # we get the same values. + parameterSetID = cms.string('8b99d66b6c3865c75e460791f721202d'), + # names should normally be empty. Only extremely old data or + # has names filled and not empty. If it is not empty, the + # ParameterSetID is ignored and left default constructed. + names = cms.vstring(), + hltStates = cms.vuint32(0, 1, 2, 3), + moduleIndexes = cms.vuint32(11, 21, 31, 41) +) + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('testTriggerResults.root') +) + +process.path = cms.Path(process.triggerResultsProducer) +process.endPath = cms.EndPath(process.out) diff --git a/DataFormats/Common/test/reftobaseprod_t.cppunit.cc b/DataFormats/Common/test/reftobaseprod_t.cppunit.cc index 02ab42145d08b..45564b64125f5 100644 --- a/DataFormats/Common/test/reftobaseprod_t.cppunit.cc +++ b/DataFormats/Common/test/reftobaseprod_t.cppunit.cc @@ -93,11 +93,13 @@ void testRefToBaseProd::constructTest() { CPPUNIT_ASSERT(!nulled); CPPUNIT_ASSERT(nulled.isNull()); CPPUNIT_ASSERT(!nulled.isNonnull()); + CPPUNIT_ASSERT(!nulled.isAvailable()); RefToBaseProd nulledP; CPPUNIT_ASSERT(!nulledP); CPPUNIT_ASSERT(nulledP.isNull()); CPPUNIT_ASSERT(!nulledP.isNonnull()); + CPPUNIT_ASSERT(!nulledP.isAvailable()); ProductID const pid(1, 1); @@ -110,6 +112,9 @@ void testRefToBaseProd::constructTest() { OrphanHandle handle(&dummyContainer, pid); RefToBaseProd dummyPtr(handle); + CPPUNIT_ASSERT(!dummyPtr.isNull()); + CPPUNIT_ASSERT(dummyPtr.isNonnull()); + CPPUNIT_ASSERT(dummyPtr.isAvailable()); CPPUNIT_ASSERT(dummyPtr.id() == pid); compareTo(dummyPtr, dummyContainer); } @@ -218,9 +223,15 @@ void testRefToBaseProd::getTest() { RefCore core(pid, nullptr, &tester, false); RefToBaseProd& prod = reinterpret_cast&>(core); + CPPUNIT_ASSERT(!prod.isNull()); + CPPUNIT_ASSERT(prod.isNonnull()); + CPPUNIT_ASSERT(prod.isAvailable()); //previously making a copy before reading back would cause seg fault RefToBaseProd prodCopy(prod); + CPPUNIT_ASSERT(!prodCopy.isNull()); + CPPUNIT_ASSERT(prodCopy.isNonnull()); + CPPUNIT_ASSERT(prodCopy.isAvailable()); CPPUNIT_ASSERT(!prod.hasCache()); diff --git a/DataFormats/Common/test/test_readTriggerResults_cfg.py b/DataFormats/Common/test/test_readTriggerResults_cfg.py new file mode 100644 index 0000000000000..6c465f3853583 --- /dev/null +++ b/DataFormats/Common/test/test_readTriggerResults_cfg.py @@ -0,0 +1,23 @@ +import FWCore.ParameterSet.Config as cms +import sys + +process = cms.Process("READ") + +process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring("file:"+sys.argv[2])) +process.maxEvents.input = 1 + +process.testReadTriggerResults = cms.EDAnalyzer("TestReadTriggerResults", + triggerResultsTag = cms.InputTag("triggerResultsProducer", "", "PROD"), + expectedParameterSetID = cms.string('8b99d66b6c3865c75e460791f721202d'), + expectedNames = cms.vstring(), + expectedHLTStates = cms.vuint32(0, 1, 2, 3), + expectedModuleIndexes = cms.vuint32(11, 21, 31, 41) +) + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('testTriggerResults2.root') +) + +process.path = cms.Path(process.testReadTriggerResults) + +process.endPath = cms.EndPath(process.out) diff --git a/DataFormats/EcalDigi/interface/EcalConstants.h b/DataFormats/EcalDigi/interface/EcalConstants.h index fa52fc3908f4e..3b500c1efb614 100644 --- a/DataFormats/EcalDigi/interface/EcalConstants.h +++ b/DataFormats/EcalDigi/interface/EcalConstants.h @@ -4,6 +4,15 @@ #include "FWCore/Utilities/interface/HostDeviceConstant.h" +// constants used to encode difference between corrected cc time and noncorrected cc time +// into a uInt8 value to be stored in the 8 bits set aside for the jitter error ( previously unused ) +namespace ecalcctiming { + inline constexpr const float clockToNS = 25.0; // Convert clock units to ns + inline constexpr const float nonCorrectedSlope = 1.2; // estimates nonCorreted time from corrected time + inline constexpr const float encodingOffest = 0.32; // offsets difference in time using clock units + inline constexpr const float encodingValue = 398.4375; // encodes time difference into 0 - 255 int range +} // namespace ecalcctiming + // The HOST_DEVICE_CONSTANTs can not reside in the classes directly, which is // why they are defined in a namespace and constant pointers to them are used in the classes namespace ecalph2 { diff --git a/DataFormats/EcalDigi/interface/EcalTimeDigi.h b/DataFormats/EcalDigi/interface/EcalTimeDigi.h index 9fb2a629d3199..88e40a6482ffb 100644 --- a/DataFormats/EcalDigi/interface/EcalTimeDigi.h +++ b/DataFormats/EcalDigi/interface/EcalTimeDigi.h @@ -15,6 +15,7 @@ class EcalTimeDigi { void swap(EcalTimeDigi& rh) { std::swap(id_, rh.id_); std::swap(size_, rh.size_); + std::swap(waveform_, rh.waveform_); std::swap(data_, rh.data_); } @@ -25,16 +26,21 @@ class EcalTimeDigi { const float& sample(unsigned int i) const { return data_[i]; } void setSize(unsigned int size); + void setWaveform(float* waveform); void setSample(unsigned int i, const float sam) { data_[i] = sam; } void setSampleOfInterest(int i) { sampleOfInterest_ = i; } /// Gets the BX==0 sample. If =-1 then it means that only OOT hits are present int sampleOfInterest() const { return sampleOfInterest_; } + std::vector waveform() const { return waveform_; } + + static const unsigned int WAVEFORMSAMPLES = 250; private: DetId id_; unsigned int size_; int sampleOfInterest_; + std::vector waveform_; std::vector data_; }; diff --git a/DataFormats/EcalDigi/src/EcalTimeDigi.cc b/DataFormats/EcalDigi/src/EcalTimeDigi.cc index 973de476f31c7..3e0dfe72a82d7 100644 --- a/DataFormats/EcalDigi/src/EcalTimeDigi.cc +++ b/DataFormats/EcalDigi/src/EcalTimeDigi.cc @@ -2,11 +2,12 @@ namespace { constexpr unsigned int MAXSAMPLES = 10; -} +} // namespace -EcalTimeDigi::EcalTimeDigi() : id_(0), size_(0), sampleOfInterest_(-1), data_(MAXSAMPLES) {} +EcalTimeDigi::EcalTimeDigi() : id_(0), size_(0), sampleOfInterest_(-1), waveform_(WAVEFORMSAMPLES), data_(MAXSAMPLES) {} -EcalTimeDigi::EcalTimeDigi(const DetId& id) : id_(id), size_(0), sampleOfInterest_(-1), data_(MAXSAMPLES) {} +EcalTimeDigi::EcalTimeDigi(const DetId& id) + : id_(id), size_(0), sampleOfInterest_(-1), waveform_(WAVEFORMSAMPLES), data_(MAXSAMPLES) {} void EcalTimeDigi::setSize(unsigned int size) { if (size > MAXSAMPLES) @@ -15,3 +16,10 @@ void EcalTimeDigi::setSize(unsigned int size) { size_ = size; data_.resize(size_); } + +void EcalTimeDigi::setWaveform(float* waveform) { + waveform_.resize(WAVEFORMSAMPLES); + for (uint i(0); i != WAVEFORMSAMPLES; ++i) { + waveform_[i] = waveform[i]; + } +} diff --git a/DataFormats/EcalDigi/src/classes_def.xml b/DataFormats/EcalDigi/src/classes_def.xml index 5f365f96523b4..7893cc71b2bf2 100644 --- a/DataFormats/EcalDigi/src/classes_def.xml +++ b/DataFormats/EcalDigi/src/classes_def.xml @@ -53,7 +53,8 @@ - + + diff --git a/DataFormats/EcalRecHit/interface/EcalRecHit.h b/DataFormats/EcalRecHit/interface/EcalRecHit.h index 64be12ec35f6e..338afcb0d31fa 100644 --- a/DataFormats/EcalRecHit/interface/EcalRecHit.h +++ b/DataFormats/EcalRecHit/interface/EcalRecHit.h @@ -3,6 +3,7 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/CaloRecHit/interface/CaloRecHit.h" +#include "DataFormats/EcalDigi/interface/EcalDataFrame.h" #include #include @@ -216,6 +217,16 @@ class EcalRecHit { return kGood; } + // For CC Timing reco + float nonCorrectedTime() const { + uint8_t jitterErrorBits = getMasked(extra_, 24, 8); + float encBits = static_cast(jitterErrorBits); + float decTimeDif = ecalcctiming::clockToNS * (ecalcctiming::encodingOffest - encBits / ecalcctiming::encodingValue); + float nonCorrectedTime = + (encBits > 1 && encBits < 254) ? ecalcctiming::nonCorrectedSlope * time_ + decTimeDif : -30.0; + return nonCorrectedTime; + } + private: // from calorechit DetId id_; diff --git a/DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h b/DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h index 9b1412c035b59..448e0063b369a 100644 --- a/DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h +++ b/DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h @@ -55,6 +55,10 @@ class EcalUncalibratedRecHit { bool isJitterValid() const; bool isJitterErrorValid() const; + // For CC Timing reco + float nonCorrectedTime() const; + void setNonCorrectedTime(const float correctedJittter, const float nonCorrectedJitter); + private: float amplitude_; //< Reconstructed amplitude float amplitudeError_; //< Reconstructed amplitude uncertainty diff --git a/DataFormats/EcalRecHit/src/EcalUncalibratedRecHit.cc b/DataFormats/EcalRecHit/src/EcalUncalibratedRecHit.cc index 4516f25f7ed94..88710927c1a0d 100644 --- a/DataFormats/EcalRecHit/src/EcalUncalibratedRecHit.cc +++ b/DataFormats/EcalRecHit/src/EcalUncalibratedRecHit.cc @@ -115,3 +115,19 @@ bool EcalUncalibratedRecHit::checkFlag(EcalUncalibratedRecHit::Flags flag) const } // if all flags are unset, then hit is good return flags_ & (0x1 << flag); } + +// For CC Timing reco +float EcalUncalibratedRecHit::nonCorrectedTime() const { + float encBits = static_cast(jitterErrorBits()); + float decJitter = + ecalcctiming::nonCorrectedSlope * jitter_ + ecalcctiming::encodingOffest - encBits / ecalcctiming::encodingValue; + float nonCorrectedTime = (encBits > 1 && encBits < 254) ? ecalcctiming::clockToNS * decJitter : -30.0; + return nonCorrectedTime; +} + +void EcalUncalibratedRecHit::setNonCorrectedTime(const float correctedJitter, const float nonCorrectedJitter) { + float fDiff = ecalcctiming::nonCorrectedSlope * correctedJitter - nonCorrectedJitter + ecalcctiming::encodingOffest; + int encBits = std::floor((fDiff * ecalcctiming::encodingValue) + 0.5); + int bits = (encBits < 1) ? 1 : (encBits > 254) ? 254 : encBits; + aux_ = (~0xFF & aux_) | (static_cast(bits) & 0xFF); +} diff --git a/DataFormats/FEDRawData/README.md b/DataFormats/FEDRawData/README.md new file mode 100644 index 0000000000000..0cc3c76428f37 --- /dev/null +++ b/DataFormats/FEDRawData/README.md @@ -0,0 +1,10 @@ +# DataFormats/FEDRawData + +## `FEDRawDataCollection` + +The class `FEDRawDataCollection` is part of the RAW data, and any changes must be backwards compatible. In order to ensure it can be read by all future CMSSW releases, there is a `TestFEDRawDataCollectionFormat` unit test, which makes use of the `TestReadFEDRawDataCollection` analyzer and the `TestWriteFEDRawDataCollection` producer. The unit test checks that the object can be read properly from + +* a file written by the same release +* files written by (some) earlier releases + +If the persistent format of class `FEDRawDataCollection` gets changed in the future, please adjust the `TestReadFEDRawDataCollection` and `TestWriteFEDRawDataCollection` modules accordingly. It is important that every member container has some content in this test. Please also add a new file to the [https://github.com/cms-data/DataFormats-FEDRawData/](https://github.com/cms-data/DataFormats-FEDRawData/) repository, and update the `TestFEDRawDataCollectionFormat` unit test to read the newly created file. The file name should contain the release or pre-release with which it was written. diff --git a/DataFormats/FEDRawData/test/BuildFile.xml b/DataFormats/FEDRawData/test/BuildFile.xml index c69c5fdc725d3..28fbaa29c7152 100644 --- a/DataFormats/FEDRawData/test/BuildFile.xml +++ b/DataFormats/FEDRawData/test/BuildFile.xml @@ -1,4 +1,14 @@ + + + + + + + + + + diff --git a/DataFormats/FEDRawData/test/TestFEDRawDataCollectionFormat.sh b/DataFormats/FEDRawData/test/TestFEDRawDataCollectionFormat.sh new file mode 100755 index 0000000000000..ba15b3bb6619a --- /dev/null +++ b/DataFormats/FEDRawData/test/TestFEDRawDataCollectionFormat.sh @@ -0,0 +1,19 @@ +#!/bin/sh -ex + +function die { echo $1: status $2 ; exit $2; } + +LOCAL_TEST_DIR=${SCRAM_TEST_PATH} + +cmsRun ${LOCAL_TEST_DIR}/create_FEDRawDataCollection_test_file_cfg.py || die 'Failure using create_FEDRawDataCollection_test_file_cfg.py' $? + +file=testFEDRawDataCollection.root + +cmsRun ${LOCAL_TEST_DIR}/test_readFEDRawDataCollection_cfg.py "$file" || die "Failure using test_readFEDRawDataCollection_cfg.py $file" $? + +oldFiles="testFEDRawDataCollection_CMSSW_13_0_0.root testFEDRawDataCollection_CMSSW_13_1_0_pre3.root" +for file in $oldFiles; do + inputfile=$(edmFileInPath DataFormats/FEDRawData/data/$file) || die "Failure edmFileInPath DataFormats/FEDRawData/data/$file" $? + cmsRun ${LOCAL_TEST_DIR}/test_readFEDRawDataCollection_cfg.py "$inputfile" || die "Failed to read old file $file" $? +done + +exit 0 diff --git a/DataFormats/FEDRawData/test/TestReadFEDRawDataCollection.cc b/DataFormats/FEDRawData/test/TestReadFEDRawDataCollection.cc new file mode 100644 index 0000000000000..788a5153dd51a --- /dev/null +++ b/DataFormats/FEDRawData/test/TestReadFEDRawDataCollection.cc @@ -0,0 +1,95 @@ +// -*- C++ -*- +// +// Package: DataFormats/FEDRawData +// Class: TestReadFEDRawDataCollection +// +/**\class edmtest::TestReadFEDRawDataCollection + Description: Used as part of tests that ensure the FEDRawDataCollection + data format can be persistently written and in a subsequent process + read. First, this is done using the current release version for writing + and reading. In addition, the output file of the write process should + be saved permanently each time the FEDRawDataCollection persistent data + format changes. In unit tests, we read each of those saved files to verify + that the current releases can read older versions of the data format. +*/ +// Original Author: W. David Dagenhart +// Created: 1 May 2023 + +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDAnalyzer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/StreamID.h" + +#include + +namespace edmtest { + + class TestReadFEDRawDataCollection : public edm::global::EDAnalyzer<> { + public: + TestReadFEDRawDataCollection(edm::ParameterSet const&); + void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override; + void throwWithMessage(const char*) const; + static void fillDescriptions(edm::ConfigurationDescriptions&); + + private: + // Two FEDRawData elements should be enough to verify we can read + // and write the whole collection. I arbitrarily chose elements + // 0 and 3 of the Collection. Values are meaningless, we just + // verify what we read matches what we wrote. For purposes of + // this test that is enough. + std::vector expectedFEDData0_; + std::vector expectedFEDData3_; + edm::EDGetTokenT fedRawDataCollectionToken_; + }; + + TestReadFEDRawDataCollection::TestReadFEDRawDataCollection(edm::ParameterSet const& iPSet) + : expectedFEDData0_(iPSet.getParameter>("expectedFEDData0")), + expectedFEDData3_(iPSet.getParameter>("expectedFEDData3")), + fedRawDataCollectionToken_(consumes(iPSet.getParameter("fedRawDataCollectionTag"))) {} + + void TestReadFEDRawDataCollection::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const { + auto const& fedRawDataCollection = iEvent.get(fedRawDataCollectionToken_); + auto const& fedData0 = fedRawDataCollection.FEDData(0); + if (fedData0.size() != expectedFEDData0_.size()) { + throwWithMessage("fedData0 does not have expected size"); + } + for (unsigned int i = 0; i < fedData0.size(); ++i) { + if (fedData0.data()[i] != expectedFEDData0_[i]) { + throwWithMessage("fedData0 does not have expected contents"); + } + } + auto const& fedData3 = fedRawDataCollection.FEDData(3); + if (fedData3.size() != expectedFEDData3_.size()) { + throwWithMessage("fedData3 does not have expected size"); + } + for (unsigned int i = 0; i < fedData3.size(); ++i) { + if (fedData3.data()[i] != expectedFEDData3_[i]) { + throwWithMessage("fedData3 does not have expected contents"); + } + } + } + + void TestReadFEDRawDataCollection::throwWithMessage(const char* msg) const { + throw cms::Exception("TestFailure") << "TestReadFEDRawDataCollection::analyze, " << msg; + } + + void TestReadFEDRawDataCollection::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add>("expectedFEDData0"); + desc.add>("expectedFEDData3"); + desc.add("fedRawDataCollectionTag"); + descriptions.addDefault(desc); + } +} // namespace edmtest + +using edmtest::TestReadFEDRawDataCollection; +DEFINE_FWK_MODULE(TestReadFEDRawDataCollection); diff --git a/DataFormats/FEDRawData/test/TestWriteFEDRawDataCollection.cc b/DataFormats/FEDRawData/test/TestWriteFEDRawDataCollection.cc new file mode 100644 index 0000000000000..ff846686598f9 --- /dev/null +++ b/DataFormats/FEDRawData/test/TestWriteFEDRawDataCollection.cc @@ -0,0 +1,80 @@ +// -*- C++ -*- +// +// Package: DataFormats/FEDRawData +// Class: TestWriteFEDRawDataCollection +// +/**\class edmtest::TestWriteFEDRawDataCollection + Description: Used as part of tests that ensure the FEDRawDataCollection + data format can be persistently written and in a subsequent process + read. First, this is done using the current release version for writing + and reading. In addition, the output file of the write process should + be saved permanently each time the FEDRawDataCollection persistent data + format changes. In unit tests, we read each of those saved files to verify + that the current releases can read older versions of the data format. +*/ +// Original Author: W. David Dagenhart +// Created: 1 May 2023 + +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/EDPutToken.h" +#include "FWCore/Utilities/interface/StreamID.h" + +#include +#include +#include + +namespace edmtest { + + class TestWriteFEDRawDataCollection : public edm::global::EDProducer<> { + public: + TestWriteFEDRawDataCollection(edm::ParameterSet const&); + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions&); + + private: + std::vector fedData0_; + std::vector fedData3_; + edm::EDPutTokenT fedRawDataCollectionPutToken_; + }; + + TestWriteFEDRawDataCollection::TestWriteFEDRawDataCollection(edm::ParameterSet const& iPSet) + : fedData0_(iPSet.getParameter>("FEDData0")), + fedData3_(iPSet.getParameter>("FEDData3")), + fedRawDataCollectionPutToken_(produces()) {} + + void TestWriteFEDRawDataCollection::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const { + auto fedRawDataCollection = std::make_unique(); + FEDRawData& fedData0 = fedRawDataCollection->FEDData(0); + FEDRawData& fedData3 = fedRawDataCollection->FEDData(3); + + fedData0.resize(fedData0_.size()); + unsigned char* dataPtr0 = fedData0.data(); + for (unsigned int i = 0; i < fedData0_.size(); ++i) { + dataPtr0[i] = fedData0_[i]; + } + fedData3.resize(fedData3_.size()); + unsigned char* dataPtr3 = fedData3.data(); + for (unsigned int i = 0; i < fedData3_.size(); ++i) { + dataPtr3[i] = fedData3_[i]; + } + iEvent.put(fedRawDataCollectionPutToken_, std::move(fedRawDataCollection)); + } + + void TestWriteFEDRawDataCollection::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add>("FEDData0"); + desc.add>("FEDData3"); + descriptions.addDefault(desc); + } +} // namespace edmtest + +using edmtest::TestWriteFEDRawDataCollection; +DEFINE_FWK_MODULE(TestWriteFEDRawDataCollection); diff --git a/DataFormats/FEDRawData/test/create_FEDRawDataCollection_test_file_cfg.py b/DataFormats/FEDRawData/test/create_FEDRawDataCollection_test_file_cfg.py new file mode 100644 index 0000000000000..02d2d7bfd3638 --- /dev/null +++ b/DataFormats/FEDRawData/test/create_FEDRawDataCollection_test_file_cfg.py @@ -0,0 +1,22 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("PROD") + +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.source = cms.Source("EmptySource") +process.maxEvents.input = 1 + +process.fedRawDataCollectionProducer = cms.EDProducer("TestWriteFEDRawDataCollection", + # Test values below are meaningless. We just make sure when we read + # we get the same values. + FEDData0 = cms.vuint32(0, 1, 2, 3, 4, 5, 6, 7), + FEDData3 = cms.vuint32(100, 101, 102, 103, 104, 105, 106, 107) +) + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('testFEDRawDataCollection.root') +) + +process.path = cms.Path(process.fedRawDataCollectionProducer) +process.endPath = cms.EndPath(process.out) diff --git a/DataFormats/FEDRawData/test/test_readFEDRawDataCollection_cfg.py b/DataFormats/FEDRawData/test/test_readFEDRawDataCollection_cfg.py new file mode 100644 index 0000000000000..67389987c3424 --- /dev/null +++ b/DataFormats/FEDRawData/test/test_readFEDRawDataCollection_cfg.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms +import sys + +process = cms.Process("READ") + +process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring("file:"+sys.argv[2])) +process.maxEvents.input = 1 + +process.testReadFEDRawDataCollection = cms.EDAnalyzer("TestReadFEDRawDataCollection", + fedRawDataCollectionTag = cms.InputTag("fedRawDataCollectionProducer", "", "PROD"), + expectedFEDData0 = cms.vuint32(0, 1, 2, 3, 4, 5, 6, 7), + expectedFEDData3 = cms.vuint32(100, 101, 102, 103, 104, 105, 106, 107) +) + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('testFEDRawDataCollection2.root') +) + +process.path = cms.Path(process.testReadFEDRawDataCollection) + +process.endPath = cms.EndPath(process.out) diff --git a/DataFormats/FWLite/test/BuildFile.xml b/DataFormats/FWLite/test/BuildFile.xml index b1c0a7386a6bc..bf4aab00c5a65 100644 --- a/DataFormats/FWLite/test/BuildFile.xml +++ b/DataFormats/FWLite/test/BuildFile.xml @@ -1,10 +1,5 @@ - - - - - - - + + @@ -13,8 +8,6 @@ - + - - - + diff --git a/DataFormats/FWLite/test/MergeTest.sh b/DataFormats/FWLite/test/MergeTest.sh index ea03f9f0ade34..9a52f8074156b 100755 --- a/DataFormats/FWLite/test/MergeTest.sh +++ b/DataFormats/FWLite/test/MergeTest.sh @@ -1,6 +1,6 @@ #!/bin/sh -rm -f ${LOCAL_TEST_DIR}/prod1.root ${LOCAL_TEST_DIR}/prod2.root ${LOCAL_TEST_DIR}/prodmerge.root +rm -f ${SCRAM_TEST_PATH}/prod1.root ${SCRAM_TEST_PATH}/prod2.root ${SCRAM_TEST_PATH}/prodmerge.root rm -f prod1.root prod2.root prodmerge.root -cmsRun ${LOCAL_TEST_DIR}/ProdTest1_cfg.py -cmsRun ${LOCAL_TEST_DIR}/ProdTest2_cfg.py -cmsRun ${LOCAL_TEST_DIR}/ProdTestMerge_cfg.py +cmsRun ${SCRAM_TEST_PATH}/ProdTest1_cfg.py +cmsRun ${SCRAM_TEST_PATH}/ProdTest2_cfg.py +cmsRun ${SCRAM_TEST_PATH}/ProdTestMerge_cfg.py diff --git a/DataFormats/FWLite/test/RefTest.sh b/DataFormats/FWLite/test/RefTest.sh index 4cca5de370e0b..1479bc341f646 100755 --- a/DataFormats/FWLite/test/RefTest.sh +++ b/DataFormats/FWLite/test/RefTest.sh @@ -9,14 +9,14 @@ rm -f other_onlyDataFormatsFWLite.root good_delta5DataFormatsFWLite.root rm -f partialEventDataFormatsFWLite.root refTestCopyDropDataFormatsFWLite.root echo RefTest_cfg.py -cmsRun ${LOCAL_TEST_DIR}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $? echo RefTest2_cfg.py -cmsRun ${LOCAL_TEST_DIR}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $? echo EmptyFile_cfg.py -cmsRun ${LOCAL_TEST_DIR}/EmptyFile_cfg.py || die "cmsRun EmptyFile_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/EmptyFile_cfg.py || die "cmsRun EmptyFile_cfg.py" $? echo PartialEventTest_cfg.py -cmsRun ${LOCAL_TEST_DIR}/PartialEventTest_cfg.py || die "cmsRun PartialEventTest_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/PartialEventTest_cfg.py || die "cmsRun PartialEventTest_cfg.py" $? echo RefTestCopyDrop_cfg.py -cmsRun ${LOCAL_TEST_DIR}/RefTestCopyDrop_cfg.py || die "cmsRun RefTestCopyDrop_cfg.py" $? +cmsRun ${SCRAM_TEST_PATH}/RefTestCopyDrop_cfg.py || die "cmsRun RefTestCopyDrop_cfg.py" $? exit 0 diff --git a/DataFormats/FWLite/test/RefTest_a.sh b/DataFormats/FWLite/test/RefTest_a.sh index 06f4e7b7b6a8b..2749e9b8f645b 100755 --- a/DataFormats/FWLite/test/RefTest_a.sh +++ b/DataFormats/FWLite/test/RefTest_a.sh @@ -1,6 +1,6 @@ #!/bin/sh -rm -f ${LOCAL_TEST_DIR}/good_a.root ${LOCAL_TEST_DIR}/good_b.root ${LOCAL_TEST_DIR}/empty_a.root +rm -f ${SCRAM_TEST_PATH}/good_a.root ${SCRAM_TEST_PATH}/good_b.root ${SCRAM_TEST_PATH}/empty_a.root rm -f good_a.root good_b.root empty_a.root -cmsRun ${LOCAL_TEST_DIR}/RefTest_a_cfg.py -cmsRun ${LOCAL_TEST_DIR}/RefTest_b_cfg.py -cmsRun ${LOCAL_TEST_DIR}/EmptyFile_a_cfg.py +cmsRun ${SCRAM_TEST_PATH}/RefTest_a_cfg.py +cmsRun ${SCRAM_TEST_PATH}/RefTest_b_cfg.py +cmsRun ${SCRAM_TEST_PATH}/EmptyFile_a_cfg.py diff --git a/DataFormats/FWLite/test/TestRunnerDataFormatsFWLite.cpp b/DataFormats/FWLite/test/TestRunnerDataFormatsFWLite.cpp deleted file mode 100644 index b2991bd18ae57..0000000000000 --- a/DataFormats/FWLite/test/TestRunnerDataFormatsFWLite.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "FWCore/Utilities/interface/TestHelper.h" - -RUNTEST() diff --git a/DataFormats/FWLite/test/VIPTest.sh b/DataFormats/FWLite/test/VIPTest.sh index 1e1cc1e6d6826..9fa31fb598798 100755 --- a/DataFormats/FWLite/test/VIPTest.sh +++ b/DataFormats/FWLite/test/VIPTest.sh @@ -1,4 +1,4 @@ #!/bin/sh -rm -f ${LOCAL_TEST_DIR}/vectorinttest.root +rm -f ${SCRAM_TEST_PATH}/vectorinttest.root rm -f vectorinttest.root -cmsRun ${LOCAL_TEST_DIR}/vip_cfg.py +cmsRun ${SCRAM_TEST_PATH}/vip_cfg.py diff --git a/DataFormats/FWLite/test/run_all_t.sh b/DataFormats/FWLite/test/run_all_t.sh index 334cb37510b75..8bb08ff8c91c6 100755 --- a/DataFormats/FWLite/test/run_all_t.sh +++ b/DataFormats/FWLite/test/run_all_t.sh @@ -4,32 +4,32 @@ # Pass in name and status function die { echo $1: status $2 ; exit $2; } -${LOCAL_TEST_DIR}/RefTest_a.sh || die 'Failed to create file' $? -root -b -n -q ${LOCAL_TEST_DIR}/event_looping_cint.C || die 'Failed in event_looping_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/event_looping_consumes_cint.C || die 'Failed in event_looping_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/chainevent_looping_cint.C || die 'Failed in chainevent_looping_cint.C' $? -python3 ${LOCAL_TEST_DIR}/chainEvent_python.py || die 'Failed in chainEvent_python.py' $? -#root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $? -#root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $? +${SCRAM_TEST_PATH}/RefTest_a.sh || die 'Failed to create file' $? +root -b -n -q ${SCRAM_TEST_PATH}/event_looping_cint.C || die 'Failed in event_looping_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/event_looping_consumes_cint.C || die 'Failed in event_looping_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/chainevent_looping_cint.C || die 'Failed in chainevent_looping_cint.C' $? +python3 ${SCRAM_TEST_PATH}/chainEvent_python.py || die 'Failed in chainEvent_python.py' $? +#root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $? +#root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $? -${LOCAL_TEST_DIR}/MergeTest.sh || die 'Failed to create file' $? -root -b -n -q ${LOCAL_TEST_DIR}/runlumi_looping_cint.C || die 'Failed in runlumi_looping_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/productid_cint.C || die 'Failed in productid_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/triggernames_cint.C || die 'Failed in triggernames_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/triggernames_multi_cint.C || die 'Failed in triggernames_multi_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/triggerResultsByName_cint.C || die 'Failed in triggerResultsByName_cint.C' $? -root -b -n -q ${LOCAL_TEST_DIR}/triggerResultsByName_multi_cint.C || die 'Failed in triggerResultsByName_multi_cint.C' $? +${SCRAM_TEST_PATH}/MergeTest.sh || die 'Failed to create file' $? +root -b -n -q ${SCRAM_TEST_PATH}/runlumi_looping_cint.C || die 'Failed in runlumi_looping_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/productid_cint.C || die 'Failed in productid_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/triggernames_cint.C || die 'Failed in triggernames_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/triggernames_multi_cint.C || die 'Failed in triggernames_multi_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/triggerResultsByName_cint.C || die 'Failed in triggerResultsByName_cint.C' $? +root -b -n -q ${SCRAM_TEST_PATH}/triggerResultsByName_multi_cint.C || die 'Failed in triggerResultsByName_multi_cint.C' $? -${LOCAL_TEST_DIR}/VIPTest.sh || die 'Failed to create file' $? -root -b -n -q ${LOCAL_TEST_DIR}/vector_int_cint.C || die 'Failed in vector_int_cint.C' $? +${SCRAM_TEST_PATH}/VIPTest.sh || die 'Failed to create file' $? +root -b -n -q ${SCRAM_TEST_PATH}/vector_int_cint.C || die 'Failed in vector_int_cint.C' $? -python3 ${LOCAL_TEST_DIR}/pyroot_handle_reuse.py || die 'Failed in pyroot_handle_reuse.py' $? -python3 ${LOCAL_TEST_DIR}/pyroot_multichain.py inputFiles=file:prodmerge.root secondaryInputFiles=file:prod1.root,file:prod2.root || die 'Failed in pyroot_multichain.py (non-empty files)' $? -python3 ${LOCAL_TEST_DIR}/pyroot_multichain.py inputFiles=file:empty_a.root secondaryInputFiles=file:good_a.root || die 'Failed in pyroot_multichain.py (empty file)' $? +python3 ${SCRAM_TEST_PATH}/pyroot_handle_reuse.py || die 'Failed in pyroot_handle_reuse.py' $? +python3 ${SCRAM_TEST_PATH}/pyroot_multichain.py inputFiles=file:prodmerge.root secondaryInputFiles=file:prod1.root,file:prod2.root || die 'Failed in pyroot_multichain.py (non-empty files)' $? +python3 ${SCRAM_TEST_PATH}/pyroot_multichain.py inputFiles=file:empty_a.root secondaryInputFiles=file:good_a.root || die 'Failed in pyroot_multichain.py (empty file)' $? #NOTE: ROOT has a bug which keeps the AssociationVector from running its ioread rule and therefore it never clears its cache #test AssociationVector reading -#rm -f ${LOCAL_TEST_DIR}/avtester.root +#rm -f ${SCRAM_TEST_PATH}/avtester.root #rm -f avtester.root -#cmsRun ${LOCAL_TEST_DIR}/make_associationvector_file_cfg.py || die "cmsRun make_associationvector_file_cfg.py " $? -#python ${LOCAL_TEST_DIR}/pyroot_read_associationvector.py || die 'Failed in pyroot_read_associationvector.py' +#cmsRun ${SCRAM_TEST_PATH}/make_associationvector_file_cfg.py || die "cmsRun make_associationvector_file_cfg.py " $? +#python ${SCRAM_TEST_PATH}/pyroot_read_associationvector.py || die 'Failed in pyroot_read_associationvector.py' diff --git a/DataFormats/FWLite/test/test.cppunit.cpp b/DataFormats/FWLite/test/test.cppunit.cpp index 873043639b073..58cd14ded3f7d 100644 --- a/DataFormats/FWLite/test/test.cppunit.cpp +++ b/DataFormats/FWLite/test/test.cppunit.cpp @@ -14,7 +14,6 @@ Test program for edm::Ref use in ROOT. #include "DataFormats/TestObjects/interface/OtherThingCollection.h" #include "DataFormats/TestObjects/interface/ThingCollection.h" #include "DataFormats/TestObjects/interface/TrackOfThings.h" -#include "FWCore/Utilities/interface/TestHelper.h" #include "DataFormats/FWLite/interface/ChainEvent.h" #include "DataFormats/FWLite/interface/EventBase.h" @@ -23,12 +22,6 @@ Test program for edm::Ref use in ROOT. #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Provenance/interface/ProductID.h" -static char* gArgV = nullptr; - -extern "C" char** environ; - -#define CHARSTAR(x) const_cast(x) - class testRefInROOT : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(testRefInROOT); @@ -576,10 +569,7 @@ void testRefInROOT::testThinning() { #include #include -int main(int argc, char* argv[]) { - gArgV = argv[0]; - std::string testPath = (argc > 1) ? std::string(argv[1]) : ""; - +int main() { // Create the event manager and test controller CppUnit::TestResult controller; @@ -595,8 +585,8 @@ int main(int argc, char* argv[]) { CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); try { - std::cout << "Running " << testPath; - runner.run(controller, testPath); + std::cout << "Running "; + runner.run(controller); std::cerr << std::endl; diff --git a/DataFormats/GEMDigi/interface/GEMVFAT.h b/DataFormats/GEMDigi/interface/GEMVFAT.h index 94811bac22e2b..79820cd93cd1b 100644 --- a/DataFormats/GEMDigi/interface/GEMVFAT.h +++ b/DataFormats/GEMDigi/interface/GEMVFAT.h @@ -16,7 +16,8 @@ class GEMVFAT { // is half-full, so it's like a warning uint64_t vc : 1; /// VFAT CRC Error uint64_t : 7; // unused - uint64_t pos : 8; // VFAT position on chamber, 5 used in GE11 but more is needed for phase2 + uint64_t pos : 5; // VFAT position on chamber, 5 used in GE11 but more is needed for phase2 + uint64_t : 3; // unused }; // v2 dataformat struct { diff --git a/DataFormats/GeometrySurface/interface/private/sseTkRotation.h b/DataFormats/GeometrySurface/interface/private/sseTkRotation.h index 4c793e8b67a06..3c06b28bd78d3 100644 --- a/DataFormats/GeometrySurface/interface/private/sseTkRotation.h +++ b/DataFormats/GeometrySurface/interface/private/sseTkRotation.h @@ -205,10 +205,10 @@ class TkRotation { }; template <> -std::ostream& operator<<(std::ostream& s, const TkRotation& r); +std::ostream& operator<< (std::ostream& s, const TkRotation& r); template <> -std::ostream& operator<<(std::ostream& s, const TkRotation& r); +std::ostream& operator<< (std::ostream& s, const TkRotation& r); template inline Basic3DVector operator*(const TkRotation& r, const Basic3DVector& v) { @@ -270,9 +270,9 @@ class TkRotation2D { }; template <> -std::ostream& operator<<(std::ostream& s, const TkRotation2D& r); +std::ostream& operator<< (std::ostream& s, const TkRotation2D& r); template <> -std::ostream& operator<<(std::ostream& s, const TkRotation2D& r); +std::ostream& operator<< (std::ostream& s, const TkRotation2D& r); #endif diff --git a/DataFormats/GeometrySurface/src/TkRotation.cc b/DataFormats/GeometrySurface/src/TkRotation.cc index 12dfd5e460b65..27248865444d9 100644 --- a/DataFormats/GeometrySurface/src/TkRotation.cc +++ b/DataFormats/GeometrySurface/src/TkRotation.cc @@ -2,26 +2,26 @@ #include template <> -std::ostream& operator<<(std::ostream& s, const TkRotation& rtmp) { +std::ostream& operator<< (std::ostream& s, const TkRotation& rtmp) { return s << " (" << rtmp.xx() << ',' << rtmp.xy() << ',' << rtmp.xz() << ")\n" << " (" << rtmp.yx() << ',' << rtmp.yy() << ',' << rtmp.yz() << ")\n" << " (" << rtmp.zx() << ',' << rtmp.zy() << ',' << rtmp.zz() << ") "; } template <> -std::ostream& operator<<(std::ostream& s, const TkRotation& rtmp) { +std::ostream& operator<< (std::ostream& s, const TkRotation& rtmp) { return s << " (" << rtmp.xx() << ',' << rtmp.xy() << ',' << rtmp.xz() << ")\n" << " (" << rtmp.yx() << ',' << rtmp.yy() << ',' << rtmp.yz() << ")\n" << " (" << rtmp.zx() << ',' << rtmp.zy() << ',' << rtmp.zz() << ") "; } template <> -std::ostream& operator<<(std::ostream& s, const TkRotation2D& rtmp) { +std::ostream& operator<< (std::ostream& s, const TkRotation2D& rtmp) { return s << rtmp.x() << "\n" << rtmp.y(); } template <> -std::ostream& operator<<(std::ostream& s, const TkRotation2D& rtmp) { +std::ostream& operator<< (std::ostream& s, const TkRotation2D& rtmp) { return s << rtmp.x() << "\n" << rtmp.y(); } diff --git a/DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h b/DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h index 168bc1330e36e..7194f4ee7aee3 100644 --- a/DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h +++ b/DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h @@ -19,7 +19,8 @@ enum L1GtConditionType { TypeHfRingEtSums, TypeBptx, TypeExternal, - Type2corWithOverlapRemoval + Type2corWithOverlapRemoval, + L1GtConditionTypeInvalid = -1 }; /// condition categories @@ -35,7 +36,8 @@ enum L1GtConditionCategory { CondHfRingEtSums, CondBptx, CondExternal, - CondCorrelationWithOverlapRemoval + CondCorrelationWithOverlapRemoval, + L1GtConditionCategoryInvalid = -1 }; #endif diff --git a/DataFormats/L1TMuonPhase2/interface/Constants.h b/DataFormats/L1TMuonPhase2/interface/Constants.h index d3f80a3421948..ea8c2f4c0c5cb 100644 --- a/DataFormats/L1TMuonPhase2/interface/Constants.h +++ b/DataFormats/L1TMuonPhase2/interface/Constants.h @@ -54,7 +54,7 @@ namespace Phase2L1GMT { // Bitwidth for standalone muons to CL1 and GT const int BITSSAZ0 = 5; const int BITSSAD0 = 7; - const int BITSSAQUALITY = 4; + const int BITSSAQUAL = 4; // Bitwidth for dataformat to GT const int BITSGTPT = 16; @@ -62,14 +62,24 @@ namespace Phase2L1GMT { const int BITSGTETA = 14; const int BITSGTZ0 = 10; const int BITSGTD0 = 10; - const int BITSGTQUALITY = 8; + const int BITSGTQUAL = 8; const int BITSGTISO = 4; + const int BITSGTBETA = 4; + + // Bitwidth for Tau->3mu object + const int BITSTMPT = 8; + const int BITSTMPHI = 8; + const int BITSTMETA = 8; + const int BITSTMMASS2 = 8; + const int BITSTMTYPE = 6; + const int BITSTMIDX = 4; + const int BITSTMQUAL = 4; const float maxCurv_ = 0.00855; // 2 GeV pT Rinv is in cm const float maxPhi_ = 1.026; // relative to the center of the sector const float maxTanl_ = 8.0; - const float maxZ0_ = 30.; - const float maxD0_ = 15.4; + const float maxZ0_ = 25.6; + const float maxD0_ = 15.36; // Updated barrelLimit according to Karol, https://indico.cern.ch/event/1113802/#1-phase2-gmt-performance-and-i const int barrelLimit0_ = 1.4 / 0.00076699039 / 8; const int barrelLimit1_ = 1.1 / 0.00076699039 / 8; @@ -81,12 +91,32 @@ namespace Phase2L1GMT { const float LSBpt = 0.03125; const float LSBphi = 2. * M_PI / pow(2, BITSPHI); const float LSBeta = 2. * M_PI / pow(2, BITSETA); - const float LSBGTz0 = 2. * maxZ0_ / pow(2, BITSZ0); - const float LSBGTd0 = 2. * maxD0_ / pow(2, BITSD0); - const float LSBSAz0 = 1.875; - const float LSBSAd0 = 3.85; + const float LSBGTz0 = 0.05; // 0.5mm, in sync with GTT and Correlator + const float LSBGTd0 = 0.03; // from GT interface doc + const float LSBSAz0 = 1.6; // 0.05 * 32 cm, with range +- 25.6 + const float LSBSAd0 = 3.84; // 0.03 * 128 cm, with range +- 245.76 typedef ap_uint<64> wordtype; + typedef ap_uint<1> valid_gt_t; //valid + typedef ap_uint<1> q_gt_t; //charge + typedef ap_uint pt_gt_t; //pt of tracker muon + typedef ap_int phi_gt_t; //phi of tracker muon + typedef ap_int eta_gt_t; //eta of tracker muon + typedef ap_int z0_gt_t; //z0 of tracker muon + typedef ap_int d0_gt_t; //d0 of tracker muon + typedef ap_uint iso_gt_t; //isolation of tracker muon + typedef ap_uint beta_gt_t; //beta of tracker muon + typedef ap_uint qual_gt_t; //quality of tracker muon + + //Standalone muon datatype + typedef ap_uint<1> valid_sa_t; //valid + typedef ap_uint pt_sa_t; //pt of standalone muon + typedef ap_int phi_sa_t; //phi of standalone muon + typedef ap_int eta_sa_t; //eta of standalone muon + typedef ap_int z0_sa_t; //z0 of standalone muon + typedef ap_int d0_sa_t; //d0 of standalone muon + typedef ap_uint<1> q_sa_t; //charge of standalone muon + typedef ap_uint qual_sa_t; //quality of standalone muon inline uint64_t twos_complement(long long int v, uint bits) { uint64_t mask = (1 << bits) - 1; diff --git a/DataFormats/L1TMuonPhase2/interface/SAMuon.h b/DataFormats/L1TMuonPhase2/interface/SAMuon.h index d46d6cab3610c..12ea802dae04f 100644 --- a/DataFormats/L1TMuonPhase2/interface/SAMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/SAMuon.h @@ -31,6 +31,16 @@ namespace l1t { const uint hwBeta() const { return hwBeta_; } void setBeta(uint beta) { hwBeta_ = beta; } + // For GT, returning ap_ type + const Phase2L1GMT::valid_sa_t apValid() const { return Phase2L1GMT::valid_sa_t(hwPt() > 0); }; + const Phase2L1GMT::pt_sa_t apPt() const { return Phase2L1GMT::pt_sa_t(hwPt()); }; + const Phase2L1GMT::phi_sa_t apPhi() const { return Phase2L1GMT::phi_sa_t(hwPhi()); }; + const Phase2L1GMT::eta_sa_t apEta() const { return Phase2L1GMT::eta_sa_t(hwEta()); }; + const Phase2L1GMT::z0_sa_t apZ0() const { return Phase2L1GMT::z0_sa_t(hwZ0()); }; + const Phase2L1GMT::d0_sa_t apD0() const { return Phase2L1GMT::d0_sa_t(hwD0()); }; + const Phase2L1GMT::q_sa_t apCharge() const { return Phase2L1GMT::q_sa_t(hwCharge()); }; + const Phase2L1GMT::qual_sa_t apQual() const { return Phase2L1GMT::qual_sa_t(hwQual()); }; + // For HLT const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); } const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); } diff --git a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h index 78bb288685d37..1dd8cc90bf344 100644 --- a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h @@ -32,7 +32,7 @@ namespace l1t { ~TrackerMuon() override; const edm::Ptr& trkPtr() const { return trkPtr_; } - const edm::Ref& muonRef() const { return muRef_; } + const std::vector& muonRef() const { return muRef_; } const bool hwCharge() const { return hwCharge_; } const int hwZ0() const { return hwZ0_; } @@ -41,10 +41,22 @@ namespace l1t { const int hwIsoSumAp() const { return hwIsoSumAp_; } const uint hwBeta() const { return hwBeta_; } void setBeta(uint beta) { hwBeta_ = beta; } - void setMuonRef(const edm::Ref& p) { muRef_ = p; } + void setMuonRef(const std::vector& p) { muRef_ = p; } void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } + // For GT, returning ap_ type + const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); }; + const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); }; + const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); }; + const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); }; + const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); }; + const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); }; + const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); }; + const Phase2L1GMT::qual_gt_t apQual() const { return Phase2L1GMT::qual_gt_t(hwQual()); }; + const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIso()); }; + const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); }; + // For HLT const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); } const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); } @@ -76,7 +88,7 @@ namespace l1t { //Store the eneryg sum for isolation with ap_type int hwIsoSumAp_; - edm::Ref muRef_; + std::vector muRef_; MuonStubRefVector stubs_; }; } // namespace l1t diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml index b20feacd4c091..b3cbf00fcf430 100644 --- a/DataFormats/L1TMuonPhase2/src/classes_def.xml +++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml @@ -8,7 +8,8 @@ - + + diff --git a/DataFormats/L1TParticleFlow/interface/gt_datatypes.h b/DataFormats/L1TParticleFlow/interface/gt_datatypes.h index 12cec406492f7..178e332dbedf4 100644 --- a/DataFormats/L1TParticleFlow/interface/gt_datatypes.h +++ b/DataFormats/L1TParticleFlow/interface/gt_datatypes.h @@ -30,7 +30,7 @@ namespace l1gt { typedef ap_uint<1> valid_t; // E/gamma fields - typedef ap_fixed<11, 9> iso_t; + typedef ap_ufixed<11, 9> iso_t; typedef ap_uint<4> egquality_t; // tau fields diff --git a/DataFormats/L1Trigger/interface/BXVector.h b/DataFormats/L1Trigger/interface/BXVector.h index 6ce09f80ba5b8..7cfa8239da265 100644 --- a/DataFormats/L1Trigger/interface/BXVector.h +++ b/DataFormats/L1Trigger/interface/BXVector.h @@ -1,5 +1,5 @@ -#ifndef BXVector_h -#define BXVector_h +#ifndef DataFormats_L1Trigger_BXVector_h +#define DataFormats_L1Trigger_BXVector_h // this class is an extension of std::vector // designed to store objects corresponding to several time-samples (BX) @@ -134,4 +134,4 @@ class BXVector { #include "BXVector.icc" -#endif +#endif // DataFormats_L1Trigger_BXVector_h diff --git a/DataFormats/L1Trigger/interface/BXVector.icc b/DataFormats/L1Trigger/interface/BXVector.icc index 1c4efa0803d07..ff2c6b9236c01 100644 --- a/DataFormats/L1Trigger/interface/BXVector.icc +++ b/DataFormats/L1Trigger/interface/BXVector.icc @@ -1,6 +1,8 @@ +#include + +// FIXME: these 3 lines are required by other packages #include #include -#include using namespace std; template @@ -211,15 +213,27 @@ unsigned BXVector::indexFromBX(int bx) const { // check to see if bx is empty template bool BXVector::isEmpty(int bx) const { - if (itrs_[indexFromBX(bx)] == data_.size()) { + if (bx < bxFirst_) { return true; } - if (indexFromBX(bx + 1) >= itrs_.size()) { + auto const index_bx = indexFromBX(bx); + + if (index_bx >= itrs_.size()) { + return true; + } + + if (itrs_[index_bx] == data_.size()) { + return true; + } + + auto const index_bxPlus1 = indexFromBX(bx + 1); + + if (index_bxPlus1 >= itrs_.size()) { return false; } - if (itrs_[indexFromBX(bx)] == itrs_[indexFromBX(bx + 1)]) { + if (itrs_[index_bx] == itrs_[index_bxPlus1]) { return true; } diff --git a/DataFormats/OnlineMetaData/interface/CTPPSRecord.h b/DataFormats/OnlineMetaData/interface/CTPPSRecord.h index d38c998a57968..a6b731ffa380d 100644 --- a/DataFormats/OnlineMetaData/interface/CTPPSRecord.h +++ b/DataFormats/OnlineMetaData/interface/CTPPSRecord.h @@ -28,6 +28,7 @@ class CTPPSRecord { RP_45_220_FR_HR, RP_45_220_FR_TP, RP_45_220_NR_BT, + RP_45_220_NR_HR, RP_45_220_NR_TP, RP_56_210_FR_BT, RP_56_210_FR_HR, @@ -37,6 +38,7 @@ class CTPPSRecord { RP_56_220_FR_HR, RP_56_220_FR_TP, RP_56_220_NR_BT, + RP_56_220_NR_HR, RP_56_220_NR_TP, Last }; diff --git a/DataFormats/OnlineMetaData/src/CTPPSRecord.cc b/DataFormats/OnlineMetaData/src/CTPPSRecord.cc index 6b879398154d8..cae6605ba0a21 100644 --- a/DataFormats/OnlineMetaData/src/CTPPSRecord.cc +++ b/DataFormats/OnlineMetaData/src/CTPPSRecord.cc @@ -4,24 +4,11 @@ #include "DataFormats/OnlineMetaData/interface/CTPPSRecord.h" #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" -const CTPPSRecord::RomanPotNames CTPPSRecord::romanPotNames_ = {{"RP_45_210_FR_BT", - "RP_45_210_FR_HR", - "RP_45_210_FR_TP", - "RP_45_220_C1", - "RP_45_220_FR_BT", - "RP_45_220_FR_HR", - "RP_45_220_FR_TP", - "RP_45_220_NR_BT", - "RP_45_220_NR_TP", - "RP_56_210_FR_BT", - "RP_56_210_FR_HR", - "RP_56_210_FR_TP", - "RP_56_220_C1", - "RP_56_220_FR_BT", - "RP_56_220_FR_HR", - "RP_56_220_FR_TP", - "RP_56_220_NR_BT", - "RP_56_220_NR_TP"}}; +const CTPPSRecord::RomanPotNames CTPPSRecord::romanPotNames_ = { + {"RP_45_210_FR_BT", "RP_45_210_FR_HR", "RP_45_210_FR_TP", "RP_45_220_C1", "RP_45_220_FR_BT", + "RP_45_220_FR_HR", "RP_45_220_FR_TP", "RP_45_220_NR_BT", "RP_45_220_NR_HR", "RP_45_220_NR_TP", + "RP_56_210_FR_BT", "RP_56_210_FR_HR", "RP_56_210_FR_TP", "RP_56_220_C1", "RP_56_220_FR_BT", + "RP_56_220_FR_HR", "RP_56_220_FR_TP", "RP_56_220_NR_BT", "RP_56_220_NR_HR", "RP_56_220_NR_TP"}}; const std::array CTPPSRecord::statusNames_ = {{"unused", "bad", "warning", "ok"}}; diff --git a/DataFormats/OnlineMetaData/test/dump_run000001_event6135_fed1022.txt b/DataFormats/OnlineMetaData/test/dump_run000001_event6135_fed1022.txt new file mode 100644 index 0000000000000..cafc23523f56f --- /dev/null +++ b/DataFormats/OnlineMetaData/test/dump_run000001_event6135_fed1022.txt @@ -0,0 +1,13 @@ +==================== DUMP ====================== +Reason for dump: Requested by user +00000000 : 0003fe00 500017f7 00000003 00000000 | human readable swapped : 500017f7 0003fe00 00000000 00000003 : 00000000 +00000010 : 99d65448 00000187 0010006d 00000000 | human readable swapped : 00000187 99d65448 00000000 0010006d : 00000010 +00000020 : 00000000 00000000 99d62140 00000187 | human readable swapped : 00000000 00000000 00000187 99d62140 : 00000020 +00000030 : 00000000 00000000 00000000 00000000 | human readable swapped : 00000000 00000000 00000000 00000000 : 00000030 +00000040 : 00000000 00000000 00000000 00000000 | human readable swapped : 00000000 00000000 00000000 00000000 : 00000040 +00000050 : 00000000 00000000 00000000 00000000 | human readable swapped : 00000000 00000000 00000000 00000000 : 00000050 +00000060 : 00000000 00000000 00000000 00000000 | human readable swapped : 00000000 00000000 00000000 00000000 : 00000060 +00000070 : 99d62e9a 00000187 44410444 00000010 | human readable swapped : 00000187 99d62e9a 00000010 44410444 : 00000070 +00000080 : 99b0cc96 00000187 01fe7fff 07fe7fff | human readable swapped : 00000187 99b0cc96 07fe7fff 01fe7fff : 00000080 +00000090 : 468de7e5 00000000 d41e0000 a0000014 | human readable swapped : 00000000 468de7e5 a0000014 d41e0000 : 00000090 +================ END OF DUMP =================== \ No newline at end of file diff --git a/DataFormats/OnlineMetaData/test/onlineMetaDataRecord_t.cpp b/DataFormats/OnlineMetaData/test/onlineMetaDataRecord_t.cpp index 9a4993e591574..ccbb5241598de 100644 --- a/DataFormats/OnlineMetaData/test/onlineMetaDataRecord_t.cpp +++ b/DataFormats/OnlineMetaData/test/onlineMetaDataRecord_t.cpp @@ -161,16 +161,16 @@ void TestOnlineMetaDataRecord::testOnlineLuminosityRecord_v2() { } void TestOnlineMetaDataRecord::testCTPPSRecord_v2() { - const unsigned char* payload = readPayload("dump_run000001_event00013761_fed1022.txt"); + const unsigned char* payload = readPayload("dump_run000001_event6135_fed1022.txt"); const online::Data_v2* data_v2 = reinterpret_cast(payload + FEDHeader::length); CTPPSRecord ctpps(data_v2->ctpps); std::cout << ctpps << std::endl; // DIP timestamp is in milliseconds const uint64_t ts = ctpps.timestamp().unixTime() * 1000UL + ctpps.timestamp().microsecondOffset() / 1000; - CPPUNIT_ASSERT_EQUAL(static_cast(0x1616b5a0e5f), ts); - CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::bad, ctpps.status(CTPPSRecord::RomanPot::RP_45_210_FR_BT)); - CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::ok, ctpps.status(CTPPSRecord::RomanPot::RP_45_220_FR_TP)); - CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::warning, ctpps.status(CTPPSRecord::RomanPot::RP_45_220_NR_TP)); - CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::unused, ctpps.status(CTPPSRecord::RomanPot::RP_56_220_NR_TP)); + CPPUNIT_ASSERT_EQUAL(static_cast(0x18799D62E9A), ts); + CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::unused, ctpps.status(CTPPSRecord::RomanPot::RP_45_210_FR_BT)); + CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::unused, ctpps.status(CTPPSRecord::RomanPot::RP_45_220_FR_TP)); + CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::unused, ctpps.status(CTPPSRecord::RomanPot::RP_45_220_NR_TP)); + CPPUNIT_ASSERT_EQUAL(CTPPSRecord::Status::bad, ctpps.status(CTPPSRecord::RomanPot::RP_56_220_NR_HR)); } diff --git a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc index bb42131bab81b..467ac284eea93 100644 --- a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc +++ b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc @@ -296,8 +296,10 @@ void PFCandidate::rescaleMomentum(double rescaleFactor) { throw cms::Exception( "NegativeScaling", "Scale factor " + std::to_string(rescaleFactor) + " is < 0. Cannot rescale momentum by this value"); - float rescaleE = std::sqrt(p() * p() * (rescaleFactor * rescaleFactor - 1) / (energy() * energy()) + 1); - LorentzVector rescaledp4(rescaleFactor * px(), rescaleFactor * py(), rescaleFactor * pz(), rescaleE * energy()); + + float e = std::sqrt(p() * p() * rescaleFactor * rescaleFactor + mass() * mass()); + + LorentzVector rescaledp4(rescaleFactor * px(), rescaleFactor * py(), rescaleFactor * pz(), e); setP4(rescaledp4); } diff --git a/DataFormats/PatCandidates/interface/Muon.h b/DataFormats/PatCandidates/interface/Muon.h index 5406d7bc92df0..5f34670e14e69 100644 --- a/DataFormats/PatCandidates/interface/Muon.h +++ b/DataFormats/PatCandidates/interface/Muon.h @@ -282,14 +282,6 @@ namespace pat { void setJetPtRatio(float jetPtRatio) { jetPtRatio_ = jetPtRatio; } void setJetPtRel(float jetPtRel) { jetPtRel_ = jetPtRel; } - /// Muon MVA - float mvaValue() const { return mvaValue_; } - void setMvaValue(float mva) { mvaValue_ = mva; } - - // Low pt Muon MVA - float lowptMvaValue() const { return lowptMvaValue_; } - void setLowPtMvaValue(float lowptmva) { lowptMvaValue_ = lowptmva; } - /// Soft Muon MVA float softMvaValue() const { return softMvaValue_; } void setSoftMvaValue(float softmva) { softMvaValue_ = softmva; } @@ -420,8 +412,6 @@ namespace pat { float jetPtRel_; /// Muon MVA - float mvaValue_; - float lowptMvaValue_; float mvaIDValue_; float softMvaValue_; diff --git a/DataFormats/PatCandidates/interface/PackedCandidate.h b/DataFormats/PatCandidates/interface/PackedCandidate.h index d214746f93d1f..da0f6745d85b1 100644 --- a/DataFormats/PatCandidates/interface/PackedCandidate.h +++ b/DataFormats/PatCandidates/interface/PackedCandidate.h @@ -221,7 +221,8 @@ namespace pat { normalizedChi2_(iOther.normalizedChi2_), covarianceVersion_(iOther.covarianceVersion_), covarianceSchema_(iOther.covarianceSchema_), - firstHit_(iOther.firstHit_) {} + firstHit_(iOther.firstHit_), + trkAlgoPacked_(iOther.trkAlgoPacked_) {} PackedCandidate(PackedCandidate &&iOther) : packedPt_(iOther.packedPt_), @@ -262,7 +263,8 @@ namespace pat { normalizedChi2_(iOther.normalizedChi2_), covarianceVersion_(iOther.covarianceVersion_), covarianceSchema_(iOther.covarianceSchema_), - firstHit_(iOther.firstHit_) {} + firstHit_(iOther.firstHit_), + trkAlgoPacked_(iOther.trkAlgoPacked_) {} PackedCandidate &operator=(const PackedCandidate &iOther) { if (this == &iOther) { @@ -339,6 +341,7 @@ namespace pat { covarianceVersion_ = iOther.covarianceVersion_; covarianceSchema_ = iOther.covarianceSchema_; firstHit_ = iOther.firstHit_; + trkAlgoPacked_ = iOther.trkAlgoPacked_; return *this; } @@ -385,6 +388,7 @@ namespace pat { covarianceVersion_ = iOther.covarianceVersion_; covarianceSchema_ = iOther.covarianceSchema_; firstHit_ = iOther.firstHit_; + trkAlgoPacked_ = iOther.trkAlgoPacked_; return *this; } @@ -837,6 +841,15 @@ namespace pat { /// Return first hit from HitPattern for tracks with high level details uint16_t firstHit() const { return firstHit_; } + /// Set/get track algo + void setTrkAlgo(uint8_t algo, uint8_t original) { + trkAlgoPacked_ = algo | ((algo == original ? 0 : original) << 8); + } + uint8_t trkAlgo() const { return trkAlgoPacked_ & 0xff; } + uint8_t trkOriginalAlgo() const { + return (trkAlgoPacked_ & 0xff00) == 0 ? trkAlgo() : ((trkAlgoPacked_ >> 8) & 0xff); + } + void setMuonID(bool isStandAlone, bool isGlobal) { int16_t muonFlags = isStandAlone | (2 * isGlobal); qualityFlags_ = (qualityFlags_ & ~muonFlagsMask) | ((muonFlags << muonFlagsShift) & muonFlagsMask); @@ -1111,6 +1124,9 @@ namespace pat { /// details (hit pattern) of the first hit on track uint16_t firstHit_; + /// track algorithm details + uint16_t trkAlgoPacked_ = 0; + /// check overlap with another Candidate bool overlap(const reco::Candidate &) const override; template diff --git a/DataFormats/PatCandidates/src/Muon.cc b/DataFormats/PatCandidates/src/Muon.cc index 5a0b5fd4ca960..cfdaa2253d900 100644 --- a/DataFormats/PatCandidates/src/Muon.cc +++ b/DataFormats/PatCandidates/src/Muon.cc @@ -31,8 +31,6 @@ Muon::Muon() pfEcalEnergy_(0), jetPtRatio_(0), jetPtRel_(0), - mvaValue_(0), - lowptMvaValue_(0), mvaIDValue_(0), softMvaValue_(0), inverseBeta_(0), @@ -63,8 +61,6 @@ Muon::Muon(const reco::Muon& aMuon) pfEcalEnergy_(0), jetPtRatio_(0), jetPtRel_(0), - mvaValue_(0), - lowptMvaValue_(0), mvaIDValue_(0), softMvaValue_(0), inverseBeta_(0), @@ -95,8 +91,6 @@ Muon::Muon(const edm::RefToBase& aMuonRef) pfEcalEnergy_(0), jetPtRatio_(0), jetPtRel_(0), - mvaValue_(0), - lowptMvaValue_(0), mvaIDValue_(0), softMvaValue_(0), inverseBeta_(0), @@ -127,8 +121,6 @@ Muon::Muon(const edm::Ptr& aMuonRef) pfEcalEnergy_(0), jetPtRatio_(0), jetPtRel_(0), - mvaValue_(0), - lowptMvaValue_(0), mvaIDValue_(0), softMvaValue_(0), inverseBeta_(0), diff --git a/DataFormats/PatCandidates/src/classes_def_objects.xml b/DataFormats/PatCandidates/src/classes_def_objects.xml index 88fb44593ba8d..e564c35f61d2f 100644 --- a/DataFormats/PatCandidates/src/classes_def_objects.xml +++ b/DataFormats/PatCandidates/src/classes_def_objects.xml @@ -67,7 +67,8 @@ - + + @@ -333,7 +334,8 @@ - + + diff --git a/DataFormats/Portable/interface/Product.h b/DataFormats/Portable/interface/Product.h deleted file mode 100644 index 6b66d09060ab7..0000000000000 --- a/DataFormats/Portable/interface/Product.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef DataFormats_Portable_interface_Product_h -#define DataFormats_Portable_interface_Product_h - -#include -#include - -#include - -#include "DataFormats/Portable/interface/ProductBase.h" -#include "HeterogeneousCore/AlpakaInterface/interface/ScopedContextFwd.h" -#include "HeterogeneousCore/AlpakaInterface/interface/config.h" - -namespace edm { - template - class Wrapper; -} - -namespace cms::alpakatools { - - /** - * The purpose of this class is to wrap alpaka-based data products for - * the edm::Event in a way which forces correct use of various utilities. - * - * The default constructor is needed only for the ROOT dictionary generation. - * - * The non-default construction has to be done with ScopedContext - * (in order to properly register the alpaka event). - * - * The alpaka event is in practice needed only for inter-queue - * synchronization, but someone with long-enough lifetime has to own - * it. Here is a somewhat natural place. If the overhead is too much, we - * can use them only where synchronization between queues is needed. - */ - template >> - class Product : public ProductBase { - public: - using Queue = TQueue; - using Event = alpaka::Event; - - Product() = default; // Needed only for ROOT dictionary generation - - Product(const Product&) = delete; - Product& operator=(const Product&) = delete; - Product(Product&&) = default; - Product& operator=(Product&&) = default; - - private: - friend class impl::ScopedContextGetterBase; - friend class ScopedContextProduce; - friend class edm::Wrapper>; - - explicit Product(std::shared_ptr queue, std::shared_ptr event, T data) - : ProductBase(std::move(queue), std::move(event)), data_(std::move(data)) {} - - template - explicit Product(std::shared_ptr queue, std::shared_ptr event, Args&&... args) - : ProductBase(std::move(queue), std::move(event)), data_(std::forward(args)...) {} - - T data_; //! - }; - -} // namespace cms::alpakatools - -#endif // DataFormats_Portable_interface_Product_h diff --git a/DataFormats/Portable/interface/ProductBase.h b/DataFormats/Portable/interface/ProductBase.h deleted file mode 100644 index bb258af6570c0..0000000000000 --- a/DataFormats/Portable/interface/ProductBase.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef DataFormats_Portable_interface_ProductBase_h -#define DataFormats_Portable_interface_ProductBase_h - -#include -#include -#include - -#include - -#include "HeterogeneousCore/AlpakaInterface/interface/ScopedContextFwd.h" - -namespace cms::alpakatools { - - /** - * Base class for all instantiations of Product to hold the - * non-T-dependent members. - */ - template >> - class ProductBase { - public: - using Queue = TQueue; - using Event = alpaka::Event; - using Device = alpaka::Dev; - - ProductBase() = default; // Needed only for ROOT dictionary generation - - ~ProductBase() { - // Make sure that the production of the product in the GPU is - // complete before destructing the product. This is to make sure - // that the EDM stream does not move to the next event before all - // asynchronous processing of the current is complete. - - // TODO: a callback notifying a WaitingTaskHolder (or similar) - // would avoid blocking the CPU, but would also require more work. - - // FIXME: this may throw an execption if the underlaying call fails. - if (event_) { - alpaka::wait(*event_); - } - } - - ProductBase(const ProductBase&) = delete; - ProductBase& operator=(const ProductBase&) = delete; - ProductBase(ProductBase&& other) - : queue_{std::move(other.queue_)}, event_{std::move(other.event_)}, mayReuseQueue_{other.mayReuseQueue_.load()} {} - ProductBase& operator=(ProductBase&& other) { - queue_ = std::move(other.queue_); - event_ = std::move(other.event_); - mayReuseQueue_ = other.mayReuseQueue_.load(); - return *this; - } - - bool isValid() const { return queue_.get() != nullptr; } - - bool isAvailable() const { - // if default-constructed, the product is not available - if (not event_) { - return false; - } - return alpaka::isComplete(*event_); - } - - // returning a const& requires changes in alpaka's getDev() implementations - Device device() const { return alpaka::getDev(queue()); } - - Queue const& queue() const { return *queue_; } - - Event const& event() const { return *event_; } - - protected: - explicit ProductBase(std::shared_ptr queue, std::shared_ptr event) - : queue_{std::move(queue)}, event_{std::move(event)} {} - - private: - friend class impl::ScopedContextBase; - friend class ScopedContextProduce; - - // The following function is intended to be used only from ScopedContext - const std::shared_ptr& queuePtr() const { return queue_; } - - bool mayReuseQueue() const { - bool expected = true; - bool changed = mayReuseQueue_.compare_exchange_strong(expected, false); - // If the current thread is the one flipping the flag, it may - // reuse the queue. - return changed; - } - - // shared_ptr because of caching in QueueCache, and sharing across edm::Event products - std::shared_ptr queue_; //! - // shared_ptr because of caching in EventCache - std::shared_ptr event_; //! - - // This flag tells whether the queue may be reused by a consumer or not. - // The goal is to have a "chain" of modules to enqueue their work to the same queue. - mutable std::atomic mayReuseQueue_ = true; //! - }; - -} // namespace cms::alpakatools - -#endif // DataFormats_Portable_interface_ProductBase_h diff --git a/DataFormats/PortableTestObjects/src/alpaka/classes_cuda.h b/DataFormats/PortableTestObjects/src/alpaka/classes_cuda.h index 32d58300c3f78..923e5de9b3ecf 100644 --- a/DataFormats/PortableTestObjects/src/alpaka/classes_cuda.h +++ b/DataFormats/PortableTestObjects/src/alpaka/classes_cuda.h @@ -1,5 +1,4 @@ #include "DataFormats/Common/interface/DeviceProduct.h" #include "DataFormats/Common/interface/Wrapper.h" -#include "DataFormats/Portable/interface/Product.h" #include "DataFormats/PortableTestObjects/interface/TestSoA.h" #include "DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h" diff --git a/DataFormats/PortableTestObjects/src/alpaka/classes_rocm.h b/DataFormats/PortableTestObjects/src/alpaka/classes_rocm.h index 32d58300c3f78..923e5de9b3ecf 100644 --- a/DataFormats/PortableTestObjects/src/alpaka/classes_rocm.h +++ b/DataFormats/PortableTestObjects/src/alpaka/classes_rocm.h @@ -1,5 +1,4 @@ #include "DataFormats/Common/interface/DeviceProduct.h" #include "DataFormats/Common/interface/Wrapper.h" -#include "DataFormats/Portable/interface/Product.h" #include "DataFormats/PortableTestObjects/interface/TestSoA.h" #include "DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h" diff --git a/DataFormats/PortableTestObjects/src/classes.h b/DataFormats/PortableTestObjects/src/classes.h index b6912da969023..9405bbfd336e2 100644 --- a/DataFormats/PortableTestObjects/src/classes.h +++ b/DataFormats/PortableTestObjects/src/classes.h @@ -1,4 +1,3 @@ #include "DataFormats/Common/interface/Wrapper.h" -#include "DataFormats/Portable/interface/Product.h" #include "DataFormats/PortableTestObjects/interface/TestHostCollection.h" #include "DataFormats/PortableTestObjects/interface/TestSoA.h" diff --git a/DataFormats/Scouting/test/BuildFile.xml b/DataFormats/Scouting/test/BuildFile.xml new file mode 100644 index 0000000000000..1f6570eac7355 --- /dev/null +++ b/DataFormats/Scouting/test/BuildFile.xml @@ -0,0 +1,2 @@ + + diff --git a/DataFormats/Scouting/test/scoutingCollectionsDumper.py b/DataFormats/Scouting/test/scoutingCollectionsDumper.py new file mode 100755 index 0000000000000..86c788059f532 --- /dev/null +++ b/DataFormats/Scouting/test/scoutingCollectionsDumper.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 +import os +import argparse +import glob +import fnmatch +import ROOT + +from DataFormats.FWLite import Runs, Events, Handle + +def getScoutingProductsList(key): + '''Returns list of tuples (type, label) for EDM Scouting collections + - 'key' must be "Scouting" (data formats before Run 3), or "Run3Scouting" + ''' + if key == 'Scouting': + return [ + ('vector', 'hltScoutingCaloPacker'), + ('vector', 'hltScoutingEgammaPacker'), + ('vector', 'hltScoutingMuonPackerCalo'), + ('vector', 'hltScoutingPFPacker'), + ('vector', 'hltScoutingPFPacker'), + ('vector', 'hltScoutingEgammaPacker'), + ('vector', 'hltScoutingTrackPacker'), + ('vector', 'hltScoutingPrimaryVertexPacker:primaryVtx'), + ] + elif key == 'Run3Scouting': + return [ + ('vector', 'hltScoutingEgammaPacker'), + ('vector', 'hltScoutingMuonPacker'), + ('vector', 'hltScoutingPFPacker'), + ('vector', 'hltScoutingPFPacker'), + ('vector', 'hltScoutingEgammaPacker'), + ('vector', 'hltScoutingTrackPacker'), + ('vector', 'hltScoutingMuonPacker:displacedVtx'), + ('vector', 'hltScoutingPrimaryVertexPacker:primaryVtx') + ] + else: + raise RuntimeError(f'getScoutingProductsList -- invalid key (must be "Scouting", or "Run3Scouting"): "{key}"') + +def printScoutingVar(name, value): + '''Print content of data member of Scouting object + ''' + if isinstance(value, ROOT.Run3ScoutingHitPatternPOD): + for subvar in [ + 'hitCount', + 'beginTrackHits', + 'endTrackHits', + 'beginInner', + 'endInner', + 'beginOuter', + 'endOuter', + 'hitPattern', + ]: + subvalue = getattr(value, subvar) + print(f' {name}.{subvar} = {subvalue}') + else: + print(f' {name} = {value}') + +def printScoutingProduct(product_label, product_type, product, verbosity): + '''Print content of EDM product + ''' + if verbosity == 0: + return + + productIsVector = product_type.startswith('vector') + + productInfoStr = f'Product Label: "{product_label}" (type: "{product_type}")' + if productIsVector: + productInfoStr += f', size = {product.size()}' + + print(f'\n {productInfoStr}') + + if not productIsVector: + printScoutingVar('value', product[0]) + return + + obj_idx = 0 + for obj in product: + # print only first N objects, where N corresponds to verbosity (if positive) + if verbosity > 0 and obj_idx >= verbosity: + break + + # names of data members to print + if obj_idx == 0: + varNames = sorted([foo for foo in dir(obj) if not fnmatch.fnmatch(foo, '__*__')]) + + print(f'\n Object #{obj_idx}') + obj_idx += 1 + for varName in varNames: + varValue = getattr(obj, varName)() + printScoutingVar(varName, varValue) + +def analyseEvent(event, productList, verbosity = -1): + '''Function to analyse a single EDM Event + ''' + if verbosity != 0: + print('-'*50) + print(f'Run = {event.eventAuxiliary().run()}') + print(f'LuminosityBlock = {event.eventAuxiliary().luminosityBlock()}') + print(f'Event = {event.eventAuxiliary().event()}') + + for productType, productLabel in productList: + productHandle = Handle(productType) + event.getByLabel(productLabel, productHandle) + if productHandle.isValid(): + printScoutingProduct(productLabel, productType, productHandle.product(), verbosity) + + if verbosity != 0: + print('-'*50) + +def getInputFiles(inputList): + '''List of input files (after resolving wildcards, removing duplicates, and sorting) + ''' + ret = set() + for input_i in inputList: + inputFiles_i = glob.glob(input_i) + if len(inputFiles_i) == 0: + inputFiles_i = [input_i] + for input_j in inputFiles_i: + ret.add(os.path.abspath(os.path.realpath(input_j)) if os.path.isfile(input_j) else input_j) + return sorted(list(ret)) + +### +### main +### +if __name__ == '__main__': + ## args + parser = argparse.ArgumentParser( + description = 'FWLite script to print to stdout content of Scouting collections in EDM files.', + formatter_class = argparse.ArgumentDefaultsHelpFormatter + ) + + parser.add_argument('-i', '--inputs', dest='inputs', required=True, nargs='+', default=None, + help='List of EDM files in ROOT format') + + parser.add_argument('-s', '--skipEvents', dest='skipEvents', action='store', type=int, default=0, + help='Index of first event to be processed (inclusive)') + + parser.add_argument('-n', '--maxEvents', dest='maxEvents', action='store', type=int, default=-1, + help='Maximum number of events to be processed (inclusive)') + + parser.add_argument('-k', '--key', dest='key', action='store', type=str, choices=['Scouting', 'Run3Scouting'], default='Scouting', + help='Keyword to select Scouting DataFormats (must be "Scouting", or "Run3Scouting")') + + parser.add_argument('-v', '--verbosity', dest='verbosity', action='store', type=int, default=-1, + help='Level of verbosity') + + opts, opts_unknown = parser.parse_known_args() + + log_prx = os.path.basename(__file__)+' --' + + ## args validation + if len(opts_unknown) > 0: + raise RuntimeError(f'{log_prx} unrecognized command-line arguments: {opts_unknown}') + + inputFiles = getInputFiles(opts.inputs) + + if len(inputFiles) == 0: + raise RuntimeError(f'{log_prx} empty list of input files [-i]') + + ## Event Loop + nEvtRead, nEvtProcessed = 0, 0 + skipEvents = max(0, opts.skipEvents) + + scoutingProductsList = getScoutingProductsList(opts.key) + + for input_file in inputFiles: + try: + events = Events(input_file) + for event in events: + nEvtRead += 1 + if (nEvtRead <= skipEvents) or ((opts.maxEvents >= 0) and (nEvtProcessed >= opts.maxEvents)): + continue + + analyseEvent(event = event, productList = scoutingProductsList, verbosity = opts.verbosity) + nEvtProcessed += 1 + + except: + print(f'{log_prx} failed to analyse TFile (file will be ignored): {input_file}') + continue + + if opts.verbosity != 0: + print(f'Events processed = {nEvtProcessed}') diff --git a/DataFormats/Scouting/test/scoutingCollectionsIO_cfg.py b/DataFormats/Scouting/test/scoutingCollectionsIO_cfg.py new file mode 100644 index 0000000000000..bd6bf625d71db --- /dev/null +++ b/DataFormats/Scouting/test/scoutingCollectionsIO_cfg.py @@ -0,0 +1,68 @@ +import FWCore.ParameterSet.Config as cms + +import argparse +import sys + +parser = argparse.ArgumentParser( + prog = 'cmsRun '+sys.argv[0]+' --', + description = 'Configuration file to test I/O of Scouting collections.', + formatter_class = argparse.ArgumentDefaultsHelpFormatter +) + +parser.add_argument('-t', '--nThreads', type = int, help = 'Number of threads', + default = 1) + +parser.add_argument('-s', '--nStreams', type = int, help = 'Number of EDM streams', + default = 0) + +parser.add_argument('-i', '--inputFiles', nargs = '+', help = 'List of EDM input files', + default = ['/store/mc/Run3Summer22DR/GluGlutoHHto2B2Tau_kl-5p00_kt-1p00_c2-0p00_TuneCP5_13p6TeV_powheg-pythia8/GEN-SIM-RAW/124X_mcRun3_2022_realistic_v12-v2/2550000/bbfb86f3-4073-47e3-967b-059aa6b904ad.root']) + +parser.add_argument('-n', '--maxEvents', type = int, help = 'Max number of input events to be processed', + default = 10) + +parser.add_argument('--skipEvents', type = int, help = 'Number of input events to be skipped', + default = 0) + +parser.add_argument('-o', '--outputFile', type = str, help = 'Path to output EDM file in ROOT format', + default = 'scoutingCollectionsIO_output.root') + +parser.add_argument('--wantSummary', action = 'store_true', help = 'Value of process.options.wantSummary', + default = False) + +argv = sys.argv[:] +if '--' in argv: + argv.remove('--') + +args, unknown = parser.parse_known_args(argv) + +# Process +process = cms.Process('TEST') + +process.options.numberOfThreads = args.nThreads +process.options.numberOfStreams = args.nStreams +process.options.wantSummary = args.wantSummary + +process.maxEvents.input = args.maxEvents + +# Source (EDM input) +process.source = cms.Source('PoolSource', + fileNames = cms.untracked.vstring(args.inputFiles), + skipEvents = cms.untracked.uint32(args.skipEvents) +) + +# MessageLogger (Service) +process.load('FWCore.MessageLogger.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = 1 + +# Output module +process.testOutput = cms.OutputModule('PoolOutputModule', + fileName = cms.untracked.string( args.outputFile ), + outputCommands = cms.untracked.vstring( + 'drop *', + 'keep *Scouting*_*_*_*', + ) +) + +# EndPath +process.testEndPath = cms.EndPath( process.testOutput ) diff --git a/DataFormats/Scouting/test/testDataFormatsScoutingRun2.sh b/DataFormats/Scouting/test/testDataFormatsScoutingRun2.sh new file mode 100755 index 0000000000000..f7f01c5d97cf2 --- /dev/null +++ b/DataFormats/Scouting/test/testDataFormatsScoutingRun2.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Pass in name and status +function die { + printf "\n%s: status %s\n" "$1" "$2" + if [ $# -gt 2 ]; then + printf "%s\n" "=== Log File ==========" + cat $3 + printf "%s\n" "=== End of Log File ===" + fi + exit $2 +} + +# read Scouting collections from existing EDM file, and write them to disk +cmsRun "${SCRAM_TEST_PATH}"/scoutingCollectionsIO_cfg.py -- \ + -i /store/mc/RunIISummer20UL18RECO/DoubleElectron_Pt-1To300-gun/AODSIM/FlatPU0to70EdalIdealGT_EdalIdealGT_106X_upgrade2018_realistic_v11_L1v1_EcalIdealIC-v2/270000/4CDD9457-E14C-D84A-9BD4-3140CB6AEEB6.root \ + -n 150 --skip 900 -o testDataFormatsScoutingRun2_step1.root \ + > testDataFormatsScoutingRun2_step1.log 2> testDataFormatsScoutingRun2_step1_stderr.log \ + || die "Failure running scoutingCollectionsIO_cfg.py" $? testDataFormatsScoutingRun2_step1_stderr.log + +cat testDataFormatsScoutingRun2_step1.log + +# validate content of Scouting collections +"${SCRAM_TEST_PATH}"/scoutingCollectionsDumper.py -v 1 -n 1 --skip 81 -i testDataFormatsScoutingRun2_step1.root -k Scouting \ + > testDataFormatsScoutingRun2_step2.log 2> testDataFormatsScoutingRun2_step2_stderr.log \ + || die "Failure running scoutingCollectionsDumper.py" $? testDataFormatsScoutingRun2_step2_stderr.log + +diff -q "${SCRAM_TEST_PATH}"/testDataFormatsScoutingRun2_expected.log testDataFormatsScoutingRun2_step2.log \ + || die "Unexpected differences in outputs of testDataFormatsScoutingRun2 (step 2)" $? diff --git a/DataFormats/Scouting/test/testDataFormatsScoutingRun2_expected.log b/DataFormats/Scouting/test/testDataFormatsScoutingRun2_expected.log new file mode 100644 index 0000000000000..44c853e1557cc --- /dev/null +++ b/DataFormats/Scouting/test/testDataFormatsScoutingRun2_expected.log @@ -0,0 +1,170 @@ +-------------------------------------------------- +Run = 1 +LuminosityBlock = 291048 +Event = 29104772 + + Product Label: "hltScoutingCaloPacker" (type: "vector"), size = 14 + + Object #0 + btagDiscriminator = -20.0 + emEnergyInEB = 239.46920776367188 + emEnergyInEE = 0.0 + emEnergyInHF = 0.0 + eta = 0.19732625782489777 + hadEnergyInHB = 4.694222450256348 + hadEnergyInHE = 0.0 + hadEnergyInHF = 0.0 + jetArea = 0.5026548504829407 + m = 13.72571849822998 + maxEInEmTowers = 221.2417755126953 + maxEInHadTowers = 1.1859394311904907 + mvaDiscriminator = 0.8697163462638855 + phi = -2.93450927734375 + pt = 239.10707092285156 + towersArea = 0.12147484719753265 + + Product Label: "hltScoutingEgammaPacker" (type: "vector"), size = 6 + + Object #0 + charge = 1 + d0 = -0.03971549868583679 + dEtaIn = 8.61436128616333e-05 + dPhiIn = 0.0005463957786560059 + dz = -2.0579769611358643 + ecalIso = 5.6464996337890625 + eta = -0.22388292849063873 + hOverE = 0.0 + hcalIso = 0.0 + m = -4.42200598627096e-06 + missingHits = 0 + ooEMOop = 0.0010115106124430895 + phi = 0.19714701175689697 + pt = 225.0137176513672 + sigmaIetaIeta = 0.009137610904872417 + trackIso = 0.0 + + Product Label: "hltScoutingMuonPackerCalo" (type: "vector"), size = 1 + + Object #0 + charge = 1 + chi2 = 33.93075942993164 + dxy = -0.025435244664549828 + dxyError = 0.0014315954176709056 + dz = 5.874882698059082 + dzError = 0.002003241330385208 + ecalIso = -1.0 + eta = -0.3469981849193573 + hcalIso = -1.0 + isGlobalMuon = True + isTrackerMuon = False + m = 0.0 + nMatchedStations = 4 + nTrackerLayersWithMeasurement = 14 + nValidMuonHits = 34 + nValidPixelHits = 4 + nValidStripHits = 15 + ndof = 18.0 + phi = -2.360595464706421 + pt = 9.477605819702148 + trackIso = 0.0 + trk_dsz = 5.5381083488464355 + trk_dszError = 0.0018884065793827176 + trk_eta = -0.3469981849193573 + trk_lambda = -0.34023720026016235 + trk_lambdaError = 0.0002624643384478986 + trk_phi = -2.360595464706421 + trk_phiError = 0.0002613998076412827 + trk_pt = 9.477605819702148 + trk_qoverp = 0.09946347028017044 + trk_qoverpError = 0.0008352764998562634 + type = 2 + vtxIndx = {} + + Product Label: "hltScoutingPFPacker" (type: "vector"), size = 15 + + Object #0 + HFEMEnergy = 0.0 + HFEMMultiplicity = 0 + HFHadronEnergy = 0.0 + HFHadronMultiplicity = 0 + HOEnergy = 0.0 + chargedHadronEnergy = 5.21009635925293 + chargedHadronMultiplicity = 6 + constituents = { 1252, 1225, 1148, 1147, 103, 313, 364, 337, 86, 1206 } + csv = -20.0 + electronEnergy = 0.0 + electronMultiplicity = 0 + eta = 0.15360045433044434 + jetArea = 0.5026548504829407 + m = 17.293928146362305 + muonEnergy = 0.0 + muonMultiplicity = 0 + mvaDiscriminator = 0.0 + neutralHadronEnergy = 4.073654651641846 + neutralHadronMultiplicity = 2 + phi = -2.9331908226013184 + photonEnergy = 236.12876892089844 + photonMultiplicity = 12 + pt = 241.9427032470703 + + Product Label: "hltScoutingPFPacker" (type: "vector"), size = 1336 + + Object #0 + eta = 2.6104886531829834 + m = 0.0 + pdgId = 22 + phi = -0.648145854473114 + pt = 0.9936956763267517 + vertex = 0 + + Product Label: "hltScoutingEgammaPacker" (type: "vector"), size = 2 + + Object #0 + ecalIso = 3.121485948562622 + eta = -1.1164329051971436 + hOverE = 0.0 + hcalIso = 3.9732704162597656 + m = -1.6858739115832577e-07 + phi = 2.536961078643799 + pt = 7.608181953430176 + sigmaIetaIeta = 0.011486247181892395 + + Product Label: "hltScoutingTrackPacker" (type: "vector"), size = 78 + + Object #0 + tk_charge = -1 + tk_chi2 = 32.697689056396484 + tk_dsz = 5.522921562194824 + tk_dsz_Error = 0.009875157848000526 + tk_dxy = -0.025069741532206535 + tk_dxy_Error = 0.015570130199193954 + tk_dz = 5.897363185882568 + tk_dz_Error = 0.0105446707457304 + tk_eta = 0.36618342995643616 + tk_lambda = 0.35826390981674194 + tk_lambda_Error = 0.0020103193819522858 + tk_nTrackerLayersWithMeasurement = 4 + tk_nValidPixelHits = 4 + tk_nValidStripHits = 0 + tk_ndof = 3.0 + tk_phi = -2.915278196334839 + tk_phi_Error = 0.00473041320219636 + tk_pt = 0.9674832224845886 + tk_qoverp = -0.9679827094078064 + tk_qoverp_Error = 0.061383962631225586 + + Product Label: "hltScoutingPrimaryVertexPacker:primaryVtx" (type: "vector"), size = 25 + + Object #0 + chi2 = 0.0 + isValidVtx = True + ndof = 1 + tracksSize = 30 + x = 0.010730049572885036 + xError = 0.0 + y = 0.041916027665138245 + yError = 0.0 + z = 5.910659313201904 + zError = 0.005083281081169844 +-------------------------------------------------- +Events processed = 1 diff --git a/DataFormats/Scouting/test/testDataFormatsScoutingRun3.sh b/DataFormats/Scouting/test/testDataFormatsScoutingRun3.sh new file mode 100755 index 0000000000000..c65958793b5bd --- /dev/null +++ b/DataFormats/Scouting/test/testDataFormatsScoutingRun3.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Pass in name and status +function die { + printf "\n%s: status %s\n" "$1" "$2" + if [ $# -gt 2 ]; then + printf "%s\n" "=== Log File ==========" + cat $3 + printf "%s\n" "=== End of Log File ===" + fi + exit $2 +} + +# read Scouting collections from existing EDM file, and write them to disk +cmsRun "${SCRAM_TEST_PATH}"/scoutingCollectionsIO_cfg.py -- \ + -i /store/mc/Run3Summer22DR/GluGlutoHHto2B2Tau_kl-5p00_kt-1p00_c2-0p00_TuneCP5_13p6TeV_powheg-pythia8/GEN-SIM-RAW/124X_mcRun3_2022_realistic_v12-v2/2550000/bbfb86f3-4073-47e3-967b-059aa6b904ad.root \ + -n 150 --skip 0 -o testDataFormatsScoutingRun3_step1.root \ + >testDataFormatsScoutingRun3_step1.log 2>testDataFormatsScoutingRun3_step1_stderr.log \ + || die "Failure running scoutingCollectionsIO_cfg.py" $? testDataFormatsScoutingRun3_step1_stderr.log + +cat testDataFormatsScoutingRun3_step1.log + +# validate content of Scouting collections +"${SCRAM_TEST_PATH}"/scoutingCollectionsDumper.py -v 1 -n 1 --skip 137 -i testDataFormatsScoutingRun3_step1.root -k Run3Scouting \ + > testDataFormatsScoutingRun3_step2.log 2>testDataFormatsScoutingRun3_step2_stderr.log \ + || die "Failure running scoutingCollectionsDumper.py" $? testDataFormatsScoutingRun3_step2_stderr.log + +diff -q "${SCRAM_TEST_PATH}"/testDataFormatsScoutingRun3_expected.log testDataFormatsScoutingRun3_step2.log \ + || die "Unexpected differences in outputs of testDataFormatsScoutingRun3 (step 2)" $? diff --git a/DataFormats/Scouting/test/testDataFormatsScoutingRun3_expected.log b/DataFormats/Scouting/test/testDataFormatsScoutingRun3_expected.log new file mode 100644 index 0000000000000..0fbb1c3c5d34e --- /dev/null +++ b/DataFormats/Scouting/test/testDataFormatsScoutingRun3_expected.log @@ -0,0 +1,241 @@ +-------------------------------------------------- +Run = 1 +LuminosityBlock = 83 +Event = 29083 + + Product Label: "hltScoutingEgammaPacker" (type: "vector"), size = 1 + + Object #0 + dEtaIn = 0.00014007469872012734 + dPhiIn = 5.698204040527344e-05 + detIds = { 838944835, 838944311, 838944312, 838944316, 838944317, 838944320, 838944323, 838944324, 838943802, 838943805, 838943811, 838943812, 838943814, 838943288, 838943291, 838943292, 838943296, 838943297, 838943298, 838943302, 838942776, 838942782, 838942783, 838942785, 838942272, 838942273, 838942274, 838942275, 838941755, 838941756, 838941758, 838941759, 838941760, 838941761, 838941762, 838941242, 838941244, 838941246, 838941247, 838941248, 838941249, 838941250, 838941251, 838940729, 838940732, 838940733, 838940735, 838940736, 838940737, 838940738, 838940740, 838940742, 838940218, 838940222, 838940224, 838940225, 838940230, 838939705, 838939711, 838939713, 838939715, 838939716, 838939192, 838939193, 838939194, 838939195, 838939201, 838939202, 838939206, 838938681, 838938687, 838938689, 838938690, 838938693, 838938694, 838938169, 838938170, 838938172, 838938173, 838938176, 838938178, 838938179, 838937657, 838937658, 838937659, 838937660, 838937663, 838937668, 838937145, 838937152, 838937154, 838937156 } + ecalIso = 7.798269271850586 + energyMatrix = { 0.467529f, 0.624023f, 0.0174255f, 0.0977173f, 0.0157776f, 0.0956421f, 2.89062f, 0.685059f, 0.00851440f, 0.0712891f, 0.426025f, 0.199341f, 0.0661621f, 0.155884f, 0.0534363f, 0.0522766f, 0.00791168f, 0.0205688f, 0.107300f, 0.0122452f, 0.0700073f, 0.0157013f, 0.0520325f, 0.138428f, 0.0748291f, 0.124878f, 0.166870f, 0.0969849f, 0.0126724f, 0.0423279f, 0.0621338f, 0.142700f, 0.521484f, 0.131226f, 0.00601959f, 0.0630493f, 0.0369873f, 2.90039f, 0.886719f, 14.4453f, 0.731445f, 0.0470886f, 0.0833130f, 0.0942993f, 0.0527039f, 0.413818f, 0.182983f, 0.498535f, 0.225952f, 0.180542f, 0.0482483f, 0.0472412f, 0.114014f, 0.0368958f, 0.0646362f, 0.0283203f, 0.00453186f, 0.368896f, 0.0597839f, 0.418701f, 0.0561218f, 0.0733643f, 0.0261688f, 0.0989990f, 0.468750f, 0.0487976f, 0.0332642f, 0.0870361f, 0.00700760f, 0.0215149f, 0.0932617f, 0.0542603f, 0.0838013f, 0.336914f, 0.0405884f, 0.165405f, 0.0224762f, 0.0451355f, 0.0472717f, 0.0596008f, 0.0596619f, 0.216187f, 0.0328064f, 0.191040f, 0.0786743f, 0.0371399f, 0.00169468f, 0.0335693f, 0.0767822f, 0.0492249f, 0.0543823f, 0.0711670f } + eta = 0.5031031370162964 + hOverE = 0.0 + hcalIso = 0.0 + m = -2.920019426255749e-07 + missingHits = 0 + ooEMOop = 0.005525607615709305 + phi = 0.9313944578170776 + pt = 19.88896942138672 + r9 = 0.8709825277328491 + rechitZeroSuppression = True + sMaj = 0.2543233036994934 + sMin = 0.23481805622577667 + seedId = 838941248 + sigmaIetaIeta = 0.007278029341250658 + timingMatrix = {} + trackIso = 7.829135417938232 + trkcharge = { -1 } + trkchi2overndf = {} + trkd0 = { 0.0910756f } + trkdz = { 1.75743f } + trketa = {} + trkphi = {} + trkpt = {} + + Product Label: "hltScoutingMuonPacker" (type: "vector"), size = 2 + + Object #0 + charge = 1 + ecalIso = 0.8200493454933167 + eta = 0.4523281455039978 + hcalIso = -0.8316822648048401 + isGlobalMuon = True + isTrackerMuon = True + m = 0.0 + nPixelLayersWithMeasurement = 4 + nRecoMuonChambers = 10 + nRecoMuonChambersCSCorDT = 4 + nRecoMuonExpectedMatchedStations = 4 + nRecoMuonMatchedRPCLayers = 0 + nRecoMuonMatchedStations = 4 + nRecoMuonMatches = 4 + nStandAloneMuonMatchedStations = 4 + nTrackerLayersWithMeasurement = 13 + nValidPixelHits = 4 + nValidRecoMuonHits = 48 + nValidStandAloneMuonHits = 48 + nValidStripHits = 9 + normalizedChi2 = 1.241951823234558 + phi = -1.6093230247497559 + pt = 61.90772247314453 + recoMuonRPClayerMask = 0 + recoMuonStationMask = 15 + trackIso = 0.023261696100234985 + trk_chi2 = 28.453201293945312 + trk_dsz = 1.6049633026123047 + trk_dszError = 0.000999733223579824 + trk_dxy = 0.09571316093206406 + trk_dxyError = 0.0009637423790991306 + trk_dxy_dsz_cov = -7.264699064535307e-08 + trk_dz = 1.771970272064209 + trk_dzError = 0.0011037620715796947 + trk_eta = 0.4523281455039978 + trk_hitPattern.hitCount = 14 + trk_hitPattern.beginTrackHits = 1 + trk_hitPattern.endTrackHits = 14 + trk_hitPattern.beginInner = 0 + trk_hitPattern.endInner = 0 + trk_hitPattern.beginOuter = 0 + trk_hitPattern.endOuter = 1 + trk_hitPattern.hitPattern = { 34481, 36936, 18820, 33952, 36952, 22917, 34208, 36968, 27014, 34464, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + trk_lambda = 0.43764862418174744 + trk_lambdaError = 8.468596934108064e-05 + trk_lambda_dsz_cov = -7.34926359768906e-08 + trk_lambda_dxy_cov = 5.0671942197766384e-09 + trk_lambda_phi_cov = -3.863420139360585e-10 + trk_ndof = 21.0 + trk_phi = -1.6093230247497559 + trk_phiError = 8.349290146725252e-05 + trk_phi_dsz_cov = 5.383451018303731e-09 + trk_phi_dxy_cov = -7.052129546991637e-08 + trk_pt = 61.90772247314453 + trk_qoverp = 0.01463065855205059 + trk_qoverpError = 0.0001785793574526906 + trk_qoverp_dsz_cov = 7.775126320552772e-09 + trk_qoverp_dxy_cov = -9.391782640477686e-08 + trk_qoverp_lambda_cov = -5.765431465576398e-10 + trk_qoverp_phi_cov = 9.820788626768717e-09 + trk_vx = 0.09521367400884628 + trk_vy = -0.014802273362874985 + trk_vz = 1.7771753072738647 + type = 14 + vtxIndx = { 0 } + + Product Label: "hltScoutingPFPacker" (type: "vector"), size = 8 + + Object #0 + HFEMEnergy = 0.0 + HFEMMultiplicity = 0 + HFHadronEnergy = 0.0 + HFHadronMultiplicity = 0 + HOEnergy = 0.0 + chargedHadronEnergy = 10.6640625 + chargedHadronMultiplicity = 5 + constituents = {} + csv = -20.0 + electronEnergy = 0.0 + electronMultiplicity = 0 + eta = 1.3583984375 + jetArea = 0.50244140625 + m = 22.953125 + muonEnergy = 0.0 + muonMultiplicity = 0 + mvaDiscriminator = 0.0 + neutralHadronEnergy = 283.75 + neutralHadronMultiplicity = 7 + phi = 0.7021484375 + photonEnergy = 194.625 + photonMultiplicity = 7 + pt = 235.75 + + Product Label: "hltScoutingPFPacker" (type: "vector"), size = 220 + + Object #0 + dxy = -0.0002617835998535156 + dxysig = -0.0318603515625 + dz = -1.015625 + dzsig = -76.25 + eta = 1.3603515625 + lostInnerHits = 255 + normchi2 = 1.349609375 + pdgId = -211 + phi = 1.8115234375 + pt = 0.89208984375 + quality = 5 + relative_trk_vars = True + trk_eta = 0.0 + trk_phi = 0.0 + trk_pt = 0.0 + vertex = -1 + + Product Label: "hltScoutingEgammaPacker" (type: "vector"), size = 6 + + Object #0 + detIds = { 838967413, 838967414, 838967415, 838967421, 838966903, 838966908, 838966385, 838966389, 838966391, 838966395, 838966396, 838966397, 838965874, 838965876, 838965877, 838965878, 838965880, 838965882, 838965359, 838965360, 838965361, 838965368, 838965370, 838965372, 838964852, 838964853, 838964854, 838964855, 838964856, 838964857, 838964858, 838964859, 838964861, 838964862, 838964863, 838964864, 838964866, 838964335, 838964337, 838964340, 838964341, 838964342, 838964343, 838964346, 838964347, 838964351, 838964352, 838963825, 838963828, 838963830, 838963831, 838963833, 838963835, 838963836, 838963837, 838963838, 838963842, 838963313, 838963318, 838963319, 838963320, 838963321, 838963322, 838962804, 838962806, 838962807, 838962808, 838962809, 838962810, 838962811, 838962812, 838962813, 838962816, 838962817, 838962818, 838962287, 838962289, 838962291, 838962293, 838962294, 838962295, 838962296, 838962297, 838962298, 838962299, 838962302, 838962303, 838962304, 838962305, 838961775, 838961776, 838961781, 838961782, 838961783, 838961784, 838961785, 838961786, 838961787, 838961788, 838961790, 838961791, 838961792, 838961794, 838961263, 838961264, 838961266, 838961267, 838961268, 838961270, 838961271, 838961272, 838961273, 838961274, 838961275, 838961279, 838961280, 838960754, 838960759, 838960761, 838960762, 838960763, 838960766, 838960241, 838960245, 838960246, 838960248, 838960249, 838960250, 838960251, 838960252, 838960253, 838959727, 838959728, 838959732, 838959737, 838959743, 838959215, 838959217, 838959218, 838959223, 838959226, 838959232, 838959233, 838958704, 838958705, 838958709, 838958711, 838958712, 838958714, 838958717, 838958719, 838958191, 838958192, 838958193, 838958194, 838958197, 838958199, 838958200, 838958204, 838958205, 838958206, 838957680, 838957681, 838957685, 838957687, 838957689, 838957690, 838957693, 838957694, 838957695, 838957698, 838957171 } + ecalIso = 23.55951499938965 + energyMatrix = { 0.0222931f, 0.150757f, 0.0249481f, 0.0767822f, 0.140869f, 0.122803f, 0.0506897f, 0.0967407f, 0.166016f, 0.00157928f, 0.181152f, 0.0864258f, 0.0174408f, 0.00457001f, 0.108826f, 0.128540f, 0.0128784f, 0.0436401f, 0.108521f, 0.0340576f, 0.111755f, 0.247681f, 0.0782471f, 0.0677490f, 0.336670f, 1.18848f, 0.267334f, 0.476562f, 0.177246f, 0.0941162f, 0.171875f, 0.101807f, 0.100342f, 0.00579834f, 0.0549316f, 0.0106964f, 0.0411072f, 0.260986f, 0.122498f, 0.454346f, 10.4766f, 0.910156f, 0.528809f, 0.112671f, 0.0553284f, 0.102600f, 0.0888062f, 0.198486f, 0.0527039f, 0.915039f, 0.183228f, 0.0674438f, 0.0311127f, 0.0353394f, 0.492676f, 0.00539017f, 0.232422f, 0.699219f, 0.132690f, 0.236816f, 5.05859f, 0.0823975f, 0.129639f, 0.0683594f, 0.269531f, 0.601562f, 0.607422f, 1.18066f, 0.355957f, 0.287109f, 0.165039f, 0.273682f, 0.307617f, 0.0896606f, 0.0958252f, 0.0691528f, 0.215454f, 0.0404358f, 0.781738f, 0.755371f, 1.65430f, 0.885254f, 18.8281f, 1.44531f, 0.166260f, 0.0358887f, 0.0574341f, 0.00404739f, 0.159424f, 0.0280151f, 0.307129f, 2.46484f, 1.96777f, 0.173218f, 2.32031f, 1.24512f, 0.646973f, 0.0563049f, 0.172119f, 0.131104f, 1.79688f, 0.994141f, 0.0682983f, 0.505371f, 0.0115128f, 0.00272751f, 0.281494f, 0.00685120f, 1.72168f, 1.53027f, 0.338379f, 0.240845f, 0.247437f, 0.0144196f, 0.294678f, 0.0547485f, 0.159302f, 0.0407715f, 0.124451f, 0.00750732f, 0.0658569f, 0.0204773f, 0.111145f, 0.0135269f, 0.170410f, 0.140137f, 0.0145874f, 0.131958f, 0.112610f, 0.150635f, 0.0569153f, 0.0301208f, 0.0916748f, 0.0727539f, 0.00557709f, 0.153564f, 0.00154972f, 0.0683594f, 0.0527344f, 0.262207f, 0.0475769f, 0.162354f, 0.0407104f, 0.0469360f, 0.0335388f, 0.0665283f, 0.0793457f, 0.107971f, 0.120056f, 0.153442f, 0.0162048f, 0.0679321f, 0.323730f, 1.99512f, 0.0513000f, 0.00398254f, 0.00563049f, 0.0698242f, 0.0297852f, 0.136230f, 0.00747681f, 0.166260f, 0.889648f, 0.0120773f, 0.0858765f, 0.242065f, 0.0953369f, 0.0283966f, 0.0717163f, 0.121704f, 0.000929832f, 0.244141f } + eta = 1.21042001247406 + hOverE = 0.038411639630794525 + hcalIso = 20.55815887451172 + m = 6.743495646333031e-07 + phi = 1.92743980884552 + pt = 17.033815383911133 + r9 = 1.0433892011642456 + rechitZeroSuppression = True + sMaj = 0.6447122693061829 + sMin = 0.2290443778038025 + seedId = 838962297 + sigmaIetaIeta = 0.01953848823904991 + timingMatrix = {} + trkIso = 0.0 + + Product Label: "hltScoutingTrackPacker" (type: "vector"), size = 20 + + Object #0 + tk_charge = 1 + tk_chi2 = 30.46875 + tk_dsz = 1.6064453125 + tk_dsz_Error = 0.0007586479187011719 + tk_dxy = 0.09515380859375 + tk_dxy_Error = 0.0009350776672363281 + tk_dxy_dsz_cov = 1.987791620194912e-08 + tk_dz = 1.7734375 + tk_dz_Error = 0.0008373260498046875 + tk_eta = 0.4521484375 + tk_lambda = 0.4375 + tk_lambda_Error = 7.69495964050293e-05 + tk_lambda_dsz_cov = -4.700268618762493e-08 + tk_lambda_dxy_cov = -1.4142642612569034e-09 + tk_lambda_phi_cov = 1.0317080523236655e-10 + tk_nTrackerLayersWithMeasurement = 14 + tk_nValidPixelHits = 5 + tk_nValidStripHits = 13 + tk_ndof = 18.0 + tk_phi = -1.609375 + tk_phi_Error = 8.511543273925781e-05 + tk_phi_dsz_cov = -1.4133547665551305e-09 + tk_phi_dxy_cov = -6.746267899870872e-08 + tk_pt = 61.46875 + tk_qoverp = 0.014739990234375 + tk_qoverp_Error = 0.00016427040100097656 + tk_qoverp_dsz_cov = -1.267835614271462e-09 + tk_qoverp_dxy_cov = -8.055940270423889e-08 + tk_qoverp_lambda_cov = 7.270273272297345e-11 + tk_qoverp_phi_cov = 8.381903171539307e-09 + tk_vtxInd = 0 + tk_vx = 0.09466552734375 + tk_vy = -0.0147857666015625 + tk_vz = 1.779296875 + + Product Label: "hltScoutingMuonPacker:displacedVtx" (type: "vector"), size = 1 + + Object #0 + chi2 = 0.8499976992607117 + isValidVtx = True + ndof = 1 + tracksSize = 2 + x = 0.09472132474184036 + xError = 0.0008815590408630669 + y = -0.018364980816841125 + yError = 0.002398101380094886 + z = 1.7790638208389282 + zError = 0.0015540826134383678 + + Product Label: "hltScoutingPrimaryVertexPacker:primaryVtx" (type: "vector"), size = 8 + + Object #0 + chi2 = 119.6875 + isValidVtx = True + ndof = 52 + tracksSize = 53 + x = 0.10064697265625 + xError = 0.0 + y = -0.0150146484375 + yError = 0.0 + z = 1.783203125 + zError = 0.0013170242309570312 +-------------------------------------------------- +Events processed = 1 diff --git a/DataFormats/SiStripCluster/interface/SiStripClusterfwd.h b/DataFormats/SiStripCluster/interface/SiStripClusterfwd.h index 31f1ca1a32b87..526e69d3a85f7 100644 --- a/DataFormats/SiStripCluster/interface/SiStripClusterfwd.h +++ b/DataFormats/SiStripCluster/interface/SiStripClusterfwd.h @@ -1,4 +1,4 @@ #ifndef DATAFORMATS_SISTRIPCLUSTERFWD_H #define DATAFORMATS_SISTRIPCLUSTERFWD_H class SiStripCluster; -#endif // DATAFORMATS_SISTRIPCLUSTERFWD_H +#endif // DATAFORMATS_SISTRIPCLUSTERFWD_H diff --git a/DataFormats/SiStripCluster/interface/SiStripClustersSOA.h b/DataFormats/SiStripCluster/interface/SiStripClustersSOA.h new file mode 100644 index 0000000000000..e6c262d456289 --- /dev/null +++ b/DataFormats/SiStripCluster/interface/SiStripClustersSOA.h @@ -0,0 +1,27 @@ +#ifndef DataFormats_SiStripCluster_interface_SiStripClustersSOA_h +#define DataFormats_SiStripCluster_interface_SiStripClustersSOA_h + +#include "DataFormats/SiStripCluster/interface/SiStripClustersSOABase.h" + +#include + +namespace detail { + namespace impl { + template + using unique_ptr_default_deleter = typename std::unique_ptr; + } +} // namespace detail + +class SiStripClustersSOA : public SiStripClustersSOABase { +public: + SiStripClustersSOA() = default; + explicit SiStripClustersSOA(uint32_t maxClusters, uint32_t maxStripsPerCluster); + ~SiStripClustersSOA() override = default; + + SiStripClustersSOA(const SiStripClustersSOA &) = delete; + SiStripClustersSOA &operator=(const SiStripClustersSOA &) = delete; + SiStripClustersSOA(SiStripClustersSOA &&) = default; + SiStripClustersSOA &operator=(SiStripClustersSOA &&) = default; +}; + +#endif diff --git a/DataFormats/SiStripCluster/interface/SiStripClustersSOABase.h b/DataFormats/SiStripCluster/interface/SiStripClustersSOABase.h new file mode 100644 index 0000000000000..036ab7c3dd3e5 --- /dev/null +++ b/DataFormats/SiStripCluster/interface/SiStripClustersSOABase.h @@ -0,0 +1,59 @@ +#ifndef DataFormats_SiStripCluster_interface_SiStripClustersSOABase_ +#define DataFormats_SiStripCluster_interface_SiStripClustersSOABase_ + +#include "DataFormats/SiStripCluster/interface/SiStripTypes.h" + +#include +#include + +template