CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Attributes
PFTauDecayModeCutMultiplexer Class Reference
Inheritance diagram for PFTauDecayModeCutMultiplexer:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ComputerAndCut
 

Public Types

typedef std::vector
< ComputerAndCut
CutList
 
typedef std::map< int,
CutList::iterator > 
DecayModeToCutMap
 
- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
typedef std::vector< TauType > TauCollection
 
typedef edm::Ref< TauCollectionTauRef
 
typedef edm::RefProd
< TauCollection
TauRefProd
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

void beginEvent (const edm::Event &event, const edm::EventSetup &eventSetup)
 
double discriminate (const PFTauRef &thePFTau)
 
 PFTauDecayModeCutMultiplexer (const edm::ParameterSet &)
 
 ~PFTauDecayModeCutMultiplexer ()
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual double discriminate (const TauRef &tau)=0
 
virtual void endEvent (edm::Event &evt)
 
void produce (edm::Event &, const edm::EventSetup &)
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
virtual ~TauDiscriminationProducerBase ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

DecayModeToCutMap computerMap_
 
CutList computers_
 
edm::InputTag discriminantToMultiplex_
 
edm::InputTag pfTauDecayModeIndexSrc_
 
edm::Handle< PFTauDiscriminatorpfTauDecayModeIndices
 
edm::Handle< PFTauDiscriminatortargetDiscriminant
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 31 of file PFTauDecayModeCutMultiplexer.cc.

Member Typedef Documentation

Definition at line 41 of file PFTauDecayModeCutMultiplexer.cc.

typedef std::map<int, CutList::iterator> PFTauDecayModeCutMultiplexer::DecayModeToCutMap

Definition at line 42 of file PFTauDecayModeCutMultiplexer.cc.

Constructor & Destructor Documentation

PFTauDecayModeCutMultiplexer::PFTauDecayModeCutMultiplexer ( const edm::ParameterSet iConfig)
explicit

Definition at line 61 of file PFTauDecayModeCutMultiplexer.cc.

References computerMap_, PFTauDecayModeCutMultiplexer::ComputerAndCut::computerName, computers_, discriminantToMultiplex_, edm::hlt::Exception, edm::ParameterSet::getParameter(), pfTauDecayModeIndexSrc_, AlCaHLTBitMon_QueryRunRegistry::string, and PFTauDecayModeCutMultiplexer::ComputerAndCut::userCut.

62 {
63  pfTauDecayModeIndexSrc_ = iConfig.getParameter<edm::InputTag>("PFTauDecayModeSrc");
64  discriminantToMultiplex_ = iConfig.getParameter<edm::InputTag>("PFTauDiscriminantToMultiplex");
65 
66  //get the computer/decay mode map
67  std::vector<edm::ParameterSet> decayModeMap = iConfig.getParameter<std::vector<edm::ParameterSet> >("computers");
68  computers_.reserve(decayModeMap.size());
69 
70  // for each decay mode MVA implementation (which may correspond to multiple decay modes, map the decay modes to the correct MVA computer
71  for(std::vector<edm::ParameterSet>::const_iterator iComputer = decayModeMap.begin();
72  iComputer != decayModeMap.end();
73  ++iComputer)
74  {
75  ComputerAndCut toInsert;
76  toInsert.computerName = iComputer->getParameter<std::string>("computerName");
77  toInsert.userCut = iComputer->getParameter<double>("cut");
78  CutList::iterator computerJustAdded = computers_.insert(computers_.end(), toInsert); //add this computer to the end of the list
79 
80  //populate the map
81  std::vector<int> associatedDecayModes = iComputer->getParameter<std::vector<int> >("decayModeIndices");
82  for(std::vector<int>::const_iterator iDecayMode = associatedDecayModes.begin();
83  iDecayMode != associatedDecayModes.end();
84  ++iDecayMode)
85  {
86  //map this integer specifying the decay mode to the MVA comptuer we just added to the list
87  std::pair<DecayModeToCutMap::iterator, bool> insertResult = computerMap_.insert(std::make_pair(*iDecayMode, computerJustAdded));
88 
89  //make sure we aren't double mapping a decay mode
90  if(insertResult.second == false) { //indicates that the current key (decaymode) has already been entered!
91  throw cms::Exception("PFTauDecayModeCutMultiplexer::ctor") << "A tau decay mode: " << *iDecayMode << " has been mapped to two different MVA implementations, "
92  << insertResult.first->second->computerName << " and " << toInsert.computerName
93  << ". Please check the appropriate cfi file." << std::endl;
94  }
95  }
96  }
97 }
T getParameter(std::string const &) const
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
PFTauDecayModeCutMultiplexer::~PFTauDecayModeCutMultiplexer ( )
inline

Definition at line 34 of file PFTauDecayModeCutMultiplexer.cc.

34 {}

Member Function Documentation

void PFTauDecayModeCutMultiplexer::beginEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual
double PFTauDecayModeCutMultiplexer::discriminate ( const PFTauRef thePFTau)

Definition at line 108 of file PFTauDecayModeCutMultiplexer.cc.

References computerMap_, and pfTauDecayModeIndices.

109 {
110  // get decay mode for current tau
111  int decayMode = lrint( (*pfTauDecayModeIndices)[pfTau] ); //convert to int
112 
113  // get value we are trying to multiplex
114  float valueToMultiplex = (*targetDiscriminant)[pfTau];
115 
116  // Get correct cut
117  DecayModeToCutMap::iterator iterToComputer = computerMap_.find(decayMode);
118  if(iterToComputer != computerMap_.end()) //if we don't have a MVA mapped to this decay mode, skip it, it fails.
119  {
120  // use the supplied cut to make a decision
121  if (valueToMultiplex > iterToComputer->second->userCut)
122  return 1.0;
123  else
124  return 0.0;
125  }
126 
127  // no computer associated to this decay mode; it fails
128  return 0.;
129 }
edm::Handle< PFTauDiscriminator > pfTauDecayModeIndices

Member Data Documentation

DecayModeToCutMap PFTauDecayModeCutMultiplexer::computerMap_
private

Definition at line 54 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by discriminate(), and PFTauDecayModeCutMultiplexer().

CutList PFTauDecayModeCutMultiplexer::computers_
private

Definition at line 55 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by PFTauDecayModeCutMultiplexer().

edm::InputTag PFTauDecayModeCutMultiplexer::discriminantToMultiplex_
private

Definition at line 52 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by beginEvent(), and PFTauDecayModeCutMultiplexer().

edm::InputTag PFTauDecayModeCutMultiplexer::pfTauDecayModeIndexSrc_
private

Definition at line 49 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by beginEvent(), and PFTauDecayModeCutMultiplexer().

edm::Handle<PFTauDiscriminator> PFTauDecayModeCutMultiplexer::pfTauDecayModeIndices
private

Definition at line 57 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by beginEvent(), and discriminate().

edm::Handle<PFTauDiscriminator> PFTauDecayModeCutMultiplexer::targetDiscriminant
private

Definition at line 58 of file PFTauDecayModeCutMultiplexer.cc.

Referenced by beginEvent().