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 using namespace std; 00012 00013 namespace PFTauDiscriminants 00014 { 00015 00016 class Discriminant; 00017 00018 class PFTauDiscriminantManager { 00019 public: 00020 PFTauDiscriminantManager(); 00021 ~PFTauDiscriminantManager(); 00022 00023 typedef vector<const reco::Candidate*> candPtrVector; 00024 //maps string (discriminant name, ( (discriminantComputer), links) 00025 typedef map<string, Discriminant* const> discriminantHolder; 00027 void addDiscriminant(Discriminant* const aDiscriminant); 00029 bool branchTree(TTree* const treeToBranch); 00031 void buildMVAComputerLink(std::vector<PhysicsTools::Variable::Value>&); 00033 bool setEventData(const reco::PFTauDecayMode& theTau, const edm::Event& iEvent, 00034 const double& eventWeight = 1., bool prePass = false, bool preFail = false); 00037 bool setNullResult(const edm::Event& iEvent, const double& eventWeight = 1.); 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 vector<const reco::Candidate*>& signalObjectsSortedByPt(); 00051 const vector<const reco::Candidate*>& signalObjectsSortedByDR(); 00052 const vector<const reco::Candidate*>& outlierObjectsSortedByPt(); 00053 const vector<const reco::Candidate*>& outlierObjectsSortedByDR(); 00054 00056 candPtrVector filterByCharge(const candPtrVector& input, bool isCharged) const; 00057 00058 protected: 00059 00060 private: 00061 // magic variables 00062 Bool_t iAmSignal_; 00063 Bool_t iAmNull_; 00064 Bool_t prePass_; 00065 Bool_t preFail_; 00066 00067 Double_t eventWeight_; 00068 discriminantHolder myDiscriminants_; 00069 const reco::PFTauDecayMode* currentTauDecayMode_; 00070 const edm::Event* eventData_; 00071 00072 void clearCache(); 00073 //cached objects 00074 const reco::Candidate* mainTrack_; 00075 candPtrVector signalObjectsSortedByPt_; 00076 candPtrVector signalObjectsSortedByDR_; 00077 candPtrVector outlierObjectsSortedByPt_; 00078 candPtrVector outlierObjectsSortedByDR_; 00079 00080 //utility functions for filling caches 00081 void fillSignalObjects(candPtrVector& input); 00082 void fillOutlierObjects(candPtrVector& input); 00083 void computeMainTrack(); 00084 00085 }; 00086 00087 } 00088 #endif 00089