37 virtual void beginRun(
Run const&,
EventSetup const&)
override;
62 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
63 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
74 desc.
add<
edm::InputTag> (
"AlgInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
75 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
78 desc.
add<
int> (
"MinBx",0);
79 desc.
add<
int> (
"MaxBx",0);
80 desc.
add<
bool> (
"DumpTrigResults",
false);
81 desc.
add<
bool> (
"DumpRecord",
false);
82 desc.
add<
bool> (
"DumpTrigSummary",
true);
83 descriptions.
add(
"L1TGlobalSummary", desc);
87 decisionCount_.clear();
88 prescaledCount_.clear();
96 if(dumpTriggerSummary_) {
98 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
99 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
100 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
104 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() << endl;
105 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() << endl;
106 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() << endl;
108 LogVerbatim(
"L1TGlobalSummary") <<
" Bit Algorithm Name Init PScd Final PS Factor Masked Veto " << endl;
109 LogVerbatim(
"L1TGlobalSummary") <<
"============================================================================================================" << endl;
110 for(
unsigned int i=0;
i<prescales.size();
i++) {
114 int resultInit = decisionCount_[
i];
115 int resultPre = prescaledCount_[
i];
116 int resultFin = finalCount_[
i];
119 int prescale = (prescales.at(
i)).
second;
120 bool mask = (masks.at(
i)).
second;
123 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;
125 LogVerbatim(
"L1TGlobalSummary") <<
" Final OR Count = " << finalOrCount <<endl;
126 LogVerbatim(
"L1TGlobalSummary") <<
"===========================================================================================================" << endl;
140 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
142 if(dumpTriggerResults_ || dumpTriggerSummary_) {
145 gtUtil_->retrieveL1(iEvent,evSetup,algToken_);
147 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
150 const std::vector<std::pair<std::string, bool> > initialDecisions = gtUtil_->decisionsInitial();
151 const std::vector<std::pair<std::string, bool> > prescaledDecisions = gtUtil_->decisionsPrescaled();
152 const std::vector<std::pair<std::string, bool> > finalDecisions = gtUtil_->decisionsFinal();
153 const std::vector<std::pair<std::string, int> >
prescales = gtUtil_->prescales();
154 const std::vector<std::pair<std::string, bool> >
masks = gtUtil_->masks();
155 const std::vector<std::pair<std::string, bool> > vetoMasks = gtUtil_->vetoMasks();
159 int size = gtUtil_->decisionsInitial().size();
160 decisionCount_ .resize(size);
161 prescaledCount_ .resize(size);
162 finalCount_ .resize(size);
163 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
164 std::fill(prescaledCount_.begin(), prescaledCount_.end(), 0);
165 std::fill(finalCount_.begin(), finalCount_.end(), 0);
167 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size())
168 ||(prescaledCount_.size() != gtUtil_->decisionsPrescaled().size())
169 ||(finalCount_.size() != gtUtil_->decisionsFinal().size())){
170 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
175 if(dumpTriggerResults_){
176 cout <<
" Bit Algorithm Name Init PScd Final PS Factor Masked Veto " << endl;
177 cout <<
"============================================================================================================" << endl;
179 for(
unsigned int i=0;
i<initialDecisions.size();
i++) {
183 if(name ==
"NULL")
continue;
185 bool resultInit = (initialDecisions.at(
i)).
second;
188 bool resultPre = (prescaledDecisions.at(
i)).
second;
189 bool resultFin = (finalDecisions.at(
i)).
second;
192 int prescale = (prescales.at(
i)).
second;
193 bool mask = (masks.at(
i)).
second;
196 if (resultInit) decisionCount_[
i]++;
197 if (resultPre) prescaledCount_[
i]++;
198 if (resultFin) finalCount_[
i]++;
202 if(dumpTriggerResults_){
203 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;
206 bool finOR = gtUtil_->getFinalOR();
207 if (finOR) finalOrCount++;
208 if(dumpTriggerResults_){
209 cout <<
" FinalOR = " << finOR <<endl;
210 cout <<
"===========================================================================================================" << endl;
218 cout <<
" ------ ext ----------" << endl;
220 if(i>=ext->getFirstBX() && i<=ext->getLastBX()) {
221 for(std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(i); extBlk != ext->end(i); ++extBlk) {
225 cout <<
"No Ext Conditions stored for this bx " << i << endl;
228 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
232 cout <<
" ------ alg ----------" << endl;
234 if(i>=alg->getFirstBX() && i<=alg->getLastBX()) {
235 for(std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(i); algBlk != alg->end(i); ++algBlk) {
239 cout <<
"No Alg Decisions stored for this bx " << i << endl;
242 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