6 std::vector<float> convertToFloat(
const std::vector<double>& vecD){
7 return std::vector<float>(vecD.begin(),vecD.end());
15 collName_(config.getParameter<
std::
string>(
"collName")),
16 folderName_(config.getParameter<
std::
string>(
"folderName")),
21 auto probeFilters = config.
getParameter<std::vector<std::string> >(
"probeFilters");
22 for(
auto& probeFilter : probeFilters){
36 desc.
add<std::vector<std::string>>(
"probeFilters",std::vector<std::string>());
53 if(
evtTrigSel_(trigResults,trigNames)==
false)
return;
56 for(
auto& tagKey : tagTrigKeys){
76 isAND_(config.getParameter<
bool>(
"isAND"))
78 auto filterSetConfigs = config.
getParameter<std::vector<edm::ParameterSet>>(
"filterSets");
79 for(
auto& filterSetConfig : filterSetConfigs)
filterSets_.emplace_back(
FilterSet(filterSetConfig));
86 desc.
add<
bool>(
"isAND",
false);
93 bool isFirstFilterSet =
true;
95 auto keysOfFilterSet = filterSet.getPassingKeys(trigEvt);
96 if(isFirstFilterSet) passingKeys = keysOfFilterSet;
98 isFirstFilterSet =
false;
107 for(
auto&
key : keys) {
108 if(
std::count(keysToMerge.begin(),keysToMerge.end(),
key)==0){
113 for(
const auto key : keysToMerge){
129 filters_(config.getParameter<
std::vector<
std::
string>>(
"filters")),
136 selectionStr_(config.getParameter<
std::
string>(
"selectionStr")),
137 isANDForExpandedPaths_(config.getParameter<
bool>(
"isANDForExpandedPaths")),
138 verbose_(config.getParameter<
int>(
"verbose")),
148 desc.
add<
bool>(
"isANDForExpandedPaths",
false);
149 desc.
add<
int>(
"verbose",1);
166 edm::LogError(
"TrigObjTnPHistColl") <<
" error, TrigObjTnPHistColl::PathSelector is not initalised, returning false ";
181 bool accept = pathIndex < trigNames.
size() ? trigResults.
accept(pathIndex) :
false;
182 token.tokenResult =
accept;
196 if ( pathName.find(
'*') != std::string::npos ) {
198 expandedSelStr.replace( expandedSelStr.find( pathName ), pathName.size(), pathPatternExpanded);
201 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()));
216 matched = hltConfig.
matched(trigNames, pathPattern);
219 if( matched.empty() ) {
220 if(verbose>=1 )
edm::LogWarning(
"TrigObjTnPHistColl::PathSelector") <<
"pattern: \"" << pathPattern <<
"\" could not be resolved, please check your triggers are spelt correctly and present in the data you are running over";
226 for(
unsigned iVers = 0; iVers < matched.size(); ++iVers ) {
227 if( iVers > 0 ) expanded.append( isAND ?
" AND " :
" OR " );
228 expanded.append( matched.at( iVers ) );
230 expanded.append(
")" );
232 edm::LogInfo(
"TrigObjTnPHistColl::PathSelector" ) <<
"Logical expression : \"" << pathPattern <<
"\"\n" 233 <<
" expanded to: \"" << expanded <<
"\"";
243 desc.
add<std::vector<std::string> >(
"filters",std::vector<std::string>());
244 desc.
add<
bool>(
"isAND",
true);
251 bool firstFilter =
true;
255 passingKeys = trigKeys;
257 }
else mergeTrigKeys(passingKeys,trigKeys,isAND_);
259 cleanTrigKeys(passingKeys);
267 auto absPos = varName.rfind(
"Abs");
268 if(absPos != std::string::npos && absPos+3 == varName.size() ) {
270 varName = varName.erase(absPos);
276 std::ostringstream
msg;
277 msg<<
"var "<<varName<<
" not recognised (use pt or p rather than et or e for speed!) ";
278 if(
isAbs_) msg<<
" varName was \"Abs\" suffex cleaned where it tried to remove \"Abs\" at the end of the variable name ";
279 msg <<__FILE__<<
","<<__LINE__<<std::endl;
286 var_(config.getParameter<
std::
string>(
"var"))
308 massBins_(convertToFloat(config.getParameter<
std::vector<double> >(
"massBins")))
310 const auto histConfigs = config.
getParameter<std::vector<edm::ParameterSet> >(
"configs");
311 for(
const auto& histConfig : histConfigs){
320 std::vector<double> massBins;
322 desc.
add<std::vector<double>>(
"massBins",massBins);
328 std::vector<std::pair<HistFiller,ConcurrentMonitorElement> >
hists;
337 bins_(convertToFloat(config.getParameter<
std::vector<double> >(
"bins"))),
338 nameSuffex_(config.getParameter<
std::
string>(
"nameSuffex")),
339 titleSuffex_(config.getParameter<
std::
string>(
"titleSuffex"))
348 desc.
add<std::vector<double> >(
"bins",{-2.5,-1.5,0,1.5,2.5});
356 const std::vector<float>& massBins)
const 359 bins_.size()-1,
bins_.data(),massBins.size()-1,massBins.data());
366 hists_ = histDefs.
bookHists(iBooker,name,title);
371 for(
auto&
hist : hists_){
380 hists_.bookHists(iBooker,tagName+
"_"+probeFilter_,tagName+
"_"+probeFilter_,histDefs);
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);
T getParameter(std::string const &) const
void fill(const trigger::TriggerObject &probe, float mass) const
std::string selectionStr_
static void cleanTrigKeys(trigger::Keys &keys)
static const std::vector< std::string > matched(const std::vector< std::string > &inputs, const std::string &pattern)
regexp processing
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void bookHists(DQMStore::ConcurrentBooker &iBooker, const std::string &name, const std::string &title, const HistDefs &histDefs)
The single EDProduct to be saved for each event (AOD case)
trigger::size_type sizeFilters() const
void operator()(const trigger::TriggerObject &probe, float mass, const ConcurrentMonitorElement &hist) const
static edm::ParameterSetDescription makePSetDescription()
std::string expandedSelStr_
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)
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
const Keys & filterKeys(trigger::size_type index) const
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
bool isANDForExpandedPaths_
static edm::ParameterSetDescription makePSetDescription()
Data(const edm::ParameterSet &config)
FilterSet(const edm::ParameterSet &config)
Strings::size_type size() const
void bookHists(const std::string &tagName, DQMStore::ConcurrentBooker &iBooker, const HistDefs &histDefs)
std::vector< float > massBins_
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)
static edm::ParameterSetDescription makePSetDescription()
void init(const HLTConfigProvider &hltConfig)
void setCurrentFolder(std::string const &fullpath)
unsigned int triggerIndex(std::string const &name) const
std::vector< float > bins_
std::vector< OperandToken > & operandTokenVector()
return the vector of operand tokens
const TriggerObjectCollection & getObjects() const
ConcurrentMonitorElement book2D(Args &&...args)
void fill(const trigger::size_type tagKey, const trigger::TriggerEvent &trigEvt, const VarRangeCutColl< trigger::TriggerObject > &probeCuts) const
def unique(seq, keepstr=True)
const std::string & usedProcessName() const
getters
Cos< T >::type cos(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void mergeTrigKeys(trigger::Keys &keys, const trigger::Keys &keysToMerge, bool isAND)
float(trigger::TriggerObject::* varFunc_)() const
static const char *const trigNames[]
HistFiller(const edm::ParameterSet &config)
PathSelector(const edm::ParameterSet &config)
static std::string expandSelectionStr(const std::string &selStr, const HLTConfigProvider &hltConfig, bool isAND, int verbose)
static const std::vector< std::string > restoreVersion(const std::vector< std::string > &inputs, const std::string &trigger)
const trigger::Keys getPassingKeys(const trigger::TriggerEvent &trigEvt) const
std::vector< size_type > Keys
std::vector< std::pair< HistFiller, ConcurrentMonitorElement > > bookHists(DQMStore::ConcurrentBooker &iBooker, const std::string &name, const std::string &title) const
void bookHists(DQMStore::ConcurrentBooker &iBooker)
HistDefs(const edm::ParameterSet &config)
std::vector< FilterSet > filterSets_
VarRangeCutColl< trigger::TriggerObject > tagCuts_
char data[epos_bytes_allocation]
void fill(Args &&...args) const
ConcurrentMonitorElement book(DQMStore::ConcurrentBooker &iBooker, const std::string &name, const std::string &title, const std::vector< float > &massBins) const
VarRangeCutColl< trigger::TriggerObject > localCuts_
std::vector< Data > histData_
static edm::ParameterSetDescription makePSetDescription()
FilterSelector(const edm::ParameterSet &config)
static edm::ParameterSetDescription makePSetDescription()
bool operator()(const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
FilterSelector tagFilters_
void fill(const trigger::TriggerEvent &trigEvt, const edm::TriggerResults &trigResults, const edm::TriggerNames &trigNames) const
static edm::ParameterSetDescription makePSetDescription()
virtual const bool expressionResult() const
TrigObjVarF(std::string varName)