CMS 3D CMS Logo

L1GtTriggerMenuLiteProducer.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iostream>
22 
23 // user include files
25 
28 
32 
35 
36 // constructor(s)
38  : m_l1GtStableParCacheID(0ULL),
39  m_numberPhysTriggers(0),
40 
41  m_numberTechnicalTriggers(0),
42 
43  m_l1GtMenuCacheID(0ULL),
44 
45  m_l1GtTmAlgoCacheID(0ULL),
46  m_l1GtTmTechCacheID(0ULL),
47 
48  m_l1GtPfAlgoCacheID(0ULL),
49  m_l1GtPfTechCacheID(0ULL),
50 
51  m_l1GtStableParamToken(esConsumes<L1GtStableParameters, L1GtStableParametersRcd, edm::Transition::BeginRun>()),
54  m_l1GtTmAlgoToken(esConsumes<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd, edm::Transition::BeginRun>()),
55  m_l1GtTmTechToken(esConsumes<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd, edm::Transition::BeginRun>()),
56  m_l1GtMenuToken(esConsumes<L1GtTriggerMenu, L1GtTriggerMenuRcd, edm::Transition::BeginRun>()),
57  m_physicsDaqPartition(0) {
58  // EDM product in Run Data
59  produces<L1GtTriggerMenuLite, edm::Transition::BeginRun>();
60 }
61 
62 // destructor
64  // empty
65 }
66 
68  // get / update the stable parameters from the EventSetup
69  // local cache & check on cacheIdentifier
70 
71  unsigned long long l1GtStableParCacheID = evSetup.get<L1GtStableParametersRcd>().cacheIdentifier();
72 
73  if (m_l1GtStableParCacheID != l1GtStableParCacheID) {
75  m_l1GtStablePar = l1GtStablePar.product();
76 
77  // number of physics triggers
79 
80  // number of technical triggers
82 
83  //
84  m_l1GtStableParCacheID = l1GtStableParCacheID;
85  }
86 
87  // get / update the prescale factors from the EventSetup
88  // local cache & check on cacheIdentifier
89 
90  unsigned long long l1GtPfAlgoCacheID = evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().cacheIdentifier();
91 
92  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
94  m_l1GtPfAlgo = l1GtPfAlgo.product();
95 
97 
98  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
99  }
100 
101  unsigned long long l1GtPfTechCacheID = evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().cacheIdentifier();
102 
103  if (m_l1GtPfTechCacheID != l1GtPfTechCacheID) {
105  m_l1GtPfTech = l1GtPfTech.product();
106 
108 
109  m_l1GtPfTechCacheID = l1GtPfTechCacheID;
110  }
111 
112  // get / update the trigger mask from the EventSetup
113  // local cache & check on cacheIdentifier
114 
115  unsigned long long l1GtTmAlgoCacheID = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
116 
117  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
119  m_l1GtTmAlgo = l1GtTmAlgo.product();
120 
122 
123  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
124  }
125 
126  unsigned long long l1GtTmTechCacheID = evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
127 
128  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
130  m_l1GtTmTech = l1GtTmTech.product();
131 
133 
134  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
135  }
136 
137  // get / update the trigger menu from the EventSetup
138  // local cache & check on cacheIdentifier
139 
140  unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
141 
142  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
144  m_l1GtMenu = l1GtMenu.product();
145 
148 
150 
151  m_l1GtMenuCacheID = l1GtMenuCacheID;
152  }
153 }
154 
155 // member functions
156 
158  // empty
159 }
160 
162  //
163 
164  retrieveL1EventSetup(evSetup);
165 
166  // produce the L1GtTriggerMenuLite
167  std::unique_ptr<L1GtTriggerMenuLite> gtTriggerMenuLite(new L1GtTriggerMenuLite());
168 
169  // lite L1 trigger menu
170 
171  gtTriggerMenuLite->setGtTriggerMenuInterface(m_l1GtMenu->gtTriggerMenuInterface());
172  gtTriggerMenuLite->setGtTriggerMenuName(m_l1GtMenu->gtTriggerMenuName());
173  gtTriggerMenuLite->setGtTriggerMenuImplementation(m_l1GtMenu->gtTriggerMenuImplementation());
174 
175  gtTriggerMenuLite->setGtScaleDbKey(m_l1GtMenu->gtScaleDbKey());
176 
177  //
179  for (CItAlgo itAlgo = m_algorithmMap->begin(); itAlgo != m_algorithmMap->end(); itAlgo++) {
180  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
181  algMap[bitNumber] = itAlgo->first;
182  }
183 
184  gtTriggerMenuLite->setGtAlgorithmMap(algMap);
185 
186  //
188  for (CItAlgo itAlgo = m_algorithmAliasMap->begin(); itAlgo != m_algorithmAliasMap->end(); itAlgo++) {
189  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
190  algAliasMap[bitNumber] = itAlgo->first;
191  }
192 
193  gtTriggerMenuLite->setGtAlgorithmAliasMap(algAliasMap);
194 
195  //
197  for (CItAlgo itAlgo = m_technicalTriggerMap->begin(); itAlgo != m_technicalTriggerMap->end(); itAlgo++) {
198  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
199  techMap[bitNumber] = itAlgo->first;
200  }
201 
202  gtTriggerMenuLite->setGtTechnicalTriggerMap(techMap);
203 
204  // trigger masks
205  std::vector<unsigned int> triggerMaskAlgoTrig(m_numberPhysTriggers, 0);
206  int iBit = -1;
207 
208  for (std::vector<unsigned int>::const_iterator itBit = m_triggerMaskAlgoTrig->begin();
209  itBit != m_triggerMaskAlgoTrig->end();
210  itBit++) {
211  iBit++;
212  triggerMaskAlgoTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
213  }
214  gtTriggerMenuLite->setGtTriggerMaskAlgoTrig(triggerMaskAlgoTrig);
215 
216  //
217  std::vector<unsigned int> triggerMaskTechTrig(m_numberTechnicalTriggers, 0);
218  iBit = -1;
219 
220  for (std::vector<unsigned int>::const_iterator itBit = m_triggerMaskTechTrig->begin();
221  itBit != m_triggerMaskTechTrig->end();
222  itBit++) {
223  iBit++;
224  triggerMaskTechTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
225  }
226  gtTriggerMenuLite->setGtTriggerMaskTechTrig(triggerMaskTechTrig);
227 
228  //
229  gtTriggerMenuLite->setGtPrescaleFactorsAlgoTrig(*m_prescaleFactorsAlgoTrig);
230  gtTriggerMenuLite->setGtPrescaleFactorsTechTrig(*m_prescaleFactorsTechTrig);
231 
232  // print menu, trigger masks and prescale factors
233  if (edm::isDebugEnabled()) {
234  LogDebug("L1GtTriggerMenuLiteProducer") << *gtTriggerMenuLite;
235  }
236 
237  // put records into event
238  iRun.put(std::move(gtTriggerMenuLite));
239 }
240 
242 
243 //
245  // empty now
246 }
247 
248 // static class members
249 
250 //define this as a plug-in
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
bool isDebugEnabled()
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const std::string & gtTriggerMenuInterface() const
get / set the trigger menu names
const edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_l1GtTmAlgoToken
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
~L1GtTriggerMenuLiteProducer() override
destructor
void beginRunProduce(edm::Run &, const edm::EventSetup &) final
unsigned int m_physicsDaqPartition
index of physics DAQ partition
const L1GtPrescaleFactors * m_l1GtPfTech
const edm::ESGetToken< L1GtStableParameters, L1GtStableParametersRcd > m_l1GtStableParamToken
EventSetup Tokens.
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
unsigned int m_numberPhysTriggers
number of physics triggers
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
const edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > m_l1GtPfAlgoToken
const edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_l1GtTmTechToken
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
const std::string & gtTriggerMenuName() const
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
const std::string & gtScaleDbKey() const
menu associated scale key
void retrieveL1EventSetup(const edm::EventSetup &)
unsigned int m_numberTechnicalTriggers
number of technical triggers
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
void produce(edm::Event &, const edm::EventSetup &) final
L1GtTriggerMenuLiteProducer(const edm::ParameterSet &)
constructor(s)
const std::vector< unsigned int > * m_triggerMaskTechTrig
const edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > m_l1GtPfTechToken
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_l1GtMenuToken
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
T get() const
Definition: EventSetup.h:82
Transition
Definition: Transition.h:12
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const std::string & gtTriggerMenuImplementation() const
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
HLT enums.
const L1GtStableParameters * m_l1GtStablePar
cached stuff
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
#define LogDebug(id)