CMS 3D CMS Logo

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