File indexing completed on 2024-09-07 04:35:56
0001 #ifndef DataFormats_PatCandidates_TriggerEvent_h
0002 #define DataFormats_PatCandidates_TriggerEvent_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "DataFormats/PatCandidates/interface/TriggerAlgorithm.h"
0023 #include "DataFormats/PatCandidates/interface/TriggerCondition.h"
0024 #include "DataFormats/PatCandidates/interface/TriggerPath.h"
0025 #include "DataFormats/PatCandidates/interface/TriggerFilter.h"
0026 #include "DataFormats/PatCandidates/interface/TriggerObject.h"
0027
0028 #include <string>
0029 #include <vector>
0030
0031 #include "FWCore/Utilities/interface/InputTag.h"
0032 #include "DataFormats/Common/interface/Handle.h"
0033 #include "DataFormats/Common/interface/OrphanHandle.h"
0034 #include "DataFormats/Candidate/interface/Candidate.h"
0035 #include <cstdint>
0036
0037 namespace pat {
0038
0039 class TriggerEvent {
0040
0041
0042
0043 std::string nameL1Menu_;
0044
0045 std::string nameHltTable_;
0046
0047 bool run_;
0048
0049 bool accept_;
0050
0051 bool error_;
0052
0053 bool physDecl_;
0054
0055 uint32_t lhcFill_;
0056
0057
0058 uint16_t beamMode_;
0059
0060 uint16_t beamMomentum_;
0061
0062 uint32_t intensityBeam1_;
0063
0064 uint32_t intensityBeam2_;
0065
0066
0067 uint16_t bstMasterStatus_;
0068
0069 uint32_t turnCount_;
0070
0071 float bCurrentStart_;
0072
0073 float bCurrentStop_;
0074
0075 float bCurrentAvg_;
0076
0077
0078
0079 TriggerAlgorithmRefProd algorithms_;
0080
0081 TriggerConditionRefProd conditions_;
0082
0083 TriggerPathRefProd paths_;
0084
0085 TriggerFilterRefProd filters_;
0086
0087 TriggerObjectRefProd objects_;
0088
0089 TriggerObjectMatchContainer objectMatchResults_;
0090
0091 public:
0092
0093
0094
0095 TriggerEvent();
0096
0097 TriggerEvent(
0098 const std::string& nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true);
0099
0100 TriggerEvent(const std::string& nameL1Menu,
0101 const std::string& nameHltTable,
0102 bool run = true,
0103 bool accept = true,
0104 bool error = false,
0105 bool physDecl = true);
0106
0107
0108 virtual ~TriggerEvent() {}
0109
0110
0111
0112
0113
0114 void setNameL1Menu(const std::string& name) { nameL1Menu_ = name; };
0115
0116 void setNameHltTable(const std::string& name) { nameHltTable_ = name; };
0117
0118 void setRun(bool run) { run_ = run; };
0119
0120 void setAccept(bool accept) { accept_ = accept; };
0121
0122 void setError(bool error) { error_ = error; };
0123
0124 void setPhysDecl(bool physDecl) { physDecl_ = physDecl; };
0125
0126 void setLhcFill(uint32_t lhcFill) { lhcFill_ = lhcFill; };
0127
0128 void setBeamMode(uint16_t beamMode) { beamMode_ = beamMode; };
0129
0130 void setBeamMomentum(uint16_t beamMomentum) { beamMomentum_ = beamMomentum; };
0131
0132 void setIntensityBeam1(uint32_t intensityBeam1) { intensityBeam1_ = intensityBeam1; };
0133
0134 void setIntensityBeam2(uint32_t intensityBeam2) { intensityBeam2_ = intensityBeam2; };
0135
0136 void setBstMasterStatus(uint16_t bstMasterStatus) { bstMasterStatus_ = bstMasterStatus; };
0137
0138 void setTurnCount(uint32_t turnCount) { turnCount_ = turnCount; };
0139
0140 void setBCurrentStart(float bCurrentStart) { bCurrentStart_ = bCurrentStart; };
0141
0142 void setBCurrentStop(float bCurrentStop) { bCurrentStop_ = bCurrentStop; };
0143
0144 void setBCurrentAvg(float bCurrentAvg) { bCurrentAvg_ = bCurrentAvg; };
0145
0146 const std::string& nameL1Menu() const { return nameL1Menu_; };
0147
0148 const std::string& nameHltTable() const { return nameHltTable_; };
0149
0150 bool wasRun() const { return run_; };
0151
0152 bool wasAccept() const { return accept_; };
0153
0154 bool wasError() const { return error_; };
0155
0156 bool wasPhysDecl() const { return physDecl_; };
0157
0158 uint32_t lhcFill() const { return lhcFill_; };
0159
0160 uint16_t beamMode() const { return beamMode_; };
0161
0162 uint16_t beamMomentum() const { return beamMomentum_; };
0163
0164 uint32_t intensityBeam1() const { return intensityBeam1_; };
0165
0166 uint32_t intensityBeam2() const { return intensityBeam2_; };
0167
0168 uint16_t bstMasterStatus() const { return bstMasterStatus_; };
0169
0170 uint32_t turnCount() const { return turnCount_; };
0171
0172 float bCurrentStart() const { return bCurrentStart_; };
0173
0174 float bCurrentStop() const { return bCurrentStop_; };
0175
0176 float bCurrentAvg() const { return bCurrentAvg_; };
0177
0178
0179
0180 void setAlgorithms(const edm::Handle<TriggerAlgorithmCollection>& handleTriggerAlgorithms) {
0181 algorithms_ = TriggerAlgorithmRefProd(handleTriggerAlgorithms);
0182 };
0183
0184
0185 const TriggerAlgorithmCollection* algorithms() const { return algorithms_.get(); };
0186
0187
0188 const TriggerAlgorithmRefVector algorithmRefs() const;
0189
0190
0191 const TriggerAlgorithm* algorithm(const std::string& nameAlgorithm) const;
0192
0193
0194 const TriggerAlgorithmRef algorithmRef(const std::string& nameAlgorithm) const;
0195
0196
0197 std::string nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm = true) const;
0198
0199
0200 unsigned indexAlgorithm(const std::string& nameAlgorithm) const;
0201
0202 TriggerAlgorithmRefVector acceptedAlgorithms() const;
0203
0204 TriggerAlgorithmRefVector acceptedAlgorithmsGtl() const;
0205
0206 TriggerAlgorithmRefVector techAlgorithms() const;
0207
0208 TriggerAlgorithmRefVector acceptedTechAlgorithms() const;
0209
0210 TriggerAlgorithmRefVector acceptedTechAlgorithmsGtl() const;
0211
0212 TriggerAlgorithmRefVector physAlgorithms() const;
0213
0214 TriggerAlgorithmRefVector acceptedPhysAlgorithms() const;
0215
0216 TriggerAlgorithmRefVector acceptedPhysAlgorithmsGtl() const;
0217
0218
0219
0220 void setConditions(const edm::Handle<TriggerConditionCollection>& handleTriggerConditions) {
0221 conditions_ = TriggerConditionRefProd(handleTriggerConditions);
0222 };
0223
0224
0225 const TriggerConditionCollection* conditions() const { return conditions_.get(); };
0226
0227
0228 const TriggerConditionRefVector conditionRefs() const;
0229
0230
0231 const TriggerCondition* condition(const std::string& nameCondition) const;
0232
0233
0234 const TriggerConditionRef conditionRef(const std::string& nameCondition) const;
0235
0236
0237 unsigned indexCondition(const std::string& nameCondition) const;
0238
0239 TriggerConditionRefVector acceptedConditions() const;
0240
0241
0242
0243 void setPaths(const edm::Handle<TriggerPathCollection>& handleTriggerPaths) {
0244 paths_ = TriggerPathRefProd(handleTriggerPaths);
0245 };
0246
0247
0248 const TriggerPathCollection* paths() const { return paths_.get(); };
0249
0250
0251 const TriggerPathRefVector pathRefs() const;
0252
0253
0254 const TriggerPath* path(const std::string& namePath) const;
0255
0256
0257 const TriggerPathRef pathRef(const std::string& namePath) const;
0258
0259
0260 unsigned indexPath(const std::string& namePath) const;
0261
0262 TriggerPathRefVector acceptedPaths() const;
0263
0264
0265
0266 void setFilters(const edm::Handle<TriggerFilterCollection>& handleTriggerFilters) {
0267 filters_ = TriggerFilterRefProd(handleTriggerFilters);
0268 };
0269
0270
0271 const TriggerFilterCollection* filters() const { return filters_.get(); };
0272
0273
0274 const TriggerFilterRefVector filterRefs() const;
0275
0276
0277 const TriggerFilter* filter(const std::string& labelFilter) const;
0278
0279
0280 const TriggerFilterRef filterRef(const std::string& labelFilter) const;
0281
0282
0283 unsigned indexFilter(const std::string& labelFilter) const;
0284
0285 TriggerFilterRefVector acceptedFilters() const;
0286
0287
0288
0289 void setObjects(const edm::Handle<TriggerObjectCollection>& handleTriggerObjects) {
0290 objects_ = TriggerObjectRefProd(handleTriggerObjects);
0291 };
0292
0293
0294 const TriggerObjectCollection* objects() const { return objects_.get(); };
0295
0296
0297 const TriggerObjectRefVector objectRefs() const;
0298
0299 TriggerObjectRefVector objects(trigger::TriggerObjectType triggerObjectType) const;
0300 TriggerObjectRefVector objects(int triggerObjectType) const {
0301 return objects(trigger::TriggerObjectType(triggerObjectType));
0302 };
0303
0304
0305
0306 TriggerConditionRefVector algorithmConditions(const std::string& nameAlgorithm) const;
0307
0308 bool conditionInAlgorithm(const TriggerConditionRef& conditionRef, const std::string& nameAlgorithm) const;
0309
0310 TriggerAlgorithmRefVector conditionAlgorithms(const TriggerConditionRef& conditionRef) const;
0311
0312 std::vector<std::string> conditionCollections(const std::string& nameAlgorithm) const;
0313
0314 TriggerObjectRefVector conditionObjects(const std::string& nameCondition) const;
0315
0316 bool objectInCondition(const TriggerObjectRef& objectRef, const std::string& nameCondition) const;
0317
0318 TriggerConditionRefVector objectConditions(const TriggerObjectRef& objectRef) const;
0319
0320 TriggerObjectRefVector algorithmObjects(const std::string& nameAlgorithm) const;
0321
0322 bool objectInAlgorithm(const TriggerObjectRef& objectRef, const std::string& nameAlgorithm) const;
0323
0324 TriggerAlgorithmRefVector objectAlgorithms(const TriggerObjectRef& objectRef) const;
0325
0326
0327
0328
0329 TriggerFilterRefVector pathModules(const std::string& namePath, bool all = true) const;
0330
0331 TriggerFilterRefVector pathFilters(const std::string& namePath, bool firing = true) const;
0332
0333 bool filterInPath(const TriggerFilterRef& filterRef, const std::string& namePath, bool firing = true) const;
0334
0335 TriggerPathRefVector filterPaths(const TriggerFilterRef& filterRef, bool firing = true) const;
0336
0337 std::vector<std::string> filterCollections(const std::string& labelFilter) const;
0338
0339 TriggerObjectRefVector filterObjects(const std::string& labelFilter) const;
0340
0341 bool objectInFilter(const TriggerObjectRef& objectRef, const std::string& labelFilter) const;
0342
0343 TriggerFilterRefVector objectFilters(const TriggerObjectRef& objectRef, bool firing = true) const;
0344
0345 TriggerObjectRefVector pathObjects(const std::string& namePath, bool firing = true) const;
0346
0347 bool objectInPath(const TriggerObjectRef& objectRef, const std::string& namePath, bool firing = true) const;
0348
0349 TriggerPathRefVector objectPaths(const TriggerObjectRef& objectRef, bool firing = true) const;
0350
0351
0352
0353 bool addObjectMatchResult(const TriggerObjectMatchRefProd& trigMatches, const std::string& labelMatcher);
0354 bool addObjectMatchResult(const edm::Handle<TriggerObjectMatch>& trigMatches, const std::string& labelMatcher) {
0355 return addObjectMatchResult(TriggerObjectMatchRefProd(trigMatches), labelMatcher);
0356 };
0357 bool addObjectMatchResult(const edm::OrphanHandle<TriggerObjectMatch>& trigMatches,
0358 const std::string& labelMatcher) {
0359 return addObjectMatchResult(TriggerObjectMatchRefProd(trigMatches), labelMatcher);
0360 };
0361
0362 std::vector<std::string> triggerMatchers() const;
0363
0364 const TriggerObjectMatchContainer* triggerObjectMatchResults() const { return &objectMatchResults_; };
0365
0366
0367
0368 const TriggerObjectMatch* triggerObjectMatchResult(const std::string& labelMatcher) const;
0369
0370
0371 };
0372
0373 }
0374
0375 #endif