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

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginRun (Run const &, EventSetup const &) override
 
virtual void endRun (Run const &, EventSetup const &) override
 
 L1TGlobalSummary (const edm::ParameterSet &)
 
virtual ~L1TGlobalSummary ()
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 32 of file L1TGlobalSummary.cc.

Constructor & Destructor Documentation

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

Definition at line 60 of file L1TGlobalSummary.cc.

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

60  {
61  algInputTag_ = iConfig.getParameter<InputTag>("AlgInputTag");
62  extInputTag_ = iConfig.getParameter<InputTag>("ExtInputTag");
63  algToken_ = consumes<BXVector<GlobalAlgBlk>>(algInputTag_);
64  extToken_ = consumes<BXVector<GlobalExtBlk>>(extInputTag_);
65  dumpRecord_ = iConfig.getParameter<bool>("DumpRecord");
66  dumpTriggerResults_ = iConfig.getParameter<bool>("DumpTrigResults");
67  dumpTriggerSummary_ = iConfig.getParameter<bool>("DumpTrigSummary");
68  readPrescalesFromFile_ = iConfig.getParameter<bool>("ReadPrescalesFromFile");
69  minBx_ = iConfig.getParameter<int>("MinBx");
70  maxBx_ = iConfig.getParameter<int>("MaxBx");
71  gtUtil_ = new L1TGlobalUtil(iConfig, consumesCollector(), *this, algInputTag_, extInputTag_);
72  finalOrCount = 0;
73 
74  if (readPrescalesFromFile_){
75  std::string preScaleFileName = iConfig.getParameter<std::string>("psFileName");
76  unsigned int preScColumn = iConfig.getParameter<int>("psColumn");
77  gtUtil_ ->OverridePrescalesAndMasks(preScaleFileName,preScColumn);
78  }
79 
80 }
T getParameter(std::string const &) const
L1TGlobalUtil * gtUtil_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
virtual L1TGlobalSummary::~L1TGlobalSummary ( )
inlinevirtual

Definition at line 35 of file L1TGlobalSummary.cc.

References Vispa.Share.Profiling::analyze(), and Ecal2004TBTDCRanges_v1_cff::endRun.

35 {};

Member Function Documentation

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

Definition at line 156 of file L1TGlobalSummary.cc.

References gather_cfg::cout, TauDecayModes::dec, DEFINE_FWK_MODULE, edm::first(), edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), LogDebug, RecoTauDiscriminantConfiguration::mask, masks, dataset::name, edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

156  {
157 
159  iEvent.getByToken(algToken_,alg);
160 
162  iEvent.getByToken(extToken_,ext);
163 
164  LogDebug("l1t|Global") << "retrieved L1 GT data blocks" << endl;
165 
167 
168  //Fill the L1 result maps
169  gtUtil_->retrieveL1(iEvent,evSetup,algToken_);
170 
171  LogDebug("l1t|Global") << "retrieved L1 data from GT Util" << endl;
172 
173  // grab the map for the final decisions
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();
179 
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;
184  return;
185  }
186 
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;
191  }
192  for(unsigned int i=0; i<initialDecisions.size(); i++) {
193 
194  // get the name and trigger result
195  std::string name = (initialDecisions.at(i)).first;
196  if(name == "NULL") continue;
197 
198  bool resultInit = (initialDecisions.at(i)).second;
199 
200  // get prescaled and final results (need some error checking here)
201  bool resultInterm = (intermDecisions.at(i)).second;
202  bool resultFin = (finalDecisions.at(i)).second;
203 
204  // get the prescale and mask (needs some error checking here)
205  int prescale = (prescales.at(i)).second;
206  std::vector<int> mask = (masks.at(i)).second;
207 
208  if (resultInit) decisionCount_[i]++;
209  if (resultInterm) intermCount_[i]++;
210  if (resultFin) finalCount_[i]++;
211 
212  //cout << i << " " << decisionCount_[i] << "\n";
213 
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;
216  }
217  }
218  bool finOR = gtUtil_->getFinalOR();
219  if (finOR) finalOrCount++;
221  cout << " FinalOR = " << finOR <<endl;
222  cout << "===========================================================================================================" << endl;
223  }
224  }
225 
226  if (dumpRecord_){
227  //int i = 0; // now now just printing BX=0...
228  for( int i=minBx_; i <= maxBx_; i++ ){
229 
230  // Dump the coutput record
231  cout << " ------ Bx= " << i << " ext ----------" << endl;
232  if(ext.isValid()) {
233  if(i>=ext->getFirstBX() && i<=ext->getLastBX()) {
234  for(std::vector<GlobalExtBlk>::const_iterator extBlk = ext->begin(i); extBlk != ext->end(i); ++extBlk) {
235  extBlk->print(cout);
236  cout << std::dec;
237  }
238  } else {
239  cout << "No Ext Conditions stored for this bx " << i << endl;
240  }
241  } else {
242  LogError("L1TGlobalSummary") << "No ext Data in this event " << endl;
243  }
244 
245  // Dump the coutput record
246  cout << " ------ Bx= " << i << " alg ----------" << endl;
247  if(alg.isValid()) {
248  if(i>=alg->getFirstBX() && i<=alg->getLastBX()) {
249  for(std::vector<GlobalAlgBlk>::const_iterator algBlk = alg->begin(i); algBlk != alg->end(i); ++algBlk) {
250  algBlk->print(cout);
251  cout << std::dec;
252  }
253  } else {
254  cout << "No Alg Decisions stored for this bx " << i << endl;
255  }
256  } else {
257  LogError("L1TGlobalSummary") << "No alg Data in this event " << endl;
258  }
259  }
260  }
261 
262 }
#define LogDebug(id)
const std::vector< std::pair< std::string, int > > & prescales()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
L1TGlobalUtil * gtUtil_
U second(std::pair< T, U > const &p)
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:74
bool getFinalOR() const
constexpr uint32_t masks[]
Definition: CaloRecHit.cc:12
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)
void L1TGlobalSummary::beginRun ( Run const &  ,
EventSetup const &  evSetup 
)
overridevirtual

Definition at line 100 of file L1TGlobalSummary.cc.

References lumiContext::fill, and findQualityFiles::size.

100  {
101  decisionCount_.clear();
102  intermCount_.clear();
103  finalCount_.clear();
104 
105  finalOrCount = 0;
106  gtUtil_->retrieveL1Setup(evSetup);
107 
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);
115 
116 }
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_
void L1TGlobalSummary::endRun ( Run const &  ,
EventSetup const &   
)
overridevirtual

Definition at line 118 of file L1TGlobalSummary.cc.

References TauDecayModes::dec, edm::first(), mps_fire::i, RecoTauDiscriminantConfiguration::mask, masks, dataset::name, edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

118  {
119 
120  if(dumpTriggerSummary_) {
121 
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();
124 
125  // Dump the results
126  LogVerbatim("L1TGlobalSummary") << " " << "\n\n";
127  LogVerbatim("L1TGlobalSummary") << " ================= L1 Trigger Report =====================================================================" << endl;
128  LogVerbatim("L1TGlobalSummary") << " " << 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;
132  LogVerbatim("L1TGlobalSummary") << " " << 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++) {
136 
137 
138  // get the prescale and mask (needs some error checking here)
139  int resultInit = decisionCount_[i];
140  int resultPre = intermCount_[i];
141  int resultFin = finalCount_[i];
142 
143  std::string name = (prescales.at(i)).first;
144  int prescale = (prescales.at(i)).second;
145  std::vector<int> mask = (masks.at(i)).second;
146 
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;
148  }
149  LogVerbatim("L1TGlobalSummary") << " Final OR Count = " << finalOrCount <<endl;
150  LogVerbatim("L1TGlobalSummary") << "===========================================================================================================" << endl;
151  }
152 
153 }
const std::string & gtTriggerMenuComment() const
const std::vector< std::pair< std::string, int > > & prescales()
L1TGlobalUtil * gtUtil_
const std::string & gtTriggerMenuVersion() const
U second(std::pair< T, U > const &p)
std::vector< int > finalCount_
const std::string & gtTriggerMenuName() const
std::vector< int > decisionCount_
constexpr uint32_t masks[]
Definition: CaloRecHit.cc:12
const std::vector< std::pair< std::string, std::vector< int > > > & masks()
std::vector< int > intermCount_
void L1TGlobalSummary::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 82 of file L1TGlobalSummary.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

82  {
84  // These parameters are part of the L1T/HLT interface, avoid changing if possible::
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)");
87  // These parameters have well defined default values and are not currently
88  // part of the L1T/HLT interface. They can be cleaned up or updated at will:
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);
98 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

InputTag L1TGlobalSummary::algInputTag_
private

Definition at line 42 of file L1TGlobalSummary.cc.

EDGetToken L1TGlobalSummary::algToken_
private

Definition at line 44 of file L1TGlobalSummary.cc.

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

Definition at line 54 of file L1TGlobalSummary.cc.

bool L1TGlobalSummary::dumpRecord_
private

Definition at line 46 of file L1TGlobalSummary.cc.

bool L1TGlobalSummary::dumpTriggerResults_
private

Definition at line 47 of file L1TGlobalSummary.cc.

bool L1TGlobalSummary::dumpTriggerSummary_
private

Definition at line 48 of file L1TGlobalSummary.cc.

InputTag L1TGlobalSummary::extInputTag_
private

Definition at line 43 of file L1TGlobalSummary.cc.

EDGetToken L1TGlobalSummary::extToken_
private

Definition at line 45 of file L1TGlobalSummary.cc.

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

Definition at line 56 of file L1TGlobalSummary.cc.

int L1TGlobalSummary::finalOrCount
private

Definition at line 57 of file L1TGlobalSummary.cc.

L1TGlobalUtil* L1TGlobalSummary::gtUtil_
private

Definition at line 52 of file L1TGlobalSummary.cc.

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

Definition at line 55 of file L1TGlobalSummary.cc.

int L1TGlobalSummary::maxBx_
private

Definition at line 51 of file L1TGlobalSummary.cc.

int L1TGlobalSummary::minBx_
private

Definition at line 50 of file L1TGlobalSummary.cc.

bool L1TGlobalSummary::readPrescalesFromFile_
private

Definition at line 49 of file L1TGlobalSummary.cc.