Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous Alignment/OfflineValidation improvements #35983

Merged
merged 7 commits into from Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Alignment/OfflineValidation/macros/CMS_lumi.h
Expand Up @@ -35,6 +35,7 @@ float extraOverCmsTextSize = 0.76;
TString lumi_13TeV = "20.1 fb^{-1}";
TString lumi_8TeV = "19.7 fb^{-1}";
TString lumi_7TeV = "5.1 fb^{-1}";
TString lumi_0p45TeV = "";
TString lumi_sqrtS = "";
bool drawLogo = false;

Expand Down Expand Up @@ -88,6 +89,9 @@ void CMS_lumi(TPad* pad, int iPeriod, int iPosX) {
} else if (iPeriod == 4) {
lumiText += lumi_13TeV;
lumiText += " (#sqrt{s} = 13 TeV)";
} else if (iPeriod == 5) {
lumiText += lumi_0p45TeV;
lumiText += " (#sqrt{s} = 0.45 TeV)";
} else if (iPeriod == 7) {
if (outOfFrame)
lumiText += "#scale[0.85]{";
Expand Down
32 changes: 16 additions & 16 deletions Alignment/OfflineValidation/macros/FitPVResiduals.C
Expand Up @@ -4200,35 +4200,35 @@ params::measurement getTheRangeUser(TH1F *thePlot, Limits *lims, bool tag)
if (theTitle.Contains("norm")) {
if (theTitle.Contains("means")) {
if (theTitle.Contains("dxy") || theTitle.Contains("dx") || theTitle.Contains("dy")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT") || theTitle.Contains("ladder")) {
result = std::make_pair(-lims->get_dxyPhiNormMax().first, lims->get_dxyPhiNormMax().first);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(-lims->get_dxyEtaNormMax().first, lims->get_dxyEtaNormMax().first);
} else {
result = std::make_pair(-0.8, 0.8);
}
} else if (theTitle.Contains("dz")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT") || theTitle.Contains("ladder")) {
result = std::make_pair(-lims->get_dzPhiNormMax().first, lims->get_dzPhiNormMax().first);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(-lims->get_dzEtaNormMax().first, lims->get_dzEtaNormMax().first);
} else {
result = std::make_pair(-0.8, 0.8);
}
}
} else if (theTitle.Contains("widths")) {
if (theTitle.Contains("dxy") || theTitle.Contains("dx") || theTitle.Contains("dy")) {
if (theTitle.Contains("phi")) {
if (theTitle.Contains("phi") || theTitle.Contains("ladder")) {
result = std::make_pair(0., lims->get_dxyPhiNormMax().second);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(0., lims->get_dxyEtaNormMax().second);
} else {
result = std::make_pair(0., 2.);
}
} else if (theTitle.Contains("dz")) {
if (theTitle.Contains("phi")) {
if (theTitle.Contains("phi") || theTitle.Contains("ladder")) {
result = std::make_pair(0., lims->get_dzPhiNormMax().second);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(0., lims->get_dzEtaNormMax().second);
} else {
result = std::make_pair(0., 2.);
Expand All @@ -4238,35 +4238,35 @@ params::measurement getTheRangeUser(TH1F *thePlot, Limits *lims, bool tag)
} else {
if (theTitle.Contains("means")) {
if (theTitle.Contains("dxy") || theTitle.Contains("dx") || theTitle.Contains("dy")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT") || theTitle.Contains("ladder")) {
result = std::make_pair(-lims->get_dxyPhiMax().first, lims->get_dxyPhiMax().first);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(-lims->get_dxyEtaMax().first, lims->get_dxyEtaMax().first);
} else {
result = std::make_pair(-40., 40.);
}
} else if (theTitle.Contains("dz")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT")) {
if (theTitle.Contains("phi") || theTitle.Contains("pT") || theTitle.Contains("ladder")) {
result = std::make_pair(-lims->get_dzPhiMax().first, lims->get_dzPhiMax().first);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(-lims->get_dzEtaMax().first, lims->get_dzEtaMax().first);
} else {
result = std::make_pair(-80., 80.);
}
}
} else if (theTitle.Contains("widths")) {
if (theTitle.Contains("dxy") || theTitle.Contains("dx") || theTitle.Contains("dy")) {
if (theTitle.Contains("phi")) {
if (theTitle.Contains("phi") || theTitle.Contains("ladder")) {
result = std::make_pair(0., lims->get_dxyPhiMax().second);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(0., lims->get_dxyEtaMax().second);
} else {
result = std::make_pair(0., 150.);
}
} else if (theTitle.Contains("dz")) {
if (theTitle.Contains("phi")) {
if (theTitle.Contains("phi") || theTitle.Contains("ladder")) {
result = std::make_pair(0., lims->get_dzPhiMax().second);
} else if (theTitle.Contains("eta")) {
} else if (theTitle.Contains("eta") || theTitle.Contains("mod")) {
result = std::make_pair(0., lims->get_dzEtaMax().second);
} else {
result = std::make_pair(0., 300.);
Expand Down
65 changes: 45 additions & 20 deletions Alignment/OfflineValidation/plugins/DMRChecker.cc
Expand Up @@ -54,6 +54,7 @@
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "CommonTools/Utils/interface/TFileDirectory.h"
#include "DQM/TrackerRemapper/interface/Phase1PixelMaps.h"
#include "DQM/TrackerRemapper/interface/Phase1PixelSummaryMap.h"
#include "CondCore/SiPixelPlugins/interface/PixelRegionContainers.h"
#include "CondCore/SiPixelPlugins/interface/SiPixelPayloadInspectorHelper.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
Expand Down Expand Up @@ -158,16 +159,16 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
usesResource(TFileService::kSharedResource);

TkTag_ = pset.getParameter<edm::InputTag>("TkTag");
theTrackCollectionToken = consumes<reco::TrackCollection>(TkTag_);
theTrackCollectionToken_ = consumes<reco::TrackCollection>(TkTag_);

TriggerResultsTag_ = pset.getParameter<edm::InputTag>("TriggerResultsTag");
hltresultsToken = consumes<edm::TriggerResults>(TriggerResultsTag_);
hltresultsToken_ = consumes<edm::TriggerResults>(TriggerResultsTag_);

BeamSpotTag_ = pset.getParameter<edm::InputTag>("BeamSpotTag");
beamspotToken = consumes<reco::BeamSpot>(BeamSpotTag_);
beamspotToken_ = consumes<reco::BeamSpot>(BeamSpotTag_);

VerticesTag_ = pset.getParameter<edm::InputTag>("VerticesTag");
vertexToken = consumes<reco::VertexCollection>(VerticesTag_);
vertexToken_ = consumes<reco::VertexCollection>(VerticesTag_);

// initialize conventional Tracker maps

Expand All @@ -191,6 +192,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

// set no rescale
pixelmap->setNoRescale();

// initialize Full Pixel Map
fullPixelmapXDMR = std::make_unique<Phase1PixelSummaryMap>("", "DMR-x", "median of residuals [#mum]");
fullPixelmapYDMR = std::make_unique<Phase1PixelSummaryMap>("", "DMR-y", "median of residuals [#mum]");
}

static void fillDescriptions(edm::ConfigurationDescriptions &);
Expand Down Expand Up @@ -225,6 +230,9 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
edm::Service<TFileService> fs;

std::unique_ptr<Phase1PixelMaps> pixelmap;
std::unique_ptr<Phase1PixelSummaryMap> fullPixelmapXDMR;
std::unique_ptr<Phase1PixelSummaryMap> fullPixelmapYDMR;

std::unique_ptr<PixelRegions::PixelRegionContainers> PixelDMRS_x_ByLayer;
std::unique_ptr<PixelRegions::PixelRegionContainers> PixelDMRS_y_ByLayer;

Expand Down Expand Up @@ -455,10 +463,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
edm::InputTag BeamSpotTag_;
edm::InputTag VerticesTag_;

edm::EDGetTokenT<reco::TrackCollection> theTrackCollectionToken;
edm::EDGetTokenT<edm::TriggerResults> hltresultsToken;
edm::EDGetTokenT<reco::BeamSpot> beamspotToken;
edm::EDGetTokenT<reco::VertexCollection> vertexToken;
edm::EDGetTokenT<reco::TrackCollection> theTrackCollectionToken_;
edm::EDGetTokenT<edm::TriggerResults> hltresultsToken_;
edm::EDGetTokenT<reco::BeamSpot> beamspotToken_;
edm::EDGetTokenT<reco::VertexCollection> vertexToken_;

std::map<std::string, std::pair<int, int> > triggerMap_;
std::map<int, std::pair<int, float> > conditionsMap_;
Expand All @@ -484,8 +492,7 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
void analyze(const edm::Event &event, const edm::EventSetup &setup) override {
ievt++;

edm::Handle<reco::TrackCollection> trackCollection;
event.getByToken(theTrackCollectionToken, trackCollection);
edm::Handle<reco::TrackCollection> trackCollection = event.getHandle(theTrackCollectionToken_);

// magnetic field setup
const MagneticField *magneticField_ = &setup.getData(magFieldToken_);
Expand Down Expand Up @@ -547,8 +554,7 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

//edm::LogVerbatim("DMRChecker") << "Reconstructed "<< tC.size() << " tracks" << std::endl ;

edm::Handle<edm::TriggerResults> hltresults;
event.getByToken(hltresultsToken, hltresults);
edm::Handle<edm::TriggerResults> hltresults = event.getHandle(hltresultsToken_);
if (hltresults.isValid()) {
const edm::TriggerNames &triggerNames_ = event.triggerNames(*hltresults);
int ntrigs = hltresults->size();
Expand Down Expand Up @@ -1021,8 +1027,7 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

//dxy with respect to the beamspot
reco::BeamSpot beamSpot;
edm::Handle<reco::BeamSpot> beamSpotHandle;
event.getByToken(beamspotToken, beamSpotHandle);
edm::Handle<reco::BeamSpot> beamSpotHandle = event.getHandle(beamspotToken_);
if (beamSpotHandle.isValid()) {
beamSpot = *beamSpotHandle;
math::XYZPoint point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
Expand All @@ -1035,8 +1040,7 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

//dxy with respect to the primary vertex
reco::Vertex pvtx;
edm::Handle<reco::VertexCollection> vertexHandle;
event.getByToken(vertexToken, vertexHandle);
edm::Handle<reco::VertexCollection> vertexHandle = event.getHandle(vertexToken_);
double mindxy = 100.;
double dz = 100;
if (vertexHandle.isValid()) {
Expand Down Expand Up @@ -1329,6 +1333,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

firstEvent_ = true;

// create the full maps
fullPixelmapXDMR->createTrackerBaseMap();
fullPixelmapYDMR->createTrackerBaseMap();

} //beginJob

void endJob() override {
Expand Down Expand Up @@ -1524,8 +1532,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

for (auto &bpixid : resDetailsBPixX_) {
DMRBPixX_->Fill(bpixid.second.runningMeanOfRes_);
if (phase_ == SiPixelPI::phase::one)
if (phase_ == SiPixelPI::phase::one) {
pixelmap->fillBarrelBin("DMRsX", bpixid.first, bpixid.second.runningMeanOfRes_);
fullPixelmapXDMR->fillTrackerMap(bpixid.first, bpixid.second.runningMeanOfRes_);
}

//auto myLocalTopo = PixelDMRS_x_ByLayer->getTheTopo();
//edm::LogPrint("DMRChecker") << myLocalTopo->print(bpixid.first) << std::endl;
Expand All @@ -1547,8 +1557,11 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

for (auto &bpixid : resDetailsBPixY_) {
DMRBPixY_->Fill(bpixid.second.runningMeanOfRes_);
if (phase_ == SiPixelPI::phase::one)
if (phase_ == SiPixelPI::phase::one) {
pixelmap->fillBarrelBin("DMRsY", bpixid.first, bpixid.second.runningMeanOfRes_);
fullPixelmapYDMR->fillTrackerMap(bpixid.first, bpixid.second.runningMeanOfRes_);
}

PixelDMRS_y_ByLayer->fill(bpixid.first, bpixid.second.runningMeanOfRes_);

// split DMR
Expand All @@ -1566,8 +1579,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

for (auto &fpixid : resDetailsFPixX_) {
DMRFPixX_->Fill(fpixid.second.runningMeanOfRes_);
if (phase_ == SiPixelPI::phase::one)
if (phase_ == SiPixelPI::phase::one) {
pixelmap->fillForwardBin("DMRsX", fpixid.first, fpixid.second.runningMeanOfRes_);
fullPixelmapXDMR->fillTrackerMap(fpixid.first, fpixid.second.runningMeanOfRes_);
}
PixelDMRS_x_ByLayer->fill(fpixid.first, fpixid.second.runningMeanOfRes_);

// split DMR
Expand All @@ -1585,8 +1600,10 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {

for (auto &fpixid : resDetailsFPixY_) {
DMRFPixY_->Fill(fpixid.second.runningMeanOfRes_);
if (phase_ == SiPixelPI::phase::one)
if (phase_ == SiPixelPI::phase::one) {
pixelmap->fillForwardBin("DMRsY", fpixid.first, fpixid.second.runningMeanOfRes_);
fullPixelmapXDMR->fillTrackerMap(fpixid.first, fpixid.second.runningMeanOfRes_);
}
PixelDMRS_y_ByLayer->fill(fpixid.first, fpixid.second.runningMeanOfRes_);

// split DMR
Expand Down Expand Up @@ -1684,6 +1701,14 @@ class DMRChecker : public edm::one::EDAnalyzer<edm::one::SharedResources> {
TCanvas cFY("CanvXForward", "CanvXForward", 1600, 1000);
pixelmap->drawForwardMaps("DMRsY", cFY);
cFY.SaveAs("pixelForwardDMR_y.png");

TCanvas cFullPixelxDMR("CanvFullPixelX", "CanvFullPixelX", 3000, 2000);
fullPixelmapXDMR->printTrackerMap(cFullPixelxDMR);
cFullPixelxDMR.SaveAs("fullPixelDMR_x.png");

TCanvas cFullPixelyDMR("CanvFullPixelX", "CanvFullPixelY", 3000, 2000);
fullPixelmapXDMR->printTrackerMap(cFullPixelyDMR);
cFullPixelyDMR.SaveAs("fullPixelDMR_y.png");
}

// take care now of the 1D histograms
Expand Down
31 changes: 13 additions & 18 deletions Alignment/OfflineValidation/plugins/GeneralPurposeTrackAnalyzer.cc
Expand Up @@ -97,16 +97,16 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
usesResource(TFileService::kSharedResource);

TkTag_ = pset.getParameter<edm::InputTag>("TkTag");
theTrackCollectionToken = consumes<reco::TrackCollection>(TkTag_);
theTrackCollectionToken_ = consumes<reco::TrackCollection>(TkTag_);

TriggerResultsTag_ = pset.getParameter<edm::InputTag>("TriggerResultsTag");
hltresultsToken = consumes<edm::TriggerResults>(TriggerResultsTag_);
hltresultsToken_ = consumes<edm::TriggerResults>(TriggerResultsTag_);

BeamSpotTag_ = pset.getParameter<edm::InputTag>("BeamSpotTag");
beamspotToken = consumes<reco::BeamSpot>(BeamSpotTag_);
beamspotToken_ = consumes<reco::BeamSpot>(BeamSpotTag_);

VerticesTag_ = pset.getParameter<edm::InputTag>("VerticesTag");
vertexToken = consumes<reco::VertexCollection>(VerticesTag_);
vertexToken_ = consumes<reco::VertexCollection>(VerticesTag_);

isCosmics_ = pset.getParameter<bool>("isCosmics");

Expand Down Expand Up @@ -289,10 +289,10 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR

bool isCosmics_;

edm::EDGetTokenT<reco::TrackCollection> theTrackCollectionToken;
edm::EDGetTokenT<edm::TriggerResults> hltresultsToken;
edm::EDGetTokenT<reco::BeamSpot> beamspotToken;
edm::EDGetTokenT<reco::VertexCollection> vertexToken;
edm::EDGetTokenT<reco::TrackCollection> theTrackCollectionToken_;
edm::EDGetTokenT<edm::TriggerResults> hltresultsToken_;
edm::EDGetTokenT<reco::BeamSpot> beamspotToken_;
edm::EDGetTokenT<reco::VertexCollection> vertexToken_;

std::map<std::string, std::pair<int, int> > triggerMap_;
std::map<int, std::pair<int, float> > conditionsMap_;
Expand All @@ -304,12 +304,10 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
{
ievt++;

edm::Handle<reco::TrackCollection> trackCollection;
event.getByToken(theTrackCollectionToken, trackCollection);
edm::Handle<reco::TrackCollection> trackCollection = event.getHandle(theTrackCollectionToken_);

// geometry setup
edm::ESHandle<TrackerGeometry> geometry = setup.getHandle(geomToken_);
const TrackerGeometry *theGeometry = &(*geometry);
const TrackerGeometry *theGeometry = &setup.getData(geomToken_);

// switch on the phase1
if ((theGeometry->isThere(GeomDetEnumerators::P1PXB)) || (theGeometry->isThere(GeomDetEnumerators::P1PXEC))) {
Expand All @@ -329,8 +327,7 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR
}
//int iCounter=0;

edm::Handle<edm::TriggerResults> hltresults;
event.getByToken(hltresultsToken, hltresults);
edm::Handle<edm::TriggerResults> hltresults = event.getHandle(hltresultsToken_);
if (hltresults.isValid()) {
const edm::TriggerNames &triggerNames_ = event.triggerNames(*hltresults);
int ntrigs = hltresults->size();
Expand Down Expand Up @@ -641,8 +638,7 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR

//dxy with respect to the beamspot
reco::BeamSpot beamSpot;
edm::Handle<reco::BeamSpot> beamSpotHandle;
event.getByToken(beamspotToken, beamSpotHandle);
edm::Handle<reco::BeamSpot> beamSpotHandle = event.getHandle(beamspotToken_);
if (beamSpotHandle.isValid()) {
beamSpot = *beamSpotHandle;
math::XYZPoint point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
Expand All @@ -655,8 +651,7 @@ class GeneralPurposeTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchR

//dxy with respect to the primary vertex
reco::Vertex pvtx;
edm::Handle<reco::VertexCollection> vertexHandle;
event.getByToken(vertexToken, vertexHandle);
edm::Handle<reco::VertexCollection> vertexHandle = event.getHandle(vertexToken_);
double mindxy = 100.;
double dz = 100;
if (vertexHandle.isValid() && !isCosmics_) {
Expand Down