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) |
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 trigger::TriggerEvent *trigEvt, const std::string &hltTag) |
void | translateFiltersToPathNames (const HLTConfigProvider &hltConfig, const std::vector< std::string > &filters, std::vector< std::string > &paths) |
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 102 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().
{ std::vector<TrigCodes::TrigBitSet> partTrigBits(1); const double maxDeltaR=0.1; for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){ size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec],"",hltTag).encode()); //const TrigCodes::TrigBitSet filterCode = TrigCodes::getCode(filters[filterNrInVec].c_str()); if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it 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 const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects()); for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){ float trigObjEta = trigObjColl[*keyIt].eta(); float trigObjPhi = trigObjColl[*keyIt].phi(); float trigObjE = trigObjColl[*keyIt].energy(); if (reco::deltaR(particle.superCluster()->eta(),particle.superCluster()->phi(),trigObjEta,trigObjPhi) < maxDeltaR){ hltData.HLTeta=trigObjEta; hltData.HLTphi=trigObjPhi; hltData.HLTenergy=trigObjE; }//end dR<maxDeltaR trig obj match test }//end loop over all objects passing filter` }//end check if filter is present }//end check if path has fired in the event }//end loop over all filters
void egHLT::trigTools::filterInactiveTightLooseTriggers | ( | std::vector< std::string > & | namesToFilter, |
const std::vector< std::string > & | activeFilters | ||
) |
Definition at line 202 of file EgHLTTrigTools.cc.
References cscdqm::h::names, split, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().
{ //tempory vector to store the filtered results std::vector<std::string> filteredNames; for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){ std::vector<std::string> names; boost::split(names,namesToFilter[inputFilterNr],boost::is_any_of(std::string(":"))); if(names.size()!=2) continue; //format incorrect, reject it if(std::binary_search(activeFilters.begin(),activeFilters.end(),names[0]) && std::binary_search(activeFilters.begin(),activeFilters.end(),names[1])){ //both filters are valid filteredNames.push_back(namesToFilter[inputFilterNr]); } } namesToFilter.swap(filteredNames); }
void egHLT::trigTools::filterInactiveTriggers | ( | std::vector< std::string > & | namesToFilter, |
std::vector< std::string > & | activeFilters | ||
) |
Definition at line 185 of file EgHLTTrigTools.cc.
Referenced by EgHLTOfflineSummaryClient::beginRun(), EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().
{ //tempory vector to store the filtered results std::vector<std::string> filteredNames; /* for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){ if(std::binary_search(activeFilters.begin(),activeFilters.end(),namesToFilter[inputFilterNr])){ filteredNames.push_back(namesToFilter[inputFilterNr]); }//std::cout<<filteredNames[inputFilterNr]<<std::endl; } */ //namesToFilter.swap(activeFilters); filteredNames = activeFilters; namesToFilter.swap(filteredNames); }
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 101 of file EgHLTTrigTools.cc.
References alcazmumu_cfi::filter, filters, spr::find(), getMinNrObjsRequiredByFilter(), EgammaValidation_cff::pathName, HLTConfigProvider::saveTagsModules(), HLTConfigProvider::size(), python::multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerName().
Referenced by EgHLTOfflineSummaryClient::beginRun(), EgHLTOfflineClient::beginRun(), and EgHLTOfflineSource::filterTriggers().
{ activeFilters.clear(); activeEleFilters.clear(); activeEle2LegFilters.clear(); activePhoFilters.clear(); activePho2LegFilters.clear(); for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){ const std::string& pathName = hltConfig.triggerName(pathNr); if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX if((pathName.find("Photon")==4 || pathName.find("Ele")==4 || pathName.find("EG")==4 || pathName.find("Activity")==4 || pathName.find("Physics")==4)// e/g paths, pho or ele always come first && (pathName.find("Jet")==pathName.npos && pathName.find("Muon")==pathName.npos && pathName.find("Tau")==pathName.npos && pathName.find("HT")==pathName.npos && pathName.find("MR")==pathName.npos && pathName.find("LEITI")==pathName.npos && pathName.find("Jpsi")==pathName.npos && pathName.find("Ups")==pathName.npos ) ){//veto x-triggers //std::string lastFilter; const std::vector<std::string>& filters = hltConfig.saveTagsModules(pathNr); //std::cout<<"Number of prescale sets: "<<hltConfig.prescaleSize()<<std::endl; //std::cout<<std::endl<<"Path Name: "<<pathName<<" Prescale: "<<hltConfig.prescaleValue(1,pathName)<<std::endl; if(!filters.empty()){//std::cout<<"Path Name: "<<pathName<<std::endl; //if(filters.back()=="hltBoolEnd" && filters.size()>=2){ for(size_t filter=0;filter<filters.size();filter++){ if(filters[filter].find("Filter")!=filters[filter].npos){//keep only modules that contain the word "Filter" //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl; if(//keep only the last filter and the last one with ncandcut==1 (for di-object triggers) (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("PFMT")!=filters[filter+1].npos) || filter==filters.size()-1 ){ activeFilters.push_back(filters[filter]); //saves all modules with saveTags=true //std::cout<<" Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl; if(pathName.find("Photon")!=pathName.npos || pathName.find("Activity")!=pathName.npos || pathName.find("Physics")!=pathName.npos ){ activePhoFilters.push_back(filters[filter]);//saves all "Photon" paths into photon set int posPho = pathName.find("Pho")+1; if( pathName.find("Pho",posPho)!=pathName.npos || pathName.find("SC",posPho)!=pathName.npos ){ //This saves all "x_Photon_x_Photon_x" and "x_Photon_x_SC_x" path filters into 2leg photon set activePho2LegFilters.push_back(filters[filter]); //std::cout<<"Pho2LegPath: "<<pathName<<std::endl; } } if(pathName.find("Ele")!=pathName.npos || pathName.find("Activity")!=pathName.npos || pathName.find("Physics")!=pathName.npos ){ activeEleFilters.push_back(filters[filter]);//saves all "Ele" paths into electron set int posEle = pathName.find("Ele")+1; if( pathName.find("Ele",posEle)!=pathName.npos || pathName.find("SC",posEle)!=pathName.npos ){ if( (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("SC")!=filters[filter+1].npos) || (filter<filters.size()-1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos) ){ //This saves all "x_Ele_x_Ele_x" and "x_Ele_x_SC_x" path filters into 2leg electron set activeEle2LegFilters.push_back(filters[filter]+"::"+filters[filter+1]); //std::cout<<"Ele2LegPath: "<<pathName<<std::endl; } } } } } } //std::cout<<filters[filters.size()-2]<<std::endl; //}else activeFilters.push_back(filters.back()); } } }//end hlt path check }//end path loop over /*for(size_t i=0;i<activeEle2LegFilters.size();i++){ std::cout<<"Leg1: "<<activeEle2LegFilters[i].substr(0,activeEle2LegFilters[i].find("::"))<<std::endl; std::cout<<"Leg2: "<<activeEle2LegFilters[i].substr(activeEle2LegFilters[i].find("::")+2)<<std::endl<<std::endl; }*/ std::sort(activeFilters.begin(),activeFilters.end()); std::sort(activeEleFilters.begin(),activeEleFilters.end()); std::sort(activeEle2LegFilters.begin(),activeEle2LegFilters.end()); std::sort(activePhoFilters.begin(),activePhoFilters.end()); }
float egHLT::trigTools::getEtThresFromName | ( | const std::string & | trigName | ) |
Definition at line 283 of file EgHLTTrigTools.cc.
Referenced by egHLT::MonElemFuncs::addTightLooseTrigHist().
{ size_t etStrPos = trigName.find("Et"); while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){ etStrPos = trigName.find("Et",etStrPos+1); } if(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){ size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2); std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2)); float etVal; etValStr>> etVal; return etVal; } return 0; }
TrigCodes::TrigBitSet egHLT::trigTools::getFiltersPassed | ( | const std::vector< std::pair< std::string, int > > & | filters, |
const trigger::TriggerEvent * | trigEvt, | ||
const std::string & | hltTag | ||
) |
Definition at line 10 of file EgHLTTrigTools.cc.
References alcaDQMUpload::encode(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), filters, first, egHLT::TrigCodes::getCode(), and edm::second().
Referenced by egHLT::OffHelper::setTrigInfo().
{ TrigCodes::TrigBitSet evtTrigs; for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){ size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec].first,"",hltTag).encode()); const TrigCodes::TrigBitSet filterCode = TrigCodes::getCode(filters[filterNrInVec].first.c_str()); if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, however this only means that something passed the previous filter const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt); if(static_cast<int>(trigKeys.size())>=filters[filterNrInVec].second){ evtTrigs |=filterCode; //filter was passed } }//end check if filter is present }//end loop over all filters return evtTrigs; }
std::string egHLT::trigTools::getL1SeedFilterOfPath | ( | const HLTConfigProvider & | hltConfig, |
const std::string & | path | ||
) |
Definition at line 269 of file EgHLTTrigTools.cc.
References HLTConfigProvider::moduleLabels(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by egHLT::OffHelper::setupTriggers().
{ const std::vector<std::string>& modules = hltConfig.moduleLabels(path); for(size_t moduleNr=0;moduleNr<modules.size();moduleNr++){ const std::string& moduleName=modules[moduleNr]; if(moduleName.find("hltL1s")==0) return moduleName; //found l1 seed module } std::string dummy; return dummy; }
int egHLT::trigTools::getMinNrObjsRequiredByFilter | ( | const std::string & | filterName | ) |
Definition at line 39 of file EgHLTTrigTools.cc.
References edm::detail::ThreadSafeRegistry< KEY, T, E >::begin(), edm::detail::ThreadSafeRegistry< KEY, T, E >::end(), reco_skim_cfg_mod::filterName, instance, and NULL.
Referenced by getActiveFilters(), and egHLT::OffHelper::setupTriggers().
{ //will return out of for loop once its found it to save time const edm::pset::Registry* psetRegistry = edm::pset::Registry::instance(); if(psetRegistry==NULL) return -1; for(edm::pset::Registry::const_iterator psetIt=psetRegistry->begin();psetIt!=psetRegistry->end();++psetIt){ //loop over every pset for every module ever run const std::map<std::string,edm::Entry>& mapOfPara = psetIt->second.tbl(); //contains the parameter name and value for all the parameters of the pset const std::map<std::string,edm::Entry>::const_iterator itToModLabel = mapOfPara.find("@module_label"); if(itToModLabel!=mapOfPara.end()){ if(itToModLabel->second.getString()==filterName){ //moduleName is the filter name, we have found filter, we will now return something std::map<std::string,edm::Entry>::const_iterator itToCandCut = mapOfPara.find("ncandcut"); if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32(); else{ //checks if nZcandcut exists and is int32, if not return -1 itToCandCut = mapOfPara.find("nZcandcut"); if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32(); else{ //checks if MinN exists and is int32, if not return -1 itToCandCut = mapOfPara.find("MinN"); if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32(); else{ //checks if minN exists and is int32, if not return -1 itToCandCut = mapOfPara.find("minN"); if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32(); else return -1; } } } } } } return -1; }
float egHLT::trigTools::getSecondEtThresFromName | ( | const std::string & | trigName | ) |
Definition at line 304 of file EgHLTTrigTools.cc.
{//std::cout<<"What the heck is this trigName?:"<<trigName<<std::endl; bool isEle=false,isPhoton=false,isEG=false,isEle2=false,isPhoton2=false,isEG2=false,isSC2=false; size_t etStrPos = trigName.npos; if( trigName.find("Ele")<trigName.find("Photon") && trigName.find("Ele")<trigName.find("EG") ){ etStrPos=trigName.find("Ele");isEle=true; } else if( trigName.find("EG")<trigName.find("Photon") && trigName.find("EG")<trigName.find("Ele") ){ etStrPos=trigName.find("EG");isEG=true; } else if( trigName.find("Photon")<trigName.find("Ele") && trigName.find("Photon")<trigName.find("EG") ){ etStrPos=trigName.find("Photon");isPhoton=true; } //size_t etStrPos = trigName.find("Et"); //std::cout<<"Got Original Et spot; etStrPos="<<etStrPos<<std::endl; /*while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){ etStrPos = trigName.find("Et",etStrPos+1);//std::cout<<"Got first Et spot; etStrPos="<<etStrPos<<std::endl; }*/ if(etStrPos!=trigName.npos && ( trigName.find("Ele",etStrPos+1)!=trigName.npos || trigName.find("EG",etStrPos+1)!=trigName.npos || trigName.find("Photon",etStrPos+1)!=trigName.npos || trigName.find("SC",etStrPos+1)!=trigName.npos)){ 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;} 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;} 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;} 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;} //std::cout<<"Got second Et spot; etStrPos="<<etStrPos<<std::endl;//}//get second instance. if it dne, keep first if(isEle2){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3); std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } if(isEG2 || isSC2){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2); std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } if(isPhoton2){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6); std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } } else if(etStrPos!=trigName.npos){ if(isEle){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3); std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } if(isEG){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2); std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } if(isPhoton){ if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl; size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6); std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6)); float etVal; etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<" etVal= "<<etVal<<std::endl; return etVal; } } } return 0; }
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 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(), first, egHLT::TrigCodes::getCode(), trigger::TriggerEvent::getObjects(), phi, and edm::second().
Referenced by egHLT::OffHelper::setTrigInfo().
{ std::vector<TrigCodes::TrigBitSet> partTrigBits(particles.size()); const double maxDeltaR=0.1; for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){ size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec],"",hltTag).encode()); const TrigCodes::TrigBitSet filterCode = TrigCodes::getCode(filters[filterNrInVec].c_str()); if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it 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 const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects()); for(size_t partNr=0;partNr<particles.size();partNr++){ for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){ float trigObjEta = trigObjColl[*keyIt].eta(); float trigObjPhi = trigObjColl[*keyIt].phi(); if (reco::deltaR(particles[partNr].eta(),particles[partNr].phi(),trigObjEta,trigObjPhi) < maxDeltaR){ partTrigBits[partNr] |= filterCode; }//end dR<maxDeltaR trig obj match test }//end loop over all objects passing filter }//end loop over particles }//end check if filter is present }//end loop over all filters //okay the first element is the key, the second is the filter that exists in trigger event for(size_t l1FilterNrInVec=0;l1FilterNrInVec<l1PreAndSeedFilters.size();l1FilterNrInVec++){ const TrigCodes::TrigBitSet filterCode = TrigCodes::getCode(l1PreAndSeedFilters[l1FilterNrInVec].first.c_str()); if((filterCode&evtTrigBits)==filterCode){ //check that filter has fired in the event size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(l1PreAndSeedFilters[l1FilterNrInVec].second,"",hltTag).encode()); if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, something passes it 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 const trigger::TriggerObjectCollection & trigObjColl(trigEvt->getObjects()); for(size_t partNr=0;partNr<particles.size();partNr++){ for(trigger::Keys::const_iterator keyIt=trigKeys.begin();keyIt!=trigKeys.end();++keyIt){ float trigObjEta = trigObjColl[*keyIt].eta(); float trigObjPhi = trigObjColl[*keyIt].phi(); if (reco::deltaR(particles[partNr].eta(),particles[partNr].phi(),trigObjEta,trigObjPhi) < maxDeltaR){ partTrigBits[partNr] |= filterCode; }//end dR<maxDeltaR trig obj match test }//end loop over all objects passing filter }//end loop over particles }//end check if filter is present }//end check if path has fired in the event }//end loop over all filters for(size_t partNr=0;partNr<particles.size();partNr++) particles[partNr].setTrigBits(partTrigBits[partNr]); }
void egHLT::trigTools::translateFiltersToPathNames | ( | const HLTConfigProvider & | hltConfig, |
const std::vector< std::string > & | filters, | ||
std::vector< std::string > & | paths | ||
) |
Definition at line 234 of file EgHLTTrigTools.cc.
References HLTConfigProvider::moduleLabels(), EgammaValidation_cff::pathName, HLTConfigProvider::size(), python::multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerName().
Referenced by EgHLTOfflineSummaryClient::beginRun(), and egHLT::OffHelper::setupTriggers().
{ paths.clear(); std::vector<std::pair<std::string,std::string> > filtersAndPaths; for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){ const std::string& pathName = hltConfig.triggerName(pathNr); if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX std::string lastFilter; const std::vector<std::string>& pathFilters = hltConfig.moduleLabels(pathNr); if(!pathFilters.empty()){ if(pathFilters.back()=="hltBoolEnd" && pathFilters.size()>=2){ //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size()-2],pathName)); }else filtersAndPaths.push_back(std::make_pair(pathFilters.back(),pathName)); } }//end hlt path check }//end path loop over std::sort(filtersAndPaths.begin(),filtersAndPaths.end(),StringPairCompare()); for(size_t filterNr=0;filterNr<filters.size();filterNr++){ typedef std::vector<std::pair<std::string,std::string> >::const_iterator VecIt; std::pair<VecIt,VecIt> searchResult = std::equal_range(filtersAndPaths.begin(),filtersAndPaths.end(),filters[filterNr],StringPairCompare()); if(searchResult.first!=searchResult.second) paths.push_back(searchResult.first->second); else paths.push_back(filters[filterNr]);//if cant find the path, just write the filter //---Morse----- //std::cout<<filtersAndPaths[filterNr].first<<" "<<filtersAndPaths[filterNr].second<<std::endl; //------------- } }