1 #include <oneapi/tbb/concurrent_unordered_map.h> 2 #include <boost/algorithm/string.hpp> 89 std::vector<std::string> namePartsVec;
92 for (std::vector<std::string>::const_iterator iVec = nameVec.begin(); iVec != nameVec.end(); ++iVec) {
98 for (std::vector<std::string>::const_iterator iName = namePartsVec.begin(); iName != namePartsVec.end(); ++iName) {
102 if (iName->length() == 0)
110 if (
index == std::string::npos || (iName == namePartsVec.begin() &&
index > 0)) {
115 index += iName->length();
130 bool pathLastFilterAccepted,
131 bool pathL3FilterAccepted) {
142 }
else if (pathLastFilterAccepted || pathL3FilterAccepted) {
160 bool pathL3FilterAccepted)
const {
165 pathLastFilterAccepted =
false;
167 pathL3FilterAccepted =
false;
169 if (!pathLastFilterAccepted && !pathL3FilterAccepted)
172 std::vector<std::string>
paths;
174 for (
unsigned iPath = 0; iPath <
pathNames_.size(); ++iPath) {
196 bool pathLastFilterAccepted,
197 bool pathL3FilterAccepted)
const {
205 pathLastFilterAccepted =
false;
207 pathL3FilterAccepted =
false;
213 if (!pathLastFilterAccepted && !pathL3FilterAccepted)
218 return (foundLastFilter && foundL3Filter);
246 if (collTag.
process().empty()) {
262 if (!unpacked && throwIfPacked)
264 "This TriggerObjectStandAlone object has packed trigger path names. Before accessing path " 265 "names you must call unpackPathNames with an edm::TriggerNames object. You can get the latter " 266 "from the edm::Event or fwlite::Event and the TriggerResults\n");
271 if (!unpacked && throwIfPacked)
273 "This TriggerObjectStandAlone object has packed trigger filter labels. Before accessing path " 274 "names you must call unpackFilterLabels with an edm::EventBase object. Both the edm::Event or " 275 "fwlite::Event are derived from edm::EventBase and can be passed\n");
282 throw cms::Exception(
"RuntimeError",
"Error, trying to pack a partially packed TriggerObjectStandAlone");
290 for (
unsigned int i = 0;
i <
n; ++
i) {
293 static std::atomic<int> _warn(0);
296 <<
"Warning: can't resolve '" <<
pathNames_[
i] <<
"' to a path index" << std::endl;
312 throw cms::Exception(
"RuntimeError",
"Error, trying to unpack a partially unpacked TriggerObjectStandAlone");
318 std::vector<std::string>
paths(
n);
319 for (
unsigned int i = 0;
i <
n; ++
i) {
321 throw cms::Exception(
"RuntimeError",
"Error, path index out of bounds");
331 "Error, trying to pack filter labels for an already packed TriggerObjectStandAlone");
333 std::vector<std::string> unmatched;
337 auto nStart =
names.begin(), nEnd =
names.end();
341 indices.push_back(match - nStart);
343 static std::atomic<int> _warn(0);
346 <<
"Warning: can't resolve '" <<
filterLabels_[
i] <<
"' to a label index. idx: " <<
i << std::endl;
371 throw cms::Exception(
"RuntimeError",
"Error, filter label index out of bounds");
383 MiniFloatConverter::reduceMantissaToNbitsRounding<11>(
eta()),
384 MiniFloatConverter::reduceMantissaToNbits<11>(
phi()),
385 MiniFloatConverter::reduceMantissaToNbitsRounding<8>(
mass())));
392 typedef tbb::concurrent_unordered_map<edm::ParameterSetID, std::vector<std::string>, key_hash> AllLabelsMap;
401 AllLabelsMap::const_iterator iter = allLabelsMap.find(psetid);
402 if (iter != allLabelsMap.end()) {
403 return &iter->second;
409 if (
nullptr != (
pset =
event.parameterSet(psetid))) {
416 for (
unsigned int i = 0;
i !=
n; ++
i) {
421 if (
pset->exists(moduleStrip)) {
422 const auto &modulePSet =
pset->getParameterSet(moduleStrip);
423 if (modulePSet.existsAs<
bool>(
"saveTags",
true) and modulePSet.getParameter<
bool>(
"saveTags")) {
431 std::pair<AllLabelsMap::iterator, bool>
ret =
433 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
std::string removeSchedulingTokensFromModuleLabel(std::string iLabel)
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.
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