CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Attributes

PFTauDiscriminants::DiscriminantBase< T > Class Template Reference

#include <PFTauDiscriminantBase.h>

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

List of all members.

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
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 ()

Protected Member Functions

virtual void doComputation (PFTauDiscriminantManager *input, std::vector< T > &result)=0

Private Attributes

defaultValue_
bool isMultiple_
std::vector< T > result_
std::vector< T > * resultPtr_
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,
defaultValue 
) [inline, explicit]

Definition at line 71 of file PFTauDiscriminantBase.h.

                                                                                     :Discriminant(name, rootTypeName, branchAsSimpleDataType),isMultiple_(isMultiple),defaultValue_(defaultValue){
         resultPtr_ = &result_;
      };
template<class T>
virtual PFTauDiscriminants::DiscriminantBase< T >::~DiscriminantBase ( ) [inline, virtual]

Definition at line 76 of file PFTauDiscriminantBase.h.

{};

Member Function Documentation

template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::branchTree ( TTree *  theTree) [inline, virtual]

add a branch to a ttree corresponding to this variable

Implements PFTauDiscriminants::Discriminant.

Definition at line 111 of file PFTauDiscriminantBase.h.

                                      {
         if (!this->branchSimply())
         {
            edm::LogInfo("PFTauDiscriminantBase") << "Branching TTree: " << theTree->GetName() << " with full class name (bronch)";
            theTree->Branch(name().c_str(), rootTypeName().c_str(), &resultPtr_); 
         }
         else
         {
            edm::LogInfo("PFTauDiscriminantBase") << "Branching TTree: " << theTree->GetName() << " with struct style branch (leaflist)";
            std::stringstream branchType;
            branchType << name() << "/" << rootTypeName(); //eg D, F, I, etc
            theTree->Branch(this->name().c_str(), &singleResult_, branchType.str().c_str());
         }
      }
template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::compute ( PFTauDiscriminantManager input) [inline, virtual]

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.

      {
         result_.clear();

         if (input)
            doComputation(input, result_); 
         else
            edm::LogError("DiscriminantBase") << "Error in DiscriminantBase - trying to compute discriminants on null PFTauDecayMode pointer!";

         size_t numberOfResultsReturned = result_.size();
         if(!numberOfResultsReturned) //if there are no results, ROOT branches of simple variables must be filled w/ the default value
         {
            singleResult_ = defaultValue_;
         } else
         {
            if(!isMultiple_ && numberOfResultsReturned > 1)
            {
               edm::LogWarning("PFTauDiscriminants::DiscriminantBase") << "Warning, multiple discriminant values recieved for a non-multiple branch, taking only the first!"; 
            }
            singleResult_ = result_[0];
         }
      }
template<class T>
virtual void PFTauDiscriminants::DiscriminantBase< T >::doComputation ( PFTauDiscriminantManager input,
std::vector< T > &  result 
) [protected, pure virtual]
template<class T>
void PFTauDiscriminants::DiscriminantBase< T >::fillMVA ( std::vector< PhysicsTools::Variable::Value > &  mvaHolder) const [inline, virtual]

Implements PFTauDiscriminants::Discriminant.

Definition at line 126 of file PFTauDiscriminantBase.h.

                                                                          {
         if (isMultiple_)
         {
            for(myVectorIterator aResult = result_.begin(); aResult != result_.end(); ++aResult)
            {
               mvaHolder.push_back(PhysicsTools::Variable::Value(theAtomicId(), static_cast<double>(*aResult)));
            }
         }
         else
         {
            mvaHolder.push_back(PhysicsTools::Variable::Value(theAtomicId(), static_cast<double>(singleResult_)));
         }
      }
template<class T>
virtual void PFTauDiscriminants::DiscriminantBase< T >::setNullResult ( PFTauDiscriminantManager input) [inline, virtual]

Implements PFTauDiscriminants::Discriminant.

Definition at line 79 of file PFTauDiscriminantBase.h.


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]