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(
auto 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);
363 for(
auto met_=
mets_.begin(); met_!=
mets_.end(); ++met_){
368 if(met->begin()!=met->end()){
369 unsigned int idx=met_-
mets_.begin();
371 caloMET=*met->begin();
390 for (
auto const & triggerPath : triggerPaths) {
391 if (TString(
name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(
name.c_str()).Contains(TString(
"ele"), TString::kIgnoreCase) && TString(
name.c_str()).Contains(TString(
"mu"), TString::kIgnoreCase)) elecmu =
true;
393 if (TString(
name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(
name.c_str()).Contains(TString(
"ele"), TString::kIgnoreCase)) dielec =
true;
394 if (TString(
name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase) && TString(
name.c_str()).Contains(TString(
"mu"), TString::kIgnoreCase)) dimuon =
true;
400 fill(
"decayChannel_", 0.5);
401 if( !isoElecs.empty() && !isoMuons.empty() ) {
402 double mass = (isoElecs[0]->p4()+isoMuons[0]->p4()).
mass();
410 auto runID =
static_cast<double>(
event.eventAuxiliary().run());
411 auto luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
412 auto eventID =
static_cast<double>(
event.eventAuxiliary().event());
418 if(!leadingJets.empty())
fill(
"elecMuLogger_", 5.5,
elecMuLogged_+0.5, leadingJets[0].
pt());
419 if(leadingJets.size()>1)
fill(
"elecMuLogger_", 6.5,
elecMuLogged_+0.5, leadingJets[1].
pt());
429 fill(
"decayChannel_", 1.5);
430 if (isoMuons.size()>1) {
431 int charge = isoMuons[0]->charge()*isoMuons[1]->charge();
432 double mass = (isoMuons[0]->p4()+isoMuons[1]->p4()).
mass();
433 fill(charge<0 ?
"invMass_" :
"invMassWC_" , mass );
441 auto runID =
static_cast<double>(
event.eventAuxiliary().run());
442 auto luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
443 auto eventID =
static_cast<double>(
event.eventAuxiliary().event());
449 if(!leadingJets.empty())
fill(
"diMuonLogger_", 5.5,
diMuonLogged_+0.5, leadingJets[0].
pt());
450 if(leadingJets.size()>1)
fill(
"diMuonLogger_", 6.5,
diMuonLogged_+0.5, leadingJets[1].
pt());
460 fill(
"decayChannel_", 2.5);
461 if( dielec && isoElecs.size()>1 ){
462 int charge = isoElecs[0]->charge()*isoElecs[1]->charge();
463 double mass = (isoElecs[0]->p4()+isoElecs[1]->p4()).
mass();
464 fill(charge<0 ?
"invMass_" :
"invMassWC_" , mass );
472 auto runID =
static_cast<double>(
event.eventAuxiliary().run());
473 auto luminosityBlockID =
static_cast<double>(
event.eventAuxiliary().luminosityBlock());
474 auto eventID =
static_cast<double>(
event.eventAuxiliary().event());
480 if(!leadingJets.empty())
fill(
"diElecLogger_", 5.5,
diElecLogged_+0.5, leadingJets[0].
pt());
481 if(leadingJets.size()>1)
fill(
"diElecLogger_", 6.5,
diElecLogged_+0.5, leadingJets[1].
pt());
508 if(!rawTriggerEvent.
isValid()){
513 if(!aodTriggerEvent.
isValid()){
527 bool isInteresting =
false;
528 for (
auto const & triggerPath : triggerPaths) {
529 if (TString(name.c_str()).Contains(TString(triggerPath), TString::kIgnoreCase)) isInteresting =
true;
531 if (!isInteresting)
continue;
533 const unsigned int triggerIndex = triggerNames.
triggerIndex(name);
535 const vector<string>& moduleLabels(hltConfig.
moduleLabels(triggerIndex));
536 const unsigned int moduleIndex(triggerTable->
index(triggerIndex));
541 unsigned int kElec=0;
542 unsigned int kMuon=0;
543 for (
unsigned int k=0;
k<=moduleIndex; ++
k) {
544 const string& moduleLabel(moduleLabels[
k]);
545 const string moduleType(hltConfig.
moduleType(moduleLabel));
553 if (filterIndex<rawTriggerEvent->
size()) {
566 if (filterIndex<aodTriggerEvent->
size()) {
579 bool l1Matched =
false;
580 bool l2Matched =
false;
581 double l1DeltaRMin = 500.;
582 double l2DeltaRMin = 500.;
583 unsigned int l1IndMatched = 500;
584 unsigned int l2IndMatched = 500;
587 if (kElec > 0 && kMuon < 1 && !isoElecs.empty()) {
588 const string& moduleLabelElec(moduleLabels[kElec]);
589 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
604 double deltar1 = 600.;
605 double deltar2 = 600.;
606 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
609 if (deltar1 < deltar2 && deltar1 < l1DeltaRMin) {
610 l1DeltaRMin = deltar1;
613 if (deltar2 < deltar1 && deltar2 < l2DeltaRMin) {
614 l2DeltaRMin = deltar2;
618 if (
nElectrons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l1IndMatched]->
eta(), l1DeltaRMin);
619 if (
nElectrons > 1 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l2IndMatched]->
eta(), l2DeltaRMin);
620 if (l1DeltaRMin < DRMIN) {
622 fill(
"matchingMon_", 0.5 );
623 fill(
"leptResolution_", fabs(isoElecs[l1IndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[l1IndMatched]->
pt() );
625 if (l2DeltaRMin < DRMIN) {
627 fill(
"matchingMon_", 1.5 );
628 fill(
"leptResolution_", fabs(isoElecs[l2IndMatched]->
pt()-
electronRefs_[1]->
pt())/isoElecs[l2IndMatched]->
pt() );
633 l1DeltaRMin = 500.; l2DeltaRMin = 500.;
double l3DeltaRMin = 500.;
634 l1IndMatched = 500; l2IndMatched = 500;
double l3IndMatched = 500;
635 if (kMuon > 0 && kElec < 1 && !isoMuons.empty()) {
636 const string& moduleLabelMuon(moduleLabels[kMuon]);
637 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
656 for (
auto & myMuonRef : myMuonRefs) {
659 if (isNew) myMuonRefs.push_back(
muonRefs_[
l]);
661 const unsigned int nMyMuons(myMuonRefs.size());
662 double deltar1 = 600.;
663 double deltar2 = 600.;
664 double deltar3 = 600.;
665 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
666 if (nMyMuons > 0) deltar1 =
deltaR(*myMuonRefs[0],*isoMuons[indm]);
667 if (nMyMuons > 1) deltar2 =
deltaR(*myMuonRefs[1],*isoMuons[indm]);
668 if (nMyMuons > 2) deltar3 =
deltaR(*myMuonRefs[2],*isoMuons[indm]);
669 if (nMyMuons > 0 && (nMyMuons<1 || deltar1 < deltar2) && (nMyMuons<2 || deltar1<deltar3) && deltar1 < l1DeltaRMin) {
670 l1DeltaRMin = deltar1;
673 if (nMyMuons > 1 && deltar2 < deltar1 && (nMyMuons<3 || deltar2<deltar3) && deltar2 < l2DeltaRMin) {
674 l2DeltaRMin = deltar2;
677 if (nMyMuons > 2 && deltar3 < deltar1 && deltar3 < deltar2 && deltar3 < l3DeltaRMin) {
678 l3DeltaRMin = deltar3;
682 if (nMyMuons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l1IndMatched]->
eta(), l1DeltaRMin);
683 if (nMyMuons > 1 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l2IndMatched]->
eta(), l2DeltaRMin);
684 if (nMyMuons > 2 && l3IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l3IndMatched]->
eta(), l3DeltaRMin);
685 if (l1DeltaRMin < DRMIN) {
687 fill(
"matchingMon_", 0.5 );
688 fill(
"leptResolution_", fabs(isoMuons[l1IndMatched]->
pt()-myMuonRefs[0]->
pt())/isoMuons[l1IndMatched]->
pt() );
689 if (l2DeltaRMin < DRMIN) {
691 fill(
"matchingMon_", 1.5 );
692 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-myMuonRefs[1]->
pt())/isoMuons[l2IndMatched]->
pt() );
693 }
else if (l3DeltaRMin < DRMIN) {
695 fill(
"matchingMon_", 1.5 );
696 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
699 if (l2DeltaRMin < DRMIN) {
701 fill(
"matchingMon_", 0.5 );
702 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-myMuonRefs[1]->
pt())/isoMuons[l2IndMatched]->
pt() );
703 if (l3DeltaRMin < DRMIN) {
705 fill(
"matchingMon_", 1.5 );
706 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
709 if (l3DeltaRMin < DRMIN) {
711 fill(
"matchingMon_", 0.5 );
712 fill(
"leptResolution_", fabs(isoMuons[l3IndMatched]->
pt()-myMuonRefs[2]->
pt())/isoMuons[l3IndMatched]->
pt() );
719 l1DeltaRMin = 500.; l2DeltaRMin = 500.;
720 l1IndMatched = 500; l2IndMatched = 500;
721 if (kElec > 0 && kMuon > 0 && !isoElecs.empty()) {
722 const string& moduleLabelElec(moduleLabels[kElec]);
723 const string moduleTypeElec(hltConfig.
moduleType(moduleLabelElec));
739 for (
unsigned int inde = 0; inde < isoElecs.size(); inde++) {
741 if (deltar < l1DeltaRMin) {
742 l1DeltaRMin = deltar;
746 if (
nElectrons > 0 && l1IndMatched < 500)
fill(
"leptDeltaREta_", isoElecs[l1IndMatched]->
eta(), l1DeltaRMin);
747 if (l1DeltaRMin < DRMIN) {
749 fill(
"matchingMon_", 0.5 );
750 fill(
"leptResolution_", fabs(isoElecs[l1IndMatched]->
pt()-
electronRefs_[0]->
pt())/isoElecs[l1IndMatched]->
pt() );
753 if (kElec > 0 && kMuon > 0 && !isoMuons.empty()) {
754 const string& moduleLabelMuon(moduleLabels[kMuon]);
755 const string moduleTypeMuon(hltConfig.
moduleType(moduleLabelMuon));
770 if (isoMuons.empty())
continue;
772 for (
unsigned int indm = 0; indm < isoMuons.size(); indm++) {
774 if (deltar < l2DeltaRMin) {
775 l2DeltaRMin = deltar;
779 if (
nMuons > 0 && l2IndMatched < 500)
fill(
"leptDeltaREta_", isoMuons[l2IndMatched]->
eta(), l2DeltaRMin);
780 if (l2DeltaRMin < DRMIN) {
782 fill(
"matchingMon_", 1.5 );
783 fill(
"leptResolution_", fabs(isoMuons[l2IndMatched]->
pt()-
muonRefs_[0]->
pt())/isoMuons[l2IndMatched]->
pt() );
786 if (l1Matched && l2Matched)
fill(
"matchingMon_", 2.5 );
815 std::vector<edm::ParameterSet>
sel=cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
827 if (
type ==
"muons"){
830 if (
type ==
"elecs"){
836 if (
type ==
"jets/pf"){
839 if (
type ==
"jets/calo"){
857 <<
"Config extraction failure with process name " 875 if(vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
902 if(type2==
"Hlt" || type2==
"empty" )
continue;
908 if ( !passSel )
continue;
920 sel.second.second->book(i);
TopDiLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
T getParameter(std::string const &) const
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
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
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
double et() const final
transverse energy
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_
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 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
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