9 #include <boost/format.hpp>
11 template <
class T, std::
size_t N>
15 std::copy(values.begin(), values.end(), ret.begin());
21 return container.empty();
24 bool empty(
const char * container) {
25 return container !=
nullptr;
29 using namespace std::literals;
40 template <
typename S,
typename T,
unsigned int N>
41 std::string build_comment_from_entries(
S pre,
const Entry<T> (&entries)[
N]) {
44 for (
auto entry: entries)
47 for (
auto entry: entries)
53 for (
unsigned int i = 0;
i < length-std::strlen(
entry.tag); ++
i)
comment +=
' ';
59 template <
typename S1,
typename S2,
typename T,
unsigned int N>
60 std::string build_comment_from_entries(S1 pre,
const Entry<T> (&entries)[N], S2 post) {
69 #if __cplusplus > 201400
73 T get_enum_value(Entry<T>
const * entries,
const char *
tag) {
74 for (; entries->tag; ++entries)
75 if (std::strcmp(entries->tag, tag) == 0)
76 return entries->value;
77 throw std::logic_error(
"invalid tag "s + tag);
81 #if __cplusplus > 201400
85 T get_enum_value(Entry<T>
const * entries,
const char * tag,
T default_value) {
86 for (; entries->tag; ++entries)
87 if (std::strcmp(entries->tag, tag) == 0)
88 return entries->value;
129 { Mode::ApplyPrescaleValues,
"applyPrescaleValues",
"apply the given prescale values" },
130 { Mode::ApplyPrescaleRatios,
"applyPrescaleRatios",
"apply prescales equal to ratio between the given values and the ones read from the EventSetup" },
131 { Mode::ApplyColumnValues,
"applyColumnValues",
"apply the prescale values from the EventSetup corresponding to the given column index" },
132 { Mode::ApplyColumnRatios,
"applyColumnRatios",
"apply prescales equal to ratio between the values corresponsing to the given column index, and the ones read from the EventSetup" },
140 std::array<unsigned int, GlobalAlgBlk::maxPhysicsTriggers>
m_counters;
151 m_mode( get_enum_value(s_modes, config.getParameter<std::
string>(
"mode").c_str(),
Mode::
Invalid) ),
153 m_l1tPrescales( m_mode ==
Mode::ApplyPrescaleValues
or m_mode ==
Mode::ApplyPrescaleRatios ?
154 make_array<double,
GlobalAlgBlk::maxPhysicsTriggers>(config.getParameter<std::vector<double>>(
"l1tPrescales")) :
156 m_l1tPrescaleColumn( m_mode ==
Mode::ApplyColumnValues
or m_mode ==
Mode::ApplyColumnRatios ?
157 config.getParameter<uint32_t>(
"l1tPrescaleColumn") : 0 ),
178 produces<GlobalAlgBlkBxCollection>();
187 if (handle->isEmpty(0)) {
194 int index = handle->at(0,0).getPreScColumn();
274 bool finalOr =
false;
304 result->push_back(0, algoBlock);
314 l1tResults.
setComment(
"Collection with the original uGT results");
318 mode.
setComment(build_comment_from_entries(
"Define how to apply the prescale values:",
s_modes));
322 l1tPrescales.
setComment(
"Target prescale values (for modes \"applyPrescaleValues\" or \"applyPrescaleRatios\")");
326 l1tPrescaleColumn.
setComment(
"Target prescale column (for modes \"applyColumnValues\" or \"applyColumnRatios\")");
334 "applyPrescaleValues" >> l1tPrescales
or
335 "applyPrescaleRatios" >> l1tPrescales
or
337 "applyColumnValues" >> l1tPrescaleColumn
or
338 "applyColumnRatios" >> l1tPrescaleColumn );
339 descriptions.
add(
"l1tGlobalPrescaler", desc);
346 desc.
add<
std::string>(
"mode",
"applyColumnRatios")->setComment(
"apply prescales equal to ratio between the values corresponsing to the given column index, and the ones read from the EventSetup");
347 desc.
addNode(l1tPrescaleColumn);
348 descriptions.
add(
"l1tGlobalPrescalerTargetColumn", desc);
T getParameter(std::string const &) const
void setComment(std::string const &value)
tuple ret
prodAgent to be discontinued
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void setFinalORPreVeto(bool fOR)
std::vector< bool > const & getAlgoDecisionFinal() const
#define DEFINE_FWK_MODULE(type)
const std::array< double, GlobalAlgBlk::maxPhysicsTriggers > m_l1tPrescales
std::array< double, GlobalAlgBlk::maxPhysicsTriggers > m_prescales
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::array< unsigned int, GlobalAlgBlk::maxPhysicsTriggers > m_counters
BXVector< GlobalAlgBlk > GlobalAlgBlkBxCollection
string format
Some error handling for the usage.
const bool getFinalORVeto() const
static const unsigned int maxPhysicsTriggers
Entry(const ALIstring &type)
virtual bool filter(edm::Event &event, edm::EventSetup const &setup) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void setFinalOR(bool fOR)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::auto_ptr< ParameterDescriptionCases< T > > cases)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double S(const TLorentzVector &, const TLorentzVector &)
void setPreScColumn(int psC)
static const Entry< Mode > s_modes[]
void setAlgoDecisionFinal(unsigned int bit, bool val)
L1TGlobalPrescaler(edm::ParameterSet const &config)
const int m_l1tPrescaleColumn
std::array< T, N > make_array(std::vector< T > const &values)