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
HLTTauDQMAutomation Class Reference

#include <HLTTauDQMAutomation.h>

Public Member Functions

void AutoCompleteConfig (std::vector< edm::ParameterSet > &config, HLTConfigProvider const &HLTCP)
 
void AutoCompleteMatching (edm::ParameterSet &config, HLTConfigProvider const &HLTCP, std::string moduleType)
 
 HLTTauDQMAutomation ()
 
 HLTTauDQMAutomation (std::string hltProcessName, double L1MatchDr, double HLTMatchDr)
 
virtual ~HLTTauDQMAutomation ()
 

Private Member Functions

std::map< std::string,
HLTTauDQMFilter >::iterator 
findFilter (std::map< std::string, HLTTauDQMFilter > &container, std::string const &triggerName)
 
bool selectHLTTauDQMFilter (std::map< std::string, HLTTauDQMFilter > &container, HLTTauDQMFilter const &filter)
 

Private Attributes

double HLTMatchDr_
 
std::string hltProcessName_
 
double L1MatchDr_
 

Detailed Description

Definition at line 11 of file HLTTauDQMAutomation.h.

Constructor & Destructor Documentation

HLTTauDQMAutomation::HLTTauDQMAutomation ( )

Definition at line 5 of file HLTTauDQMAutomation.cc.

5  {
6 }
HLTTauDQMAutomation::HLTTauDQMAutomation ( std::string  hltProcessName,
double  L1MatchDr,
double  HLTMatchDr 
)

Definition at line 8 of file HLTTauDQMAutomation.cc.

References HLTMatchDr_, hltProcessName_, and L1MatchDr_.

8  {
9  hltProcessName_ = hltProcessName;
10  L1MatchDr_ = L1MatchDr;
11  HLTMatchDr_ = HLTMatchDr;
12 }
HLTTauDQMAutomation::~HLTTauDQMAutomation ( )
virtual

Definition at line 14 of file HLTTauDQMAutomation.cc.

14  {
15 }

Member Function Documentation

void HLTTauDQMAutomation::AutoCompleteConfig ( std::vector< edm::ParameterSet > &  config,
HLTConfigProvider const &  HLTCP 
)

Definition at line 17 of file HLTTauDQMAutomation.cc.

References alignCSCRings::e, end, filters, findFilter(), HLTMatchDr_, hltProcessName_, HLTConfigProvider::inited(), L1MatchDr_, HLTConfigProvider::prescaleValue(), selectHLTTauDQMFilter(), dqm_diff::start, AlCaHLTBitMon_QueryRunRegistry::string, tmp, HLTConfigProvider::triggerNames(), and cms::Exception::what().

17  {
18  //Find tau trigger paths
19  boost::regex reTau(".*Tau.*");
20  std::map<std::string,HLTTauDQMFilter> filters;
21  if ( HLTCP.inited() ) {
22  const std::vector<std::string>& triggerNames = HLTCP.triggerNames();
23  for ( std::vector<std::string>::const_iterator ipath = triggerNames.begin(); ipath != triggerNames.end(); ++ipath ) {
24  if ( boost::regex_match(*ipath, reTau) && HLTCP.prescaleValue(0,*ipath) > 0 ) {
25  HLTTauDQMFilter tmp(*ipath, HLTCP.prescaleValue(0,*ipath), hltProcessName_, L1MatchDr_, HLTMatchDr_);
26  selectHLTTauDQMFilter(filters, tmp);
27  }
28  }
29  }
30 
31  //Add PFTau paths
32  boost::regex reMuTau("Mu(.+?)Tau");
33  boost::smatch what;
34  std::map<std::string,HLTTauDQMFilter> pfTauFilters;
35  for ( std::map<std::string,HLTTauDQMFilter>::const_iterator ipath = filters.begin(); ipath != filters.end(); ++ipath ) {
36  std::string::const_iterator start = ipath->first.begin();
37  std::string::const_iterator end = ipath->first.end();
38  if ( boost::regex_match(start, end, what, reMuTau) ) {
39  HLTTauDQMFilter tmp(ipath->second.name(), what[1]+"PFTau", HLTCP.prescaleValue(0,ipath->second.name()), hltProcessName_, L1MatchDr_, HLTMatchDr_, 1, 0, 0);
40  selectHLTTauDQMFilter(pfTauFilters, tmp);
41  }
42  }
43  filters.insert(pfTauFilters.begin(),pfTauFilters.end());
44 
45  //Auto configuration
46  std::vector<edm::ParameterSet>::iterator lpsum = config.end();
47  std::vector<std::map<std::string,HLTTauDQMFilter>::iterator> selectedFilters;
48  for ( std::vector<edm::ParameterSet>::iterator iconfig = config.begin(); iconfig != config.end(); ++iconfig ) {
49  std::string configtype;
50  try {
51  configtype = iconfig->getUntrackedParameter<std::string>("ConfigType");
52  } catch ( cms::Exception &e ) {
53  edm::LogWarning("HLTTauDQMAutomation") << e.what() << std::endl;
54  continue;
55  }
56  if (configtype == "Path") {
57  try {
58  if ( iconfig->getUntrackedParameter<std::vector<edm::ParameterSet> >("Filters",std::vector<edm::ParameterSet>()).size() == 0 ) {
59  std::string triggerName = iconfig->getUntrackedParameter<std::string>("DQMFolder");
60  std::map<std::string,HLTTauDQMFilter>::iterator iter = findFilter(filters,triggerName);
61  if ( iter != filters.end() ) {
62  iconfig->addUntrackedParameter<std::string>("DQMFolder", iter->first);
63  iconfig->addUntrackedParameter<std::vector<edm::ParameterSet> >("Filters", iter->second.getPSets(HLTCP) );
64  iconfig->addUntrackedParameter<edm::ParameterSet >("Reference", iter->second.getRefPSet());
65  selectedFilters.push_back(iter);
66  }
67  }
68  } catch ( cms::Exception &e ) {
69  edm::LogWarning("HLTTauDQMAutomation") << e.what() << std::endl;
70  continue;
71  }
72  }
73  else if (configtype == "LitePath") {
74  try {
75  if ( iconfig->getUntrackedParameter<std::vector<edm::ParameterSet> >("Filters",std::vector<edm::ParameterSet>()).size() == 0 ) {
76  std::string triggerName = iconfig->getUntrackedParameter<std::string>("DQMFolder");
77  if ( triggerName != "Summary" ) {
78  std::map<std::string,HLTTauDQMFilter>::iterator iter = findFilter(filters,triggerName);
79  if ( iter != filters.end() ) {
80  iconfig->addUntrackedParameter<std::string>("DQMFolder", iter->first);
81  iconfig->addUntrackedParameter<std::vector<edm::ParameterSet> >("Filters", iter->second.getPSets(HLTCP) );
82  selectedFilters.push_back(iter);
83  }
84  } else {
85  lpsum = iconfig;
86  }
87  }
88  } catch ( cms::Exception &e ) {
89  edm::LogWarning("HLTTauDQMAutomation") << e.what() << std::endl;
90  continue;
91  }
92  }
93  }
94 
95  //Configure litepath summary
96  if ( lpsum != config.end() ) {
97  std::vector<edm::ParameterSet> filterSet;
98  for ( std::vector<std::map<std::string,HLTTauDQMFilter>::iterator>::iterator ifilter = selectedFilters.begin(); ifilter != selectedFilters.end(); ++ifilter ) {
99  if ( !((*ifilter)->second.getSummaryPSet(HLTCP).empty()) ) {
100  filterSet.push_back((*ifilter)->second.getSummaryPSet(HLTCP));
101  }
102  }
103  lpsum->addUntrackedParameter<std::vector<edm::ParameterSet> >("Filters", filterSet );
104  }
105 }
virtual char const * what() const
Definition: Exception.cc:141
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::map< std::string, HLTTauDQMFilter >::iterator findFilter(std::map< std::string, HLTTauDQMFilter > &container, std::string const &triggerName)
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
#define end
Definition: vmac.h:38
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool selectHLTTauDQMFilter(std::map< std::string, HLTTauDQMFilter > &container, HLTTauDQMFilter const &filter)
void HLTTauDQMAutomation::AutoCompleteMatching ( edm::ParameterSet config,
HLTConfigProvider const &  HLTCP,
std::string  moduleType 
)

Definition at line 107 of file HLTTauDQMAutomation.cc.

References edm::ParameterSet::addUntrackedParameter(), alignCSCRings::e, end, filters, findFilter(), edm::ParameterSet::getUntrackedParameter(), HLTMatchDr_, hltProcessName_, HLTConfigProvider::inited(), L1MatchDr_, HLTConfigProvider::moduleType(), HLTConfigProvider::prescaleValue(), selectHLTTauDQMFilter(), dqm_diff::start, AlCaHLTBitMon_QueryRunRegistry::string, tmp, HLTConfigProvider::triggerNames(), and cms::Exception::what().

107  {
108  //Find tau trigger paths
109  boost::regex reTau(".*Tau.*");
110  std::map<std::string,HLTTauDQMFilter> filters;
111  if ( HLTCP.inited() ) {
112  const std::vector<std::string>& triggerNames = HLTCP.triggerNames();
113  for ( std::vector<std::string>::const_iterator ipath = triggerNames.begin(); ipath != triggerNames.end(); ++ipath ) {
114  if ( boost::regex_match(*ipath, reTau) && HLTCP.prescaleValue(0,*ipath) > 0 ) {
115  HLTTauDQMFilter tmp(*ipath, HLTCP.prescaleValue(0,*ipath), hltProcessName_, L1MatchDr_, HLTMatchDr_);
116  selectHLTTauDQMFilter(filters, tmp);
117  }
118  }
119  }
120 
121  //Auto configuration
122  if ( config.getUntrackedParameter<bool>("doMatching") ) {
123  std::vector<edm::ParameterSet> matchingFilters = config.getUntrackedParameter<std::vector<edm::ParameterSet> >("matchFilters");
124  for ( std::vector<edm::ParameterSet>::iterator imatch = matchingFilters.begin(); imatch != matchingFilters.end(); ++imatch ) {
125  std::string autoFilterName = imatch->getUntrackedParameter<std::string>("AutomaticFilterName","");
126  if ( autoFilterName != "" ) {
127  try {
128  std::map<std::string,HLTTauDQMFilter>::iterator iter = findFilter(filters,autoFilterName);
129  if ( iter != filters.end() ) {
130  std::map<int,std::string> modules = iter->second.interestingModules(HLTCP);
131  boost::regex exprEle(moduleType);
132  std::string selectedModule = "";
133  for ( std::map<int,std::string>::const_iterator imodule = modules.begin(); imodule != modules.end(); ++imodule ) {
134  const std::string& mType = HLTCP.moduleType(imodule->second);
135  std::string::const_iterator start = mType.begin();
136  std::string::const_iterator end = mType.end();
137  if ( boost::regex_match(start, end, exprEle) ) {
138  selectedModule = imodule->second;
139  break;
140  }
141  }
142 
143  imatch->addUntrackedParameter<edm::InputTag>("FilterName", edm::InputTag(selectedModule,"",hltProcessName_) );
144  } else {
145  imatch->addUntrackedParameter<edm::InputTag>("FilterName", edm::InputTag("","",hltProcessName_) );
146  }
147  } catch ( cms::Exception &e ) {
148  edm::LogWarning("HLTTauDQMAutomation") << e.what() << std::endl;
149  continue;
150  }
151  }
152  }
153  config.addUntrackedParameter<std::vector<edm::ParameterSet> >("matchFilters", matchingFilters );
154  }
155 }
virtual char const * what() const
Definition: Exception.cc:141
T getUntrackedParameter(std::string const &, T const &) const
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::map< std::string, HLTTauDQMFilter >::iterator findFilter(std::map< std::string, HLTTauDQMFilter > &container, std::string const &triggerName)
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
#define end
Definition: vmac.h:38
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:209
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool selectHLTTauDQMFilter(std::map< std::string, HLTTauDQMFilter > &container, HLTTauDQMFilter const &filter)
std::map< std::string, HLTTauDQMFilter >::iterator HLTTauDQMAutomation::findFilter ( std::map< std::string, HLTTauDQMFilter > &  container,
std::string const &  triggerName 
)
private

Definition at line 169 of file HLTTauDQMAutomation.cc.

Referenced by AutoCompleteConfig(), and AutoCompleteMatching().

169  {
170  boost::regex re("[a-zA-Z_]+");
171  std::map<std::string,HLTTauDQMFilter>::iterator iter;
172  if ( boost::regex_match(triggerName, re) ) {
173  iter = container.find(triggerName);
174  return iter;
175  } else {
176  boost::regex tmpRe(triggerName);
177  for ( iter = container.begin(); iter != container.end(); ++iter ) {
178  if ( boost::regex_match(iter->first, tmpRe) ) { //Always take the first matching path
179  return iter;
180  }
181  }
182  }
183  return container.end();
184 }
bool HLTTauDQMAutomation::selectHLTTauDQMFilter ( std::map< std::string, HLTTauDQMFilter > &  container,
HLTTauDQMFilter const &  filter 
)
private

Definition at line 157 of file HLTTauDQMAutomation.cc.

References alcazmumu_cfi::filter, and HLTTauDQMFilter::type().

Referenced by AutoCompleteConfig(), and AutoCompleteMatching().

157  {
158  bool inserted = false;
159  std::map<std::string,HLTTauDQMFilter>::iterator iter = container.find(filter.type());
160  if ( iter == container.end() ) {
161  container.insert(std::make_pair(filter.type(), filter));
162  inserted = true;
163  } else {
164  iter->second = iter->second.select(filter,inserted);
165  }
166  return inserted;
167 }

Member Data Documentation

double HLTTauDQMAutomation::HLTMatchDr_
private
std::string HLTTauDQMAutomation::hltProcessName_
private
double HLTTauDQMAutomation::L1MatchDr_
private