CMS 3D CMS Logo

EgHLTTrigTools.cc
Go to the documentation of this file.
4 
5 #include <boost/algorithm/string.hpp>
6 using namespace egHLT;
7 
9  const trigger::TriggerEvent* trigEvt,
10  const std::string& hltTag,
11  const TrigCodes& trigCodes) {
12  TrigCodes::TrigBitSet evtTrigs;
13  for (auto const& filter : filters) {
14  size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filter.first, "", hltTag));
15  const TrigCodes::TrigBitSet filterCode = trigCodes.getCode(filter.first.c_str());
16  if (filterNrInEvt <
17  trigEvt
18  ->sizeFilters()) { //filter found in event, however this only means that something passed the previous filter
19  const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt);
20  if (static_cast<int>(trigKeys.size()) >= filter.second) {
21  evtTrigs |= filterCode; //filter was passed
22  }
23  } //end check if filter is present
24  } //end loop over all filters
25 
26  return evtTrigs;
27 }
28 
29 //this function runs over all parameter sets for every module that has ever run on an event in this job
30 //it looks for the specified filter module
31 //and returns the minimum number of objects required to pass the filter, -1 if its not found
32 //which is either the ncandcut or MinN parameter in the filter config
33 //assumption: nobody will ever change MinN or ncandcut without changing the filter name
34 //as this just picks the first module name and if 2 different versions of HLT were run with the filter having
35 //a different min obj required in the two versions, this may give the wrong answer
36 std::vector<int> trigTools::getMinNrObjsRequiredByFilter(const std::vector<std::string>& filterNames) {
37  std::vector<int> retVal(filterNames.size(), -2);
38  const std::string mag0("@module_label");
39  const std::string mag1("ncandcut");
40  const std::string mag2("nZcandcut");
41  const std::string mag3("MinN");
42  const std::string mag4("minN");
43 
44  std::vector<std::string> filterEntryStrings;
45  filterEntryStrings.reserve(filterNames.size());
46  for (auto const& filterName : filterNames) {
47  const edm::Entry filterEntry(mag0, filterName, true);
48  filterEntryStrings.push_back(filterEntry.toString());
49  }
50 
51  //will return out of for loop once its found it to save time
52  const edm::pset::Registry* psetRegistry = edm::pset::Registry::instance();
53  if (psetRegistry == nullptr) {
54  retVal = std::vector<int>(filterNames.size(), -1);
55  return retVal;
56  }
57  for (auto& psetIt : *psetRegistry) { //loop over every pset for every module ever run
58  const std::map<std::string, edm::Entry>& mapOfPara =
59  psetIt.second.tbl(); //contains the parameter name and value for all the parameters of the pset
60  const auto itToModLabel = mapOfPara.find(mag0);
61  if (itToModLabel != mapOfPara.end()) {
62  std::string itString = itToModLabel->second.toString();
63 
64  for (unsigned int i = 0; i < filterNames.size(); i++) {
65  if (retVal[i] == -1)
66  continue; //already done
67 
68  if (itString ==
69  filterEntryStrings[i]) { //moduleName is the filter name, we have found filter, we will now return something
70  auto itToCandCut = mapOfPara.find(mag1);
71  if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() == 'I')
72  retVal[i] = itToCandCut->second.getInt32();
73  else { //checks if nZcandcut exists and is int32, if not return -1
74  itToCandCut = mapOfPara.find(mag2);
75  if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() == 'I')
76  retVal[i] = itToCandCut->second.getInt32();
77  else { //checks if MinN exists and is int32, if not return -1
78  itToCandCut = mapOfPara.find(mag3);
79  if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() == 'I')
80  retVal[i] = itToCandCut->second.getInt32();
81  else { //checks if minN exists and is int32, if not return -1
82  itToCandCut = mapOfPara.find(mag4);
83  if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() == 'I')
84  retVal[i] = itToCandCut->second.getInt32();
85  else
86  retVal[i] = -1;
87  }
88  }
89  }
90  }
91  }
92  }
93  }
94  for (unsigned int i = 0; i < filterNames.size(); i++)
95  if (retVal[i] == -2)
96  retVal[i] = -1;
97  return retVal;
98 }
99 
100 //this looks into the HLT config and fills a sorted vector with the last filter of all HLT triggers
101 //it assumes this filter is either the last (in the case of ES filters) or second to last in the sequence
102 /*void trigTools::getActiveFilters(const HLTConfigProvider& hltConfig,std::vector<std::string>& activeFilters)
103  {
104  activeFilters.clear();
105 
106  for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
107  const std::string& pathName = hltConfig.triggerName(pathNr);
108  if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
109 
110  std::string lastFilter;
111  const std::vector<std::string>& filters = hltConfig.moduleLabels(pathNr);
112  if(!filters.empty()){
113  if(filters.back()=="hltBoolEnd" && filters.size()>=2){
114  activeFilters.push_back(filters[filters.size()-2]); //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits
115  }else activeFilters.push_back(filters.back());
116  //std::cout<<filters[filters.size()-2]<<std::endl;
117  }
118  }//end hlt path check
119  }//end path loop over
120 
121  std::sort(activeFilters.begin(),activeFilters.end());
122 
123  }*/
124 //----Morse--------------
125 //want to grab all modules with saveTags==true for e/g paths
126 //veto x-triggers, which will be handled by PAGs
127 //first step towards automation; for now it is just used to check against filtersToMon
128 //should have some overhead but they will be filtered out by filterInactiveTriggers anyway
130  std::vector<std::string>& activeFilters,
131  std::vector<std::string>& activeEleFilters,
132  std::vector<std::string>& activeEle2LegFilters,
133  std::vector<std::string>& activePhoFilters,
134  std::vector<std::string>& activePho2LegFilters) {
135  activeFilters.clear();
136  activeEleFilters.clear();
137  activeEle2LegFilters.clear();
138  activePhoFilters.clear();
139  activePho2LegFilters.clear();
140 
141  for (size_t pathNr = 0; pathNr < hltConfig.size(); pathNr++) {
142  const std::string& pathName = hltConfig.triggerName(pathNr);
143 
144  if (pathName.find("HLT_") == 0) { //hlt path as they all start with HLT_XXXX
145  if ((pathName.find("Photon") == 4 || pathName.find("Ele") == 4 || pathName.find("EG") != pathName.npos ||
146  pathName.find("PAPhoton") == 4 || pathName.find("PAEle") == 4 || pathName.find("PASinglePhoton") == 4 ||
147  pathName.find("HIPhoton") == 4 || pathName.find("HIEle") == 4 || pathName.find("HISinglePhoton") == 4 ||
148  pathName.find("Activity") == 4 || pathName.find("Physics") == 4 || pathName.find("DiSC") == 4) &&
149  (pathName.find("Jet") == pathName.npos && pathName.find("Muon") == pathName.npos &&
150  pathName.find("Tau") == pathName.npos && pathName.find("HT") == pathName.npos &&
151  pathName.find("MR") == pathName.npos && pathName.find("LEITI") == pathName.npos &&
152  pathName.find("Jpsi") == pathName.npos && pathName.find("Ups") == pathName.npos)) { //veto x-triggers
153  //std::string lastFilter;
154  const std::vector<std::string>& filters = hltConfig.saveTagsModules(pathNr);
155 
156  //std::cout<<"Number of prescale sets: "<<hltConfig.prescaleSize()<<std::endl;
157  //std::cout<<std::endl<<"Path Name: "<<pathName<<" Prescale: "<<hltConfig.prescaleValue(1,pathName)<<std::endl;
158 
159  if (!filters.empty()) {
160  //std::cout<<"Path Name: "<<pathName<<std::endl;
161  //if(filters.back()=="hltBoolEnd" && filters.size()>=2){
162  std::vector<int> minNRFFCache = getMinNrObjsRequiredByFilter(filters);
163 
164  for (size_t filter = 0; filter < filters.size(); filter++) {
165  //std::cout << filters[filter] << std::endl;
166  if (filters[filter].find("Filter") !=
167  filters[filter].npos) { //keep only modules that contain the word "Filter"
168  //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
169  int minNRFF = minNRFFCache[filter];
170  int minNRFFP1 = -99;
171  if (filter < filters.size() - 1)
172  minNRFFP1 = minNRFFCache[filter + 1];
173  if ( //keep only the last filter and the last one with ncandcut==1 (for di-object triggers)
174  (minNRFF == 1 && minNRFFP1 == 2) ||
175  (minNRFF == 1 && minNRFFP1 == 1 && filters[filter + 1].find("Mass") != filters[filter + 1].npos) ||
176  (minNRFF == 1 && minNRFFP1 == 1 && filters[filter + 1].find("FEM") != filters[filter + 1].npos) ||
177  (minNRFF == 1 && minNRFFP1 == 1 && filters[filter + 1].find("PFMT") != filters[filter + 1].npos) ||
178  filter == filters.size() - 1) {
179  activeFilters.push_back(filters[filter]); //saves all modules with saveTags=true
180 
181  //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
182  if (pathName.find("Photon") != pathName.npos || pathName.find("Activity") != pathName.npos ||
183  pathName.find("Physics") != pathName.npos || pathName.find("DiSC") == 4) {
184  activePhoFilters.push_back(filters[filter]); //saves all "Photon" paths into photon set
185  int posPho = pathName.find("Pho") + 1;
186  if (pathName.find("Pho", posPho) != pathName.npos || pathName.find("SC", posPho) != pathName.npos) {
187  //This saves all "x_Photon_x_Photon_x" and "x_Photon_x_SC_x" path filters into 2leg photon set
188  activePho2LegFilters.push_back(filters[filter]);
189  //std::cout<<"Pho2LegPath: "<<pathName<<std::endl;
190  }
191  }
192  if (pathName.find("Ele") != pathName.npos || pathName.find("Activity") != pathName.npos ||
193  pathName.find("Physics") != pathName.npos) {
194  activeEleFilters.push_back(filters[filter]); //saves all "Ele" paths into electron set
195  int posEle = pathName.find("Ele") + 1;
196  if (pathName.find("Ele", posEle) != pathName.npos || pathName.find("SC", posEle) != pathName.npos) {
197  if ((minNRFF == 1 && minNRFFP1 == 2) ||
198  (minNRFF == 1 && minNRFFP1 == 1 &&
199  filters[filter + 1].find("Mass") != filters[filter + 1].npos) ||
200  (minNRFF == 1 && minNRFFP1 == 1 &&
201  filters[filter + 1].find("SC") != filters[filter + 1].npos) ||
202  (minNRFF == 1 && minNRFFP1 == 1 &&
203  filters[filter + 1].find("FEM") != filters[filter + 1].npos)) {
204  //This saves all "x_Ele_x_Ele_x" and "x_Ele_x_SC_x" path filters into 2leg electron set
205  activeEle2LegFilters.push_back(filters[filter] + "::" + filters[filter + 1]);
206  //std::cout<<"Ele2LegPath: "<<pathName<<std::endl;
207  }
208  }
209  }
210  }
211  }
212  }
213  //std::cout<<filters[filters.size()-2]<<std::endl;
214  //}else activeFilters.push_back(filters.back());
215  }
216  }
217  } //end hlt path check
218  } //end path loop over
219  /*for(size_t i=0;i<activeEle2LegFilters.size();i++){
220  std::cout<<"Leg1: "<<activeEle2LegFilters[i].substr(0,activeEle2LegFilters[i].find("::"))<<std::endl;
221  std::cout<<"Leg2: "<<activeEle2LegFilters[i].substr(activeEle2LegFilters[i].find("::")+2)<<std::endl<<std::endl;
222  }*/
223  std::sort(activeFilters.begin(), activeFilters.end());
224  std::sort(activeEleFilters.begin(), activeEleFilters.end());
225  std::sort(activeEle2LegFilters.begin(), activeEle2LegFilters.end());
226  std::sort(activePhoFilters.begin(), activePhoFilters.end());
227 }
228 //----------------------------
229 
230 //this function will filter the inactive filternames
231 //it assumes the list of active filters is sorted
232 //at some point this will be replaced with one line of fancy stl code but I want it to work now :)
233 void trigTools::filterInactiveTriggers(std::vector<std::string>& namesToFilter,
234  std::vector<std::string>& activeFilters) {
235  //tempory vector to store the filtered results
236  std::vector<std::string> filteredNames;
237  /*
238  for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
239  if(std::binary_search(activeFilters.begin(),activeFilters.end(),namesToFilter[inputFilterNr])){
240  filteredNames.push_back(namesToFilter[inputFilterNr]);
241  }//std::cout<<filteredNames[inputFilterNr]<<std::endl;
242  }
243  */
244  //namesToFilter.swap(activeFilters);
245  filteredNames = activeFilters;
246  namesToFilter.swap(filteredNames);
247 }
248 
249 //input filters have format filter1:filter2, this checks both filters are active, rejects ones where both are not active
250 void trigTools::filterInactiveTightLooseTriggers(std::vector<std::string>& namesToFilter,
251  const std::vector<std::string>& activeFilters) {
252  //tempory vector to store the filtered results
253  std::vector<std::string> filteredNames;
254 
255  for (auto& inputFilterNr : namesToFilter) {
256  std::vector<std::string> names;
257  boost::split(names, inputFilterNr, boost::is_any_of(std::string(":")));
258  if (names.size() != 2)
259  continue; //format incorrect, reject it
260  if (std::binary_search(activeFilters.begin(), activeFilters.end(), names[0]) &&
261  std::binary_search(activeFilters.begin(), activeFilters.end(), names[1])) { //both filters are valid
262  filteredNames.push_back(inputFilterNr);
263  }
264  }
265 
266  namesToFilter.swap(filteredNames);
267 }
268 
269 //a comparison functiod for std::pair<std::string,std::string>
270 //this probably (infact must) exist elsewhere
272 public:
273  bool operator()(const std::pair<std::string, std::string>& lhs,
274  const std::pair<std::string, std::string>& rhs) const {
275  return keyLess(lhs.first, rhs.first);
276  }
277  bool operator()(const std::pair<std::string, std::string>& lhs,
278  const std::pair<std::string, std::string>::first_type& rhs) const {
279  return keyLess(lhs.first, rhs);
280  }
281  bool operator()(const std::pair<std::string, std::string>::first_type& lhs,
282  const std::pair<std::string, std::string>& rhs) const {
283  return keyLess(lhs, rhs.first);
284  }
285 
286 private:
287  bool keyLess(const std::pair<std::string, std::string>::first_type& k1,
288  const std::pair<std::string, std::string>::first_type& k2) const {
289  return k1 < k2;
290  }
291 };
292 
294  const std::vector<std::string>& filters,
295  std::vector<std::string>& paths) {
296  paths.clear();
297  std::vector<std::pair<std::string, std::string> > filtersAndPaths;
298 
299  for (size_t pathNr = 0; pathNr < hltConfig.size(); pathNr++) {
300  const std::string& pathName = hltConfig.triggerName(pathNr);
301  if (pathName.find("HLT_") == 0) { //hlt path as they all start with HLT_XXXX
302 
303  std::string lastFilter;
304  const std::vector<std::string>& pathFilters = hltConfig.moduleLabels(pathNr);
305  if (!pathFilters.empty()) {
306  if (pathFilters.back() == "hltBoolEnd" && pathFilters.size() >= 2) {
307  //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits
308  filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size() - 2], pathName));
309  } else
310  filtersAndPaths.push_back(std::make_pair(pathFilters.back(), pathName));
311  }
312  } //end hlt path check
313  } //end path loop over
314 
315  std::sort(filtersAndPaths.begin(), filtersAndPaths.end(), StringPairCompare());
316 
317  for (auto const& filter : filters) {
318  typedef std::vector<std::pair<std::string, std::string> >::const_iterator VecIt;
319  std::pair<VecIt, VecIt> searchResult =
320  std::equal_range(filtersAndPaths.begin(), filtersAndPaths.end(), filter, StringPairCompare());
321  if (searchResult.first != searchResult.second)
322  paths.push_back(searchResult.first->second);
323  else
324  paths.push_back(filter); //if cant find the path, just write the filter
325  //---Morse-----
326  //std::cout<<filtersAndPaths[filterNr].first<<" "<<filtersAndPaths[filterNr].second<<std::endl;
327  //-------------
328  }
329 }
330 
332  const std::vector<std::string>& modules = hltConfig.moduleLabels(path);
333 
334  for (auto const& moduleName : modules) {
335  if (moduleName.find("hltL1s") == 0)
336  return moduleName; //found l1 seed module
337  }
339  return dummy;
340 }
341 
342 //hunts for first instance of pattern EtX where X = a number of any length and returns X
344  size_t etStrPos = trigName.find("Et");
345  while (etStrPos != std::string::npos && trigName.find_first_of("1234567890", etStrPos) != etStrPos + 2) {
346  etStrPos = trigName.find("Et", etStrPos + 1);
347  }
348  if (etStrPos != std::string::npos && trigName.find_first_of("1234567890", etStrPos) == etStrPos + 2) {
349  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 2);
350 
351  std::istringstream etValStr(trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
352  float etVal;
353  etValStr >> etVal;
354  return etVal;
355  }
356  return 0;
357 }
358 
359 //hunts for second instance of pattern X where X = a number of any length and returns X
360 //This has gotten ridiculously more complicated now that filters do not have the "Et" string in them
362  const std::string& trigName) { //std::cout<<"What the heck is this trigName?:"<<trigName<<std::endl;
363  bool isEle = false, isPhoton = false, isEG = false, isEle2 = false, isPhoton2 = false, isEG2 = false, isSC2 = false;
364  size_t etStrPos = trigName.npos;
365  if (trigName.find("Ele") < trigName.find("Photon") && trigName.find("Ele") < trigName.find("EG")) {
366  etStrPos = trigName.find("Ele");
367  isEle = true;
368  } else if (trigName.find("EG") < trigName.find("Photon") && trigName.find("EG") < trigName.find("Ele")) {
369  etStrPos = trigName.find("EG");
370  isEG = true;
371  } else if (trigName.find("Photon") < trigName.find("Ele") && trigName.find("Photon") < trigName.find("EG")) {
372  etStrPos = trigName.find("Photon");
373  isPhoton = true;
374  }
375  //size_t etStrPos = trigName.find("Et");
376  //std::cout<<"Got Original Et spot; etStrPos="<<etStrPos<<std::endl;
377  /*while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){
378  etStrPos = trigName.find("Et",etStrPos+1);//std::cout<<"Got first Et spot; etStrPos="<<etStrPos<<std::endl;
379  }*/
380  if (etStrPos != trigName.npos &&
381  (trigName.find("Ele", etStrPos + 1) != trigName.npos || trigName.find("EG", etStrPos + 1) != trigName.npos ||
382  trigName.find("Photon", etStrPos + 1) != trigName.npos || trigName.find("SC", etStrPos + 1) != trigName.npos)) {
383  if (trigName.find("Ele", etStrPos + 1) < trigName.find("Photon", etStrPos + 1) &&
384  trigName.find("Ele", etStrPos + 1) < trigName.find("EG", etStrPos + 1) &&
385  trigName.find("Ele", etStrPos + 1) < trigName.find("SC", etStrPos + 1)) {
386  etStrPos = trigName.find("Ele", etStrPos + 1);
387  isEle2 = true;
388  } else if (trigName.find("EG", etStrPos + 1) < trigName.find("Photon", etStrPos + 1) &&
389  trigName.find("EG", etStrPos + 1) < trigName.find("Ele", etStrPos + 1) &&
390  trigName.find("EG", etStrPos + 1) < trigName.find("SC", etStrPos + 1)) {
391  etStrPos = trigName.find("EG", etStrPos + 1);
392  isEG2 = true;
393  } else if (trigName.find("Photon", etStrPos + 1) < trigName.find("EG", etStrPos + 1) &&
394  trigName.find("Photon", etStrPos + 1) < trigName.find("Ele", etStrPos + 1) &&
395  trigName.find("Photon", etStrPos + 1) < trigName.find("SC", etStrPos + 1)) {
396  etStrPos = trigName.find("Photon", etStrPos + 1);
397  isPhoton2 = true;
398  } else if (trigName.find("SC", etStrPos + 1) < trigName.find("EG", etStrPos + 1) &&
399  trigName.find("SC", etStrPos + 1) < trigName.find("Ele", etStrPos + 1) &&
400  trigName.find("SC", etStrPos + 1) < trigName.find("Photon", etStrPos + 1)) {
401  etStrPos = trigName.find("Photon", etStrPos + 1);
402  isSC2 = true;
403  }
404  //std::cout<<"Got second Et spot; etStrPos="<<etStrPos<<std::endl;//}//get second instance. if it dne, keep first
405 
406  if (isEle2) {
407  if (etStrPos != trigName.npos &&
408  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 3) { //std::cout<<"In if"<<std::endl;
409  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 3);
410 
411  std::istringstream etValStr(trigName.substr(etStrPos + 3, endOfEtValStr - etStrPos - 3));
412  float etVal;
413  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
414  return etVal;
415  }
416  }
417  if (isEG2 || isSC2) {
418  if (etStrPos != trigName.npos &&
419  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 2) { //std::cout<<"In if"<<std::endl;
420  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 2);
421 
422  std::istringstream etValStr(trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
423  float etVal;
424  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
425  return etVal;
426  }
427  }
428 
429  if (isPhoton2) {
430  if (etStrPos != trigName.npos &&
431  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 6) { //std::cout<<"In if"<<std::endl;
432  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 6);
433 
434  std::istringstream etValStr(trigName.substr(etStrPos + 6, endOfEtValStr - etStrPos - 6));
435  float etVal;
436  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
437  return etVal;
438  }
439  }
440  } else if (etStrPos != trigName.npos) {
441  if (isEle) {
442  if (etStrPos != trigName.npos &&
443  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 3) { //std::cout<<"In if"<<std::endl;
444  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 3);
445 
446  std::istringstream etValStr(trigName.substr(etStrPos + 3, endOfEtValStr - etStrPos - 3));
447  float etVal;
448  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
449  return etVal;
450  }
451  }
452  if (isEG) {
453  if (etStrPos != trigName.npos &&
454  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 2) { //std::cout<<"In if"<<std::endl;
455  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 2);
456 
457  std::istringstream etValStr(trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
458  float etVal;
459  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
460  return etVal;
461  }
462  }
463 
464  if (isPhoton) {
465  if (etStrPos != trigName.npos &&
466  trigName.find_first_of("1234567890", etStrPos) == etStrPos + 6) { //std::cout<<"In if"<<std::endl;
467  size_t endOfEtValStr = trigName.find_first_not_of("1234567890", etStrPos + 6);
468 
469  std::istringstream etValStr(trigName.substr(etStrPos + 6, endOfEtValStr - etStrPos - 6));
470  float etVal;
471  etValStr >> etVal; //std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
472  return etVal;
473  }
474  }
475  }
476 
477  return 0;
478 }
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
bool operator()(const std::pair< std::string, std::string > &lhs, const std::pair< std::string, std::string > &rhs) const
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
const std::string names[nVars_]
std::string getL1SeedFilterOfPath(const HLTConfigProvider &hltConfig, const std::string &path)
std::string toString() const
Definition: Entry.cc:755
std::vector< int > getMinNrObjsRequiredByFilter(const std::vector< std::string > &filterName)
float getEtThresFromName(const std::string &trigName)
TrigCodes::TrigBitSet getFiltersPassed(const std::vector< std::pair< std::string, int > > &filters, const trigger::TriggerEvent *trigEvt, const std::string &hltTag, const TrigCodes &trigCodes)
bool operator()(const std::pair< std::string, std::string >::first_type &lhs, const std::pair< std::string, std::string > &rhs) const
bool operator()(const std::pair< std::string, std::string > &lhs, const std::pair< std::string, std::string >::first_type &rhs) const
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
void getActiveFilters(const HLTConfigProvider &hltConfig, std::vector< std::string > &activeFilters, std::vector< std::string > &activeEleFilters, std::vector< std::string > &activeEle2LegFilters, std::vector< std::string > &activePhoFilters, std::vector< std::string > &activePho2LegFilters)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
std::vector< size_type > Keys
TrigBitSet getCode(const char *descript) const
void filterInactiveTriggers(std::vector< std::string > &namesToFilter, std::vector< std::string > &activeFilters)
void filterInactiveTightLooseTriggers(std::vector< std::string > &namesToFilter, const std::vector< std::string > &activeFilters)
float getSecondEtThresFromName(const std::string &trigName)
bool keyLess(const std::pair< std::string, std::string >::first_type &k1, const std::pair< std::string, std::string >::first_type &k2) const
std::bitset< maxNrBits_ > TrigBitSet
void translateFiltersToPathNames(const HLTConfigProvider &hltConfig, const std::vector< std::string > &filters, std::vector< std::string > &paths)
static Registry * instance()
Definition: Registry.cc:12