CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtTriggerMenuTester.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iomanip>
22 
23 // user include files
24 // base class
26 
29 
32 
35 
37 
40 
42 
45 
48 
49 // forward declarations
50 
51 // constructor(s)
53  // empty
54 }
55 
56 // destructor
58  // empty
59 }
60 
61 // loop over events
63  const edm::EventSetup& evSetup) {
64 
66  evSetup.get< L1GtTriggerMenuRcd>().get(l1GtMenu);
67  (const_cast<L1GtTriggerMenu*>(l1GtMenu.product()))->buildGtConditionMap();
68 
69  // print with various level of verbosities
70 
71  int printVerbosity = 0;
72  l1GtMenu->print(std::cout, printVerbosity);
73  std::cout << std::flush << std::endl;
74 
75  printVerbosity = 1;
76  l1GtMenu->print(std::cout, printVerbosity);
77  std::cout << std::flush << std::endl;
78 
79  printVerbosity = 2;
80  l1GtMenu->print(std::cout, printVerbosity);
81  std::cout << std::flush << std::endl;
82 
83  //
84  // print menu, prescale factors and trigger mask in wiki format
85  //
86 
87  // L1 GT prescale factors for algorithm triggers
89  evSetup.get< L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
90 
91  int indexPfSet = 0; // FIXME
92 
93  std::vector<int> prescaleFactorsAlgoTrig =
94  (l1GtPfAlgo->gtPrescaleFactors()).at(indexPfSet);
95 
96 
97  // L1 GT prescale factors for technical triggers
99  evSetup.get< L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
100 
101  std::vector<int> prescaleFactorsTechTrig =
102  (l1GtPfTech->gtPrescaleFactors()).at(indexPfSet);
103 
104 
105  // L1 GT trigger masks for algorithm triggers
107  evSetup.get< L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
108 
109  std::vector<unsigned int> triggerMaskAlgoTrig = l1GtTmAlgo->gtTriggerMask();
110 
111 
112  // L1 GT trigger masks for technical triggers
114  evSetup.get< L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
115 
116  std::vector<unsigned int> triggerMaskTechTrig = l1GtTmTech->gtTriggerMask();
117 
118 
119  // L1 GT trigger veto masks for algorithm triggers
120  edm::ESHandle< L1GtTriggerMask> l1GtTmVetoAlgo;
121  evSetup.get< L1GtTriggerMaskVetoAlgoTrigRcd>().get(l1GtTmVetoAlgo);
122 
123  std::vector<unsigned int> triggerMaskVetoAlgoTrig = l1GtTmVetoAlgo->gtTriggerMask();
124 
125 
126  // L1 GT trigger veto masks for technical triggers
127  edm::ESHandle< L1GtTriggerMask> l1GtTmVetoTech;
128  evSetup.get< L1GtTriggerMaskVetoTechTrigRcd>().get(l1GtTmVetoTech);
129 
130  std::vector<unsigned int> triggerMaskVetoTechTrig = l1GtTmVetoTech->gtTriggerMask();
131 
132  // set the index of physics DAQ partition TODO EventSetup?
133  int physicsDaqPartition = 0;
134 
135  // use another map <int, L1GtAlgorithm> to get the menu sorted after bit number
136  // both algorithm and bit numbers are unique
137  typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
138 
139  // physics algorithms
140  std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
141  const AlgorithmMap& algorithmMap = l1GtMenu->gtAlgorithmMap();
142 
143  for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
144 
145  int bitNumber = (itAlgo->second).algoBitNumber();
146  algoBitToAlgo[bitNumber] = &(itAlgo->second);
147  }
148 
149  // technical triggers
150  std::map<int, const L1GtAlgorithm*> techBitToAlgo;
151  const AlgorithmMap& technicalTriggerMap = l1GtMenu->gtTechnicalTriggerMap();
152 
153  for (CItAlgo itAlgo = technicalTriggerMap.begin(); itAlgo != technicalTriggerMap.end(); itAlgo++) {
154 
155  int bitNumber = (itAlgo->second).algoBitNumber();
156  techBitToAlgo[bitNumber] = &(itAlgo->second);
157  }
158 
159  // header for printing algorithms
160 
161  std::cout << "\n ********** L1 Trigger Menu - printing ********** \n\n"
162  << "\n---+++ Summary\n"
163  << "\n|L1 Trigger Menu Interface: |!" << l1GtMenu->gtTriggerMenuInterface() << " |"
164  << "\n|L1 Trigger Menu Name: |!" << l1GtMenu->gtTriggerMenuName() << " |"
165  << "\n|L1 Trigger Menu Implementation: |!" << l1GtMenu->gtTriggerMenuImplementation() << " |"
166  << "\n|Associated L1 scale DB key: |!" << l1GtMenu->gtScaleDbKey() << " |" << "\n\n"
167  << std::flush << std::endl;
168 
169  std::cout << "\n---+++ List of physics algorithms\n" << std::endl;
170 
171  std::cout
172  << "| *Algorithm* | *Alias* | *Bit number* | *Prescale factor* | *Mask* |"
173  << std::endl;
174 
175  for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
176 
177  int bitNumber = itBit->first;
178  std::string aName = (itBit->second)->algoName();
179  std::string aAlias = (itBit->second)->algoAlias();
180 
181  unsigned int triggerMaskAlgo =
182  (triggerMaskAlgoTrig.at(bitNumber)) & (1 << physicsDaqPartition);
183 
184  std::cout
185  << "|" << std::left << aName << " |" << aAlias << " | " << std::right << bitNumber
186  << "| " << prescaleFactorsAlgoTrig.at(bitNumber)
187  << "| " << triggerMaskAlgo
188  << " |"
189  << std::endl;
190  }
191 
192  std::cout << "\n---+++ List of technical triggers\n" << std::endl;
193 
194  std::cout
195  << "| *Technical trigger* | *Bit number* | *Prescale factor* | *Mask* | *Veto mask* |"
196  << std::endl;
197 
198  for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
199 
200  int bitNumber = itBit->first;
201  std::string aName = (itBit->second)->algoName();
202  std::string aAlias = (itBit->second)->algoAlias();
203 
204  unsigned int triggerMaskTech =
205  (triggerMaskTechTrig.at(bitNumber)) & (1 << physicsDaqPartition);
206  unsigned int triggerMaskVetoTech =
207  (triggerMaskVetoTechTrig.at(bitNumber)) & (1 << physicsDaqPartition);
208 
209  std::cout
210  << "|!" << std::left << aName << " | " << std::right << bitNumber
211  << "| " << prescaleFactorsTechTrig.at(bitNumber)
212  << "| " << triggerMaskTech
213  << "| " << triggerMaskVetoTech
214  << " |"
215  << std::endl;
216  }
217 
218  std::cout
219  << "\nNOTE: only the prescale factors from set index zero are printed!"
220  << std::endl;
221 
222 }
L1GtTriggerMenuTester(const edm::ParameterSet &)
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
int iEvent
Definition: GenABIO.cc:243
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
tuple cout
Definition: gather_cfg.py:41
list at
Definition: asciidump.py:428