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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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

DQMStoredbe_
 
std::string dirname_
 
PathInfoCollection hltPaths_
 
unsigned int nBins_
 
int nev_
 
bool plotAll_
 
double ptMax_
 
double ptMin_
 
edm::InputTag triggerResultLabel_
 
edm::InputTag triggerSummaryLabel_
 
edm::EDGetTokenT
< trigger::TriggerEvent
triggerSummaryToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 15 of file FourVectorHLT.cc.

References dbe_, filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, cppFunctionSkipper::operator, PtMinSelector_cfg::ptMin, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 69 of file FourVectorHLT.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 84 of file FourVectorHLT.cc.

References dbe_, alignCSCRings::e, eta, edm::Event::getByToken(), cmsHarvester::index, relval_2017::k, LogDebug, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, phi(), EnergyCorrector::pt, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and findQualityFiles::v.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file FourVectorHLT.cc.

References AlcaSiStripGainsAfterAbortGapHarvester_cff::DQMStore, eta, cppFunctionSkipper::operator, phi(), AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and findQualityFiles::v.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 251 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 243 of file FourVectorHLT.cc.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 257 of file FourVectorHLT.cc.

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

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

Member Data Documentation

DQMStore* FourVectorHLT::dbe_
private

Definition at line 69 of file FourVectorHLT.h.

std::string FourVectorHLT::dirname_
private

Definition at line 77 of file FourVectorHLT.h.

PathInfoCollection FourVectorHLT::hltPaths_
private

Definition at line 166 of file FourVectorHLT.h.

unsigned int FourVectorHLT::nBins_
private

Definition at line 73 of file FourVectorHLT.h.

int FourVectorHLT::nev_
private

Definition at line 68 of file FourVectorHLT.h.

bool FourVectorHLT::plotAll_
private

Definition at line 71 of file FourVectorHLT.h.

double FourVectorHLT::ptMax_
private

Definition at line 75 of file FourVectorHLT.h.

double FourVectorHLT::ptMin_
private

Definition at line 74 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerResultLabel_
private

Definition at line 79 of file FourVectorHLT.h.

edm::InputTag FourVectorHLT::triggerSummaryLabel_
private

Definition at line 78 of file FourVectorHLT.h.

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

Definition at line 82 of file FourVectorHLT.h.