CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
L1TGlobalSummary Class Reference
Inheritance diagram for L1TGlobalSummary:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (Run const &, EventSetup const &) override
 
void endRun (Run const &, EventSetup const &) override
 
 L1TGlobalSummary (const edm::ParameterSet &)
 
 ~L1TGlobalSummary () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

InputTag algInputTag_
 
EDGetToken algToken_
 
std::vector< int > decisionCount_
 
bool dumpRecord_
 
bool dumpTriggerResults_
 
bool dumpTriggerSummary_
 
InputTag extInputTag_
 
EDGetToken extToken_
 
std::vector< int > finalCount_
 
int finalOrCount
 
L1TGlobalUtilgtUtil_
 
std::vector< int > intermCount_
 
int maxBx_
 
int minBx_
 
bool readPrescalesFromFile_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 30 of file L1TGlobalSummary.cc.

Constructor & Destructor Documentation

◆ L1TGlobalSummary()

L1TGlobalSummary::L1TGlobalSummary ( const edm::ParameterSet iConfig)
explicit

Definition at line 58 of file L1TGlobalSummary.cc.

References edm::ParameterSet::getParameter(), l1t::Run, l1t::RunAndEvent, and AlCaHLTBitMon_QueryRunRegistry::string.

58  {
59  algInputTag_ = iConfig.getParameter<InputTag>("AlgInputTag");
60  extInputTag_ = iConfig.getParameter<InputTag>("ExtInputTag");
61  algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
62  extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
63  dumpRecord_ = iConfig.getParameter<bool>("DumpRecord");
64  dumpTriggerResults_ = iConfig.getParameter<bool>("DumpTrigResults");
65  dumpTriggerSummary_ = iConfig.getParameter<bool>("DumpTrigSummary");
66  readPrescalesFromFile_ = iConfig.getParameter<bool>("ReadPrescalesFromFile");
67  minBx_ = iConfig.getParameter<int>("MinBx");
68  maxBx_ = iConfig.getParameter<int>("MaxBx");
71  useEventSetupIn = l1t::UseEventSetupIn::RunAndEvent;
72  }
73  gtUtil_ = new L1TGlobalUtil(iConfig, consumesCollector(), *this, algInputTag_, extInputTag_, useEventSetupIn);
74  finalOrCount = 0;
75 
77  std::string preScaleFileName = iConfig.getParameter<std::string>("psFileName");
78  unsigned int preScColumn = iConfig.getParameter<int>("psColumn");
79  gtUtil_->OverridePrescalesAndMasks(preScaleFileName, preScColumn);
80  }
81 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void OverridePrescalesAndMasks(std::string filename, unsigned int psColumn=1.)
L1TGlobalUtil * gtUtil_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
UseEventSetupIn
Definition: L1TGlobalUtil.h:42

◆ ~L1TGlobalSummary()

L1TGlobalSummary::~L1TGlobalSummary ( )
inlineoverride

Definition at line 33 of file L1TGlobalSummary.cc.

33 {};

Member Function Documentation

◆ analyze()

void L1TGlobalSummary::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 172 of file L1TGlobalSummary.cc.

References gather_cfg::cout, TauDecayModes::dec, edm::first(), mps_fire::i, iEvent, edm::HandleBase::isValid(), LogDebug, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, Skims_PA_cff::name, hltrates_dqm_sourceclient-live_cfg::prescales, edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

172  {
174  iEvent.getByToken(algToken_, alg);
175 
177  iEvent.getByToken(extToken_, ext);
178 
179  LogDebug("l1t|Global") << "retrieved L1 GT data blocks" << endl;
180 
182  //Fill the L1 result maps
183  gtUtil_->retrieveL1(iEvent, evSetup, algToken_);
184 
185  LogDebug("l1t|Global") << "retrieved L1 data from GT Util" << endl;
186 
187  // grab the map for the final decisions
188  const std::vector<std::pair<std::string, bool>> initialDecisions = gtUtil_->decisionsInitial();
189  const std::vector<std::pair<std::string, bool>> intermDecisions = gtUtil_->decisionsInterm();
190  const std::vector<std::pair<std::string, bool>> finalDecisions = gtUtil_->decisionsFinal();
191  const std::vector<std::pair<std::string, double>> prescales = gtUtil_->prescales();
192  const std::vector<std::pair<std::string, std::vector<int>>> masks = gtUtil_->masks();
193 
194  if ((decisionCount_.size() != gtUtil_->decisionsInitial().size()) ||
195  (intermCount_.size() != gtUtil_->decisionsInterm().size()) ||
196  (finalCount_.size() != gtUtil_->decisionsFinal().size())) {
197  LogError("l1t|Global") << "gtUtil sizes inconsistent across run." << endl;
198  return;
199  }
200 
201  if (dumpTriggerResults_) {
202  cout << "\n===================================== Trigger Results for BX=0 "
203  "=============================================\n"
204  << endl;
205  cout << " Bit Algorithm Name Init aBXM Final PS Factor Num Bx "
206  "Masked"
207  << endl;
208  cout << "========================================================================================================"
209  "===="
210  << endl;
211  }
212  for (unsigned int i = 0; i < initialDecisions.size(); i++) {
213  // get the name and trigger result
214  std::string name = (initialDecisions.at(i)).first;
215  if (name == "NULL")
216  continue;
217 
218  bool resultInit = (initialDecisions.at(i)).second;
219 
220  // get prescaled and final results (need some error checking here)
221  bool resultInterm = (intermDecisions.at(i)).second;
222  bool resultFin = (finalDecisions.at(i)).second;
223 
224  // get the prescale and mask (needs some error checking here)
225  double prescale = (prescales.at(i)).second;
226  std::vector<int> mask = (masks.at(i)).second;
227 
228  if (resultInit)
229  decisionCount_[i]++;
230  if (resultInterm)
231  intermCount_[i]++;
232  if (resultFin)
233  finalCount_[i]++;
234 
235  //cout << i << " " << decisionCount_[i] << "\n";
236 
237  if (dumpTriggerResults_) {
238  cout << std::dec << setfill(' ') << " " << setw(5) << i << " " << setw(40) << name.c_str() << " "
239  << setw(7) << resultInit << setw(7) << resultInterm << setw(7) << resultFin << setw(10) << prescale
240  << setw(11) << mask.size() << endl;
241  }
242  }
243  bool finOR = gtUtil_->getFinalOR();
244  if (finOR)
245  finalOrCount++;
246  if (dumpTriggerResults_) {
247  cout << " FinalOR = " << finOR << endl;
248  cout << "========================================================================================================"
249  "==="
250  << endl;
251  }
252  }
253 
254  if (dumpRecord_) {
255  //int i = 0; // now now just printing BX=0...
256  for (int i = minBx_; i <= maxBx_; i++) {
257  // Dump the coutput record
258  cout << " ------ Bx= " << i << " ext ----------" << endl;
259  if (ext.isValid()) {
260  if (i >= ext->getFirstBX() && i <= ext->getLastBX()) {
261  for (std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(i); extBlk != ext->end(i); ++extBlk) {
262  extBlk->print(cout);
263  cout << std::dec;
264  }
265  } else {
266  cout << "No Ext Conditions stored for this bx " << i << endl;
267  }
268  } else {
269  LogError("L1TGlobalSummary") << "No ext Data in this event " << endl;
270  }
271 
272  // Dump the coutput record
273  cout << " ------ Bx= " << i << " alg ----------" << endl;
274  if (alg.isValid()) {
275  if (i >= alg->getFirstBX() && i <= alg->getLastBX()) {
276  for (std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(i); algBlk != alg->end(i); ++algBlk) {
277  algBlk->print(cout);
278  cout << std::dec;
279  }
280  } else {
281  cout << "No Alg Decisions stored for this bx " << i << endl;
282  }
283  } else {
284  LogError("L1TGlobalSummary") << "No alg Data in this event " << endl;
285  }
286  }
287  }
288 }
bool getFinalOR() const
const std::vector< std::pair< std::string, double > > & prescales()
L1TGlobalUtil * gtUtil_
Log< level::Error, false > LogError
U second(std::pair< T, U > const &p)
int iEvent
Definition: GenABIO.cc:224
const std::vector< std::pair< std::string, bool > > & decisionsInterm()
std::vector< int > finalCount_
const std::vector< std::pair< std::string, bool > > & decisionsInitial()
std::vector< int > decisionCount_
bool isValid() const
Definition: HandleBase.h:70
const std::vector< std::pair< std::string, bool > > & decisionsFinal()
const std::vector< std::pair< std::string, std::vector< int > > > & masks()
Definition: memstream.h:15
std::vector< int > intermCount_
void retrieveL1(const edm::Event &iEvent, const edm::EventSetup &evSetup)
initialize the class (mainly reserve)
#define LogDebug(id)

◆ beginRun()

void L1TGlobalSummary::beginRun ( Run const &  ,
EventSetup const &  evSetup 
)
override

Definition at line 112 of file L1TGlobalSummary.cc.

References ntuplemaker::fill.

112  {
113  decisionCount_.clear();
114  intermCount_.clear();
115  finalCount_.clear();
116 
117  finalOrCount = 0;
118  gtUtil_->retrieveL1Setup(evSetup);
119 
120  int size = gtUtil_->decisionsInitial().size();
121  decisionCount_.resize(size);
122  intermCount_.resize(size);
123  finalCount_.resize(size);
124  std::fill(decisionCount_.begin(), decisionCount_.end(), 0);
125  std::fill(intermCount_.begin(), intermCount_.end(), 0);
126  std::fill(finalCount_.begin(), finalCount_.end(), 0);
127 }
size
Write out results.
L1TGlobalUtil * gtUtil_
std::vector< int > finalCount_
const std::vector< std::pair< std::string, bool > > & decisionsInitial()
std::vector< int > decisionCount_
void retrieveL1Setup(const edm::EventSetup &evSetup)
std::vector< int > intermCount_

◆ endRun()

void L1TGlobalSummary::endRun ( Run const &  ,
EventSetup const &   
)
override

Definition at line 129 of file L1TGlobalSummary.cc.

References TauDecayModes::dec, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, Skims_PA_cff::name, MillePedeFileConverter_cfg::out, and hltrates_dqm_sourceclient-live_cfg::prescales.

129  {
130  if (dumpTriggerSummary_) {
131  LogVerbatim out("L1TGlobalSummary");
132  if (gtUtil_->valid()) {
133  out << "================== L1 Trigger Report "
134  "=====================================================================\n";
135  out << '\n';
136  out << " L1T menu Name : " << gtUtil_->gtTriggerMenuName() << '\n';
137  out << " L1T menu Version: " << gtUtil_->gtTriggerMenuVersion() << '\n';
138  out << " L1T menu Comment: " << gtUtil_->gtTriggerMenuComment() << '\n';
139  out << '\n';
140  out << " Bit Algorithm Name Init PScd Final PS Factor Num Bx "
141  "Masked\n";
142  out << "========================================================================================================="
143  "===\n";
144  auto const& prescales = gtUtil_->prescales();
145  auto const& masks = gtUtil_->masks();
146  for (unsigned int i = 0; i < prescales.size(); i++) {
147  // get the prescale and mask (needs some error checking here)
148  int resultInit = decisionCount_[i];
149  int resultPre = intermCount_[i];
150  int resultFin = finalCount_[i];
151 
152  auto const& name = prescales.at(i).first;
153  if (name != "NULL") {
154  double prescale = prescales.at(i).second;
155  auto const& mask = masks.at(i).second;
156  out << std::dec << setfill(' ') << " " << setw(5) << i << " " << setw(40) << name << " " << setw(7)
157  << resultInit << setw(7) << resultPre << setw(7) << resultFin << setw(10) << prescale << setw(11)
158  << mask.size() << '\n';
159  }
160  }
161  out << " Final OR Count = " << finalOrCount << '\n';
162  out << "========================================================================================================="
163  "===\n";
164  } else {
165  out << "================== No Level-1 Trigger menu "
166  "===============================================================\n";
167  }
168  }
169 }
const std::vector< std::pair< std::string, double > > & prescales()
L1TGlobalUtil * gtUtil_
const std::string & gtTriggerMenuName() const
const std::string & gtTriggerMenuComment() const
std::vector< int > finalCount_
std::vector< int > decisionCount_
const std::string & gtTriggerMenuVersion() const
bool valid() const
check that the L1TGlobalUtil has been properly initialised
const std::vector< std::pair< std::string, std::vector< int > > > & masks()
std::vector< int > intermCount_

◆ fillDescriptions()

void L1TGlobalSummary::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 107 of file L1TGlobalSummary.cc.

References edm::ConfigurationDescriptions::add(), and edm::ConfigurationDescriptions::addDefault().

107  {
108  descriptions.add("L1TGlobalSummary", makeDesc(edm::InputTag("gtStage2Digis"), edm::InputTag("gtStage2Digis"), -2, 2));
109  descriptions.addDefault(makeDesc(edm::InputTag(""), edm::InputTag(""), 0, 0));
110 }
void addDefault(ParameterSetDescription const &psetDescription)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ algInputTag_

InputTag L1TGlobalSummary::algInputTag_
private

Definition at line 40 of file L1TGlobalSummary.cc.

◆ algToken_

EDGetToken L1TGlobalSummary::algToken_
private

Definition at line 42 of file L1TGlobalSummary.cc.

◆ decisionCount_

std::vector<int> L1TGlobalSummary::decisionCount_
private

Definition at line 52 of file L1TGlobalSummary.cc.

◆ dumpRecord_

bool L1TGlobalSummary::dumpRecord_
private

Definition at line 44 of file L1TGlobalSummary.cc.

◆ dumpTriggerResults_

bool L1TGlobalSummary::dumpTriggerResults_
private

Definition at line 45 of file L1TGlobalSummary.cc.

◆ dumpTriggerSummary_

bool L1TGlobalSummary::dumpTriggerSummary_
private

Definition at line 46 of file L1TGlobalSummary.cc.

◆ extInputTag_

InputTag L1TGlobalSummary::extInputTag_
private

Definition at line 41 of file L1TGlobalSummary.cc.

◆ extToken_

EDGetToken L1TGlobalSummary::extToken_
private

Definition at line 43 of file L1TGlobalSummary.cc.

◆ finalCount_

std::vector<int> L1TGlobalSummary::finalCount_
private

Definition at line 54 of file L1TGlobalSummary.cc.

◆ finalOrCount

int L1TGlobalSummary::finalOrCount
private

Definition at line 55 of file L1TGlobalSummary.cc.

◆ gtUtil_

L1TGlobalUtil* L1TGlobalSummary::gtUtil_
private

Definition at line 50 of file L1TGlobalSummary.cc.

◆ intermCount_

std::vector<int> L1TGlobalSummary::intermCount_
private

Definition at line 53 of file L1TGlobalSummary.cc.

◆ maxBx_

int L1TGlobalSummary::maxBx_
private

Definition at line 49 of file L1TGlobalSummary.cc.

◆ minBx_

int L1TGlobalSummary::minBx_
private

Definition at line 48 of file L1TGlobalSummary.cc.

◆ readPrescalesFromFile_

bool L1TGlobalSummary::readPrescalesFromFile_
private

Definition at line 47 of file L1TGlobalSummary.cc.