37 virtual void beginRun(
Run const&,
EventSetup const&)
override;
61 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
62 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
72 desc.
add<
edm::InputTag> (
"AlgInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
73 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
76 desc.
add<
int> (
"MinBx",0);
77 desc.
add<
int> (
"MaxBx",0);
78 desc.
add<
bool> (
"DumpTrigResults",
false);
79 desc.
add<
bool> (
"DumpRecord",
false);
80 desc.
add<
bool> (
"DumpTrigSummary",
true);
81 descriptions.
add(
"L1TGlobalSummary", desc);
85 decisionCount_.clear();
86 prescaledCount_.clear();
90 gtUtil_->retrieveL1Run(evSetup);
91 gtUtil_->retrieveL1LumiBlock(evSetup);
93 int size = gtUtil_->decisionsInitial().size();
94 decisionCount_ .resize(size);
95 prescaledCount_ .resize(size);
96 finalCount_ .resize(size);
97 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
98 std::fill(prescaledCount_.begin(), prescaledCount_.end(), 0);
99 std::fill(finalCount_.begin(), finalCount_.end(), 0);
105 if(dumpTriggerSummary_) {
107 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
108 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
109 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
113 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() << endl;
114 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() << endl;
115 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() << endl;
117 LogVerbatim(
"L1TGlobalSummary") <<
" Bit Algorithm Name Init PScd Final PS Factor Masked Veto " << endl;
118 LogVerbatim(
"L1TGlobalSummary") <<
"============================================================================================================" << endl;
119 for(
unsigned int i=0;
i<prescales.size();
i++) {
123 int resultInit = decisionCount_[
i];
124 int resultPre = prescaledCount_[
i];
125 int resultFin = finalCount_[
i];
128 int prescale = (prescales.at(
i)).
second;
129 bool mask = (masks.at(
i)).
second;
132 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;
134 LogVerbatim(
"L1TGlobalSummary") <<
" Final OR Count = " << finalOrCount <<endl;
135 LogVerbatim(
"L1TGlobalSummary") <<
"===========================================================================================================" << endl;
149 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
151 if(dumpTriggerResults_ || dumpTriggerSummary_) {
154 gtUtil_->retrieveL1(iEvent,evSetup,algToken_);
156 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
159 const std::vector<std::pair<std::string, bool> > initialDecisions = gtUtil_->decisionsInitial();
160 const std::vector<std::pair<std::string, bool> > prescaledDecisions = gtUtil_->decisionsPrescaled();
161 const std::vector<std::pair<std::string, bool> > finalDecisions = gtUtil_->decisionsFinal();
162 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
163 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
164 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
166 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size())
167 ||(prescaledCount_.size() != gtUtil_->decisionsPrescaled().size())
168 ||(finalCount_.size() != gtUtil_->decisionsFinal().size())){
169 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
173 if(dumpTriggerResults_){
174 cout <<
" Bit Algorithm Name Init PScd Final PS Factor Masked Veto " << endl;
175 cout <<
"============================================================================================================" << endl;
177 for(
unsigned int i=0;
i<initialDecisions.size();
i++) {
181 if(name ==
"NULL")
continue;
183 bool resultInit = (initialDecisions.at(
i)).
second;
186 bool resultPre = (prescaledDecisions.at(
i)).
second;
187 bool resultFin = (finalDecisions.at(
i)).
second;
190 int prescale = (prescales.at(
i)).
second;
191 bool mask = (masks.at(
i)).
second;
194 if (resultInit) decisionCount_[
i]++;
195 if (resultPre) prescaledCount_[
i]++;
196 if (resultFin) finalCount_[
i]++;
200 if(dumpTriggerResults_){
201 cout <<
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;
204 bool finOR = gtUtil_->getFinalOR();
205 if (finOR) finalOrCount++;
206 if(dumpTriggerResults_){
207 cout <<
" FinalOR = " << finOR <<endl;
208 cout <<
"===========================================================================================================" << endl;
216 cout <<
" ------ ext ----------" << endl;
218 if(i>=ext->getFirstBX() && i<=ext->getLastBX()) {
219 for(std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(i); extBlk != ext->end(i); ++extBlk) {
223 cout <<
"No Ext Conditions stored for this bx " << i << endl;
226 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
230 cout <<
" ------ alg ----------" << endl;
232 if(i>=alg->getFirstBX() && i<=alg->getLastBX()) {
233 for(std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(i); algBlk != alg->end(i); ++algBlk) {
237 cout <<
"No Alg Decisions stored for this bx " << i << endl;
240 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
std::vector< int > prescaledCount_
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)
tuple size
Write out results.
L1TGlobalSummary(const edm::ParameterSet &)
virtual void beginRun(Run const &, EventSetup const &) override