38 using namespace PFTauDiscriminants;
52 typedef std::vector<MVAComputerFromDB>
MVAList;
56 double discriminate(
const PFTauRef&);
83 std::vector<edm::ParameterSet> decayModeMap = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"computers");
85 for(std::vector<edm::ParameterSet>::const_iterator iComputer = decayModeMap.begin(); iComputer != decayModeMap.end(); ++iComputer)
89 toInsert.
userCut = iComputer->getParameter<
double>(
"cut");
94 std::vector<int> associatedDecayModes = iComputer->getParameter<std::vector<int> >(
"decayModeIndices");
95 for(std::vector<int>::const_iterator iDecayMode = associatedDecayModes.begin();
96 iDecayMode != associatedDecayModes.end();
100 std::pair<DecayModeToMVAMap::iterator, bool> insertResult =
computerMap_.insert(std::make_pair(*iDecayMode, computerJustAdded));
103 if(insertResult.second ==
false) {
104 throw cms::Exception(
"PFTauMVADiscriminator::ctor") <<
"A tau decay mode: " << *iDecayMode <<
" has been mapped to two different MVA implementations, "
105 << insertResult.first->second->computerName <<
" and " << toInsert.
computerName
106 <<
". Please check the appropriate cfi file." << std::endl;
123 for(MVAList::iterator iMVAComputer =
computers_.begin(); iMVAComputer !=
computers_.end(); ++iMVAComputer)
125 delete iMVAComputer->computer;
140 for(MVAList::iterator iMVAComputer =
computers_.begin();
144 std::string nameToGet = iMVAComputer->computerName;
154 const PFTauDecayMode& theTauDecayMode = (*pfTauDecayModes)[pfTau];
159 DecayModeToMVAMap::iterator iterToComputer =
computerMap_.find(decayMode);
164 if ( (*mvaComputer) )
174 edm::LogWarning(
"PFTauMVADiscriminator") <<
"Warning: got a null pointer to MVA computer in conditions database"
175 <<
" for decay mode: " << decayMode <<
", expected MVA computer name: "
176 << iterToComputer->second->computerName;
181 if (result > 1) result = 1.;
182 else if (result < -1) result = 0.;
192 if (result > iterToComputer->second->userCut)
T getParameter(std::string const &) const
edm::InputTag pfTauDecayModeSrc_
DiscriminantList myDiscriminants_
void addDiscriminant(Discriminant *const aDiscriminant)
add a discriminant
#define DEFINE_FWK_MODULE(type)
bool setTau(const reco::PFTauDecayMode &theTau, bool prePass=false, bool preFail=false)
set objects for this discriminant
void beginEvent(const edm::Event &, const edm::EventSetup &)
hadronicTauDecayModes getDecayMode() const
void setEvent(const edm::Event &, double eventWeight)
set the current event. Must be called (once per event) before setTau or setNullResult ...
std::vector< PhysicsTools::Variable::Value > mvaComputerInput_
edm::Handle< PFTauDecayModeAssociation > pfTauDecayModes
PFTauMVADiscriminator(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< MVAComputerFromDB > MVAList
const_iterator begin()
iterators over the list
DecayModeToMVAMap computerMap_
collection::const_iterator const_iterator
PFTauDiscriminantManager discriminantManager_
double discriminate(const PFTauRef &)
std::map< int, MVAList::iterator > DecayModeToMVAMap
double prediscriminantFailValue_
PhysicsTools::MVAComputerCache * computer
void buildMVAComputerLink(std::vector< PhysicsTools::Variable::Value > &)
connect to an MVA computer