Go to the documentation of this file.00001
00017
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuTester.h"
00019
00020
00021 #include <iomanip>
00022
00023
00024
00025 #include "FWCore/Framework/interface/EDAnalyzer.h"
00026
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00029
00030 #include "FWCore/Framework/interface/EventSetup.h"
00031 #include "FWCore/Framework/interface/ESHandle.h"
00032
00033 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00034 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00035
00036 #include "CondFormats/L1TObjects/interface/L1GtPrescaleFactors.h"
00037
00038 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsAlgoTrigRcd.h"
00039 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsTechTrigRcd.h"
00040
00041 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
00042
00043 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
00044 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
00045
00046 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoAlgoTrigRcd.h"
00047 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoTechTrigRcd.h"
00048
00049
00050
00051
00052 L1GtTriggerMenuTester::L1GtTriggerMenuTester(const edm::ParameterSet& parSet) {
00053
00054 }
00055
00056
00057 L1GtTriggerMenuTester::~L1GtTriggerMenuTester() {
00058
00059 }
00060
00061
00062 void L1GtTriggerMenuTester::analyze(const edm::Event& iEvent,
00063 const edm::EventSetup& evSetup) {
00064
00065 edm::ESHandle< L1GtTriggerMenu> l1GtMenu;
00066 evSetup.get< L1GtTriggerMenuRcd>().get(l1GtMenu);
00067 (const_cast<L1GtTriggerMenu*>(l1GtMenu.product()))->buildGtConditionMap();
00068
00069
00070
00071 int printVerbosity = 0;
00072 l1GtMenu->print(std::cout, printVerbosity);
00073 std::cout << std::flush << std::endl;
00074
00075 printVerbosity = 1;
00076 l1GtMenu->print(std::cout, printVerbosity);
00077 std::cout << std::flush << std::endl;
00078
00079 printVerbosity = 2;
00080 l1GtMenu->print(std::cout, printVerbosity);
00081 std::cout << std::flush << std::endl;
00082
00083
00084
00085
00086
00087
00088 edm::ESHandle< L1GtPrescaleFactors> l1GtPfAlgo;
00089 evSetup.get< L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
00090
00091 int indexPfSet = 0;
00092
00093 std::vector<int> prescaleFactorsAlgoTrig =
00094 (l1GtPfAlgo->gtPrescaleFactors()).at(indexPfSet);
00095
00096
00097
00098 edm::ESHandle< L1GtPrescaleFactors> l1GtPfTech;
00099 evSetup.get< L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
00100
00101 std::vector<int> prescaleFactorsTechTrig =
00102 (l1GtPfTech->gtPrescaleFactors()).at(indexPfSet);
00103
00104
00105
00106 edm::ESHandle< L1GtTriggerMask> l1GtTmAlgo;
00107 evSetup.get< L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
00108
00109 std::vector<unsigned int> triggerMaskAlgoTrig = l1GtTmAlgo->gtTriggerMask();
00110
00111
00112
00113 edm::ESHandle< L1GtTriggerMask> l1GtTmTech;
00114 evSetup.get< L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
00115
00116 std::vector<unsigned int> triggerMaskTechTrig = l1GtTmTech->gtTriggerMask();
00117
00118
00119
00120 edm::ESHandle< L1GtTriggerMask> l1GtTmVetoAlgo;
00121 evSetup.get< L1GtTriggerMaskVetoAlgoTrigRcd>().get(l1GtTmVetoAlgo);
00122
00123 std::vector<unsigned int> triggerMaskVetoAlgoTrig = l1GtTmVetoAlgo->gtTriggerMask();
00124
00125
00126
00127 edm::ESHandle< L1GtTriggerMask> l1GtTmVetoTech;
00128 evSetup.get< L1GtTriggerMaskVetoTechTrigRcd>().get(l1GtTmVetoTech);
00129
00130 std::vector<unsigned int> triggerMaskVetoTechTrig = l1GtTmVetoTech->gtTriggerMask();
00131
00132
00133 int physicsDaqPartition = 0;
00134
00135
00136
00137 typedef std::map<int, const L1GtAlgorithm*>::const_iterator CItBit;
00138
00139
00140 std::map<int, const L1GtAlgorithm*> algoBitToAlgo;
00141 const AlgorithmMap& algorithmMap = l1GtMenu->gtAlgorithmMap();
00142
00143 for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
00144
00145 int bitNumber = (itAlgo->second).algoBitNumber();
00146 algoBitToAlgo[bitNumber] = &(itAlgo->second);
00147 }
00148
00149
00150 std::map<int, const L1GtAlgorithm*> techBitToAlgo;
00151 const AlgorithmMap& technicalTriggerMap = l1GtMenu->gtTechnicalTriggerMap();
00152
00153 for (CItAlgo itAlgo = technicalTriggerMap.begin(); itAlgo != technicalTriggerMap.end(); itAlgo++) {
00154
00155 int bitNumber = (itAlgo->second).algoBitNumber();
00156 techBitToAlgo[bitNumber] = &(itAlgo->second);
00157 }
00158
00159
00160
00161 std::cout << "\n ********** L1 Trigger Menu - printing ********** \n\n"
00162 << "\n---+++ Summary\n"
00163 << "\n|L1 Trigger Menu Interface: |!" << l1GtMenu->gtTriggerMenuInterface() << " |"
00164 << "\n|L1 Trigger Menu Name: |!" << l1GtMenu->gtTriggerMenuName() << " |"
00165 << "\n|L1 Trigger Menu Implementation: |!" << l1GtMenu->gtTriggerMenuImplementation() << " |"
00166 << "\n|Associated L1 scale DB key: |!" << l1GtMenu->gtScaleDbKey() << " |" << "\n\n"
00167 << std::flush << std::endl;
00168
00169 std::cout << "\n---+++ List of physics algorithms\n" << std::endl;
00170
00171 std::cout
00172 << "| *Algorithm* | *Alias* | *Bit number* | *Prescale factor* | *Mask* |"
00173 << std::endl;
00174
00175 for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
00176
00177 int bitNumber = itBit->first;
00178 std::string aName = (itBit->second)->algoName();
00179 std::string aAlias = (itBit->second)->algoAlias();
00180
00181 unsigned int triggerMaskAlgo =
00182 (triggerMaskAlgoTrig.at(bitNumber)) & (1 << physicsDaqPartition);
00183
00184 std::cout
00185 << "|" << std::left << aName << " |" << aAlias << " | " << std::right << bitNumber
00186 << "| " << prescaleFactorsAlgoTrig.at(bitNumber)
00187 << "| " << triggerMaskAlgo
00188 << " |"
00189 << std::endl;
00190 }
00191
00192 std::cout << "\n---+++ List of technical triggers\n" << std::endl;
00193
00194 std::cout
00195 << "| *Technical trigger* | *Bit number* | *Prescale factor* | *Mask* | *Veto mask* |"
00196 << std::endl;
00197
00198 for (CItBit itBit = techBitToAlgo.begin(); itBit != techBitToAlgo.end(); itBit++) {
00199
00200 int bitNumber = itBit->first;
00201 std::string aName = (itBit->second)->algoName();
00202 std::string aAlias = (itBit->second)->algoAlias();
00203
00204 unsigned int triggerMaskTech =
00205 (triggerMaskTechTrig.at(bitNumber)) & (1 << physicsDaqPartition);
00206 unsigned int triggerMaskVetoTech =
00207 (triggerMaskVetoTechTrig.at(bitNumber)) & (1 << physicsDaqPartition);
00208
00209 std::cout
00210 << "|!" << std::left << aName << " | " << std::right << bitNumber
00211 << "| " << prescaleFactorsTechTrig.at(bitNumber)
00212 << "| " << triggerMaskTech
00213 << "| " << triggerMaskVetoTech
00214 << " |"
00215 << std::endl;
00216 }
00217
00218 std::cout
00219 << "\nNOTE: only the prescale factors from set index zero are printed!"
00220 << std::endl;
00221
00222 }