CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h

Go to the documentation of this file.
00001 
00002 #ifndef GsfElectronAlgo_H
00003 #define GsfElectronAlgo_H
00004 
00005 class MultiTrajectoryStateTransform ;
00006 class MultiTrajectoryStateMode ;
00007 class EcalClusterFunctionBaseClass ;
00008 
00009 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h"
00010 
00011 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
00012 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h"
00013 #include "RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h"
00014 
00015 #include "MagneticField/Engine/interface/MagneticField.h"
00016 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00017 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00018 #include "TrackingTools/GsfTracking/interface/GsfConstraintAtVertex.h"
00019 
00020 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
00021 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00022 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00023 
00024 #include "FWCore/Framework/interface/ESHandle.h"
00025 #include "FWCore/Framework/interface/EventSetup.h"
00026 #include "FWCore/Framework/interface/Event.h"
00027 
00028 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00029 #include "DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h"
00030 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
00031 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00032 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00033 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
00034 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00035 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00036 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00037 #include "DataFormats/TrackReco/interface/HitPattern.h"
00038 #include "DataFormats/Common/interface/ValueMap.h"
00039 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00040 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00041 
00042 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00043 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00044 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
00045 
00046 #include <list>
00047 #include <string>
00048 
00049 class GsfElectronAlgo {
00050 
00051   public:
00052 
00053     struct InputTagsConfiguration
00054      {
00055       edm::InputTag previousGsfElectrons ;
00056       edm::InputTag pflowGsfElectronsTag ;
00057       edm::InputTag gsfElectronCores ;
00058       edm::InputTag hcalTowersTag ;
00059       edm::InputTag barrelSuperClusters ;
00060       edm::InputTag endcapSuperClusters ;
00061       //edm::InputTag tracks ;
00062       edm::InputTag barrelRecHitCollection ;
00063       edm::InputTag endcapRecHitCollection ;
00064       edm::InputTag pfMVA ;
00065       edm::InputTag seedsTag ;
00066       edm::InputTag ctfTracks ;
00067       edm::InputTag beamSpotTag ;
00068       edm::InputTag gsfPfRecTracksTag ;
00069 
00070       //IsoVals (PF and EcalDriven)
00071       edm::ParameterSet pfIsoVals;
00072       edm::ParameterSet edIsoVals;
00073 
00074      } ;
00075 
00076     struct StrategyConfiguration
00077      {
00078       bool useGsfPfRecTracks ;
00079       // if true, electron preselection is applied
00080       bool applyPreselection ;
00081       // if true, electron level escale corrections are
00082       // used on top of the cluster level corrections
00083       bool ecalDrivenEcalEnergyFromClassBasedParameterization ;
00084       bool ecalDrivenEcalErrorFromClassBasedParameterization ;
00085       bool pureTrackerDrivenEcalErrorFromSimpleParameterization ;
00086       // ambiguity solving
00087       bool applyAmbResolution  ; // if not true, ambiguity solving is not applied
00088       unsigned ambSortingStrategy  ; // 0:isBetter, 1:isInnerMost
00089       unsigned ambClustersOverlapStrategy  ; // 0:sc adresses, 1:bc shared energy
00090       // if true, trackerDriven electrons are added
00091       bool addPflowElectrons ;
00092       // for backward compatibility
00093       bool ctfTracksCheck ;
00094      } ;
00095 
00096     struct CutsConfiguration
00097      {
00098       // minimum SC Et
00099       double minSCEtBarrel ;
00100       double minSCEtEndcaps ;
00101       // maximum E/p where E is the supercluster corrected energy and p the track momentum at innermost state
00102       double maxEOverPBarrel ;
00103       double maxEOverPEndcaps ;
00104       // minimum E/p where E is the supercluster corrected energy and p the track momentum at innermost state
00105       double minEOverPBarrel ;
00106       double minEOverPEndcaps ;
00107 
00108       // H/E
00109       double maxHOverEBarrel ;
00110       double maxHOverEEndcaps ;
00111       double maxHBarrel ;
00112       double maxHEndcaps ;
00113 
00114       // maximum eta difference between the supercluster position and the track position at the closest impact to the supercluster
00115       double maxDeltaEtaBarrel ;
00116       double maxDeltaEtaEndcaps ;
00117 
00118       // maximum phi difference between the supercluster position and the track position at the closest impact to the supercluster
00119       // position to the supercluster
00120       double maxDeltaPhiBarrel ;
00121       double maxDeltaPhiEndcaps ;
00122 
00123       // maximum sigma ieta ieta
00124       double maxSigmaIetaIetaBarrel ;
00125       double maxSigmaIetaIetaEndcaps ;
00126       // maximum fbrem
00127 
00128       double maxFbremBarrel ;
00129       double maxFbremEndcaps ;
00130 
00131       // fiducial regions
00132       bool isBarrel ;
00133       bool isEndcaps ;
00134       bool isFiducial ;
00135 
00136       // BDT output (if available)
00137       double minMVA ;
00138       double minMvaByPassForIsolated ;
00139 
00140       // transverse impact parameter wrt beam spot
00141       double maxTIP ;
00142 
00143       // only make sense for ecal driven electrons
00144       bool seedFromTEC ;
00145      } ;
00146 
00147     // Ecal rec hits
00148     struct EcalRecHitsConfiguration
00149      {
00150       std::vector<int> recHitFlagsToBeExcludedBarrel ;
00151       std::vector<int> recHitFlagsToBeExcludedEndcaps ;
00152       std::vector<int> recHitSeverityToBeExcludedBarrel ;
00153       std::vector<int> recHitSeverityToBeExcludedEndcaps ;
00154       //int severityLevelCut ;
00155      } ;
00156 
00157     // isolation variables parameters
00158     struct IsolationConfiguration
00159      {
00160       double intRadiusBarrelTk ;
00161       double intRadiusEndcapTk ;
00162       double stripBarrelTk ;
00163       double stripEndcapTk ;
00164       double ptMinTk ;
00165       double maxVtxDistTk ;
00166       double maxDrbTk ;
00167       double intRadiusHcal ;
00168       double etMinHcal ;
00169       double intRadiusEcalBarrel ;
00170       double intRadiusEcalEndcaps ;
00171       double jurassicWidth ;
00172       double etMinBarrel ;
00173       double eMinBarrel ;
00174       double etMinEndcaps ;
00175       double eMinEndcaps ;
00176       bool vetoClustered ;
00177       bool useNumCrystals ;
00178      } ;
00179 
00180     GsfElectronAlgo
00181      (
00182       const InputTagsConfiguration &,
00183       const StrategyConfiguration &,
00184       const CutsConfiguration & cutsCfg,
00185       const CutsConfiguration & cutsCfgPflow,
00186       const ElectronHcalHelper::Configuration & hcalCfg,
00187       const ElectronHcalHelper::Configuration & hcalCfgPflow,
00188       const IsolationConfiguration &,
00189       const EcalRecHitsConfiguration &,
00190       EcalClusterFunctionBaseClass * superClusterErrorFunction,
00191       EcalClusterFunctionBaseClass * crackCorrectionFunction
00192      ) ;
00193 
00194     ~GsfElectronAlgo() ;
00195 
00196     // typedefs
00197     typedef std::list<reco::GsfElectron *> GsfElectronPtrCollection ; // for temporary collections
00198 
00199     // main methods
00200     void checkSetup( const edm::EventSetup & ) ;
00201     void beginEvent( edm::Event & ) ;
00202     void displayInternalElectrons( const std::string & title ) const ;
00203     void clonePreviousElectrons() ;
00204     void completeElectrons() ; // do not redo cloned electrons done previously
00205     void addPflowInfo() ;
00206     void setAmbiguityData( bool ignoreNotPreselected = true ) ;
00207     void removeNotPreselectedElectrons() ;
00208     void removeAmbiguousElectrons() ;
00209     void copyElectrons( reco::GsfElectronCollection & ) ;
00210     void endEvent() ;
00211 
00212 
00213   private :
00214 
00215     // internal structures
00216     struct GeneralData ;
00217     struct EventSetupData ;
00218     struct EventData ;
00219     struct ElectronData ;
00220     GeneralData * generalData_ ;
00221     EventSetupData * eventSetupData_ ;
00222     EventData * eventData_ ;
00223     ElectronData * electronData_ ;
00224 
00225     void createElectron() ;
00226 
00227     void setCutBasedPreselectionFlag( reco::GsfElectron * ele, const reco::BeamSpot & ) ;
00228     void setPflowPreselectionFlag( reco::GsfElectron * ele ) ;
00229     bool isPreselected( reco::GsfElectron * ele ) ;
00230     void calculateShowerShape( const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape & ) ;
00231 
00232     // associations
00233     const reco::SuperClusterRef getTrSuperCluster( const reco::GsfTrackRef & trackRef ) ;
00234  } ;
00235 
00236 #endif // GsfElectronAlgo_H
00237 
00238