CMS 3D CMS Logo

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