CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/RecoTauTag/TauTagTools/interface/PFTauDiscriminantManager.h

Go to the documentation of this file.
00001 #ifndef RecoTauTag_TauTagTools_PFTauDiscriminantManager_h
00002 #define RecoTauTag_TauTagTools_PFTauDiscriminantManager_h
00003 
00004 #include "PhysicsTools/MVAComputer/interface/Variable.h"
00005 #include "DataFormats/TauReco/interface/PFTauDecayMode.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "RecoTauTag/TauTagTools/interface/PFTauDiscriminantBase.h"
00008 #include "RecoTauTag/TauTagTools/interface/TauTagTools.h"
00009 #include "TTree.h"
00010 
00011 namespace PFTauDiscriminants
00012 {
00013 
00014 class Discriminant;
00015 
00016 class PFTauDiscriminantManager {
00017    public:
00018       PFTauDiscriminantManager();
00019       ~PFTauDiscriminantManager();
00020 
00021       typedef std::vector<const reco::Candidate*> candPtrVector;
00022       //maps string (discriminant name, ( (discriminantComputer), links)
00023       typedef std::map<std::string, Discriminant* const> discriminantHolder;
00025       void addDiscriminant(Discriminant* const aDiscriminant);
00027       bool branchTree(TTree* const treeToBranch, bool addTargetBranch = false, bool addWeightBranch = false);
00029       void buildMVAComputerLink(std::vector<PhysicsTools::Variable::Value>&);
00031       bool setTau(const reco::PFTauDecayMode& theTau, bool prePass = false, bool preFail = false);
00034       bool setNullResult();
00036       void setEvent(const edm::Event&, double eventWeight);
00037 
00038       void setSignalFlag(bool isSignal) { iAmSignal_ = isSignal; };
00039 
00040       //TODO: Discriminant should be a friend and these should be private...
00041 
00043       const reco::PFTauDecayMode* getDecayMode() const { return currentTauDecayMode_; };
00045       const edm::Event*           getEvent()     const { return eventData_; };
00046 
00048       const reco::Candidate*      mainTrack();
00050       const std::vector<const reco::Candidate*>& signalObjectsSortedByPt();
00051       const std::vector<const reco::Candidate*>& signalObjectsSortedByDR();
00052       const std::vector<const reco::Candidate*>& outlierObjectsSortedByPt();
00053       const std::vector<const reco::Candidate*>& outlierObjectsSortedByDR();
00054 
00056       static std::vector<const reco::Candidate*> getLeafDaughters(const reco::Candidate* input);
00057 
00059       candPtrVector                         filterByCharge(const candPtrVector& input, bool isCharged) const;
00060 
00061    protected:
00062 
00063    private:
00064       // magic variables
00065       Bool_t                                                    iAmSignal_;
00066       Bool_t                                                    iAmNull_;
00067       Bool_t                                                    prePass_;
00068       Bool_t                                                    preFail_;
00069 
00070       Double_t                                                  eventWeight_;
00071       discriminantHolder                                        myDiscriminants_;
00072       const reco::PFTauDecayMode*                               currentTauDecayMode_;
00073       const edm::Event*                                         eventData_;
00074 
00075       void                                                      clearCache();
00076       //cached objects 
00077       const reco::Candidate*                                    mainTrack_;
00078       candPtrVector                                             signalObjectsSortedByPt_;
00079       candPtrVector                                             signalObjectsSortedByDR_;
00080       candPtrVector                                             outlierObjectsSortedByPt_;
00081       candPtrVector                                             outlierObjectsSortedByDR_;
00082 
00083       //utility functions for filling caches
00084       void                                                      fillSignalObjects(candPtrVector& input);                                     
00085       void                                                      fillOutlierObjects(candPtrVector& input);                                     
00086       void                                                      computeMainTrack();
00087 
00088 };
00089 
00090 }
00091 #endif
00092