61 algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
62 extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
64 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
65 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
66 readPrescalesFromFile_ = iConfig.
getParameter<
bool>(
"ReadPrescalesFromFile");
70 if (dumpTriggerResults_ || dumpTriggerSummary_) {
73 gtUtil_ =
new L1TGlobalUtil(iConfig, consumesCollector(), *
this, algInputTag_, extInputTag_, useEventSetupIn);
76 if (readPrescalesFromFile_) {
78 unsigned int preScColumn = iConfig.
getParameter<
int>(
"psColumn");
79 gtUtil_->OverridePrescalesAndMasks(preScaleFileName, preScColumn);
87 ->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
89 ->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
92 desc.
add<
int>(
"MinBx", 0);
93 desc.
add<
int>(
"MaxBx", 0);
94 desc.
add<
bool>(
"DumpTrigResults",
false);
95 desc.
add<
bool>(
"DumpRecord",
false);
96 desc.
add<
bool>(
"DumpTrigSummary",
true);
97 desc.
add<
bool>(
"ReadPrescalesFromFile",
false);
99 ->setComment(
"File should be located in directory: L1Trigger/L1TGlobal/data/Luminosity/startup");
100 desc.
add<
int>(
"psColumn", 0);
101 descriptions.
add(
"L1TGlobalSummary", desc);
105 decisionCount_.clear();
106 intermCount_.clear();
110 gtUtil_->retrieveL1Setup(evSetup);
112 int size = gtUtil_->decisionsInitial().size();
113 decisionCount_.resize(size);
114 intermCount_.resize(size);
115 finalCount_.resize(size);
116 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
117 std::fill(intermCount_.begin(), intermCount_.end(), 0);
118 std::fill(finalCount_.begin(), finalCount_.end(), 0);
122 if (dumpTriggerSummary_) {
124 if (gtUtil_->valid()) {
125 out <<
"================== L1 Trigger Report "
126 "=====================================================================\n";
128 out <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() <<
'\n';
129 out <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() <<
'\n';
130 out <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() <<
'\n';
132 out <<
" Bit Algorithm Name Init PScd Final PS Factor Num Bx "
134 out <<
"========================================================================================================="
136 auto const&
prescales = gtUtil_->prescales();
137 auto const& masks = gtUtil_->masks();
140 int resultInit = decisionCount_[
i];
141 int resultPre = intermCount_[
i];
142 int resultFin = finalCount_[
i];
145 if (
name !=
"NULL") {
147 auto const& mask = masks.at(
i).second;
148 out <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) <<
name <<
" " << setw(7)
149 << resultInit << setw(7) << resultPre << setw(7) << resultFin << setw(10) << prescale << setw(11)
150 << mask.size() <<
'\n';
153 out <<
" Final OR Count = " << finalOrCount <<
'\n';
154 out <<
"========================================================================================================="
157 out <<
"================== No Level-1 Trigger menu "
158 "===============================================================\n";
171 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
173 if (dumpTriggerResults_ || dumpTriggerSummary_) {
175 gtUtil_->retrieveL1(iEvent, evSetup, algToken_);
177 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
180 const std::vector<std::pair<std::string, bool>> initialDecisions = gtUtil_->decisionsInitial();
181 const std::vector<std::pair<std::string, bool>> intermDecisions = gtUtil_->decisionsInterm();
182 const std::vector<std::pair<std::string, bool>> finalDecisions = gtUtil_->decisionsFinal();
183 const std::vector<std::pair<std::string, double>>
prescales = gtUtil_->prescales();
184 const std::vector<std::pair<std::string, std::vector<int>>> masks = gtUtil_->masks();
186 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size()) ||
187 (intermCount_.size() != gtUtil_->decisionsInterm().size()) ||
188 (finalCount_.size() != gtUtil_->decisionsFinal().size())) {
189 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
193 if (dumpTriggerResults_) {
194 cout <<
"\n===================================== Trigger Results for BX=0 "
195 "=============================================\n"
197 cout <<
" Bit Algorithm Name Init aBXM Final PS Factor Num Bx "
200 cout <<
"========================================================================================================"
204 for (
unsigned int i = 0;
i < initialDecisions.size();
i++) {
210 bool resultInit = (initialDecisions.at(
i)).
second;
213 bool resultInterm = (intermDecisions.at(
i)).
second;
214 bool resultFin = (finalDecisions.at(
i)).
second;
217 double prescale = (prescales.at(
i)).
second;
218 std::vector<int> mask = (masks.at(
i)).
second;
229 if (dumpTriggerResults_) {
230 cout <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) << name.c_str() <<
" "
231 << setw(7) << resultInit << setw(7) << resultInterm << setw(7) << resultFin << setw(10) << prescale
232 << setw(11) << mask.size() << endl;
235 bool finOR = gtUtil_->getFinalOR();
238 if (dumpTriggerResults_) {
239 cout <<
" FinalOR = " << finOR << endl;
240 cout <<
"========================================================================================================"
248 for (
int i = minBx_;
i <= maxBx_;
i++) {
250 cout <<
" ------ Bx= " <<
i <<
" ext ----------" << endl;
252 if (
i >= ext->getFirstBX() &&
i <= ext->getLastBX()) {
253 for (std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(
i); extBlk != ext->end(
i); ++extBlk) {
258 cout <<
"No Ext Conditions stored for this bx " <<
i << endl;
261 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
265 cout <<
" ------ Bx= " <<
i <<
" alg ----------" << endl;
267 if (
i >= alg->getFirstBX() &&
i <= alg->getLastBX()) {
268 for (std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(
i); algBlk != alg->end(
i); ++algBlk) {
273 cout <<
"No Alg Decisions stored for this bx " <<
i << endl;
276 LogError(
"L1TGlobalSummary") <<
"No alg Data in this event " << endl;
bool readPrescalesFromFile_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
~L1TGlobalSummary() override
Log< level::Error, false > LogError
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
U second(std::pair< T, U > const &p)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< int > finalCount_
std::vector< int > decisionCount_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void endRun(Run const &, EventSetup const &) override
T first(std::pair< T, U > const &p)
std::vector< int > intermCount_
tuple size
Write out results.
L1TGlobalSummary(const edm::ParameterSet &)
void beginRun(Run const &, EventSetup const &) override