62 algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
63 extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
65 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
66 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
67 readPrescalesFromFile_ = iConfig.
getParameter<
bool>(
"ReadPrescalesFromFile");
71 if (dumpTriggerResults_ || dumpTriggerSummary_) {
74 gtUtil_ =
new L1TGlobalUtil(iConfig, consumesCollector(), *
this, algInputTag_, extInputTag_, useEventSetupIn);
77 if (readPrescalesFromFile_) {
79 unsigned int preScColumn = iConfig.
getParameter<
int>(
"psColumn");
80 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", 0);
94 desc.
add<
int>(
"MaxBx", 0);
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);
102 descriptions.
add(
"L1TGlobalSummary", desc);
106 decisionCount_.clear();
107 intermCount_.clear();
111 gtUtil_->retrieveL1Setup(evSetup);
113 int size = gtUtil_->decisionsInitial().size();
114 decisionCount_.resize(
size);
115 intermCount_.resize(
size);
116 finalCount_.resize(
size);
117 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
118 std::fill(intermCount_.begin(), intermCount_.end(), 0);
119 std::fill(finalCount_.begin(), finalCount_.end(), 0);
123 if (dumpTriggerSummary_) {
125 if (gtUtil_->valid()) {
126 out <<
"================== L1 Trigger Report "
127 "=====================================================================\n";
129 out <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() <<
'\n';
130 out <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() <<
'\n';
131 out <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() <<
'\n';
133 out <<
" Bit Algorithm Name Init PScd Final PS Factor Num Bx "
135 out <<
"========================================================================================================="
137 auto const&
prescales = gtUtil_->prescales();
138 auto const& masks = gtUtil_->masks();
141 int resultInit = decisionCount_[
i];
142 int resultPre = intermCount_[
i];
143 int resultFin = finalCount_[
i];
146 if (
name !=
"NULL") {
148 auto const& mask = masks.at(
i).second;
149 out <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) <<
name <<
" " << setw(7)
150 << resultInit << setw(7) << resultPre << setw(7) << resultFin << setw(10) <<
prescale << setw(11)
151 << mask.size() <<
'\n';
154 out <<
" Final OR Count = " << finalOrCount <<
'\n';
155 out <<
"========================================================================================================="
158 out <<
"================== No Level-1 Trigger menu "
159 "===============================================================\n";
167 iEvent.getByToken(algToken_, alg);
172 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
174 if (dumpTriggerResults_ || dumpTriggerSummary_) {
176 gtUtil_->retrieveL1(
iEvent, evSetup, algToken_);
178 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
181 const std::vector<std::pair<std::string, bool>> initialDecisions = gtUtil_->decisionsInitial();
182 const std::vector<std::pair<std::string, bool>> intermDecisions = gtUtil_->decisionsInterm();
183 const std::vector<std::pair<std::string, bool>> finalDecisions = gtUtil_->decisionsFinal();
184 const std::vector<std::pair<std::string, int>>
prescales = gtUtil_->prescales();
185 const std::vector<std::pair<std::string, std::vector<int>>> masks = gtUtil_->masks();
187 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size()) ||
188 (intermCount_.size() != gtUtil_->decisionsInterm().size()) ||
189 (finalCount_.size() != gtUtil_->decisionsFinal().size())) {
190 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
194 if (dumpTriggerResults_) {
195 cout <<
"\n===================================== Trigger Results for BX=0 "
196 "=============================================\n"
198 cout <<
" Bit Algorithm Name Init aBXM Final PS Factor Num Bx "
201 cout <<
"========================================================================================================"
205 for (
unsigned int i = 0;
i < initialDecisions.size();
i++) {
211 bool resultInit = (initialDecisions.at(
i)).
second;
214 bool resultInterm = (intermDecisions.at(
i)).
second;
215 bool resultFin = (finalDecisions.at(
i)).
second;
219 std::vector<int> mask = (masks.at(
i)).
second;
230 if (dumpTriggerResults_) {
231 cout <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) <<
name.c_str() <<
" "
232 << setw(7) << resultInit << setw(7) << resultInterm << setw(7) << resultFin << setw(10) <<
prescale
233 << setw(11) << mask.size() << endl;
236 bool finOR = gtUtil_->getFinalOR();
239 if (dumpTriggerResults_) {
240 cout <<
" FinalOR = " << finOR << endl;
241 cout <<
"========================================================================================================"
249 for (
int i = minBx_;
i <= maxBx_;
i++) {
251 cout <<
" ------ Bx= " <<
i <<
" ext ----------" << endl;
253 if (
i >=
ext->getFirstBX() &&
i <=
ext->getLastBX()) {
254 for (std::vector<GlobalExtBlk>::const_iterator extBlk =
ext->begin(
i); extBlk !=
ext->end(
i); ++extBlk) {
259 cout <<
"No Ext Conditions stored for this bx " <<
i << endl;
262 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
266 cout <<
" ------ Bx= " <<
i <<
" alg ----------" << endl;
268 if (
i >= alg->getFirstBX() &&
i <= alg->getLastBX()) {
269 for (std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(
i); algBlk != alg->end(
i); ++algBlk) {
274 cout <<
"No Alg Decisions stored for this bx " <<
i << endl;
277 LogError(
"L1TGlobalSummary") <<
"No alg Data in this event " << endl;