CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/RecoParticleFlow/PFProducer/interface/PFCandConnector.h

Go to the documentation of this file.
00001 #ifndef PFProducer_PFCandConnector_H_
00002 #define PFProducer_PFCandConnector_H_
00003 
00004 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00005 
00006 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00007 
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h" 
00009 
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 // \author : M. Gouzevitch
00012 // \date : May 2010
00013 
00015 
00016 class PFCandConnector {
00017     
00018     public :
00019        
00020        PFCandConnector( ) { 
00021          pfC_ = std::auto_ptr<reco::PFCandidateCollection>(new reco::PFCandidateCollection); 
00022          debug_ = false;
00023          bCorrect_ = false;
00024          bCalibPrimary_ =  false;
00025 
00026          fConst_.push_back(1), fConst_.push_back(0);
00027          fNorm_.push_back(0), fNorm_.push_back(0);
00028          fExp_.push_back(0);
00029 
00030          dptRel_PrimaryTrack_ = 0.;
00031          dptRel_MergedTrack_ = 0.;
00032          ptErrorSecondary_ = 0.;
00033        }
00034        
00035        void setParameters(const edm::ParameterSet& iCfgCandConnector){
00036          
00037          bool bCorrect, bCalibPrimary;
00038          double dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary;
00039          std::vector<double> nuclCalibFactors;
00040 
00042          bCorrect = iCfgCandConnector.getParameter<bool>("bCorrect");
00044          bCalibPrimary =  iCfgCandConnector.getParameter<bool>("bCalibPrimary");
00045 
00046          if(iCfgCandConnector.exists("dptRel_PrimaryTrack")) dptRel_PrimaryTrack = iCfgCandConnector.getParameter<double>("dptRel_PrimaryTrack");
00047          else { edm::LogWarning("PFCandConnector")  << "dptRel_PrimaryTrack doesn't exist. Setting a default safe value 0" << std::endl; dptRel_PrimaryTrack = 0;}
00048 
00049          if(iCfgCandConnector.exists("dptRel_MergedTrack"))  dptRel_MergedTrack = iCfgCandConnector.getParameter<double>("dptRel_MergedTrack");
00050          else { edm::LogWarning("PFCandConnector") << "dptRel_MergedTrack doesn't exist. Setting a default safe value 0" << std::endl; dptRel_MergedTrack = 0;}
00051 
00052          if(iCfgCandConnector.exists("ptErrorSecondary"))    ptErrorSecondary = iCfgCandConnector.getParameter<double>("ptErrorSecondary");
00053          else { edm::LogWarning("PFCandConnector")  << "ptErrorSecondary doesn't exist. Setting a default safe value 0" << std::endl; ptErrorSecondary = 0;}
00054 
00055          if(iCfgCandConnector.exists("nuclCalibFactors"))    nuclCalibFactors = iCfgCandConnector.getParameter<std::vector<double> >("nuclCalibFactors");  
00056          else { edm::LogWarning("PFCandConnector")  << "nuclear calib factors doesn't exist the factor would not be applyed" << std::endl; }
00057 
00058          setParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
00059 
00060        }
00061 
00062 
00063        void setParameters(bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, std::vector<double> nuclCalibFactors);
00064        void setDebug( bool debug ) {debug_ = debug;}
00065 
00066        
00067 
00068        std::auto_ptr<reco::PFCandidateCollection> connect(std::auto_ptr<reco::PFCandidateCollection>& pfCand);
00069 
00070        
00071  
00072     private :
00073 
00075        void analyseNuclearWPrim(std::auto_ptr<reco::PFCandidateCollection>&, unsigned int);
00076 
00078        void analyseNuclearWSec(std::auto_ptr<reco::PFCandidateCollection>&, unsigned int);
00079 
00080        bool isPrimaryNucl( const reco::PFCandidate& pf ) const;
00081 
00082        bool isSecondaryNucl( const reco::PFCandidate& pf ) const;
00083 
00085        double rescaleFactor( const double pt, const double cFrac ) const;
00086 
00088        std::auto_ptr<reco::PFCandidateCollection> pfC_;
00090        std::vector<bool> bMask_;
00091 
00093        bool debug_;
00094        bool bCorrect_;
00095 
00097        bool bCalibPrimary_;
00098        std::vector< double > fConst_;
00099        std::vector< double > fNorm_;
00100        std::vector< double > fExp_;
00101 
00102        // Maximal accepatble uncertainty on primary tracks to usem them as MC truth for calibration
00103        double dptRel_PrimaryTrack_;
00104        double dptRel_MergedTrack_;
00105        double ptErrorSecondary_;
00106 
00108        static const double pion_mass2;
00109        static const reco::PFCandidate::Flags fT_TO_DISP_;
00110        static const reco::PFCandidate::Flags fT_FROM_DISP_;
00111 };
00112 
00113 #endif