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

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
 
- 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_, filters, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, cppFunctionSkipper::operator, PtMinSelector_cfg::ptMin, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 86 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 253 of file FourVectorHLT.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 245 of file FourVectorHLT.cc.

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 259 of file FourVectorHLT.cc.

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

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

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.