11 namespace TopHLTSingleLepton {
18 static const double WMASS = 80.4;
21 label_(label), elecIso_(0), elecSelect_(0), pvSelect_(0), muonIso_(0), muonSelect_(0), jetIDSelect_(0), includeBTag_(
false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
36 if( elecExtras.
existsAs<std::string>(
"select") ){
41 if( elecExtras.
existsAs<std::string>(
"isolation") ){
57 if( pvExtras.
existsAs<std::string>(
"select") ){
66 if( muonExtras.
existsAs<std::string>(
"select") ){
71 if( muonExtras.
existsAs<std::string>(
"isolation") ){
82 if( jetExtras.
existsAs<std::string>(
"jetCorrector") ){
94 if( jetExtras.
existsAs<std::string>(
"select") ){
135 if(monitoring.
getParameter<std::string>(
"verbosity") ==
"DEBUG" )
137 if(monitoring.
getParameter<std::string>(
"verbosity") ==
"VERBOSE" )
139 if(monitoring.
getParameter<std::string>(
"verbosity") ==
"STANDARD")
175 hists_[
"triggerEff_" ] =
store_->
book1D(
"TriggerEff" ,
"Eff(trigger)" , nPaths, 0., nPaths);
177 hists_[
"triggerMon_" ] =
store_->
book1D(
"TriggerMon" ,
"Mon(trigger)" , nPaths, 0., nPaths);
210 hists_[
"muonRelIso_" ] =
store_->
book1D(
"MuonRelIso" ,
"Iso_{Rel}(#mu)" , 50, 0., 1.);
216 hists_[
"jetMultBEff_"] =
store_->
book1D(
"JetMultBEff",
"N_{30}(b/eff)" , 10, 0., 10.);
218 hists_[
"jetBDiscEff_"] =
store_->
book1D(
"JetBDiscEff",
"Disc_{b/eff}(jet)", 100, 0., 10.);
242 hists_[
"muonDelXY_" ] =
store_->
book2D(
"MuonDelXY" ,
"d_{xy}(#mu)" , 50, -0.1, 0.1, 50, -0.1, 0.1);
245 hists_[
"muonDelXY_" ]->setAxisTitle(
"x [cm]", 1);
hists_[
"muonDelXY_" ]->setAxisTitle(
"y [cm]", 2);
251 hists_[
"muonTrkIso_" ] =
store_->
book1D(
"MuonTrkIso" ,
"Iso_{Trk}(#mu)" , 50, 0., 1.);
253 hists_[
"muonCalIso_" ] =
store_->
book1D(
"MuonCalIso" ,
"Iso_{Ecal}(#mu)" , 50, 0., 1.);
259 hists_[
"jetMultBPur_"] =
store_->
book1D(
"JetMultBPur",
"N_{30}(b/pur)" , 10, 0., 10.);
261 hists_[
"jetBDiscPur_"] =
store_->
book1D(
"JetBDiscPur",
"Disc_{b/pur}(Jet)", 100, 0., 10.);
263 hists_[
"jetMultBVtx_"] =
store_->
book1D(
"JetMultBVtx",
"N_{30}(b/vtx)" , 10, 0., 10.);
265 hists_[
"jetBDiscVtx_"] =
store_->
book1D(
"JetBDiscVtx",
"Disc_{b/vtx}(Jet)", 35, -1., 6.);
267 hists_[
"jet1PtRaw_" ] =
store_->
book1D(
"Jet1PtRaw" ,
"pt_{Raw}(jet1)" , 60, 0., 300.);
269 hists_[
"jet2PtRaw_" ] =
store_->
book1D(
"Jet2PtRaw" ,
"pt_{Raw}(jet2)" , 60, 0., 300.);
271 hists_[
"jet3PtRaw_" ] =
store_->
book1D(
"Jet3PtRaw" ,
"pt_{Raw}(jet3)" , 60, 0., 300.);
273 hists_[
"jet4PtRaw_" ] =
store_->
book1D(
"Jet4PtRaw" ,
"pt_{Raw}(jet4)" , 60, 0., 300.);
275 hists_[
"eventLogger_"] =
store_->
book2D(
"EventLogger",
"Logged Events" , 9, 0., 9., 10, 0., 10.);
278 hists_[
"eventLogger_"]->getTH1()->SetOption(
"TEXT");
279 hists_[
"eventLogger_"]->setBinLabel( 1 ,
"Run" , 1);
280 hists_[
"eventLogger_"]->setBinLabel( 2 ,
"Block" , 1);
281 hists_[
"eventLogger_"]->setBinLabel( 3 ,
"Event" , 1);
282 hists_[
"eventLogger_"]->setBinLabel( 4 ,
"pt_{L2L3}(jet1)" , 1);
283 hists_[
"eventLogger_"]->setBinLabel( 5 ,
"pt_{L2L3}(jet2)" , 1);
284 hists_[
"eventLogger_"]->setBinLabel( 6 ,
"pt_{L2L3}(jet3)" , 1);
285 hists_[
"eventLogger_"]->setBinLabel( 7 ,
"pt_{L2L3}(jet4)" , 1);
286 hists_[
"eventLogger_"]->setBinLabel( 8 ,
"M_{W}" , 1);
287 hists_[
"eventLogger_"]->setBinLabel( 9 ,
"M_{Top}" , 1);
288 hists_[
"eventLogger_"]->setAxisTitle(
"logged evts" , 2);
311 unsigned int pvMult = 0;
316 fill(
"pvMult_", pvMult );
337 unsigned int eMult=0, eMultIso=0;
338 std::vector<const reco::GsfElectron*> isoElecs;
341 unsigned int idx = elec-elecs->begin();
345 double isolationTrk = elec->pt()/(elec->pt()+elec->dr03TkSumPt());
346 double isolationCal = elec->pt()/(elec->pt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt());
347 double isolationRel = (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->pt();
350 fill(
"elecPt_" , elec->pt() );
351 fill(
"elecEta_", elec->eta());
352 fill(
"elecRelIso_" , isolationRel );
353 fill(
"elecTrkIso_" , isolationTrk );
354 fill(
"elecCalIso_" , isolationCal );
358 ++eMult;
if(!
elecIso_ || (*
elecIso_)(*elec)){
if(eMultIso == 0) e = *elec; isoElecs.push_back(&(*elec)); ++eMultIso;}
362 fill(
"elecMult_", eMult );
363 fill(
"elecMultIso_", eMultIso);
374 unsigned int mMult=0, mMultIso=0;
381 if(
muon->isGlobalMuon() ){
382 fill(
"muonDelZ_" ,
muon->globalTrack()->vz());
383 fill(
"muonDelXY_",
muon->globalTrack()->vx(),
muon->globalTrack()->vy());
386 double isolationTrk =
muon->pt()/(
muon->pt()+
muon->isolationR03().sumPt);
387 double isolationCal =
muon->pt()/(
muon->pt()+
muon->isolationR03().emEt+
muon->isolationR03().hadEt);
388 double isolationRel = (
muon->isolationR03().sumPt+
muon->isolationR03().emEt+
muon->isolationR03().hadEt)/
muon->pt();
393 fill(
"muonRelIso_" , isolationRel );
394 fill(
"muonTrkIso_" , isolationTrk );
395 fill(
"muonCalIso_" , isolationCal );
401 fill(
"muonMult_", mMult );
402 fill(
"muonMultIso_", mMultIso);
423 if(setup.
find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
429 <<
"------------------------------------------------------------------------------------- \n"
430 <<
" No JetCorrectionsRecord available from EventSetup: \n"
431 <<
" - Jets will not be corrected. \n"
432 <<
" - If you want to change this add the following lines to your cfg file: \n"
434 <<
" ## load jet corrections \n"
435 <<
" process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
436 <<
" process.prefer(\"ak5CaloL2L3\") \n"
438 <<
"------------------------------------------------------------------------------------- \n";
443 std::vector<reco::Jet> correctedJets;
444 unsigned int mult=0, multBEff=0, multBPur=0, multBVtx=0;
456 unsigned int idx =
jet-jets->begin();
457 if(
jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
458 if(!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
461 if(dynamic_cast<const reco::CaloJet*>(&*
jet)){
465 else if(dynamic_cast<const reco::PFJet*>(&*
jet)){
481 correctedJets.push_back(monitorJet);
486 fill(
"jetBDiscEff_", (*btagEff)[jetRef]);
if( (*btagEff)[jetRef]>
btagEffWP_ ) ++multBEff;
487 fill(
"jetBDiscPur_", (*btagPur)[jetRef]);
if( (*btagPur)[jetRef]>
btagPurWP_ ) {
if(multBPur == 0) bJetCand = *
jet; ++multBPur;}
488 fill(
"jetBDiscVtx_", (*btagVtx)[jetRef]);
if( (*btagVtx)[jetRef]>
btagVtxWP_ ) ++multBVtx;
491 if(idx==0) {
fill(
"jet1Pt_" , monitorJet.
pt());
fill(
"jet1PtRaw_",
jet->pt() );
fill(
"jet1Eta_" , monitorJet.
eta());}
492 if(idx==1) {
fill(
"jet2Pt_" , monitorJet.
pt());
fill(
"jet2PtRaw_",
jet->pt() );
fill(
"jet2Eta_" , monitorJet.
eta());}
493 if(idx==2) {
fill(
"jet3Pt_" , monitorJet.
pt());
fill(
"jet3PtRaw_",
jet->pt() );
fill(
"jet3Eta_" , monitorJet.
eta());}
494 if(idx==3) {
fill(
"jet4Pt_" , monitorJet.
pt());
fill(
"jet4PtRaw_",
jet->pt() );
fill(
"jet4Eta_" , monitorJet.
eta());}
496 fill(
"jetMult_" , mult );
497 fill(
"jetMultBEff_", multBEff);
498 fill(
"jetMultBPur_", multBPur);
499 fill(
"jetMultBVtx_", multBVtx);
511 for(std::vector<edm::InputTag>::const_iterator met_=
mets_.begin(); met_!=
mets_.end(); ++met_){
514 if(met->begin()!=met->end()){
515 unsigned int idx=met_-
mets_.begin();
516 if(idx==0)
fill(
"metCalo_" , met->begin()->et());
517 if(idx==1)
fill(
"metTC_" , met->begin()->et());
518 if(idx==2)
fill(
"metPflow_", met->begin()->et());
519 mET = *(met->begin());
533 double wMass = eventKinematics.
massWBoson (correctedJets);
534 double topMass = eventKinematics.
massTopQuark(correctedJets);
535 if(wMass>=0 && topMass>=0) {
fill(
"massW_" , wMass );
fill(
"massTop_" , topMass);}
539 if(
logged_<=
hists_.find(
"eventLogger_")->second->getNbinsY()){
545 if(correctedJets.size()>0)
fill(
"eventLogger_", 3.5,
logged_+0.5, correctedJets[0].pt());
546 if(correctedJets.size()>1)
fill(
"eventLogger_", 4.5,
logged_+0.5, correctedJets[1].pt());
547 if(correctedJets.size()>2)
fill(
"eventLogger_", 5.5,
logged_+0.5, correctedJets[2].pt());
548 if(correctedJets.size()>3)
fill(
"eventLogger_", 6.5,
logged_+0.5, correctedJets[3].pt());
554 if(multBPur != 0 && mMultIso == 1 ){
555 cout<<bJetCand.
pt()<<
"\t"<<mu.
pt()<<
"\t"<<mET.
pt()<<endl;
556 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
fill(
"MTWm_",mtW);
557 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
fill(
"mMub_", Mlb);
558 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
fill(
"mMTT_", MTT);
561 if(multBPur != 0 && eMultIso == 1 ){
562 double mtW = eventKinematics.
tmassWBoson(&mu,mET,bJetCand);
fill(
"MTWe_",mtW);
563 double Mlb = eventKinematics.
masslb(&mu,mET,bJetCand);
fill(
"mEb_", Mlb);
564 double MTT = eventKinematics.
tmassTopQuark(&mu,mET,bJetCand);
fill(
"eMTT_", MTT);
592 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
593 for(
unsigned int i=0;
i<sel.size(); ++
i){
621 unsigned int passed=0;
635 if(step.
select(event)){ ++passed;
641 if(step.
select(event)){ ++passed;
647 if(step.
select(event, setup)){ ++passed;
651 if(
type==
"jets/pf" ){
653 if(step.
select(event, setup)){ ++passed;
657 if(
type==
"jets/calo" ){
660 if(step.
select(event, setup)){ ++passed;
666 if(step.
select(event)){ ++passed;
std::map< std::string, std::pair< edm::ParameterSet, TopHLTSingleLepton::MonitorEnsemble * > > selection_
T getParameter(std::string const &) const
edm::InputTag electronId_
electronId label
void book(std::string directory)
book histograms in subdirectory directory
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Level verbosity_
verbosity level for booking
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
bool select(const edm::Event &event)
apply selection
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
double masslb(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate mlb estimate
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
double massTopQuark(const std::vector< reco::Jet > &jets)
calculate top quark mass estimate
edm::InputTag elecs_
input sources for monitoring
std::vector< edm::InputTag > mets_
considers a vector of METs
int logged_
number of logged interesting events
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
double massWBoson(const std::vector< reco::Jet > &jets)
calculate W boson mass estimate
virtual void scaleEnergy(double fScale)
scale energy of the jet
edm::InputTag vertex_
primary vertex
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
double lowerEdge_
mass window upper and lower edge
Jets made from PFObjects.
virtual double eta() const
momentum pseudorapidity
edm::InputTag btagEff_
btag discriminator labels
LuminosityBlockNumber_t luminosityBlock() const
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
static const double WMASS
std::map< std::string, MonitorElement * > hists_
histogram container
DQMStore * store_
storage manager
edm::InputTag triggerTable_
trigger table
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
std::vector< std::string > triggerPaths_
trigger paths
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
edm::InputTag beamspot_
beamspot
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
static const unsigned int MAXJETS
edm::InputTag jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
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
StringCutObjectSelector< reco::Vertex > * pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double tmassWBoson(reco::RecoCandidate *mu, const reco::MET &met, const reco::Jet &b)
calculate W boson transverse mass estimate
std::vector< std::string > selectionOrder_
EventAuxiliary const & eventAuxiliary() const
virtual double pt() const
transverse momentum
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
std::string jetCorrector_
jetCorrector
Templated helper class to allow a selection on a certain object collection.
TopHLTSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
std::string selectionStep(const std::string &label)
edm::InputTag triggerTable_
trigger table
static const double WMASS
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
double btagEffWP_
btag working points
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
std::string label_
instance label
std::string objectType(const std::string &label)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
EventNumber_t event() const
void setCurrentFolder(const std::string &fullpath)