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 &)
 
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
 

Detailed Description

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

Date:
2012/03/23 11:50:56
Revision:
1.7
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 47 of file HLTHiggsPlotter.h.

Constructor & Destructor Documentation

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.

30  :
31  _hltPath(hltPath),
32  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
33  _objectsType(std::set<unsigned int>(objectsType.begin(),objectsType.end())),
34  _nObjects(objectsType.size()),
35  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
36  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
37  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
38  _dbe(dbe)
39 {
40  for(std::set<unsigned int>::iterator it = _objectsType.begin();
41  it != _objectsType.end(); ++it)
42  {
43  // Some parameters extracted from the .py
45  _cutMinPt[*it] = pset.getParameter<double>( std::string(objStr+"_cutMinPt").c_str() );
46  _cutMaxEta[*it] = pset.getParameter<double>( std::string(objStr+"_cutMaxEta").c_str() );
47  }
48 }
T getParameter(std::string const &) const
static std::string getTypeString(const unsigned int &objtype)
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
HLTHiggsPlotter::~HLTHiggsPlotter ( )

Definition at line 50 of file HLTHiggsPlotter.cc.

51 {
52 }

Member Function Documentation

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.

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

Definition at line 55 of file HLTHiggsPlotter.cc.

56 {
57 }
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.

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

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

189 {
190  std::string sourceUpper = source;
191  sourceUpper[0] = toupper(sourceUpper[0]);
192  std::string name = source + objType + variable + "_" + _hltPath;
193 
194  _elements[name]->Fill(value);
195 }
std::map< std::string, MonitorElement * > _elements
std::string _hltPath
const std::string HLTHiggsPlotter::gethltpath ( ) const
inline

Definition at line 60 of file HLTHiggsPlotter.h.

References _hltPath.

60 { return _hltPath; }
std::string _hltPath

Member Data Documentation

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().