CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoEgamma/EgammaElectronAlgos/interface/SiStripElectronAlgo.h

Go to the documentation of this file.
00001 #ifndef EgammaElectronAlgos_SiStripElectronAlgo_h
00002 #define EgammaElectronAlgos_SiStripElectronAlgo_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     EgammaElectronAlgos
00006 // Class  :     SiStripElectronAlgo
00007 // 
00016 //
00017 // Original Author:  Jim Pivarski
00018 //         Created:  Fri May 26 16:11:58 EDT 2006
00019 // $Id: SiStripElectronAlgo.h,v 1.17 2011/03/21 17:10:32 innocent Exp $
00020 //
00021 
00022 // system include files
00023 
00024 #include <map>
00025 
00026 // user include files
00027 
00028 // forward declarations
00029 
00030 #include "DataFormats/EgammaCandidates/interface/SiStripElectron.h"
00031 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00032 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00033 #include "MagneticField/Engine/interface/MagneticField.h"
00034 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 
00035 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
00036 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00037 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
00038 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
00039 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00040 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00041 #include "DataFormats/Common/interface/Handle.h"
00042 #include "FWCore/Framework/interface/ESHandle.h"
00043 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00044 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00045 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00046 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00047 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h"
00048 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00049 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
00050 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00051 #include "DataFormats/TrajectoryState/interface/PTrajectoryStateOnDet.h"
00052 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00053 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
00054 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00055 
00056 class SiStripElectronAlgo
00057 {
00058 
00059    public:
00060       SiStripElectronAlgo(unsigned int maxHitsOnDetId,
00061                           double originUncertainty,
00062                           double phiBandWidth,
00063                           double maxNormResid,
00064                           unsigned int minHits,
00065                           double maxReducedChi2);
00066 
00067       virtual ~SiStripElectronAlgo();
00068 
00069       // ---------- const member functions ---------------------
00070 
00071       // ---------- static member functions --------------------
00072 
00073       // ---------- member functions ---------------------------
00074 
00075       void prepareEvent(const edm::ESHandle<TrackerGeometry>& tracker,
00076                         const edm::Handle<SiStripRecHit2DCollection>& rphiHits,
00077                         const edm::Handle<SiStripRecHit2DCollection>& stereoHits,
00078                         const edm::Handle<SiStripMatchedRecHit2DCollection>& matchedHits,
00079                         const edm::ESHandle<MagneticField>& magneticField);
00080 
00081       // returns true iff an electron/positron was found
00082       // and inserts SiStripElectron and trackCandidate into electronOut and trackCandidateOut
00083       bool findElectron(reco::SiStripElectronCollection& electronOut,
00084                         TrackCandidateCollection& trackCandidateOut,
00085                         const reco::SuperClusterRef& superclusterIn);
00086 
00087    private:
00088       SiStripElectronAlgo(const SiStripElectronAlgo&); // stop default
00089 
00090       const SiStripElectronAlgo& operator=(const SiStripElectronAlgo&); // stop default
00091 
00092       // inserts pointers to good hits into hitPointersOut
00093       // selects hits on DetIds that have no more than maxHitsOnDetId_
00094       // selects from stereo if stereo == true, rphi otherwise
00095       // selects from TID or TEC if endcap == true, TIB or TOB otherwise
00096       void coarseHitSelection(std::vector<const SiStripRecHit2D*>& hitPointersOut,
00097                               bool stereo, bool endcap);
00098       void coarseBarrelMonoHitSelection(std::vector<const SiStripRecHit2D*>& monoHitPointersOut );
00099       void coarseEndcapMonoHitSelection(std::vector<const SiStripRecHit2D*>& monoHitPointersOut );
00100       void coarseMatchedHitSelection(std::vector<const SiStripMatchedRecHit2D*>& coarseMatchedHitPointersOut);
00101 
00102 
00103       // projects a phi band of width phiBandWidth_ from supercluster into tracker (given a chargeHypothesis)
00104       // fills *_pos_ or *_neg_ member data with the results
00105       // returns true iff the electron/positron passes cuts
00106       bool projectPhiBand(float chargeHypothesis, const reco::SuperClusterRef& superclusterIn);
00107 
00108       double unwrapPhi(double phi) const {
00109          while (phi > M_PI) { phi -= 2.*M_PI; }
00110          while (phi < -M_PI) { phi += 2.*M_PI; }
00111          return phi;
00112       }
00113 
00114       // ---------- member data --------------------------------
00115 
00116       // parameters
00117       unsigned int maxHitsOnDetId_;
00118       double originUncertainty_;
00119       double phiBandWidth_;
00120       double maxNormResid_;
00121       unsigned int minHits_;
00122       double maxReducedChi2_;
00123 
00124       // changes with each event
00125       const TrackerGeometry* tracker_p_;
00126       const SiStripRecHit2DCollection* rphiHits_p_;
00127       const SiStripRecHit2DCollection* stereoHits_p_;
00128       const SiStripMatchedRecHit2DCollection* matchedHits_p_;
00129       const MagneticField* magneticField_p_;
00130 
00131       const edm::Handle<SiStripRecHit2DCollection>* rphiHits_hp_;
00132       const edm::Handle<SiStripRecHit2DCollection>* stereoHits_hp_;
00133       const edm::Handle<SiStripMatchedRecHit2DCollection>* matchedHits_hp_;
00134 
00135 
00136       std::map<const SiStripRecHit2D*, unsigned int> rphiKey_;
00137       std::map<const SiStripRecHit2D*, unsigned int> stereoKey_;
00138       std::map<const SiStripMatchedRecHit2D*, unsigned int> matchedKey_;
00139 
00140       std::map<const TrackingRecHit*, bool> hitUsed_;
00141       std::map<const TrackingRecHit*, bool> matchedHitUsed_;
00142 
00143 
00144       double redchi2_pos_;
00145       GlobalPoint position_pos_;
00146       GlobalVector momentum_pos_;
00147       const SiStripRecHit2D* innerhit_pos_;
00148       std::vector<const TrackingRecHit*> outputHits_pos_;
00149       std::vector<SiStripRecHit2D> outputRphiHits_pos_;
00150       std::vector<SiStripRecHit2D> outputStereoHits_pos_;
00151       std::vector<SiStripRecHit2D> outputMatchedHits_neg_;
00152 
00153       double phiVsRSlope_pos_;
00154       double slope_pos_;
00155       double intercept_pos_;
00156       double chi2_pos_;
00157       int ndof_pos_;
00158       double correct_pT_pos_;
00159       double pZ_pos_;
00160       double zVsRSlope_pos_;
00161       unsigned int numberOfMatchedHits_pos_;
00162       unsigned int numberOfStereoHits_pos_;
00163       unsigned int numberOfBarrelRphiHits_pos_;
00164       unsigned int numberOfEndcapZphiHits_pos_;
00165       
00166       double redchi2_neg_;
00167       GlobalPoint position_neg_;
00168       GlobalVector momentum_neg_;
00169       const SiStripRecHit2D* innerhit_neg_;
00170       std::vector<const TrackingRecHit*> outputHits_neg_;
00171       std::vector<SiStripRecHit2D> outputRphiHits_neg_;
00172       std::vector<SiStripRecHit2D> outputStereoHits_neg_;
00173       double phiVsRSlope_neg_;
00174       double slope_neg_;
00175       double intercept_neg_;
00176       double chi2_neg_;
00177       int ndof_neg_;
00178       double correct_pT_neg_;
00179       double pZ_neg_;
00180       double zVsRSlope_neg_;
00181       unsigned numberOfStereoHits_neg_;
00182       unsigned numberOfBarrelRphiHits_neg_;
00183       unsigned numberOfEndcapZphiHits_neg_;
00184 };
00185 
00186 
00187 #endif