|
|
Go to the documentation of this file. 1 #include <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 auto moduleStrip = module.front() !=
'-' ? module : module.substr(1);
422 if (
pset->exists(moduleStrip)) {
423 const auto &modulePSet =
pset->getParameterSet(moduleStrip);
424 if (modulePSet.existsAs<
bool>(
"saveTags",
true) and modulePSet.getParameter<
bool>(
"saveTags")) {
432 std::pair<AllLabelsMap::iterator, bool>
ret =
434 return &(
ret.first->second);
ret
prodAgent to be discontinued
void unpackFilterLabels(const std::vector< std::string > &labels)
unpack filter labels from indices
bool id(trigger::TriggerObjectType triggerObjectType) const
void packP4()
reduce the precision on the 4-vector
bool hasFilterOrCondition(const std::string &name) const
Checks, if a certain HLT filter label or L1 condition name is assigned.
bool checkIfFiltersAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packFilterLabels() and not yet unpacked.
const std::vector< std::string > * allLabels(edm::ParameterSetID const &psetid, const edm::EventBase &event, const edm::TriggerResults &res) const
double pt() const final
transverse momentum
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Log< level::Warning, false > LogWarning
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void addPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted)
Adds a new HLT path or L1 algorithm name.
size_t smallHash() const
returns a short hash which can be used with hashing containers
void packPathNames(const edm::TriggerNames &names)
pack trigger names into indices
std::vector< uint16_t > filterLabelIndices_
bool hasPathOrAlgorithm(const std::string &name, bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Checks, if a certain HLT path or L1 algorithm name is assigned.
TriggerObject triggerObject()
Gets the pat::TriggerObject (parent class)
bool hasLastFilter() const
Check, if the usage indicator vectors have been filled.
const std::string names[nVars_]
def split(sequence, size)
TriggerObjectStandAlone()
Constructors and Destructor.
std::vector< bool > pathL3FilterAccepted_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Single trigger physics object (e.g., an isolated muon)
edm::ParameterSetID psetId_
static const char wildcard_
Constants.
double mass() const final
mass
double eta() const final
momentum pseudorapidity
const_iterator end() const
last daughter const_iterator
std::vector< std::string > pathsOrAlgorithms(bool pathLastFilterAccepted, bool pathL3FilterAccepted) const
Gets all HLT path or L1 algorithm names.
int pdgId() const final
PDG identifier.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const LorentzVector & p4() const final
four-momentum Lorentz vector
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
void unpackPathNames(const edm::TriggerNames &names)
unpack trigger names into indices
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
void setP4(const LorentzVector &p4) final
set 4-momentum
std::vector< std::string > filterLabels_
Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in.
double phi() const final
momentum azimuthal angle
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
void unpackNamesAndLabels(const edm::EventBase &event, const edm::TriggerResults &res)
unpack both filter labels and trigger names
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
unsigned int index
index type
std::vector< bool > pathLastFilterAccepted_
bool hasAnyName(const std::string &name, const std::vector< std::string > &nameVec) const
Private methods.
std::vector< std::string > pathNames_
Vector of names of all HLT paths or L1 algorithms the trigger objects has been used in.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
std::vector< uint16_t > pathIndices_
void setCollection(const std::string &collName)
Methods.
void packFilterLabels(const edm::EventBase &event, const edm::TriggerResults &res)
bool checkIfPathsAreUnpacked(bool throwIfPacked=true) const
Check if trigger names have been packed by calling packPathNames() and not yet unpacked.