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>
73 beginEvent(event, eventSetup);
77 event.getByToken(Tau_token, taus);
82 std::auto_ptr<TauDiscriminator>
output(
new TauDiscriminator(
TauRefProd(taus)));
84 size_t nTaus = taus->size();
87 size_t nPrediscriminants = prediscriminants_.size();
88 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
90 prediscriminants_[iDisc].fill(event);
95 prediscriminants_[iDisc].handle->keyProduct().
id();
96 if (tauProductID != discKeyId) {
98 <<
"The tau collection with input tag " << TauProducer_
99 <<
" has product ID: " << tauProductID
100 <<
" but the pre-discriminator with input tag "
101 << prediscriminants_[iDisc].label
102 <<
" is keyed with product ID: " << discKeyId << std::endl;
107 for(
size_t iTau = 0; iTau < nTaus; ++iTau )
110 TauRef tauRef(taus, iTau);
112 bool passesPrediscriminants = ( andPrediscriminants_ ? 1 : 0 );
114 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
117 double discResult = (*prediscriminants_[iDisc].handle)[tauRef];
118 uint8_t thisPasses = ( discResult > prediscriminants_[iDisc].cut ) ? 1 : 0;
135 if( thisPasses ^ andPrediscriminants_ )
137 passesPrediscriminants = ( andPrediscriminants_ ? 0 : 1 );
142 double result = prediscriminantFailValue_;
143 if( passesPrediscriminants )
146 result = discriminate(tauRef);
150 output->setValue(iTau, result);
T getParameter(std::string const &) const
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_