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 hists.reserve(histData_.size());
332 for (
const auto&
data : histData_) {
340 bins_(convertToFloat(
config.getParameter<
std::
vector<double>>(
"bins"))),
347 desc.add<std::vector<double>>(
"bins", {-2.5, -1.5, 0, 1.5, 2.5});
356 const std::vector<float>&
massBins)
const {
357 return iBooker.
book2D((
name + nameSuffex_).c_str(),
358 (
title + titleSuffex_).c_str(),
373 for (
auto&
hist : hists_) {
387 auto probeKeys =
getKeys(trigEvt, probeFilter_);
388 for (
auto probeKey : probeKeys) {
390 if (tagKey != probeKey &&
probeCuts(probe)) {
392 auto massFunc = [](
float pt1,
float eta1,
float phi1,
float pt2,
float eta2,
float phi2) {
396 hists_.fill(probe,
mass);
bool accept() const
Has at least one path accepted the event?
const Keys & filterKeys(trigger::size_type index) const
static void cleanTrigKeys(trigger::Keys &keys)
bool operator()(const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
The single EDProduct to be saved for each event (AOD case)
static edm::ParameterSetDescription makePSetDescription()
virtual void setCurrentFolder(std::string const &fullpath)
static edm::ParameterSetDescription makePSetDescription()
static const trigger::Keys getKeys(const trigger::TriggerEvent &trigEvt, const std::string &filterName)
std::vector< ProbeData > probeHists_
TrigObjTnPHistColl(const edm::ParameterSet &config)
void bookHists(DQMStore::IBooker &iBooker)
trigger::size_type sizeFilters() const
static edm::ParameterSetDescription makePSetDescription()
Data(const edm::ParameterSet &config)
FilterSet(const edm::ParameterSet &config)
Log< level::Error, false > LogError
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
static std::string expandPath(const std::string &pathPattern, const HLTConfigProvider &hltConfig, bool isAND, int verbose)
VarRangeCutColl< trigger::TriggerObject > probeCuts_
Single trigger physics object (e.g., an isolated muon)
void bookHists(const std::string &tagName, DQMStore::IBooker &iBooker, const HistDefs &histDefs)
static edm::ParameterSetDescription makePSetDescription()
void init(const HLTConfigProvider &hltConfig)
void fill(const trigger::size_type tagKey, const trigger::TriggerEvent &trigEvt, const VarRangeCutColl< trigger::TriggerObject > &probeCuts) const
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
def unique(seq, keepstr=True)
Cos< T >::type cos(const T &t)
dqm::reco::MonitorElement * book(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, const std::vector< float > &massBins) const
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
const TriggerObjectCollection & getObjects() const
key
prepare the HTCondor submission files and eventually submit them
void bookHists(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, const HistDefs &histDefs)
float(trigger::TriggerObject::* varFunc_)() const
static void mergeTrigKeys(trigger::Keys &keys, const trigger::Keys &keysToMerge, bool isAND)
Log< level::Info, false > LogInfo
static const char *const trigNames[]
void fill(const trigger::TriggerObject &probe, float mass) const
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
PathSelector(const edm::ParameterSet &config)
static std::string expandSelectionStr(const std::string &selStr, const HLTConfigProvider &hltConfig, bool isAND, int verbose)
std::vector< size_type > Keys
void fill(const trigger::TriggerEvent &trigEvt, const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
HistDefs(const edm::ParameterSet &config)
std::vector< std::pair< HistFiller, dqm::reco::MonitorElement * > > bookHists(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title) const
std::vector< FilterSet > filterSets_
VarRangeCutColl< trigger::TriggerObject > tagCuts_
const std::string & usedProcessName() const
getters
char data[epos_bytes_allocation]
std::vector< Data > histData_
void operator()(const trigger::TriggerObject &probe, float mass, dqm::reco::MonitorElement *hist) const
static edm::ParameterSetDescription makePSetDescription()
FilterSelector(const edm::ParameterSet &config)
static edm::ParameterSetDescription makePSetDescription()
Log< level::Warning, false > LogWarning
FilterSelector tagFilters_
virtual const bool expressionResult() const
static edm::ParameterSetDescription makePSetDescription()
TrigObjVarF(std::string varName)