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"))
30 transform(pdBoolOperator.begin(), pdBoolOperator.end(), pdBoolOperator.begin(), ::tolower);
32 if( pdBoolOperator ==
"and" )
36 else if ( pdBoolOperator ==
"or" )
42 throw cms::Exception(
"TauDiscriminationProducerBase") <<
"PrediscriminantBooleanOperator defined incorrectly, options are: AND,OR";
48 for( std::vector<std::string>::const_iterator iDisc = prediscriminantsNames.begin();
49 iDisc != prediscriminantsNames.end(); ++iDisc )
57 thisDiscriminator.cut =
cut;
64 produces<TauDiscriminator>();
67 template<
class TauType,
class TauDiscriminator>
71 beginEvent(event, eventSetup);
75 event.getByLabel(TauProducer_, taus);
80 std::auto_ptr<TauDiscriminator>
output(
new TauDiscriminator(
TauRefProd(taus)));
82 size_t nTaus = taus->size();
85 size_t nPrediscriminants = prediscriminants_.size();
86 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
88 prediscriminants_[iDisc].fill(event);
93 prediscriminants_[iDisc].handle->keyProduct().
id();
94 if (tauProductID != discKeyId) {
96 <<
"The tau collection with input tag " << TauProducer_
97 <<
" has product ID: " << tauProductID
98 <<
" but the pre-discriminator with input tag "
99 << prediscriminants_[iDisc].label
100 <<
" is keyed with product ID: " << discKeyId << std::endl;
105 for(
size_t iTau = 0; iTau < nTaus; ++iTau )
108 TauRef tauRef(taus, iTau);
110 bool passesPrediscriminants =
true;
112 for(
size_t iDisc = 0; iDisc < nPrediscriminants; ++iDisc )
115 double discResult = (*prediscriminants_[iDisc].handle)[tauRef];
116 uint8_t thisPasses = ( discResult > prediscriminants_[iDisc].cut ) ? 1 : 0;
133 if( thisPasses ^ andPrediscriminants_ )
135 passesPrediscriminants = ( andPrediscriminants_ ? 0 : 1 );
140 double result = prediscriminantFailValue_;
141 if( passesPrediscriminants )
144 result = discriminate(tauRef);
148 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 &)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
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
std::string getProducerString< PFTau >()
edm::InputTag TauProducer_
double prediscriminantFailValue_