1 #include <oneapi/tbb/concurrent_unordered_map.h> 2 #include <boost/algorithm/string.hpp> 88 std::vector<std::string> namePartsVec;
91 for (std::vector<std::string>::const_iterator iVec = nameVec.begin(); iVec != nameVec.end(); ++iVec) {
97 for (std::vector<std::string>::const_iterator iName = namePartsVec.begin(); iName != namePartsVec.end(); ++iName) {
101 if (iName->length() == 0)
109 if (
index == std::string::npos || (iName == namePartsVec.begin() &&
index > 0)) {
114 index += iName->length();
129 bool pathLastFilterAccepted,
130 bool pathL3FilterAccepted) {
141 }
else if (pathLastFilterAccepted || pathL3FilterAccepted) {
159 bool pathL3FilterAccepted)
const {
164 pathLastFilterAccepted =
false;
166 pathL3FilterAccepted =
false;
168 if (!pathLastFilterAccepted && !pathL3FilterAccepted)
171 std::vector<std::string>
paths;
173 for (
unsigned iPath = 0; iPath <
pathNames_.size(); ++iPath) {
195 bool pathLastFilterAccepted,
196 bool pathL3FilterAccepted)
const {
204 pathLastFilterAccepted =
false;
206 pathL3FilterAccepted =
false;
212 if (!pathLastFilterAccepted && !pathL3FilterAccepted)
217 return (foundLastFilter && foundL3Filter);
245 if (collTag.
process().empty()) {
261 if (!unpacked && throwIfPacked)
263 "This TriggerObjectStandAlone object has packed trigger path names. Before accessing path " 264 "names you must call unpackPathNames with an edm::TriggerNames object. You can get the latter " 265 "from the edm::Event or fwlite::Event and the TriggerResults\n");
270 if (!unpacked && throwIfPacked)
272 "This TriggerObjectStandAlone object has packed trigger filter labels. Before accessing path " 273 "names you must call unpackFilterLabels with an edm::EventBase object. Both the edm::Event or " 274 "fwlite::Event are derived from edm::EventBase and can be passed\n");
281 throw cms::Exception(
"RuntimeError",
"Error, trying to pack a partially packed TriggerObjectStandAlone");
289 for (
unsigned int i = 0;
i <
n; ++
i) {
292 static std::atomic<int> _warn(0);
295 <<
"Warning: can't resolve '" <<
pathNames_[
i] <<
"' to a path index" << std::endl;
311 throw cms::Exception(
"RuntimeError",
"Error, trying to unpack a partially unpacked TriggerObjectStandAlone");
317 std::vector<std::string>
paths(
n);
318 for (
unsigned int i = 0;
i <
n; ++
i) {
320 throw cms::Exception(
"RuntimeError",
"Error, path index out of bounds");
330 "Error, trying to pack filter labels for an already packed TriggerObjectStandAlone");
332 std::vector<std::string> unmatched;
336 auto nStart =
names.begin(), nEnd =
names.end();
342 static std::atomic<int> _warn(0);
345 <<
"Warning: can't resolve '" <<
filterLabels_[
i] <<
"' to a label index. idx: " <<
i << std::endl;
370 throw cms::Exception(
"RuntimeError",
"Error, filter label index out of bounds");
382 MiniFloatConverter::reduceMantissaToNbitsRounding<11>(
eta()),
383 MiniFloatConverter::reduceMantissaToNbits<11>(
phi()),
384 MiniFloatConverter::reduceMantissaToNbitsRounding<8>(
mass())));
391 typedef tbb::concurrent_unordered_map<edm::ParameterSetID, std::vector<std::string>, key_hash> AllLabelsMap;
400 AllLabelsMap::const_iterator iter = allLabelsMap.find(psetid);
401 if (iter != allLabelsMap.end()) {
402 return &iter->second;
408 if (
nullptr != (
pset =
event.parameterSet(psetid))) {
415 for (
unsigned int i = 0;
i !=
n; ++
i) {
420 if (
pset->exists(moduleStrip)) {
421 const auto &modulePSet =
pset->getParameterSet(moduleStrip);
422 if (modulePSet.existsAs<
bool>(
"saveTags",
true) and modulePSet.getParameter<
bool>(
"saveTags")) {
430 std::pair<AllLabelsMap::iterator, bool>
ret =
432 return &(
ret.first->second);
void packFilterLabels(const edm::EventBase &event, const edm::TriggerResults &res)
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
std::vector< std::string > const * allLabels(edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
double pt() const final
transverse momentum
void packP4()
reduce the precision on the 4-vector
std::vector< uint16_t > filterLabelIndices_
static const char wildcard_
Constants.
ret
prodAgent to be discontinued
size_t smallHash() const
returns a short hash which can be used with hashing containers
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::string names[nVars_]
const LorentzVector & p4() const final
four-momentum Lorentz vector
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
int pdgId() const final
PDG identifier.
Single trigger physics object (e.g., an isolated muon)
TriggerObject triggerObject()
Gets the pat::TriggerObject (parent class)
void setCollection(const std::string &collName)
Methods.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
TriggerObjectStandAlone()
Constructors and Destructor.
const_iterator end() const
last daughter const_iterator
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.
bool id(trigger::TriggerObjectType triggerObjectType) const
std::vector< bool > pathLastFilterAccepted_
def split(sequence, size)
unsigned int index
index type
void unpackFilterLabels(const std::vector< std::string > &labels)
unpack filter labels from indices
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
void packPathNames(const edm::TriggerNames &names)
pack trigger names into indices
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in...
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in...
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
double mass() const final
mass
edm::ParameterSetID psetId_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Log< level::Warning, false > LogWarning
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
double phi() const final
momentum azimuthal angle
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
std::vector< uint16_t > pathIndices_
void setP4(const LorentzVector &p4) final
set 4-momentum
void unpackNamesAndLabels(const edm::EventBase &event, const edm::TriggerResults &res)
unpack both filter labels and trigger names
std::vector< bool > pathL3FilterAccepted_
double eta() const final
momentum pseudorapidity