|
|
Go to the documentation of this file.
7 std::vector<float> convertToFloat(
const std::vector<double>& vecD) {
8 return std::vector<float>(vecD.begin(), vecD.end());
38 desc.add<std::vector<std::string>>(
"probeFilters", std::vector<std::string>());
57 for (
auto& tagKey : tagTrigKeys) {
80 auto filterSetConfigs =
config.getParameter<std::vector<edm::ParameterSet>>(
"filterSets");
81 for (
auto& filterSetConfig : filterSetConfigs)
87 desc.addVPSet(
"filterSets", FilterSet::makePSetDescription(), std::vector<edm::ParameterSet>());
88 desc.add<
bool>(
"isAND",
false);
94 bool isFirstFilterSet =
true;
95 for (
const auto& filterSet : filterSets_) {
96 auto keysOfFilterSet = filterSet.getPassingKeys(trigEvt);
98 passingKeys = keysOfFilterSet;
100 mergeTrigKeys(passingKeys, keysOfFilterSet, isAND_);
101 isFirstFilterSet =
false;
103 cleanTrigKeys(passingKeys);
112 if (
std::count(keysToMerge.begin(), keysToMerge.end(),
key) == 0) {
117 for (
const auto key : keysToMerge) {
136 isANDForExpandedPaths_(
config.getParameter<
bool>(
"isANDForExpandedPaths")),
137 verbose_(
config.getParameter<
int>(
"verbose")),
143 desc.add<
bool>(
"isANDForExpandedPaths",
false);
144 desc.add<
int>(
"verbose", 1);
149 expandedSelStr_ = expandSelectionStr(selectionStr_,
hltConfig, isANDForExpandedPaths_, verbose_);
152 edm::LogInfo(
"TrigObjTnPHistColl::PathSelector") <<
"trigger selection string: \"" << expandedSelStr_ <<
"\"";
158 if (selectionStr_.empty())
160 else if (!isInited_) {
162 <<
" error, TrigObjTnPHistColl::PathSelector is not initalised, returning false ";
164 }
else if (expandedSelStr_.empty()) {
194 if (
pathName.find(
'*') != std::string::npos) {
196 expandedSelStr.replace(expandedSelStr.find(
pathName),
pathName.size(), pathPatternExpanded);
199 return expandedSelStr;
210 std::vector<std::string>
matched;
212 if (pathPattern.substr(pathPattern.size() - versionWildcard.size()) == versionWildcard) {
213 const std::string pathPatternBase(pathPattern.substr(0, pathPattern.size() - versionWildcard.size()));
222 <<
"pattern: \"" << pathPattern
223 <<
"\" could not be resolved, please check your triggers are spelt correctly and present in the data you are "
230 for (
unsigned iVers = 0; iVers <
matched.size(); ++iVers) {
232 expanded.append(
isAND ?
" AND " :
" OR ");
233 expanded.append(
matched.at(iVers));
235 expanded.append(
")");
237 edm::LogInfo(
"TrigObjTnPHistColl::PathSelector") <<
"Logical expression : \"" << pathPattern <<
"\"\n"
238 <<
" expanded to: \"" << expanded <<
"\"";
245 desc.add<std::vector<std::string>>(
"filters", std::vector<std::string>());
246 desc.add<
bool>(
"isAND",
true);
253 bool firstFilter =
true;
257 passingKeys = trigKeys;
260 mergeTrigKeys(passingKeys, trigKeys, isAND_);
262 cleanTrigKeys(passingKeys);
269 auto absPos = varName.rfind(
"Abs");
270 if (absPos != std::string::npos && absPos + 3 == varName.size()) {
272 varName = varName.erase(absPos);
276 else if (varName ==
"eta")
278 else if (varName ==
"phi")
281 std::ostringstream
msg;
282 msg <<
"var " << varName <<
" not recognised (use pt or p rather than et or e for speed!) ";
284 msg <<
" varName was \"Abs\" suffex cleaned where it tried to remove \"Abs\" at the end of the variable name ";
285 msg << __FILE__ <<
"," << __LINE__ << std::endl;
304 if (localCuts_(probe))
309 : massBins_(convertToFloat(
config.getParameter<
std::
vector<double>>(
"massBins"))) {
310 const auto histConfigs =
config.getParameter<std::vector<edm::ParameterSet>>(
"configs");
318 desc.addVPSet(
"configs", Data::makePSetDescription(), std::vector<edm::ParameterSet>());
326 std::vector<std::pair<TrigObjTnPHistColl::HistFiller, dqm::reco::MonitorElement*>>
330 std::vector<std::pair<HistFiller, dqm::reco::MonitorElement*>>
hists;
331 for (
const auto&
data : histData_) {
339 bins_(convertToFloat(
config.getParameter<
std::
vector<double>>(
"bins"))),
346 desc.add<std::vector<double>>(
"bins", {-2.5, -1.5, 0, 1.5, 2.5});
355 const std::vector<float>&
massBins)
const {
356 return iBooker.
book2D((
name + nameSuffex_).c_str(),
357 (
title + titleSuffex_).c_str(),
372 for (
auto&
hist : hists_) {
386 auto probeKeys =
getKeys(trigEvt, probeFilter_);
387 for (
auto probeKey : probeKeys) {
389 if (tagKey != probeKey &&
probeCuts(probe)) {
391 auto massFunc = [](
float pt1,
float eta1,
float phi1,
float pt2,
float eta2,
float phi2) {
395 hists_.fill(probe,
mass);
PathSelector(const edm::ParameterSet &config)
static std::string expandSelectionStr(const std::string &selStr, const HLTConfigProvider &hltConfig, bool isAND, int verbose)
static const trigger::Keys getKeys(const trigger::TriggerEvent &trigEvt, const std::string &filterName)
std::vector< ProbeData > probeHists_
trigger::size_type sizeFilters() const
static edm::ParameterSetDescription makePSetDescription()
static std::string expandPath(const std::string &pathPattern, const HLTConfigProvider &hltConfig, bool isAND, int verbose)
const Keys & filterKeys(trigger::size_type index) const
static const char *const trigNames[]
void operator()(const trigger::TriggerObject &probe, float mass, dqm::reco::MonitorElement *hist) const
virtual void setCurrentFolder(std::string const &fullpath)
TrigObjVarF(std::string varName)
static edm::ParameterSetDescription makePSetDescription()
void fill(const trigger::TriggerEvent &trigEvt, const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
static void cleanTrigKeys(trigger::Keys &keys)
void bookHists(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, const HistDefs &histDefs)
Log< level::Info, false > LogInfo
HistDefs(const edm::ParameterSet &config)
static edm::ParameterSetDescription makePSetDescription()
Log< level::Warning, false > LogWarning
TrigObjTnPHistColl(const edm::ParameterSet &config)
VarRangeCutColl< trigger::TriggerObject > tagCuts_
void fill(const trigger::size_type tagKey, const trigger::TriggerEvent &trigEvt, const VarRangeCutColl< trigger::TriggerObject > &probeCuts) const
Data(const edm::ParameterSet &config)
FilterSet(const edm::ParameterSet &config)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< Data > histData_
bool operator()(const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
Cos< T >::type cos(const T &t)
static void mergeTrigKeys(trigger::Keys &keys, const trigger::Keys &keysToMerge, bool isAND)
FilterSelector(const edm::ParameterSet &config)
VarRangeCutColl< trigger::TriggerObject > probeCuts_
static constexpr int verbose
Single trigger physics object (e.g., an isolated muon)
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
static edm::ParameterSetDescription makePSetDescription()
static edm::ParameterSetDescription makePSetDescription()
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
HistFiller(const edm::ParameterSet &config)
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
std::vector< std::pair< HistFiller, dqm::reco::MonitorElement * > > bookHists(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title) const
std::vector< size_type > Keys
static edm::ParameterSetDescription makePSetDescription()
The single EDProduct to be saved for each event (AOD case)
Log< level::Error, false > LogError
virtual const bool expressionResult() const
const TriggerObjectCollection & getObjects() const
void init(const HLTConfigProvider &hltConfig)
void bookHists(DQMStore::IBooker &iBooker)
def unique(seq, keepstr=True)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const std::string & usedProcessName() const
getters
char data[epos_bytes_allocation]
bool accept() const
Has at least one path accepted the event?
void bookHists(const std::string &tagName, DQMStore::IBooker &iBooker, const HistDefs &histDefs)
dqm::reco::MonitorElement * book(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, const std::vector< float > &massBins) const
std::vector< FilterSet > filterSets_
void fill(const trigger::TriggerObject &probe, float mass) const
static edm::ParameterSetDescription makePSetDescription()
FilterSelector tagFilters_
float(trigger::TriggerObject::* varFunc_)() const