5 #include <boost/algorithm/string.hpp> 20 if (static_cast<int>(trigKeys.size()) >=
filter.second) {
21 evtTrigs |= filterCode;
37 std::vector<int> retVal(filterNames.size(), -2);
44 std::vector<std::string> filterEntryStrings;
45 filterEntryStrings.reserve(filterNames.size());
48 filterEntryStrings.push_back(filterEntry.
toString());
53 if (psetRegistry ==
nullptr) {
54 retVal = std::vector<int>(filterNames.size(), -1);
57 for (
auto& psetIt : *psetRegistry) {
58 const auto& mapOfPara =
60 const auto itToModLabel = mapOfPara.find(mag0);
61 if (itToModLabel != mapOfPara.end()) {
62 std::string itString = itToModLabel->second.toString();
64 for (
unsigned int i = 0;
i < filterNames.size();
i++) {
69 filterEntryStrings[
i]) {
70 auto itToCandCut = mapOfPara.find(mag1);
71 if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() ==
'I')
72 retVal[
i] = itToCandCut->second.getInt32();
74 itToCandCut = mapOfPara.find(
mag2);
75 if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() ==
'I')
76 retVal[
i] = itToCandCut->second.getInt32();
78 itToCandCut = mapOfPara.find(mag3);
79 if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() ==
'I')
80 retVal[
i] = itToCandCut->second.getInt32();
82 itToCandCut = mapOfPara.find(mag4);
83 if (itToCandCut != mapOfPara.end() && itToCandCut->second.typeCode() ==
'I')
84 retVal[
i] = itToCandCut->second.getInt32();
94 for (
unsigned int i = 0;
i < filterNames.size();
i++)
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();
141 for (
size_t pathNr = 0; pathNr <
hltConfig.size(); pathNr++) {
154 const std::vector<std::string>&
filters =
hltConfig.saveTagsModules(pathNr);
169 int minNRFF = minNRFFCache[
filter];
172 minNRFFP1 = minNRFFCache[
filter + 1];
174 (minNRFF == 1 && minNRFFP1 == 2) ||
185 int posPho =
pathName.find(
"Pho") + 1;
195 int posEle =
pathName.find(
"Ele") + 1;
197 if ((minNRFF == 1 && minNRFFP1 == 2) ||
198 (minNRFF == 1 && minNRFFP1 == 1 &&
200 (minNRFF == 1 && minNRFFP1 == 1 &&
202 (minNRFF == 1 && minNRFFP1 == 1 &&
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());
234 std::vector<std::string>& activeFilters) {
236 std::vector<std::string> filteredNames;
245 filteredNames = activeFilters;
246 namesToFilter.swap(filteredNames);
251 const std::vector<std::string>& activeFilters) {
253 std::vector<std::string> filteredNames;
255 for (
auto& inputFilterNr : namesToFilter) {
256 std::vector<std::string>
names;
258 if (
names.size() != 2)
262 filteredNames.push_back(inputFilterNr);
266 namesToFilter.swap(filteredNames);
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);
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);
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);
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 {
294 const std::vector<std::string>&
filters,
295 std::vector<std::string>&
paths) {
297 std::vector<std::pair<std::string, std::string> > filtersAndPaths;
299 for (
size_t pathNr = 0; pathNr <
hltConfig.size(); pathNr++) {
304 const std::vector<std::string>& pathFilters =
hltConfig.moduleLabels(pathNr);
305 if (!pathFilters.empty()) {
306 if (pathFilters.back() ==
"hltBoolEnd" && pathFilters.size() >= 2) {
308 filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size() - 2],
pathName));
310 filtersAndPaths.push_back(std::make_pair(pathFilters.back(),
pathName));
318 typedef std::vector<std::pair<std::string, std::string> >::const_iterator VecIt;
319 std::pair<VecIt, VecIt> searchResult =
321 if (searchResult.first != searchResult.second)
322 paths.push_back(searchResult.first->second);
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);
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);
351 std::istringstream etValStr(
trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
363 bool isEle =
false, isPhoton =
false, isEG =
false, isEle2 =
false, isPhoton2 =
false, isEG2 =
false, isSC2 =
false;
383 if (
trigName.find(
"Ele", etStrPos + 1) <
trigName.find(
"Photon", etStrPos + 1) &&
386 etStrPos =
trigName.find(
"Ele", etStrPos + 1);
388 }
else if (
trigName.find(
"EG", etStrPos + 1) <
trigName.find(
"Photon", etStrPos + 1) &&
391 etStrPos =
trigName.find(
"EG", etStrPos + 1);
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);
398 }
else if (
trigName.find(
"SC", etStrPos + 1) <
trigName.find(
"EG", etStrPos + 1) &&
400 trigName.find(
"SC", etStrPos + 1) <
trigName.find(
"Photon", etStrPos + 1)) {
401 etStrPos =
trigName.find(
"Photon", etStrPos + 1);
408 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 3) {
409 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 3);
411 std::istringstream etValStr(
trigName.substr(etStrPos + 3, endOfEtValStr - etStrPos - 3));
417 if (isEG2 || isSC2) {
419 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 2) {
420 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 2);
422 std::istringstream etValStr(
trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
431 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 6) {
432 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 6);
434 std::istringstream etValStr(
trigName.substr(etStrPos + 6, endOfEtValStr - etStrPos - 6));
440 }
else if (etStrPos !=
trigName.npos) {
443 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 3) {
444 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 3);
446 std::istringstream etValStr(
trigName.substr(etStrPos + 3, endOfEtValStr - etStrPos - 3));
454 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 2) {
455 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 2);
457 std::istringstream etValStr(
trigName.substr(etStrPos + 2, endOfEtValStr - etStrPos - 2));
466 trigName.find_first_of(
"1234567890", etStrPos) == etStrPos + 6) {
467 size_t endOfEtValStr =
trigName.find_first_not_of(
"1234567890", etStrPos + 6);
469 std::istringstream etValStr(
trigName.substr(etStrPos + 6, endOfEtValStr - etStrPos - 6));
const Keys & filterKeys(trigger::size_type index) const
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)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< TPRegexp > filters
const std::string names[nVars_]
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE int binary_search(const unsigned int *data, unsigned int search_val, unsigned int ndata)
std::string toString() const
def split(sequence, size)
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
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
std::vector< size_type > Keys
TrigBitSet getCode(const char *descript) const
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
static Registry * instance()