File indexing completed on 2024-04-06 12:07:38
0001 #ifndef DQM_HLTEvF_TrigObjTnPHistColl_h
0002 #define DQM_HLTEvF_TrigObjTnPHistColl_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0079 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0080
0081 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
0082 #include "DQMOffline/Trigger/interface/VarRangeCutColl.h"
0083 #include "DQMServices/Core/interface/DQMStore.h"
0084 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0085
0086 class TrigObjTnPHistColl {
0087 public:
0088 typedef dqm::legacy::DQMStore DQMStore;
0089 typedef dqm::legacy::MonitorElement MonitorElement;
0090
0091 class FilterSelector {
0092 public:
0093 class FilterSet {
0094 public:
0095 explicit FilterSet(const edm::ParameterSet& config);
0096 static edm::ParameterSetDescription makePSetDescription();
0097 const trigger::Keys getPassingKeys(const trigger::TriggerEvent& trigEvt) const;
0098
0099 private:
0100 std::vector<std::string> filters_;
0101 bool isAND_;
0102 };
0103
0104 public:
0105 explicit FilterSelector(const edm::ParameterSet& config);
0106 static edm::ParameterSetDescription makePSetDescription();
0107 const trigger::Keys getPassingKeys(const trigger::TriggerEvent& trigEvt) const;
0108
0109 private:
0110
0111 static void mergeTrigKeys(trigger::Keys& keys, const trigger::Keys& keysToMerge, bool isAND);
0112 static void cleanTrigKeys(trigger::Keys& keys);
0113
0114 std::vector<FilterSet> filterSets_;
0115 bool isAND_;
0116 };
0117
0118
0119
0120
0121
0122 class PathSelector {
0123 public:
0124 PathSelector(const edm::ParameterSet& config);
0125 static edm::ParameterSetDescription makePSetDescription();
0126 void init(const HLTConfigProvider& hltConfig);
0127 bool operator()(const edm::TriggerResults& trigResults, const edm::TriggerNames& trigNames) const;
0128
0129 private:
0130 static std::string expandSelectionStr(const std::string& selStr,
0131 const HLTConfigProvider& hltConfig,
0132 bool isAND,
0133 int verbose);
0134 static std::string expandPath(const std::string& pathPattern,
0135 const HLTConfigProvider& hltConfig,
0136 bool isAND,
0137 int verbose);
0138
0139 std::string selectionStr_;
0140 std::string expandedSelStr_;
0141 bool isANDForExpandedPaths_;
0142 int verbose_;
0143 bool isInited_;
0144 };
0145
0146 class TrigObjVarF {
0147 public:
0148 explicit TrigObjVarF(std::string varName);
0149 float operator()(const trigger::TriggerObject& obj) const {
0150 return isAbs_ ? std::abs((obj.*varFunc_)()) : (obj.*varFunc_)();
0151 }
0152
0153 private:
0154 float (trigger::TriggerObject::*varFunc_)() const;
0155 bool isAbs_;
0156 };
0157
0158 class HistFiller {
0159 public:
0160 explicit HistFiller(const edm::ParameterSet& config);
0161 static edm::ParameterSetDescription makePSetDescription();
0162 void operator()(const trigger::TriggerObject& probe, float mass, dqm::reco::MonitorElement* hist) const;
0163
0164 private:
0165 VarRangeCutColl<trigger::TriggerObject> localCuts_;
0166 TrigObjVarF var_;
0167 };
0168
0169
0170 class HistDefs {
0171 private:
0172 class Data {
0173 public:
0174 explicit Data(const edm::ParameterSet& config);
0175 static edm::ParameterSetDescription makePSetDescription();
0176 dqm::reco::MonitorElement* book(DQMStore::IBooker& iBooker,
0177 const std::string& name,
0178 const std::string& title,
0179 const std::vector<float>& massBins) const;
0180 const HistFiller& filler() const { return histFiller_; }
0181
0182 private:
0183 HistFiller histFiller_;
0184 std::vector<float> bins_;
0185 std::string nameSuffex_;
0186 std::string titleSuffex_;
0187 };
0188
0189 public:
0190 explicit HistDefs(const edm::ParameterSet& config);
0191 static edm::ParameterSetDescription makePSetDescription();
0192 std::vector<std::pair<HistFiller, dqm::reco::MonitorElement*> > bookHists(DQMStore::IBooker& iBooker,
0193 const std::string& name,
0194 const std::string& title) const;
0195
0196 private:
0197 std::vector<Data> histData_;
0198 std::vector<float> massBins_;
0199 };
0200
0201 class HistColl {
0202 public:
0203 HistColl() {}
0204 void bookHists(DQMStore::IBooker& iBooker,
0205 const std::string& name,
0206 const std::string& title,
0207 const HistDefs& histDefs);
0208 void fill(const trigger::TriggerObject& probe, float mass) const;
0209
0210 private:
0211 std::vector<std::pair<HistFiller, dqm::reco::MonitorElement*> > hists_;
0212 };
0213
0214 class ProbeData {
0215 public:
0216 explicit ProbeData(std::string probeFilter) : probeFilter_(std::move(probeFilter)) {}
0217 void bookHists(const std::string& tagName, DQMStore::IBooker& iBooker, const HistDefs& histDefs);
0218 void fill(const trigger::size_type tagKey,
0219 const trigger::TriggerEvent& trigEvt,
0220 const VarRangeCutColl<trigger::TriggerObject>& probeCuts) const;
0221
0222 private:
0223 std::string probeFilter_;
0224 HistColl hists_;
0225 };
0226
0227 public:
0228 TrigObjTnPHistColl(const edm::ParameterSet& config);
0229 static edm::ParameterSetDescription makePSetDescription();
0230 void init(const HLTConfigProvider& hltConfig) { evtTrigSel_.init(hltConfig); }
0231 void bookHists(DQMStore::IBooker& iBooker);
0232 void fill(const trigger::TriggerEvent& trigEvt,
0233 const edm::TriggerResults& trigResults,
0234 const edm::TriggerNames& trigNames) const;
0235
0236 private:
0237
0238 static const trigger::Keys getKeys(const trigger::TriggerEvent& trigEvt, const std::string& filterName);
0239
0240 VarRangeCutColl<trigger::TriggerObject> tagCuts_, probeCuts_;
0241 FilterSelector tagFilters_;
0242 std::string collName_;
0243 std::string folderName_;
0244 HistDefs histDefs_;
0245 std::vector<ProbeData> probeHists_;
0246 PathSelector evtTrigSel_;
0247 };
0248
0249 #endif