00001 #ifndef GlobalTriggerAnalyzer_L1GtUtils_h
00002 #define GlobalTriggerAnalyzer_L1GtUtils_h
00003
00020
00021 #include <string>
00022
00023
00024
00025 #include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h"
00026
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/Framework/interface/Run.h"
00030
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 #include "FWCore/Utilities/interface/InputTag.h"
00033
00034 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
00035
00036
00037 class L1GtStableParameters;
00038 class L1GtPrescaleFactors;
00039 class L1GtTriggerMask;
00040 class L1GtTriggerMenu;
00041
00042 class L1GlobalTriggerReadoutRecord;
00043 class L1GlobalTriggerRecord;
00044
00045
00046
00047 class L1GtUtils {
00048
00049 public:
00050
00052 explicit L1GtUtils();
00053
00055 virtual ~L1GtUtils();
00056
00057 public:
00058
00059 enum TriggerCategory {
00060 AlgorithmTrigger = 0,
00061 TechnicalTrigger = 1
00062 };
00063
00065
00066
00067 const std::string triggerCategory (const TriggerCategory&) const;
00068
00070 void retrieveL1EventSetup(const edm::EventSetup&);
00071
00074 void retrieveL1GtTriggerMenuLite(const edm::Event&, edm::InputTag&);
00076 void retrieveL1GtTriggerMenuLite(const edm::Event&);
00077
00079 void getInputTag(const edm::Event& iEvent, edm::InputTag& l1GtRecordInputTag,
00080 edm::InputTag& l1GtReadoutRecordInputTag) const;
00081
00083 void getL1GtTriggerMenuLiteInputTag(const edm::Event& iEvent,
00084 edm::InputTag& l1GtTriggerMenuLiteInputTag) const;
00085
00094
00095 const bool l1AlgoTechTrigBitNumber(const std::string& nameAlgoTechTrig,
00096 TriggerCategory& trigCategory, int& bitNumber) const;
00097
00099 const bool l1AlgTechTrigBitNumber(const std::string& nameAlgoTechTrig,
00100 int& triggerAlgoTechTrig, int& bitNumber) const;
00101
00114
00115 const int l1Results(const edm::Event& iEvent,
00116 const edm::InputTag& l1GtRecordInputTag,
00117 const edm::InputTag& l1GtReadoutRecordInputTag,
00118 const std::string& nameAlgoTechTrig, bool& decisionBeforeMask,
00119 bool& decisionAfterMask, int& prescaleFactor, int& triggerMask) const;
00120
00132
00133 const int l1Results(const edm::Event& iEvent,
00134 const std::string& nameAlgoTechTrig, bool& decisionBeforeMask,
00135 bool& decisionAfterMask, int& prescaleFactor, int& triggerMask) const;
00136
00151
00153 const bool decisionBeforeMask(const edm::Event& iEvent,
00154 const edm::InputTag& l1GtRecordInputTag,
00155 const edm::InputTag& l1GtReadoutRecordInputTag,
00156 const std::string& nameAlgoTechTrig, int& errorCode) const;
00157
00158 const bool decisionBeforeMask(const edm::Event& iEvent,
00159 const std::string& nameAlgoTechTrig, int& errorCode) const;
00160
00161
00163 const bool decisionAfterMask(const edm::Event& iEvent,
00164 const edm::InputTag& l1GtRecordInputTag,
00165 const edm::InputTag& l1GtReadoutRecordInputTag,
00166 const std::string& nameAlgoTechTrig, int& errorCode) const;
00167
00168 const bool decisionAfterMask(const edm::Event& iEvent,
00169 const std::string& nameAlgoTechTrig, int& errorCode) const;
00170
00171
00174 const bool decision(const edm::Event& iEvent,
00175 const edm::InputTag& l1GtRecordInputTag,
00176 const edm::InputTag& l1GtReadoutRecordInputTag,
00177 const std::string& nameAlgoTechTrig, int& errorCode) const;
00178
00179 const bool decision(const edm::Event& iEvent,
00180 const std::string& nameAlgoTechTrig, int& errorCode) const;
00181
00183 const int prescaleFactor(const edm::Event& iEvent,
00184 const edm::InputTag& l1GtRecordInputTag,
00185 const edm::InputTag& l1GtReadoutRecordInputTag,
00186 const std::string& nameAlgoTechTrig, int& errorCode) const;
00187
00188 const int prescaleFactor(const edm::Event& iEvent,
00189 const std::string& nameAlgoTechTrig, int& errorCode) const;
00190
00192 const int triggerMask(const edm::Event& iEvent,
00193 const edm::InputTag& l1GtRecordInputTag,
00194 const edm::InputTag& l1GtReadoutRecordInputTag,
00195 const std::string& nameAlgoTechTrig, int& errorCode) const;
00196
00197 const int triggerMask(const edm::Event& iEvent,
00198 const std::string& nameAlgoTechTrig, int& errorCode) const;
00199
00202 const int triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const;
00203
00208
00209 const int prescaleFactorSetIndex(const edm::Event& iEvent,
00210 const edm::InputTag& l1GtRecordInputTag,
00211 const edm::InputTag& l1GtReadoutRecordInputTag,
00212 const TriggerCategory& trigCategory, int& errorCode) const;
00213
00214 const int prescaleFactorSetIndex(const edm::Event& iEvent,
00215 const TriggerCategory& trigCategory, int& errorCode) const;
00216
00218 const int prescaleFactorSetIndex(const edm::Event& iEvent,
00219 const edm::InputTag& l1GtRecordInputTag,
00220 const edm::InputTag& l1GtReadoutRecordInputTag,
00221 const std::string& triggerAlgoTechTrig, int& errorCode) const;
00222
00223 const int prescaleFactorSetIndex(const edm::Event& iEvent,
00224 const std::string& triggerAlgoTechTrig, int& errorCode) const;
00225
00229
00230 const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
00231 const edm::InputTag& l1GtRecordInputTag,
00232 const edm::InputTag& l1GtReadoutRecordInputTag,
00233 const TriggerCategory& trigCategory, int& errorCode);
00234
00235 const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
00236 const TriggerCategory& trigCategory, int& errorCode);
00237
00239 const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
00240 const edm::InputTag& l1GtRecordInputTag,
00241 const edm::InputTag& l1GtReadoutRecordInputTag,
00242 const std::string& triggerAlgoTechTrig, int& errorCode);
00243
00244 const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
00245 const std::string& triggerAlgoTechTrig, int& errorCode);
00246
00247
00250 const std::vector<unsigned int>& triggerMaskSet(
00251 const TriggerCategory& trigCategory, int& errorCode);
00252
00253
00255 const std::vector<unsigned int>& triggerMaskSet(
00256 const std::string& triggerAlgoTechTrig, int& errorCode);
00257
00259 const std::string& l1TriggerMenu() const;
00260
00262 const std::string& l1TriggerMenuImplementation() const;
00263
00265 const L1GtTriggerMenu* ptrL1TriggerMenuEventSetup(int& errorCode);
00266
00268 const L1GtTriggerMenuLite* ptrL1GtTriggerMenuLite(int& errorCode);
00269
00272 const bool availableL1Configuration(int& errorCode, int& l1ConfCode) const;
00273
00274
00275 private:
00276
00277 static const std::string EmptyString;
00278 static const int L1GtNotValidError;
00279
00283 const bool trigResult(const DecisionWord& decWord, const int bitNumber,
00284 const std::string& nameAlgoTechTrig,
00285 const TriggerCategory& trigCategory, int& errorCode) const;
00286
00287 private:
00288
00290
00292 const L1GtStableParameters* m_l1GtStablePar;
00293 unsigned long long m_l1GtStableParCacheID;
00294
00296 unsigned int m_numberAlgorithmTriggers;
00297
00299 unsigned int m_numberTechnicalTriggers;
00300
00302 const L1GtPrescaleFactors* m_l1GtPfAlgo;
00303 unsigned long long m_l1GtPfAlgoCacheID;
00304
00305 const L1GtPrescaleFactors* m_l1GtPfTech;
00306 unsigned long long m_l1GtPfTechCacheID;
00307
00308 const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
00309 const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
00310
00312 const L1GtTriggerMask* m_l1GtTmAlgo;
00313 unsigned long long m_l1GtTmAlgoCacheID;
00314
00315 const L1GtTriggerMask* m_l1GtTmTech;
00316 unsigned long long m_l1GtTmTechCacheID;
00317
00318 const L1GtTriggerMask* m_l1GtTmVetoAlgo;
00319 unsigned long long m_l1GtTmVetoAlgoCacheID;
00320
00321 const L1GtTriggerMask* m_l1GtTmVetoTech;
00322 unsigned long long m_l1GtTmVetoTechCacheID;
00323
00324 const std::vector<unsigned int>* m_triggerMaskAlgoTrig;
00325 const std::vector<unsigned int>* m_triggerMaskTechTrig;
00326
00327 const std::vector<unsigned int>* m_triggerMaskVetoAlgoTrig;
00328 const std::vector<unsigned int>* m_triggerMaskVetoTechTrig;
00329
00330
00331 const L1GtTriggerMenu* m_l1GtMenu;
00332 unsigned long long m_l1GtMenuCacheID;
00333
00334 const AlgorithmMap* m_algorithmMap;
00335 const AlgorithmMap* m_algorithmAliasMap;
00336 const AlgorithmMap* m_technicalTriggerMap;
00337
00338 bool m_l1EventSetupValid;
00339
00341
00342
00344 const L1GtTriggerMenuLite* m_l1GtMenuLite;
00345
00346 const L1GtTriggerMenuLite::L1TriggerMap* m_algorithmMapLite;
00347 const L1GtTriggerMenuLite::L1TriggerMap* m_algorithmAliasMapLite;
00348 const L1GtTriggerMenuLite::L1TriggerMap* m_technicalTriggerMapLite;
00349
00350 const std::vector<unsigned int>* m_triggerMaskAlgoTrigLite;
00351 const std::vector<unsigned int>* m_triggerMaskTechTrigLite;
00352
00353 const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrigLite;
00354 const std::vector<std::vector<int> >* m_prescaleFactorsTechTrigLite;
00355
00356 const edm::RunID* m_runIDCache;
00357
00358
00359 const edm::RunID* m_provRunIDCache;
00360
00361
00362 bool m_l1GtMenuLiteValid;
00363
00364 private:
00365
00367 unsigned int m_physicsDaqPartition;
00368
00369 std::vector<unsigned int> m_triggerMaskSet;
00370 std::vector<int> m_prescaleFactorSet;
00371
00373 bool m_retrieveL1EventSetup;
00374 bool m_retrieveL1GtTriggerMenuLite;
00375
00376 };
00377
00378 #endif