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::beginLuminosityBlock\n";
254 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::analyze\n";
257 bool hasFired =
false;
258 bool hasFiredAuxiliary =
false;
259 bool hasFiredLeptonAuxiliary =
false;
264 if (!(hasFiredAuxiliary || hasFiredLeptonAuxiliary))
return;
270 if ( !VertexCollection.
isValid() ) {
274 else npv = VertexCollection->size();
282 if (!ele_id_decisions.
isValid()) {
292 if ( !ConversionCollection.
isValid() ) {
312 if ( !pfMETCollection.
isValid() ) {
322 if ( !pfJetCollection.
isValid() ) {
332 if ( !ElectronCollection.
isValid() ) {
342 if ( !MuonCollection.
isValid() ) {
350 if (pfJetCollection.
isValid()) {
352 for(
auto const &pfjet: *pfJetCollection) {
361 if (pfMETCollection.
isValid() && pfMETCollection->size()) {
362 pfMET = pfMETCollection->front().et();
367 double lep_max_pt = -1.0;
370 double trailing_ele_eta=0;
371 double trailing_ele_phi=0;
372 double trailing_mu_eta=0;
373 double trailing_mu_phi=0;
374 double min_ele_pt= -1.0;
375 double min_mu_pt=-1.0;
378 if (VertexCollection.
isValid() && VertexCollection->size()) {
380 if (ElectronCollection.
isValid()
381 && ConversionCollection.
isValid()
383 && ele_id_decisions.
isValid()) {
385 for(
auto const &
electron: *ElectronCollection) {
386 const auto el = ElectronCollection->ptrAt(index);
387 bool pass_id = (*ele_id_decisions)[el];
388 if (isGood(
electron, VertexCollection->front().position(),
402 if (MuonCollection.
isValid()) {
403 for(
auto const &
muon: *MuonCollection) {
405 if (
muon.pt()>lep_max_pt) {lep_max_pt=
muon.pt(); lep_eta=
muon.eta();lep_phi=
muon.phi();}
406 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();}
415 float lep_pt = lep_max_pt;
418 if (
nmusCut_>=2) {lep_pt = min_mu_pt; lep_eta = trailing_mu_eta; lep_phi = trailing_mu_phi;}
419 if (
nelsCut_>=2) {lep_pt = min_ele_pt; lep_eta = trailing_ele_eta; lep_phi = trailing_ele_phi;}
421 if (min_ele_pt<min_mu_pt) {
423 lep_eta = trailing_ele_eta;
424 lep_phi = trailing_ele_phi;
427 lep_eta = trailing_mu_eta;
428 lep_phi = trailing_mu_phi;
436 if (hasFiredLeptonAuxiliary || !e.
isRealData()) {
463 if (nleps_cut && lep_plateau ) {
476 <<
"LepHTMonitor::endLuminosityBlock\n";
480 edm::LogInfo(
"LepHTMonitor") <<
"LepHTMonitor::endRun\n";
const PflowIsolationVariables & pfIsolationVariables() const
edm::EDGetTokenT< edm::ValueMap< bool > > theElectronVIDMap_
virtual double pt() const final
transverse momentum
bool isNonnull() const
Checks for non-null.
virtual double eta() const final
momentum pseudorapidity
MonitorElement * h_pfHTTurnOn_num_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::InputTag thePfMETTag_
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_lepEtaTurnOn_den_
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_
void endLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &eSetup) override
bool isMediumMuon(const reco::Muon &)
const Point & position() const
position
MonitorElement * h_NPVTurnOn_num_
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &eSetup) override
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_
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
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_
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_
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
edm::InputTag theBeamSpotTag_
MonitorElement * h_lepEtaTurnOn_num_
float sumChargedHadronPt
sum-pt of charged Hadron