25 namespace HLTOfflineDQMTopSingleLepton {
32 static const double WMASS = 80.4;
35 static const double DRMIN = 0.05;
38 label_(label), elecIso_(0), elecSelect_(0), pvSelect_(0), muonIso_(0), muonSelect_(0), jetIDSelect_(0), includeBTag_(
false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
46 const auto& mets = sources.
getParameter<std::vector<edm::InputTag>>(
"mets");
47 for (
const auto&
met: mets) {
171 hists_[
"pvMult_" ] = store_.
book1D(
"PvMult" ,
"N_{pvs}" , 100, 0., 100.);
173 hists_[
"jetMult_" ] = store_.
book1D(
"JetMult" ,
"N_{20}(jet)" , 10, 0., 10.);
177 hists_[
"triggerMon_" ] = store_.
book1D(
"TriggerMon" ,
"Mon(trigger)" , nPaths, 0., nPaths);
179 hists_[
"massW_" ] = store_.
book1D(
"MassW" ,
"M(W)" , 60, 0., 300.);
181 hists_[
"massTop_" ] = store_.
book1D(
"MassTop" ,
"M(Top)" , 50, 0., 500.);
183 hists_[
"mMub_" ] = store_.
book1D(
"mMub" ,
"m_{#mub}" , 50, 0., 500.);
185 hists_[
"MTWm_" ] = store_.
book1D(
"MTWm" ,
"M_{T}^{W}(#mu)" , 60, 0., 300.);
187 hists_[
"mMTT_" ] = store_.
book1D(
"mMTT" ,
"M_{T}^{t}(#mu)" , 50, 0., 500.);
189 hists_[
"mEb_" ] = store_.
book1D(
"mEb" ,
"m_{eb}" , 50, 0., 500.);
191 hists_[
"MTWe_" ] = store_.
book1D(
"MTWe" ,
"M_{T}^{W}(e)" , 60, 0., 300.);
193 hists_[
"eMTT_" ] = store_.
book1D(
"eMTT" ,
"M_{T}^{t}(e)" , 50, 0., 500.);
197 hists_[
"jetMultBEff_"] = store_.
book1D(
"JetMultBProb",
"N_{20}(b/prob)" , 10, 0., 10.);
199 hists_[
"jetBDiscEff_"] = store_.
book1D(
"JetBDiscProb",
"Disc_{b/prob}(jet)", 25, 0., 2.5);
201 hists_[
"jetMultBPur_"] = store_.
book1D(
"JetMultBPur",
"N_{20}(b/pur)" , 10, 0., 10.);
203 hists_[
"jetBDiscPur_"] = store_.
book1D(
"JetBDiscPur",
"Disc_{b/pur}(Jet)", 100, 0., 10.);
205 hists_[
"jetMultBVtx_"] = store_.
book1D(
"JetMultBVtx",
"N_{20}(b/vtx)" , 10, 0., 10.);
207 hists_[
"jetBDiscVtx_"] = store_.
book1D(
"JetBDiscVtx",
"Disc_{b/vtx}(Jet)", 35, -1., 6.);
209 hists_[
"eventLogger_"] = store_.
book2D(
"EventLogger",
"Logged Events" , 3, 0., 3., 4, 0., 4.);
211 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
212 hists_[
"eventLogger_"]->setBinLabel( 1 ,
"Run" , 1);
213 hists_[
"eventLogger_"]->setBinLabel( 2 ,
"Block" , 1);
214 hists_[
"eventLogger_"]->setBinLabel( 3 ,
"Event" , 1);
215 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts" , 2);
218 hists_[
"leptDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaLepton",
"#Delta R_{min}(leptons) wrt #eta", 30, -3, 3, 10, 0., 0.1);
220 hists_[
"jetDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaJet",
"#Delta R_{min}(jets) wrt #eta", 30, -3, 3, 10, 0., 0.1);
222 hists_[
"leptResolution_"] = store_.
book1D(
"ResIsoLeptons",
"#Delta p_{T}/p_{T}(matched leptons)", 20, 0., 0.1);
224 hists_[
"jetResolution_"] = store_.
book1D(
"ResIsoJets",
"#Delta p_{T}/p_{T}(matched jets)", 20, 0., 0.1);
226 hists_[
"matchingMon_"] = store_.
book1D(
"MatchingMon",
"Mon(matching)", 5, 0., 5.);
228 hists_[
"matchingMon_"]->setBinLabel( 1 ,
"iso lepton" );
229 hists_[
"matchingMon_"]->setBinLabel( 2 ,
"1st jet" );
230 hists_[
"matchingMon_"]->setBinLabel( 3 ,
"2nd jet" );
231 hists_[
"matchingMon_"]->setBinLabel( 4 ,
"3rd jet" );
232 hists_[
"matchingMon_"]->setBinLabel( 5 ,
"all " );
260 <<
"Vertex collection not found \n";
263 unsigned int pvMult = 0;
268 fill(
"pvMult_", pvMult );
282 <<
"Electron collection not found \n";
293 unsigned int eMultIso=0;
294 std::vector<const reco::GsfElectron*> isoElecs;
297 unsigned int idx = elec-elecs->begin();
301 if(!
elecIso_ || (*
elecIso_)(*elec)){
if(eMultIso == 0) e = *elec; isoElecs.push_back(&(*elec)); ++eMultIso;}
315 unsigned int mMultIso=0;
317 std::vector<const reco::Muon*> isoMuons;
320 <<
"Muon collection not found \n";
326 if(
muon->isGlobalMuon() ){
353 if(setup.
find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
359 <<
"------------------------------------------------------------------------------------- \n"
360 <<
" No JetCorrectionsRecord available from EventSetup: \n"
361 <<
" - Jets will not be corrected. \n"
362 <<
" - If you want to change this add the following lines to your cfg file: \n"
364 <<
" ## load jet corrections \n"
365 <<
" process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
366 <<
" process.prefer(\"ak5CaloL2L3\") \n"
368 <<
"------------------------------------------------------------------------------------- \n";
373 std::vector<reco::Jet> correctedJets;
374 unsigned int mult=0, multBEff=0, multBPur=0, multBVtx=0;
379 <<
"Jet collection not found \n";
390 unsigned int idx =
jet-jets->begin();
391 if(
jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
392 if(!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
395 if(dynamic_cast<const reco::CaloJet*>(&*
jet)){
399 else if(dynamic_cast<const reco::PFJet*>(&*
jet)){
410 correctedJets.push_back(monitorJet);
416 double btagEffDisc = (*btagEff)[jetRef];
417 fill(
"jetBDiscEff_", btagEffDisc);
418 if( (*btagEff)[jetRef]>
btagEffWP_ ) ++multBEff;
420 double btagPurDisc = (*btagPur)[jetRef];
421 fill(
"jetBDiscPur_", btagPurDisc);
422 if( (*btagPur)[jetRef]>
btagPurWP_ ) {
if(multBPur == 0) bJetCand = *
jet; ++multBPur;}
424 double btagVtxDisc = (*btagVtx)[jetRef];
425 fill(
"jetBDiscVtx_", btagVtxDisc);
426 if( (*btagVtx)[jetRef]>
btagVtxWP_ ) ++multBVtx;
429 fill(
"jetMult_" , mult );
430 fill(
"jetMultBEff_", multBEff);
431 fill(
"jetMultBPur_", multBPur);
432 fill(
"jetMultBVtx_", multBVtx);
447 if(met->begin()!=met->end()){
448 mET = *(met->begin());
462 double wMass = eventKinematics.
massWBoson (correctedJets);
463 double topMass = eventKinematics.
massTopQuark(correctedJets);
464 if(wMass>=0 && topMass>=0) {
fill(
"massW_" , wMass );
fill(
"massTop_" , topMass);}
468 if(
logged_<=
hists_.find(
"eventLogger_")->second->getNbinsY()){
477 if(multBPur != 0 && mMultIso == 1 ){
478 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWm_",mtW);
479 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mMub_", Mlb);
480 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"mMTT_", MTT);
483 if(multBPur != 0 && eMultIso == 1 ){
484 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
if (mtW == mtW)
fill(
"MTWe_",mtW);
485 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
if (Mlb == Mlb)
fill(
"mEb_", Mlb);
486 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
if (MTT == MTT)
fill(
"eMTT_", MTT);
503 bool isInteresting =
false;
504 for (
unsigned int j=0;
j<triggerPaths.size();
j++) {
505 if (TString(name.c_str()).Contains(TString(triggerPaths[
j]), TString::kIgnoreCase)) isInteresting =
true;
507 if (!isInteresting)
continue;
509 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
511 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
512 const unsigned int moduleIndex(triggerTable->index(triggerIndex));
518 unsigned int kElec=0;
519 unsigned int kMuon=0;
521 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
522 const string& moduleLabel(moduleLabels[
k]);
523 const string moduleType(hltConfig.
moduleType(moduleLabel));
526 if (filterIndex<triggerEventWithRefsHandle->
size()) {
529 if (nElectrons>0) kElec =
k;
532 const unsigned int nMuons(
muonIds_.size());
533 if (nMuons>0) kMuon =
k;
536 const unsigned int nPFJets(
pfjetIds_.size());
537 if (nPFJets>0) kJet =
k;
541 bool lMatched =
false;
542 bool j1Matched =
false;
543 bool j2Matched =
false;
544 bool j3Matched =
false;
546 double eDeltaRMin = 500.;
547 unsigned int eIndMatched = 500;
550 const string& moduleLabelElec(moduleLabels[kElec]);
551 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
552 const unsigned int filterIndexElec(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelElec,
"",
processName_)));
554 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
556 if (deltar < eDeltaRMin) {
561 if (eDeltaRMin <
DRMIN) lMatched =
true;
565 double mDeltaRMin = 500.;
566 unsigned int mIndMatched = 500;
568 const string& moduleLabelMuon(moduleLabels[kMuon]);
569 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
570 const unsigned int filterIndexMuon(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelMuon,
"",
processName_)));
572 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
574 if (deltar < mDeltaRMin) {
579 if (mDeltaRMin <
DRMIN) lMatched =
true;
582 const unsigned int nPFJets(
pfjetIds_.size());
584 double j1DeltaRMin = 500.;
585 double j2DeltaRMin = 500.;
586 double j3DeltaRMin = 500.;
587 unsigned int j1IndMatched = 500;
588 unsigned int j2IndMatched = 500;
589 unsigned int j3IndMatched = 500;
591 const string& moduleLabelJet(moduleLabels[kJet]);
592 const string moduleTypeJet(hltConfig.
moduleType(moduleLabelJet));
593 const unsigned int filterIndexJet(triggerEventWithRefsHandle->filterIndex(
edm::InputTag(moduleLabelJet,
"",
processName_)));
595 for (
unsigned int indj = 0; indj < correctedJets.size(); indj++) {
597 if (deltar1 < j1DeltaRMin) {j1DeltaRMin = deltar1; j1IndMatched = indj;}
600 if (deltar2 < j2DeltaRMin) {j2DeltaRMin = deltar2; j2IndMatched = indj;}
603 if (deltar3 < j3DeltaRMin) {j3DeltaRMin = deltar3; j3IndMatched = indj;}
607 if (nPFJets > 0 && j1DeltaRMin <
DRMIN) j1Matched =
true;
608 if (nPFJets > 1 && j2DeltaRMin <
DRMIN) j2Matched =
true;
609 if (nPFJets > 2 && j3DeltaRMin <
DRMIN) j3Matched =
true;
611 if (eIndMatched < 500) {
612 fill(
"leptDeltaREta_", isoElecs[eIndMatched]->
eta(), eDeltaRMin);
613 if (lMatched)
fill(
"leptResolution_", fabs(isoElecs[eIndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[eIndMatched]->
pt() );
615 if (mIndMatched < 500) {
616 fill(
"leptDeltaREta_", isoMuons[mIndMatched]->
eta(), mDeltaRMin);
617 if (lMatched)
fill(
"leptResolution_", fabs(isoMuons[mIndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[mIndMatched]->
pt() );
619 if (lMatched)
fill(
"matchingMon_", 0.5 );
620 else isMatched =
false;
621 if (j1IndMatched < 500) {
622 fill(
"jetDeltaREta_", correctedJets[j1IndMatched].
eta(), j1DeltaRMin);
624 fill(
"jetResolution_", fabs(correctedJets[j1IndMatched].
pt()-
pfjetRefs_[0]->
pt())/correctedJets[j1IndMatched].
pt() );
625 fill(
"matchingMon_", 1.5 );
627 else isMatched =
false;
628 if (j2IndMatched < 500) {
629 fill(
"jetDeltaREta_", correctedJets[j2IndMatched].
eta(), j2DeltaRMin);
631 fill(
"jetResolution_", fabs(correctedJets[j2IndMatched].
pt()-
pfjetRefs_[1]->
pt())/correctedJets[j2IndMatched].
pt() );
632 fill(
"matchingMon_", 2.5 );
634 else isMatched =
false;
635 if (j3IndMatched < 500) {
636 fill(
"jetDeltaREta_", correctedJets[j3IndMatched].
eta(), j3DeltaRMin);
638 fill(
"jetResolution_", fabs(correctedJets[j3IndMatched].
pt()-
pfjetRefs_[2]->
pt())/correctedJets[j3IndMatched].
pt() );
639 fill(
"matchingMon_", 3.5 );
641 else isMatched =
false;
645 if (isMatched)
fill(
"matchingMon_", 4.5 );
676 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
677 for(
unsigned int i=0;
i<sel.size(); ++
i){
688 if (
type ==
"muons"){
691 if (
type ==
"elecs"){
697 if (
type ==
"jets/pf"){
700 if (
type ==
"jets/calo"){
718 <<
"Config extraction failure with process name "
736 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
759 for(std::vector<std::string>::const_iterator selIt2=
selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
763 if(type2==
"Hlt" || type2==
"empty" )
continue;
769 if ( !passSel )
continue;
781 sel.second.second->book(i);
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
tuple met
____________________________________________________________________________||
const std::string moduleType(const std::string &module) const
C++ class name of module.
HLTConfigProvider hltConfig_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
std::map< std::string, SelectionStepHLTBase * > selectmap_
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
double masslb(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate mlb estimate
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate top quark mass estimate
static const double WMASS
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int logged_
number of logged interesting events
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
std::string jetCorrector_
jetCorrector
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
Base class for all types of Jets.
double tmassTopQuark(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate top quark transverse mass estimate
StringCutObjectSelector< reco::Vertex > * pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
std::map< std::string, MonitorElement * > hists_
histogram container
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
virtual void scaleEnergy(double fScale)
scale energy of the jet
trigger::VRelectron electronRefs_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
std::string selectionStep(const std::string &label)
double lowerEdge_
mass window upper and lower edge
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
void book(DQMStore::IBooker &store_)
book histograms in subdirectory directory
std::vector< std::string > selectionOrder_
Strings const & triggerNames() const
Jets made from PFObjects.
static const double DRMIN
LuminosityBlockNumber_t luminosityBlock() const
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
static const unsigned int MAXJETS
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerEventWithRefsTag_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
unsigned int triggerIndex(std::string const &name) const
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
void fill(const edm::Event &event, const edm::EventSetup &setup, const HLTConfigProvider &hltConfig, const std::vector< std::string > triggerPaths)
fill monitor histograms with electronId and jetCorrections
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
std::map< std::string, std::pair< edm::ParameterSet, HLTOfflineDQMTopSingleLepton::MonitorSingleLepton * > > selection_
std::vector< std::string > triggerPaths_
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
MonitorElement * book1D(Args &&...args)
std::string label_
instance label
bool isMatched(TrackingRecHit const &hit)
void triggerBinLabels(std::string channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
trigger::VRpfjet pfjetRefs_
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
double tmassWBoson(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate W boson transverse mass estimate
const std::string & processName() const
process name
std::vector< std::string > triggerPaths_
trigger paths
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c)
do this during the event loop
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
EventAuxiliary const & eventAuxiliary() const
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
void setCurrentFolder(const std::string &fullpath)
std::string processName_
hlt objects
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
MonitorElement * book2D(Args &&...args)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
double btagEffWP_
btag working points
static const double DRMIN
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
std::string objectType(const std::string &label)
TopSingleLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
trigger::VRmuon muonRefs_
bool isUninitialized() const
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
volatile std::atomic< bool > shutdown_flag false
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
static std::string const triggerPaths
static const double WMASS
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
EventNumber_t event() const
trigger::Vids electronIds_