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);
162 template<>
std::string getProducerString<pat::Tau>() {
return "PATTauProducer"; }
T getParameter(std::string const &) const
edm::RefProd< TauCollection > TauRefProd
std::string getProducerString< CaloTau >()
TauDiscriminationProducerBase()
std::vector< TauDiscInfo > prediscriminants_
uint8_t andPrediscriminants_
void produce(edm::Event &, const edm::EventSetup &)
virtual void endEvent(edm::Event &evt)
edm::EDGetTokenT< TauCollection > Tau_token
virtual double discriminate(const TauRef &tau) const =0
std::string getProducerString< PFTau >()
virtual void beginEvent(const edm::Event &evt, const edm::EventSetup &evtSetup)
edm::InputTag TauProducer_
double prediscriminantFailValue_