9 #include <boost/format.hpp> 11 template <
class T, std::
size_t N>
13 assert(
N == values.size());
15 std::copy(values.begin(), values.end(), ret.begin());
21 return container.empty();
24 bool empty(
const char * container) {
25 return container !=
nullptr;
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 ?
156 m_l1tPrescaleColumn( m_mode ==
Mode::ApplyColumnValues
or m_mode ==
Mode::ApplyColumnRatios ?
157 config.getParameter<uint32_t>(
"l1tPrescaleColumn") : 0 ),
178 produces<GlobalAlgBlkBxCollection>();
203 if (index >= (
int) prescaleTable.size())
205 auto const & prescales = prescaleTable[
index];
208 if (prescales[i] == 0)
249 if (index >= (
int) prescaleTable.size())
253 auto const & prescales = prescaleTable[
index];
257 if (prescales[i] == 0)
262 m_prescales[
i] = targets[
i] < prescales[
i] ? 1. : (double) targets[i] / prescales[i];
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)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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)
def setup(process, global_tag, zero_tesla=False)
std::array< unsigned int, GlobalAlgBlk::maxPhysicsTriggers > m_counters
bool isEmpty(int bx) const
BXVector< GlobalAlgBlk > GlobalAlgBlkBxCollection
const bool getFinalORVeto() const
static const unsigned int maxPhysicsTriggers
std::array< T, N > make_array(std::vector< T > const &values)
Entry(const ALIstring &type)
virtual bool filter(edm::Event &event, edm::EventSetup const &setup) override
const int getPreScColumn() const
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
bool empty(T const &container)
format
Some error handling for the usage.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setFinalOR(bool fOR)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
std::vector< std::vector< int > > prescale_table_
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
const T & at(int bx, unsigned i) const