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>
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>
74 beginEvent(event, eventSetup);
78 event.getByToken(Tau_token, taus);
83 std::auto_ptr<TauDiscriminator>
output(
new TauDiscriminator(
TauRefProd(taus)));
85 size_t nTaus = taus->size();
88 size_t nPrediscriminants = prediscriminants_.size();
89 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
91 prediscriminants_[iDisc].fill(event);
96 prediscriminants_[iDisc].handle->keyProduct().
id();
97 if (tauProductID != discKeyId) {
99 <<
"The tau collection with input tag " << TauProducer_
100 <<
" has product ID: " << tauProductID
101 <<
" but the pre-discriminator with input tag "
102 << prediscriminants_[iDisc].label
103 <<
" is keyed with product ID: " << discKeyId << std::endl;
108 for(
size_t iTau = 0; iTau < nTaus; ++iTau )
111 TauRef tauRef(taus, iTau);
113 bool passesPrediscriminants = ( andPrediscriminants_ ? 1 : 0 );
115 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
118 double discResult = (*prediscriminants_[iDisc].handle)[tauRef];
119 uint8_t thisPasses = ( discResult > prediscriminants_[iDisc].cut ) ? 1 : 0;
136 if( thisPasses ^ andPrediscriminants_ )
138 passesPrediscriminants = ( andPrediscriminants_ ? 0 : 1 );
143 double result = prediscriminantFailValue_;
144 if( passesPrediscriminants )
147 result = discriminate(tauRef); ++tauIndex_;
151 output->setValue(iTau, result);
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 &)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< TauCollection > Tau_token
std::string getProducerString< PFTau >()
edm::InputTag TauProducer_
double prediscriminantFailValue_