Classes | |
struct | ComputerAndCut |
Public Types | |
typedef std::vector < ComputerAndCut > | CutList |
typedef std::map< int, CutList::iterator > | DecayModeToCutMap |
Public Member Functions | |
void | beginEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
double | discriminate (const PFTauRef &thePFTau) |
PFTauDecayModeCutMultiplexer (const edm::ParameterSet &) | |
~PFTauDecayModeCutMultiplexer () | |
Private Attributes | |
DecayModeToCutMap | computerMap_ |
CutList | computers_ |
edm::InputTag | discriminantToMultiplex_ |
edm::InputTag | pfTauDecayModeIndexSrc_ |
edm::Handle< PFTauDiscriminator > | pfTauDecayModeIndices |
edm::Handle< PFTauDiscriminator > | targetDiscriminant |
Definition at line 31 of file PFTauDecayModeCutMultiplexer.cc.
typedef std::vector<ComputerAndCut> PFTauDecayModeCutMultiplexer::CutList |
Definition at line 41 of file PFTauDecayModeCutMultiplexer.cc.
typedef std::map<int, CutList::iterator> PFTauDecayModeCutMultiplexer::DecayModeToCutMap |
Definition at line 42 of file PFTauDecayModeCutMultiplexer.cc.
PFTauDecayModeCutMultiplexer::PFTauDecayModeCutMultiplexer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 61 of file PFTauDecayModeCutMultiplexer.cc.
References computerMap_, PFTauDecayModeCutMultiplexer::ComputerAndCut::computerName, computers_, discriminantToMultiplex_, Exception, edm::ParameterSet::getParameter(), pfTauDecayModeIndexSrc_, and PFTauDecayModeCutMultiplexer::ComputerAndCut::userCut.
:PFTauDiscriminationProducerBase(iConfig) { pfTauDecayModeIndexSrc_ = iConfig.getParameter<edm::InputTag>("PFTauDecayModeSrc"); discriminantToMultiplex_ = iConfig.getParameter<edm::InputTag>("PFTauDiscriminantToMultiplex"); //get the computer/decay mode map std::vector<edm::ParameterSet> decayModeMap = iConfig.getParameter<std::vector<edm::ParameterSet> >("computers"); computers_.reserve(decayModeMap.size()); // for each decay mode MVA implementation (which may correspond to multiple decay modes, map the decay modes to the correct MVA computer for(std::vector<edm::ParameterSet>::const_iterator iComputer = decayModeMap.begin(); iComputer != decayModeMap.end(); ++iComputer) { ComputerAndCut toInsert; toInsert.computerName = iComputer->getParameter<std::string>("computerName"); toInsert.userCut = iComputer->getParameter<double>("cut"); CutList::iterator computerJustAdded = computers_.insert(computers_.end(), toInsert); //add this computer to the end of the list //populate the map std::vector<int> associatedDecayModes = iComputer->getParameter<std::vector<int> >("decayModeIndices"); for(std::vector<int>::const_iterator iDecayMode = associatedDecayModes.begin(); iDecayMode != associatedDecayModes.end(); ++iDecayMode) { //map this integer specifying the decay mode to the MVA comptuer we just added to the list std::pair<DecayModeToCutMap::iterator, bool> insertResult = computerMap_.insert(std::make_pair(*iDecayMode, computerJustAdded)); //make sure we aren't double mapping a decay mode if(insertResult.second == false) { //indicates that the current key (decaymode) has already been entered! throw cms::Exception("PFTauDecayModeCutMultiplexer::ctor") << "A tau decay mode: " << *iDecayMode << " has been mapped to two different MVA implementations, " << insertResult.first->second->computerName << " and " << toInsert.computerName << ". Please check the appropriate cfi file." << std::endl; } } } }
PFTauDecayModeCutMultiplexer::~PFTauDecayModeCutMultiplexer | ( | ) | [inline] |
Definition at line 34 of file PFTauDecayModeCutMultiplexer.cc.
{}
void PFTauDecayModeCutMultiplexer::beginEvent | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.
Definition at line 101 of file PFTauDecayModeCutMultiplexer.cc.
References discriminantToMultiplex_, edm::Event::getByLabel(), pfTauDecayModeIndexSrc_, pfTauDecayModeIndices, and targetDiscriminant.
{ iEvent.getByLabel(pfTauDecayModeIndexSrc_, pfTauDecayModeIndices); iEvent.getByLabel(discriminantToMultiplex_, targetDiscriminant); }
double PFTauDecayModeCutMultiplexer::discriminate | ( | const PFTauRef & | thePFTau | ) |
Definition at line 108 of file PFTauDecayModeCutMultiplexer.cc.
References computerMap_, and pfTauDecayModeIndices.
{ // get decay mode for current tau int decayMode = lrint( (*pfTauDecayModeIndices)[pfTau] ); //convert to int // get value we are trying to multiplex float valueToMultiplex = (*targetDiscriminant)[pfTau]; // Get correct cut DecayModeToCutMap::iterator iterToComputer = computerMap_.find(decayMode); if(iterToComputer != computerMap_.end()) //if we don't have a MVA mapped to this decay mode, skip it, it fails. { // use the supplied cut to make a decision if (valueToMultiplex > iterToComputer->second->userCut) return 1.0; else return 0.0; } // no computer associated to this decay mode; it fails return 0.; }
Definition at line 54 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by discriminate(), and PFTauDecayModeCutMultiplexer().
Definition at line 55 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by PFTauDecayModeCutMultiplexer().
Definition at line 52 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by beginEvent(), and PFTauDecayModeCutMultiplexer().
Definition at line 49 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by beginEvent(), and PFTauDecayModeCutMultiplexer().
Definition at line 57 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by beginEvent(), and discriminate().
Definition at line 58 of file PFTauDecayModeCutMultiplexer.cc.
Referenced by beginEvent().