7 #include <boost/algorithm/string.hpp>
13 for(
size_t filterNrInVec=0;filterNrInVec<
filters.size();filterNrInVec++){
16 if(filterNrInEvt<trigEvt->sizeFilters()){
18 if(static_cast<int>(trigKeys.size())>=
filters[filterNrInVec].
second){
19 evtTrigs |=filterCode;
44 if(psetRegistry==
NULL)
return -1;
46 const std::map<std::string,edm::Entry>& mapOfPara = psetIt->second.tbl();
47 const std::map<std::string,edm::Entry>::const_iterator itToModLabel = mapOfPara.find(
"@module_label");
48 if(itToModLabel!=mapOfPara.end()){
49 if(itToModLabel->second.getString()==
filterName){
50 std::map<std::string,edm::Entry>::const_iterator itToCandCut = mapOfPara.find(
"ncandcut");
51 if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()==
'I')
return itToCandCut->second.getInt32();
53 itToCandCut = mapOfPara.find(
"nZcandcut");
54 if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()==
'I')
return itToCandCut->second.getInt32();
56 itToCandCut = mapOfPara.find(
"MinN");
57 if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()==
'I')
return itToCandCut->second.getInt32();
59 itToCandCut = mapOfPara.find(
"minN");
60 if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()==
'I')
return itToCandCut->second.getInt32();
101 void 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)
104 activeFilters.clear();
105 activeEleFilters.clear();
106 activeEle2LegFilters.clear();
107 activePhoFilters.clear();
108 activePho2LegFilters.clear();
110 for(
size_t pathNr=0;pathNr<hltConfig.
size();pathNr++){
112 if(pathName.find(
"HLT_")==0){
113 if((pathName.find(
"Photon")==4 || pathName.find(
"Ele")==4 || pathName.find(
"EG")==4 || pathName.find(
"Activity")==4 || pathName.find(
"Physics")==4)
114 && (pathName.find(
"Jet")==pathName.npos && pathName.find(
"Muon")==pathName.npos
115 && pathName.find(
"Tau")==pathName.npos && pathName.find(
"HT")==pathName.npos
116 && pathName.find(
"MR")==pathName.npos && pathName.find(
"LEITI")==pathName.npos
117 && pathName.find(
"Jpsi")==pathName.npos && pathName.find(
"Ups")==pathName.npos ) ){
124 if(!filters.empty()){
134 || filter==filters.size()-1 ){
135 activeFilters.push_back(filters[filter]);
137 if(pathName.find(
"Photon")!=pathName.npos || pathName.find(
"Activity")!=pathName.npos || pathName.find(
"Physics")!=pathName.npos ){
138 activePhoFilters.push_back(filters[filter]);
139 int posPho = pathName.find(
"Pho")+1;
140 if( pathName.find(
"Pho",posPho)!=pathName.npos || pathName.find(
"SC",posPho)!=pathName.npos ){
142 activePho2LegFilters.push_back(filters[filter]);
146 if(pathName.find(
"Ele")!=pathName.npos || pathName.find(
"Activity")!=pathName.npos || pathName.find(
"Physics")!=pathName.npos ){
147 activeEleFilters.push_back(filters[filter]);
148 int posEle = pathName.find(
"Ele")+1;
149 if( pathName.find(
"Ele",posEle)!=pathName.npos || pathName.find(
"SC",posEle)!=pathName.npos ){
157 activeEle2LegFilters.push_back(filters[filter]+
"::"+filters[filter+1]);
175 std::sort(activeFilters.begin(),activeFilters.end());
176 std::sort(activeEleFilters.begin(),activeEleFilters.end());
177 std::sort(activeEle2LegFilters.begin(),activeEle2LegFilters.end());
178 std::sort(activePhoFilters.begin(),activePhoFilters.end());
188 std::vector<std::string> filteredNames;
197 filteredNames = activeFilters;
198 namesToFilter.swap(filteredNames);
205 std::vector<std::string> filteredNames;
207 for(
size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
208 std::vector<std::string>
names;
210 if(names.size()!=2)
continue;
211 if(std::binary_search(activeFilters.begin(),activeFilters.end(),names[0]) &&
212 std::binary_search(activeFilters.begin(),activeFilters.end(),names[1])){
213 filteredNames.push_back(namesToFilter[inputFilterNr]);
217 namesToFilter.swap(filteredNames);
224 bool operator()(
const std::pair<std::string,std::string>&lhs,
225 const std::pair<std::string,std::string>& rhs)
const{
return keyLess(lhs.first,rhs.first);}
226 bool operator()(
const std::pair<std::string,std::string>&lhs,
227 const std::pair<std::string,std::string>::first_type& rhs)
const{
return keyLess(lhs.first,rhs);}
228 bool operator()(
const std::pair<std::string,std::string>::first_type &lhs,
229 const std::pair<std::string,std::string>& rhs)
const{
return keyLess(lhs,rhs.first);}
231 bool keyLess(
const std::pair<std::string,std::string>::first_type& k1,
const std::pair<std::string,std::string>::first_type& k2)
const{
return k1<k2;}
238 std::vector<std::pair<std::string,std::string> > filtersAndPaths;
240 for(
size_t pathNr=0;pathNr<hltConfig.
size();pathNr++){
242 if(pathName.find(
"HLT_")==0){
245 const std::vector<std::string>& pathFilters = hltConfig.
moduleLabels(pathNr);
246 if(!pathFilters.empty()){
247 if(pathFilters.back()==
"hltBoolEnd" && pathFilters.size()>=2){
249 filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size()-2],
pathName));
250 }
else filtersAndPaths.push_back(std::make_pair(pathFilters.back(),
pathName));
257 for(
size_t filterNr=0;filterNr<filters.size();filterNr++){
258 typedef std::vector<std::pair<std::string,std::string> >::const_iterator VecIt;
259 std::pair<VecIt,VecIt> searchResult = std::equal_range(filtersAndPaths.begin(),filtersAndPaths.end(),filters[filterNr],
StringPairCompare());
260 if(searchResult.first!=searchResult.second) paths.push_back(searchResult.first->second);
261 else paths.push_back(filters[filterNr]);
271 const std::vector<std::string>& modules = hltConfig.
moduleLabels(path);
273 for(
size_t moduleNr=0;moduleNr<modules.size();moduleNr++){
275 if(moduleName.find(
"hltL1s")==0)
return moduleName;
285 size_t etStrPos = trigName.find(
"Et");
286 while(etStrPos!=std::string::npos && trigName.find_first_of(
"1234567890",etStrPos)!=etStrPos+2){
287 etStrPos = trigName.find(
"Et",etStrPos+1);
289 if(etStrPos!=std::string::npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+2){
290 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+2);
292 std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
306 bool isEle=
false,isPhoton=
false,isEG=
false,isEle2=
false,isPhoton2=
false,isEG2=
false,isSC2=
false;
307 size_t etStrPos = trigName.npos;
308 if( trigName.find(
"Ele")<trigName.find(
"Photon") && trigName.find(
"Ele")<trigName.find(
"EG") ){
309 etStrPos=trigName.find(
"Ele");isEle=
true; }
310 else if( trigName.find(
"EG")<trigName.find(
"Photon") && trigName.find(
"EG")<trigName.find(
"Ele") ){
311 etStrPos=trigName.find(
"EG");isEG=
true; }
312 else if( trigName.find(
"Photon")<trigName.find(
"Ele") && trigName.find(
"Photon")<trigName.find(
"EG") ){
313 etStrPos=trigName.find(
"Photon");isPhoton=
true; }
319 if(etStrPos!=trigName.npos
320 && ( trigName.find(
"Ele",etStrPos+1)!=trigName.npos || trigName.find(
"EG",etStrPos+1)!=trigName.npos
321 || trigName.find(
"Photon",etStrPos+1)!=trigName.npos || trigName.find(
"SC",etStrPos+1)!=trigName.npos)){
322 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;}
323 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;}
324 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;}
325 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;}
329 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+3){
330 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+3);
332 std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
339 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+2){
340 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+2);
342 std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
350 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+6){
351 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+6);
353 std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
360 else if(etStrPos!=trigName.npos){
362 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+3){
363 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+3);
365 std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
372 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+2){
373 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+2);
375 std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
383 if(etStrPos!=trigName.npos && trigName.find_first_of(
"1234567890",etStrPos)==etStrPos+6){
384 size_t endOfEtValStr = trigName.find_first_not_of(
"1234567890",etStrPos+6);
386 std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
unsigned int size() const
number of trigger paths in trigger table
map_type::const_iterator const_iterator
The single EDProduct to be saved for each event (AOD case)
const std::string & triggerName(unsigned int triggerIndex) const
static const HistoName names[]
const_iterator end() const
static TrigBitSet getCode(const std::string &descript)
const Keys & filterKeys(trigger::size_type index) const
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool operator()(const std::pair< std::string, std::string >::first_type &lhs, const std::pair< std::string, std::string > &rhs) const
std::vector< TPRegexp > filters
const std::vector< std::string > & saveTagsModules(unsigned int trigger) const
U second(std::pair< T, U > const &p)
bool keyLess(const std::pair< std::string, std::string >::first_type &k1, const std::pair< std::string, std::string >::first_type &k2) const
std::string moduleName(Provenance const &provenance)
bool operator()(const std::pair< std::string, std::string > &lhs, const std::pair< std::string, std::string > &rhs) const
const_iterator begin() const
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< size_type > Keys
bool operator()(const std::pair< std::string, std::string > &lhs, const std::pair< std::string, std::string >::first_type &rhs) const
static Registry * instance()
std::bitset< maxNrBits_ > TrigBitSet