CMS 3D CMS Logo

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

#include <DQM/FourVectorHLT/src/FourVectorHLT.cc>

Inheritance diagram for FourVectorHLT:
edm::EDAnalyzer edm::EDConsumerBase

Classes

class  PathInfo
 
class  PathInfoCollection
 

Public Member Functions

 FourVectorHLT (const edm::ParameterSet &)
 
 ~FourVectorHLT ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
virtual void endJob ()
 
void endRun (const edm::Run &run, const edm::EventSetup &c)
 EndRun. More...
 

Private Attributes

int currentRun_
 
DQMStoredbe_
 
std::string dirname_
 
PathInfoCollection hltPaths_
 
bool monitorDaemon_
 
unsigned int nBins_
 
int nev_
 
bool plotAll_
 
double ptMax_
 
double ptMin_
 
bool resetMe_
 
int theHLTOutputType
 
MonitorElementtotal_
 
edm::InputTag triggerResultLabel_
 
edm::InputTag triggerSummaryLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Description: This is a DQM source meant to plot high-level HLT trigger quantities as stored in the HLT results object TriggerResults

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file FourVectorHLT.h.

Constructor & Destructor Documentation

FourVectorHLT::FourVectorHLT ( const edm::ParameterSet iConfig)
explicit

Definition at line 18 of file FourVectorHLT.cc.

References dbe_, dirname_, filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltPaths_, LogDebug, nBins_, cppFunctionSkipper::operator, plotAll_, jptDQMConfig_cff::ptMax, ptMax_, PtMinSelector_cfg::ptMin, ptMin_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), AlCaHLTBitMon_QueryRunRegistry::string, and triggerSummaryLabel_.

18  :
19  resetMe_(true), currentRun_(-99)
20 {
21  LogDebug("FourVectorHLT") << "constructor...." ;
22 
24  if ( ! dbe_ ) {
25  LogWarning("Status") << "unable to get DQMStore service?";
26  }
27  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
28  dbe_->setVerbose(0);
29  }
30 
31 
32  dirname_="HLT/FourVectorHLT" ;
33 
34  if (dbe_ != 0 ) {
35  LogDebug("Status") << "Setting current directory to " << dirname_;
37  }
38 
39 
40  // plotting paramters
41  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
42  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",200.);
43  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",50);
44 
45  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
46 
47  // this is the list of paths to look at.
48  std::vector<edm::ParameterSet> filters =
49  iConfig.getParameter<std::vector<edm::ParameterSet> >("filters");
50  for(std::vector<edm::ParameterSet>::iterator
51  filterconf = filters.begin() ; filterconf != filters.end();
52  filterconf++) {
53  std::string me = filterconf->getParameter<std::string>("name");
54  int objectType = filterconf->getParameter<unsigned int>("type");
55  float ptMin = filterconf->getUntrackedParameter<double>("ptMin");
56  float ptMax = filterconf->getUntrackedParameter<double>("ptMax");
57  hltPaths_.push_back(PathInfo(me, objectType, ptMin, ptMax));
58  }
59  if ( hltPaths_.size() && plotAll_) {
60  // these two ought to be mutually exclusive....
61  LogWarning("Configuration") << "Using both plotAll and a list. "
62  "list will be ignored." ;
63  hltPaths_.clear();
64  }
66  iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
67 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string dirname_
Definition: FourVectorHLT.h:82
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
PathInfoCollection hltPaths_
unsigned int nBins_
Definition: FourVectorHLT.h:78
DQMStore * dbe_
Definition: FourVectorHLT.h:70
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
edm::InputTag triggerSummaryLabel_
Definition: FourVectorHLT.h:85
FourVectorHLT::~FourVectorHLT ( )

Definition at line 70 of file FourVectorHLT.cc.

71 {
72 
73  // do anything here that needs to be done at desctruction time
74  // (e.g. close files, deallocate resources etc.)
75 
76 }

Member Function Documentation

void FourVectorHLT::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 85 of file FourVectorHLT.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, dirname_, alignCSCRings::e, eta(), FourVectorHLT::PathInfoCollection::find(), edm::Event::getByLabel(), hltPaths_, getHLTprescales::index, gen::k, LogDebug, mergeVDriftHistosByStation::name, nBins_, nev_, AlCaHLTBitMon_ParallelJobs::p, phi, plotAll_, ptMax_, ptMin_, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, triggerSummaryLabel_, and findQualityFiles::v.

86 {
87  using namespace edm;
88  using namespace trigger;
89  ++nev_;
90  LogDebug("Status")<< "analyze" ;
91 
92  edm::Handle<TriggerEvent> triggerObj;
93  iEvent.getByLabel(triggerSummaryLabel_,triggerObj);
94  if(!triggerObj.isValid()) {
95  edm::LogInfo("Status") << "Summary HLT object (TriggerEvent) not found, "
96  "skipping event";
97  return;
98  }
99 
100  const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
101 
102  if ( plotAll_ ) {
103  for ( size_t ia = 0; ia < triggerObj->sizeFilters(); ++ ia) {
104  std::string fullname = triggerObj->filterTag(ia).encode();
105  // the name can have in it the module label as well as the process and
106  // other labels - strip 'em
108  size_t p = fullname.find_first_of(':');
109  if ( p != std::string::npos) {
110  name = fullname.substr(0, p);
111  }
112  else {
113  name = fullname;
114  }
115 
116  LogDebug("Parameter") << "filter " << ia << ", full name = " << fullname
117  << ", p = " << p
118  << ", abbreviated = " << name ;
119 
120  PathInfoCollection::iterator pic = hltPaths_.find(name);
121  if ( pic == hltPaths_.end() ) {
122  // doesn't exist - add it
123  MonitorElement *et(0), *eta(0), *phi(0), *etavsphi(0);
124 
125  std::string histoname(name+"_et");
126  LogDebug("Status") << "new histo with name "<< histoname ;
128  std::string title(name+" E_{T}");
129  et = dbe_->book1D(histoname.c_str(),
130  title.c_str(),nBins_, 0, 100);
131 
132  histoname = name+"_eta";
133  title = name+" #eta";
134  eta = dbe_->book1D(histoname.c_str(),
135  title.c_str(),nBins_,-2.7,2.7);
136 
137  histoname = name+"_phi";
138  title = name+" #phi";
139  phi = dbe_->book1D(histoname.c_str(),
140  title.c_str(),nBins_,-3.14,3.14);
141 
142 
143  histoname = name+"_etaphi";
144  title = name+" #eta vs #phi";
145  etavsphi = dbe_->book2D(histoname.c_str(),
146  title.c_str(),
147  nBins_,-2.7,2.7,
148  nBins_,-3.14, 3.14);
149 
150  // no idea how to get the bin boundries in this mode
151  PathInfo e(name,0, et, eta, phi, etavsphi, ptMin_,ptMax_);
152  hltPaths_.push_back(e);
153  pic = hltPaths_.begin() + hltPaths_.size()-1;
154  }
155  const trigger::Keys & k = triggerObj->filterKeys(ia);
156  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
157  LogDebug("Parameters") << "pt, eta, phi = "
158  << toc[*ki].pt() << ", "
159  << toc[*ki].eta() << ", "
160  << toc[*ki].phi() ;
161  pic->getEtHisto()->Fill(toc[*ki].pt());
162  pic->getEtaHisto()->Fill(toc[*ki].eta());
163  pic->getPhiHisto()->Fill(toc[*ki].phi());
164  pic->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
165  }
166 
167  }
168 
169  }
170  else { // not plotAll_
171  for(PathInfoCollection::iterator v = hltPaths_.begin();
172  v!= hltPaths_.end(); ++v ) {
173  const int index = triggerObj->filterIndex(v->getName());
174  if ( index >= triggerObj->sizeFilters() ) {
175  continue; // not in this event
176  }
177  LogDebug("Status") << "filling ... " ;
178  const trigger::Keys & k = triggerObj->filterKeys(index);
179  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
180  v->getEtHisto()->Fill(toc[*ki].pt());
181  v->getEtaHisto()->Fill(toc[*ki].eta());
182  v->getPhiHisto()->Fill(toc[*ki].phi());
183  v->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
184  }
185  }
186  }
187 }
#define LogDebug(id)
std::string dirname_
Definition: FourVectorHLT.h:82
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
T eta() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
int k[5][pyjets_maxn]
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
std::vector< size_type > Keys
PathInfoCollection hltPaths_
unsigned int nBins_
Definition: FourVectorHLT.h:78
std::vector< PathInfo >::iterator find(std::string pathName)
DQMStore * dbe_
Definition: FourVectorHLT.h:70
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
edm::InputTag triggerSummaryLabel_
Definition: FourVectorHLT.h:85
Definition: DDAxes.h:10
void FourVectorHLT::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 192 of file FourVectorHLT.cc.

References DQMStore::book1D(), DQMStore::book2D(), dirname_, eta(), hltPaths_, nBins_, nev_, cppFunctionSkipper::operator, phi, plotAll_, DQMStore::rmdir(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and findQualityFiles::v.

193 {
194  nev_ = 0;
195  DQMStore *dbe = 0;
196  dbe = Service<DQMStore>().operator->();
197 
198  if (dbe) {
199  dbe->setCurrentFolder(dirname_);
200  dbe->rmdir(dirname_);
201  }
202 
203 
204  if (dbe) {
205  dbe->setCurrentFolder(dirname_);
206 
207  if ( ! plotAll_ ) {
208  for(PathInfoCollection::iterator v = hltPaths_.begin();
209  v!= hltPaths_.end(); ++v ) {
210  MonitorElement *et, *eta, *phi, *etavsphi=0;
211  std::string histoname(v->getName()+"_et");
212  std::string title(v->getName()+" E_t");
213  et = dbe->book1D(histoname.c_str(),
214  title.c_str(),nBins_,
215  v->getPtMin(),
216  v->getPtMax());
217 
218  histoname = v->getName()+"_eta";
219  title = v->getName()+" #eta";
220  eta = dbe->book1D(histoname.c_str(),
221  title.c_str(),nBins_,-2.7,2.7);
222 
223  histoname = v->getName()+"_phi";
224  title = v->getName()+" #phi";
225  phi = dbe->book1D(histoname.c_str(),
226  histoname.c_str(),nBins_,-3.14,3.14);
227 
228 
229  histoname = v->getName()+"_etaphi";
230  title = v->getName()+" #eta vs #phi";
231  etavsphi = dbe->book2D(histoname.c_str(),
232  title.c_str(),
233  nBins_,-2.7,2.7,
234  nBins_,-3.14, 3.14);
235 
236  v->setHistos( et, eta, phi, etavsphi);
237  }
238  } // ! plotAll_ - for plotAll we discover it during the event
239  }
240 }
std::string dirname_
Definition: FourVectorHLT.h:82
T eta() const
PathInfoCollection hltPaths_
unsigned int nBins_
Definition: FourVectorHLT.h:78
Definition: DDAxes.h:10
void FourVectorHLT::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 252 of file FourVectorHLT.cc.

References edm::RunBase::id(), and LogDebug.

253 {
254  LogDebug("Status") << "beginRun, run " << run.id();
255 }
#define LogDebug(id)
RunID const & id() const
Definition: RunBase.h:41
void FourVectorHLT::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 244 of file FourVectorHLT.cc.

References nev_.

245 {
246  LogInfo("Status") << "endJob: analyzed " << nev_ << " events";
247  return;
248 }
void FourVectorHLT::endRun ( const edm::Run run,
const edm::EventSetup c 
)
privatevirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 258 of file FourVectorHLT.cc.

References edm::RunBase::id(), and LogDebug.

259 {
260  LogDebug("Status") << "endRun, run " << run.id();
261 }
#define LogDebug(id)
RunID const & id() const
Definition: RunBase.h:41

Member Data Documentation

int FourVectorHLT::currentRun_
private

Definition at line 76 of file FourVectorHLT.h.

DQMStore* FourVectorHLT::dbe_
private

Definition at line 70 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

std::string FourVectorHLT::dirname_
private

Definition at line 82 of file FourVectorHLT.h.

Referenced by analyze(), beginJob(), and FourVectorHLT().

PathInfoCollection FourVectorHLT::hltPaths_
private

Definition at line 170 of file FourVectorHLT.h.

Referenced by analyze(), beginJob(), and FourVectorHLT().

bool FourVectorHLT::monitorDaemon_
private

Definition at line 83 of file FourVectorHLT.h.

unsigned int FourVectorHLT::nBins_
private

Definition at line 78 of file FourVectorHLT.h.

Referenced by analyze(), beginJob(), and FourVectorHLT().

int FourVectorHLT::nev_
private

Definition at line 69 of file FourVectorHLT.h.

Referenced by analyze(), beginJob(), and endJob().

bool FourVectorHLT::plotAll_
private

Definition at line 74 of file FourVectorHLT.h.

Referenced by analyze(), beginJob(), and FourVectorHLT().

double FourVectorHLT::ptMax_
private

Definition at line 80 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

double FourVectorHLT::ptMin_
private

Definition at line 79 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

bool FourVectorHLT::resetMe_
private

Definition at line 75 of file FourVectorHLT.h.

int FourVectorHLT::theHLTOutputType
private

Definition at line 84 of file FourVectorHLT.h.

MonitorElement* FourVectorHLT::total_
private

Definition at line 72 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerResultLabel_
private

Definition at line 86 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerSummaryLabel_
private

Definition at line 85 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().