forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cms-sw#33463 from sroychow/tkdqmfoldedmap
TkDQM: backport of PR 33430
- Loading branch information
Showing
13 changed files
with
265 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#ifndef TrackingMonitor_TrackFoldedOccupancyClient_h | ||
#define TrackingMonitor_TrackFoldedOccupancyClient_h | ||
// -*- C++ -*- | ||
// | ||
// Package: TrackingMonitor | ||
// Class : TrackFoldedOccupancyClient | ||
// | ||
//DQM class to plot occupancy in eta phi | ||
|
||
#include <string> | ||
|
||
#include "DQMServices/Core/interface/DQMEDHarvester.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/LuminosityBlock.h" | ||
#include "FWCore/Framework/interface/Run.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "DQMServices/Core/interface/DQMStore.h" | ||
|
||
class TrackFoldedOccupancyClient : public DQMEDHarvester { | ||
public: | ||
/// Constructor | ||
TrackFoldedOccupancyClient(const edm::ParameterSet& ps); | ||
|
||
/// Destructor | ||
~TrackFoldedOccupancyClient() override; | ||
|
||
protected: | ||
/// BeginJob | ||
void beginJob(void) override; | ||
|
||
/// BeginRun | ||
void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override; | ||
|
||
/// EndJob | ||
void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override; | ||
|
||
private: | ||
/// book MEs | ||
void bookMEs(DQMStore::IBooker& ibooker_); | ||
|
||
edm::ParameterSet conf_; | ||
std::string algoName_; | ||
std::string quality_; | ||
std::string state_; | ||
std::string histTag_; | ||
std::string TopFolder_; | ||
|
||
MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap = nullptr; | ||
MonitorElement* TkEtaPhi_RelativeDifference_byFoldingmap_op = nullptr; | ||
MonitorElement* TkEtaPhi_Ratio_byFoldingmap = nullptr; | ||
MonitorElement* TkEtaPhi_Ratio_byFoldingmap_op = nullptr; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
DQM/TrackingMonitor/python/TrackFoldedOccupancyClient_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester | ||
|
||
TrackerMapFoldedClient = DQMEDHarvester("TrackFoldedOccupancyClient", | ||
FolderName = cms.string('Tracking/TrackParameters'), | ||
AlgoName = cms.string('GenTk'), | ||
TrackQuality = cms.string('generalTracks'), | ||
MeasurementState = cms.string('ImpactPoint'), | ||
PhiMax = cms.double(3.141592654), | ||
PhiMin = cms.double(-3.141592654), | ||
EtaMax = cms.double(2.5), | ||
EtaMin = cms.double(-2.5), | ||
Eta2DBin = cms.int32(26), | ||
Phi2DBin = cms.int32(32), | ||
) | ||
|
||
from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel | ||
phase1Pixel.toModify(TrackerMapFoldedClient, EtaMin=-3., EtaMax=3.) | ||
from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker | ||
phase2_tracker.toModify(TrackerMapFoldedClient, EtaMin=-4.5, EtaMax=4.5) | ||
|
||
TrackerMapFoldedClient_highpurity_dzPV0p1=TrackerMapFoldedClient.clone( | ||
TrackQuality=cms.string('highPurityTracks/dzPV0p1') | ||
) | ||
|
||
TrackerMapFoldedClient_highpurity_pt0to1=TrackerMapFoldedClient.clone( | ||
TrackQuality=cms.string('highPurityTracks/pt_0to1') | ||
) | ||
|
||
TrackerMapFoldedClient_highpurity_pt1=TrackerMapFoldedClient.clone( | ||
TrackQuality=cms.string('highPurityTracks/pt_1') | ||
) | ||
|
||
foldedMapClientSeq=cms.Sequence(TrackerMapFoldedClient*TrackerMapFoldedClient_highpurity_dzPV0p1*TrackerMapFoldedClient_highpurity_pt0to1*TrackerMapFoldedClient_highpurity_pt1) | ||
|
||
#run3 | ||
TrackerMapFoldedClient_hiConformalPixelTracks=TrackerMapFoldedClient.clone( | ||
TrackQuality = cms.string('hiConformalPixelTracks') | ||
) | ||
|
||
folded_with_conformalpixtkclient= cms.Sequence(TrackerMapFoldedClient_hiConformalPixelTracks+foldedMapClientSeq.copy()) | ||
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA | ||
pp_on_AA.toReplaceWith(foldedMapClientSeq, folded_with_conformalpixtkclient) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/ParameterSet/interface/FileInPath.h" | ||
#include "DQM/TrackingMonitor/interface/TrackFoldedOccupancyClient.h" | ||
//----------------------------------------------------------------------------------- | ||
TrackFoldedOccupancyClient::TrackFoldedOccupancyClient(edm::ParameterSet const& iConfig) | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::Deleting TrackFoldedOccupancyClient "; | ||
TopFolder_ = iConfig.getParameter<std::string>("FolderName"); | ||
quality_ = iConfig.getParameter<std::string>("TrackQuality"); | ||
algoName_ = iConfig.getParameter<std::string>("AlgoName"); | ||
state_ = iConfig.getParameter<std::string>("MeasurementState"); | ||
histTag_ = (state_ == "default") ? algoName_ : state_ + "_" + algoName_; | ||
conf_ = iConfig; | ||
} | ||
|
||
//----------------------------------------------------------------------------------- | ||
TrackFoldedOccupancyClient::~TrackFoldedOccupancyClient() | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::Deleting TrackFoldedOccupancyClient "; | ||
} | ||
|
||
//----------------------------------------------------------------------------------- | ||
void TrackFoldedOccupancyClient::beginJob(void) | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::beginJob done"; | ||
} | ||
|
||
//----------------------------------------------------------------------------------- | ||
void TrackFoldedOccupancyClient::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient:: Begining of Run"; | ||
} | ||
|
||
//----------------------------------------------------------------------------------- | ||
void TrackFoldedOccupancyClient::bookMEs(DQMStore::IBooker& ibooker) | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
ibooker.setCurrentFolder(TopFolder_ + "/" + quality_ + "/GeneralProperties/"); | ||
int Phi2DBin = conf_.getParameter<int>("Phi2DBin"); | ||
int Eta2DBin = conf_.getParameter<int>("Eta2DBin"); | ||
double EtaMin = conf_.getParameter<double>("EtaMin"); | ||
double EtaMax = conf_.getParameter<double>("EtaMax"); | ||
double PhiMin = conf_.getParameter<double>("PhiMin"); | ||
double PhiMax = conf_.getParameter<double>("PhiMax"); | ||
|
||
// use the AlgoName and Quality Name | ||
std::string histname = "TkEtaPhi_RelativeDifference_byFoldingmap_" + histTag_; | ||
TkEtaPhi_RelativeDifference_byFoldingmap = | ||
ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); | ||
TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #eta", 1); | ||
TkEtaPhi_RelativeDifference_byFoldingmap->setAxisTitle("Track #phi", 2); | ||
|
||
histname = "TkEtaPhi_RelativeDifference_byFoldingmap_op_" + histTag_; | ||
TkEtaPhi_RelativeDifference_byFoldingmap_op = | ||
ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); | ||
TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #eta", 1); | ||
TkEtaPhi_RelativeDifference_byFoldingmap_op->setAxisTitle("Track #phi", 2); | ||
|
||
histname = "TkEtaPhi_Ratio_byFoldingmap_" + histTag_; | ||
TkEtaPhi_Ratio_byFoldingmap = ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); | ||
TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #eta", 1); | ||
TkEtaPhi_Ratio_byFoldingmap->setAxisTitle("Track #phi", 2); | ||
|
||
histname = "TkEtaPhi_Ratio_byFoldingmap_op_" + histTag_; | ||
TkEtaPhi_Ratio_byFoldingmap_op = | ||
ibooker.book2D(histname, histname, Eta2DBin, EtaMin, EtaMax, Phi2DBin, PhiMin, PhiMax); | ||
TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #eta", 1); | ||
TkEtaPhi_Ratio_byFoldingmap_op->setAxisTitle("Track #phi", 2); | ||
} | ||
|
||
//----------------------------------------------------------------------------------- | ||
void TrackFoldedOccupancyClient::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) | ||
//----------------------------------------------------------------------------------- | ||
{ | ||
edm::LogInfo("TrackFoldedOccupancyClient") << "TrackFoldedOccupancyClient::endLuminosityBlock"; | ||
|
||
bookMEs(ibooker); | ||
std::string inFolder = TopFolder_ + "/" + quality_ + "/GeneralProperties/"; | ||
|
||
std::string hname; | ||
hname = "TrackEtaPhi_"; | ||
MonitorElement* TrackEtaPhi = igetter.get(inFolder + hname + histTag_); | ||
|
||
hname = "TrackEtaPhiInverted_"; | ||
MonitorElement* TrackEtaPhiInverted = igetter.get(inFolder + hname + histTag_); | ||
|
||
hname = "TrackEtaPhiInvertedoutofphase_"; | ||
MonitorElement* TrackEtaPhiInvertedoutofphase = igetter.get(inFolder + hname + histTag_); | ||
|
||
TkEtaPhi_Ratio_byFoldingmap->divide(TrackEtaPhi, TrackEtaPhiInverted, 1., 1., ""); | ||
TkEtaPhi_Ratio_byFoldingmap_op->divide(TrackEtaPhi, TrackEtaPhiInvertedoutofphase, 1., 1., ""); | ||
|
||
int nx = TrackEtaPhi->getNbinsX(); | ||
int ny = TrackEtaPhi->getNbinsY(); | ||
|
||
for (int ii = 1; ii <= nx; ii++) { | ||
for (int jj = 1; jj <= ny; jj++) { | ||
double Sum1 = TrackEtaPhi->getBinContent(ii, jj) + TrackEtaPhiInverted->getBinContent(ii, jj); | ||
double Sum2 = TrackEtaPhi->getBinContent(ii, jj) + TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); | ||
|
||
double Sub1 = TrackEtaPhi->getBinContent(ii, jj) - TrackEtaPhiInverted->getBinContent(ii, jj); | ||
double Sub2 = TrackEtaPhi->getBinContent(ii, jj) - TrackEtaPhiInvertedoutofphase->getBinContent(ii, jj); | ||
|
||
if (Sum1 == 0 || Sum2 == 0) { | ||
TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, 1); | ||
TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, 1); | ||
} else { | ||
double ratio1 = Sub1 / Sum1; | ||
double ratio2 = Sub2 / Sum2; | ||
TkEtaPhi_RelativeDifference_byFoldingmap->setBinContent(ii, jj, ratio1); | ||
TkEtaPhi_RelativeDifference_byFoldingmap_op->setBinContent(ii, jj, ratio2); | ||
} | ||
} | ||
} | ||
} | ||
|
||
DEFINE_FWK_MODULE(TrackFoldedOccupancyClient); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.