CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTHiggsPlotter Class Reference

#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 &)
 
void bookHistograms (DQMStore::IBooker &)
 
const std::string gethltpath () const
 
 HLTHiggsPlotter (const edm::ParameterSet &pset, const std::string &hltPath, const std::vector< unsigned int > &objectsType)
 
 ~HLTHiggsPlotter ()
 

Private Member Functions

void bookHist (const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
 
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
 
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
 

Detailed Description

Generate histograms for trigger efficiencies Higgs related Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate

Author
J. Duarte Campderros (based and adapted on J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package)
J. Klukas, M. Vander Donckt, J. Alcaraz

Definition at line 45 of file HLTHiggsPlotter.h.

Constructor & Destructor Documentation

HLTHiggsPlotter::HLTHiggsPlotter ( const edm::ParameterSet pset,
const std::string &  hltPath,
const std::vector< unsigned int > &  objectsType 
)

Definition at line 25 of file HLTHiggsPlotter.cc.

References _cutMaxEta, _cutMinPt, _objectsType, edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), and AlCaHLTBitMon_QueryRunRegistry::string.

27  :
28  _hltPath(hltPath),
29  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
30  _objectsType(std::set<unsigned int>(objectsType.begin(),objectsType.end())),
31  _nObjects(objectsType.size()),
32  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
33  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
34  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn"))
35 {
36  for(std::set<unsigned int>::iterator it = _objectsType.begin();
37  it != _objectsType.end(); ++it)
38  {
39  // Some parameters extracted from the .py
41  _cutMinPt[*it] = pset.getParameter<double>( std::string(objStr+"_cutMinPt").c_str() );
42  _cutMaxEta[*it] = pset.getParameter<double>( std::string(objStr+"_cutMaxEta").c_str() );
43  }
44 }
T getParameter(std::string const &) const
std::string _hltProcessName
std::vector< double > _parametersPhi
std::set< unsigned int > _objectsType
std::string _hltPath
std::map< unsigned int, double > _cutMinPt
std::vector< double > _parametersTurnOn
std::vector< double > _parametersEta
unsigned int _nObjects
std::map< unsigned int, double > _cutMaxEta
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
HLTHiggsPlotter::~HLTHiggsPlotter ( )

Definition at line 46 of file HLTHiggsPlotter.cc.

47 {
48 }

Member Function Documentation

void HLTHiggsPlotter::analyze ( const bool &  isPassTrigger,
const std::string &  source,
const std::vector< MatchStruct > &  matches 
)

Definition at line 86 of file HLTHiggsPlotter.cc.

References _objectsType, eta(), fillHist(), EVTColContainer::getTypeString(), j, phi, RecoTauCleanerPlugins::pt, and AlCaHLTBitMon_QueryRunRegistry::string.

89 {
90  if ( !isPassTrigger )
91  {
92  return;
93  }
94  std::map<unsigned int,int> countobjects;
95  // Initializing the count of the used object
96  for(std::set<unsigned int>::iterator co = _objectsType.begin();
97  co != _objectsType.end(); ++co)
98  {
99  countobjects[*co] = 0;
100  }
101 
102  int counttotal = 0;
103  const int totalobjectssize2 = 2*countobjects.size();
104  // Fill the histos if pass the trigger (just the two with higher pt)
105  for (size_t j = 0; j < matches.size(); ++j)
106  {
107  // Is this object owned by this trigger? If not we are not interested...
108  if ( _objectsType.find( matches[j].objType) == _objectsType.end() )
109  {
110  continue;
111  }
112 
113  const unsigned int objType = matches[j].objType;
114  const std::string objTypeStr = EVTColContainer::getTypeString(matches[j].objType);
115 
116  float pt = matches[j].pt;
117  float eta = matches[j].eta;
118  float phi = matches[j].phi;
119  this->fillHist(isPassTrigger,source,objTypeStr,"Eta",eta);
120  this->fillHist(isPassTrigger,source,objTypeStr,"Phi",phi);
121  if ( countobjects[objType] == 0 )
122  {
123  this->fillHist(isPassTrigger,source,objTypeStr,"MaxPt1",pt);
124  // Filled the high pt ...
125  ++(countobjects[objType]);
126  ++counttotal;
127  }
128  else if ( countobjects[objType] == 1 )
129  {
130  this->fillHist(isPassTrigger,source,objTypeStr,"MaxPt2",pt);
131  // Filled the second high pt ...
132  ++(countobjects[objType]);
133  ++counttotal;
134  }
135  else
136  {
137  if ( counttotal == totalobjectssize2 )
138  {
139  break;
140  }
141  }
142  }
143 }
T eta() const
std::set< unsigned int > _objectsType
int j
Definition: DBlmapReader.cc:9
void fillHist(const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:43
Definition: DDAxes.h:10
void HLTHiggsPlotter::beginJob ( void  )

Definition at line 51 of file HLTHiggsPlotter.cc.

52 {
53 }
void HLTHiggsPlotter::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 57 of file HLTHiggsPlotter.cc.

59 {
60 
61 }
void HLTHiggsPlotter::bookHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
DQMStore::IBooker ibooker 
)
private

Definition at line 146 of file HLTHiggsPlotter.cc.

References _elements, _hltPath, _parametersEta, _parametersPhi, _parametersTurnOn, DQMStore::IBooker::book1D(), prof2calltree::edges, h, i, bookConverter::max, min(), mergeVDriftHistosByStation::name, source, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

Referenced by bookHistograms().

150 {
151  std::string sourceUpper = source;
152  sourceUpper[0] = std::toupper(sourceUpper[0]);
153  std::string name = source + objType + variable + "_" + _hltPath;
154  TH1F * h = 0;
155 
156  if (variable.find("MaxPt") != std::string::npos)
157  {
158  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
159  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType + " "
160  "where event pass the "+ _hltPath;
161  const size_t nBins = _parametersTurnOn.size() - 1;
162  float * edges = new float[nBins + 1];
163  for(size_t i = 0; i < nBins + 1; i++)
164  {
165  edges[i] = _parametersTurnOn[i];
166  }
167  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
168  delete [] edges;
169  }
170  else
171  {
172  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
173  std::string title = symbol + " of " + sourceUpper + " " + objType + " "+
174  "where event pass the "+ _hltPath;
175  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
176 
177  int nBins = (int)params[0];
178  double min = params[1];
179  double max = params[2];
180  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
181  }
182  h->Sumw2();
183  _elements[name] = ibooker.book1D(name.c_str(), h);
184  delete h;
185 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > _parametersPhi
dictionary edges
std::map< std::string, MonitorElement * > _elements
std::string _hltPath
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
std::vector< double > _parametersTurnOn
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > _parametersEta
static std::string const source
Definition: EdmProvDump.cc:43
void HLTHiggsPlotter::bookHistograms ( DQMStore::IBooker ibooker)

Definition at line 63 of file HLTHiggsPlotter.cc.

References _objectsType, bookHist(), EVTColContainer::getTypeString(), i, source, and AlCaHLTBitMon_QueryRunRegistry::string.

64 {
65  for (std::set<unsigned int>::iterator it = _objectsType.begin();
66  it != _objectsType.end(); ++it)
67  {
68  std::vector<std::string> sources(2);
69  sources[0] = "gen";
70  sources[1] = "rec";
71 
72  const std::string objTypeStr = EVTColContainer::getTypeString(*it);
73 
74  for (size_t i = 0; i < sources.size(); i++)
75  {
76  std::string source = sources[i];
77  bookHist(source, objTypeStr, "Eta", ibooker);
78  bookHist(source, objTypeStr, "Phi", ibooker);
79  bookHist(source, objTypeStr, "MaxPt1", ibooker);
80  bookHist(source, objTypeStr, "MaxPt2", ibooker);
81  }
82  }
83 
84 }
int i
Definition: DBlmapReader.cc:9
std::set< unsigned int > _objectsType
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:43
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 187 of file HLTHiggsPlotter.cc.

References _elements, _hltPath, mergeVDriftHistosByStation::name, source, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

192 {
193  std::string sourceUpper = source;
194  sourceUpper[0] = toupper(sourceUpper[0]);
195  std::string name = source + objType + variable + "_" + _hltPath;
196 
197  _elements[name]->Fill(value);
198 }
std::map< std::string, MonitorElement * > _elements
std::string _hltPath
static std::string const source
Definition: EdmProvDump.cc:43
const std::string HLTHiggsPlotter::gethltpath ( ) const
inline

Definition at line 58 of file HLTHiggsPlotter.h.

References _hltPath.

58 { return _hltPath; }
std::string _hltPath

Member Data Documentation

std::map<unsigned int,double> HLTHiggsPlotter::_cutMaxEta
private

Definition at line 79 of file HLTHiggsPlotter.h.

Referenced by HLTHiggsPlotter().

std::map<unsigned int,double> HLTHiggsPlotter::_cutMinPt
private

Definition at line 78 of file HLTHiggsPlotter.h.

Referenced by HLTHiggsPlotter().

std::map<unsigned int,unsigned int> HLTHiggsPlotter::_cutMotherId
private

Definition at line 80 of file HLTHiggsPlotter.h.

std::map<unsigned int,std::vector<double> > HLTHiggsPlotter::_cutsDr
private

Definition at line 81 of file HLTHiggsPlotter.h.

std::map<std::string, MonitorElement *> HLTHiggsPlotter::_elements
private

Definition at line 84 of file HLTHiggsPlotter.h.

Referenced by bookHist(), and fillHist().

std::string HLTHiggsPlotter::_hltPath
private

Definition at line 66 of file HLTHiggsPlotter.h.

Referenced by bookHist(), fillHist(), and gethltpath().

std::string HLTHiggsPlotter::_hltProcessName
private

Definition at line 68 of file HLTHiggsPlotter.h.

unsigned int HLTHiggsPlotter::_nObjects
private

Definition at line 72 of file HLTHiggsPlotter.h.

std::set<unsigned int> HLTHiggsPlotter::_objectsType
private

Definition at line 70 of file HLTHiggsPlotter.h.

Referenced by analyze(), bookHistograms(), and HLTHiggsPlotter().

std::vector<double> HLTHiggsPlotter::_parametersEta
private

Definition at line 74 of file HLTHiggsPlotter.h.

Referenced by bookHist().

std::vector<double> HLTHiggsPlotter::_parametersPhi
private

Definition at line 75 of file HLTHiggsPlotter.h.

Referenced by bookHist().

std::vector<double> HLTHiggsPlotter::_parametersTurnOn
private

Definition at line 76 of file HLTHiggsPlotter.h.

Referenced by bookHist().