![]() |
![]() |
#include <RecoParticleFlow/PFProducer/interface/PFProducer.h>
Public Member Functions | |
virtual void | beginJob (const edm::EventSetup &c) |
PFProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~PFProducer () | |
Private Attributes | |
edm::InputTag | inputTagBlocks_ |
std::auto_ptr< PFAlgo > | pfAlgo_ |
particle flow algorithm | |
bool | verbose_ |
verbose ? |
This producer makes use of PFAlgo, the particle flow algorithm.
Definition at line 28 of file PFProducer.h.
PFProducer::PFProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 18 of file PFProducer.cc.
References calibration, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, inputTagBlocks_, names, params, pfAlgo_, and verbose_.
00018 { 00019 00020 00021 bool newCalib = 00022 iConfig.getParameter<bool>("pf_newCalib"); 00023 00024 // Create a PFClusterCalbration auto_ptr 00025 shared_ptr<pftools::PFClusterCalibration> 00026 clusterCalibration( new pftools::PFClusterCalibration() ); 00027 00028 // Initialise function parameters properly. 00029 double lowEP0 00030 = iConfig.getParameter<double>("pfcluster_lowEP0"); 00031 double lowEP1 00032 = iConfig.getParameter<double>("pfcluster_lowEP1"); 00033 double globalP0 00034 = iConfig.getParameter<double>("pfcluster_globalP0"); 00035 double globalP1 00036 = iConfig.getParameter<double>("pfcluster_globalP1"); 00037 // 00038 clusterCalibration->setCorrections(lowEP0, lowEP1, globalP0, globalP1); 00039 00040 unsigned int allowNegative 00041 = iConfig.getParameter<unsigned int>("pfcluster_allowNegative"); 00042 clusterCalibration->setAllowNegativeEnergy(allowNegative); 00043 00044 unsigned int doCorrection 00045 = iConfig.getParameter<unsigned int>("pfcluster_doCorrection"); 00046 clusterCalibration->setDoCorrection(doCorrection); 00047 00048 double barrelEta 00049 = iConfig.getParameter<double>("pfcluster_barrelEndcapEtaDiv"); 00050 clusterCalibration->setBarrelBoundary(barrelEta); 00051 00052 /* Now obsolete 00053 double ecalEcut = 00054 iConfig.getParameter<double>("pfcluster_ecalECut"); 00055 double hcalEcut = 00056 iConfig.getParameter<double>("pfcluster_hcalECut"); 00057 00058 clusterCalibration->setEcalHcalEnergyCuts(ecalEcut,hcalEcut); 00059 */ 00060 00061 std::vector<std::string>* names = clusterCalibration->getKnownSectorNames(); 00062 for(std::vector<std::string>::iterator i = names->begin(); i != names->end(); ++i) { 00063 std::string sector = *i; 00064 std::vector<double> params 00065 = iConfig.getParameter<std::vector<double> >(sector); 00066 clusterCalibration->setEvolutionParameters(sector, params); 00067 } 00068 00069 //Finally set eta correction 00070 unsigned int doEtaCorrection = iConfig.getParameter<unsigned int>("pfcluster_doEtaCorrection"); 00071 clusterCalibration->setDoEtaCorrection(doEtaCorrection); 00072 00073 std::vector<double> etaCorrectionParams = 00074 iConfig.getParameter<std::vector<double> >("pfcluster_etaCorrection"); 00075 clusterCalibration->setEtaCorrectionParameters(etaCorrectionParams); 00076 // use configuration file to setup input/output collection names 00077 //std::cout << "Finished initialisaing PFClusterCalibration: it looks like...\n"; 00078 //std::cout << *clusterCalibration << std::endl; 00079 00080 //Done with PFClusterCalibration // 00081 00082 inputTagBlocks_ 00083 = iConfig.getParameter<InputTag>("blocks"); 00084 00085 // register products 00086 produces<reco::PFCandidateCollection>(); 00087 00088 00089 double nSigmaECAL 00090 = iConfig.getParameter<double>("pf_nsigma_ECAL"); 00091 double nSigmaHCAL 00092 = iConfig.getParameter<double>("pf_nsigma_HCAL"); 00093 00094 00095 double e_slope 00096 = iConfig.getParameter<double>("pf_calib_ECAL_slope"); 00097 double e_offset 00098 = iConfig.getParameter<double>("pf_calib_ECAL_offset"); 00099 00100 double eh_eslope 00101 = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_eslope"); 00102 double eh_hslope 00103 = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_hslope"); 00104 double eh_offset 00105 = iConfig.getParameter<double>("pf_calib_ECAL_HCAL_offset"); 00106 00107 double h_slope 00108 = iConfig.getParameter<double>("pf_calib_HCAL_slope"); 00109 double h_offset 00110 = iConfig.getParameter<double>("pf_calib_HCAL_offset"); 00111 double h_damping 00112 = iConfig.getParameter<double>("pf_calib_HCAL_damping"); 00113 00114 //PFElectrons Configuration 00115 double chi2EcalGSF 00116 = iConfig.getParameter<double>("final_chi2cut_gsfecal"); 00117 double chi2EcalBrem 00118 = iConfig.getParameter<double>("final_chi2cut_bremecal"); 00119 double chi2HcalGSF 00120 = iConfig.getParameter<double>("final_chi2cut_gsfhcal"); 00121 double chi2HcalBrem 00122 = iConfig.getParameter<double>("final_chi2cut_bremhcal"); 00123 double chi2PsGSF 00124 = iConfig.getParameter<double>("final_chi2cut_gsfps"); 00125 double chi2PsBrem 00126 = iConfig.getParameter<double>("final_chi2cut_bremps"); 00127 00128 00129 double mvaEleCut 00130 = iConfig.getParameter<double>("pf_electron_mvaCut"); 00131 bool usePFElectrons 00132 = iConfig.getParameter<bool>("usePFElectrons"); 00133 string mvaWeightFileEleID 00134 = iConfig.getParameter<string>("pf_electronID_mvaWeightFile"); 00135 edm::FileInPath path_mvaWeightFileEleID( mvaWeightFileEleID.c_str() ); 00136 00137 // End PFElectrons Configuration 00138 00139 bool usePFConversions 00140 = iConfig.getParameter<bool>("usePFConversions"); 00141 00142 00143 00144 00145 shared_ptr<PFEnergyCalibration> 00146 calibration( new PFEnergyCalibration( e_slope, 00147 e_offset, 00148 eh_eslope, 00149 eh_hslope, 00150 eh_offset, 00151 h_slope, 00152 h_offset, 00153 h_damping ) ); 00154 00155 bool clusterRecovery 00156 = iConfig.getParameter<bool>("pf_clusterRecovery"); 00157 00158 double mvaCut = iConfig.getParameter<double>("pf_mergedPhotons_mvaCut"); 00159 string mvaWeightFile 00160 = iConfig.getParameter<string>("pf_mergedPhotons_mvaWeightFile"); 00161 edm::FileInPath path_mvaWeightFile( mvaWeightFile.c_str() ); 00162 double PSCut = iConfig.getParameter<double>("pf_mergedPhotons_PSCut"); 00163 00164 int algoType 00165 = iConfig.getParameter<unsigned>("algoType"); 00166 00167 switch(algoType) { 00168 case 0: 00169 pfAlgo_.reset( new PFAlgo); 00170 break; 00171 default: 00172 assert(0); 00173 } 00174 00175 pfAlgo_->setParameters( nSigmaECAL, 00176 nSigmaHCAL, 00177 calibration, 00178 clusterCalibration, 00179 newCalib, 00180 clusterRecovery, 00181 PSCut, 00182 mvaCut, 00183 path_mvaWeightFile.fullPath().c_str() ); 00184 00185 //PFElectrons: call the method setpfeleparameters 00186 pfAlgo_->setPFEleParameters(chi2EcalGSF, 00187 chi2EcalBrem, 00188 chi2HcalGSF, 00189 chi2HcalBrem, 00190 chi2PsGSF, 00191 chi2PsBrem, 00192 mvaEleCut, 00193 path_mvaWeightFileEleID.fullPath(), 00194 usePFElectrons); 00195 00196 pfAlgo_->setPFConversionParameters(usePFConversions); 00197 00198 00199 verbose_ = 00200 iConfig.getUntrackedParameter<bool>("verbose",false); 00201 00202 bool debug_ = 00203 iConfig.getUntrackedParameter<bool>("debug",false); 00204 00205 pfAlgo_->setDebug( debug_ ); 00206 00207 }
PFProducer::~PFProducer | ( | ) |
void PFProducer::beginJob | ( | const edm::EventSetup & | c | ) | [virtual] |
void PFProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 217 of file PFProducer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, edm::EventID::event(), Exception, edm::Event::getByLabel(), edm::Event::id(), inputTagBlocks_, edm::Handle< T >::isValid(), LogDebug, pfAlgo_, edm::Event::put(), edm::EventID::run(), and verbose_.
00218 { 00219 00220 LogDebug("PFProducer")<<"START event: " 00221 <<iEvent.id().event() 00222 <<" in run "<<iEvent.id().run()<<endl; 00223 00224 00225 // get the collection of blocks 00226 00227 Handle< reco::PFBlockCollection > blocks; 00228 00229 LogDebug("PFBlock")<<"getting blocks"<<endl; 00230 bool found = iEvent.getByLabel( inputTagBlocks_, blocks ); 00231 00232 if(!found ) { 00233 00234 ostringstream err; 00235 err<<"cannot find blocks: "<<inputTagBlocks_; 00236 LogError("PFSimParticleProducer")<<err.str()<<endl; 00237 00238 throw cms::Exception( "MissingProduct", err.str()); 00239 } 00240 00241 00242 LogDebug("PFProducer")<<"particle flow is starting"<<endl; 00243 00244 assert( blocks.isValid() ); 00245 00246 pfAlgo_->reconstructParticles( blocks ); 00247 00248 00249 if(verbose_) { 00250 ostringstream str; 00251 str<<(*pfAlgo_)<<endl; 00252 LogInfo("PFProducer") <<str.str()<<endl; 00253 } 00254 00255 auto_ptr< reco::PFCandidateCollection > 00256 pOutputCandidateCollection( pfAlgo_->transferCandidates() ); 00257 00258 LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl; 00259 if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl; 00260 int nC=0; 00261 for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) { 00262 nC++; 00263 if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl; 00264 00265 } 00266 00267 iEvent.put(pOutputCandidateCollection); 00268 }
edm::InputTag PFProducer::inputTagBlocks_ [private] |
std::auto_ptr<PFAlgo> PFProducer::pfAlgo_ [private] |
particle flow algorithm
Definition at line 44 of file PFProducer.h.
Referenced by PFProducer(), and produce().
bool PFProducer::verbose_ [private] |