30 const double lep_counting_threshold,
const double lep_iso_cut,
const double lep_eta_cut,
31 const double d0_cut_b,
const double dz_cut_b,
const double d0_cut_e,
const double dz_cut_e) {
34 if (!pass_id)
return false;
42 +
std::max(0.0, iso.sumNeutralHadronEt + iso.sumPhotonEt -0.5 * iso.sumPUPt);
43 const float relisowithdb = absiso/el.
pt();
44 if (relisowithdb>lep_iso_cut)
return false;
47 bool pass_conversion =
false;
52 edm::LogError(
"LepHTMonitor") <<
"Electron conversion matching failed.\n";
54 if (!pass_conversion)
return false;
58 float d0 = 999.,
dz=999.;
60 d0=-(el.
gsfTrack()->dxy(pv_position));
64 edm::LogError(
"LepHTMonitor") <<
"Could not read electron.gsfTrack().\n";
80 const double lep_counting_threshold,
const double lep_iso_cut,
const double lep_eta_cut,
81 const double d0_cut,
const double dz_cut,
int muonIDlevel) {
86 if (mu.
pt()<lep_counting_threshold ||
std::abs(mu.
eta())>lep_eta_cut)
return false;
91 +
std::max(0.0, iso.sumNeutralHadronEt + iso.sumPhotonEt -0.5 * iso.sumPUPt);
92 const float relisowithdb = absiso/mu.
pt();
93 if (relisowithdb>lep_iso_cut)
return false;
101 if (!pass_id)
return false;
106 if (d0>d0_cut || dz>dz_cut)
return false;
113 theElectronTag_(ps.getParameter<
edm::
InputTag>(
"electronCollection")),
115 theElectronVIDTag_(ps.getParameter<
edm::
InputTag>(
"electronVID")),
116 theElectronVIDMap_(consumes<
edm::
ValueMap<
bool> >(theElectronVIDTag_)),
117 theMuonTag_(ps.getParameter<
edm::
InputTag>(
"muonCollection")),
119 thePfMETTag_(ps.getParameter<
edm::
InputTag>(
"pfMetCollection")),
121 thePfJetTag_(ps.getParameter<
edm::
InputTag>(
"pfJetCollection")),
123 theJetTagTag_(ps.getParameter<
edm::
InputTag>(
"jetTagCollection")),
125 theVertexCollectionTag_(ps.getParameter<
edm::
InputTag>(
"vertexCollection")),
127 theConversionCollectionTag_(ps.getParameter<
edm::
InputTag>(
"conversionCollection")),
129 theBeamSpotTag_(ps.getParameter<
edm::
InputTag>(
"beamSpot")),
130 theBeamSpot_(consumes<
reco::
BeamSpot>(theBeamSpotTag_)),
136 folderName_(ps.getParameter<
std::
string>(
"folderName")),
138 muonIDlevel_(ps.getUntrackedParameter<
int>(
"muonIDlevel")),
140 jetPtCut_(ps.getUntrackedParameter<double>(
"jetPtCut")),
141 jetEtaCut_(ps.getUntrackedParameter<double>(
"jetEtaCut")),
142 metCut_(ps.getUntrackedParameter<double>(
"metCut")),
143 htCut_(ps.getUntrackedParameter<double>(
"htCut")),
145 nmusCut_(ps.getUntrackedParameter<double>(
"nmus")),
146 nelsCut_(ps.getUntrackedParameter<double>(
"nels")),
147 lep_pt_plateau_(ps.getUntrackedParameter<double>(
"leptonPtPlateau")),
148 lep_counting_threshold_(ps.getUntrackedParameter<double>(
"leptonCountingThreshold")),
149 lep_iso_cut_(ps.getUntrackedParameter<double>(
"lepIsoCut")),
150 lep_eta_cut_(ps.getUntrackedParameter<double>(
"lepEtaCut")),
151 lep_d0_cut_b_(ps.getUntrackedParameter<double>(
"lep_d0_cut_b")),
152 lep_dz_cut_b_(ps.getUntrackedParameter<double>(
"lep_dz_cut_b")),
153 lep_d0_cut_e_(ps.getUntrackedParameter<double>(
"lep_d0_cut_e")),
154 lep_dz_cut_e_(ps.getUntrackedParameter<double>(
"lep_dz_cut_e")),
155 ptbins_(ps.getParameter<
std::vector<double> >(
"ptbins")),
156 htbins_(ps.getParameter<
std::vector<double> >(
"htbins")),
158 nbins_eta_(ps.getUntrackedParameter<
int>(
"nbins_eta")),
159 nbins_phi_(ps.getUntrackedParameter<
int>(
"nbins_phi")),
160 nbins_npv_(ps.getUntrackedParameter<
int>(
"nbins_npv")),
161 etabins_min_(ps.getUntrackedParameter<double>(
"etabins_min")),
162 etabins_max_(ps.getUntrackedParameter<double>(
"etabins_max")),
163 phibins_min_(ps.getUntrackedParameter<double>(
"phibins_min")),
164 phibins_max_(ps.getUntrackedParameter<double>(
"phibins_max")),
165 npvbins_min_(ps.getUntrackedParameter<double>(
"npvbins_min")),
166 npvbins_max_(ps.getUntrackedParameter<double>(
"npvbins_max")),
180 <<
"Constructor LepHTMonitor::LepHTMonitor\n";
185 <<
"Destructor LepHTMonitor::~LepHTMonitor\n";
189 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::beginRun\n";
194 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::bookHistograms\n";
209 if (is_mu && !is_ele) {
212 }
else if (is_ele && !is_mu) {
223 vector<float> f_ptbins;
224 for(
double ptbin :
ptbins_) f_ptbins.push_back(static_cast<float>(ptbin));
225 vector<float> f_htbins;
226 for(
double htbin :
htbins_) f_htbins.push_back(static_cast<float>(htbin));
229 h_pfHTTurnOn_num_ = ibooker.
book1D(
"pfHTTurnOn_num",
"Numerator;Offline H_{T} [GeV];", f_htbins.size()-1, f_htbins.data());
230 h_pfHTTurnOn_den_ = ibooker.
book1D(
"pfHTTurnOn_den",
"Denominator;Offline H_{T} [GeV];", f_htbins.size()-1, f_htbins.data());
232 h_lepPtTurnOn_num_ = ibooker.
book1D(
"lepPtTurnOn_num", (
"Numerator;Offline "+lepton+
" p_{T} [GeV];").c_str(), f_ptbins.size()-1, f_ptbins.data());
233 h_lepPtTurnOn_den_ = ibooker.
book1D(
"lepPtTurnOn_den", (
"Denominator;Offline "+lepton+
" p_{T} [GeV];").c_str(), f_ptbins.size()-1, f_ptbins.data());
250 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::analyze\n";
253 bool hasFired =
false;
254 bool hasFiredAuxiliary =
false;
255 bool hasFiredLeptonAuxiliary =
false;
260 if (!(hasFiredAuxiliary || hasFiredLeptonAuxiliary))
return;
266 if ( !VertexCollection.
isValid() ) {
270 else npv = VertexCollection->size();
278 if (!ele_id_decisions.
isValid()) {
288 if ( !ConversionCollection.
isValid() ) {
308 if ( !pfMETCollection.
isValid() ) {
318 if ( !pfJetCollection.
isValid() ) {
328 if ( !ElectronCollection.
isValid() ) {
338 if ( !MuonCollection.
isValid() ) {
346 if (pfJetCollection.
isValid()) {
348 for(
auto const &pfjet: *pfJetCollection) {
357 if (pfMETCollection.
isValid() && !pfMETCollection->empty()) {
358 pfMET = pfMETCollection->front().et();
363 double lep_max_pt = -1.0;
366 double trailing_ele_eta=0;
367 double trailing_ele_phi=0;
368 double trailing_mu_eta=0;
369 double trailing_mu_phi=0;
370 double min_ele_pt= -1.0;
371 double min_mu_pt=-1.0;
374 if (VertexCollection.
isValid() && !VertexCollection->empty()) {
376 if (ElectronCollection.
isValid()
377 && ConversionCollection.
isValid()
379 && ele_id_decisions.
isValid()) {
381 for(
auto const &
electron: *ElectronCollection) {
382 const auto el = ElectronCollection->ptrAt(index);
383 bool pass_id = (*ele_id_decisions)[el];
384 if (isGood(
electron, VertexCollection->front().position(),
398 if (MuonCollection.
isValid()) {
399 for(
auto const &
muon: *MuonCollection) {
401 if (
muon.pt()>lep_max_pt) {lep_max_pt=
muon.pt(); lep_eta=
muon.eta();lep_phi=
muon.phi();}
402 if (
muon.pt()<min_mu_pt || min_mu_pt<0) {min_mu_pt=
muon.pt(); trailing_mu_eta=
muon.eta(); trailing_mu_phi=
muon.phi();}
411 float lep_pt = lep_max_pt;
414 if (
nmusCut_>=2) {lep_pt = min_mu_pt; lep_eta = trailing_mu_eta; lep_phi = trailing_mu_phi;}
415 if (
nelsCut_>=2) {lep_pt = min_ele_pt; lep_eta = trailing_ele_eta; lep_phi = trailing_ele_phi;}
417 if (min_ele_pt<min_mu_pt) {
419 lep_eta = trailing_ele_eta;
420 lep_phi = trailing_ele_phi;
423 lep_eta = trailing_mu_eta;
424 lep_phi = trailing_mu_phi;
432 if (hasFiredLeptonAuxiliary || !e.
isRealData()) {
459 if (nleps_cut && lep_plateau ) {
471 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::endRun\n";
const PflowIsolationVariables & pfIsolationVariables() const
edm::EDGetTokenT< edm::ValueMap< bool > > theElectronVIDMap_
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
bool isNonnull() const
Checks for non-null.
double eta() const final
momentum pseudorapidity
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
MonitorElement * h_pfHTTurnOn_num_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::InputTag thePfMETTag_
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_lepEtaTurnOn_den_
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
math::XYZPoint Point
point in the space
MonitorElement * h_pfHTTurnOn_den_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
MonitorElement * h_lepPhiTurnOn_num_
const Point & position() const
position
MonitorElement * h_NPVTurnOn_num_
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::vector< Muon > MuonCollection
collection of Muon objects
bool isLooseMuon(const reco::Muon &)
std::vector< double > ptbins_
edm::EDGetTokenT< reco::PFMETCollection > thePfMETCollection_
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
std::unique_ptr< GenericTriggerEventFlag > den_lep_genTriggerEventFlag_
virtual TrackRef muonBestTrack() const
edm::EDGetTokenT< edm::View< reco::GsfElectron > > theElectronCollection_
edm::InputTag thePfJetTag_
edm::InputTag theElectronTag_
edm::EDGetTokenT< reco::BeamSpot > theBeamSpot_
MonitorElement * h_lepPtTurnOn_den_
MonitorElement * h_lepPtTurnOn_num_
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
math::XYZPoint Point
point in the space
edm::EDGetTokenT< reco::ConversionCollection > theConversionCollection_
edm::InputTag theMuonTag_
void analyze(const edm::Event &e, const edm::EventSetup &eSetup) override
std::vector< Electron > ElectronCollection
collectin of Electron objects
edm::EDGetTokenT< reco::PFJetCollection > thePfJetCollection_
double lep_counting_threshold_
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
MonitorElement * h_NPVTurnOn_den_
const MuonPFIsolation & pfIsolationR04() const
std::unique_ptr< GenericTriggerEventFlag > num_genTriggerEventFlag_
std::vector< PFJet > PFJetCollection
collection of PFJet objects
MonitorElement * h_lepEtaPhiTurnOn_den_
std::vector< double > htbins_
SuperClusterRef superCluster() const override
reference to a SuperCluster
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &e) override
const Point & position() const
position
void endRun(const edm::Run &run, const edm::EventSetup &eSetup) override
edm::EDGetTokenT< reco::VertexCollection > theVertexCollection_
std::unique_ptr< GenericTriggerEventFlag > den_HT_genTriggerEventFlag_
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
edm::InputTag theConversionCollectionTag_
edm::InputTag theElectronVIDTag_
MonitorElement * h_lepEtaPhiTurnOn_num_
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
MonitorElement * h_lepPhiTurnOn_den_
LepHTMonitor(const edm::ParameterSet &ps)
edm::InputTag theVertexCollectionTag_
edm::EDGetTokenT< reco::MuonCollection > theMuonCollection_
edm::InputTag theBeamSpotTag_
MonitorElement * h_lepEtaTurnOn_num_
float sumChargedHadronPt
sum-pt of charged Hadron