Main Page
Namespaces
Classes
Package Documentation
CommonTools
Utils
interface
StringCutObjectSelector.h
Go to the documentation of this file.
1
#ifndef CommonTools_Utils_StringCutObjectSelector_h
2
#define CommonTools_Utils_StringCutObjectSelector_h
3
/* \class StringCutObjectSelector
4
*
5
* \author Luca Lista, INFN
6
*
7
* $Id: StringCutObjectSelector.h,v 1.4 2012/06/26 21:09:37 wmtan Exp $
8
*/
9
#include "
FWCore/Utilities/interface/EDMException.h
"
10
#include "
CommonTools/Utils/src/SelectorPtr.h
"
11
#include "
CommonTools/Utils/src/SelectorBase.h
"
12
#include "
CommonTools/Utils/interface/cutParser.h
"
13
#include "
FWCore/Utilities/interface/ObjectWithDict.h
"
14
15
template
<
typename
T,
bool
DefaultLazyness=false>
16
struct
StringCutObjectSelector
{
17
StringCutObjectSelector
(
const
std::string
&
cut
,
bool
lazy=DefaultLazyness) :
18
type_
(typeid(
T
)) {
19
if
(! reco::parser::cutParser<T>(cut,
select_
, lazy)) {
20
throw
edm::Exception
(
edm::errors::Configuration
,
21
"failed to parse \""
+ cut +
"\""
);
22
}
23
}
24
StringCutObjectSelector
(
const
reco::parser::SelectorPtr
&
select
) :
25
select_
(select),
26
type_
(typeid(
T
)) {
27
}
28
bool
operator()
(
const
T
&
t
)
const
{
29
edm::ObjectWithDict
o
(
type_
, const_cast<T *>(& t));
30
return
(*
select_
)(
o
);
31
}
32
33
private
:
34
reco::parser::SelectorPtr
select_
;
35
edm::TypeWithDict
type_
;
36
};
37
38
#endif
edm::ObjectWithDict
Definition:
ObjectWithDict.h:17
Exception
Definition:
hltDiff.cc:292
SelectorBase.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
StringCutObjectSelector
Definition:
StringCutObjectSelector.h:16
cutParser.h
TauGenJetsDecayModeSelectorAllHadrons_cfi.select
select
Definition:
TauGenJetsDecayModeSelectorAllHadrons_cfi.py:5
StringCutObjectSelector::type_
edm::TypeWithDict type_
Definition:
StringCutObjectSelector.h:35
SelectorPtr.h
edm::errors::Configuration
Definition:
EDMException.h:36
EDMException.h
ObjectWithDict.h
protons_cff.t
t
Definition:
protons_cff.py:34
StringCutObjectSelector::select_
reco::parser::SelectorPtr select_
Definition:
StringCutObjectSelector.h:34
StringCutObjectSelector::StringCutObjectSelector
StringCutObjectSelector(const reco::parser::SelectorPtr &select)
Definition:
StringCutObjectSelector.h:24
connectstrParser.o
o
Definition:
connectstrParser.py:72
reco::parser::SelectorPtr
boost::shared_ptr< SelectorBase > SelectorPtr
Definition:
SelectorPtr.h:17
TkAlMuonSelectors_cfi.cut
cut
Definition:
TkAlMuonSelectors_cfi.py:5
edm::TypeWithDict
Definition:
TypeWithDict.h:38
T
long double T
Definition:
Basic3DVectorLD.h:66
StringCutObjectSelector::operator()
bool operator()(const T &t) const
Definition:
StringCutObjectSelector.h:28
StringCutObjectSelector::StringCutObjectSelector
StringCutObjectSelector(const std::string &cut, bool lazy=DefaultLazyness)
Definition:
StringCutObjectSelector.h:17
Generated for CMSSW Reference Manual by
1.8.11