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

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_
 
edm::EDGetTokenT
< trigger::TriggerEvent
triggerSummaryToken_
 

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

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 49 of file FourVectorHLT.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file FourVectorHLT.cc.

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

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

Definition at line 72 of file FourVectorHLT.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 87 of file FourVectorHLT.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, dirname_, alignCSCRings::e, eta(), FourVectorHLT::PathInfoCollection::find(), edm::Event::getByToken(), dt-layouts::histoname, hltPaths_, cmsHarvester::index, gen::k, LogDebug, mergeVDriftHistosByStation::name, nBins_, nev_, AlCaHLTBitMon_ParallelJobs::p, phi, plotAll_, RecoTauCleanerPlugins::pt, ptMax_, ptMin_, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, triggerSummaryToken_, and findQualityFiles::v.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 194 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 254 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 246 of file FourVectorHLT.cc.

References nev_.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 260 of file FourVectorHLT.cc.

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

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

Member Data Documentation

int FourVectorHLT::currentRun_
private

Definition at line 75 of file FourVectorHLT.h.

DQMStore* FourVectorHLT::dbe_
private

Definition at line 69 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

std::string FourVectorHLT::dirname_
private

Definition at line 81 of file FourVectorHLT.h.

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

PathInfoCollection FourVectorHLT::hltPaths_
private

Definition at line 172 of file FourVectorHLT.h.

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

bool FourVectorHLT::monitorDaemon_
private

Definition at line 82 of file FourVectorHLT.h.

unsigned int FourVectorHLT::nBins_
private

Definition at line 77 of file FourVectorHLT.h.

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

int FourVectorHLT::nev_
private

Definition at line 68 of file FourVectorHLT.h.

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

bool FourVectorHLT::plotAll_
private

Definition at line 73 of file FourVectorHLT.h.

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

double FourVectorHLT::ptMax_
private

Definition at line 79 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

double FourVectorHLT::ptMin_
private

Definition at line 78 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().

bool FourVectorHLT::resetMe_
private

Definition at line 74 of file FourVectorHLT.h.

int FourVectorHLT::theHLTOutputType
private

Definition at line 83 of file FourVectorHLT.h.

MonitorElement* FourVectorHLT::total_
private

Definition at line 71 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerResultLabel_
private

Definition at line 85 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerSummaryLabel_
private

Definition at line 84 of file FourVectorHLT.h.

Referenced by FourVectorHLT().

edm::EDGetTokenT<trigger::TriggerEvent> FourVectorHLT::triggerSummaryToken_
private

Definition at line 88 of file FourVectorHLT.h.

Referenced by analyze(), and FourVectorHLT().