00001 #ifndef RecoEgamma_EgammaPhotonProducers_TrackerOnlyConversionProducer_h
00002 #define RecoEgamma_EgammaPhotonProducers_TrackerOnlyConversionProducer_h
00003
00012
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/EDProducer.h"
00015
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/Framework/interface/MakerMacros.h"
00018
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 #include "FWCore/Framework/interface/ESHandle.h"
00021
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023
00024
00025 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00026 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00027 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00028 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00029 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
00030 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00031 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00032 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00033 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00034 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00035 #include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h"
00036 #include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h"
00037
00038 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00039 #include "RecoVertex/VertexPrimitives/interface/VertexState.h"
00040 #include "DataFormats/VertexReco/interface/Vertex.h"
00041 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicVertex.h"
00042 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicParticle.h"
00043 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicTree.h"
00044 #include "RecoVertex/KinematicFitPrimitives/interface/TransientTrackKinematicParticle.h"
00045 #include "RecoVertex/KinematicFit/interface/KinematicParticleVertexFitter.h"
00046
00047
00048
00049 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00050 #include "DataFormats/TrackReco/interface/Track.h"
00051 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00052
00053
00054
00055 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00056 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00057 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00058 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00059 #include "DataFormats/EgammaTrackReco/interface/ConversionTrackFwd.h"
00060
00061 #include "MagneticField/Engine/interface/MagneticField.h"
00062 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00063
00064 class TransientTrackBuilder;
00065 class ConversionVertexFinder;
00066
00067 class TrackerOnlyConversionProducer : public edm::EDProducer {
00068 public:
00069 explicit TrackerOnlyConversionProducer(const edm::ParameterSet&);
00070 ~TrackerOnlyConversionProducer();
00071
00072 void buildCollection( edm::Event& iEvent, const edm::EventSetup& iSetup,
00073
00074 const reco::ConversionTrackCollection& allTracks,
00075 const std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
00076 const reco::Vertex& the_pvtx,
00077 reco::ConversionCollection & outputConvPhotonCollection);
00078
00079 void buildCollection( edm::Event& iEvent, const edm::EventSetup& iSetup,
00080 const reco::ConversionTrackCollection& allTracks,
00081 const reco::CaloClusterPtr& basicClusterPtrs,
00082 const reco::Vertex& the_pvtx,
00083 reco::ConversionCollection & outputConvPhotonCollection);
00084
00085
00086 inline bool trackQualityFilter(const edm::RefToBase<reco::Track>& ref, bool isLeft);
00087 inline bool trackD0Cut(const edm::RefToBase<reco::Track>& ref);
00088 inline bool trackD0Cut(const edm::RefToBase<reco::Track>& ref, const reco::Vertex& the_pvtx);
00089
00090
00091 bool getTrackImpactPosition(const reco::Track* tk_ref,
00092 const TrackerGeometry* trackerGeom, const MagneticField* magField,
00093 math::XYZPoint& ew);
00094
00095
00096
00097
00098
00099 bool preselectTrackPair(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r,
00100 double& appDist);
00101
00102
00103 bool checkTrackPair(const std::pair<edm::RefToBase<reco::Track>, reco::CaloClusterPtr>& ll,
00104 const std::pair<edm::RefToBase<reco::Track>, reco::CaloClusterPtr>& rr);
00105
00106
00107 bool checkVertex(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r,
00108 const MagneticField* magField,
00109 reco::Vertex& the_vertex);
00110 bool checkPhi(const edm::RefToBase<reco::Track>& tk_l, const edm::RefToBase<reco::Track>& tk_r,
00111 const TrackerGeometry* trackerGeom, const MagneticField* magField,
00112 const reco::Vertex& the_vertex);
00113
00114
00115 bool getMatchedBC(const std::multimap<double, reco::CaloClusterPtr>& bcMap,
00116 const math::XYZPoint& trackImpactPosition,
00117 reco::CaloClusterPtr& closestBC);
00118
00119 bool getMatchedBC(const reco::CaloClusterPtrVector& bcMap,
00120 const math::XYZPoint& trackImpactPosition,
00121 reco::CaloClusterPtr& closestBC);
00122
00123
00124
00125 private:
00126
00127 virtual void produce(edm::Event&, const edm::EventSetup&);
00128
00129
00130 std::string algoName_;
00131
00132 typedef math::XYZPointD Point;
00133 typedef std::vector<Point> PointCollection;
00134
00135 edm::InputTag src_;
00136
00137 edm::InputTag bcBarrelCollection_;
00138 edm::InputTag bcEndcapCollection_;
00139 std::string ConvertedPhotonCollection_;
00140
00141 bool allowD0_, allowDeltaPhi_, allowTrackBC_, allowDeltaCot_, allowMinApproach_, allowOppCharge_, allowVertex_;
00142
00143 bool usePvtx_;
00144 std::string vertexProducer_;
00145 ConversionVertexFinder* theVertexFinder_;
00146
00147 const TransientTrackBuilder *thettbuilder_;
00148
00149
00150 double halfWayEta_, halfWayPhi_;
00151 unsigned int maxNumOfTrackInPU_;
00152
00153 double energyBC_;
00154 double energyTotalBC_;
00155 double d0Cut_;
00156 double dzCut_;
00157 double dEtaTkBC_, dPhiTkBC_;
00158
00159 double maxChi2Left_, maxChi2Right_;
00160 double minHitsLeft_, minHitsRight_;
00161
00162 double deltaCotTheta_, deltaPhi_, minApproachLow_, minApproachHigh_;
00163
00164
00165 double r_cut;
00166 double vtxChi2_;
00167
00168 bool allowSingleLeg_;
00169 bool rightBC_;
00170
00171 };
00172
00173
00174 inline const GeomDet * recHitDet( const TrackingRecHit & hit, const TrackingGeometry * geom ) {
00175 return geom->idToDet( hit.geographicalId() );
00176 }
00177
00178 inline const BoundPlane & recHitSurface( const TrackingRecHit & hit, const TrackingGeometry * geom ) {
00179 return recHitDet( hit, geom )->surface();
00180 }
00181
00182 inline LocalVector toLocal( const reco::Track::Vector & v, const Surface & s ) {
00183 return s.toLocal( GlobalVector( v.x(), v.y(), v.z() ) );
00184 }
00185
00186 #endif