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
TopElectronHLTOfflineClient Class Reference

#include <TopElectronHLTOfflineClient.h>

Inheritance diagram for TopElectronHLTOfflineClient:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
void createSingleEffHists (const std::string &, const std::string &, const std::string &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &c)
 
MonitorElementmakeEffMonElemFromPassAndAll (const std::string &name, const MonitorElement *pass, const MonitorElement *fail)
 
 TopElectronHLTOfflineClient (const edm::ParameterSet &)
 
virtual ~TopElectronHLTOfflineClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

TopElectronHLTOfflineClientoperator= (const TopElectronHLTOfflineClient &rhs)
 
void runClient_ ()
 
 TopElectronHLTOfflineClient (const TopElectronHLTOfflineClient &rhs)
 

Private Attributes

bool addExtraId_
 
DQMStoredbe_
 
std::string dirName_
 
std::vector< std::string > electronIdNames_
 
std::vector< std::string > electronTriggerNames_
 
std::vector< std::string > eleMeNames_
 
std::string hltTag_
 
bool runClientEndJob_
 
bool runClientEndLumiBlock_
 
bool runClientEndRun_
 
std::vector< std::string > superMeNames_
 
std::vector< std::string > superTriggerNames_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 37 of file TopElectronHLTOfflineClient.h.

Constructor & Destructor Documentation

TopElectronHLTOfflineClient::TopElectronHLTOfflineClient ( const TopElectronHLTOfflineClient rhs)
inlineprivate

Definition at line 60 of file TopElectronHLTOfflineClient.h.

60 {}
TopElectronHLTOfflineClient::TopElectronHLTOfflineClient ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file TopElectronHLTOfflineClient.cc.

References addExtraId_, dbe_, dirName_, electronIdNames_, electronTriggerNames_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag_, cppFunctionSkipper::operator, runClientEndJob_, runClientEndLumiBlock_, runClientEndRun_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), AlCaHLTBitMon_QueryRunRegistry::string, and superTriggerNames_.

15  : dbe_(NULL)
16 {
18 
19  if (!dbe_)
20  {
21  edm::LogError("TopElectronHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
22  }
23 
24  if(iConfig.getUntrackedParameter<bool>("DQMStore", false))
25  {
26  if (dbe_) dbe_->setVerbose(0);
27  }
28 
29  dirName_=iConfig.getParameter<std::string>("DQMDirName");
30 
31  if (dbe_)
33 
34  hltTag_ = iConfig.getParameter<std::string>("hltTag");
35 
36  electronIdNames_ = iConfig.getParameter<std::vector<std::string> >("electronIdNames");
37  superTriggerNames_ = iConfig.getParameter<std::vector<std::string> >("superTriggerNames");
38  electronTriggerNames_ = iConfig.getParameter<std::vector<std::string> >("electronTriggerNames");
39  addExtraId_ = iConfig.getParameter<bool>("addExtraId");
40 
41  runClientEndLumiBlock_ = iConfig.getParameter<bool>("runClientEndLumiBlock");
42  runClientEndRun_ = iConfig.getParameter<bool>("runClientEndRun");
43  runClientEndJob_ = iConfig.getParameter<bool>("runClientEndJob");
44 
45 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define NULL
Definition: scimark2.h:8
std::vector< std::string > electronIdNames_
std::vector< std::string > electronTriggerNames_
void setVerbose(unsigned level)
Definition: DQMStore.cc:631
std::vector< std::string > superTriggerNames_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
TopElectronHLTOfflineClient::~TopElectronHLTOfflineClient ( )
virtual

Definition at line 48 of file TopElectronHLTOfflineClient.cc.

49 {
50 }

Member Function Documentation

void TopElectronHLTOfflineClient::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 119 of file TopElectronHLTOfflineClient.cc.

120 {
121 }
void TopElectronHLTOfflineClient::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file TopElectronHLTOfflineClient.cc.

References addExtraId_, electronIdNames_, electronTriggerNames_, eleMeNames_, i, j, gen::k, ConfigFiles::l, m, superMeNames_, and superTriggerNames_.

53 {
54  //compose the ME names we need
55 
56  // Eta regions
57  std::vector<std::string> regions;
58  regions.push_back("EB");
59  regions.push_back("EE");
60 
61  // Electron IDs, including own extra ID
62  std::vector<std::string> eleIdNames;
63  for (size_t i = 0; i < electronIdNames_.size(); ++i)
64  {
65  eleIdNames.push_back(electronIdNames_[i]);
66  if (addExtraId_)
67  eleIdNames.push_back(electronIdNames_[i]+"extraId");
68  }
69 
70  std::vector<std::string> vars;
71  vars.push_back("_et");
72  vars.push_back("_eta");
73  vars.push_back("_phi");
74  vars.push_back("_isolEm");
75  vars.push_back("_isolHad");
76  vars.push_back("_minDeltaR");
77  vars.push_back("_global_n30jets");
78  vars.push_back("_global_sumEt");
79  vars.push_back("_gsftrack_etaError");
80  vars.push_back("_gsftrack_phiError");
81  vars.push_back("_gsftrack_numberOfValidHits");
82  vars.push_back("_gsftrack_dzPV");
83 
84 
85  for (size_t i = 0; i < eleIdNames.size(); ++i)
86  for (size_t j = 0; j < regions.size(); ++j)
87  for (size_t k = 0; k < vars.size(); ++k)
88  for (size_t l = 0; l < superTriggerNames_.size(); ++l)
89  {
90  superMeNames_.push_back("ele_"+superTriggerNames_[l]+"_"+regions[j]+"_"+eleIdNames[i]+vars[k] );
91  for (size_t m = 0; m < electronTriggerNames_.size(); ++m)
92  {
93  eleMeNames_.push_back("ele_"+superTriggerNames_[l]+"_"+electronTriggerNames_[m] +"_"+regions[j]+"_"+eleIdNames[i]+vars[k]);
94  }
95  }
96 
97 
98 
99 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > superMeNames_
std::vector< std::string > electronIdNames_
std::vector< std::string > electronTriggerNames_
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
std::vector< std::string > superTriggerNames_
std::vector< std::string > eleMeNames_
virtual void TopElectronHLTOfflineClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file TopElectronHLTOfflineClient.h.

74 {}
void TopElectronHLTOfflineClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file TopElectronHLTOfflineClient.cc.

108 {
109 }
void TopElectronHLTOfflineClient::createSingleEffHists ( const std::string &  denomName,
const std::string &  nomName,
const std::string &  effName 
)

Definition at line 151 of file TopElectronHLTOfflineClient.cc.

References dbe_, dirName_, DQMStore::get(), makeEffMonElemFromPassAndAll(), and NULL.

Referenced by runClient_().

152 {
153  MonitorElement* denom = dbe_->get(dirName_+"/"+denomName);
154 
155  MonitorElement* nom = dbe_->get(dirName_+"/"+nomName);
156  if(nom!=NULL && denom!=NULL)
157  {
158 
159  makeEffMonElemFromPassAndAll(effName, nom, denom);
160  }
161 }
#define NULL
Definition: scimark2.h:8
MonitorElement * makeEffMonElemFromPassAndAll(const std::string &name, const MonitorElement *pass, const MonitorElement *fail)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
void TopElectronHLTOfflineClient::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file TopElectronHLTOfflineClient.cc.

References runClient_(), and runClientEndJob_.

void TopElectronHLTOfflineClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
virtual
void TopElectronHLTOfflineClient::endRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file TopElectronHLTOfflineClient.cc.

References runClient_(), and runClientEndRun_.

MonitorElement * TopElectronHLTOfflineClient::makeEffMonElemFromPassAndAll ( const std::string &  name,
const MonitorElement pass,
const MonitorElement fail 
)

Definition at line 164 of file TopElectronHLTOfflineClient.cc.

References DQMStore::book1D(), dbe_, dirName_, DQMStore::get(), MonitorElement::getTH1F(), and NULL.

Referenced by createSingleEffHists().

165 {
166  TH1F* passHist = pass->getTH1F();
167  if(passHist->GetSumw2N()==0)
168  passHist->Sumw2();
169  TH1F* allHist = all->getTH1F();
170  if(allHist->GetSumw2N()==0)
171  allHist->Sumw2();
172 
173  TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
174  effHist->Divide(passHist,allHist,1,1,"B");
175 
176  MonitorElement* eff = dbe_->get(dirName_+"/"+name);
177  if(eff==NULL)
178  {
179  eff= dbe_->book1D(name,effHist);
180  }
181  else
182  { //I was having problems with collating the histograms, hence why I'm just reseting the histogram value
183  *eff->getTH1F()=*effHist;
184  delete effHist;
185  }
186  return eff;
187 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
TH1F * getTH1F(void) const
TopElectronHLTOfflineClient& TopElectronHLTOfflineClient::operator= ( const TopElectronHLTOfflineClient rhs)
inlineprivate

Definition at line 61 of file TopElectronHLTOfflineClient.h.

61 {return *this;}
void TopElectronHLTOfflineClient::runClient_ ( )
private

Definition at line 129 of file TopElectronHLTOfflineClient.cc.

References createSingleEffHists(), dbe_, dirName_, electronTriggerNames_, eleMeNames_, i, j, gen::k, DQMStore::setCurrentFolder(), superMeNames_, and superTriggerNames_.

Referenced by endJob(), endLuminosityBlock(), and endRun().

130 {
131  if (!dbe_) return; //we dont have the DQMStore so we cant do anything
133 
134  size_t k = 0;
135  for (size_t i = 0; i < superMeNames_.size(); ++i)
136  {
137  for (size_t j = 0; j < electronTriggerNames_.size(); ++j)
138  {
139  if (k >= eleMeNames_.size())
140  continue;
142  ++k;
143  }
144  }
145  superTriggerNames_.size();
146  electronTriggerNames_.size();
147 
148 
149 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > superMeNames_
std::vector< std::string > electronTriggerNames_
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
void createSingleEffHists(const std::string &, const std::string &, const std::string &)
std::vector< std::string > superTriggerNames_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
std::vector< std::string > eleMeNames_

Member Data Documentation

bool TopElectronHLTOfflineClient::addExtraId_
private

Definition at line 52 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and TopElectronHLTOfflineClient().

DQMStore* TopElectronHLTOfflineClient::dbe_
private
std::string TopElectronHLTOfflineClient::dirName_
private
std::vector<std::string> TopElectronHLTOfflineClient::electronIdNames_
private

Definition at line 48 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::electronTriggerNames_
private

Definition at line 50 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), runClient_(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::eleMeNames_
private

Definition at line 46 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and runClient_().

std::string TopElectronHLTOfflineClient::hltTag_
private

Definition at line 43 of file TopElectronHLTOfflineClient.h.

Referenced by TopElectronHLTOfflineClient().

bool TopElectronHLTOfflineClient::runClientEndJob_
private

Definition at line 56 of file TopElectronHLTOfflineClient.h.

Referenced by endJob(), and TopElectronHLTOfflineClient().

bool TopElectronHLTOfflineClient::runClientEndLumiBlock_
private
bool TopElectronHLTOfflineClient::runClientEndRun_
private

Definition at line 55 of file TopElectronHLTOfflineClient.h.

Referenced by endRun(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::superMeNames_
private

Definition at line 45 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and runClient_().

std::vector<std::string> TopElectronHLTOfflineClient::superTriggerNames_
private

Definition at line 49 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), runClient_(), and TopElectronHLTOfflineClient().