CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

TopHLTSingleLepton::MonitorEnsemble Class Reference

#include <TopHLTSingleLeptonDQM.h>

List of all members.

Public Types

enum  Level { STANDARD, VERBOSE, DEBUG }
 

different verbosity levels

More...

Public Member Functions

void book (std::string directory)
 book histograms in subdirectory _directory_
void fill (const edm::Event &event, const edm::EventSetup &setup)
 fill monitor histograms with electronId and jetCorrections
 MonitorEnsemble (const char *label, const edm::ParameterSet &cfg)
 default contructor
 ~MonitorEnsemble ()
 default destructor

Private Member Functions

bool booked (const std::string histName) const
 check if histogram was booked
void fill (const edm::Event &event, const edm::TriggerResults &triggerTable, std::string channel, const std::vector< std::string > labels) const
 fill trigger monitoring histograms
void fill (const std::string histName, double xValue, double yValue) const
 fill histogram if it had been booked before (2-dim version)
void fill (const std::string histName, double xValue, double yValue, double zValue) const
 fill histogram if it had been booked before (2-dim version)
void fill (const std::string histName, double value) const
 fill histogram if it had been booked before
std::string monitorPath (const std::string &label) const
std::string selectionPath (const std::string &label) const
void triggerBinLabels (std::string channel, const std::vector< std::string > labels)
 set configurable labels for trigger monitoring histograms

Private Attributes

edm::InputTag btagEff_
 btag discriminator labels
double btagEffWP_
 btag working points
edm::InputTag btagPur_
double btagPurWP_
edm::InputTag btagVtx_
double btagVtxWP_
int eidPattern_
StringCutObjectSelector
< reco::GsfElectron > * 
elecIso_
 extra isolation criterion on electron
edm::InputTag elecs_
 input sources for monitoring
StringCutObjectSelector
< reco::GsfElectron > * 
elecSelect_
 extra selection on electrons
edm::InputTag electronId_
 electronId label
std::map< std::string,
MonitorElement * > 
hists_
 histogram container
bool includeBTag_
std::string jetCorrector_
 jetCorrector
edm::InputTag jetIDLabel_
 jetID as an extra selection type
StringCutObjectSelector
< reco::JetID > * 
jetIDSelect_
 extra jetID selection on calo jets
edm::InputTag jets_
std::string jetSelect_
std::string label_
 instance label
int logged_
 number of logged interesting events
double lowerEdge_
 mass window upper and lower edge
std::vector< edm::InputTagmets_
 considers a vector of METs
StringCutObjectSelector
< reco::Muon > * 
muonIso_
 extra isolation criterion on muon
edm::InputTag muons_
StringCutObjectSelector
< reco::Muon > * 
muonSelect_
 extra selection on muons
edm::InputTag pvs_
StringCutObjectSelector
< reco::Vertex > * 
pvSelect_
 extra selection on primary vertices; meant to investigate the pile-up effect
DQMStorestore_
 storage manager
std::vector< std::string > triggerPaths_
edm::InputTag triggerTable_
 trigger table
double upperEdge_
Level verbosity_
 verbosity level for booking

Detailed Description

Definition at line 40 of file TopHLTSingleLeptonDQM.h.


Member Enumeration Documentation

different verbosity levels

Enumerator:
STANDARD 
VERBOSE 
DEBUG 

Definition at line 43 of file TopHLTSingleLeptonDQM.h.


Constructor & Destructor Documentation

MonitorEnsemble::MonitorEnsemble ( const char *  label,
const edm::ParameterSet cfg 
)

default contructor

Definition at line 20 of file TopHLTSingleLeptonDQM.cc.

References book(), btagEff_, btagEffWP_, btagPur_, btagPurWP_, btagVtx_, btagVtxWP_, DEBUG, eidPattern_, elecIso_, elecs_, elecSelect_, electronId_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), includeBTag_, jetCorrector_, jetIDLabel_, jetIDSelect_, jets_, jetSelect_, lowerEdge_, mets_, muonIso_, muons_, muonSelect_, pvs_, pvSelect_, STANDARD, triggerPaths_, triggerTable_, upperEdge_, VERBOSE, and verbosity_.

                                                                                : 
    label_(label), elecIso_(0), elecSelect_(0), pvSelect_(0), muonIso_(0), muonSelect_(0), jetIDSelect_(0), includeBTag_(false), lowerEdge_(-1.), upperEdge_(-1.), logged_(0)
  {
    // sources have to be given; this PSet is not optional
    edm::ParameterSet sources=cfg.getParameter<edm::ParameterSet>("sources");
    muons_= sources.getParameter<edm::InputTag>("muons");
    elecs_= sources.getParameter<edm::InputTag>("elecs");
    jets_ = sources.getParameter<edm::InputTag>("jets" );
    mets_ = sources.getParameter<std::vector<edm::InputTag> >("mets" );
    pvs_ = sources.getParameter<edm::InputTag>("pvs" );
    // electronExtras are optional; they may be omitted or 
    // empty
    if( cfg.existsAs<edm::ParameterSet>("elecExtras") ){
      edm::ParameterSet elecExtras=cfg.getParameter<edm::ParameterSet>("elecExtras");
      // select is optional; in case it's not found no
      // selection will be applied
      if( elecExtras.existsAs<std::string>("select") ){
        elecSelect_= new StringCutObjectSelector<reco::GsfElectron>(elecExtras.getParameter<std::string>("select"));
      }
      // isolation is optional; in case it's not found no
      // isolation will be applied
      if( elecExtras.existsAs<std::string>("isolation") ){
        elecIso_= new StringCutObjectSelector<reco::GsfElectron>(elecExtras.getParameter<std::string>("isolation"));
      }
      // electronId is optional; in case it's not found the 
      // InputTag will remain empty
      if( elecExtras.existsAs<edm::ParameterSet>("electronId") ){
        edm::ParameterSet elecId=elecExtras.getParameter<edm::ParameterSet>("electronId");
        electronId_= elecId.getParameter<edm::InputTag>("src");
        eidPattern_= elecId.getParameter<int>("pattern");
      }
    }
    // pvExtras are opetional; they may be omitted or empty
    if(cfg.existsAs<edm::ParameterSet>("pvExtras")){
      edm::ParameterSet pvExtras=cfg.getParameter<edm::ParameterSet>("pvExtras");
      // select is optional; in case it's not found no
      // selection will be applied
      if( pvExtras.existsAs<std::string>("select") ){
        pvSelect_= new StringCutObjectSelector<reco::Vertex>(pvExtras.getParameter<std::string>("select"));
      }
    }
    // muonExtras are optional; they may be omitted or empty
    if( cfg.existsAs<edm::ParameterSet>("muonExtras") ){
      edm::ParameterSet muonExtras=cfg.getParameter<edm::ParameterSet>("muonExtras");
      // select is optional; in case it's not found no
      // selection will be applied
      if( muonExtras.existsAs<std::string>("select") ){
        muonSelect_= new StringCutObjectSelector<reco::Muon>(muonExtras.getParameter<std::string>("select"));
      }
      // isolation is optional; in case it's not found no
      // isolation will be applied
      if( muonExtras.existsAs<std::string>("isolation") ){
        muonIso_= new StringCutObjectSelector<reco::Muon>(muonExtras.getParameter<std::string>("isolation"));
      }
    }
    
    // jetExtras are optional; they may be omitted or 
    // empty
    if( cfg.existsAs<edm::ParameterSet>("jetExtras") ){
      edm::ParameterSet jetExtras=cfg.getParameter<edm::ParameterSet>("jetExtras");
      // jetCorrector is optional; in case it's not found 
      // the InputTag will remain empty
      if( jetExtras.existsAs<std::string>("jetCorrector") ){
        jetCorrector_= jetExtras.getParameter<std::string>("jetCorrector");
      }
      // read jetID information if it exists
      if(jetExtras.existsAs<edm::ParameterSet>("jetID")){
        edm::ParameterSet jetID=jetExtras.getParameter<edm::ParameterSet>("jetID");
        jetIDLabel_ =jetID.getParameter<edm::InputTag>("label");
        jetIDSelect_= new StringCutObjectSelector<reco::JetID>(jetID.getParameter<std::string>("select"));
      }
      // select is optional; in case it's not found no
      // selection will be applied (only implemented for 
      // CaloJets at the moment)
      if( jetExtras.existsAs<std::string>("select") ){
        jetSelect_= jetExtras.getParameter<std::string>("select");
      }
      // jetBDiscriminators are optional; in case they are
      // not found the InputTag will remain empty; they 
      // consist of pairs of edm::JetFlavorAssociation's & 
      // corresponding working points
      includeBTag_=jetExtras.existsAs<edm::ParameterSet>("jetBTaggers");
      if( includeBTag_ ){
        edm::ParameterSet btagEff=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("trackCountingEff");
        btagEff_= btagEff.getParameter<edm::InputTag>("label"); btagEffWP_= btagEff.getParameter<double>("workingPoint");
        edm::ParameterSet btagPur=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("trackCountingPur");
        btagPur_= btagPur.getParameter<edm::InputTag>("label"); btagPurWP_= btagPur.getParameter<double>("workingPoint");
        edm::ParameterSet btagVtx=jetExtras.getParameter<edm::ParameterSet>("jetBTaggers").getParameter<edm::ParameterSet>("secondaryVertex" );
        btagVtx_= btagVtx.getParameter<edm::InputTag>("label"); btagVtxWP_= btagVtx.getParameter<double>("workingPoint");
      }
    }

    // triggerExtras are optional; they may be omitted or empty
    if( cfg.existsAs<edm::ParameterSet>("triggerExtras") ){
      edm::ParameterSet triggerExtras=cfg.getParameter<edm::ParameterSet>("triggerExtras");
      triggerTable_=triggerExtras.getParameter<edm::InputTag>("src");
      triggerPaths_=triggerExtras.getParameter<std::vector<std::string> >("paths");
    }

    // massExtras is optional; in case it's not found no mass
    // window cuts are applied for the same flavor monitor
    // histograms
    if( cfg.existsAs<edm::ParameterSet>("massExtras") ){
      edm::ParameterSet massExtras=cfg.getParameter<edm::ParameterSet>("massExtras");
      lowerEdge_= massExtras.getParameter<double>("lowerEdge");
      upperEdge_= massExtras.getParameter<double>("upperEdge");
    }

    // setup the verbosity level for booking histograms;
    // per default the verbosity level will be set to 
    // STANDARD. This will also be the chosen level in
    // the case when the monitoring PSet is not found
    verbosity_=STANDARD;
    if( cfg.existsAs<edm::ParameterSet>("monitoring") ){
      edm::ParameterSet monitoring=cfg.getParameter<edm::ParameterSet>("monitoring");
      if(monitoring.getParameter<std::string>("verbosity") == "DEBUG"   )
        verbosity_= DEBUG;
      if(monitoring.getParameter<std::string>("verbosity") == "VERBOSE" )
        verbosity_= VERBOSE;
      if(monitoring.getParameter<std::string>("verbosity") == "STANDARD")
        verbosity_= STANDARD;
    }
    // and don't forget to do the histogram booking
    book(cfg.getParameter<std::string>("directory"));
  }
TopHLTSingleLepton::MonitorEnsemble::~MonitorEnsemble ( ) [inline]

default destructor

Definition at line 49 of file TopHLTSingleLeptonDQM.h.

{};

Member Function Documentation

void MonitorEnsemble::book ( std::string  directory)

book histograms in subdirectory _directory_

Definition at line 147 of file TopHLTSingleLeptonDQM.cc.

References DQMStore::book1D(), DQMStore::book2D(), cond::rpcobimon::current, hists_, label_, cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), STANDARD, store_, triggerBinLabels(), triggerPaths_, VERBOSE, and verbosity_.

Referenced by MonitorEnsemble().

  {
    //set up the current directory path
    std::string current(directory); current+=label_;
    store_=edm::Service<DQMStore>().operator->();
    store_->setCurrentFolder(current);

    // determine number of bins for trigger monitoring
    unsigned int nPaths=triggerPaths_.size();

    // --- [STANDARD] --- //
    // number of selected primary vertices
    hists_["pvMult_"     ] = store_->book1D("PvMult"     , "N_{pvs}"          ,     100,     0.,    100.);  
    // pt of the leading muon
    hists_["muonPt_"     ] = store_->book1D("MuonPt"     , "pt(#mu)"          ,     50,     0.,    250.);   
    // muon multiplicity before std isolation
    hists_["muonMult_"   ] = store_->book1D("MuonMult"   , "N_{All}(#mu)"     ,     10,     0.,     10.);   
    // muon multiplicity after  std isolation
    hists_["muonMultIso_"] = store_->book1D("MuonMultIso", "N_{Iso}(#mu)"     ,     10,     0.,     10.);   
    // pt of the leading electron
    hists_["elecPt_"     ] = store_->book1D("ElecPt"     , "pt(e)"            ,     50,     0.,    250.);   
    // electron multiplicity before std isolation
    hists_["elecMult_"   ] = store_->book1D("ElecMult"   , "N_{All}(e)"       ,     10,     0.,     10.);   
    // electron multiplicity after  std isolation
    hists_["elecMultIso_"] = store_->book1D("ElecMultIso", "N_{Iso}(e)"       ,     10,     0.,     10.);   
    // multiplicity of jets with pt>20 (corrected to L2+L3)
    hists_["jetMult_"    ] = store_->book1D("JetMult"    , "N_{30}(jet)"      ,     10,     0.,     10.);   
    // trigger efficiency estimates for single lepton triggers
    hists_["triggerEff_" ] = store_->book1D("TriggerEff" , "Eff(trigger)"     , nPaths,     0.,  nPaths);
    // monitored trigger occupancy for single lepton triggers
    hists_["triggerMon_" ] = store_->book1D("TriggerMon" , "Mon(trigger)"     , nPaths,     0.,  nPaths);
    // MET (calo)
    hists_["metCalo_"    ] = store_->book1D("METCalo"    , "MET_{Calo}"       ,     50,     0.,    200.);   
    // W mass estimate
    hists_["massW_"      ] = store_->book1D("MassW"      , "M(W)"             ,     60,     0.,    300.);   
    // Top mass estimate
    hists_["massTop_"    ] = store_->book1D("MassTop"    , "M(Top)"           ,     50,     0.,    500.);   
    // Mlb mu 
    hists_["mMub_"       ] = store_->book1D("mMub"       , "m_{#mub}"         ,     50,     0.,    500.);
    // W mass transverse estimate mu
    hists_["MTWm_"       ] = store_->book1D("MTWm"       , "M_{T}^{W}(#mu)"   ,     60,     0.,    300.);
    // Top mass transverse estimate mu
    hists_["mMTT_"       ] = store_->book1D("mMTT"       , "M_{T}^{t}(#mu)"   ,     50,     0.,    500.);

    // Mlb e 
    hists_["mEb_"        ] = store_->book1D("mEb"        , "m_{eb}"           ,     50,     0.,    500.);
    // W mass transverse estimate e
    hists_["MTWe_"       ] = store_->book1D("MTWe"       , "M_{T}^{W}(e)"     ,     60,     0.,    300.);
    // Top mass transverse estimate e
    hists_["eMTT_"       ] = store_->book1D("eMTT"       , "M_{T}^{t}(e)"     ,     50,     0.,    500.);




    // set bin labels for trigger monitoring
    triggerBinLabels(std::string("trigger"), triggerPaths_);

    if( verbosity_==STANDARD) return;

    // --- [VERBOSE] --- //
    // eta of the leading muon
    hists_["muonEta_"    ] = store_->book1D("MuonEta"    , "#eta(#mu)"        ,     30,    -3.,      3.);   
    // std isolation variable of the leading muon
    hists_["muonRelIso_" ] = store_->book1D("MuonRelIso" , "Iso_{Rel}(#mu)"   ,     50,     0.,      1.);   
    // eta of the leading electron
    hists_["elecEta_"    ] = store_->book1D("ElecEta"    , "#eta(e)"          ,     30,    -3.,      3.);   
    // std isolation variable of the leading electron
    hists_["elecRelIso_" ] = store_->book1D("ElecRelIso" , "Iso_{Rel}(e)"     ,     50,     0.,      1.);   
    // multiplicity of btagged jets (for track counting high efficiency) with pt(L2L3)>30
    hists_["jetMultBEff_"] = store_->book1D("JetMultBEff", "N_{30}(b/eff)"    ,     10,     0.,     10.);   
    // btag discriminator for track counting high efficiency for jets with pt(L2L3)>30
    hists_["jetBDiscEff_"] = store_->book1D("JetBDiscEff", "Disc_{b/eff}(jet)",     100,     0.,     10.);   
    // pt of the 1. leading jet (corrected to L2+L3)
    hists_["jet1Pt_"     ] = store_->book1D("Jet1Pt"     , "pt_{L2L3}(jet1)"  ,     60,     0.,    300.);   
    // pt of the 2. leading jet (corrected to L2+L3)
    hists_["jet2Pt_"     ] = store_->book1D("Jet2Pt"     , "pt_{L2L3}(jet2)"  ,     60,     0.,    300.);   
    // pt of the 3. leading jet (corrected to L2+L3)
    hists_["jet3Pt_"     ] = store_->book1D("Jet3Pt"     , "pt_{L2L3}(jet3)"  ,     60,     0.,    300.);   
    // pt of the 4. leading jet (corrected to L2+L3)
    hists_["jet4Pt_"     ] = store_->book1D("Jet4Pt"     , "pt_{L2L3}(jet4)"  ,     60,     0.,    300.);   
    // eta of the 1. 
    hists_["jet1Eta_"     ] = store_->book1D("Jet1Eta"     , "#eta(jet1)"  ,     30,    -3.,      3.);   
    // eta of the 2. 
    hists_["jet2Eta_"     ] = store_->book1D("Jet2Eta"     , "#eta(jet2)"  ,     30,    -3.,      3.);   
    // eta of the 3. 
    hists_["jet3Eta_"     ] = store_->book1D("Jet3Eta"     , "#eta(jet3)"  ,     30,    -3.,      3.);   
    // eta of the 4.
    hists_["jet4Eta_"     ] = store_->book1D("Jet4Eta"     , "#eta(jet4)"  ,     30,    -3.,      3.);   
    // MET (tc)
    hists_["metTC_"      ] = store_->book1D("METTC"      , "MET_{TC}"         ,     50,     0.,    200.);   
    // MET (pflow)
    hists_["metPflow_"   ] = store_->book1D("METPflow"   , "MET_{Pflow}"      ,     50,     0.,    200.);   
    // dz for muons (to suppress cosmis)
    hists_["muonDelZ_"    ] = store_->book1D("MuonDelZ"  , "d_{z}(#mu)"       ,     50,   -25.,     25.);
    // dxy for muons (to suppress cosmics)
    hists_["muonDelXY_"   ] = store_->book2D("MuonDelXY" , "d_{xy}(#mu)"      ,     50,   -0.1,     0.1,   50,   -0.1,   0.1);

    // set axes titles for dxy for muons
    hists_["muonDelXY_"   ]->setAxisTitle( "x [cm]", 1); hists_["muonDelXY_"   ]->setAxisTitle( "y [cm]", 2);

    if( verbosity_==VERBOSE) return;

    // --- [DEBUG] --- //
    // relative muon isolation in tracker for the leading muon
    hists_["muonTrkIso_" ] = store_->book1D("MuonTrkIso" , "Iso_{Trk}(#mu)"   ,     50,     0.,      1.);   
    // relative muon isolation in ecal+hcal for the leading muon
    hists_["muonCalIso_" ] = store_->book1D("MuonCalIso" , "Iso_{Ecal}(#mu)"  ,     50,     0.,      1.);   
    // relative electron isolation in tracker for the leading electron
    hists_["elecTrkIso_" ] = store_->book1D("ElecTrkIso" , "Iso_{Trk}(e)"     ,     50,     0.,      1.);   
    // relative electron isolation in ecal+hcal for the leading electron
    hists_["elecCalIso_" ] = store_->book1D("ElecCalIso" , "Iso_{Ecal}(e)"    ,     50,     0.,      1.);   
    // multiplicity of btagged jets (for track counting high purity) with pt(L2L3)>30
    hists_["jetMultBPur_"] = store_->book1D("JetMultBPur", "N_{30}(b/pur)"    ,     10,     0.,     10.);   
    // btag discriminator for track counting high purity
    hists_["jetBDiscPur_"] = store_->book1D("JetBDiscPur", "Disc_{b/pur}(Jet)",     100,     0.,     10.);   
    // multiplicity of btagged jets (for simple secondary vertex) with pt(L2L3)>30
    hists_["jetMultBVtx_"] = store_->book1D("JetMultBVtx", "N_{30}(b/vtx)"    ,     10,     0.,     10.);   
    // btag discriminator for simple secondary vertex
    hists_["jetBDiscVtx_"] = store_->book1D("JetBDiscVtx", "Disc_{b/vtx}(Jet)",     35,    -1.,      6.);   
    // pt of the 1. leading jet (uncorrected)
    hists_["jet1PtRaw_"  ] = store_->book1D("Jet1PtRaw"  , "pt_{Raw}(jet1)"   ,     60,     0.,    300.);   
    // pt of the 2. leading jet (uncorrected)
    hists_["jet2PtRaw_"  ] = store_->book1D("Jet2PtRaw"  , "pt_{Raw}(jet2)"   ,     60,     0.,    300.);   
    // pt of the 3. leading jet (uncorrected)
    hists_["jet3PtRaw_"  ] = store_->book1D("Jet3PtRaw"  , "pt_{Raw}(jet3)"   ,     60,     0.,    300.);   
    // pt of the 4. leading jet (uncorrected)
    hists_["jet4PtRaw_"  ] = store_->book1D("Jet4PtRaw"  , "pt_{Raw}(jet4)"   ,     60,     0.,    300.);   
    // selected events
    hists_["eventLogger_"] = store_->book2D("EventLogger", "Logged Events"    ,      9,     0.,      9.,   10,   0.,   10.);

    // set axes titles for selected events
    hists_["eventLogger_"]->getTH1()->SetOption("TEXT");
    hists_["eventLogger_"]->setBinLabel( 1 , "Run"             , 1);
    hists_["eventLogger_"]->setBinLabel( 2 , "Block"           , 1);
    hists_["eventLogger_"]->setBinLabel( 3 , "Event"           , 1);
    hists_["eventLogger_"]->setBinLabel( 4 , "pt_{L2L3}(jet1)" , 1);
    hists_["eventLogger_"]->setBinLabel( 5 , "pt_{L2L3}(jet2)" , 1);
    hists_["eventLogger_"]->setBinLabel( 6 , "pt_{L2L3}(jet3)" , 1);
    hists_["eventLogger_"]->setBinLabel( 7 , "pt_{L2L3}(jet4)" , 1);
    hists_["eventLogger_"]->setBinLabel( 8 , "M_{W}"           , 1);
    hists_["eventLogger_"]->setBinLabel( 9 , "M_{Top}"         , 1);
    hists_["eventLogger_"]->setAxisTitle("logged evts"         , 2);
    return;
  }
bool TopHLTSingleLepton::MonitorEnsemble::booked ( const std::string  histName) const [inline, private]

check if histogram was booked

Definition at line 70 of file TopHLTSingleLeptonDQM.h.

References hists_.

Referenced by fill().

{ return hists_.find(histName.c_str())!=hists_.end(); };
void TopHLTSingleLepton::MonitorEnsemble::fill ( const std::string  histName,
double  xValue,
double  yValue 
) const [inline, private]

fill histogram if it had been booked before (2-dim version)

Definition at line 74 of file TopHLTSingleLeptonDQM.h.

References booked(), hists_, and edm::second().

{ if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue); };
void MonitorEnsemble::fill ( const edm::Event event,
const edm::EventSetup setup 
)

fill monitor histograms with electronId and jetCorrections

Definition at line 293 of file TopHLTSingleLeptonDQM.cc.

References btagEff_, btagEffWP_, btagPur_, btagPurWP_, btagVtx_, btagVtxWP_, JetCorrector::correction(), gather_cfg::cout, alignCSCRings::e, eidPattern_, elecIso_, elecs_, elecSelect_, electronId_, reco::LeafCandidate::eta(), edm::Event::eventAuxiliary(), edm::EventSetup::find(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), hists_, includeBTag_, metsig::jet, jetCorrector_, jetIDLabel_, jetIDSelect_, fwrapper::jets, jets_, jetSelect_, edm::InputTag::label(), logged_, lowerEdge_, CalculateHLT::masslb(), CalculateHLT::massTopQuark(), CalculateHLT::massWBoson(), TopHLTSingleLepton::MAXJETS, CaloMET_cfi::met, mets_, RPCpg::mu, VarParsing::mult, metsig::muon, muonIso_, patZpeak::muons, muons_, muonSelect_, reco::LeafCandidate::pt(), pvs_, pvSelect_, reco::Jet::scaleEnergy(), EgammaValidation_Wenu_cff::sel, CalculateHLT::tmassTopQuark(), CalculateHLT::tmassWBoson(), triggerPaths_, triggerTable_, upperEdge_, and TopHLTSingleLepton::WMASS.

Referenced by fill().

  {
    // fetch trigger event if configured such 
    edm::Handle<edm::TriggerResults> triggerTable;
    if(!triggerTable_.label().empty()) {
      if( !event.getByLabel(triggerTable_, triggerTable) ) return;
    }

    /*
    ------------------------------------------------------------

    Primary Vertex Monitoring

    ------------------------------------------------------------
    */
    // fill monitoring plots for primary verices
    edm::Handle<edm::View<reco::Vertex> > pvs;
    if( !event.getByLabel(pvs_, pvs) ) return;
    unsigned int pvMult = 0;
    for(edm::View<reco::Vertex>::const_iterator pv=pvs->begin(); pv!=pvs->end(); ++pv){
      if(!pvSelect_ || (*pvSelect_)(*pv))
        pvMult++;
    }
    fill("pvMult_",    pvMult   );

    /* 
    ------------------------------------------------------------

    Electron Monitoring

    ------------------------------------------------------------
    */

    // fill monitoring plots for electrons
    edm::Handle<edm::View<reco::GsfElectron> > elecs;
    if( !event.getByLabel(elecs_, elecs) ) return;

    // check availability of electron id
    edm::Handle<edm::ValueMap<float> > electronId; 
    if(!electronId_.label().empty()) {
      if( !event.getByLabel(electronId_, electronId) ) return;
    }

    // loop electron collection
    unsigned int eMult=0, eMultIso=0;
    std::vector<const reco::GsfElectron*> isoElecs;
    reco::GsfElectron e;
    for(edm::View<reco::GsfElectron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
      unsigned int idx = elec-elecs->begin();
      // restrict to electrons with good electronId
      if( electronId_.label().empty() ? true : ((int)(*electronId)[elecs->refAt(idx)] & eidPattern_) ){
        if(!elecSelect_ || (*elecSelect_)(*elec)){
          double isolationTrk = elec->pt()/(elec->pt()+elec->dr03TkSumPt());
          double isolationCal = elec->pt()/(elec->pt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt());
          double isolationRel = (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->pt();
          if( eMult==0 ){
            // restrict to the leading electron
            fill("elecPt_" , elec->pt() );
            fill("elecEta_", elec->eta());
            fill("elecRelIso_" , isolationRel );
            fill("elecTrkIso_" , isolationTrk );
            fill("elecCalIso_" , isolationCal );
          }
          // in addition to the multiplicity counter buffer the iso 
          // electron candidates for later overlap check with jets
          ++eMult; if(!elecIso_ || (*elecIso_)(*elec)){ if(eMultIso == 0) e = *elec;  isoElecs.push_back(&(*elec)); ++eMultIso;}
        }
      }
    }
    fill("elecMult_",    eMult   );
    fill("elecMultIso_", eMultIso);
    
    /* 
    ------------------------------------------------------------

    Muon Monitoring

    ------------------------------------------------------------
    */

    // fill monitoring plots for muons
    unsigned int mMult=0, mMultIso=0;

    edm::Handle<edm::View<reco::Muon> > muons;
    if( !event.getByLabel(muons_, muons) ) return;
    reco::Muon mu;
    for(edm::View<reco::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
      // restrict to globalMuons
      if( muon->isGlobalMuon() ){ 
        fill("muonDelZ_" , muon->globalTrack()->vz());
        fill("muonDelXY_", muon->globalTrack()->vx(), muon->globalTrack()->vy());
        // apply preselection
        if(!muonSelect_ || (*muonSelect_)(*muon)){
          double isolationTrk = muon->pt()/(muon->pt()+muon->isolationR03().sumPt);
          double isolationCal = muon->pt()/(muon->pt()+muon->isolationR03().emEt+muon->isolationR03().hadEt);
          double isolationRel = (muon->isolationR03().sumPt+muon->isolationR03().emEt+muon->isolationR03().hadEt)/muon->pt();
          if( mMult==0 ){
            // restrict to leading muon
            fill("muonPt_"     , muon->pt() );
            fill("muonEta_"    , muon->eta());
            fill("muonRelIso_" , isolationRel );
            fill("muonTrkIso_" , isolationTrk );
            fill("muonCalIso_" , isolationCal );
          }
           ++mMult; if(!muonIso_ || (*muonIso_)(*muon)) {if(mMultIso == 0) mu = *muon; ++mMultIso;}
        }
      }
    }
    fill("muonMult_",    mMult   );
    fill("muonMultIso_", mMultIso);

    /* 
    ------------------------------------------------------------

    Jet Monitoring

    ------------------------------------------------------------
    */

    // check availability of the btaggers
    edm::Handle<reco::JetTagCollection> btagEff, btagPur, btagVtx;
    if( includeBTag_ ){ 
      if( !event.getByLabel(btagEff_, btagEff) ) return;
      if( !event.getByLabel(btagPur_, btagPur) ) return;
      if( !event.getByLabel(btagVtx_, btagVtx) ) return;
    }
    // load jet corrector if configured such
    const JetCorrector* corrector=0;
    if(!jetCorrector_.empty()){
      // check whether a jet correcto is in the event setup or not
      if(setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>() )){
        corrector = JetCorrector::getJetCorrector(jetCorrector_, setup);
      }
      else{ 
        edm::LogVerbatim( "TopHLTSingleLeptonDQM" ) 
          << "\n"
          << "------------------------------------------------------------------------------------- \n"
          << " No JetCorrectionsRecord available from EventSetup:                                   \n" 
          << "  - Jets will not be corrected.                                                       \n"
          << "  - If you want to change this add the following lines to your cfg file:              \n"
          << "                                                                                      \n"
          << "  ## load jet corrections                                                             \n"
          << "  process.load(\"JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff\") \n"
          << "  process.prefer(\"ak5CaloL2L3\")                                                     \n"
          << "                                                                                      \n"
          << "------------------------------------------------------------------------------------- \n";
      }
    }

    // loop jet collection
    std::vector<reco::Jet> correctedJets;
    unsigned int mult=0, multBEff=0, multBPur=0, multBVtx=0;

    edm::Handle<edm::View<reco::Jet> > jets; 
    if( !event.getByLabel(jets_, jets) ) return;

    edm::Handle<reco::JetIDValueMap> jetID; 
    if(jetIDSelect_){ 
      if( !event.getByLabel(jetIDLabel_, jetID) ) return;
    }
    reco::Jet bJetCand; 
    for(edm::View<reco::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
      // check jetID for calo jets
      unsigned int idx = jet-jets->begin();
      if( jetIDSelect_ && dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())){
        if(!(*jetIDSelect_)((*jetID)[jets->refAt(idx)])) continue;
      }
      // chekc additional jet selection for calo, pf and bare reco jets
      if(dynamic_cast<const reco::CaloJet*>(&*jet)){
        reco::CaloJet sel = dynamic_cast<const reco::CaloJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
        StringCutObjectSelector<reco::CaloJet> jetSelect(jetSelect_); if(!jetSelect(sel)){ continue;}
      }
      else if(dynamic_cast<const reco::PFJet*>(&*jet)){
        reco::PFJet sel= dynamic_cast<const reco::PFJet&>(*jet); sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
        StringCutObjectSelector<reco::PFJet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
      } 
      else{
        reco::Jet sel = *jet; sel.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
        StringCutObjectSelector<reco::Jet> jetSelect(jetSelect_); if(!jetSelect(sel)) continue;
      }
      // check for overlaps -- comment this to be synchronous with the selection
      //bool overlap=false;
      //for(std::vector<const reco::GsfElectron*>::const_iterator elec=isoElecs.begin(); elec!=isoElecs.end(); ++elec){
      //  if(reco::deltaR((*elec)->eta(), (*elec)->phi(), jet->eta(), jet->phi())<0.4){overlap=true; break;}
      //} if(overlap){continue;}

      // prepare jet to fill monitor histograms
      reco::Jet monitorJet = *jet; monitorJet.scaleEnergy(corrector ? corrector->correction(*jet) : 1.);
      correctedJets.push_back(monitorJet);
      ++mult; // determine jet multiplicity
      if( includeBTag_ ){
        // fill b-discriminators
        edm::RefToBase<reco::Jet> jetRef = jets->refAt(idx);    
        fill("jetBDiscEff_", (*btagEff)[jetRef]); if( (*btagEff)[jetRef]>btagEffWP_ ) ++multBEff; 
        fill("jetBDiscPur_", (*btagPur)[jetRef]); if( (*btagPur)[jetRef]>btagPurWP_ ) {if(multBPur == 0) bJetCand = *jet; ++multBPur;} 
        fill("jetBDiscVtx_", (*btagVtx)[jetRef]); if( (*btagVtx)[jetRef]>btagVtxWP_ ) ++multBVtx; 
      }
      // fill pt (raw or L2L3) for the leading four jets  
      if(idx==0) {fill("jet1Pt_" , monitorJet.pt()); fill("jet1PtRaw_", jet->pt() ); fill("jet1Eta_" , monitorJet.eta());}
      if(idx==1) {fill("jet2Pt_" , monitorJet.pt()); fill("jet2PtRaw_", jet->pt() ); fill("jet2Eta_" , monitorJet.eta());}
      if(idx==2) {fill("jet3Pt_" , monitorJet.pt()); fill("jet3PtRaw_", jet->pt() ); fill("jet3Eta_" , monitorJet.eta());}
      if(idx==3) {fill("jet4Pt_" , monitorJet.pt()); fill("jet4PtRaw_", jet->pt() ); fill("jet4Eta_" , monitorJet.eta());}
    }
    fill("jetMult_"    , mult    );
    fill("jetMultBEff_", multBEff);
    fill("jetMultBPur_", multBPur);
    fill("jetMultBVtx_", multBVtx);
    
    /* 
    ------------------------------------------------------------

    MET Monitoring

    ------------------------------------------------------------
    */

    // fill monitoring histograms for met
    reco::MET mET;
    for(std::vector<edm::InputTag>::const_iterator met_=mets_.begin(); met_!=mets_.end(); ++met_){
      edm::Handle<edm::View<reco::MET> > met;
      if( !event.getByLabel(*met_, met) ) continue;
      if(met->begin()!=met->end()){
        unsigned int idx=met_-mets_.begin();
        if(idx==0) fill("metCalo_" , met->begin()->et());
        if(idx==1) fill("metTC_"   , met->begin()->et());
        if(idx==2) fill("metPflow_", met->begin()->et());
        mET = *(met->begin());
      }
    }

    /* 
    ------------------------------------------------------------

    Event Monitoring

    ------------------------------------------------------------
    */

    // fill W boson and top mass estimates
    CalculateHLT eventKinematics(MAXJETS, WMASS);
    double wMass   = eventKinematics.massWBoson  (correctedJets);
    double topMass = eventKinematics.massTopQuark(correctedJets);
    if(wMass>=0 && topMass>=0) {fill("massW_" , wMass  ); fill("massTop_" , topMass);}
    // fill plots for trigger monitoring
    if((lowerEdge_==-1. && upperEdge_==-1.) || (lowerEdge_<wMass && wMass<upperEdge_) ){
      if(!triggerTable_.label().empty()) fill(event, *triggerTable, "trigger", triggerPaths_);
      if(logged_<=hists_.find("eventLogger_")->second->getNbinsY()){
        // log runnumber, lumi block, event number & some
        // more pysics infomation for interesting events
        fill("eventLogger_", 0.5, logged_+0.5, event.eventAuxiliary().run()); 
        fill("eventLogger_", 1.5, logged_+0.5, event.eventAuxiliary().luminosityBlock()); 
        fill("eventLogger_", 2.5, logged_+0.5, event.eventAuxiliary().event()); 
        if(correctedJets.size()>0) fill("eventLogger_", 3.5, logged_+0.5, correctedJets[0].pt()); 
        if(correctedJets.size()>1) fill("eventLogger_", 4.5, logged_+0.5, correctedJets[1].pt()); 
        if(correctedJets.size()>2) fill("eventLogger_", 5.5, logged_+0.5, correctedJets[2].pt()); 
        if(correctedJets.size()>3) fill("eventLogger_", 6.5, logged_+0.5, correctedJets[3].pt()); 
        fill("eventLogger_", 7.5, logged_+0.5, wMass  ); 
        fill("eventLogger_", 8.5, logged_+0.5, topMass); 
        ++logged_;
      }
    }
    if(multBPur != 0 && mMultIso == 1 ){
        cout<<bJetCand.pt()<<"\t"<<mu.pt()<<"\t"<<mET.pt()<<endl;
        double mtW = eventKinematics.tmassWBoson(&mu,mET,bJetCand); fill("MTWm_",mtW);
        double Mlb = eventKinematics.masslb(&mu,mET,bJetCand); fill("mMub_", Mlb);
        double MTT = eventKinematics.tmassTopQuark(&mu,mET,bJetCand); fill("mMTT_", MTT);
    }

    if(multBPur != 0 && eMultIso == 1 ){
        double mtW = eventKinematics.tmassWBoson(&mu,mET,bJetCand); fill("MTWe_",mtW);
        double Mlb = eventKinematics.masslb(&mu,mET,bJetCand); fill("mEb_", Mlb);
        double MTT = eventKinematics.tmassTopQuark(&mu,mET,bJetCand); fill("eMTT_", MTT);
    }
  }
void TopHLTSingleLepton::MonitorEnsemble::fill ( const std::string  histName,
double  value 
) const [inline, private]

fill histogram if it had been booked before

Definition at line 72 of file TopHLTSingleLeptonDQM.h.

References booked(), hists_, and edm::second().

{ if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
void TopHLTSingleLepton::MonitorEnsemble::fill ( const std::string  histName,
double  xValue,
double  yValue,
double  zValue 
) const [inline, private]

fill histogram if it had been booked before (2-dim version)

Definition at line 76 of file TopHLTSingleLeptonDQM.h.

{ if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue); };
void MonitorEnsemble::fill ( const edm::Event event,
const edm::TriggerResults triggerTable,
std::string  channel,
const std::vector< std::string >  labels 
) const [inline, private]

fill trigger monitoring histograms

Definition at line 157 of file TopHLTSingleLeptonDQM.h.

References acceptHLT(), fill(), hists_, monitorPath(), selectionPath(), and relativeConstraints::value.

  {
    for(unsigned int idx=0; idx<labels.size(); ++idx){
      if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
        fill((channel+"Mon_").c_str(), idx+0.5 );
        // take care to fill triggerMon_ before evts is being called
        int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
        double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
        fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(acceptHLT(event, triggerTable, selectionPath(labels[idx]))-value));
      }
    }
  }
std::string TopHLTSingleLepton::MonitorEnsemble::monitorPath ( const std::string &  label) const [inline, private]

deduce monitorPath from label, the label is expected to be of type 'selectionPath:monitorPath'

Definition at line 59 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and triggerBinLabels().

{ return label.substr(label.find(':')+1); };  
std::string TopHLTSingleLepton::MonitorEnsemble::selectionPath ( const std::string &  label) const [inline, private]

deduce selectionPath from label, the label is expected to be of type 'selectionPath:monitorPath'

Definition at line 62 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and triggerBinLabels().

{ return label.substr(0, label.find(':')); };  
void MonitorEnsemble::triggerBinLabels ( std::string  channel,
const std::vector< std::string >  labels 
) [inline, private]

set configurable labels for trigger monitoring histograms

Definition at line 148 of file TopHLTSingleLeptonDQM.h.

References hists_, monitorPath(), and selectionPath().

Referenced by book().

  {
    for(unsigned int idx=0; idx<labels.size(); ++idx){
      hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
      hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
    }
  }

Member Data Documentation

btag discriminator labels

Definition at line 133 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

btag working points

Definition at line 135 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 133 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 135 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 133 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 135 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

electronId pattern we expect the following pattern: 0: fails 1: passes electron ID only 2: passes electron Isolation only 3: passes electron ID and Isolation only 4: passes conversion rejection 5: passes conversion rejection and ID 6: passes conversion rejection and Isolation 7: passes the whole selection As described on https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID

Definition at line 106 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra isolation criterion on electron

Definition at line 108 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

input sources for monitoring

Definition at line 86 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra selection on electrons

Definition at line 110 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

electronId label

Definition at line 95 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

histogram container

Definition at line 144 of file TopHLTSingleLeptonDQM.h.

Referenced by book(), booked(), fill(), and triggerBinLabels().

include btag information or not to be determined from the cfg

Definition at line 131 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

jetCorrector

Definition at line 121 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

jetID as an extra selection type

Definition at line 123 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra jetID selection on calo jets

Definition at line 125 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 86 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra selection on jets (here given as std::string as it depends on the the jet type, which selections are valid and which not)

Definition at line 128 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

instance label

Definition at line 82 of file TopHLTSingleLeptonDQM.h.

Referenced by book().

number of logged interesting events

Definition at line 140 of file TopHLTSingleLeptonDQM.h.

Referenced by fill().

mass window upper and lower edge

Definition at line 137 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

considers a vector of METs

Definition at line 84 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra isolation criterion on muon

Definition at line 116 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 86 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra selection on muons

Definition at line 118 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 86 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

extra selection on primary vertices; meant to investigate the pile-up effect

Definition at line 113 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

storage manager

Definition at line 142 of file TopHLTSingleLeptonDQM.h.

Referenced by book().

std::vector<std::string> TopHLTSingleLepton::MonitorEnsemble::triggerPaths_ [private]

trigger paths for monitoring, expected to be of form signalPath:MonitorPath

Definition at line 92 of file TopHLTSingleLeptonDQM.h.

Referenced by book(), fill(), and MonitorEnsemble().

trigger table

Definition at line 89 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

Definition at line 137 of file TopHLTSingleLeptonDQM.h.

Referenced by fill(), and MonitorEnsemble().

verbosity level for booking

Definition at line 76 of file TopHLTSingleLeptonDQM.h.

Referenced by book(), and MonitorEnsemble().