37 virtual void beginRun(
Run const&,
EventSetup const&)
override;
62 algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
63 extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
65 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
66 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
69 gtUtil_ =
new L1TGlobalUtil(iConfig, consumesCollector(), *
this, algInputTag_, extInputTag_);
76 desc.
add<
edm::InputTag> (
"AlgInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
77 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
80 desc.
add<
int> (
"MinBx",0);
81 desc.
add<
int> (
"MaxBx",0);
82 desc.
add<
bool> (
"DumpTrigResults",
false);
83 desc.
add<
bool> (
"DumpRecord",
false);
84 desc.
add<
bool> (
"DumpTrigSummary",
true);
85 descriptions.
add(
"L1TGlobalSummary", desc);
89 decisionCount_.clear();
94 gtUtil_->retrieveL1Setup(evSetup);
96 int size = gtUtil_->decisionsInitial().size();
97 decisionCount_ .resize(size);
98 intermCount_ .resize(size);
99 finalCount_ .resize(size);
100 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
101 std::fill(intermCount_.begin(), intermCount_.end(), 0);
102 std::fill(finalCount_.begin(), finalCount_.end(), 0);
108 if(dumpTriggerSummary_) {
110 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
111 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
112 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
116 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() << endl;
117 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() << endl;
118 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() << endl;
120 LogVerbatim(
"L1TGlobalSummary") <<
" Bit Algorithm Name Init PScd Final PS Factor Masked Veto " << endl;
121 LogVerbatim(
"L1TGlobalSummary") <<
"============================================================================================================" << endl;
122 for(
unsigned int i=0;
i<prescales.size();
i++) {
126 int resultInit = decisionCount_[
i];
127 int resultPre = intermCount_[
i];
128 int resultFin = finalCount_[
i];
131 int prescale = (prescales.at(
i)).
second;
132 bool mask = (masks.at(
i)).
second;
135 if(name !=
"NULL")
LogVerbatim(
"L1TGlobalSummary") <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) << name.c_str() <<
" " << setw(7) << resultInit << setw(7) << resultPre << setw(7) << resultFin << setw(10) << prescale << setw(11) << mask << setw(9) << veto << endl;
137 LogVerbatim(
"L1TGlobalSummary") <<
" Final OR Count = " << finalOrCount <<endl;
138 LogVerbatim(
"L1TGlobalSummary") <<
"===========================================================================================================" << endl;
152 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
154 if(dumpTriggerResults_ || dumpTriggerSummary_) {
157 gtUtil_->retrieveL1(iEvent,evSetup,algToken_);
159 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
162 const std::vector<std::pair<std::string, bool> > initialDecisions = gtUtil_->decisionsInitial();
163 const std::vector<std::pair<std::string, bool> > intermDecisions = gtUtil_->decisionsInterm();
164 const std::vector<std::pair<std::string, bool> > finalDecisions = gtUtil_->decisionsFinal();
165 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
166 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
167 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
169 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size())
170 ||(intermCount_.size() != gtUtil_->decisionsInterm().size())
171 ||(finalCount_.size() != gtUtil_->decisionsFinal().size())){
172 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
176 if(dumpTriggerResults_){
177 cout <<
" Bit Algorithm Name Init aBXM Final PS Factor Masked Veto " << endl;
178 cout <<
"============================================================================================================" << endl;
180 for(
unsigned int i=0;
i<initialDecisions.size();
i++) {
184 if(name ==
"NULL")
continue;
186 bool resultInit = (initialDecisions.at(
i)).
second;
189 bool resultInterm = (intermDecisions.at(
i)).
second;
190 bool resultFin = (finalDecisions.at(
i)).
second;
193 int prescale = (prescales.at(
i)).
second;
194 bool mask = (masks.at(
i)).
second;
197 if (resultInit) decisionCount_[
i]++;
198 if (resultInterm) intermCount_[
i]++;
199 if (resultFin) finalCount_[
i]++;
203 if(dumpTriggerResults_){
204 cout <<
std::dec << setfill(
' ') <<
" " << setw(5) <<
i <<
" " << setw(40) << name.c_str() <<
" " << setw(7) << resultInit << setw(7) << resultInterm << setw(7) << resultFin << setw(10) << prescale << setw(11) << mask << setw(9) << veto << endl;
207 bool finOR = gtUtil_->getFinalOR();
208 if (finOR) finalOrCount++;
209 if(dumpTriggerResults_){
210 cout <<
" FinalOR = " << finOR <<endl;
211 cout <<
"===========================================================================================================" << endl;
219 cout <<
" ------ ext ----------" << endl;
221 if(i>=ext->getFirstBX() && i<=ext->getLastBX()) {
222 for(std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(i); extBlk != ext->end(i); ++extBlk) {
226 cout <<
"No Ext Conditions stored for this bx " << i << endl;
229 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
233 cout <<
" ------ alg ----------" << endl;
235 if(i>=alg->getFirstBX() && i<=alg->getLastBX()) {
236 for(std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(i); algBlk != alg->end(i); ++algBlk) {
240 cout <<
"No Alg Decisions stored for this bx " << i << endl;
243 LogError(
"L1TGlobalSummary") <<
"No alg Data in this event " << endl;
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual 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)
virtual ~L1TGlobalSummary()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void endRun(Run const &, EventSetup const &) override
constexpr uint32_t masks[]
T first(std::pair< T, U > const &p)
std::vector< int > intermCount_
tuple size
Write out results.
L1TGlobalSummary(const edm::ParameterSet &)
virtual void beginRun(Run const &, EventSetup const &) override