CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
PFTauDiscriminants::DiscriminantBase< T > Class Template Referenceabstract

#include <PFTauDiscriminantBase.h>

Inheritance diagram for PFTauDiscriminants::DiscriminantBase< T >:
PFTauDiscriminants::Discriminant

Public Types

typedef std::vector< T >
::const_iterator 
myVectorIterator
 

Public Member Functions

void branchTree (TTree *theTree)
 add a branch to a ttree corresponding to this variable More...
 
void compute (PFTauDiscriminantManager *input)
 
 DiscriminantBase (std::string name, std::string rootTypeName, bool branchAsSimpleDataType, bool isMultiple, T defaultValue)
 
void fillMVA (std::vector< PhysicsTools::Variable::Value > &mvaHolder) const
 
virtual void setNullResult (PFTauDiscriminantManager *input)
 
virtual ~DiscriminantBase ()
 
- Public Member Functions inherited from PFTauDiscriminants::Discriminant
 Discriminant (std::string name, std::string rootTypeName, bool branchAsSimpleDataType)
 
std::string name () const
 
std::string rootTypeName () const
 
PhysicsTools::AtomicId theAtomicId () const
 
virtual ~Discriminant ()
 

Protected Member Functions

virtual void doComputation (PFTauDiscriminantManager *input, std::vector< T > &result)=0
 
- Protected Member Functions inherited from PFTauDiscriminants::Discriminant
bool branchSimply () const
 determines whether or not to use simple struct like branching or custom class branching (e.g. TLorentzVector) More...
 

Private Attributes

T defaultValue_
 
bool isMultiple_
 
std::vector< Tresult_
 
std::vector< T > * resultPtr_
 
T singleResult_
 

Detailed Description

template<class T>
class PFTauDiscriminants::DiscriminantBase< T >

Definition at line 69 of file PFTauDiscriminantBase.h.

Member Typedef Documentation

template<class T>
typedef std::vector<T>::const_iterator PFTauDiscriminants::DiscriminantBase< T >::myVectorIterator

Definition at line 76 of file PFTauDiscriminantBase.h.

Constructor & Destructor Documentation

template<class T>
PFTauDiscriminants::DiscriminantBase< T >::DiscriminantBase ( std::string  name,
std::string  rootTypeName,
bool  branchAsSimpleDataType,
bool  isMultiple,
T  defaultValue 
)
inlineexplicit

Definition at line 71 of file PFTauDiscriminantBase.h.

72  :Discriminant(name, rootTypeName, branchAsSimpleDataType),isMultiple_(isMultiple),defaultValue_(defaultValue){
74  };
Discriminant(std::string name, std::string rootTypeName, bool branchAsSimpleDataType)
template<class T>
virtual PFTauDiscriminants::DiscriminantBase< T >::~DiscriminantBase ( )
inlinevirtual

Definition at line 76 of file PFTauDiscriminantBase.h.

76 {};

Member Function Documentation

template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::branchTree ( TTree *  theTree)
inlinevirtual

add a branch to a ttree corresponding to this variable

Implements PFTauDiscriminants::Discriminant.

Definition at line 111 of file PFTauDiscriminantBase.h.

111  {
112  if (!this->branchSimply())
113  {
114  edm::LogInfo("PFTauDiscriminantBase") << "Branching TTree: " << theTree->GetName() << " with full class name (bronch)";
115  theTree->Branch(name().c_str(), rootTypeName().c_str(), &resultPtr_);
116  }
117  else
118  {
119  edm::LogInfo("PFTauDiscriminantBase") << "Branching TTree: " << theTree->GetName() << " with struct style branch (leaflist)";
120  std::stringstream branchType;
121  branchType << name() << "/" << rootTypeName(); //eg D, F, I, etc
122  theTree->Branch(this->name().c_str(), &singleResult_, branchType.str().c_str());
123  }
124  }
bool branchSimply() const
determines whether or not to use simple struct like branching or custom class branching (e...
template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::compute ( PFTauDiscriminantManager input)
inlinevirtual

computes the associated quanity for the tau object that is loaded in the PFTauDiscriminantManager implemented in derived implementation class

Implements PFTauDiscriminants::Discriminant.

Definition at line 87 of file PFTauDiscriminantBase.h.

88  {
89  result_.clear();
90 
91  if (input)
93  else
94  edm::LogError("DiscriminantBase") << "Error in DiscriminantBase - trying to compute discriminants on null PFTauDecayMode pointer!";
95 
96  size_t numberOfResultsReturned = result_.size();
97  if(!numberOfResultsReturned) //if there are no results, ROOT branches of simple variables must be filled w/ the default value
98  {
100  } else
101  {
102  if(!isMultiple_ && numberOfResultsReturned > 1)
103  {
104  edm::LogWarning("PFTauDiscriminants::DiscriminantBase") << "Warning, multiple discriminant values recieved for a non-multiple branch, taking only the first!";
105  }
106  singleResult_ = result_[0];
107  }
108  }
virtual void doComputation(PFTauDiscriminantManager *input, std::vector< T > &result)=0
template<class T>
virtual void PFTauDiscriminants::DiscriminantBase< T >::doComputation ( PFTauDiscriminantManager input,
std::vector< T > &  result 
)
protectedpure virtual
template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::fillMVA ( std::vector< PhysicsTools::Variable::Value > &  mvaHolder) const
inlinevirtual

Implements PFTauDiscriminants::Discriminant.

Definition at line 126 of file PFTauDiscriminantBase.h.

126  {
127  if (isMultiple_)
128  {
129  for(myVectorIterator aResult = result_.begin(); aResult != result_.end(); ++aResult)
130  {
131  mvaHolder.push_back(PhysicsTools::Variable::Value(theAtomicId(), static_cast<double>(*aResult)));
132  }
133  }
134  else
135  {
136  mvaHolder.push_back(PhysicsTools::Variable::Value(theAtomicId(), static_cast<double>(singleResult_)));
137  }
138  }
PhysicsTools::AtomicId theAtomicId() const
Helper class that can contain an identifier-value pair.
Definition: Variable.h:52
std::vector< T >::const_iterator myVectorIterator
template<class T>
virtual void PFTauDiscriminants::DiscriminantBase< T >::setNullResult ( PFTauDiscriminantManager input)
inlinevirtual

Member Data Documentation

template<class T>
T PFTauDiscriminants::DiscriminantBase< T >::defaultValue_
private
template<class T>
bool PFTauDiscriminants::DiscriminantBase< T >::isMultiple_
private
template<class T>
std::vector<T> PFTauDiscriminants::DiscriminantBase< T >::result_
private
template<class T>
std::vector<T>* PFTauDiscriminants::DiscriminantBase< T >::resultPtr_
private
template<class T>
T PFTauDiscriminants::DiscriminantBase< T >::singleResult_
private