CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
FourVectorHLT Class Reference

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

Inheritance diagram for FourVectorHLT:
edm::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

class  PathInfo
 
class  PathInfoCollection
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 FourVectorHLT (const edm::ParameterSet &)
 
 ~FourVectorHLT () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &run, const edm::EventSetup &c) override
 
void endJob () override
 
void endRun (const edm::Run &run, const edm::EventSetup &c) override
 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::TriggerEventtriggerSummaryToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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

Member Typedef Documentation

◆ DQMStore

Definition at line 49 of file FourVectorHLT.h.

◆ MonitorElement

Definition at line 48 of file FourVectorHLT.h.

Constructor & Destructor Documentation

◆ FourVectorHLT()

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

Definition at line 14 of file FourVectorHLT.cc.

References filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, hlt_dqm_clientPB-live_cfg::me, Utilities::operator, AlignmentTrackSelector_cfi::ptMax, ptMin, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ ~FourVectorHLT()

FourVectorHLT::~FourVectorHLT ( )
override

Definition at line 59 of file FourVectorHLT.cc.

59  {
60  // do anything here that needs to be done at desctruction time
61  // (e.g. close files, deallocate resources etc.)
62 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 69 of file FourVectorHLT.cc.

References MillePedeFileConverter_cfg::e, edm::InputTag::encode(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::filterTag(), trigger::TriggerEvent::getObjects(), iEvent, edm::HandleBase::isValid(), dqmdumpme::k, LogDebug, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, trigger::TriggerEvent::sizeFilters(), AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and findQualityFiles::v.

69  {
70  using namespace edm;
71  using namespace trigger;
72  ++nev_;
73  LogDebug("Status") << "analyze";
74 
75  edm::Handle<TriggerEvent> triggerObj;
76  iEvent.getByToken(triggerSummaryToken_, triggerObj);
77  if (!triggerObj.isValid()) {
78  edm::LogInfo("Status") << "Summary HLT object (TriggerEvent) not found, "
79  "skipping event";
80  return;
81  }
82 
83  const trigger::TriggerObjectCollection& toc(triggerObj->getObjects());
84 
85  if (plotAll_) {
86  for (size_t ia = 0; ia < triggerObj->sizeFilters(); ++ia) {
87  std::string fullname = triggerObj->filterTag(ia).encode();
88  // the name can have in it the module label as well as the process and
89  // other labels - strip 'em
91  size_t p = fullname.find_first_of(':');
92  if (p != std::string::npos) {
93  name = fullname.substr(0, p);
94  } else {
95  name = fullname;
96  }
97 
98  LogDebug("Parameter") << "filter " << ia << ", full name = " << fullname << ", p = " << p
99  << ", abbreviated = " << name;
100 
101  PathInfoCollection::iterator pic = hltPaths_.find(name);
102  if (pic == hltPaths_.end()) {
103  // doesn't exist - add it
104  MonitorElement *et(nullptr), *eta(nullptr), *phi(nullptr), *etavsphi(nullptr);
105 
106  std::string histoname(name + "_et");
107  LogDebug("Status") << "new histo with name " << histoname;
109  std::string title(name + " E_{T}");
110  et = dbe_->book1D(histoname.c_str(), title.c_str(), nBins_, 0, 100);
111 
112  histoname = name + "_eta";
113  title = name + " #eta";
114  eta = dbe_->book1D(histoname.c_str(), title.c_str(), nBins_, -2.7, 2.7);
115 
116  histoname = name + "_phi";
117  title = name + " #phi";
118  phi = dbe_->book1D(histoname.c_str(), title.c_str(), nBins_, -3.14, 3.14);
119 
120  histoname = name + "_etaphi";
121  title = name + " #eta vs #phi";
122  etavsphi = dbe_->book2D(histoname.c_str(), title.c_str(), nBins_, -2.7, 2.7, nBins_, -3.14, 3.14);
123 
124  // no idea how to get the bin boundries in this mode
125  PathInfo e(name, 0, et, eta, phi, etavsphi, ptMin_, ptMax_);
126  hltPaths_.push_back(e);
127  pic = hltPaths_.begin() + hltPaths_.size() - 1;
128  }
129  const trigger::Keys& k = triggerObj->filterKeys(ia);
130  for (trigger::Keys::const_iterator ki = k.begin(); ki != k.end(); ++ki) {
131  LogDebug("Parameters") << "pt, eta, phi = " << toc[*ki].pt() << ", " << toc[*ki].eta() << ", "
132  << toc[*ki].phi();
133  pic->getEtHisto()->Fill(toc[*ki].pt());
134  pic->getEtaHisto()->Fill(toc[*ki].eta());
135  pic->getPhiHisto()->Fill(toc[*ki].phi());
136  pic->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
137  }
138  }
139 
140  } else { // not plotAll_
141  for (PathInfoCollection::iterator v = hltPaths_.begin(); v != hltPaths_.end(); ++v) {
142  const int index = triggerObj->filterIndex(v->getName());
143  if (index >= triggerObj->sizeFilters()) {
144  continue; // not in this event
145  }
146  LogDebug("Status") << "filling ... ";
147  const trigger::Keys& k = triggerObj->filterKeys(index);
148  for (trigger::Keys::const_iterator ki = k.begin(); ki != k.end(); ++ki) {
149  v->getEtHisto()->Fill(toc[*ki].pt());
150  v->getEtaHisto()->Fill(toc[*ki].eta());
151  v->getPhiHisto()->Fill(toc[*ki].phi());
152  v->getEtaVsPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
153  }
154  }
155  }
156 }
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
std::string dirname_
Definition: FourVectorHLT.h:75
std::string encode() const
Definition: InputTag.cc:159
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
int iEvent
Definition: GenABIO.cc:224
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
Log< level::Info, false > LogInfo
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
std::vector< size_type > Keys
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
PathInfoCollection hltPaths_
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
unsigned int nBins_
Definition: FourVectorHLT.h:71
std::vector< PathInfo >::iterator find(std::string pathName)
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryToken_
Definition: FourVectorHLT.h:80
DQMStore * dbe_
Definition: FourVectorHLT.h:67
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
#define LogDebug(id)

◆ beginJob()

void FourVectorHLT::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 159 of file FourVectorHLT.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, Utilities::operator, dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and findQualityFiles::v.

159  {
160  nev_ = 0;
161  DQMStore* dbe = nullptr;
162  dbe = Service<DQMStore>().operator->();
163 
164  if (dbe) {
165  dbe->setCurrentFolder(dirname_);
166 
167  if (!plotAll_) {
168  for (PathInfoCollection::iterator v = hltPaths_.begin(); v != hltPaths_.end(); ++v) {
169  MonitorElement *et, *eta, *phi, *etavsphi = nullptr;
170  std::string histoname(v->getName() + "_et");
171  std::string title(v->getName() + " E_t");
172  et = dbe->book1D(histoname.c_str(), title.c_str(), nBins_, v->getPtMin(), v->getPtMax());
173 
174  histoname = v->getName() + "_eta";
175  title = v->getName() + " #eta";
176  eta = dbe->book1D(histoname.c_str(), title.c_str(), nBins_, -2.7, 2.7);
177 
178  histoname = v->getName() + "_phi";
179  title = v->getName() + " #phi";
180  phi = dbe->book1D(histoname.c_str(), histoname.c_str(), nBins_, -3.14, 3.14);
181 
182  histoname = v->getName() + "_etaphi";
183  title = v->getName() + " #eta vs #phi";
184  etavsphi = dbe->book2D(histoname.c_str(), title.c_str(), nBins_, -2.7, 2.7, nBins_, -3.14, 3.14);
185 
186  v->setHistos(et, eta, phi, etavsphi);
187  }
188  } // ! plotAll_ - for plotAll we discover it during the event
189  }
190 }
std::string dirname_
Definition: FourVectorHLT.h:75
PathInfoCollection hltPaths_
unsigned int nBins_
Definition: FourVectorHLT.h:71

◆ beginRun()

void FourVectorHLT::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
overrideprivate

Definition at line 199 of file FourVectorHLT.cc.

References LogDebug, and writedatasetfile::run.

199  {
200  LogDebug("Status") << "beginRun, run " << run.id();
201 }
#define LogDebug(id)

◆ endJob()

void FourVectorHLT::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 193 of file FourVectorHLT.cc.

193  {
194  LogInfo("Status") << "endJob: analyzed " << nev_ << " events";
195  return;
196 }
Log< level::Info, false > LogInfo

◆ endRun()

void FourVectorHLT::endRun ( const edm::Run run,
const edm::EventSetup c 
)
overrideprivate

EndRun.

Definition at line 204 of file FourVectorHLT.cc.

References LogDebug, and writedatasetfile::run.

204  {
205  LogDebug("Status") << "endRun, run " << run.id();
206 }
#define LogDebug(id)

Member Data Documentation

◆ dbe_

DQMStore* FourVectorHLT::dbe_
private

Definition at line 67 of file FourVectorHLT.h.

◆ dirname_

std::string FourVectorHLT::dirname_
private

Definition at line 75 of file FourVectorHLT.h.

◆ hltPaths_

PathInfoCollection FourVectorHLT::hltPaths_
private

Definition at line 153 of file FourVectorHLT.h.

◆ nBins_

unsigned int FourVectorHLT::nBins_
private

Definition at line 71 of file FourVectorHLT.h.

◆ nev_

int FourVectorHLT::nev_
private

Definition at line 66 of file FourVectorHLT.h.

◆ plotAll_

bool FourVectorHLT::plotAll_
private

Definition at line 69 of file FourVectorHLT.h.

◆ ptMax_

double FourVectorHLT::ptMax_
private

Definition at line 73 of file FourVectorHLT.h.

◆ ptMin_

double FourVectorHLT::ptMin_
private

Definition at line 72 of file FourVectorHLT.h.

◆ triggerResultLabel_

edm::InputTag FourVectorHLT::triggerResultLabel_
private

Definition at line 77 of file FourVectorHLT.h.

◆ triggerSummaryLabel_

edm::InputTag FourVectorHLT::triggerSummaryLabel_
private

Definition at line 76 of file FourVectorHLT.h.

◆ triggerSummaryToken_

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

Definition at line 80 of file FourVectorHLT.h.