CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CompareToObjectMapRecord Class Reference

#include <CompareToObjectMapRecord.h>

Inheritance diagram for CompareToObjectMapRecord:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &event, edm::EventSetup const &es) override
 
 CompareToObjectMapRecord (const edm::ParameterSet &pset)
 
 ~CompareToObjectMapRecord () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag m_l1GtObjectMapsTag
 
edm::InputTag m_l1GtObjectMapTag
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna
: W. David Dagenhart

Description:Compares the L1GlobalTriggerObjectMapRecord to the L1GlobalTriggerObjectMaps object and also the ParameterSet registry and verifies that the information is consistent or else it throws.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna
: W. David Dagenhart

Definition at line 27 of file CompareToObjectMapRecord.h.

Constructor & Destructor Documentation

◆ CompareToObjectMapRecord()

CompareToObjectMapRecord::CompareToObjectMapRecord ( const edm::ParameterSet pset)
explicit

Definition at line 36 of file CompareToObjectMapRecord.cc.

37  : m_l1GtObjectMapTag(pset.getParameter<edm::InputTag>("L1GtObjectMapTag")),
38  m_l1GtObjectMapsTag(pset.getParameter<edm::InputTag>("L1GtObjectMapsTag")),
39  verbose_(pset.getUntrackedParameter<bool>("verbose", false)) {}

◆ ~CompareToObjectMapRecord()

CompareToObjectMapRecord::~CompareToObjectMapRecord ( )
override

Definition at line 41 of file CompareToObjectMapRecord.cc.

41 {}

Member Function Documentation

◆ analyze()

void CompareToObjectMapRecord::analyze ( edm::Event const &  event,
edm::EventSetup const &  es 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 43 of file CompareToObjectMapRecord.cc.

43  {
44  // Read in the data in the old format
46  event.getByLabel(m_l1GtObjectMapTag, gtObjectMapRecord);
47 
48  // Read in the data in the new format
50  event.getByLabel(m_l1GtObjectMapsTag, gtObjectMaps);
51 
52  // In the new format the names are not in the event data,
53  // They are in the ParameterSet registry
55  edm::ParameterSet const *pset = psetRegistry->getMapped(gtObjectMaps->namesParameterSetID());
56  if (pset == nullptr) {
57  cms::Exception ex("L1GlobalTrigger");
58  ex << "Could not find L1 trigger names ParameterSet in the registry";
59  ex.addContext("Calling CompareToObjectMapRecord::analyze");
60  throw ex;
61  }
62 
63  // First compare the algorithm bit numbers
64  std::vector<int> algoBitNumbers1;
65  std::vector<L1GlobalTriggerObjectMap> const &vectorInRecord = gtObjectMapRecord->gtObjectMap();
66  algoBitNumbers1.reserve(vectorInRecord.size());
67  for (std::vector<L1GlobalTriggerObjectMap>::const_iterator i = vectorInRecord.begin(), iEnd = vectorInRecord.end();
68  i != iEnd;
69  ++i) {
70  algoBitNumbers1.push_back(i->algoBitNumber());
71  if (verbose_) {
72  // This will print out all the data from the
73  // L1GlobalTriggerObjectMapRecord
74  i->print(std::cout);
75  }
76  }
77  edm::sort_all(algoBitNumbers1);
78 
79  std::vector<int> algoBitNumbers2;
80  gtObjectMaps->getAlgorithmBitNumbers(algoBitNumbers2);
81  if (algoBitNumbers1 != algoBitNumbers2) {
82  cms::Exception ex("L1GlobalTrigger");
83  ex << "Algorithm bit numbers do not match";
84  ex.addContext("Calling CompareToObjectMapRecord::analyze");
85  throw ex;
86  }
87 
88  // Now test the algorithm names
89  std::vector<std::string> algoNames2 = pset->getParameter<std::vector<std::string>>("@algorithmNames");
90 
91  // In the ParameterSet, the algorithm names are referenced by position
92  // in the vector. If the bit number for a position in the vector is
93  // not assigned, then the algorithm name should be an empty string.
94  for (int i = 0; i < static_cast<int>(algoNames2.size()); ++i) {
95  if (!std::binary_search(algoBitNumbers1.begin(), algoBitNumbers1.end(), i)) {
96  if (algoNames2[i] != std::string("")) {
97  cms::Exception ex("L1GlobalTrigger");
98  ex << "Undefined algorithm should have empty name";
99  ex.addContext("Calling CompareToObjectMapRecord::analyze");
100  throw ex;
101  }
102  }
103  }
104 
105  // Main loop over algorithms
106  for (std::vector<int>::const_iterator iBit = algoBitNumbers1.begin(), endBits = algoBitNumbers1.end();
107  iBit != endBits;
108  ++iBit) {
109  L1GlobalTriggerObjectMap const *objMap = gtObjectMapRecord->getObjectMap(*iBit);
110  const std::string &algoName1 = objMap->algoName();
111 
112  if (algoName1 != algoNames2.at(*iBit)) {
113  cms::Exception ex("L1GlobalTrigger");
114  ex << "Algorithm names do not match";
115  ex.addContext("Calling CompareToObjectMapRecord::analyze");
116  throw ex;
117  }
118 
119  // Now test the algorithm results
120  if (objMap->algoGtlResult() != gtObjectMaps->algorithmResult(*iBit)) {
121  cms::Exception ex("L1GlobalTrigger");
122  ex << "Algorithm results do not match";
123  ex.addContext("Calling CompareToObjectMapRecord::analyze");
124  throw ex;
125  }
126 
127  std::vector<L1GtLogicParser::OperandToken> const &operandTokens1 = objMap->operandTokenVector();
128 
130  if (conditions2.nConditions() != operandTokens1.size()) {
131  cms::Exception ex("L1GlobalTrigger");
132  ex << "Number of conditions does not match";
133  ex.addContext("Calling CompareToObjectMapRecord::analyze");
134  throw ex;
135  }
136 
137  std::vector<std::string> conditionNames2;
138  conditionNames2 = pset->getParameter<std::vector<std::string>>(algoNames2.at(*iBit));
139 
140  // Print out data from L1GlobalTriggerObjectMaps and ParameterSet registry
141  if (verbose_) {
142  std::cout << *iBit << " " << algoNames2[*iBit] << " " << gtObjectMaps->algorithmResult(*iBit) << "\n";
143 
144  for (unsigned j = 0; j < gtObjectMaps->getNumberOfConditions(*iBit); ++j) {
146  std::cout << " " << j << " " << conditionNames2[j] << " " << conditions.getConditionResult(j) << "\n";
148  gtObjectMaps->getCombinationsInCondition(*iBit, j);
149  for (unsigned m = 0; m < combinations.nCombinations(); ++m) {
150  std::cout << " ";
151  for (unsigned n = 0; n < combinations.nObjectsPerCombination(); ++n) {
152  std::cout << " " << static_cast<unsigned>(combinations.getObjectIndex(m, n));
153  }
154  std::cout << "\n";
155  }
156  }
157  }
158 
159  // Loop over conditions
160  unsigned iCondition = 0;
161  for (std::vector<L1GtLogicParser::OperandToken>::const_iterator iToken1 = operandTokens1.begin(),
162  endTokens1 = operandTokens1.end();
163  iToken1 != endTokens1;
164  ++iToken1, ++iCondition) {
165  // Compare condition numbers
166  if (iToken1->tokenNumber != static_cast<int>(iCondition)) {
167  cms::Exception ex("L1GlobalTrigger");
168  ex << "Token numbers not sequential";
169  ex.addContext("Calling CompareToObjectMapRecord::analyze");
170  throw ex;
171  }
172 
173  // Compare condition names
174  if (iToken1->tokenResult != conditions2.getConditionResult(iCondition)) {
175  cms::Exception ex("L1GlobalTrigger");
176  ex << "Condition results do not match";
177  ex.addContext("Calling CompareToObjectMapRecord::analyze");
178  throw ex;
179  }
180 
181  // Compare condition names
182  if (iToken1->tokenName != conditionNames2.at(iCondition)) {
183  cms::Exception ex("L1GlobalTrigger");
184  ex << "Condition names do not match";
185  ex.addContext("Calling CompareToObjectMapRecord::analyze");
186  throw ex;
187  }
188 
189  // Compare the combinations of Indexes into the L1 collections
191  gtObjectMaps->getCombinationsInCondition(*iBit, iCondition);
192 
193  CombinationsInCond const *combinations1 = objMap->getCombinationsInCond(iToken1->tokenNumber);
194  if (combinations1->size() != combinations2.nCombinations()) {
195  cms::Exception ex("L1GlobalTrigger");
196  ex << "The number of combinations in a condition does not match";
197  ex.addContext("Calling CompareToObjectMapRecord::analyze");
198  throw ex;
199  }
200 
201  for (CombinationsInCond::const_iterator iCombo = combinations1->begin(), endCombos = combinations1->end();
202  iCombo != endCombos;
203  ++iCombo) {
204  if (iCombo->size() != combinations2.nObjectsPerCombination()) {
205  cms::Exception ex("L1GlobalTrigger");
206  ex << "The number of indexes in a combination does not match";
207  ex.addContext("Calling CompareToObjectMapRecord::analyze");
208  throw ex;
209  }
210 
211  for (std::vector<int>::const_iterator iIndex = iCombo->begin(), endIndexes = iCombo->end();
212  iIndex != endIndexes;
213  ++iIndex) {
214  if (*iIndex != combinations2.getObjectIndex(iCombo - combinations1->begin(), iIndex - iCombo->begin())) {
215  cms::Exception ex("L1GlobalTrigger");
216  ex << "Object index does not match";
217  ex.addContext("Calling CompareToObjectMapRecord::analyze");
218  throw ex;
219  }
220  }
221  }
222  }
223  }
224 }

References cms::Exception::addContext(), L1GlobalTriggerObjectMap::algoGtlResult(), L1GlobalTriggerObjectMap::algoName(), L1GlobalTriggerObjectMaps::algorithmResult(), submitPVValidationJobs::conditions, gather_cfg::cout, L1GlobalTriggerObjectMaps::getAlgorithmBitNumbers(), L1GlobalTriggerObjectMap::getCombinationsInCond(), L1GlobalTriggerObjectMaps::getCombinationsInCondition(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult(), L1GlobalTriggerObjectMaps::getConditionsInAlgorithm(), edm::pset::Registry::getMapped(), L1GlobalTriggerObjectMaps::getNumberOfConditions(), L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex(), L1GlobalTriggerObjectMapRecord::getObjectMap(), L1GlobalTriggerObjectMapRecord::gtObjectMap(), mps_fire::i, edm::pset::Registry::instance(), dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, m_l1GtObjectMapsTag, m_l1GtObjectMapTag, dqmiodumpmetadata::n, L1GlobalTriggerObjectMaps::namesParameterSetID(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::nConditions(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination(), L1GlobalTriggerObjectMap::operandTokenVector(), muonDTDigis_cfi::pset, edm::sort_all(), AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Member Data Documentation

◆ m_l1GtObjectMapsTag

edm::InputTag CompareToObjectMapRecord::m_l1GtObjectMapsTag
private

Definition at line 36 of file CompareToObjectMapRecord.h.

Referenced by analyze().

◆ m_l1GtObjectMapTag

edm::InputTag CompareToObjectMapRecord::m_l1GtObjectMapTag
private

Definition at line 35 of file CompareToObjectMapRecord.h.

Referenced by analyze().

◆ verbose_

bool CompareToObjectMapRecord::verbose_
private

Definition at line 37 of file CompareToObjectMapRecord.h.

Referenced by analyze().

edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
L1GlobalTriggerObjectMaps::getCombinationsInCondition
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
Definition: L1GlobalTriggerObjectMaps.cc:94
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
L1GlobalTriggerObjectMaps::namesParameterSetID
edm::ParameterSetID const & namesParameterSetID() const
Definition: L1GlobalTriggerObjectMaps.h:64
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult
bool getConditionResult(unsigned condition) const
Definition: L1GlobalTriggerObjectMaps.cc:251
edm::sort_all
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1GlobalTriggerObjectMap::algoName
const std::string & algoName() const
get / set name for algorithm in the object map
Definition: L1GlobalTriggerObjectMap.h:43
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::nConditions
unsigned nConditions() const
Definition: L1GlobalTriggerObjectMaps.h:123
L1GlobalTriggerObjectMap::operandTokenVector
const std::vector< L1GtLogicParser::OperandToken > & operandTokenVector() const
Definition: L1GlobalTriggerObjectMap.h:71
CombinationsInCond
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
Definition: L1GlobalTriggerObjectMapFwd.h:32
edm::Handle
Definition: AssociativeIterator.h:50
L1GlobalTriggerObjectMap::algoGtlResult
bool algoGtlResult() const
Definition: L1GlobalTriggerObjectMap.h:54
L1GlobalTriggerObjectMap
Definition: L1GlobalTriggerObjectMap.h:33
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm
Definition: L1GlobalTriggerObjectMaps.h:120
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GlobalTriggerObjectMaps::CombinationsInCondition
Definition: L1GlobalTriggerObjectMaps.h:131
L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations
unsigned nCombinations() const
Definition: L1GlobalTriggerObjectMaps.h:137
edm::ParameterSet
Definition: ParameterSet.h:47
L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination
unsigned short nObjectsPerCombination() const
Definition: L1GlobalTriggerObjectMaps.h:138
L1GlobalTriggerObjectMaps::algorithmResult
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
Definition: L1GlobalTriggerObjectMaps.cc:39
L1GlobalTriggerObjectMapRecord::getObjectMap
const L1GlobalTriggerObjectMap * getObjectMap(const std::string &algoNameVal) const
return the object map for the algorithm algoNameVal
Definition: L1GlobalTriggerObjectMapRecord.cc:33
CompareToObjectMapRecord::m_l1GtObjectMapTag
edm::InputTag m_l1GtObjectMapTag
Definition: CompareToObjectMapRecord.h:35
L1GlobalTriggerObjectMaps::getConditionsInAlgorithm
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
Definition: L1GlobalTriggerObjectMaps.cc:86
L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex
unsigned char getObjectIndex(unsigned combination, unsigned object) const
Definition: L1GlobalTriggerObjectMaps.cc:268
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
CompareToObjectMapRecord::m_l1GtObjectMapsTag
edm::InputTag m_l1GtObjectMapsTag
Definition: CompareToObjectMapRecord.h:36
L1GlobalTriggerObjectMap::getCombinationsInCond
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal
Definition: L1GlobalTriggerObjectMap.cc:34
L1GlobalTriggerObjectMapRecord::gtObjectMap
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
Definition: L1GlobalTriggerObjectMapRecord.h:64
L1GlobalTriggerObjectMaps::getNumberOfConditions
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
Definition: L1GlobalTriggerObjectMaps.cc:79
cms::Exception
Definition: Exception.h:70
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1GlobalTriggerObjectMaps::getAlgorithmBitNumbers
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
Definition: L1GlobalTriggerObjectMaps.cc:70
CompareToObjectMapRecord::verbose_
bool verbose_
Definition: CompareToObjectMapRecord.h:37
edm::pset::Registry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
edm::InputTag
Definition: InputTag.h:15
edm::pset::Registry
Definition: Registry.h:26
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27