CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TCaloLayer1Validator Class Reference

#include <L1Trigger/L1TCaloLayer1/plugins/L1TCaloLayer1Validator.cc>

Inheritance diagram for L1TCaloLayer1Validator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1TCaloLayer1Validator (const edm::ParameterSet &)
 
 ~L1TCaloLayer1Validator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

uint32_t badEventCount
 
uint32_t badNonZeroTowerCount
 
uint32_t badTowerCount
 
std::string emulLabel
 
edm::EDGetTokenT
< CaloTowerBxCollection
emulSource
 
uint32_t eventCount
 
uint32_t nonZeroTowerCount
 
std::string testLabel
 
edm::EDGetTokenT
< CaloTowerBxCollection
testSource
 
uint32_t towerCount
 
bool verbose
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer 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

Description: This ED Analyzer compares output of CMS L1 Trigger Calo Layer-1 output (CaloTowers) from two sources

Implementation: It is expected that we compare CaloTowers from the spy source to that of the emulator. It can be used to compare any two CaloTower collections

Definition at line 40 of file L1TCaloLayer1Validator.cc.

Constructor & Destructor Documentation

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

Definition at line 87 of file L1TCaloLayer1Validator.cc.

87  :
88  testSource(consumes<CaloTowerBxCollection>(iConfig.getParameter<edm::InputTag>("testSource"))),
89  emulSource(consumes<CaloTowerBxCollection>(iConfig.getParameter<edm::InputTag>("emulSource"))),
90  eventCount(0),
91  badEventCount(0),
92  towerCount(0),
93  badTowerCount(0),
96  verbose(iConfig.getParameter<bool>("verbose")) {}
T getParameter(std::string const &) const
edm::EDGetTokenT< CaloTowerBxCollection > emulSource
edm::EDGetTokenT< CaloTowerBxCollection > testSource
L1TCaloLayer1Validator::~L1TCaloLayer1Validator ( )

Definition at line 98 of file L1TCaloLayer1Validator.cc.

98 {}

Member Function Documentation

void L1TCaloLayer1Validator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 106 of file L1TCaloLayer1Validator.cc.

References badEventCount, badNonZeroTowerCount, badTowerCount, gather_cfg::cout, emulSource, eventCount, edm::Event::getByToken(), nonZeroTowerCount, summarizeEdmComparisonLogfiles::success, testSource, and towerCount.

107 {
108  using namespace edm;
109  bool badEvent = false;
111  iEvent.getByToken(testSource, testTowers);
113  iEvent.getByToken(emulSource, emulTowers);
114  int theBX = 0;
115  for(std::vector<CaloTower>::const_iterator testTower = testTowers->begin(theBX);
116  testTower != testTowers->end(theBX);
117  ++testTower) {
118  for(std::vector<CaloTower>::const_iterator emulTower = emulTowers->begin(theBX);
119  emulTower != emulTowers->end(theBX);
120  ++emulTower) {
121  int test_iEta = testTower->hwEta();
122  int test_iPhi = testTower->hwPhi();
123  int test_et = testTower->hwPt();
124  int test_er = testTower->hwEtRatio();
125  int test_fb = testTower->hwQual();
126  int emul_iEta = emulTower->hwEta();
127  int emul_iPhi = emulTower->hwPhi();
128  int emul_et = emulTower->hwPt();
129  int emul_er = emulTower->hwEtRatio();
130  int emul_fb = emulTower->hwQual();
131  bool success = true;
132  if(test_iEta == emul_iEta && test_iPhi == emul_iPhi) {
133  if(test_et != emul_et) {success = false;}
134  if(test_er != emul_er) {success = false;}
135  if(test_fb != emul_fb) {success = false;}
136  if(!success) {
137  if(test_et != emul_et) {if(verbose) std::cout << "ET ";}
138  if(test_er != emul_er) {if(verbose) std::cout << "ER ";}
139  if(test_fb != emul_fb) {if(verbose) std::cout << "FB ";}
140  if(verbose) std::cout << "Checks failed for ("
141  << test_iEta << ", "
142  << test_iPhi << ") : ("
143  << test_et << ", "
144  << test_er << ", "
145  << test_fb << ") != ("
146  << emul_et << ", "
147  << emul_er << ", "
148  << emul_fb << ")" << std::endl;
149  badEvent = true;
150  badTowerCount++;
151  if(test_et > 0) badNonZeroTowerCount++;
152  }
153  towerCount++;
154  if(test_et > 0) nonZeroTowerCount++;
155  }
156  if(!success && test_et == emul_et && test_iPhi == emul_iPhi) {
157  if(verbose) std::cout << "Incidental match for ("
158  << test_iEta << ", "
159  << test_iPhi << ") : ("
160  << test_et << ", "
161  << test_er << ", "
162  << test_fb << ") != ("
163  << emul_iEta <<","
164  << emul_iPhi<<") :("
165  << emul_et << ", "
166  << emul_er << ", "
167  << emul_fb << ")" << std::endl;
168  }
169  }
170  }
171  if(badEvent) badEventCount++;
172  eventCount++;
173 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< CaloTowerBxCollection > emulSource
edm::EDGetTokenT< CaloTowerBxCollection > testSource
tuple cout
Definition: gather_cfg.py:145
void L1TCaloLayer1Validator::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 177 of file L1TCaloLayer1Validator.cc.

178 {
179 }
void L1TCaloLayer1Validator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file L1TCaloLayer1Validator.cc.

References badEventCount, badNonZeroTowerCount, badTowerCount, gather_cfg::cout, eventCount, nonZeroTowerCount, and towerCount.

184 {
185  std::cout << "L1TCaloLayer1Vaidator: Summary is Non-Zero Bad Tower / Bad Tower / Event Count = ("
186  << badNonZeroTowerCount << " of " << nonZeroTowerCount << ") / ("
187  << badTowerCount << " of " << towerCount << ") / ("
188  << badEventCount << " of " << eventCount << ")" << std::endl;
189 }
tuple cout
Definition: gather_cfg.py:145
void L1TCaloLayer1Validator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 225 of file L1TCaloLayer1Validator.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

225  {
226  //The following says we do not know what parameters are allowed so do no validation
227  // Please change this to state exactly what you do use, even if it is no parameters
229  desc.setUnknown();
230  descriptions.addDefault(desc);
231 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

uint32_t L1TCaloLayer1Validator::badEventCount
private

Definition at line 66 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

uint32_t L1TCaloLayer1Validator::badNonZeroTowerCount
private

Definition at line 70 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

uint32_t L1TCaloLayer1Validator::badTowerCount
private

Definition at line 68 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

std::string L1TCaloLayer1Validator::emulLabel
private

Definition at line 63 of file L1TCaloLayer1Validator.cc.

edm::EDGetTokenT<CaloTowerBxCollection> L1TCaloLayer1Validator::emulSource
private

Definition at line 62 of file L1TCaloLayer1Validator.cc.

Referenced by analyze().

uint32_t L1TCaloLayer1Validator::eventCount
private

Definition at line 65 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

uint32_t L1TCaloLayer1Validator::nonZeroTowerCount
private

Definition at line 69 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

std::string L1TCaloLayer1Validator::testLabel
private

Definition at line 61 of file L1TCaloLayer1Validator.cc.

edm::EDGetTokenT<CaloTowerBxCollection> L1TCaloLayer1Validator::testSource
private

Definition at line 60 of file L1TCaloLayer1Validator.cc.

Referenced by analyze().

uint32_t L1TCaloLayer1Validator::towerCount
private

Definition at line 67 of file L1TCaloLayer1Validator.cc.

Referenced by analyze(), and endJob().

bool L1TCaloLayer1Validator::verbose
private