CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtTriggerMenuLiteProducer.cc
Go to the documentation of this file.
1 
19 // this class header
21 
22 // system include files
23 #include <iostream>
24 
25 // user include files
27 
30 
34 
37 
40 
43 
47 
51 
52 // constructor(s)
54  const edm::ParameterSet& parSet) :
55  m_l1GtStableParCacheID(0ULL), m_numberPhysTriggers(0),
56 
57  m_numberTechnicalTriggers(0),
58 
59  m_l1GtMenuCacheID(0ULL),
60 
61  m_l1GtTmAlgoCacheID(0ULL), m_l1GtTmTechCacheID(0ULL),
62 
63  m_l1GtPfAlgoCacheID(0ULL), m_l1GtPfTechCacheID(0ULL),
64 
65  m_physicsDaqPartition(0) {
66 
67  // EDM product in Run Data
68  produces<L1GtTriggerMenuLite, edm::InRun>();
69 
70 }
71 
72 // destructor
74 
75  // empty
76 
77 }
78 
80 
81  // get / update the stable parameters from the EventSetup
82  // local cache & check on cacheIdentifier
83 
84  unsigned long long l1GtStableParCacheID =
85  evSetup.get<L1GtStableParametersRcd>().cacheIdentifier();
86 
87  if (m_l1GtStableParCacheID != l1GtStableParCacheID) {
88 
90  evSetup.get<L1GtStableParametersRcd>().get(l1GtStablePar);
91  m_l1GtStablePar = l1GtStablePar.product();
92 
93  // number of physics triggers
95 
96  // number of technical triggers
99 
100  //
101  m_l1GtStableParCacheID = l1GtStableParCacheID;
102 
103  }
104 
105  // get / update the prescale factors from the EventSetup
106  // local cache & check on cacheIdentifier
107 
108  unsigned long long l1GtPfAlgoCacheID =
109  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().cacheIdentifier();
110 
111  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
112 
114  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
115  m_l1GtPfAlgo = l1GtPfAlgo.product();
116 
118 
119  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
120 
121  }
122 
123  unsigned long long l1GtPfTechCacheID = evSetup.get<
124  L1GtPrescaleFactorsTechTrigRcd>().cacheIdentifier();
125 
126  if (m_l1GtPfTechCacheID != l1GtPfTechCacheID) {
127 
129  evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
130  m_l1GtPfTech = l1GtPfTech.product();
131 
133 
134  m_l1GtPfTechCacheID = l1GtPfTechCacheID;
135 
136  }
137 
138  // get / update the trigger mask from the EventSetup
139  // local cache & check on cacheIdentifier
140 
141  unsigned long long l1GtTmAlgoCacheID =
142  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
143 
144  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
145 
147  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
148  m_l1GtTmAlgo = l1GtTmAlgo.product();
149 
151 
152  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
153 
154  }
155 
156  unsigned long long l1GtTmTechCacheID =
157  evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
158 
159  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
160 
162  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
163  m_l1GtTmTech = l1GtTmTech.product();
164 
166 
167  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
168 
169  }
170 
171 
172  // get / update the trigger menu from the EventSetup
173  // local cache & check on cacheIdentifier
174 
175  unsigned long long l1GtMenuCacheID =
176  evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
177 
178  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
179 
181  evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
182  m_l1GtMenu = l1GtMenu.product();
183 
186 
188 
189  m_l1GtMenuCacheID = l1GtMenuCacheID;
190 
191  }
192 
193 }
194 
195 // member functions
196 
198  // empty
199 }
200 
202  const edm::EventSetup& evSetup) {
203 
204  //
205 
206  retrieveL1EventSetup(evSetup);
207 
208  // produce the L1GtTriggerMenuLite
209  std::auto_ptr<L1GtTriggerMenuLite> gtTriggerMenuLite(new L1GtTriggerMenuLite());
210 
211  // lite L1 trigger menu
212 
213  gtTriggerMenuLite->setGtTriggerMenuInterface(m_l1GtMenu->gtTriggerMenuInterface());
214  gtTriggerMenuLite->setGtTriggerMenuName(m_l1GtMenu->gtTriggerMenuName());
215  gtTriggerMenuLite->setGtTriggerMenuImplementation(m_l1GtMenu->gtTriggerMenuImplementation());
216 
217  gtTriggerMenuLite->setGtScaleDbKey(m_l1GtMenu->gtScaleDbKey());
218 
219  //
221  for (CItAlgo itAlgo = m_algorithmMap->begin(); itAlgo
222  != m_algorithmMap->end(); itAlgo++) {
223 
224  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
225  algMap[bitNumber] = itAlgo->first;
226 
227  }
228 
229  gtTriggerMenuLite->setGtAlgorithmMap(algMap);
230 
231  //
233  for (CItAlgo itAlgo = m_algorithmAliasMap->begin(); itAlgo
234  != m_algorithmAliasMap->end(); itAlgo++) {
235 
236  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
237  algAliasMap[bitNumber] = itAlgo->first;
238 
239  }
240 
241  gtTriggerMenuLite->setGtAlgorithmAliasMap(algAliasMap);
242 
243  //
245  for (CItAlgo itAlgo = m_technicalTriggerMap->begin(); itAlgo
246  != m_technicalTriggerMap->end(); itAlgo++) {
247 
248  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
249  techMap[bitNumber] = itAlgo->first;
250 
251  }
252 
253  gtTriggerMenuLite->setGtTechnicalTriggerMap(techMap);
254 
255  // trigger masks
256  std::vector<unsigned int> triggerMaskAlgoTrig(m_numberPhysTriggers, 0);
257  int iBit = -1;
258 
259  for (std::vector<unsigned int>::const_iterator
260  itBit = m_triggerMaskAlgoTrig->begin();
261  itBit != m_triggerMaskAlgoTrig->end();
262  itBit++) {
263 
264  iBit++;
265  triggerMaskAlgoTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
266  }
267  gtTriggerMenuLite->setGtTriggerMaskAlgoTrig(triggerMaskAlgoTrig);
268 
269  //
270  std::vector<unsigned int> triggerMaskTechTrig(m_numberTechnicalTriggers, 0);
271  iBit = -1;
272 
273  for (std::vector<unsigned int>::const_iterator
274  itBit = m_triggerMaskTechTrig->begin();
275  itBit != m_triggerMaskTechTrig->end();
276  itBit++) {
277 
278  iBit++;
279  triggerMaskTechTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
280  }
281  gtTriggerMenuLite->setGtTriggerMaskTechTrig(triggerMaskTechTrig);
282 
283 
284  //
285  gtTriggerMenuLite->setGtPrescaleFactorsAlgoTrig(*m_prescaleFactorsAlgoTrig);
286  gtTriggerMenuLite->setGtPrescaleFactorsTechTrig(*m_prescaleFactorsTechTrig);
287 
288 
289  // print menu, trigger masks and prescale factors
290  if (edm::isDebugEnabled()) {
291 
292  LogDebug("L1GtTriggerMenuLiteProducer") << *gtTriggerMenuLite;
293 
294  }
295 
296  // put records into event
297  iRun.put(gtTriggerMenuLite);
298 
299 }
300 
302  const edm::EventSetup& evSetup) {
303 
304 
305 }
306 
307 //
309 
310  // empty now
311 }
312 
313 // static class members
314 
315 //define this as a plug-in
#define LogDebug(id)
const std::string & gtTriggerMenuName() const
bool isDebugEnabled()
virtual void beginJob() overridefinal
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
unsigned int m_physicsDaqPartition
index of physics DAQ partition
const L1GtPrescaleFactors * m_l1GtPfTech
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
const std::string & gtTriggerMenuImplementation() const
unsigned int m_numberPhysTriggers
number of physics triggers
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
unsigned int gtNumberTechnicalTriggers() const
get / set the number of technical triggers
void retrieveL1EventSetup(const edm::EventSetup &)
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
unsigned int m_numberTechnicalTriggers
number of technical triggers
int iEvent
Definition: GenABIO.cc:243
L1GtTriggerMenuLiteProducer(const edm::ParameterSet &)
constructor(s)
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
const std::vector< unsigned int > * m_triggerMaskTechTrig
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
const std::string & gtScaleDbKey() const
menu associated scale key
void beginRunProduce(edm::Run &, const edm::EventSetup &) overridefinal
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
const std::string & gtTriggerMenuInterface() const
get / set the trigger menu names
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
virtual ~L1GtTriggerMenuLiteProducer()
destructor
virtual void produce(edm::Event &, const edm::EventSetup &) overridefinal
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
const L1GtStableParameters * m_l1GtStablePar
cached stuff
void put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Run.h:86
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
Definition: Run.h:36