CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

TcMETAnalyzer Class Reference

#include <TcMETAnalyzer.h>

Inheritance diagram for TcMETAnalyzer:
TcMETAnalyzerBase

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &, const edm::TriggerResults &)
 Get the analysis.
void beginJob (DQMStore *dbe)
 Inizialize parameters for histo binning.
void beginRun (const edm::Run &, const edm::EventSetup &)
 Initialize run-based parameters.
void bookMESet (std::string)
void bookMonitorElement (std::string, bool)
void endJob ()
 Finish up a job.
void endRun (const edm::Run &iRun, const edm::EventSetup &iSetup, DQMStore *dbe)
 Finish up a run.
void fillMESet (const edm::Event &, std::string, const reco::MET &)
void fillMonitorElement (const edm::Event &, std::string, std::string, const reco::MET &, bool)
void makeRatePlot (std::string, double)
bool selectHighPtJetEvent (const edm::Event &)
bool selectLowPtJetEvent (const edm::Event &)
bool selectWElectronEvent (const edm::Event &)
bool selectWMuonEvent (const edm::Event &)
void setSource (std::string source)
 TcMETAnalyzer (const edm::ParameterSet &)
 Constructor.
virtual ~TcMETAnalyzer ()
 Destructor.

Public Attributes

int evtCounter

Private Attributes

bool _allhist
bool _allSelection
DQMStore_dbe
double _etThreshold
std::vector< std::string > _FolderNames
double _highPtTcJetThreshold
double _highTcMETThreshold
std::string _hlt_Ele
std::string _hlt_HighMET
std::string _hlt_HighPtJet
std::string _hlt_LowMET
std::string _hlt_LowPtJet
std::string _hlt_Muon
double _lowPtTcJetThreshold
double _lowTcMETThreshold
std::string _source
int _trig_Ele
int _trig_HighMET
int _trig_HighPtJet
int _trig_JetMB
int _trig_LowMET
int _trig_LowPtJet
int _trig_Muon
int _verbose
edm::InputTag HcalNoiseRBXCollectionTag
edm::InputTag HcalNoiseSummaryTag
double hfCalibFactor_
std::vector< std::string > HLTPathsJetMBByName_
reco::helper::JetIDHelperjetID
MonitorElementmeNevents
MonitorElementmeTcChargedEMFraction
MonitorElementmeTcChargedHadFraction
MonitorElementmeTcEz
MonitorElementmeTcMET
MonitorElementmeTcMETHPDNoise
MonitorElementmeTcMETIonFeedbck
MonitorElementmeTcMETPhi
MonitorElementmeTcMETRate
MonitorElementmeTcMETRBXNoise
MonitorElementmeTcMETSig
MonitorElementmeTcMEx
MonitorElementmeTcMExLS
MonitorElementmeTcMEy
MonitorElementmeTcMEyLS
MonitorElementmeTcMuonFraction
MonitorElementmeTcNeutralEMFraction
MonitorElementmeTcNeutralHadFraction
MonitorElementmeTcSumET
MonitorElementmetME
std::string metname
MonitorElementmeTriggerName_Ele
MonitorElementmeTriggerName_HighMET
MonitorElementmeTriggerName_HighPtJet
MonitorElementmeTriggerName_LowMET
MonitorElementmeTriggerName_LowPtJet
MonitorElementmeTriggerName_Muon
edm::ParameterSet parameters
edm::InputTag TcCandidatesTag
edm::InputTag theJetCollectionLabel
edm::InputTag thePfJetCollectionLabel
edm::InputTag theTcMETCollectionLabel

Detailed Description

DQM monitoring source for CaloMET

Date:
2010/06/16 18:49:03
Revision:
1.6
Author:
A.Apresyan - Caltech

Definition at line 39 of file TcMETAnalyzer.h.


Constructor & Destructor Documentation

TcMETAnalyzer::TcMETAnalyzer ( const edm::ParameterSet pSet)

Constructor.

Definition at line 30 of file TcMETAnalyzer.cc.

References Parameters::parameters.

                                                        {

  parameters = pSet;

}
TcMETAnalyzer::~TcMETAnalyzer ( ) [virtual]

Destructor.

Definition at line 37 of file TcMETAnalyzer.cc.

{ }

Member Function Documentation

void TcMETAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::TriggerResults triggerResults 
)

Get the analysis.

Definition at line 272 of file TcMETAnalyzer.cc.

References edm::HLTGlobalStatus::accept(), gather_cfg::cout, cmsPerfPublish::DirName, edm::Event::getByLabel(), i, edm::HandleBase::isValid(), LogDebug, LogTrace, metname, edm::Handle< T >::product(), edm::HLTGlobalStatus::size(), edm::TriggerNames::size(), edm::TriggerNames::triggerIndex(), and edm::Event::triggerNames().

                                                                     {

  if (_verbose) std::cout << "TcMETAnalyzer analyze" << std::endl;

  LogTrace(metname)<<"[TcMETAnalyzer] Analyze TcMET";

  metME->Fill(2);

  // ==========================================================  
  // Trigger information 
  //
  _trig_JetMB=0;
  _trig_HighPtJet=0;
  _trig_LowPtJet=0;
  _trig_HighMET=0;
  _trig_LowMET=0;
  if(&triggerResults) {   


    //
    //
    // Check how many HLT triggers are in triggerResults 
    int ntrigs = triggerResults.size();
    if (_verbose) std::cout << "ntrigs=" << ntrigs << std::endl;
    
    //
    //
    // If index=ntrigs, this HLT trigger doesn't exist in the HLT table for this data.
    const edm::TriggerNames & triggerNames = iEvent.triggerNames(triggerResults);
    
    //
    //
    // count number of requested Jet or MB HLT paths which have fired
    for (unsigned int i=0; i!=HLTPathsJetMBByName_.size(); i++) {
      unsigned int triggerIndex = triggerNames.triggerIndex(HLTPathsJetMBByName_[i]);
      if (triggerIndex<triggerResults.size()) {
        if (triggerResults.accept(triggerIndex)) {
          _trig_JetMB++;
        }
      }
    }
    // for empty input vectors (n==0), take all HLT triggers!
    if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.size()-1;

    //
    if (_verbose) std::cout << "triggerNames size" << " " << triggerNames.size() << std::endl;
    if (_verbose) std::cout << _hlt_HighPtJet << " " << triggerNames.triggerIndex(_hlt_HighPtJet) << std::endl;
    if (_verbose) std::cout << _hlt_LowPtJet  << " " << triggerNames.triggerIndex(_hlt_LowPtJet)  << std::endl;
    if (_verbose) std::cout << _hlt_HighMET   << " " << triggerNames.triggerIndex(_hlt_HighMET)   << std::endl;
    if (_verbose) std::cout << _hlt_LowMET    << " " << triggerNames.triggerIndex(_hlt_LowMET)    << std::endl;
    if (_verbose) std::cout << _hlt_Ele       << " " << triggerNames.triggerIndex(_hlt_Ele)       << std::endl;
    if (_verbose) std::cout << _hlt_Muon      << " " << triggerNames.triggerIndex(_hlt_Muon)      << std::endl;

    if (triggerNames.triggerIndex(_hlt_HighPtJet) != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_HighPtJet))) _trig_HighPtJet=1;

    if (triggerNames.triggerIndex(_hlt_LowPtJet)  != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_LowPtJet)))  _trig_LowPtJet=1;

    if (triggerNames.triggerIndex(_hlt_HighMET)   != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_HighMET)))   _trig_HighMET=1;

    if (triggerNames.triggerIndex(_hlt_LowMET)    != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_LowMET)))    _trig_LowMET=1;

    if (triggerNames.triggerIndex(_hlt_Ele)       != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_Ele)))       _trig_Ele=1;

    if (triggerNames.triggerIndex(_hlt_Muon)      != triggerNames.size() &&
        triggerResults.accept(triggerNames.triggerIndex(_hlt_Muon)))      _trig_Muon=1;
    
  } else {

    edm::LogInfo("TcMetAnalyzer") << "TriggerResults::HLT not found, "
      "automatically select events"; 

    // TriggerResults object not found. Look at all events.    
    _trig_JetMB=1;
  }

  // ==========================================================
  // TcMET information
  
  // **** Get the MET container  
  edm::Handle<reco::METCollection> tcmetcoll;
  iEvent.getByLabel(theTcMETCollectionLabel, tcmetcoll);
  
  if(!tcmetcoll.isValid()) return;

  const METCollection *tcmetcol = tcmetcoll.product();
  const MET *tcmet;
  tcmet = &(tcmetcol->front());
    
  LogTrace(metname)<<"[TcMETAnalyzer] Call to the TcMET analyzer";

  // ==========================================================
  //
  edm::Handle<HcalNoiseRBXCollection> HRBXCollection;
  iEvent.getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
  if (!HRBXCollection.isValid()) {
    LogDebug("") << "TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
    if (_verbose) std::cout << "TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
  }
  
  edm::Handle<HcalNoiseSummary> HNoiseSummary;
  iEvent.getByLabel(HcalNoiseSummaryTag,HNoiseSummary);
  if (!HNoiseSummary.isValid()) {
    LogDebug("") << "TcMETAnalyzer: Could not find Hcal NoiseSummary product" << std::endl;
    if (_verbose) std::cout << "TcMETAnalyzer: Could not find Hcal NoiseSummary product" << std::endl;
  }

  edm::Handle<reco::CaloJetCollection> caloJets;
  iEvent.getByLabel(theJetCollectionLabel, caloJets);
  if (!caloJets.isValid()) {
    LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
    if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
  }

  // ==========================================================
  // TcMET sanity check

  //   if (_source=="TcMET") validateMET(*tcmet, tcCandidates);
  
  // ==========================================================
  // JetID 

  if (_verbose) std::cout << "JetID starts" << std::endl;
  
  //
  // --- Loose cuts, not Tc specific for now!
  //
  bool bJetID=true;
  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin(); 
       cal!=caloJets->end(); ++cal){ 
    jetID->calculate(iEvent, *cal);
    if (_verbose) std::cout << jetID->n90Hits() << " " 
                            << jetID->restrictedEMF() << " "
                            << cal->pt() << std::endl;
    if (cal->pt()>10.){
      //
      // for all regions
      if (jetID->n90Hits()<2)  bJetID=false; 
      if (jetID->fHPD()>=0.98) bJetID=false; 
      //if (jetID->restrictedEMF()<0.01) bJetID=false; 
      //
      // for non-forward
      if (fabs(cal->eta())<2.55){
        if (cal->emEnergyFraction()<=0.01) bJetID=false; 
      }
      // for forward
      else {
        if (cal->emEnergyFraction()<=-0.9) bJetID=false; 
        if (cal->pt()>80.){
        if (cal->emEnergyFraction()>= 1.0) bJetID=false; 
        }
      } // forward vs non-forward
    }   // pt>10 GeV/c
  }     // calor-jets loop
 
  //
  // --- Tight cuts
  //
  bool bJetIDTight=true;
  bJetIDTight=bJetID;
  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin(); 
       cal!=caloJets->end(); ++cal){
    jetID->calculate(iEvent, *cal);
    if (cal->pt()>25.){
      //
      // for all regions
      if (jetID->fHPD()>=0.95) bJetIDTight=false; 
      //
      // for 1.0<|eta|<1.75
      if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
        if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false; 
      }
      //
      // for 1.75<|eta|<2.55
      else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
        if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false; 
      }
      //
      // for 2.55<|eta|<3.25
      else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
        if (cal->pt()< 50.                   && cal->emEnergyFraction()<=-0.3) bJetIDTight=false; 
        if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=false; 
        if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=false; 
        if (cal->pt()>=340.                  && cal->emEnergyFraction()<=-0.1 
                                             && cal->emEnergyFraction()>=0.95) bJetIDTight=false; 
      }
      //
      // for 3.25<|eta|
      else if (fabs(cal->eta())>=3.25){
        if (cal->pt()< 50.                   && cal->emEnergyFraction()<=-0.3
                                             && cal->emEnergyFraction()>=0.90) bJetIDTight=false; 
        if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
                                             && cal->emEnergyFraction()>=0.80) bJetIDTight=false; 
        if (cal->pt()>=130.                  && cal->emEnergyFraction()<=-0.1 
                                             && cal->emEnergyFraction()>=0.70) bJetIDTight=false; 
      }
    }   // pt>10 GeV/c
  }     // calor-jets loop
  
  if (_verbose) std::cout << "JetID ends" << std::endl;


  // ==========================================================
  // HCAL Noise filter
  
  bool bHcalNoiseFilter      = HNoiseSummary->passLooseNoiseFilter();
  bool bHcalNoiseFilterTight = HNoiseSummary->passTightNoiseFilter();

  // ==========================================================
  // Reconstructed MET Information - fill MonitorElements
  
  std::string DirName = "JetMET/MET/"+_source;
  
  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); 
       ic != _FolderNames.end(); ic++){
    if (*ic=="All")                                   fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    if (*ic=="Cleanup" && bHcalNoiseFilter && bJetID) fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    if (_allSelection) {
    if (*ic=="HcalNoiseFilter"      && bHcalNoiseFilter )       fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    if (*ic=="HcalNoiseFilterTight" && bHcalNoiseFilterTight )  fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    if (*ic=="JetID"      && bJetID)                            fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    if (*ic=="JetIDTight" && bJetIDTight)                       fillMESet(iEvent, DirName+"/"+*ic, *tcmet);
    }
  }
}
void TcMETAnalyzer::beginJob ( DQMStore dbe) [virtual]

Inizialize parameters for histo binning.

Implements TcMETAnalyzerBase.

Definition at line 39 of file TcMETAnalyzer.cc.

References DQMStore::book1D(), cmsPerfPublish::DirName, LogTrace, metname, Parameters::parameters, MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

                                           {

  evtCounter = 0;
  metname = "tcMETAnalyzer";

  // trigger information
  HLTPathsJetMBByName_ = parameters.getParameter<std::vector<std::string > >("HLTPathsJetMB");

  _hlt_HighPtJet = parameters.getParameter<std::string>("HLT_HighPtJet");
  _hlt_LowPtJet  = parameters.getParameter<std::string>("HLT_LowPtJet");
  _hlt_HighMET   = parameters.getParameter<std::string>("HLT_HighMET");
  _hlt_LowMET    = parameters.getParameter<std::string>("HLT_LowMET");
  _hlt_Ele       = parameters.getParameter<std::string>("HLT_Ele");
  _hlt_Muon      = parameters.getParameter<std::string>("HLT_Muon");

  // TcMET information
  theTcMETCollectionLabel       = parameters.getParameter<edm::InputTag>("TcMETCollectionLabel");
  _source                       = parameters.getParameter<std::string>("Source");

  // Other data collections
  HcalNoiseRBXCollectionTag   = parameters.getParameter<edm::InputTag>("HcalNoiseRBXCollection");
  HcalNoiseSummaryTag         = parameters.getParameter<edm::InputTag>("HcalNoiseSummary");
  theJetCollectionLabel       = parameters.getParameter<edm::InputTag>("JetCollectionLabel");

  // misc
  _verbose     = parameters.getParameter<int>("verbose");
  _etThreshold = parameters.getParameter<double>("etThreshold"); // MET threshold
  _allhist     = parameters.getParameter<bool>("allHist");       // Full set of monitoring histograms
  _allSelection= parameters.getParameter<bool>("allSelection");  // Plot with all sets of event selection

  _highPtTcJetThreshold = parameters.getParameter<double>("HighPtTcJetThreshold"); // High Pt Jet threshold
  _lowPtTcJetThreshold = parameters.getParameter<double>("LowPtTcJetThreshold");   // Low Pt Jet threshold
  _highTcMETThreshold = parameters.getParameter<double>("HighTcMETThreshold");     // High MET threshold
  _lowTcMETThreshold = parameters.getParameter<double>("LowTcMETThreshold");       // Low MET threshold

  //
  jetID = new reco::helper::JetIDHelper(parameters.getParameter<ParameterSet>("JetIDParams"));

  // DQStore stuff
  LogTrace(metname)<<"[TcMETAnalyzer] Parameters initialization";
  std::string DirName = "JetMET/MET/"+_source;
  dbe->setCurrentFolder(DirName);

  metME = dbe->book1D("metReco", "metReco", 4, 1, 5);
  metME->setBinLabel(2,"TcMET",1);

  _dbe = dbe;

  _FolderNames.push_back("All");
  _FolderNames.push_back("Cleanup");
  _FolderNames.push_back("HcalNoiseFilter");
  _FolderNames.push_back("HcalNoiseFilterTight");
  _FolderNames.push_back("JetID");
  _FolderNames.push_back("JetIDTight");

  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); 
       ic != _FolderNames.end(); ic++){
    if (*ic=="All")                  bookMESet(DirName+"/"+*ic);
    if (*ic=="Cleanup")              bookMESet(DirName+"/"+*ic);
    if (_allSelection){
    if (*ic=="HcalNoiseFilter")      bookMESet(DirName+"/"+*ic);
    if (*ic=="HcalNoiseFilterTight") bookMESet(DirName+"/"+*ic);
    if (*ic=="JetID")                bookMESet(DirName+"/"+*ic);
    if (*ic=="JetIDTight")           bookMESet(DirName+"/"+*ic);
    }
  }
}
void TcMETAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Initialize run-based parameters.

Definition at line 190 of file TcMETAnalyzer.cc.

{

}
void TcMETAnalyzer::bookMESet ( std::string  DirName)

Definition at line 115 of file TcMETAnalyzer.cc.

{

  bool bLumiSecPlot=false;
  if (DirName.find("All")!=std::string::npos) bLumiSecPlot=true;

  bookMonitorElement(DirName,bLumiSecPlot);

  if (_hlt_HighPtJet.size()){
    bookMonitorElement(DirName+"/"+"HighPtJet",false);
    meTriggerName_HighPtJet = _dbe->bookString("triggerName_HighPtJet", _hlt_HighPtJet);
  }  

  if (_hlt_LowPtJet.size()){
    bookMonitorElement(DirName+"/"+"LowPtJet",false);
    meTriggerName_LowPtJet = _dbe->bookString("triggerName_LowPtJet", _hlt_LowPtJet);
  }

  if (_hlt_HighMET.size()){
    bookMonitorElement(DirName+"/"+"HighMET",false);
    meTriggerName_HighMET = _dbe->bookString("triggerName_HighMET", _hlt_HighMET);
  }

  if (_hlt_LowMET.size()){
    bookMonitorElement(DirName+"/"+"LowMET",false);
    meTriggerName_LowMET = _dbe->bookString("triggerName_LowMET", _hlt_LowMET);
  }

  if (_hlt_Ele.size()){
    bookMonitorElement(DirName+"/"+"Ele",false);
    meTriggerName_Ele = _dbe->bookString("triggerName_Ele", _hlt_Ele);
  }

  if (_hlt_Muon.size()){
    bookMonitorElement(DirName+"/"+"Muon",false);
    meTriggerName_Muon = _dbe->bookString("triggerName_Muon", _hlt_Muon);
  }

}
void TcMETAnalyzer::bookMonitorElement ( std::string  DirName,
bool  bLumiSecPlot = false 
)

Definition at line 156 of file TcMETAnalyzer.cc.

References gather_cfg::cout, and Pi.

{

  if (_verbose) std::cout << "booMonitorElement " << DirName << std::endl;
  _dbe->setCurrentFolder(DirName);
 
  meNevents              = _dbe->book1D("METTask_Nevents", "METTask_Nevents"   ,1,0,1);
  meTcMEx                = _dbe->book1D("METTask_TcMEx",   "METTask_TcMEx"   ,500,-500,500);
  meTcMEy                = _dbe->book1D("METTask_TcMEy",   "METTask_TcMEy"   ,500,-500,500);
  meTcEz                 = _dbe->book1D("METTask_TcEz",    "METTask_TcEz"    ,500,-500,500);
  meTcMETSig             = _dbe->book1D("METTask_TcMETSig","METTask_TcMETSig",51,0,51);
  meTcMET                = _dbe->book1D("METTask_TcMET",   "METTask_TcMET"   ,500,0,1000);
  meTcMETPhi             = _dbe->book1D("METTask_TcMETPhi","METTask_TcMETPhi",80,-TMath::Pi(),TMath::Pi());
  meTcSumET              = _dbe->book1D("METTask_TcSumET", "METTask_TcSumET" ,500,0,2000);

  meTcNeutralEMFraction  = _dbe->book1D("METTask_TcNeutralEMFraction", "METTask_TcNeutralEMFraction" ,50,0.,1.);
  meTcNeutralHadFraction = _dbe->book1D("METTask_TcNeutralHadFraction","METTask_TcNeutralHadFraction",50,0.,1.);
  meTcChargedEMFraction  = _dbe->book1D("METTask_TcChargedEMFraction", "METTask_TcChargedEMFraction" ,50,0.,1.);
  meTcChargedHadFraction = _dbe->book1D("METTask_TcChargedHadFraction","METTask_TcChargedHadFraction",50,0.,1.);
  meTcMuonFraction       = _dbe->book1D("METTask_TcMuonFraction",      "METTask_TcMuonFraction"      ,50,0.,1.);

  meTcMETIonFeedbck      = _dbe->book1D("METTask_TcMETIonFeedbck", "METTask_TcMETIonFeedbck" ,500,0,1000);
  meTcMETHPDNoise        = _dbe->book1D("METTask_TcMETHPDNoise",   "METTask_TcMETHPDNoise"   ,500,0,1000);
  meTcMETRBXNoise        = _dbe->book1D("METTask_TcMETRBXNoise",   "METTask_TcMETRBXNoise"   ,500,0,1000);

  if (_allhist){
    if (bLumiSecPlot){
      meTcMExLS              = _dbe->book2D("METTask_TcMEx_LS","METTask_TcMEx_LS",200,-200,200,50,0.,500.);
      meTcMEyLS              = _dbe->book2D("METTask_TcMEy_LS","METTask_TcMEy_LS",200,-200,200,50,0.,500.);
    }
  }
}
void TcMETAnalyzer::endJob ( void  )

Finish up a job.

Definition at line 108 of file TcMETAnalyzer.cc.

                           {

  delete jetID;

}
void TcMETAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup,
DQMStore dbe 
)

Finish up a run.

Definition at line 196 of file TcMETAnalyzer.cc.

References cmsPerfPublish::DirName, TrackerOfflineValidation_Dqm_cff::dirName, MonitorElement::getRootObject(), MonitorElement::getTH1F(), and i.

{
  
  //
  //--- Check the time length of the Run from the lumi section plots

  std::string dirName = "JetMET/MET/"+_source+"/";
  _dbe->setCurrentFolder(dirName);

  TH1F* tlumisec;

  MonitorElement *meLumiSec = _dbe->get("aaa");
  meLumiSec = _dbe->get("JetMET/lumisec");

  int totlsec=0;
  double totltime=0.;
  if ( meLumiSec->getRootObject() ) {
    tlumisec = meLumiSec->getTH1F();
    for (int i=0; i<500; i++){
      if (tlumisec->GetBinContent(i+1)) totlsec++;
    }
    totltime = double(totlsec*90); // one lumi sec ~ 90 (sec)
  }

  if (totltime==0.) totltime=1.; 

  //
  //--- Make the integrated plots with rate (Hz)

  for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
    {

      std::string DirName;
      DirName = dirName+*ic;

      makeRatePlot(DirName,totltime);
      if (_hlt_HighPtJet.size()) makeRatePlot(DirName+"/"+_hlt_HighPtJet,totltime);
      if (_hlt_LowPtJet.size())  makeRatePlot(DirName+"/"+_hlt_LowPtJet,totltime);
      if (_hlt_HighMET.size())   makeRatePlot(DirName+"/"+_hlt_HighMET,totltime);
      if (_hlt_LowMET.size())    makeRatePlot(DirName+"/"+_hlt_LowMET,totltime);
      if (_hlt_Ele.size())       makeRatePlot(DirName+"/"+_hlt_Ele,totltime);
      if (_hlt_Muon.size())      makeRatePlot(DirName+"/"+_hlt_Muon,totltime);

    }
}
void TcMETAnalyzer::fillMESet ( const edm::Event iEvent,
std::string  DirName,
const reco::MET tcmet 
)

Definition at line 505 of file TcMETAnalyzer.cc.

{

  _dbe->setCurrentFolder(DirName);

  bool bLumiSecPlot=false;
  if (DirName.find("All")) bLumiSecPlot=true;

  if (_trig_JetMB) fillMonitorElement(iEvent,DirName,"",tcmet, bLumiSecPlot);
  if (_hlt_HighPtJet.size() && _trig_HighPtJet) fillMonitorElement(iEvent,DirName,"HighPtJet",tcmet,false);
  if (_hlt_LowPtJet.size() && _trig_LowPtJet) fillMonitorElement(iEvent,DirName,"LowPtJet",tcmet,false);
  if (_hlt_HighMET.size() && _trig_HighMET) fillMonitorElement(iEvent,DirName,"HighMET",tcmet,false);
  if (_hlt_LowMET.size() && _trig_LowMET) fillMonitorElement(iEvent,DirName,"LowMET",tcmet,false);
  if (_hlt_Ele.size() && _trig_Ele) fillMonitorElement(iEvent,DirName,"Ele",tcmet,false);
  if (_hlt_Muon.size() && _trig_Muon) fillMonitorElement(iEvent,DirName,"Muon",tcmet,false);
}
void TcMETAnalyzer::fillMonitorElement ( const edm::Event iEvent,
std::string  DirName,
std::string  TriggerTypeName,
const reco::MET tcmet,
bool  bLumiSecPlot 
)

Definition at line 524 of file TcMETAnalyzer.cc.

References gather_cfg::cout, reco::MET::e_longitudinal(), edm::EventBase::luminosityBlock(), reco::MET::mEtSig(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::MET::sumEt().

{

  if (TriggerTypeName=="HighPtJet") {
    if (!selectHighPtJetEvent(iEvent)) return;
  }
  else if (TriggerTypeName=="LowPtJet") {
    if (!selectLowPtJetEvent(iEvent)) return;
  }
  else if (TriggerTypeName=="HighMET") {
    if (tcmet.pt()<_highTcMETThreshold) return;
  }
  else if (TriggerTypeName=="LowMET") {
    if (tcmet.pt()<_lowTcMETThreshold) return;
  }
  else if (TriggerTypeName=="Ele") {
    if (!selectWElectronEvent(iEvent)) return;
  }
  else if (TriggerTypeName=="Muon") {
    if (!selectWMuonEvent(iEvent)) return;
  }
  
// Reconstructed MET Information
  double tcSumET  = tcmet.sumEt();
  double tcMETSig = tcmet.mEtSig();
  double tcEz     = tcmet.e_longitudinal();
  double tcMET    = tcmet.pt();
  double tcMEx    = tcmet.px();
  double tcMEy    = tcmet.py();
  double tcMETPhi = tcmet.phi();

  //
  int myLuminosityBlock;
  //  myLuminosityBlock = (evtCounter++)/1000;
  myLuminosityBlock = iEvent.luminosityBlock();
  //

  if (TriggerTypeName!="") DirName = DirName +"/"+TriggerTypeName;

  if (_verbose) std::cout << "_etThreshold = " << _etThreshold << std::endl;
  if (tcMET>_etThreshold){
    
    meTcMEx    = _dbe->get(DirName+"/"+"METTask_TcMEx");    if (meTcMEx    && meTcMEx->getRootObject())    meTcMEx->Fill(tcMEx);
    meTcMEy    = _dbe->get(DirName+"/"+"METTask_TcMEy");    if (meTcMEy    && meTcMEy->getRootObject())    meTcMEy->Fill(tcMEy);
    meTcMET    = _dbe->get(DirName+"/"+"METTask_TcMET");    if (meTcMET    && meTcMET->getRootObject())    meTcMET->Fill(tcMET);
    meTcMETPhi = _dbe->get(DirName+"/"+"METTask_TcMETPhi"); if (meTcMETPhi && meTcMETPhi->getRootObject()) meTcMETPhi->Fill(tcMETPhi);
    meTcSumET  = _dbe->get(DirName+"/"+"METTask_TcSumET");  if (meTcSumET  && meTcSumET->getRootObject())  meTcSumET->Fill(tcSumET);
    meTcMETSig = _dbe->get(DirName+"/"+"METTask_TcMETSig"); if (meTcMETSig && meTcMETSig->getRootObject()) meTcMETSig->Fill(tcMETSig);
    meTcEz     = _dbe->get(DirName+"/"+"METTask_TcEz");     if (meTcEz     && meTcEz->getRootObject())     meTcEz->Fill(tcEz);

    meTcMETIonFeedbck = _dbe->get(DirName+"/"+"METTask_TcMETIonFeedbck");  if (meTcMETIonFeedbck && meTcMETIonFeedbck->getRootObject()) meTcMETIonFeedbck->Fill(tcMET);
    meTcMETHPDNoise   = _dbe->get(DirName+"/"+"METTask_TcMETHPDNoise");    if (meTcMETHPDNoise   && meTcMETHPDNoise->getRootObject())   meTcMETHPDNoise->Fill(tcMET);
    meTcMETRBXNoise   = _dbe->get(DirName+"/"+"METTask_TcMETRBXNoise");    if (meTcMETRBXNoise   && meTcMETRBXNoise->getRootObject())   meTcMETRBXNoise->Fill(tcMET);
        
    if (_allhist){
      if (bLumiSecPlot){
        meTcMExLS = _dbe->get(DirName+"/"+"METTask_TcMExLS"); if (meTcMExLS && meTcMExLS->getRootObject()) meTcMExLS->Fill(tcMEx,myLuminosityBlock);
        meTcMEyLS = _dbe->get(DirName+"/"+"METTask_TcMEyLS"); if (meTcMEyLS && meTcMEyLS->getRootObject()) meTcMEyLS->Fill(tcMEy,myLuminosityBlock);
      }
    } // _allhist
  } // et threshold cut
}
void TcMETAnalyzer::makeRatePlot ( std::string  DirName,
double  totltime 
)

Definition at line 243 of file TcMETAnalyzer.cc.

References MonitorElement::getRootObject(), MonitorElement::getTH1F(), and i.

{

  _dbe->setCurrentFolder(DirName);
  MonitorElement *meTcMET = _dbe->get(DirName+"/"+"METTask_TcMET");

  TH1F* tTcMET;
  TH1F* tTcMETRate;

  if ( meTcMET )
    if ( meTcMET->getRootObject() ) {
      tTcMET     = meTcMET->getTH1F();
      
      // Integral plot & convert number of events to rate (hz)
      tTcMETRate = (TH1F*) tTcMET->Clone("METTask_TcMETRate");
      for (int i = tTcMETRate->GetNbinsX()-1; i>=0; i--){
        tTcMETRate->SetBinContent(i+1,tTcMETRate->GetBinContent(i+2)+tTcMET->GetBinContent(i+1));
      }
      for (int i = 0; i<tTcMETRate->GetNbinsX(); i++){
        tTcMETRate->SetBinContent(i+1,tTcMETRate->GetBinContent(i+1)/double(totltime));
      }      

      meTcMETRate      = _dbe->book1D("METTask_TcMETRate",tTcMETRate);
      
    }

}
bool TcMETAnalyzer::selectHighPtJetEvent ( const edm::Event iEvent)

Definition at line 590 of file TcMETAnalyzer.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and LogDebug.

                                                              {

  bool return_value=false;

  edm::Handle<reco::CaloJetCollection> caloJets;
  iEvent.getByLabel(theJetCollectionLabel, caloJets);
  if (!caloJets.isValid()) {
    LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
    if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
  }

  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin(); 
       cal!=caloJets->end(); ++cal){
    if (cal->pt()>_highPtTcJetThreshold){
      return_value=true;
    }
  }
  
  return return_value;
}
bool TcMETAnalyzer::selectLowPtJetEvent ( const edm::Event iEvent)

Definition at line 612 of file TcMETAnalyzer.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and LogDebug.

                                                             {

  bool return_value=false;

  edm::Handle<reco::CaloJetCollection> caloJets;
  iEvent.getByLabel(theJetCollectionLabel, caloJets);
  if (!caloJets.isValid()) {
    LogDebug("") << "TcMETAnalyzer: Could not find jet product" << std::endl;
    if (_verbose) std::cout << "TcMETAnalyzer: Could not find jet product" << std::endl;
  }

  for (reco::CaloJetCollection::const_iterator cal = caloJets->begin(); 
       cal!=caloJets->end(); ++cal){
    if (cal->pt()>_lowPtTcJetThreshold){
      return_value=true;
    }
  }

  return return_value;

}
bool TcMETAnalyzer::selectWElectronEvent ( const edm::Event iEvent)

Definition at line 635 of file TcMETAnalyzer.cc.

                                                              {

  bool return_value=false;

  /*
    W-electron event selection comes here
   */

  return return_value;

}
bool TcMETAnalyzer::selectWMuonEvent ( const edm::Event iEvent)

Definition at line 648 of file TcMETAnalyzer.cc.

                                                          {

  bool return_value=false;

  /*
    W-muon event selection comes here
   */

  return return_value;

}
void TcMETAnalyzer::setSource ( std::string  source) [inline]

Definition at line 78 of file TcMETAnalyzer.h.

References _source, and LaserTracksInput_cfi::source.

                                   {
    _source = source;
  }

Member Data Documentation

bool TcMETAnalyzer::_allhist [private]

Definition at line 135 of file TcMETAnalyzer.h.

Definition at line 136 of file TcMETAnalyzer.h.

Definition at line 142 of file TcMETAnalyzer.h.

double TcMETAnalyzer::_etThreshold [private]

Definition at line 126 of file TcMETAnalyzer.h.

std::vector<std::string> TcMETAnalyzer::_FolderNames [private]

Definition at line 139 of file TcMETAnalyzer.h.

Definition at line 120 of file TcMETAnalyzer.h.

Definition at line 122 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_Ele [private]

Definition at line 108 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_HighMET [private]

Definition at line 106 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_HighPtJet [private]

Definition at line 104 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_LowMET [private]

Definition at line 107 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_LowPtJet [private]

Definition at line 105 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_hlt_Muon [private]

Definition at line 109 of file TcMETAnalyzer.h.

Definition at line 121 of file TcMETAnalyzer.h.

Definition at line 123 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::_source [private]

Definition at line 92 of file TcMETAnalyzer.h.

Referenced by setSource().

int TcMETAnalyzer::_trig_Ele [private]

Definition at line 116 of file TcMETAnalyzer.h.

Definition at line 114 of file TcMETAnalyzer.h.

Definition at line 112 of file TcMETAnalyzer.h.

Definition at line 111 of file TcMETAnalyzer.h.

Definition at line 115 of file TcMETAnalyzer.h.

Definition at line 113 of file TcMETAnalyzer.h.

Definition at line 117 of file TcMETAnalyzer.h.

int TcMETAnalyzer::_verbose [private]

Definition at line 89 of file TcMETAnalyzer.h.

Definition at line 82 of file TcMETAnalyzer.h.

Definition at line 95 of file TcMETAnalyzer.h.

Definition at line 96 of file TcMETAnalyzer.h.

Definition at line 129 of file TcMETAnalyzer.h.

std::vector<std::string > TcMETAnalyzer::HLTPathsJetMBByName_ [private]

Definition at line 102 of file TcMETAnalyzer.h.

Definition at line 132 of file TcMETAnalyzer.h.

Definition at line 160 of file TcMETAnalyzer.h.

Definition at line 156 of file TcMETAnalyzer.h.

Definition at line 157 of file TcMETAnalyzer.h.

Definition at line 163 of file TcMETAnalyzer.h.

Definition at line 165 of file TcMETAnalyzer.h.

Definition at line 172 of file TcMETAnalyzer.h.

Definition at line 171 of file TcMETAnalyzer.h.

Definition at line 166 of file TcMETAnalyzer.h.

Definition at line 175 of file TcMETAnalyzer.h.

Definition at line 173 of file TcMETAnalyzer.h.

Definition at line 164 of file TcMETAnalyzer.h.

Definition at line 161 of file TcMETAnalyzer.h.

Definition at line 168 of file TcMETAnalyzer.h.

Definition at line 162 of file TcMETAnalyzer.h.

Definition at line 169 of file TcMETAnalyzer.h.

Definition at line 158 of file TcMETAnalyzer.h.

Definition at line 154 of file TcMETAnalyzer.h.

Definition at line 155 of file TcMETAnalyzer.h.

Definition at line 167 of file TcMETAnalyzer.h.

Definition at line 145 of file TcMETAnalyzer.h.

std::string TcMETAnalyzer::metname [private]

Definition at line 91 of file TcMETAnalyzer.h.

Definition at line 151 of file TcMETAnalyzer.h.

Definition at line 149 of file TcMETAnalyzer.h.

Definition at line 147 of file TcMETAnalyzer.h.

Definition at line 150 of file TcMETAnalyzer.h.

Definition at line 148 of file TcMETAnalyzer.h.

Definition at line 152 of file TcMETAnalyzer.h.

Definition at line 87 of file TcMETAnalyzer.h.

Definition at line 99 of file TcMETAnalyzer.h.

Definition at line 97 of file TcMETAnalyzer.h.

Definition at line 98 of file TcMETAnalyzer.h.

Definition at line 94 of file TcMETAnalyzer.h.