CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/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 
00071     struct StrategyConfiguration
00072      {
00073       bool useGsfPfRecTracks ;
00074       // if true, electron preselection is applied
00075       bool applyPreselection ;
00076       // if true, electron level escale corrections are
00077       // used on top of the cluster level corrections
00078       bool applyEcalEnergyCorrection ;
00079       // ambiguity solving
00080       bool applyAmbResolution  ; // if not true, ambiguity solving is not applied
00081       unsigned ambSortingStrategy  ; // 0:isBetter, 1:isInnerMost
00082       unsigned ambClustersOverlapStrategy  ; // 0:sc adresses, 1:bc shared energy
00083       // if true, trackerDriven electrons are added
00084       bool addPflowElectrons ;
00085       // for backward compatibility
00086       bool ctfTracksCheck ;
00087      } ;
00088 
00089     struct CutsConfiguration
00090      {
00091       // minimum SC Et
00092       double minSCEtBarrel ;
00093       double minSCEtEndcaps ;
00094       // maximum E/p where E is the supercluster corrected energy and p the track momentum at innermost state
00095       double maxEOverPBarrel ;
00096       double maxEOverPEndcaps ;
00097       // minimum E/p where E is the supercluster corrected energy and p the track momentum at innermost state
00098       double minEOverPBarrel ;
00099       double minEOverPEndcaps ;
00100 
00101       // H/E
00102       double maxHOverEBarrel ;
00103       double maxHOverEEndcaps ;
00104       double maxHBarrel ;
00105       double maxHEndcaps ;
00106 
00107       // maximum eta difference between the supercluster position and the track position at the closest impact to the supercluster
00108       double maxDeltaEtaBarrel ;
00109       double maxDeltaEtaEndcaps ;
00110 
00111       // maximum phi difference between the supercluster position and the track position at the closest impact to the supercluster
00112       // position to the supercluster
00113       double maxDeltaPhiBarrel ;
00114       double maxDeltaPhiEndcaps ;
00115 
00116       // maximum sigma ieta ieta
00117       double maxSigmaIetaIetaBarrel ;
00118       double maxSigmaIetaIetaEndcaps ;
00119       // maximum fbrem
00120 
00121       double maxFbremBarrel ;
00122       double maxFbremEndcaps ;
00123 
00124       // fiducial regions
00125       bool isBarrel ;
00126       bool isEndcaps ;
00127       bool isFiducial ;
00128 
00129       // BDT output (if available)
00130       double minMVA ;
00131 
00132       // transverse impact parameter wrt beam spot
00133       double maxTIP ;
00134 
00135       // only make sense for ecal driven electrons
00136       bool seedFromTEC ;
00137      } ;
00138 
00139     // isolation variables parameters
00140     struct IsolationConfiguration
00141      {
00142       double intRadiusBarrelTk ;
00143       double intRadiusEndcapTk ;
00144       double stripBarrelTk ;
00145       double stripEndcapTk ;
00146       double ptMinTk ;
00147       double maxVtxDistTk ;
00148       double maxDrbTk ;
00149       double intRadiusHcal ;
00150       double etMinHcal ;
00151       double intRadiusEcalBarrel ;
00152       double intRadiusEcalEndcaps ;
00153       double jurassicWidth ;
00154       double etMinBarrel ;
00155       double eMinBarrel ;
00156       double etMinEndcaps ;
00157       double eMinEndcaps ;
00158       bool vetoClustered ;
00159       bool useNumCrystals ;
00160      } ;
00161 
00162     // spike removal configuration
00163     struct SpikeConfiguration
00164      {
00165       int severityLevelCut ;
00166       //float severityRecHitThreshold ;
00167       //float spikeIdThreshold ;
00168       //EcalSeverityLevelAlgo::SpikeId spikeId ;
00169       std::vector<int> recHitFlagsToBeExcluded ;
00170      } ;
00171 
00172     GsfElectronAlgo
00173      (
00174       const InputTagsConfiguration &,
00175       const StrategyConfiguration &,
00176       const CutsConfiguration & cutsCfg,
00177       const CutsConfiguration & cutsCfgPflow,
00178       const ElectronHcalHelper::Configuration & hcalCfg,
00179       const ElectronHcalHelper::Configuration & hcalCfgPflow,
00180       const IsolationConfiguration &,
00181       const SpikeConfiguration &,
00182       EcalClusterFunctionBaseClass * superClusterErrorFunction,
00183       EcalClusterFunctionBaseClass * crackCorrectionFunction
00184      ) ;
00185 
00186     ~GsfElectronAlgo() ;
00187 
00188     // typedefs
00189     typedef std::list<reco::GsfElectron *> GsfElectronPtrCollection ; // for temporary collections
00190 
00191     // main methods
00192     void checkSetup( const edm::EventSetup & ) ;
00193     void beginEvent( edm::Event & ) ;
00194     void displayInternalElectrons( const std::string & title ) const ;
00195     void clonePreviousElectrons() ;
00196     void completeElectrons() ; // do not redo cloned electrons done previously
00197     void addPflowInfo() ;
00198     void setAmbiguityData( bool ignoreNotPreselected = true ) ;
00199     void removeNotPreselectedElectrons() ;
00200     void removeAmbiguousElectrons() ;
00201     void copyElectrons( reco::GsfElectronCollection & ) ;
00202     void endEvent() ;
00203 
00204 
00205   private :
00206 
00207     // internal structures
00208     struct GeneralData ;
00209     struct EventSetupData ;
00210     struct EventData ;
00211     struct ElectronData ;
00212     GeneralData * generalData_ ;
00213     EventSetupData * eventSetupData_ ;
00214     EventData * eventData_ ;
00215     ElectronData * electronData_ ;
00216 
00217     void createElectron() ;
00218 
00219     void setCutBasedPreselectionFlag( reco::GsfElectron * ele, const reco::BeamSpot & ) ;
00220     void setMvaPreselectionFlag( reco::GsfElectron * ele ) ;
00221     bool isPreselected( reco::GsfElectron * ele ) ;
00222     void calculateShowerShape( const reco::SuperClusterRef &, bool pflow, reco::GsfElectron::ShowerShape & ) ;
00223 
00224     // associations
00225     const reco::SuperClusterRef getTrSuperCluster( const reco::GsfTrackRef & trackRef ) ;
00226 
00227  } ;
00228 
00229 #endif // GsfElectronAlgo_H
00230 
00231