#include <HLTHiggsPlotter.h>
Public Member Functions | |
void | analyze (const bool &isPassTrigger, const std::string &source, const std::vector< MatchStruct > &matches) |
void | beginJob () |
void | beginRun (const edm::Run &, const edm::EventSetup &) |
const std::string | gethltpath () const |
HLTHiggsPlotter (const edm::ParameterSet &pset, const std::string &hltPath, const std::vector< unsigned int > &objectsType, DQMStore *dbe) | |
~HLTHiggsPlotter () | |
Private Member Functions | |
void | bookHist (const std::string &source, const std::string &objType, const std::string &variable) |
void | fillHist (const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value) |
Private Attributes | |
std::map< unsigned int, double > | _cutMaxEta |
std::map< unsigned int, double > | _cutMinPt |
std::map< unsigned int, unsigned int > | _cutMotherId |
std::map< unsigned int, std::vector< double > > | _cutsDr |
DQMStore * | _dbe |
std::map< std::string, MonitorElement * > | _elements |
std::string | _hltPath |
std::string | _hltProcessName |
unsigned int | _nObjects |
std::set< unsigned int > | _objectsType |
std::vector< double > | _parametersEta |
std::vector< double > | _parametersPhi |
std::vector< double > | _parametersTurnOn |
Generate histograms for trigger efficiencies Higgs related Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate
Definition at line 47 of file HLTHiggsPlotter.h.
HLTHiggsPlotter::HLTHiggsPlotter | ( | const edm::ParameterSet & | pset, |
const std::string & | hltPath, | ||
const std::vector< unsigned int > & | objectsType, | ||
DQMStore * | dbe | ||
) |
Definition at line 27 of file HLTHiggsPlotter.cc.
References _cutMaxEta, _cutMinPt, _objectsType, edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), and AlCaHLTBitMon_QueryRunRegistry::string.
: _hltPath(hltPath), _hltProcessName(pset.getParameter<std::string>("hltProcessName")), _objectsType(std::set<unsigned int>(objectsType.begin(),objectsType.end())), _nObjects(objectsType.size()), _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")), _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")), _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")), _dbe(dbe) { for(std::set<unsigned int>::iterator it = _objectsType.begin(); it != _objectsType.end(); ++it) { // Some parameters extracted from the .py std::string objStr = EVTColContainer::getTypeString( *it ); _cutMinPt[*it] = pset.getParameter<double>( std::string(objStr+"_cutMinPt").c_str() ); _cutMaxEta[*it] = pset.getParameter<double>( std::string(objStr+"_cutMaxEta").c_str() ); } }
HLTHiggsPlotter::~HLTHiggsPlotter | ( | ) |
Definition at line 50 of file HLTHiggsPlotter.cc.
{ }
void HLTHiggsPlotter::analyze | ( | const bool & | isPassTrigger, |
const std::string & | source, | ||
const std::vector< MatchStruct > & | matches | ||
) |
Definition at line 84 of file HLTHiggsPlotter.cc.
References _objectsType, eta(), fillHist(), EVTColContainer::getTypeString(), j, phi, and AlCaHLTBitMon_QueryRunRegistry::string.
{ if ( !isPassTrigger ) { return; } std::map<unsigned int,int> countobjects; // Initializing the count of the used object for(std::set<unsigned int>::iterator co = _objectsType.begin(); co != _objectsType.end(); ++co) { countobjects[*co] = 0; } int counttotal = 0; const int totalobjectssize2 = 2*countobjects.size(); // Fill the histos if pass the trigger (just the two with higher pt) for (size_t j = 0; j < matches.size(); ++j) { // Is this object owned by this trigger? If not we are not interested... if ( _objectsType.find( matches[j].objType) == _objectsType.end() ) { continue; } const unsigned int objType = matches[j].objType; const std::string objTypeStr = EVTColContainer::getTypeString(matches[j].objType); float pt = matches[j].pt; float eta = matches[j].eta; float phi = matches[j].phi; this->fillHist(isPassTrigger,source,objTypeStr,"Eta",eta); this->fillHist(isPassTrigger,source,objTypeStr,"Phi",phi); if ( countobjects[objType] == 0 ) { this->fillHist(isPassTrigger,source,objTypeStr,"MaxPt1",pt); // Filled the high pt ... ++(countobjects[objType]); ++counttotal; } else if ( countobjects[objType] == 1 ) { this->fillHist(isPassTrigger,source,objTypeStr,"MaxPt2",pt); // Filled the second high pt ... ++(countobjects[objType]); ++counttotal; } else { if ( counttotal == totalobjectssize2 ) { break; } } } }
void HLTHiggsPlotter::beginJob | ( | void | ) |
Definition at line 55 of file HLTHiggsPlotter.cc.
{ }
void HLTHiggsPlotter::beginRun | ( | const edm::Run & | iRun, |
const edm::EventSetup & | iSetup | ||
) |
Definition at line 61 of file HLTHiggsPlotter.cc.
References _objectsType, bookHist(), EVTColContainer::getTypeString(), i, LaserTracksInput_cfi::source, and AlCaHLTBitMon_QueryRunRegistry::string.
{ for (std::set<unsigned int>::iterator it = _objectsType.begin(); it != _objectsType.end(); ++it) { std::vector<std::string> sources(2); sources[0] = "gen"; sources[1] = "rec"; const std::string objTypeStr = EVTColContainer::getTypeString(*it); for (size_t i = 0; i < sources.size(); i++) { std::string source = sources[i]; bookHist(source, objTypeStr, "Eta"); bookHist(source, objTypeStr, "Phi"); bookHist(source, objTypeStr, "MaxPt1"); bookHist(source, objTypeStr, "MaxPt2"); } } }
void HLTHiggsPlotter::bookHist | ( | const std::string & | source, |
const std::string & | objType, | ||
const std::string & | variable | ||
) | [private] |
Definition at line 144 of file HLTHiggsPlotter.cc.
References _dbe, _elements, _hltPath, _parametersEta, _parametersPhi, _parametersTurnOn, DQMStore::book1D(), prof2calltree::edges, h, i, max(), min, mergeVDriftHistosByStation::name, LaserTracksInput_cfi::source, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.
Referenced by beginRun().
{ std::string sourceUpper = source; sourceUpper[0] = std::toupper(sourceUpper[0]); std::string name = source + objType + variable + "_" + _hltPath; TH1F * h = 0; if (variable.find("MaxPt") != std::string::npos) { std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading"; std::string title = "pT of " + desc + " " + sourceUpper + " " + objType + " " "where event pass the "+ _hltPath; const size_t nBins = _parametersTurnOn.size() - 1; float * edges = new float[nBins + 1]; for(size_t i = 0; i < nBins + 1; i++) { edges[i] = _parametersTurnOn[i]; } h = new TH1F(name.c_str(), title.c_str(), nBins, edges); delete [] edges; } else { std::string symbol = (variable == "Eta") ? "#eta" : "#phi"; std::string title = symbol + " of " + sourceUpper + " " + objType + " "+ "where event pass the "+ _hltPath; std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi; int nBins = (int)params[0]; double min = params[1]; double max = params[2]; h = new TH1F(name.c_str(), title.c_str(), nBins, min, max); } h->Sumw2(); _elements[name] = _dbe->book1D(name, h); delete h; }
void HLTHiggsPlotter::fillHist | ( | const bool & | passTrigger, |
const std::string & | source, | ||
const std::string & | objType, | ||
const std::string & | var, | ||
const float & | value | ||
) | [private] |
Definition at line 184 of file HLTHiggsPlotter.cc.
References _elements, _hltPath, mergeVDriftHistosByStation::name, LaserTracksInput_cfi::source, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by analyze().
{ std::string sourceUpper = source; sourceUpper[0] = toupper(sourceUpper[0]); std::string name = source + objType + variable + "_" + _hltPath; _elements[name]->Fill(value); }
const std::string HLTHiggsPlotter::gethltpath | ( | ) | const [inline] |
std::map<unsigned int,double> HLTHiggsPlotter::_cutMaxEta [private] |
Definition at line 81 of file HLTHiggsPlotter.h.
Referenced by HLTHiggsPlotter().
std::map<unsigned int,double> HLTHiggsPlotter::_cutMinPt [private] |
Definition at line 80 of file HLTHiggsPlotter.h.
Referenced by HLTHiggsPlotter().
std::map<unsigned int,unsigned int> HLTHiggsPlotter::_cutMotherId [private] |
Definition at line 82 of file HLTHiggsPlotter.h.
std::map<unsigned int,std::vector<double> > HLTHiggsPlotter::_cutsDr [private] |
Definition at line 83 of file HLTHiggsPlotter.h.
DQMStore* HLTHiggsPlotter::_dbe [private] |
Definition at line 86 of file HLTHiggsPlotter.h.
Referenced by bookHist().
std::map<std::string, MonitorElement *> HLTHiggsPlotter::_elements [private] |
Definition at line 87 of file HLTHiggsPlotter.h.
Referenced by bookHist(), and fillHist().
std::string HLTHiggsPlotter::_hltPath [private] |
Definition at line 68 of file HLTHiggsPlotter.h.
Referenced by bookHist(), fillHist(), and gethltpath().
std::string HLTHiggsPlotter::_hltProcessName [private] |
Definition at line 70 of file HLTHiggsPlotter.h.
unsigned int HLTHiggsPlotter::_nObjects [private] |
Definition at line 74 of file HLTHiggsPlotter.h.
std::set<unsigned int> HLTHiggsPlotter::_objectsType [private] |
Definition at line 72 of file HLTHiggsPlotter.h.
Referenced by analyze(), beginRun(), and HLTHiggsPlotter().
std::vector<double> HLTHiggsPlotter::_parametersEta [private] |
Definition at line 76 of file HLTHiggsPlotter.h.
Referenced by bookHist().
std::vector<double> HLTHiggsPlotter::_parametersPhi [private] |
Definition at line 77 of file HLTHiggsPlotter.h.
Referenced by bookHist().
std::vector<double> HLTHiggsPlotter::_parametersTurnOn [private] |
Definition at line 78 of file HLTHiggsPlotter.h.
Referenced by bookHist().