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