-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
DQM Pixel Phase 1: Several new Efficiency trend plots #34384
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: SiPixelPhase1EfficiencyExtras | ||
// Class: SiPixelPhase1EfficiencyExtras | ||
// | ||
/**\class | ||
|
||
Description: Create the Phase 1 extra efficiency trend plots | ||
|
||
Implementation: | ||
<Notes on implementation> | ||
*/ | ||
// | ||
// Original Author: Jack Sisson, Julie Hogan | ||
// Created: 7 July, 2021 | ||
// | ||
// | ||
|
||
// Framework | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDAnalyzer.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this include needed? |
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/EDProducer.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this include needed? |
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "FWCore/Framework/interface/LuminosityBlock.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this include needed? |
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this include needed? |
||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
// DQM Framework | ||
#include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this include needed? |
||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "DQMServices/Core/interface/DQMEDHarvester.h" | ||
// Geometry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are all those Geometry related includes needed? |
||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" | ||
#include "Geometry/CommonTopologies/interface/PixelTopology.h" | ||
#include "Geometry/Records/interface/TrackerTopologyRcd.h" | ||
// DataFormats | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are all these Dataformats includes needed? |
||
#include "DataFormats/DetId/interface/DetId.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" | ||
// | ||
#include <string> | ||
#include <cstdlib> | ||
#include <iostream> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure whethere these io related include's are needed: please check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @perrotta All the include statements that you commented on have been removed! Let me know if you notice anything else. |
||
#include <fstream> | ||
#include <sstream> | ||
|
||
using namespace std; | ||
using namespace edm; | ||
|
||
class SiPixelPhase1EfficiencyExtras : public DQMEDHarvester { | ||
public: | ||
explicit SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& conf); | ||
~SiPixelPhase1EfficiencyExtras() override; | ||
|
||
protected: | ||
void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override; | ||
|
||
void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override; | ||
|
||
std::string effFolderName_; | ||
std::string vtxFolderName_; | ||
std::string instLumiFolderName_; | ||
|
||
private: | ||
edm::ParameterSet conf_; | ||
}; | ||
|
||
SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras(const edm::ParameterSet& iConfig) : conf_(iConfig) { | ||
LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::SiPixelPhase1EfficiencyExtras: Hello!" << endl; | ||
effFolderName_ = conf_.getParameter<std::string>("EffFolderName"); | ||
vtxFolderName_ = conf_.getParameter<std::string>("VtxFolderName"); | ||
instLumiFolderName_ = conf_.getParameter<std::string>("InstLumiFolderName"); | ||
} | ||
|
||
SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras() { | ||
// do anything here that needs to be done at desctruction time | ||
// (e.g. close files, deallocate resources etc.) | ||
LogInfo("PixelDQM") << "SiPixelPhase1EfficiencyExtras::~SiPixelPhase1EfficiencyExtras: Destructor" << endl; | ||
} | ||
|
||
void SiPixelPhase1EfficiencyExtras::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) {} | ||
|
||
//------------------------------------------------------------------ | ||
// Method called for every event | ||
//------------------------------------------------------------------ | ||
void SiPixelPhase1EfficiencyExtras::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) { | ||
iBooker.setCurrentFolder(effFolderName_); | ||
|
||
//Get the existing histos | ||
MonitorElement* vtx_v_lumi = iGetter.get(vtxFolderName_ + "/NumberOfGoodPVtxVsLS_GenTk"); | ||
|
||
MonitorElement* scalLumi_v_lumi = iGetter.get(instLumiFolderName_ + "/lumiVsLS"); | ||
|
||
MonitorElement* eff_v_lumi_forward = | ||
iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXDisk_PXForward"); | ||
|
||
MonitorElement* eff_v_lumi_barrel = | ||
iGetter.get(effFolderName_ + "/hitefficiency_per_Lumisection_per_PXLayer_PXBarrel"); | ||
|
||
//set up some booleans that will tell us which graphs to create | ||
bool createNvtx = true; | ||
bool createInstLumi = true; | ||
|
||
//check which of the MEs exist and respond appropriately | ||
if (!eff_v_lumi_forward) { | ||
edm::LogWarning("SiPixelPhase1EfficiencyExtras") | ||
<< "no hitefficiency_per_Lumisection_per_PXDisk_PXForward ME is available in " << effFolderName_ << std::endl; | ||
return; | ||
} | ||
if (!eff_v_lumi_barrel) { | ||
edm::LogWarning("SiPixelPhase1EfficiencyExtras") | ||
<< "no hitefficiency_per_Lumisection_per_PXLayer_PXBarrel ME is available in " << effFolderName_ << std::endl; | ||
return; | ||
} | ||
if (!vtx_v_lumi) { | ||
edm::LogWarning("SiPixelPhase1EfficiencyExtras") | ||
<< "no NumberOfGoodPVtxVsLS_GenTK ME is available in " << vtxFolderName_ << std::endl; | ||
createNvtx = false; | ||
} | ||
if (!scalLumi_v_lumi) { | ||
edm::LogWarning("SiPixelPhase1EfficiencyExtras") | ||
<< "no lumiVsLS ME is available in " << instLumiFolderName_ << std::endl; | ||
createInstLumi = false; | ||
} | ||
|
||
//If the existing MEs are empty, set the boolean to skip booking | ||
if (vtx_v_lumi && vtx_v_lumi->getEntries() == 0) | ||
createNvtx = false; | ||
if (scalLumi_v_lumi && scalLumi_v_lumi->getEntries() == 0) | ||
createInstLumi = false; | ||
|
||
double eff = 0.0; | ||
|
||
//Will pass if nvtx ME exists and is not empty | ||
if (createNvtx) { | ||
//Book new histos | ||
MonitorElement* eff_v_vtx_barrel = | ||
iBooker.book2D("hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel", | ||
"hitefficiency_per_meanNvtx_per_PXLayer_PXBarrel; meanNvtx; PXLayer", | ||
500, | ||
0, | ||
100, | ||
3, | ||
.5, | ||
3.5); | ||
|
||
MonitorElement* eff_v_vtx_forward = | ||
iBooker.book2D("hitefficiency_per_meanNvtx_per_PXDisk_PXForward", | ||
"hitefficiency_per_meanNvtx_per_PXDisk_PXForward; meanNvtx; PXDisk", | ||
500, | ||
0, | ||
100, | ||
7, | ||
-3.5, | ||
3.5); | ||
|
||
//initialize variables | ||
int numLumiNvtx = int(vtx_v_lumi->getNbinsX()); | ||
double nvtx = 0.0; | ||
int binNumVtx = 0; | ||
|
||
//For loop to loop through lumisections | ||
for (int iLumi = 1; iLumi < numLumiNvtx - 1; iLumi++) { | ||
//get the meanNvtx for each lumi | ||
nvtx = vtx_v_lumi->getBinContent(iLumi); | ||
|
||
//Filter out useless iterations | ||
if (nvtx != 0) { | ||
//Grab the bin number for the nvtx | ||
binNumVtx = eff_v_vtx_barrel->getTH2F()->FindBin(nvtx); | ||
|
||
//loop through the layers | ||
for (int iLayer = 1; iLayer < 8; iLayer++) { | ||
//get the eff at the lumisection and layer | ||
eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); | ||
|
||
//set the efficiency in the new histo | ||
eff_v_vtx_forward->setBinContent(binNumVtx, iLayer, eff); | ||
} | ||
|
||
//loop through the layers | ||
for (int iLayer = 1; iLayer < 5; iLayer++) { | ||
//get the efficiency for each lumi at each layer | ||
eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); | ||
|
||
//set the efficiency | ||
eff_v_vtx_barrel->setBinContent(binNumVtx, iLayer, eff); | ||
} | ||
} | ||
} | ||
} | ||
// Will pass if InstLumi ME exists and is not empty | ||
if (createInstLumi) { | ||
//Get the max value of inst lumi for plot | ||
int yMax2 = scalLumi_v_lumi->getTProfile()->GetMaximum(); | ||
yMax2 = yMax2 + yMax2 * .1; | ||
|
||
//Book new histos | ||
MonitorElement* eff_v_scalLumi_barrel = | ||
iBooker.book2D("hitefficiency_per_scalLumi_per_PXLayer_PXBarrel", | ||
"hitefficiency_per_scalLumi_per_PXLayer_PXBarrel; scal inst lumi E30; PXLayer", | ||
500, | ||
0, | ||
yMax2, | ||
3, | ||
.5, | ||
3.5); | ||
|
||
MonitorElement* eff_v_scalLumi_forward = | ||
iBooker.book2D("hitefficiency_per_scalLumi_per_PXDisk_PXForward", | ||
"hitefficiency_per_scalLumi_per_PXDisk_PXForward; scal inst lumi E30; PXDisk", | ||
500, | ||
0, | ||
yMax2, | ||
7, | ||
-3.5, | ||
3.5); | ||
|
||
//initialize variables | ||
int numLumiScal = int(scalLumi_v_lumi->getNbinsX()); | ||
double scalLumi = 0.0; | ||
int binNumScal = 0; | ||
|
||
//For loop to loop through lumisections | ||
for (int iLumi = 1; iLumi < numLumiScal - 1; iLumi++) { | ||
//get the inst lumi for each lumi | ||
scalLumi = scalLumi_v_lumi->getBinContent(iLumi); | ||
|
||
//Filter out useless iterations | ||
if (scalLumi != 0) { | ||
//Grab the bin number for the inst lumi | ||
binNumScal = eff_v_scalLumi_barrel->getTH2F()->FindBin(scalLumi); | ||
|
||
//loop through the layers | ||
for (int iLayer = 1; iLayer < 8; iLayer++) { | ||
//get the eff at the lumisection and layer | ||
eff = eff_v_lumi_forward->getBinContent(iLumi - 1, iLayer); | ||
|
||
//set the efficiency in the new histo | ||
eff_v_scalLumi_forward->setBinContent(binNumScal, iLayer, eff); | ||
} | ||
|
||
//loop through the layers | ||
for (int iLayer = 1; iLayer < 5; iLayer++) { | ||
//get the eff at the lumisection and layer | ||
eff = eff_v_lumi_barrel->getBinContent(iLumi - 1, iLayer); | ||
|
||
//set the efficiency in the new histo | ||
eff_v_scalLumi_barrel->setBinContent(binNumScal, iLayer, eff); | ||
} | ||
} | ||
} | ||
} else | ||
return; | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(SiPixelPhase1EfficiencyExtras); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester | ||
|
||
|
||
SiPixelPhase1EfficiencyExtras = DQMEDHarvester("SiPixelPhase1EfficiencyExtras", | ||
EffFolderName = cms.string('PixelPhase1/Tracks/'), | ||
VtxFolderName = cms.string('Tracking/TrackParameters/generalTracks/GeneralProperties/'), | ||
InstLumiFolderName = cms.string('HLT/LumiMonitoring/') | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cfi is importing the module but SiPixelPhase1EfficiencyExtras is not added to the sequence, is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in OfflineDQM_source_cff is imported to OfflineDQM_harvesting_cff:
from DQM.SiPixelPhase1Config.SiPixelPhase1OfflineDQM_source_cff import *
The sequence this module appears in is: siPixelPhase1OfflineDQM_harvesting