CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
OfflineDQMMuonTrigAnalyzer Class Reference
Inheritance diagram for OfflineDQMMuonTrigAnalyzer:
edm::EDAnalyzer

Public Member Functions

 OfflineDQMMuonTrigAnalyzer (const edm::ParameterSet &)
 
 ~OfflineDQMMuonTrigAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (edm::Run const &currentRun, edm::EventSetup const &currentEventSetup)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &r, const edm::EventSetup &c)
 

Private Attributes

vector< edm::ParameterSetcustomCollection
 
const ParameterSetinitialPset
 
string theHltProcessName
 
int theNumberOfTriggers
 
std::vector
< HLTMuonMatchAndPlot * > 
theTriggerAnalyzers
 
vector< string > triggerNames
 
vector< TPRegexp > trigRegExps
 
bool useDQMStore
 
bool weHaveProcessedTheFirstRun
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 54 of file DQMOfflineMuonTrigAnalyzer.cc.

Constructor & Destructor Documentation

OfflineDQMMuonTrigAnalyzer::OfflineDQMMuonTrigAnalyzer ( const edm::ParameterSet pset)
explicit

Definition at line 88 of file DQMOfflineMuonTrigAnalyzer.cc.

References customCollection, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), initialPset, LogTrace, theHltProcessName, triggerNames, trigRegExps, useDQMStore, and weHaveProcessedTheFirstRun.

88  :
89  initialPset(pset)
90 {
91 
92  LogTrace ("HLTMuonVal") << "\n\n Inside MuonTriggerRate Constructor\n\n";
93 
94  triggerNames = initialPset.getParameter< vector<string> >
95  ("TriggerRegExpStrings");
96 
97 
98 
99  for (vector<string>::const_iterator iTrigName = triggerNames.begin();
100  iTrigName != triggerNames.end();
101  iTrigName ++) {
102 
103  trigRegExps.push_back( TPRegexp((*iTrigName).c_str()) );
104 
105  LogTrace ("HLTMuonVal") << "Trigger Reg Exp = " << trigRegExps.back().GetPattern() << endl;
106  }
107 
108  useDQMStore = initialPset.getUntrackedParameter<bool>("DQMStore", false);
109 
110 
111  theHltProcessName = initialPset.getParameter<string>("HltProcessName");
112 
113  //string defRecoLabel = initialPset.getUntrackedParameter<string>("RecoLabel","");
114  //string highPtTracksLabel = initialPset.getParameter <string> ("highPtTrackCollection");
115 
116  //vector<string> recoCollectionNames = initialPset.getParameter < vector<string> > ("allCollectionNames");
117 
118 
119  // make analyzers for each collection. Push the collections into a vector
120  //vector <string> recoCollectionNames;
121  //if (defRecoLabel != "") recoCollectionNames.push_back(defRecoLabel);
122  //if (highPtTracksLabel != "") recoCollectionNames.push_back(highPtTracksLabel);
123 
124  customCollection = initialPset.getParameter<vector<edm::ParameterSet> > ("customCollection");
125 
127 
128 
129 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define LogTrace(id)
vector< edm::ParameterSet > customCollection
OfflineDQMMuonTrigAnalyzer::~OfflineDQMMuonTrigAnalyzer ( )

Definition at line 356 of file DQMOfflineMuonTrigAnalyzer.cc.

References LogTrace, and theTriggerAnalyzers.

357 {
358 
359  LogTrace ("HLTMuonVal")
360  << "Inside OfflineDQMMuonTrigAnalyzer destructor" << endl;
361 
362  vector<HLTMuonMatchAndPlot *>::iterator thisAnalyzer;
363  for ( thisAnalyzer = theTriggerAnalyzers.begin();
364  thisAnalyzer != theTriggerAnalyzers.end();
365  ++thisAnalyzer )
366  {
367  delete *thisAnalyzer;
368  }
369  theTriggerAnalyzers.clear();
370  //delete theOverlapAnalyzer;
371 }
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 379 of file DQMOfflineMuonTrigAnalyzer.cc.

References LogTrace, and theTriggerAnalyzers.

380 {
381  LogTrace ("HLTMuonVal")
382  << "Inside OfflineDQMMuonTrigAnalyzer analyze" << endl;
383 
384  vector<HLTMuonMatchAndPlot *>::iterator thisAnalyzer;
385  for ( thisAnalyzer = theTriggerAnalyzers.begin();
386  thisAnalyzer != theTriggerAnalyzers.end(); ++thisAnalyzer )
387  {
388  (*thisAnalyzer)->analyze(iEvent);
389  }
390  //theOverlapAnalyzer ->analyze(iEvent);
391 }
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)
void OfflineDQMMuonTrigAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 396 of file DQMOfflineMuonTrigAnalyzer.cc.

References LogTrace, and theTriggerAnalyzers.

397 {
398 
399  LogTrace ("HLTMuonVal")
400  << "Inside OfflineDQMMuonTrigAnalyzer beginJob" << endl;
401 
402  LogTrace ("HLTMuonVal")
403  << "Looking at a vector of analyzers, with size " << theTriggerAnalyzers.size() << endl;
404 
405 
406 
407  //theOverlapAnalyzer ->begin();
408 }
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)
void OfflineDQMMuonTrigAnalyzer::beginRun ( edm::Run const &  currentRun,
edm::EventSetup const &  currentEventSetup 
)
privatevirtual

Now do all the begin job steps too.

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file DQMOfflineMuonTrigAnalyzer.cc.

References DQMStore::bookString(), customCollection, dbe_, idDealer::description, HltComparatorCreateWorkflow::hltConfig, i, HLTConfigProvider::init(), initialPset, LogTrace, HLTConfigProvider::moduleLabels(), cmsCodeRules.cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), theHltProcessName, theNumberOfTriggers, theTriggerAnalyzers, HLTConfigProvider::triggerNames(), trigRegExps, useDQMStore, and weHaveProcessedTheFirstRun.

131  {
132 
133 
136  vector<edm::ParameterSet>::iterator iPSet;
137 
138  LogTrace ("HLTMuonVal") << "customCollection is a vector of size = " << customCollection.size() << std::endl
139  << "looping over entries" << std::endl;
140 
141 
142  DQMStore * dbe_ = 0;
143  if ( useDQMStore ) {
144  dbe_ = Service<DQMStore>().operator->();
145  dbe_->setVerbose(0);
146  }
147 
148 
149  vector < MuonSelectionStruct > customSelectors;
150  vector < string > customNames;
151  // Print out information about each initialPset
152  for ( iPSet = customCollection.begin();
153  iPSet != customCollection.end();
154  iPSet++) {
155  string customCuts = iPSet->getUntrackedParameter<string> ("recoCuts");
156  string customName = iPSet->getUntrackedParameter<string> ("collectionName");
157  string hltCuts = iPSet->getUntrackedParameter<string> ("hltCuts");
158  string targetTrackCollection = iPSet->getUntrackedParameter<string> ("trackCollection");
159  double customD0Cut = iPSet->getUntrackedParameter<double> ("d0cut");
160  double customZ0Cut = iPSet->getUntrackedParameter<double> ("z0cut");
161 
162  vector<string> requiredTriggers = iPSet->getUntrackedParameter< vector<string> > ("requiredTriggers");
163 
164  LogTrace("HLTMuonVal") << "customTargetCollection = " << customName << std::endl
165  << "customCuts = " << customCuts << std::endl
166  << "targetTrackCollection = " << targetTrackCollection << std::endl
167  << "d0 cut = " << customD0Cut << std::endl
168  << "z0 cut = " << customZ0Cut << std:: endl ;
169 
170  if (dbe_) {
171 
172  string description = customName + ", reco cuts = " + customCuts
173  + ", hlt cuts = " + hltCuts + ", trackCollection = " + targetTrackCollection
174  + ", required triggers, ";
175 
176  // add the required triggers
177  for (vector <string>::const_iterator trigit = requiredTriggers.begin();
178  trigit != requiredTriggers.end();
179  trigit++){
180  description += (*trigit) + ", ";
181  }
182 
183  // Add the other cuts
184  ostringstream ossd0, ossz0, osschi2, osshits;
185 
186 
187  ossd0 << customD0Cut;
188  ossz0 << customZ0Cut;
189  //osschi2 << customChi2Cut;
190  //osshits << customNHitsCut;
191 
192  description += "|d0| < " + ossd0.str() + ", |z0| < " + ossz0.str();
193 
194 
195  LogTrace ("HLTMuonVal") << "Storing description = " << description << endl;
196 
197  dbe_->setCurrentFolder("HLT/Muon/Distributions/");
198 
199  dbe_->bookString (customName, description);
200 
201  }
202 
203 
204  StringCutObjectSelector<Muon> tempRecoSelector(customCuts);
205  StringCutObjectSelector<trigger::TriggerObject> tempHltSelector(hltCuts);
206 
207  // create a custom selector
208  MuonSelectionStruct tempStruct(tempRecoSelector, tempHltSelector,
209  customName, customD0Cut, customZ0Cut,
210  targetTrackCollection, requiredTriggers);
211 
212 
213  customNames.push_back ( customName);
214  customSelectors.push_back(tempStruct);
215  }
216 
217 
218 
219  LogTrace ("HLTMuonVal") << "Initializing HLTConfigProvider with HLT process name: " << theHltProcessName << endl;
220 
221 
222  // Be careful. If hltConfig provider doesn't initialize sucessfully,
223  // then you can get in trouble.
224 
226 
227  bool hltConfigChanged;
228  bool hltConfigInitSuccess = hltConfig.init(currentRun, currentEventSetup, theHltProcessName, hltConfigChanged);
229 
230 
231  vector<string> validTriggerNames;
232 
233  if (hltConfigInitSuccess)
234  validTriggerNames = hltConfig.triggerNames();
235 
236  if (validTriggerNames.size() < 1) {
237  LogInfo ("HLTMuonVal") << endl << endl << endl
238  << "---> WARNING: The HLT Config Provider gave you an empty list of valid trigger names" << endl
239  << "Could be a problem with the HLT Process Name (you provided " << theHltProcessName <<")" << endl
240  << "W/o valid triggers we can't produce plots, exiting..."
241  << endl << endl << endl;
242 
243  // don't return... you'll automatically skip the rest
244  //return;
245  }
246 
247  vector<string>::const_iterator iDumpName;
248  unsigned int numTriggers = 0;
249 
250  vector<string> parsedMuonTrigNames;
251 
252  // declare a bunch of trigger name patterns that you'd like to match
253  // and do the matching
254  // the end of line anchor removes matches to
255  // multi-object triggers
256  TPRegexp l1l2MuTrigExp ("HLT_L[12]Mu[^_]*$");
257  TPRegexp isoMuTrigExp ("HLT_[iI]soMu[^_]*$");
258  TPRegexp normalMuExp ("HLT_Mu[^_]*$");
259  TPRegexp l1l2DoubleExp ("HLT_L[12]DoubleMu[^_]*$");
260  TPRegexp normalDoubleExp ("HLT_DoubleMu[^_]*$");
261 
262 
263 
264 
265  for (iDumpName = validTriggerNames.begin();
266  iDumpName != validTriggerNames.end();
267  iDumpName++) {
268 
269  LogTrace ("HLTMuonVal") << "Trigger " << numTriggers
270  << " is called " << (*iDumpName)
271  << endl;
272  numTriggers++;
273 
274  TString tempTStringModName(*iDumpName);
275 
276  bool matchesAnyRegexp = false;
277  for (vector<TPRegexp>::const_iterator iTrigRegExp = trigRegExps.begin();
278  iTrigRegExp != trigRegExps.end();
279  iTrigRegExp ++) {
280  TPRegexp tempRegExp((*iTrigRegExp));
281  if (tempTStringModName.Contains(tempRegExp))
282  matchesAnyRegexp = true;
283  }
284 
285  if (matchesAnyRegexp) {
286 
287  LogTrace ("HLTMuonVal") << "------> This is a muon trigger"
288  << endl;
289 
290  parsedMuonTrigNames.push_back(*iDumpName);
291 
292  }
293 
294  }
295 
296  // loop over each combination of selection + trigger
297  // make a match and plot analyzer for each combination
298 
299  vector<MuonSelectionStruct>::iterator iMuonSelector;
300  vector<string>::iterator iName = customNames.begin();
301 
302  LogTrace ("HLTMuonVal") << "Looping over custom selectors" << endl;
303  unsigned numSelectors = 0;
304  for ( iMuonSelector = customSelectors.begin();
305  iMuonSelector != customSelectors.end();
306  iMuonSelector++) {
307 
308  LogTrace ("HLTMuonVal") << "Num selectors = " << numSelectors << endl;
309 
310  for( size_t i = 0; i < parsedMuonTrigNames.size(); i++) {
311 
312  LogTrace ("HLTMuonVal") << "PARSED: Making match and plot for trigger " << parsedMuonTrigNames[i] << endl;
313 
314  vector<string> moduleNames = hltConfig.moduleLabels( parsedMuonTrigNames[i] );
315  HLTMuonMatchAndPlot *analyzer;
316  analyzer = new HLTMuonMatchAndPlot( initialPset, parsedMuonTrigNames[i], moduleNames, (*iMuonSelector), (*iName), validTriggerNames, currentRun, currentEventSetup );
317  theTriggerAnalyzers.push_back( analyzer );
318 
319  }
320  numSelectors++;
321  iName++;
322  }
323  //theOverlapAnalyzer = new HLTMuonOverlap( initialPset );
325 
326  LogTrace ("HLTMuonVal") << "You have created " << theNumberOfTriggers
327  << " trigger analyzers" << endl;
328 
329 
331 
332 
333  vector<HLTMuonMatchAndPlot *>::iterator thisAnalyzer;
334  int nTotalAnalyzers = 0;
335  for ( thisAnalyzer = theTriggerAnalyzers.begin();
336  thisAnalyzer != theTriggerAnalyzers.end();
337  ++thisAnalyzer )
338  {
339 
340  LogTrace ("HLTMuonVal")
341  << "Calling begin for analyzer " << nTotalAnalyzers;
342 
343  (*thisAnalyzer)->begin();
344 
345 
346  nTotalAnalyzers++;
347  }
348 
349  LogTrace ("HLTMuonVal")
350  << "OfflineDQMMuonTrigAnalyzer: Calling being for overlap analyzer" << endl;
351 
352 
353  }// end if this is the first run
354 }
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & triggerNames() const
names of trigger paths
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:485
void setVerbose(unsigned level)
Definition: DQMStore.cc:201
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)
DQMStore * dbe_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
tuple description
Definition: idDealer.py:66
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
vector< edm::ParameterSet > customCollection
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
void OfflineDQMMuonTrigAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 430 of file DQMOfflineMuonTrigAnalyzer.cc.

References LogTrace, and theTriggerAnalyzers.

430  {
431 
432  LogTrace ("HLTMuonVal")
433  << "Inside OfflineDQMMuonTrigAnalyzer endJob()" << endl;
434 
435 
436  vector<HLTMuonMatchAndPlot *>::iterator thisAnalyzer;
437  for ( thisAnalyzer = theTriggerAnalyzers.begin();
438  thisAnalyzer != theTriggerAnalyzers.end();
439  ++thisAnalyzer )
440  {
441  (*thisAnalyzer)->finish();
442  }
443  //theOverlapAnalyzer ->finish();
444 }
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)
void OfflineDQMMuonTrigAnalyzer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 411 of file DQMOfflineMuonTrigAnalyzer.cc.

References LogTrace, and theTriggerAnalyzers.

411  {
412 
413  LogTrace ("HLTMuonVal")
414  << "Inside OfflineDQMMuonTrigAnalyzer endRun()" << endl;
415 
416 
417  vector<HLTMuonMatchAndPlot *>::iterator thisAnalyzer;
418  for ( thisAnalyzer = theTriggerAnalyzers.begin();
419  thisAnalyzer != theTriggerAnalyzers.end();
420  ++thisAnalyzer )
421  {
422  (*thisAnalyzer)->endRun(theRun, theEventSetup);
423  }
424 
425 }
std::vector< HLTMuonMatchAndPlot * > theTriggerAnalyzers
#define LogTrace(id)

Member Data Documentation

vector<edm::ParameterSet> OfflineDQMMuonTrigAnalyzer::customCollection
private

Definition at line 77 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().

const ParameterSet& OfflineDQMMuonTrigAnalyzer::initialPset
private

Definition at line 79 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().

string OfflineDQMMuonTrigAnalyzer::theHltProcessName
private

Definition at line 76 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().

int OfflineDQMMuonTrigAnalyzer::theNumberOfTriggers
private

Definition at line 68 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun().

std::vector<HLTMuonMatchAndPlot*> OfflineDQMMuonTrigAnalyzer::theTriggerAnalyzers
private
vector<string> OfflineDQMMuonTrigAnalyzer::triggerNames
private

Definition at line 75 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by OfflineDQMMuonTrigAnalyzer().

vector<TPRegexp> OfflineDQMMuonTrigAnalyzer::trigRegExps
private

Definition at line 81 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().

bool OfflineDQMMuonTrigAnalyzer::useDQMStore
private

Definition at line 73 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().

bool OfflineDQMMuonTrigAnalyzer::weHaveProcessedTheFirstRun
private

Definition at line 72 of file DQMOfflineMuonTrigAnalyzer.cc.

Referenced by beginRun(), and OfflineDQMMuonTrigAnalyzer().