37 virtual void beginRun(
Run const&,
EventSetup const&)
override;
63 algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
64 extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
66 dumpTriggerResults_ = iConfig.
getParameter<
bool>(
"DumpTrigResults");
67 dumpTriggerSummary_ = iConfig.
getParameter<
bool>(
"DumpTrigSummary");
68 readPrescalesFromFile_ = iConfig.
getParameter<
bool>(
"ReadPrescalesFromFile");
71 gtUtil_ =
new L1TGlobalUtil(iConfig, consumesCollector(), *
this, algInputTag_, extInputTag_);
74 if (readPrescalesFromFile_){
76 unsigned int preScColumn = iConfig.
getParameter<
int>(
"psColumn");
77 gtUtil_ ->OverridePrescalesAndMasks(preScaleFileName,preScColumn);
85 desc.
add<
edm::InputTag> (
"AlgInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT Algorithm Block (required parameter: default value is invalid)");
86 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for uGT External Block (required parameter: default value is invalid)");
89 desc.
add<
int> (
"MinBx",0);
90 desc.
add<
int> (
"MaxBx",0);
91 desc.
add<
bool> (
"DumpTrigResults",
false);
92 desc.
add<
bool> (
"DumpRecord",
false);
93 desc.
add<
bool> (
"DumpTrigSummary",
true);
94 desc.
add<
bool> (
"ReadPrescalesFromFile",
false);
95 desc.
add<
std::string> (
"psFileName",
"prescale_L1TGlobal.csv")->setComment(
"File should be located in directory: L1Trigger/L1TGlobal/data/Luminosity/startup");
96 desc.
add<
int> (
"psColumn",0);
97 descriptions.
add(
"L1TGlobalSummary", desc);
101 decisionCount_.clear();
102 intermCount_.clear();
106 gtUtil_->retrieveL1Setup(evSetup);
108 int size = gtUtil_->decisionsInitial().size();
109 decisionCount_ .resize(size);
110 intermCount_ .resize(size);
111 finalCount_ .resize(size);
112 std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
113 std::fill(intermCount_.begin(), intermCount_.end(), 0);
114 std::fill(finalCount_.begin(), finalCount_.end(), 0);
120 if(dumpTriggerSummary_) {
122 const std::vector<std::pair<std::string, int> > prescales = gtUtil_->prescales();
123 const std::vector<std::pair<std::string, std::vector<int> > >
masks = gtUtil_->masks();
127 LogVerbatim(
"L1TGlobalSummary") <<
" ================= L1 Trigger Report =====================================================================" << endl;
129 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Name : " << gtUtil_->gtTriggerMenuName() << endl;
130 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() << endl;
131 LogVerbatim(
"L1TGlobalSummary") <<
" L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() << endl;
133 LogVerbatim(
"L1TGlobalSummary") <<
" Bit Algorithm Name Init PScd Final PS Factor Num Bx Masked" << endl;
134 LogVerbatim(
"L1TGlobalSummary") <<
"============================================================================================================" << endl;
135 for(
unsigned int i=0;
i<prescales.size();
i++) {
139 int resultInit = decisionCount_[
i];
140 int resultPre = intermCount_[
i];
141 int resultFin = finalCount_[
i];
144 int prescale = (prescales.at(
i)).
second;
147 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.size() << setw(9) << endl;
149 LogVerbatim(
"L1TGlobalSummary") <<
" Final OR Count = " << finalOrCount <<endl;
150 LogVerbatim(
"L1TGlobalSummary") <<
"===========================================================================================================" << endl;
164 LogDebug(
"l1t|Global") <<
"retrieved L1 GT data blocks" << endl;
166 if(dumpTriggerResults_ || dumpTriggerSummary_) {
169 gtUtil_->retrieveL1(iEvent,evSetup,algToken_);
171 LogDebug(
"l1t|Global") <<
"retrieved L1 data from GT Util" << endl;
174 const std::vector<std::pair<std::string, bool> > initialDecisions = gtUtil_->decisionsInitial();
175 const std::vector<std::pair<std::string, bool> > intermDecisions = gtUtil_->decisionsInterm();
176 const std::vector<std::pair<std::string, bool> > finalDecisions = gtUtil_->decisionsFinal();
177 const std::vector<std::pair<std::string, int> > prescales = gtUtil_->prescales();
178 const std::vector<std::pair<std::string, std::vector<int>> >
masks = gtUtil_->masks();
180 if ((decisionCount_.size() != gtUtil_->decisionsInitial().size())
181 ||(intermCount_.size() != gtUtil_->decisionsInterm().size())
182 ||(finalCount_.size() != gtUtil_->decisionsFinal().size())){
183 LogError(
"l1t|Global") <<
"gtUtil sizes inconsistent across run." << endl;
187 if(dumpTriggerResults_){
188 cout <<
"\n===================================== Trigger Results for BX=0 =============================================\n" << endl;
189 cout <<
" Bit Algorithm Name Init aBXM Final PS Factor Num Bx Masked" << endl;
190 cout <<
"============================================================================================================" << endl;
192 for(
unsigned int i=0;
i<initialDecisions.size();
i++) {
196 if(name ==
"NULL")
continue;
198 bool resultInit = (initialDecisions.at(
i)).
second;
201 bool resultInterm = (intermDecisions.at(
i)).
second;
202 bool resultFin = (finalDecisions.at(
i)).
second;
205 int prescale = (prescales.at(
i)).
second;
208 if (resultInit) decisionCount_[
i]++;
209 if (resultInterm) intermCount_[
i]++;
210 if (resultFin) finalCount_[
i]++;
214 if(dumpTriggerResults_){
215 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.size() << endl;
218 bool finOR = gtUtil_->getFinalOR();
219 if (finOR) finalOrCount++;
220 if(dumpTriggerResults_){
221 cout <<
" FinalOR = " << finOR <<endl;
222 cout <<
"===========================================================================================================" << endl;
228 for(
int i=minBx_;
i <= maxBx_;
i++ ){
231 cout <<
" ------ Bx= " <<
i <<
" ext ----------" << endl;
233 if(
i>=ext->getFirstBX() &&
i<=ext->getLastBX()) {
234 for(std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(
i); extBlk != ext->end(
i); ++extBlk) {
239 cout <<
"No Ext Conditions stored for this bx " <<
i << endl;
242 LogError(
"L1TGlobalSummary") <<
"No ext Data in this event " << endl;
246 cout <<
" ------ Bx= " <<
i <<
" alg ----------" << endl;
248 if(
i>=alg->getFirstBX() &&
i<=alg->getLastBX()) {
249 for(std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(
i); algBlk != alg->end(
i); ++algBlk) {
254 cout <<
"No Alg Decisions stored for this bx " <<
i << endl;
257 LogError(
"L1TGlobalSummary") <<
"No alg Data in this event " << endl;
T getParameter(std::string const &) const
bool readPrescalesFromFile_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
def analyze(function, filename, filter=None)
#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_
L1TGlobalSummary(const edm::ParameterSet &)
virtual void beginRun(Run const &, EventSetup const &) override