17 #include <boost/foreach.hpp>
80 <<
" Failed to find File = " << inputFileName <<
" !!\n";
83 const T*
object =
dynamic_cast<T*
>(inputFile->Get(objectName.data()));
85 throw cms::Exception(
"RecoTauDiscriminantCutMultiplexer::loadObjectFromFile")
86 <<
" Failed to load Object = " << objectName.data() <<
" from file = " << inputFileName.
fullPath().data() <<
" !!\n";
88 inputFilesToDelete.push_back(inputFile);
97 mvaOutput_normalization_(0)
104 if ( cfg.
exists(
"mvaOutput_normalization" ) ) {
111 typedef std::vector<edm::ParameterSet> VPSet;
113 for ( VPSet::const_iterator mappingEntry = mapping.begin();
114 mappingEntry != mapping.end(); ++mappingEntry ) {
115 unsigned category = mappingEntry->getParameter<uint32_t>(
"category");
117 if ( mappingEntry->existsAs<
double>(
"cut") ) {
118 cut->cutValue_ = mappingEntry->getParameter<
double>(
"cut");
120 }
else if ( mappingEntry->existsAs<
std::string>(
"cut") ) {
129 <<
" Undefined Configuration Parameter 'cut' !!\n";
140 for ( std::map<int, DiscriminantCutEntry*>::iterator it =
cuts_.begin();
141 it !=
cuts_.end(); ++it ) {
161 std::cout <<
"<RecoTauDiscriminantCutMultiplexer::discriminate>:" << std::endl;
165 double disc_result = (*toMultiplexHandle_)[
tau];
167 std::cout <<
"disc_result = " << disc_result << std::endl;
174 std::cout <<
"disc_result (normalized) = " << disc_result << std::endl;
177 double key_result = (*keyHandle_)[
tau];
178 DiscriminantCutMap::const_iterator cutIter =
cuts_.find(TMath::Nint(key_result));
181 if ( cutIter ==
cuts_.end() ) {
186 bool passesCuts =
false;
188 passesCuts = (disc_result > cutIter->second->cutValue_);
190 std::cout <<
"cutValue (fixed) = " << cutIter->second->cutValue_ <<
" --> passesCuts = " << passesCuts << std::endl;
193 double cutVariable = (*cutIter->second->cutVariable_)(*tau);
194 double xMin, xMax, dummy;
195 cutIter->second->cutFunction_->GetPoint(0, xMin, dummy);
196 cutIter->second->cutFunction_->GetPoint(cutIter->second->cutFunction_->GetN() - 1, xMax, dummy);
198 if ( cutVariable < (xMin + epsilon) ) cutVariable = xMin + epsilon;
199 else if ( cutVariable > (xMax - epsilon) ) cutVariable = xMax - epsilon;
200 double cutValue = cutIter->second->cutFunction_->Eval(cutVariable);
201 passesCuts = (disc_result > cutValue);
203 std::cout <<
"cutValue (@" << cutVariable <<
") = " << cutValue <<
" --> passesCuts = " << passesCuts << std::endl;
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< TFile * > inputFilesToDelete_
edm::Handle< reco::PFTauDiscriminator > keyHandle_
#define DEFINE_FWK_MODULE(type)
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup) override
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::Handle< reco::PFTauDiscriminator > toMultiplexHandle_
~RecoTauDiscriminantCutMultiplexer()
edm::EDGetTokenT< reco::PFTauDiscriminator > toMultiplex_token
edm::EDGetTokenT< reco::PFTauDiscriminator > key_token
std::map< int, DiscriminantCutEntry * > DiscriminantCutMap
double discriminate(const reco::PFTauRef &) override
const TGraph * cutFunction_
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
const TFormula * mvaOutput_normalization_
StringObjectFunction< reco::PFTau > * cutVariable_
LocationCode location() const
Where was the file found?
edm::InputTag toMultiplex_
RecoTauDiscriminantCutMultiplexer(const edm::ParameterSet &pset)
std::string fullPath() const
double prediscriminantFailValue_