26 static const double DRMIN = 0.05;
30 lowerEdge_(-1.), upperEdge_(-1.), elecMuLogged_(0), diMuonLogged_(0), diElecLogged_(0)
140 hists_[
"invMass_" ] = store_.
book1D(
"InvMass" ,
"M(lep1, lep2)" , 80, 0., 320.);
142 hists_[
"invMassWC_" ] = store_.
book1D(
"InvMassWC" ,
"M_{WC}(L1, L2)" , 80, 0., 320.);
144 hists_[
"decayChannel_"] = store_.
book1D(
"DecayChannel",
"Decay Channel" , 3, 0, 3);
148 hists_[
"elecMuMon_" ] = store_.
book1D(
"ElecMuMon" ,
"Mon(e/#mu paths)" , nElecMu, 0., nElecMu);
152 hists_[
"diMuonMon_" ] = store_.
book1D(
"DiMuonMon" ,
"Mon(#mu/#mu paths)" , nDiMuon, 0., nDiMuon);
156 hists_[
"diElecMon_" ] = store_.
book1D(
"DiElecMon" ,
"Mon(e/e paths)" , nDiElec, 0., nDiElec);
158 hists_[
"jetMult_" ] = store_.
book1D(
"JetMult" ,
"N_{30}(jet)" , 20, 0., 20.);
165 hists_[
"decayChannel_"]->setBinLabel( 1,
"#mu e" , 1);
166 hists_[
"decayChannel_"]->setBinLabel( 2,
"#mu #mu", 1);
167 hists_[
"decayChannel_"]->setBinLabel( 3,
"e e" , 1);
170 hists_[
"diMuonLogger_"] = store_.
book2D(
"DiMuonLogger",
"Logged DiMuon Events" , 8, 0., 8., 10, 0., 10.);
172 hists_[
"diElecLogger_"] = store_.
book2D(
"DiElecLogger",
"Logged DiElec Events" , 8, 0., 8., 10, 0., 10.);
174 hists_[
"elecMuLogger_"] = store_.
book2D(
"ElecMuLogger",
"Logged ElecMu Events" , 8, 0., 8., 10, 0., 10.);
182 hists_[
"leptDeltaREta_"] = store_.
book2D(
"DeltaRMinEtaLepton",
"#Delta R_{min}(leptons) wrt #eta", 30, -3, 3, 10, 0., 0.1);
184 hists_[
"leptResolution_"] = store_.
book1D(
"ResIsoLeptons",
"#Delta p_{T}/p_{T}(matched leptons)", 20, 0., 0.1);
186 hists_[
"matchingMon_"] = store_.
book1D(
"MatchingMon",
"Mon(matching)", 3, 0., 3.);
188 hists_[
"matchingMon_"]->setBinLabel( 1 ,
"1st lepton" );
189 hists_[
"matchingMon_"]->setBinLabel( 2 ,
"2nd lepton" );
190 hists_[
"matchingMon_"]->setBinLabel( 3 ,
"both " );
222 std::vector<const reco::Muon*> isoMuons;
227 <<
"Muon collection not found \n";
233 if(
muon->isGlobalMuon() ){
250 std::vector<const reco::GsfElectron*> isoElecs;
259 <<
"Electron collection not found \n";
265 int idx = elec-elecs->begin();
285 if(setup.
find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
291 <<
"------------------------------------------------------------------------------------- \n" 292 <<
" No JetCorrectionsRecord available from EventSetup: \n" 293 <<
" - Jets will not be corrected. \n" 294 <<
" - If you want to change this add the following lines to your cfg file: \n" 296 <<
" ## load jet corrections \n" 297 <<
" process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n" 298 <<
" process.prefer(\"ak5CaloL2L3\") \n" 300 <<
"------------------------------------------------------------------------------------- \n";
306 std::vector<reco::Jet> leadingJets;
310 <<
"Jet collection not found \n";
320 unsigned int idx=
jet-jets->begin();
321 if(
jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
322 if(!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
325 if(dynamic_cast<const reco::CaloJet*>(&*
jet)){
329 else if(dynamic_cast<const reco::PFJet*>(&*
jet)){
339 for(std::vector<const reco::GsfElectron*>::const_iterator elec=isoElecs.begin(); elec!=isoElecs.end(); ++elec){
340 if(
reco::deltaR((*elec)->eta(), (*elec)->phi(),
jet->eta(),
jet->phi())<0.4){overlap=
true;
break;}
341 }
if(overlap){
continue;}
346 leadingJets.push_back(monitorJet);
349 leadingJets.push_back(monitorJet);
352 fill(
"jetMult_", mult);
368 if(met->begin()!=met->end()){
369 unsigned int idx=met_-
mets_.begin();
371 caloMET=*met->begin();
391 for (
unsigned int j=0; j<triggerPaths.size(); j++) {
392 if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString(
"ele"), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString(
"mu"), TString::kIgnoreCase)) elecmu =
true;
394 if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString(
"ele"), TString::kIgnoreCase)) dielec =
true;
395 if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase) && TString(name.c_str()).Contains(TString(
"mu"), TString::kIgnoreCase)) dimuon =
true;
401 fill(
"decayChannel_", 0.5);
402 if( isoElecs.size()>0 && isoMuons.size()>0 ) {
403 double mass = (isoElecs[0]->p4()+isoMuons[0]->p4()).
mass();
411 double runID =
static_cast<double>(
event.eventAuxiliary().run());
412 double luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
413 double eventID =
static_cast<double>(
event.eventAuxiliary().event());
419 if(leadingJets.size()>0)
fill(
"elecMuLogger_", 5.5,
elecMuLogged_+0.5, leadingJets[0].
pt());
420 if(leadingJets.size()>1)
fill(
"elecMuLogger_", 6.5,
elecMuLogged_+0.5, leadingJets[1].
pt());
430 fill(
"decayChannel_", 1.5);
431 if (isoMuons.size()>1) {
432 int charge = isoMuons[0]->charge()*isoMuons[1]->charge();
433 double mass = (isoMuons[0]->p4()+isoMuons[1]->p4()).
mass();
434 fill(charge<0 ?
"invMass_" :
"invMassWC_" , mass );
442 double runID =
static_cast<double>(
event.eventAuxiliary().run());
443 double luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
444 double eventID =
static_cast<double>(
event.eventAuxiliary().event());
450 if(leadingJets.size()>0)
fill(
"diMuonLogger_", 5.5,
diMuonLogged_+0.5, leadingJets[0].
pt());
451 if(leadingJets.size()>1)
fill(
"diMuonLogger_", 6.5,
diMuonLogged_+0.5, leadingJets[1].
pt());
461 fill(
"decayChannel_", 2.5);
462 if( dielec && isoElecs.size()>1 ){
463 int charge = isoElecs[0]->charge()*isoElecs[1]->charge();
464 double mass = (isoElecs[0]->p4()+isoElecs[1]->p4()).
mass();
465 fill(charge<0 ?
"invMass_" :
"invMassWC_" , mass );
473 double runID =
static_cast<double>(
event.eventAuxiliary().run());
474 double luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
475 double eventID =
static_cast<double>(
event.eventAuxiliary().event());
481 if(leadingJets.size()>0)
fill(
"diElecLogger_", 5.5,
diElecLogged_+0.5, leadingJets[0].
pt());
482 if(leadingJets.size()>1)
fill(
"diElecLogger_", 6.5,
diElecLogged_+0.5, leadingJets[1].
pt());
509 if(!rawTriggerEvent.
isValid()){
514 if(!aodTriggerEvent.
isValid()){
528 bool isInteresting =
false;
529 for (
unsigned int j=0; j<triggerPaths.size(); j++) {
530 if (TString(name.c_str()).Contains(TString(triggerPaths[j]), TString::kIgnoreCase)) isInteresting =
true;
532 if (!isInteresting)
continue;
534 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
536 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
537 const unsigned int moduleIndex(triggerTable->
index(triggerIndex));
542 unsigned int kElec=0;
543 unsigned int kMuon=0;
544 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
545 const string& moduleLabel(moduleLabels[
k]);
546 const string moduleType(hltConfig.
moduleType(moduleLabel));
554 if (filterIndex<rawTriggerEvent->
size()) {
557 if (nElectrons>0) kElec =
k;
560 const unsigned int nMuons(
muonIds_.size());
561 if (nMuons>0) kMuon =
k;
567 if (filterIndex<aodTriggerEvent->
size()) {
571 if (nElectrons>0) kElec =
k;
574 const unsigned int nMuons(
muonIds_.size());
575 if (nMuons>0) kMuon =
k;
580 bool l1Matched =
false;
581 bool l2Matched =
false;
582 double l1DeltaRMin = 500.;
583 double l2DeltaRMin = 500.;
584 unsigned int l1IndMatched = 500;
585 unsigned int l2IndMatched = 500;
588 if (kElec > 0 && kMuon < 1 && isoElecs.size()>0) {
589 const string& moduleLabelElec(moduleLabels[kElec]);
590 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
605 double deltar1 = 600.;
606 double deltar2 = 600.;
607 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
610 if (deltar1 < deltar2 && deltar1 < l1DeltaRMin) {
611 l1DeltaRMin = deltar1;
614 if (deltar2 < deltar1 && deltar2 < l2DeltaRMin) {
615 l2DeltaRMin = deltar2;
619 if (nElectrons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l1IndMatched]->
eta(), l1DeltaRMin);
620 if (nElectrons > 1 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l2IndMatched]->
eta(), l2DeltaRMin);
621 if (l1DeltaRMin < DRMIN) {
623 fill(
"matchingMon_", 0.5 );
624 fill(
"leptResolution_", fabs(isoElecs[l1IndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[l1IndMatched]->
pt() );
626 if (l2DeltaRMin < DRMIN) {
628 fill(
"matchingMon_", 1.5 );
629 fill(
"leptResolution_", fabs(isoElecs[l2IndMatched]->
pt()-
electronRefs_[1]->
pt())/isoElecs[l2IndMatched]->
pt() );
634 l1DeltaRMin = 500.; l2DeltaRMin = 500.;
double l3DeltaRMin = 500.;
635 l1IndMatched = 500; l2IndMatched = 500;
double l3IndMatched = 500;
636 if (kMuon > 0 && kElec < 1 && isoMuons.size()>0) {
637 const string& moduleLabelMuon(moduleLabels[kMuon]);
638 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
654 const unsigned int nMuons(
muonIds_.size());
655 for (
unsigned int l=0;
l<nMuons;
l++) {
657 for (
unsigned int ll=0; ll<myMuonRefs.size(); ll++) {
660 if (isNew) myMuonRefs.push_back(
muonRefs_[
l]);
662 const unsigned int nMyMuons(myMuonRefs.size());
663 double deltar1 = 600.;
664 double deltar2 = 600.;
665 double deltar3 = 600.;
666 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
667 if (nMyMuons > 0) deltar1 =
deltaR(*myMuonRefs[0],*isoMuons[indm]);
668 if (nMyMuons > 1) deltar2 =
deltaR(*myMuonRefs[1],*isoMuons[indm]);
669 if (nMyMuons > 2) deltar3 =
deltaR(*myMuonRefs[2],*isoMuons[indm]);
670 if (nMyMuons > 0 && (nMyMuons<1 || deltar1 < deltar2) && (nMyMuons<2 || deltar1<deltar3) && deltar1 < l1DeltaRMin) {
671 l1DeltaRMin = deltar1;
674 if (nMyMuons > 1 && deltar2 < deltar1 && (nMyMuons<3 || deltar2<deltar3) && deltar2 < l2DeltaRMin) {
675 l2DeltaRMin = deltar2;
678 if (nMyMuons > 2 && deltar3 < deltar1 && deltar3 < deltar2 && deltar3 < l3DeltaRMin) {
679 l3DeltaRMin = deltar3;
683 if (nMyMuons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l1IndMatched]->
eta(), l1DeltaRMin);
684 if (nMyMuons > 1 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l2IndMatched]->
eta(), l2DeltaRMin);
685 if (nMyMuons > 2 && l3IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l3IndMatched]->
eta(), l3DeltaRMin);
686 if (l1DeltaRMin < DRMIN) {
688 fill(
"matchingMon_", 0.5 );
689 fill(
"leptResolution_", fabs(isoMuons[l1IndMatched]->
pt()-myMuonRefs[0]->
pt())/isoMuons[l1IndMatched]->
pt() );
690 if (l2DeltaRMin < DRMIN) {
692 fill(
"matchingMon_", 1.5 );
693 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-myMuonRefs[1]->
pt())/isoMuons[l2IndMatched]->
pt() );
694 }
else if (l3DeltaRMin < DRMIN) {
696 fill(
"matchingMon_", 1.5 );
697 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
700 if (l2DeltaRMin < DRMIN) {
702 fill(
"matchingMon_", 0.5 );
703 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-myMuonRefs[1]->
pt())/isoMuons[l2IndMatched]->
pt() );
704 if (l3DeltaRMin < DRMIN) {
706 fill(
"matchingMon_", 1.5 );
707 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
710 if (l3DeltaRMin < DRMIN) {
712 fill(
"matchingMon_", 0.5 );
713 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
720 l1DeltaRMin = 500.; l2DeltaRMin = 500.;
721 l1IndMatched = 500; l2IndMatched = 500;
722 if (kElec > 0 && kMuon > 0 && isoElecs.size()>0) {
723 const string& moduleLabelElec(moduleLabels[kElec]);
724 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
740 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
742 if (deltar < l1DeltaRMin) {
743 l1DeltaRMin = deltar;
747 if (nElectrons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l1IndMatched]->
eta(), l1DeltaRMin);
748 if (l1DeltaRMin < DRMIN) {
750 fill(
"matchingMon_", 0.5 );
751 fill(
"leptResolution_", fabs(isoElecs[l1IndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[l1IndMatched]->
pt() );
754 if (kElec > 0 && kMuon > 0 && isoMuons.size()>0) {
755 const string& moduleLabelMuon(moduleLabels[kMuon]);
756 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
770 const unsigned int nMuons(
muonIds_.size());
771 if (isoMuons.size()<1)
continue;
773 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
775 if (deltar < l2DeltaRMin) {
776 l2DeltaRMin = deltar;
780 if (nMuons > 0 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l2IndMatched]->
eta(), l2DeltaRMin);
781 if (l2DeltaRMin < DRMIN) {
783 fill(
"matchingMon_", 1.5 );
784 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[l2IndMatched]->
pt() );
787 if (l1Matched && l2Matched)
fill(
"matchingMon_", 2.5 );
816 std::vector<edm::ParameterSet> sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
817 for(
unsigned int i=0;
i<sel.size(); ++
i){
828 if (
type ==
"muons"){
831 if (
type ==
"elecs"){
837 if (
type ==
"jets/pf"){
840 if (
type ==
"jets/calo"){
858 <<
"Config extraction failure with process name " 876 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
899 for(std::vector<std::string>::const_iterator selIt2=
selectionOrder_.begin(); selIt2<=selIt; ++selIt2){
903 if(type2==
"Hlt" || type2==
"empty" )
continue;
909 if ( !passSel )
continue;
921 sel.second.second->book(i);
TopDiLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
T getParameter(std::string const &) const
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
bool hasRawTriggerSummary
EventAuxiliary const & eventAuxiliary() const override
const std::string moduleType(const std::string &module) const
C++ class name of module.
double lowerEdge_
mass window upper and lower edge
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
virtual void scaleEnergy(double fScale)
scale energy of the jet
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
Base class for all types of Jets.
std::string processName_
hlt objects
std::string selectionStep(const std::string &label)
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
def setup(process, global_tag, zero_tesla=False)
int elecMuLogged_
number of logged interesting events
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
Strings const & triggerNames() const
Jets made from PFObjects.
trigger::Vids electronIds_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
do this during the event loop
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
std::string jetCorrector_
jetCorrector
virtual double et() const final
transverse energy
void triggerBinLabels(const std::string &channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
unsigned int triggerIndex(std::string const &name) const
void loggerBinLabels(const std::string &hist)
set labels for event logging histograms
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
MonitorElement * book1D(Args &&...args)
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
trigger::VRmuon muonRefs_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
std::map< std::string, MonitorElement * > hists_
histogram container
HLTConfigProvider hltConfig_
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
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > selection_
const std::string & processName() const
process name
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
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)
void setCurrentFolder(const std::string &fullpath)
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
MonitorElement * book2D(Args &&...args)
std::vector< std::string > selectionOrder_
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
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 ...
trigger::VRelectron electronRefs_
void book(DQMStore::IBooker &store_)
book histograms in subdirectory directory
std::string objectType(const std::string &label)
std::vector< reco::RecoChargedCandidateRef > VRmuon
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
bool isUninitialized() const
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
static std::string const triggerPaths
std::vector< std::string > elecMuPaths_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::string label_
instance label