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);
88 ->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
90 ->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
93 desc.add<
int>(
"MinBx", minBx);
94 desc.add<
int>(
"MaxBx", maxBx);
95 desc.add<
bool>(
"DumpTrigResults",
false);
96 desc.add<
bool>(
"DumpRecord",
false);
97 desc.add<
bool>(
"DumpTrigSummary",
true);
98 desc.add<
bool>(
"ReadPrescalesFromFile",
false);
100 ->setComment(
"File should be located in directory: L1Trigger/L1TGlobal/data/Luminosity/startup");
101 desc.add<
int>(
"psColumn", 0);
113 decisionCount_.clear();
114 intermCount_.clear();
118 gtUtil_->retrieveL1Setup(evSetup);
120 int size = gtUtil_->decisionsInitial().size();
121 decisionCount_.resize(size);
122 intermCount_.resize(size);
123 finalCount_.resize(size);
124 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
125 std::fill(intermCount_.begin(), intermCount_.end(), 0);
126 std::fill(finalCount_.begin(), finalCount_.end(), 0);
130 if (dumpTriggerSummary_) {
132 if (gtUtil_->valid()) {
133 out <<
"================== L1 Trigger Report " 134 "=====================================================================\n";
136 out <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() <<
'\n';
137 out <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() <<
'\n';
138 out <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() <<
'\n';
140 out <<
" Bit Algorithm Name Init PScd Final PS Factor Num Bx " 142 out <<
"=========================================================================================================" 144 auto const&
prescales = gtUtil_->prescales();
145 auto const& masks = gtUtil_->masks();
148 int resultInit = decisionCount_[
i];
149 int resultPre = intermCount_[
i];
150 int resultFin = finalCount_[
i];
153 if (
name !=
"NULL") {
155 auto const&
mask = masks.at(
i).second;
156 out <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) <<
name <<
" " << setw(7)
157 << resultInit << setw(7) << resultPre << setw(7) << resultFin << setw(10) <<
prescale << setw(11)
158 <<
mask.size() <<
'\n';
161 out <<
" Final OR Count = " << finalOrCount <<
'\n';
162 out <<
"=========================================================================================================" 165 out <<
"================== No Level-1 Trigger menu " 166 "===============================================================\n";
174 iEvent.getByToken(algToken_, alg);
179 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
181 if (dumpTriggerResults_ || dumpTriggerSummary_) {
183 gtUtil_->retrieveL1(
iEvent, evSetup, algToken_);
185 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
188 const auto& initialDecisions = gtUtil_->decisionsInitial();
189 const auto& intermDecisions = gtUtil_->decisionsInterm();
190 const auto& finalDecisions = gtUtil_->decisionsFinal();
191 const auto&
prescales = gtUtil_->prescales();
192 const auto& masks = gtUtil_->masks();
194 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size()) ||
195 (intermCount_.size() != gtUtil_->decisionsInterm().size()) ||
196 (finalCount_.size() != gtUtil_->decisionsFinal().size())) {
197 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
201 if (dumpTriggerResults_) {
202 cout <<
"\n===================================== Trigger Results for BX=0 " 203 "=============================================\n" 205 cout <<
" Bit Algorithm Name Init aBXM Final PS Factor Num Bx " 208 cout <<
"========================================================================================================" 212 for (
unsigned int i = 0;
i < initialDecisions.size();
i++) {
218 bool resultInit = (initialDecisions.at(
i)).
second;
221 bool resultInterm = (intermDecisions.at(
i)).
second;
222 bool resultFin = (finalDecisions.at(
i)).
second;
237 if (dumpTriggerResults_) {
238 cout <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) <<
name.c_str() <<
" " 239 << setw(7) << resultInit << setw(7) << resultInterm << setw(7) << resultFin << setw(10) <<
prescale 240 << setw(11) <<
mask.size() << endl;
243 bool finOR = gtUtil_->getFinalOR();
246 if (dumpTriggerResults_) {
247 cout <<
" FinalOR = " << finOR << endl;
248 cout <<
"========================================================================================================" 256 for (
int i = minBx_;
i <= maxBx_;
i++) {
258 cout <<
" ------ Bx= " <<
i <<
" ext ----------" << endl;
260 if (
i >=
ext->getFirstBX() &&
i <=
ext->getLastBX()) {
261 for (std::vector<GlobalExtBlk>::const_iterator extBlk =
ext->begin(
i); extBlk !=
ext->end(
i); ++extBlk) {
266 cout <<
"No Ext Conditions stored for this bx " <<
i << endl;
269 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
273 cout <<
" ------ Bx= " <<
i <<
" alg ----------" << endl;
275 if (
i >= alg->getFirstBX() &&
i <= alg->getLastBX()) {
276 for (std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(
i); algBlk != alg->end(
i); ++algBlk) {
281 cout <<
"No Alg Decisions stored for this bx " <<
i << endl;
284 LogError(
"L1TGlobalSummary") <<
"No alg Data in this event " << endl;
T getParameter(std::string const &) const
bool readPrescalesFromFile_
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)
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< int > finalCount_
std::vector< int > decisionCount_
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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_
L1TGlobalSummary(const edm::ParameterSet &)
void beginRun(Run const &, EventSetup const &) override