8 template<
class TauType,
class TauDiscriminator>
11 throw cms::Exception(
"TauDiscriminationProducerBase") <<
" -- default ctor called; derived classes must call " <<
12 "TauDiscriminationProducerBase(const ParameterSet&)";
16 template<
class TauType,
class TauDiscriminator>
18 : moduleLabel_(iConfig.getParameter<
std::
string>(
"@module_label"))
31 transform(pdBoolOperator.begin(), pdBoolOperator.end(), pdBoolOperator.begin(), ::tolower);
33 if( pdBoolOperator ==
"and" )
37 else if ( pdBoolOperator ==
"or" )
43 throw cms::Exception(
"TauDiscriminationProducerBase") <<
"PrediscriminantBooleanOperator defined incorrectly, options are: AND,OR";
47 std::vector<std::string> prediscriminantsNames = prediscriminantConfig.getParameterNamesForType<
edm::ParameterSet>();
49 for( std::vector<std::string>::const_iterator iDisc = prediscriminantsNames.begin();
50 iDisc != prediscriminantsNames.end(); ++iDisc )
58 thisDiscriminator.cut =
cut;
59 thisDiscriminator.disc_token = consumes<TauDiscriminator>(
label);
66 produces<TauDiscriminator>();
69 template<
class TauType,
class TauDiscriminator>
85 size_t nTaus = taus->size();
89 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
97 if (tauProductID != discKeyId) {
100 <<
" has product ID: " << tauProductID
101 <<
" but the pre-discriminator with input tag " 103 <<
" is keyed with product ID: " << discKeyId << std::endl;
108 for(
size_t iTau = 0; iTau < nTaus; ++iTau )
111 TauRef tauRef(taus, iTau);
115 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
138 passesPrediscriminants = ( andPrediscriminants_ ? 0 : 1 );
144 if( passesPrediscriminants )
151 output->setValue(iTau, result);
159 template<
class TauType,
class TauDiscriminator>
170 producer_params.
add<
double>(
"cut",0.);
181 template <
class TauType,
class TauDiscriminator>
190 <<
"Unsupported TauType used. You must use either PFTau, PATTau or CaloTau.";
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
edm::RefProd< TauCollection > TauRefProd
TauDiscriminationProducerBase()
std::vector< TauDiscInfo > prediscriminants_
void produce(edm::Event &, const edm::EventSetup &) override
uint8_t andPrediscriminants_
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
virtual void beginEvent(const edm::Event &, const edm::EventSetup &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< TauCollection > Tau_token
virtual double discriminate(const TauRef &tau) const =0
static std::string getTauTypeString()
helper method to retrieve tau type name, e.g. to build correct cfi getter
edm::InputTag TauProducer_
double prediscriminantFailValue_
virtual void endEvent(edm::Event &)