|
|
Go to the documentation of this file.
6 std::vector<float> convertToFloat(
const std::vector<double>& vecD) {
7 return std::vector<float>(vecD.begin(), vecD.end());
37 desc.
add<std::vector<std::string>>(
"probeFilters", std::vector<std::string>());
56 for (
auto& tagKey : tagTrigKeys) {
79 auto filterSetConfigs =
config.getParameter<std::vector<edm::ParameterSet>>(
"filterSets");
80 for (
auto& filterSetConfig : filterSetConfigs)
86 desc.
addVPSet(
"filterSets", FilterSet::makePSetDescription(), std::vector<edm::ParameterSet>());
87 desc.
add<
bool>(
"isAND",
false);
93 bool isFirstFilterSet =
true;
94 for (
const auto& filterSet : filterSets_) {
95 auto keysOfFilterSet = filterSet.getPassingKeys(trigEvt);
97 passingKeys = keysOfFilterSet;
99 mergeTrigKeys(passingKeys, keysOfFilterSet, isAND_);
100 isFirstFilterSet =
false;
102 cleanTrigKeys(passingKeys);
111 if (
std::count(keysToMerge.begin(), keysToMerge.end(),
key) == 0) {
116 for (
const auto key : keysToMerge) {
123 std::sort(
keys.begin(),
keys.end());
135 isANDForExpandedPaths_(
config.getParameter<
bool>(
"isANDForExpandedPaths")),
136 verbose_(
config.getParameter<
int>(
"verbose")),
142 desc.
add<
bool>(
"isANDForExpandedPaths",
false);
143 desc.
add<
int>(
"verbose", 1);
148 expandedSelStr_ = expandSelectionStr(selectionStr_,
hltConfig, isANDForExpandedPaths_, verbose_);
151 edm::LogInfo(
"TrigObjTnPHistColl::PathSelector") <<
"trigger selection string: \"" << expandedSelStr_ <<
"\"";
157 if (selectionStr_.empty())
159 else if (!isInited_) {
161 <<
" error, TrigObjTnPHistColl::PathSelector is not initalised, returning false ";
163 }
else if (expandedSelStr_.empty()) {
193 if (
pathName.find(
'*') != std::string::npos) {
195 expandedSelStr.replace(expandedSelStr.find(
pathName),
pathName.size(), pathPatternExpanded);
198 return expandedSelStr;
209 std::vector<std::string>
matched;
211 if (pathPattern.substr(pathPattern.size() - versionWildcard.size()) == versionWildcard) {
212 const std::string pathPatternBase(pathPattern.substr(0, pathPattern.size() - versionWildcard.size()));
221 <<
"pattern: \"" << pathPattern
222 <<
"\" could not be resolved, please check your triggers are spelt correctly and present in the data you are "
229 for (
unsigned iVers = 0; iVers <
matched.size(); ++iVers) {
231 expanded.append(
isAND ?
" AND " :
" OR ");
232 expanded.append(
matched.at(iVers));
234 expanded.append(
")");
236 edm::LogInfo(
"TrigObjTnPHistColl::PathSelector") <<
"Logical expression : \"" << pathPattern <<
"\"\n"
237 <<
" expanded to: \"" << expanded <<
"\"";
244 desc.
add<std::vector<std::string>>(
"filters", std::vector<std::string>());
245 desc.
add<
bool>(
"isAND",
true);
252 bool firstFilter =
true;
256 passingKeys = trigKeys;
259 mergeTrigKeys(passingKeys, trigKeys, isAND_);
261 cleanTrigKeys(passingKeys);
268 auto absPos = varName.rfind(
"Abs");
269 if (absPos != std::string::npos && absPos + 3 == varName.size()) {
271 varName = varName.erase(absPos);
275 else if (varName ==
"eta")
277 else if (varName ==
"phi")
280 std::ostringstream
msg;
281 msg <<
"var " << varName <<
" not recognised (use pt or p rather than et or e for speed!) ";
283 msg <<
" varName was \"Abs\" suffex cleaned where it tried to remove \"Abs\" at the end of the variable name ";
284 msg << __FILE__ <<
"," << __LINE__ << std::endl;
303 if (localCuts_(probe))
308 : massBins_(convertToFloat(
config.getParameter<
std::vector<double>>(
"massBins"))) {
309 const auto histConfigs =
config.getParameter<std::vector<edm::ParameterSet>>(
"configs");
317 desc.
addVPSet(
"configs", Data::makePSetDescription(), std::vector<edm::ParameterSet>());
321 desc.
add<std::vector<double>>(
"massBins",
massBins);
325 std::vector<std::pair<TrigObjTnPHistColl::HistFiller, dqm::reco::MonitorElement*>>
329 std::vector<std::pair<HistFiller, dqm::reco::MonitorElement*>>
hists;
330 for (
const auto&
data : histData_) {
338 bins_(convertToFloat(
config.getParameter<
std::vector<double>>(
"bins"))),
345 desc.
add<std::vector<double>>(
"bins", {-2.5, -1.5, 0, 1.5, 2.5});
354 const std::vector<float>&
massBins)
const {
355 return iBooker.
book2D((
name + nameSuffex_).c_str(),
356 (
title + titleSuffex_).c_str(),
371 for (
auto&
hist : hists_) {
385 auto probeKeys =
getKeys(trigEvt, probeFilter_);
386 for (
auto probeKey : probeKeys) {
388 if (tagKey != probeKey &&
probeCuts(probe)) {
390 auto massFunc = [](
float pt1,
float eta1,
float phi1,
float pt2,
float eta2,
float phi2) {
394 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()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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)
HistDefs(const edm::ParameterSet &config)
static edm::ParameterSetDescription makePSetDescription()
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()
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
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)
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