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 
17 // this class header
19 
20 // system include files
21 #include <iostream>
22 
23 // user include files
25 
28 
32 
35 
38 
41 
45 
49 
50 // constructor(s)
52  const edm::ParameterSet& parSet) :
53  m_l1GtStableParCacheID(0ULL), m_numberPhysTriggers(0),
54 
55  m_numberTechnicalTriggers(0),
56 
57  m_l1GtMenuCacheID(0ULL),
58 
59  m_l1GtTmAlgoCacheID(0ULL), m_l1GtTmTechCacheID(0ULL),
60 
61  m_l1GtPfAlgoCacheID(0ULL), m_l1GtPfTechCacheID(0ULL),
62 
63  m_physicsDaqPartition(0) {
64 
65  // EDM product in Run Data
66  produces<L1GtTriggerMenuLite, edm::InRun>();
67 
68 }
69 
70 // destructor
72 
73  // empty
74 
75 }
76 
78 
79  // get / update the stable parameters from the EventSetup
80  // local cache & check on cacheIdentifier
81 
82  unsigned long long l1GtStableParCacheID =
83  evSetup.get<L1GtStableParametersRcd>().cacheIdentifier();
84 
85  if (m_l1GtStableParCacheID != l1GtStableParCacheID) {
86 
88  evSetup.get<L1GtStableParametersRcd>().get(l1GtStablePar);
89  m_l1GtStablePar = l1GtStablePar.product();
90 
91  // number of physics triggers
93 
94  // number of technical triggers
97 
98  //
99  m_l1GtStableParCacheID = l1GtStableParCacheID;
100 
101  }
102 
103  // get / update the prescale factors from the EventSetup
104  // local cache & check on cacheIdentifier
105 
106  unsigned long long l1GtPfAlgoCacheID =
107  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().cacheIdentifier();
108 
109  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
110 
112  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
113  m_l1GtPfAlgo = l1GtPfAlgo.product();
114 
116 
117  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
118 
119  }
120 
121  unsigned long long l1GtPfTechCacheID = evSetup.get<
122  L1GtPrescaleFactorsTechTrigRcd>().cacheIdentifier();
123 
124  if (m_l1GtPfTechCacheID != l1GtPfTechCacheID) {
125 
127  evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
128  m_l1GtPfTech = l1GtPfTech.product();
129 
131 
132  m_l1GtPfTechCacheID = l1GtPfTechCacheID;
133 
134  }
135 
136  // get / update the trigger mask from the EventSetup
137  // local cache & check on cacheIdentifier
138 
139  unsigned long long l1GtTmAlgoCacheID =
140  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
141 
142  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
143 
145  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
146  m_l1GtTmAlgo = l1GtTmAlgo.product();
147 
149 
150  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
151 
152  }
153 
154  unsigned long long l1GtTmTechCacheID =
155  evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
156 
157  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
158 
160  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
161  m_l1GtTmTech = l1GtTmTech.product();
162 
164 
165  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
166 
167  }
168 
169 
170  // get / update the trigger menu from the EventSetup
171  // local cache & check on cacheIdentifier
172 
173  unsigned long long l1GtMenuCacheID =
174  evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
175 
176  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
177 
179  evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
180  m_l1GtMenu = l1GtMenu.product();
181 
184 
186 
187  m_l1GtMenuCacheID = l1GtMenuCacheID;
188 
189  }
190 
191 }
192 
193 // member functions
194 
196  // empty
197 }
198 
200  const edm::EventSetup& evSetup) {
201 
202  //
203 
204  retrieveL1EventSetup(evSetup);
205 
206  // produce the L1GtTriggerMenuLite
207  std::auto_ptr<L1GtTriggerMenuLite> gtTriggerMenuLite(new L1GtTriggerMenuLite());
208 
209  // lite L1 trigger menu
210 
211  gtTriggerMenuLite->setGtTriggerMenuInterface(m_l1GtMenu->gtTriggerMenuInterface());
212  gtTriggerMenuLite->setGtTriggerMenuName(m_l1GtMenu->gtTriggerMenuName());
213  gtTriggerMenuLite->setGtTriggerMenuImplementation(m_l1GtMenu->gtTriggerMenuImplementation());
214 
215  gtTriggerMenuLite->setGtScaleDbKey(m_l1GtMenu->gtScaleDbKey());
216 
217  //
219  for (CItAlgo itAlgo = m_algorithmMap->begin(); itAlgo
220  != m_algorithmMap->end(); itAlgo++) {
221 
222  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
223  algMap[bitNumber] = itAlgo->first;
224 
225  }
226 
227  gtTriggerMenuLite->setGtAlgorithmMap(algMap);
228 
229  //
231  for (CItAlgo itAlgo = m_algorithmAliasMap->begin(); itAlgo
232  != m_algorithmAliasMap->end(); itAlgo++) {
233 
234  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
235  algAliasMap[bitNumber] = itAlgo->first;
236 
237  }
238 
239  gtTriggerMenuLite->setGtAlgorithmAliasMap(algAliasMap);
240 
241  //
243  for (CItAlgo itAlgo = m_technicalTriggerMap->begin(); itAlgo
244  != m_technicalTriggerMap->end(); itAlgo++) {
245 
246  unsigned int bitNumber = (itAlgo->second).algoBitNumber();
247  techMap[bitNumber] = itAlgo->first;
248 
249  }
250 
251  gtTriggerMenuLite->setGtTechnicalTriggerMap(techMap);
252 
253  // trigger masks
254  std::vector<unsigned int> triggerMaskAlgoTrig(m_numberPhysTriggers, 0);
255  int iBit = -1;
256 
257  for (std::vector<unsigned int>::const_iterator
258  itBit = m_triggerMaskAlgoTrig->begin();
259  itBit != m_triggerMaskAlgoTrig->end();
260  itBit++) {
261 
262  iBit++;
263  triggerMaskAlgoTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
264  }
265  gtTriggerMenuLite->setGtTriggerMaskAlgoTrig(triggerMaskAlgoTrig);
266 
267  //
268  std::vector<unsigned int> triggerMaskTechTrig(m_numberTechnicalTriggers, 0);
269  iBit = -1;
270 
271  for (std::vector<unsigned int>::const_iterator
272  itBit = m_triggerMaskTechTrig->begin();
273  itBit != m_triggerMaskTechTrig->end();
274  itBit++) {
275 
276  iBit++;
277  triggerMaskTechTrig[iBit] = (*itBit) & (1 << m_physicsDaqPartition);
278  }
279  gtTriggerMenuLite->setGtTriggerMaskTechTrig(triggerMaskTechTrig);
280 
281 
282  //
283  gtTriggerMenuLite->setGtPrescaleFactorsAlgoTrig(*m_prescaleFactorsAlgoTrig);
284  gtTriggerMenuLite->setGtPrescaleFactorsTechTrig(*m_prescaleFactorsTechTrig);
285 
286 
287  // print menu, trigger masks and prescale factors
288  if (edm::isDebugEnabled()) {
289 
290  LogDebug("L1GtTriggerMenuLiteProducer") << *gtTriggerMenuLite;
291 
292  }
293 
294  // put records into event
295  iRun.put(gtTriggerMenuLite);
296 
297 }
298 
300  const edm::EventSetup& evSetup) {
301 
302 
303 }
304 
305 //
307 
308  // empty now
309 }
310 
311 // static class members
312 
313 //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:230
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:86
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:107
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:41