CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronBaseProducer.cc

Go to the documentation of this file.
00001 
00002 #include "GsfElectronBaseProducer.h"
00003 
00004 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
00005 
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "FWCore/Framework/interface/MakerMacros.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 #include "FWCore/ParameterSet/interface/Registry.h"
00013 #include "CommonTools/Utils/interface/StringToEnumValue.h"
00014 
00015 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00016 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00017 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00018 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00019 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00020 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h"
00021 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00022 #include "DataFormats/EcalRecHit/interface/EcalSeverityLevel.h"
00023 
00024 
00025 #include <iostream>
00026 
00027 using namespace reco;
00028 
00029 void GsfElectronBaseProducer::fillDescription( edm::ParameterSetDescription & desc )
00030  {
00031   // input collections
00032   desc.add<edm::InputTag>("previousGsfElectronsTag",edm::InputTag("ecalDrivenGsfElectrons")) ;
00033   desc.add<edm::InputTag>("pflowGsfElectronsTag",edm::InputTag("pflowGsfElectrons")) ;
00034   desc.add<edm::InputTag>("gsfElectronCoresTag",edm::InputTag("gsfElectronCores")) ;
00035   desc.add<edm::InputTag>("hcalTowers",edm::InputTag("towerMaker")) ;
00036   desc.add<edm::InputTag>("barrelRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEB")) ;
00037   desc.add<edm::InputTag>("endcapRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEE")) ;
00038   //desc.add<edm::InputTag>("pfMvaTag",edm::InputTag("pfElectronTranslator:pf")) ;
00039   desc.add<edm::InputTag>("seedsTag",edm::InputTag("ecalDrivenElectronSeeds")) ;
00040   desc.add<edm::InputTag>("beamSpotTag",edm::InputTag("offlineBeamSpot")) ;
00041   desc.add<edm::InputTag>("gsfPfRecTracksTag",edm::InputTag("pfTrackElec")) ;
00042 
00043   // backward compatibility mechanism for ctf tracks
00044   desc.add<bool>("ctfTracksCheck",true) ;
00045   desc.add<edm::InputTag>("ctfTracksTag",edm::InputTag("generalTracks")) ;
00046 
00047   // steering
00048   desc.add<bool>("useGsfPfRecTracks",true) ;
00049   desc.add<bool>("applyPreselection",false) ;
00050   desc.add<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization",false) ;
00051   desc.add<bool>("ecalDrivenEcalErrorFromClassBasedParameterization",false) ;
00052   desc.add<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization",false) ;
00053   desc.add<bool>("applyAmbResolution",false) ;
00054   desc.add<unsigned>("ambSortingStrategy",1) ;
00055   desc.add<unsigned>("ambClustersOverlapStrategy",1) ;
00056   //desc.add<bool>("addPflowElectrons",true) ;
00057 
00058 //  // preselection parameters (ecal driven electrons)
00059 //  desc.add<bool>("seedFromTEC",true) ;
00060 //  desc.add<double>("minSCEtBarrel",4.0) ;
00061 //  desc.add<double>("minSCEtEndcaps",4.0) ;
00062 //  desc.add<double>("minEOverPBarrel",0.0) ;
00063 //  desc.add<double>("maxEOverPBarrel",999999999.) ;
00064 //  desc.add<double>("minEOverPEndcaps",0.0) ;
00065 //  desc.add<double>("maxEOverPEndcaps",999999999.) ;
00066 //  desc.add<double>("maxDeltaEtaBarrel",0.02) ;
00067 //  desc.add<double>("maxDeltaEtaEndcaps",0.02) ;
00068 //  desc.add<double>("maxDeltaPhiBarrel",0.15) ;
00069 //  desc.add<double>("maxDeltaPhiEndcaps",0.15) ;
00070 //  desc.add<double>("hOverEConeSize",0.15) ;
00071 //  desc.add<double>("hOverEPtMin",0.) ;
00072 //  desc.add<double>("maxHOverEBarrel",0.15) ;
00073 //  desc.add<double>("maxHOverEEndcaps",0.15) ;
00074 //  desc.add<double>("maxHBarrel",0.0) ;
00075 //  desc.add<double>("maxHEndcaps",0.0) ;
00076 //  desc.add<double>("maxSigmaIetaIetaBarrel",999999999.) ;
00077 //  desc.add<double>("maxSigmaIetaIetaEndcaps",999999999.) ;
00078 //  desc.add<double>("maxFbremBarrel",999999999.) ;
00079 //  desc.add<double>("maxFbremEndcaps",999999999.) ;
00080 //  desc.add<bool>("isBarrel",false) ;
00081 //  desc.add<bool>("isEndcaps",false) ;
00082 //  desc.add<bool>("isFiducial",false) ;
00083 //  desc.add<double>("maxTIP",999999999.) ;
00084 //  desc.add<double>("minMVA",-0.4) ;
00085 //
00086 //  // preselection parameters (tracker driven only electrons)
00087 //  desc.add<double>("minSCEtBarrelPflow",0.0) ;
00088 //  desc.add<double>("minSCEtEndcapsPflow",0.0) ;
00089 //  desc.add<double>("minEOverPBarrelPflow",0.0) ;
00090 //  desc.add<double>("maxEOverPBarrelPflow",999999999.) ;
00091 //  desc.add<double>("minEOverPEndcapsPflow",0.0) ;
00092 //  desc.add<double>("maxEOverPEndcapsPflow",999999999.) ;
00093 //  desc.add<double>("maxDeltaEtaBarrelPflow",999999999.) ;
00094 //  desc.add<double>("maxDeltaEtaEndcapsPflow",999999999.) ;
00095 //  desc.add<double>("maxDeltaPhiBarrelPflow",999999999.) ;
00096 //  desc.add<double>("maxDeltaPhiEndcapsPflow",999999999.) ;
00097 //  desc.add<double>("hOverEConeSizePflow",0.15) ;
00098 //  desc.add<double>("hOverEPtMinPflow",0.) ;
00099 //  desc.add<double>("maxHOverEBarrelPflow",999999999.) ;
00100 //  desc.add<double>("maxHOverEEndcapsPflow",999999999.) ;
00101 //  desc.add<double>("maxHBarrelPflow",0.0) ;
00102 //  desc.add<double>("maxHEndcapsPflow",0.0) ;
00103 //  desc.add<double>("maxSigmaIetaIetaBarrelPflow",999999999.) ;
00104 //  desc.add<double>("maxSigmaIetaIetaEndcapsPflow",999999999.) ;
00105 //  desc.add<double>("maxFbremBarrelPflow",999999999.) ;
00106 //  desc.add<double>("maxFbremEndcapsPflow",999999999.) ;
00107 //  desc.add<bool>("isBarrelPflow",false) ;
00108 //  desc.add<bool>("isEndcapsPflow",false) ;
00109 //  desc.add<bool>("isFiducialPflow",false) ;
00110 //  desc.add<double>("maxTIPPflow",999999999.) ;
00111 //  desc.add<double>("minMVAPflow",-0.4) ;
00112 
00113   // Ecal rec hits configuration
00114   desc.add<std::vector<int> >("recHitFlagsToBeExcludedBarrel") ;
00115   desc.add<std::vector<int> >("recHitFlagsToBeExcludedEndcaps") ;
00116   desc.add<std::vector<int> >("recHitSeverityToBeExcludedBarrel") ;
00117   desc.add<std::vector<int> >("recHitSeverityToBeExcludedEndcaps") ;
00118   //desc.add<int>("severityLevelCut",4) ;
00119 
00120   // Isolation algos configuration
00121   desc.add<double>("intRadiusBarrelTk",0.015) ;
00122   desc.add<double>("intRadiusEndcapTk",0.015) ;
00123   desc.add<double>("stripBarrelTk",0.015) ;
00124   desc.add<double>("stripEndcapTk",0.015) ;
00125   desc.add<double>("ptMinTk",0.7) ;
00126   desc.add<double>("maxVtxDistTk",0.2) ;
00127   desc.add<double>("maxDrbTk",999999999.) ;
00128   desc.add<double>("intRadiusHcal",0.15) ;
00129   desc.add<double>("etMinHcal",0.0) ;
00130   desc.add<double>("intRadiusEcalBarrel",3.0) ;
00131   desc.add<double>("intRadiusEcalEndcaps",3.0) ;
00132   desc.add<double>("jurassicWidth",1.5) ;
00133   desc.add<double>("etMinBarrel",0.0) ;
00134   desc.add<double>("eMinBarrel",0.08) ;
00135   desc.add<double>("etMinEndcaps",0.1) ;
00136   desc.add<double>("eMinEndcaps",0.0) ;
00137   desc.add<bool>("vetoClustered",false) ;
00138   desc.add<bool>("useNumCrystals",true) ;
00139 
00140   edm::ParameterSetDescription descNested ;
00141   descNested.add<std::string>("propagatorAlongTISE","PropagatorWithMaterial") ;
00142   descNested.add<std::string>("propagatorOppositeTISE","PropagatorWithMaterialOpposite") ;
00143   desc.add<edm::ParameterSetDescription>("TransientInitialStateEstimatorParameters",descNested) ;
00144 
00145   // Corrections
00146   desc.add<std::string>("superClusterErrorFunction","EcalClusterEnergyUncertaintyObjectSpecific") ;
00147   desc.add<std::string>("crackCorrectionFunction","EcalClusterCrackCorrection") ;
00148  }
00149 
00150 GsfElectronBaseProducer::GsfElectronBaseProducer( const edm::ParameterSet& cfg )
00151  : ecalSeedingParametersChecked_(false)
00152  {
00153   produces<GsfElectronCollection>();
00154 
00155   inputCfg_.previousGsfElectrons = cfg.getParameter<edm::InputTag>("previousGsfElectronsTag");
00156   inputCfg_.pflowGsfElectronsTag = cfg.getParameter<edm::InputTag>("pflowGsfElectronsTag");
00157   inputCfg_.gsfElectronCores = cfg.getParameter<edm::InputTag>("gsfElectronCoresTag");
00158   inputCfg_.hcalTowersTag = cfg.getParameter<edm::InputTag>("hcalTowers") ;
00159   //inputCfg_.tracks_ = cfg.getParameter<edm::InputTag>("tracks");
00160   inputCfg_.barrelRecHitCollection = cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag") ;
00161   inputCfg_.endcapRecHitCollection = cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag") ;
00162   inputCfg_.pfMVA = cfg.getParameter<edm::InputTag>("pfMvaTag") ;
00163   inputCfg_.ctfTracks = cfg.getParameter<edm::InputTag>("ctfTracksTag");
00164   inputCfg_.seedsTag = cfg.getParameter<edm::InputTag>("seedsTag"); // used to check config consistency with seeding
00165   inputCfg_.beamSpotTag = cfg.getParameter<edm::InputTag>("beamSpotTag") ;
00166   inputCfg_.gsfPfRecTracksTag = cfg.getParameter<edm::InputTag>("gsfPfRecTracksTag") ;
00167 
00168   strategyCfg_.useGsfPfRecTracks = cfg.getParameter<bool>("useGsfPfRecTracks") ;
00169   strategyCfg_.applyPreselection = cfg.getParameter<bool>("applyPreselection") ;
00170   strategyCfg_.ecalDrivenEcalEnergyFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization") ;
00171   strategyCfg_.ecalDrivenEcalErrorFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalErrorFromClassBasedParameterization") ;
00172   strategyCfg_.pureTrackerDrivenEcalErrorFromSimpleParameterization = cfg.getParameter<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization") ;
00173   strategyCfg_.applyAmbResolution = cfg.getParameter<bool>("applyAmbResolution") ;
00174   strategyCfg_.ambSortingStrategy = cfg.getParameter<unsigned>("ambSortingStrategy") ;
00175   strategyCfg_.ambClustersOverlapStrategy = cfg.getParameter<unsigned>("ambClustersOverlapStrategy") ;
00176   strategyCfg_.addPflowElectrons = cfg.getParameter<bool>("addPflowElectrons") ;
00177   strategyCfg_.ctfTracksCheck = cfg.getParameter<bool>("ctfTracksCheck");
00178 
00179   cutsCfg_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrel") ;
00180   cutsCfg_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcaps") ;
00181   cutsCfg_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrel") ;
00182   cutsCfg_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcaps") ;
00183   cutsCfg_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrel") ;
00184   cutsCfg_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcaps") ;
00185 
00186   // H/E
00187   cutsCfg_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrel") ;
00188   cutsCfg_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcaps") ;
00189   cutsCfg_.maxHBarrel = cfg.getParameter<double>("maxHBarrel") ;
00190   cutsCfg_.maxHEndcaps = cfg.getParameter<double>("maxHEndcaps") ;
00191 
00192   cutsCfg_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrel") ;
00193   cutsCfg_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcaps") ;
00194   cutsCfg_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrel") ;
00195   cutsCfg_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcaps") ;
00196   cutsCfg_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrel") ;
00197   cutsCfg_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcaps") ;
00198   cutsCfg_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrel") ;
00199   cutsCfg_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcaps") ;
00200   cutsCfg_.isBarrel = cfg.getParameter<bool>("isBarrel") ;
00201   cutsCfg_.isEndcaps = cfg.getParameter<bool>("isEndcaps") ;
00202   cutsCfg_.isFiducial = cfg.getParameter<bool>("isFiducial") ;
00203   cutsCfg_.minMVA = cfg.getParameter<double>("minMVA") ;
00204   cutsCfg_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolated") ;
00205   cutsCfg_.maxTIP = cfg.getParameter<double>("maxTIP") ;
00206   cutsCfg_.seedFromTEC = cfg.getParameter<bool>("seedFromTEC") ;
00207 
00208   cutsCfgPflow_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrelPflow") ;
00209   cutsCfgPflow_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcapsPflow") ;
00210   cutsCfgPflow_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrelPflow") ;
00211   cutsCfgPflow_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcapsPflow") ;
00212   cutsCfgPflow_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrelPflow") ;
00213   cutsCfgPflow_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcapsPflow") ;
00214 
00215   // H/E
00216   cutsCfgPflow_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrelPflow") ;
00217   cutsCfgPflow_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcapsPflow") ;
00218   cutsCfgPflow_.maxHBarrel = cfg.getParameter<double>("maxHBarrelPflow") ;
00219   cutsCfgPflow_.maxHEndcaps = cfg.getParameter<double>("maxHEndcapsPflow") ;
00220 
00221   cutsCfgPflow_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrelPflow") ;
00222   cutsCfgPflow_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcapsPflow") ;
00223   cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
00224   cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
00225   cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
00226   cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
00227   cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
00228   cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
00229   cutsCfgPflow_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrelPflow") ;
00230   cutsCfgPflow_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcapsPflow") ;
00231   cutsCfgPflow_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrelPflow") ;
00232   cutsCfgPflow_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcapsPflow") ;
00233   cutsCfgPflow_.isBarrel = cfg.getParameter<bool>("isBarrelPflow") ;
00234   cutsCfgPflow_.isEndcaps = cfg.getParameter<bool>("isEndcapsPflow") ;
00235   cutsCfgPflow_.isFiducial = cfg.getParameter<bool>("isFiducialPflow") ;
00236   cutsCfgPflow_.minMVA = cfg.getParameter<double>("minMVAPflow") ;
00237   cutsCfgPflow_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolatedPflow") ;
00238   cutsCfgPflow_.maxTIP = cfg.getParameter<double>("maxTIPPflow") ;
00239   cutsCfgPflow_.seedFromTEC = true ; // not applied for pflow
00240 
00241   // hcal helpers
00242   hcalCfg_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSize") ;
00243   if (hcalCfg_.hOverEConeSize>0)
00244    {
00245     hcalCfg_.useTowers = true ;
00246     hcalCfg_.hcalTowers = cfg.getParameter<edm::InputTag>("hcalTowers") ;
00247     hcalCfg_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMin") ;
00248    }
00249   hcalCfgPflow_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSizePflow") ;
00250   if (hcalCfgPflow_.hOverEConeSize>0)
00251    {
00252     hcalCfgPflow_.useTowers = true ;
00253     hcalCfgPflow_.hcalTowers = cfg.getParameter<edm::InputTag>("hcalTowers") ;
00254     hcalCfgPflow_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMinPflow") ;
00255    }
00256 
00257   // Ecal rec hits configuration
00258   GsfElectronAlgo::EcalRecHitsConfiguration recHitsCfg ;
00259   const std::vector<std::string> flagnamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedBarrel");
00260   recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
00261   const std::vector<std::string> flagnamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedEndcaps");
00262   recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
00263   const std::vector<std::string> severitynamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedBarrel");
00264   recHitsCfg.recHitSeverityToBeExcludedBarrel = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
00265   const std::vector<std::string> severitynamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedEndcaps");
00266   recHitsCfg.recHitSeverityToBeExcludedEndcaps = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
00267   //recHitsCfg.severityLevelCut = cfg.getParameter<int>("severityLevelCut") ;
00268 
00269   // isolation
00270   GsfElectronAlgo::IsolationConfiguration isoCfg ;
00271   isoCfg.intRadiusBarrelTk = cfg.getParameter<double>("intRadiusBarrelTk") ;
00272   isoCfg.intRadiusEndcapTk = cfg.getParameter<double>("intRadiusEndcapTk") ;
00273   isoCfg.stripBarrelTk = cfg.getParameter<double>("stripBarrelTk") ;
00274   isoCfg.stripEndcapTk = cfg.getParameter<double>("stripEndcapTk") ;
00275   isoCfg.ptMinTk = cfg.getParameter<double>("ptMinTk") ;
00276   isoCfg.maxVtxDistTk = cfg.getParameter<double>("maxVtxDistTk") ;
00277   isoCfg.maxDrbTk = cfg.getParameter<double>("maxDrbTk") ;
00278   isoCfg.intRadiusHcal = cfg.getParameter<double>("intRadiusHcal") ;
00279   isoCfg.etMinHcal = cfg.getParameter<double>("etMinHcal") ;
00280   isoCfg.intRadiusEcalBarrel = cfg.getParameter<double>("intRadiusEcalBarrel") ;
00281   isoCfg.intRadiusEcalEndcaps = cfg.getParameter<double>("intRadiusEcalEndcaps") ;
00282   isoCfg.jurassicWidth = cfg.getParameter<double>("jurassicWidth") ;
00283   isoCfg.etMinBarrel = cfg.getParameter<double>("etMinBarrel") ;
00284   isoCfg.eMinBarrel = cfg.getParameter<double>("eMinBarrel") ;
00285   isoCfg.etMinEndcaps = cfg.getParameter<double>("etMinEndcaps") ;
00286   isoCfg.eMinEndcaps = cfg.getParameter<double>("eMinEndcaps") ;
00287   isoCfg.vetoClustered = cfg.getParameter<bool>("vetoClustered") ;
00288   isoCfg.useNumCrystals = cfg.getParameter<bool>("useNumCrystals") ;
00289 
00290   // functions for corrector
00291   EcalClusterFunctionBaseClass * superClusterErrorFunction = 0 ;
00292   std::string superClusterErrorFunctionName
00293    = cfg.getParameter<std::string>("superClusterErrorFunction") ;
00294   if (superClusterErrorFunctionName!="")
00295    {
00296     superClusterErrorFunction
00297      = EcalClusterFunctionFactory::get()->create(superClusterErrorFunctionName,cfg) ;
00298    }
00299   else
00300   {
00301    superClusterErrorFunction
00302     = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyUncertaintyObjectSpecific",cfg) ;
00303   }
00304   EcalClusterFunctionBaseClass * crackCorrectionFunction = 0 ;
00305   std::string crackCorrectionFunctionName
00306    = cfg.getParameter<std::string>("crackCorrectionFunction") ;
00307   if (crackCorrectionFunctionName!="")
00308    {
00309     crackCorrectionFunction
00310      = EcalClusterFunctionFactory::get()->create(crackCorrectionFunctionName,cfg) ;
00311    }
00312 
00313   // create algo
00314   algo_ = new GsfElectronAlgo
00315    ( inputCfg_, strategyCfg_,
00316      cutsCfg_,cutsCfgPflow_,
00317      hcalCfg_,hcalCfgPflow_,
00318      isoCfg,recHitsCfg,
00319      superClusterErrorFunction,
00320      crackCorrectionFunction ) ;
00321  }
00322 
00323 GsfElectronBaseProducer::~GsfElectronBaseProducer()
00324  { delete algo_ ; }
00325 
00326 void GsfElectronBaseProducer::beginEvent( edm::Event & event, const edm::EventSetup & setup )
00327  {
00328   // check configuration
00329   if (!ecalSeedingParametersChecked_)
00330    {
00331     ecalSeedingParametersChecked_ = true ;
00332     edm::Handle<reco::ElectronSeedCollection> seeds ;
00333     event.getByLabel(inputCfg_.seedsTag,seeds) ;
00334     if (!seeds.isValid())
00335      {
00336       edm::LogWarning("GsfElectronAlgo|UnreachableSeedsProvenance")
00337         <<"Cannot check consistency of parameters with ecal seeding ones,"
00338         <<" because the original collection of seeds is not any more available." ;
00339      }
00340     else
00341      {
00342       checkEcalSeedingParameters(seeds.provenance()->psetID()) ;
00343      }
00344    }
00345 
00346   // init the algo
00347   algo_->checkSetup(setup) ;
00348   algo_->beginEvent(event) ;
00349  }
00350 
00351 void GsfElectronBaseProducer::fillEvent( edm::Event & event )
00352  {
00353   // all electrons
00354   algo_->displayInternalElectrons("GsfElectronAlgo Info (before preselection)") ;
00355 
00356   // preselection
00357   if (strategyCfg_.applyPreselection)
00358    {
00359     algo_->removeNotPreselectedElectrons() ;
00360     algo_->displayInternalElectrons("GsfElectronAlgo Info (after preselection)") ;
00361    }
00362 
00363   // ambiguity
00364   algo_->setAmbiguityData() ;
00365   if (strategyCfg_.applyAmbResolution)
00366    {
00367     algo_->removeAmbiguousElectrons() ;
00368     algo_->displayInternalElectrons("GsfElectronAlgo Info (after amb. solving)") ;
00369    }
00370 
00371   // final filling
00372   std::auto_ptr<GsfElectronCollection> finalCollection( new GsfElectronCollection ) ;
00373   algo_->copyElectrons(*finalCollection) ;
00374   event.put(finalCollection) ;
00375  }
00376 
00377 void GsfElectronBaseProducer::endEvent()
00378  {
00379   algo_->endEvent() ;
00380  }
00381 
00382 void GsfElectronBaseProducer::checkEcalSeedingParameters( edm::ParameterSetID const & psetid )
00383  {
00384   edm::ParameterSet pset ;
00385   edm::pset::Registry::instance()->getMapped(psetid,pset) ;
00386   edm::ParameterSet seedConfiguration = pset.getParameter<edm::ParameterSet>("SeedConfiguration") ;
00387   //edm::ParameterSet orderedHitsFactoryPSet = seedConfiguration.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet") ;
00388   //edm::ParameterSet seedParameters = seedConfiguration.getParameter<edm::ParameterSet>("ecalDrivenElectronSeedsParameters") ;
00389 
00390   if (seedConfiguration.getParameter<bool>("applyHOverECut"))
00391    {
00392     if ((hcalCfg_.hOverEConeSize!=0)&&(hcalCfg_.hOverEConeSize!=seedConfiguration.getParameter<double>("hOverEConeSize")))
00393      { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The H/E cone size ("<<hcalCfg_.hOverEConeSize<<") is different from ecal seeding ("<<seedConfiguration.getParameter<double>("hOverEConeSize")<<")." ; }
00394     if (cutsCfg_.maxHOverEBarrel<seedConfiguration.getParameter<double>("maxHOverEBarrel"))
00395      { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max barrel H/E is lower than during ecal seeding." ; }
00396     if (cutsCfg_.maxHOverEEndcaps<seedConfiguration.getParameter<double>("maxHOverEEndcaps"))
00397      { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max endcaps H/E is lower than during ecal seeding." ; }
00398    }
00399 
00400   if (cutsCfg_.minSCEtBarrel<seedConfiguration.getParameter<double>("SCEtCut"))
00401    { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in barrel is lower than during ecal seeding." ; }
00402   if (cutsCfg_.minSCEtEndcaps<seedConfiguration.getParameter<double>("SCEtCut"))
00403    { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in endcaps is lower than during ecal seeding." ; }
00404  }
00405 
00406