test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
egHLT::trigTools Namespace Reference

Functions

template<class T , class U >
void fillHLTposition (T &obj, U &hltData, const std::vector< std::string > &filters, const trigger::TriggerEvent *trigEvt, const std::string &hltTag)
 
void filterInactiveTightLooseTriggers (std::vector< std::string > &namesToFilter, const std::vector< std::string > &activeFilters)
 
void filterInactiveTriggers (std::vector< std::string > &namesToFilter, std::vector< std::string > &activeFilters)
 
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)
 
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)
 
std::string getL1SeedFilterOfPath (const HLTConfigProvider &hltConfig, const std::string &path)
 
int getMinNrObjsRequiredByFilter (const std::string &filterName)
 
float getSecondEtThresFromName (const std::string &trigName)
 
template<class T >
void setFiltersObjPasses (std::vector< T > &objs, const std::vector< std::string > &filters, const std::vector< std::pair< std::string, std::string > > &l1PreAndSeedFilters, const TrigCodes::TrigBitSet &evtTrigBits, const TrigCodes &trigCodes, const trigger::TriggerEvent *trigEvt, const std::string &hltTag)
 
void translateFiltersToPathNames (const HLTConfigProvider &hltConfig, const std::vector< std::string > &filters, std::vector< std::string > &paths)
 

Function Documentation

template<class T , class U >
void egHLT::trigTools::fillHLTposition ( T obj,
U &  hltData,
const std::vector< std::string > &  filters,
const trigger::TriggerEvent trigEvt,
const std::string &  hltTag 
)

Definition at line 103 of file EgHLTTrigTools.h.

References reco::deltaR(), alcaDQMUpload::encode(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), and trigger::TriggerEvent::getObjects().

Referenced by egHLT::OffHelper::fillHLTData(), and egHLT::OffHelper::fillHLTDataPho().

108 {
109  std::vector<TrigCodes::TrigBitSet> partTrigBits(1);
110  const double maxDeltaR=0.1;
111  for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){
112  size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec],"",hltTag).encode());
113  //const TrigCodes::TrigBitSet filterCode = trigCodes.getCode(filters[filterNrInVec].c_str());
114  if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it
115  const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt); //trigger::Keys is actually a vector<uint16_t> holding the position of trigger objects in the trigger collection passing the filter
116  const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects());
117  for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){
118  float trigObjEta = trigObjColl[*keyIt].eta();
119  float trigObjPhi = trigObjColl[*keyIt].phi();
120  float trigObjE = trigObjColl[*keyIt].energy();
121  if (reco::deltaR(particle.superCluster()->eta(),particle.superCluster()->phi(),trigObjEta,trigObjPhi) < maxDeltaR){
122  hltData.HLTeta=trigObjEta;
123  hltData.HLTphi=trigObjPhi;
124  hltData.HLTenergy=trigObjE;
125  }//end dR<maxDeltaR trig obj match test
126  }//end loop over all objects passing filter`
127  }//end check if filter is present
128  }//end check if path has fired in the event
129 }//end loop over all filters
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
void egHLT::trigTools::filterInactiveTightLooseTriggers ( std::vector< std::string > &  namesToFilter,
const std::vector< std::string > &  activeFilters 
)

Definition at line 213 of file EgHLTTrigTools.cc.

References cscdqm::h::names, split, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().

214 {
215  //tempory vector to store the filtered results
216  std::vector<std::string> filteredNames;
217 
218  for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
219  std::vector<std::string> names;
220  boost::split(names,namesToFilter[inputFilterNr],boost::is_any_of(std::string(":")));
221  if(names.size()!=2) continue; //format incorrect, reject it
222  if(std::binary_search(activeFilters.begin(),activeFilters.end(),names[0]) &&
223  std::binary_search(activeFilters.begin(),activeFilters.end(),names[1])){ //both filters are valid
224  filteredNames.push_back(namesToFilter[inputFilterNr]);
225  }
226  }
227 
228  namesToFilter.swap(filteredNames);
229 }
static const HistoName names[]
double split
Definition: MVATrainer.cc:139
void egHLT::trigTools::filterInactiveTriggers ( std::vector< std::string > &  namesToFilter,
std::vector< std::string > &  activeFilters 
)

Definition at line 196 of file EgHLTTrigTools.cc.

Referenced by EgHLTOfflineSummaryClient::beginRun(), EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().

197 {
198  //tempory vector to store the filtered results
199  std::vector<std::string> filteredNames;
200  /*
201  for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
202  if(std::binary_search(activeFilters.begin(),activeFilters.end(),namesToFilter[inputFilterNr])){
203  filteredNames.push_back(namesToFilter[inputFilterNr]);
204  }//std::cout<<filteredNames[inputFilterNr]<<std::endl;
205  }
206  */
207  //namesToFilter.swap(activeFilters);
208  filteredNames = activeFilters;
209  namesToFilter.swap(filteredNames);
210 }
void egHLT::trigTools::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 
)

Definition at line 105 of file EgHLTTrigTools.cc.

References alcazmumu_cfi::filter, filters, spr::find(), getMinNrObjsRequiredByFilter(), EgammaValidation_cff::pathName, HLTConfigProvider::saveTagsModules(), HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerName().

Referenced by EgHLTOfflineSummaryClient::beginRun(), EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().

106 {
107 
108  activeFilters.clear();
109  activeEleFilters.clear();
110  activeEle2LegFilters.clear();
111  activePhoFilters.clear();
112  activePho2LegFilters.clear();
113 
114  for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
115  const std::string& pathName = hltConfig.triggerName(pathNr);
116 
117  if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
118  if((pathName.find("Photon")==4 || pathName.find("Ele")==4 || pathName.find("EG")!=pathName.npos
119  || pathName.find("PAPhoton")==4 || pathName.find("PAEle")==4 || pathName.find("PASinglePhoton")==4
120  || pathName.find("HIPhoton")==4 || pathName.find("HIEle")==4 || pathName.find("HISinglePhoton")==4
121  || pathName.find("Activity")==4 || pathName.find("Physics")==4 || pathName.find("DiSC") == 4)
122  && (pathName.find("Jet")==pathName.npos && pathName.find("Muon")==pathName.npos
123  && pathName.find("Tau")==pathName.npos && pathName.find("HT")==pathName.npos
124  && pathName.find("MR")==pathName.npos && pathName.find("LEITI")==pathName.npos
125  && pathName.find("Jpsi")==pathName.npos && pathName.find("Ups")==pathName.npos ) ){//veto x-triggers
126  //std::string lastFilter;
127  const std::vector<std::string>& filters = hltConfig.saveTagsModules(pathNr);
128 
129  //std::cout<<"Number of prescale sets: "<<hltConfig.prescaleSize()<<std::endl;
130  //std::cout<<std::endl<<"Path Name: "<<pathName<<" Prescale: "<<hltConfig.prescaleValue(1,pathName)<<std::endl;
131 
132  if(!filters.empty()){
133  //std::cout<<"Path Name: "<<pathName<<std::endl;
134  //if(filters.back()=="hltBoolEnd" && filters.size()>=2){
135  for(size_t filter=0;filter<filters.size();filter++){
136  //std::cout << filters[filter] << std::endl;
137  if(filters[filter].find("Filter")!=filters[filter].npos){//keep only modules that contain the word "Filter"
138  //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
139  if(//keep only the last filter and the last one with ncandcut==1 (for di-object triggers)
140  (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2)
141  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos)
142  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos)
143  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("PFMT")!=filters[filter+1].npos)
144  || filter==filters.size()-1 ){
145  activeFilters.push_back(filters[filter]); //saves all modules with saveTags=true
146 
147  //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
148  if(pathName.find("Photon")!=pathName.npos || pathName.find("Activity")!=pathName.npos || pathName.find("Physics")!=pathName.npos || pathName.find("DiSC") == 4){
149  activePhoFilters.push_back(filters[filter]);//saves all "Photon" paths into photon set
150  int posPho = pathName.find("Pho")+1;
151  if( pathName.find("Pho",posPho)!=pathName.npos || pathName.find("SC",posPho)!=pathName.npos) {
152  //This saves all "x_Photon_x_Photon_x" and "x_Photon_x_SC_x" path filters into 2leg photon set
153  activePho2LegFilters.push_back(filters[filter]);
154  //std::cout<<"Pho2LegPath: "<<pathName<<std::endl;
155  }
156  }
157  if(pathName.find("Ele")!=pathName.npos || pathName.find("Activity")!=pathName.npos || pathName.find("Physics")!=pathName.npos ){
158  activeEleFilters.push_back(filters[filter]);//saves all "Ele" paths into electron set
159  int posEle = pathName.find("Ele")+1;
160  if( pathName.find("Ele",posEle)!=pathName.npos || pathName.find("SC",posEle)!=pathName.npos ){
161  if(
162  (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2)
163  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos)
164  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("SC")!=filters[filter+1].npos)
165  || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos)
166  ){
167  //This saves all "x_Ele_x_Ele_x" and "x_Ele_x_SC_x" path filters into 2leg electron set
168  activeEle2LegFilters.push_back(filters[filter]+"::"+filters[filter+1]);
169  //std::cout<<"Ele2LegPath: "<<pathName<<std::endl;
170  }
171  }
172  }
173  }
174  }
175  }
176  //std::cout<<filters[filters.size()-2]<<std::endl;
177  //}else activeFilters.push_back(filters.back());
178  }
179  }
180  }//end hlt path check
181  }//end path loop over
182  /*for(size_t i=0;i<activeEle2LegFilters.size();i++){
183  std::cout<<"Leg1: "<<activeEle2LegFilters[i].substr(0,activeEle2LegFilters[i].find("::"))<<std::endl;
184  std::cout<<"Leg2: "<<activeEle2LegFilters[i].substr(activeEle2LegFilters[i].find("::")+2)<<std::endl<<std::endl;
185  }*/
186  std::sort(activeFilters.begin(),activeFilters.end());
187  std::sort(activeEleFilters.begin(),activeEleFilters.end());
188  std::sort(activeEle2LegFilters.begin(),activeEle2LegFilters.end());
189  std::sort(activePhoFilters.begin(),activePhoFilters.end());
190 }
unsigned int size() const
number of trigger paths in trigger table
const std::string & triggerName(unsigned int triggerIndex) const
int getMinNrObjsRequiredByFilter(const std::string &filterName)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
const std::vector< std::string > & saveTagsModules(unsigned int trigger) const
float egHLT::trigTools::getEtThresFromName ( const std::string &  trigName)

Definition at line 294 of file EgHLTTrigTools.cc.

Referenced by egHLT::MonElemFuncs::addTightLooseTrigHist().

295 {
296  size_t etStrPos = trigName.find("Et");
297  while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){
298  etStrPos = trigName.find("Et",etStrPos+1);
299  }
300  if(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){
301  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);
302 
303  std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
304  float etVal;
305  etValStr>> etVal;
306  return etVal;
307 
308  }
309  return 0;
310 
311 }
TrigCodes::TrigBitSet egHLT::trigTools::getFiltersPassed ( const std::vector< std::pair< std::string, int > > &  filters,
const trigger::TriggerEvent trigEvt,
const std::string &  hltTag,
const TrigCodes trigCodes 
)

Definition at line 10 of file EgHLTTrigTools.cc.

References alcaDQMUpload::encode(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), filters, plotBeamSpotDB::first, egHLT::TrigCodes::getCode(), and edm::second().

Referenced by egHLT::OffHelper::setTrigInfo().

15 {
16  TrigCodes::TrigBitSet evtTrigs;
17  for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){
18  size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec].first,"",hltTag).encode());
19  const TrigCodes::TrigBitSet filterCode = trigCodes.getCode(filters[filterNrInVec].first.c_str());
20  if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, however this only means that something passed the previous filter
21  const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt);
22  if(static_cast<int>(trigKeys.size())>=filters[filterNrInVec].second){
23  evtTrigs |=filterCode; //filter was passed
24  }
25  }//end check if filter is present
26  }//end loop over all filters
27 
28 
29  return evtTrigs;
30 
31 }
TrigBitSet getCode(const char *descript) const
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
U second(std::pair< T, U > const &p)
std::vector< size_type > Keys
std::bitset< maxNrBits_ > TrigBitSet
std::string egHLT::trigTools::getL1SeedFilterOfPath ( const HLTConfigProvider hltConfig,
const std::string &  path 
)

Definition at line 280 of file EgHLTTrigTools.cc.

References HLTConfigProvider::moduleLabels(), edm::moduleName(), edmConvertToStreamModule::modules, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by egHLT::OffHelper::setupTriggers().

281 {
282  const std::vector<std::string>& modules = hltConfig.moduleLabels(path);
283 
284  for(size_t moduleNr=0;moduleNr<modules.size();moduleNr++){
285  const std::string& moduleName=modules[moduleNr];
286  if(moduleName.find("hltL1s")==0) return moduleName; //found l1 seed module
287  }
288  std::string dummy;
289  return dummy;
290 
291 }
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
int egHLT::trigTools::getMinNrObjsRequiredByFilter ( const std::string &  filterName)

Definition at line 43 of file EgHLTTrigTools.cc.

References edm::pset::Registry::begin(), edm::pset::Registry::end(), reco_skim_cfg_mod::filterName, edm::pset::Registry::instance(), and NULL.

Referenced by getActiveFilters(), and egHLT::OffHelper::setupTriggers().

44 {
45 
46  //will return out of for loop once its found it to save time
47  const edm::pset::Registry* psetRegistry = edm::pset::Registry::instance();
48  if(psetRegistry==NULL) return -1;
49  for(edm::pset::Registry::const_iterator psetIt=psetRegistry->begin();psetIt!=psetRegistry->end();++psetIt){ //loop over every pset for every module ever run
50  const std::map<std::string,edm::Entry>& mapOfPara = psetIt->second.tbl(); //contains the parameter name and value for all the parameters of the pset
51  const std::map<std::string,edm::Entry>::const_iterator itToModLabel = mapOfPara.find("@module_label");
52  if(itToModLabel!=mapOfPara.end()){
53  if(itToModLabel->second.getString()==filterName){ //moduleName is the filter name, we have found filter, we will now return something
54  std::map<std::string,edm::Entry>::const_iterator itToCandCut = mapOfPara.find("ncandcut");
55  if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
56  else{ //checks if nZcandcut exists and is int32, if not return -1
57  itToCandCut = mapOfPara.find("nZcandcut");
58  if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
59  else{ //checks if MinN exists and is int32, if not return -1
60  itToCandCut = mapOfPara.find("MinN");
61  if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
62  else{ //checks if minN exists and is int32, if not return -1
63  itToCandCut = mapOfPara.find("minN");
64  if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
65  else return -1;
66  }
67  }
68  }
69  }
70  }
71  }
72  return -1;
73 }
map_type::const_iterator const_iterator
Definition: Registry.h:63
const_iterator end() const
Definition: Registry.h:69
#define NULL
Definition: scimark2.h:8
const_iterator begin() const
Definition: Registry.h:65
static Registry * instance()
Definition: Registry.cc:12
float egHLT::trigTools::getSecondEtThresFromName ( const std::string &  trigName)

Definition at line 315 of file EgHLTTrigTools.cc.

316 {//std::cout<<"What the heck is this trigName?:"<<trigName<<std::endl;
317  bool isEle=false,isPhoton=false,isEG=false,isEle2=false,isPhoton2=false,isEG2=false,isSC2=false;
318  size_t etStrPos = trigName.npos;
319  if( trigName.find("Ele")<trigName.find("Photon") && trigName.find("Ele")<trigName.find("EG") ){
320  etStrPos=trigName.find("Ele");isEle=true; }
321  else if( trigName.find("EG")<trigName.find("Photon") && trigName.find("EG")<trigName.find("Ele") ){
322  etStrPos=trigName.find("EG");isEG=true; }
323  else if( trigName.find("Photon")<trigName.find("Ele") && trigName.find("Photon")<trigName.find("EG") ){
324  etStrPos=trigName.find("Photon");isPhoton=true; }
325  //size_t etStrPos = trigName.find("Et");
326  //std::cout<<"Got Original Et spot; etStrPos="<<etStrPos<<std::endl;
327  /*while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){
328  etStrPos = trigName.find("Et",etStrPos+1);//std::cout<<"Got first Et spot; etStrPos="<<etStrPos<<std::endl;
329  }*/
330  if(etStrPos!=trigName.npos
331  && ( trigName.find("Ele",etStrPos+1)!=trigName.npos || trigName.find("EG",etStrPos+1)!=trigName.npos
332  || trigName.find("Photon",etStrPos+1)!=trigName.npos || trigName.find("SC",etStrPos+1)!=trigName.npos)){
333  if(trigName.find("Ele",etStrPos+1)<trigName.find("Photon",etStrPos+1) && trigName.find("Ele",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("Ele",etStrPos+1)<trigName.find("SC",etStrPos+1) ){etStrPos=trigName.find("Ele",etStrPos+1);isEle2=true;}
334  else if(trigName.find("EG",etStrPos+1)<trigName.find("Photon",etStrPos+1) && trigName.find("EG",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("EG",etStrPos+1)<trigName.find("SC",etStrPos+1)){etStrPos=trigName.find("EG",etStrPos+1);isEG2=true;}
335  else if(trigName.find("Photon",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("Photon",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("Photon",etStrPos+1)<trigName.find("SC",etStrPos+1)){etStrPos=trigName.find("Photon",etStrPos+1);isPhoton2=true;}
336  else if(trigName.find("SC",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("SC",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("SC",etStrPos+1)<trigName.find("Photon",etStrPos+1)){etStrPos=trigName.find("Photon",etStrPos+1);isSC2=true;}
337  //std::cout<<"Got second Et spot; etStrPos="<<etStrPos<<std::endl;//}//get second instance. if it dne, keep first
338 
339  if(isEle2){
340  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl;
341  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3);
342 
343  std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
344  float etVal;
345  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
346  return etVal;
347  }
348  }
349  if(isEG2 || isSC2){
350  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl;
351  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);
352 
353  std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
354  float etVal;
355  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
356  return etVal;
357  }
358  }
359 
360  if(isPhoton2){
361  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl;
362  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6);
363 
364  std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
365  float etVal;
366  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
367  return etVal;
368  }
369  }
370  }
371  else if(etStrPos!=trigName.npos){
372  if(isEle){
373  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl;
374  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3);
375 
376  std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
377  float etVal;
378  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
379  return etVal;
380  }
381  }
382  if(isEG){
383  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl;
384  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);
385 
386  std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
387  float etVal;
388  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
389  return etVal;
390  }
391  }
392 
393  if(isPhoton){
394  if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl;
395  size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6);
396 
397  std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
398  float etVal;
399  etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl;
400  return etVal;
401  }
402  }
403  }
404 
405  return 0;
406 
407 }
template<class T >
void egHLT::trigTools::setFiltersObjPasses ( std::vector< T > &  objs,
const std::vector< std::string > &  filters,
const std::vector< std::pair< std::string, std::string > > &  l1PreAndSeedFilters,
const TrigCodes::TrigBitSet &  evtTrigBits,
const TrigCodes &  trigCodes,
const trigger::TriggerEvent trigEvt,
const std::string &  hltTag 
)

Definition at line 47 of file EgHLTTrigTools.h.

References reco::deltaR(), alcaDQMUpload::encode(), eta, trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), plotBeamSpotDB::first, egHLT::TrigCodes::getCode(), trigger::TriggerEvent::getObjects(), phi(), and edm::second().

Referenced by egHLT::OffHelper::setTrigInfo().

52  {
53  std::vector<TrigCodes::TrigBitSet> partTrigBits(particles.size());
54  const double maxDeltaR=0.1;
55  for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){
56  size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec],"",hltTag).encode());
57  const TrigCodes::TrigBitSet filterCode = trigCodes.getCode(filters[filterNrInVec].c_str());
58 
59  if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it
60  const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt); //trigger::Keys is actually a vector<uint16_t> holding the position of trigger objects in the trigger collection passing the filter
61  const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects());
62  for(size_t partNr=0;partNr<particles.size();partNr++){
63  for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){
64  float trigObjEta = trigObjColl[*keyIt].eta();
65  float trigObjPhi = trigObjColl[*keyIt].phi();
66  if (reco::deltaR(particles[partNr].eta(),particles[partNr].phi(),trigObjEta,trigObjPhi) < maxDeltaR){
67  partTrigBits[partNr] |= filterCode;
68  }//end dR<maxDeltaR trig obj match test
69  }//end loop over all objects passing filter
70  }//end loop over particles
71  }//end check if filter is present
72  }//end loop over all filters
73 
74  //okay the first element is the key, the second is the filter that exists in trigger event
75  for(size_t l1FilterNrInVec=0;l1FilterNrInVec<l1PreAndSeedFilters.size();l1FilterNrInVec++){
76  const TrigCodes::TrigBitSet filterCode = trigCodes.getCode(l1PreAndSeedFilters[l1FilterNrInVec].first.c_str());
77  if((filterCode&evtTrigBits)==filterCode){ //check that filter has fired in the event
78 
79  size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(l1PreAndSeedFilters[l1FilterNrInVec].second,"",hltTag).encode());
80 
81  if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it
82  const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt); //trigger::Keys is actually a vector<uint16_t> holding the position of trigger objects in the trigger collection passing the filter
83  const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects());
84  for(size_t partNr=0;partNr<particles.size();partNr++){
85  for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){
86  float trigObjEta = trigObjColl[*keyIt].eta();
87  float trigObjPhi = trigObjColl[*keyIt].phi();
88  if (reco::deltaR(particles[partNr].eta(),particles[partNr].phi(),trigObjEta,trigObjPhi) < maxDeltaR){
89  partTrigBits[partNr] |= filterCode;
90  }//end dR<maxDeltaR trig obj match test
91  }//end loop over all objects passing filter
92  }//end loop over particles
93  }//end check if filter is present
94  }//end check if path has fired in the event
95  }//end loop over all filters
96 
97  for(size_t partNr=0;partNr<particles.size();partNr++) particles[partNr].setTrigBits(partTrigBits[partNr]);
98 
99  }
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
U second(std::pair< T, U > const &p)
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
Geom::Phi< T > phi() const
void egHLT::trigTools::translateFiltersToPathNames ( const HLTConfigProvider hltConfig,
const std::vector< std::string > &  filters,
std::vector< std::string > &  paths 
)

Definition at line 245 of file EgHLTTrigTools.cc.

References HLTConfigProvider::moduleLabels(), EgammaValidation_cff::pathName, HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerName().

Referenced by EgHLTOfflineSummaryClient::beginRun(), and egHLT::OffHelper::setupTriggers().

246 {
247 
248  paths.clear();
249  std::vector<std::pair<std::string,std::string> > filtersAndPaths;
250 
251  for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
252  const std::string& pathName = hltConfig.triggerName(pathNr);
253  if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
254 
255  std::string lastFilter;
256  const std::vector<std::string>& pathFilters = hltConfig.moduleLabels(pathNr);
257  if(!pathFilters.empty()){
258  if(pathFilters.back()=="hltBoolEnd" && pathFilters.size()>=2){
259  //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits
260  filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size()-2],pathName));
261  }else filtersAndPaths.push_back(std::make_pair(pathFilters.back(),pathName));
262  }
263  }//end hlt path check
264  }//end path loop over
265 
266  std::sort(filtersAndPaths.begin(),filtersAndPaths.end(),StringPairCompare());
267 
268  for(size_t filterNr=0;filterNr<filters.size();filterNr++){
269  typedef std::vector<std::pair<std::string,std::string> >::const_iterator VecIt;
270  std::pair<VecIt,VecIt> searchResult = std::equal_range(filtersAndPaths.begin(),filtersAndPaths.end(),filters[filterNr],StringPairCompare());
271  if(searchResult.first!=searchResult.second) paths.push_back(searchResult.first->second);
272  else paths.push_back(filters[filterNr]);//if cant find the path, just write the filter
273  //---Morse-----
274  //std::cout<<filtersAndPaths[filterNr].first<<" "<<filtersAndPaths[filterNr].second<<std::endl;
275  //-------------
276  }
277 
278 }
unsigned int size() const
number of trigger paths in trigger table
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path