00001 #ifndef RECOEGAMMA_EGAMMAHLTPRODUCERS_EGAMMAHLTGSFTRACKVARPRODUCER 00002 #define RECOEGAMMA_EGAMMAHLTPRODUCERS_EGAMMAHLTGSFTRACKVARPRODUCER 00003 00004 00005 // system include files 00006 #include <memory> 00007 00008 // user include files 00009 #include "FWCore/Framework/interface/Frameworkfwd.h" 00010 #include "FWCore/Framework/interface/EDProducer.h" 00011 #include "FWCore/Framework/interface/Event.h" 00012 #include "FWCore/Framework/interface/MakerMacros.h" 00013 #include "FWCore/Framework/interface/ESHandle.h" 00014 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00015 00016 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" 00017 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" 00018 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateTransform.h" 00019 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateMode.h" 00020 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronUtilities.h" 00021 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" 00022 //#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" 00023 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" 00024 00025 //this class is designed to calculate dEtaIn,dPhiIn gsf track - supercluster pairs 00026 //it can take as input std::vector<Electron> which the gsf track-sc is already done 00027 //or it can run over the std::vector<GsfTrack> directly in which case it will pick the smallest dEta,dPhi 00028 //the dEta, dPhi do not have to be from the same track 00029 //it can optionally set dEta, dPhi to 0 based on the number of tracks found 00030 00031 00032 class EgammaHLTGsfTrackVarProducer : public edm::EDProducer { 00033 private: 00034 //this is a helper class which performs the necessary track to ecal and track to vertex extrapolations 00035 //based on the GsfElectronAlgo class 00036 class TrackExtrapolator { 00037 00038 00039 unsigned long long cacheIDTDGeom_; 00040 unsigned long long cacheIDMagField_; 00041 00042 edm::ESHandle<MagneticField> magField_; 00043 edm::ESHandle<TrackerGeometry> trackerHandle_; 00044 00045 MultiTrajectoryStateMode mtsMode_; 00046 const MultiTrajectoryStateTransform * mtsTransform_; //we own it 00047 00048 00049 public: 00050 TrackExtrapolator():cacheIDTDGeom_(0),cacheIDMagField_(0),mtsTransform_(0){} 00051 TrackExtrapolator(const TrackExtrapolator& rhs); 00052 ~TrackExtrapolator(){delete mtsTransform_;} 00053 TrackExtrapolator* operator=(const TrackExtrapolator& rhs); 00054 00055 00056 void setup(const edm::EventSetup& iSetup); 00057 00058 GlobalPoint extrapolateTrackPosToPoint(const reco::GsfTrack& gsfTrack,const GlobalPoint& pointToExtrapTo); 00059 GlobalVector extrapolateTrackMomToPoint(const reco::GsfTrack& gsfTrack,const GlobalPoint& pointToExtrapTo); 00060 00061 edm::ESHandle<TrackerGeometry> trackerGeomHandle()const{return trackerHandle_;} 00062 const MultiTrajectoryStateTransform * mtsTransform()const{return mtsTransform_;} 00063 const MultiTrajectoryStateMode* mtsMode()const{return &mtsMode_;} 00064 }; 00065 00066 public: 00067 explicit EgammaHLTGsfTrackVarProducer(const edm::ParameterSet&); 00068 ~EgammaHLTGsfTrackVarProducer(); 00069 00070 00071 virtual void produce(edm::Event&, const edm::EventSetup&); 00072 00073 private: 00074 00075 private: 00076 // ----------member data --------------------------- 00077 edm::InputTag recoEcalCandTag_; 00078 edm::InputTag inputCollectionTag_; 00079 edm::InputTag beamSpotTag_; 00080 TrackExtrapolator trackExtrapolator_; 00081 int upperTrackNrToRemoveCut_; 00082 int lowerTrackNrToRemoveCut_; 00083 00084 }; 00085 00086 #endif