00001 #ifndef RecoEgamma_EgammaPhotonProducers_ConversionProducer_h
00002 #define RecoEgamma_EgammaPhotonProducers_ConversionProducer_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 ConversionProducer : public edm::EDProducer {
00068 public:
00069 explicit ConversionProducer(const edm::ParameterSet&);
00070 ~ConversionProducer();
00071
00072
00073
00074
00075 private:
00076
00077 virtual void produce(edm::Event&, const edm::EventSetup&);
00078
00079
00080 std::string algoName_;
00081
00082 typedef math::XYZPointF Point;
00083 typedef std::vector<Point> PointCollection;
00084
00085 edm::InputTag src_;
00086
00087 edm::InputTag scBarrelProducer_;
00088 edm::InputTag scEndcapProducer_;
00089 edm::InputTag bcBarrelCollection_;
00090 edm::InputTag bcEndcapCollection_;
00091 std::string ConvertedPhotonCollection_;
00092
00093 bool allowD0_, allowDeltaPhi_, allowTrackBC_, allowDeltaCot_, allowMinApproach_, allowOppCharge_, allowVertex_;
00094
00095 bool bypassPreselGsf_, bypassPreselEcal_, bypassPreselEcalEcal_;
00096
00097 bool usePvtx_;
00098 std::string vertexProducer_;
00099 ConversionVertexFinder* theVertexFinder_;
00100
00101 const TransientTrackBuilder *thettbuilder_;
00102
00103 double halfWayEta_, halfWayPhi_;
00104 unsigned int maxNumOfTrackInPU_;
00105 double maxTrackZ_;
00106 double maxTrackRho_;
00107 double minSCEt_;
00108 double dEtacutForSCmatching_;
00109 double dPhicutForSCmatching_;
00110 double energyBC_;
00111 double energyTotalBC_;
00112 double d0Cut_;
00113 double dzCut_;
00114 double dEtaTkBC_, dPhiTkBC_;
00115
00116 double maxChi2Left_, maxChi2Right_;
00117 double minHitsLeft_, minHitsRight_;
00118
00119 double deltaCotTheta_, deltaPhi_, minApproachLow_, minApproachHigh_;
00120
00121
00122 double r_cut;
00123 double vtxChi2_;
00124
00125 bool allowSingleLeg_;
00126 bool rightBC_;
00127
00128
00129 void buildCollection( edm::Event& iEvent, const edm::EventSetup& iSetup,
00130 const reco::ConversionTrackCollection& allTracks,
00131 const std::multimap<double, reco::CaloClusterPtr>& superClusterPtrs,
00132 const std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
00133 const reco::Vertex& the_pvtx,
00134 reco::ConversionCollection & outputConvPhotonCollection);
00135
00136
00137
00138 inline bool trackQualityFilter(const edm::RefToBase<reco::Track>& ref, bool isLeft);
00139 inline bool trackD0Cut(const edm::RefToBase<reco::Track>& ref);
00140 inline bool trackD0Cut(const edm::RefToBase<reco::Track>& ref, const reco::Vertex& the_pvtx);
00141
00142
00143 bool getTrackImpactPosition(const reco::Track* tk_ref,
00144 const TrackerGeometry* trackerGeom, const MagneticField* magField,
00145 math::XYZPointF& ew);
00146
00147
00148
00149
00150
00151 bool preselectTrackPair(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r,
00152 double& appDist);
00153
00154
00155 bool checkTrackPair(const std::pair<edm::RefToBase<reco::Track>, reco::CaloClusterPtr>& ll,
00156 const std::pair<edm::RefToBase<reco::Track>, reco::CaloClusterPtr>& rr);
00157
00158
00159 bool checkVertex(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r,
00160 const MagneticField* magField,
00161 reco::Vertex& the_vertex);
00162 bool checkPhi(const edm::RefToBase<reco::Track>& tk_l, const edm::RefToBase<reco::Track>& tk_r,
00163 const TrackerGeometry* trackerGeom, const MagneticField* magField,
00164 const reco::Vertex& the_vertex);
00165
00166
00167 bool getMatchedBC(const std::multimap<double, reco::CaloClusterPtr>& bcMap,
00168 const math::XYZPointF& trackImpactPosition,
00169 reco::CaloClusterPtr& closestBC);
00170
00171
00172 bool matchingSC(const std::multimap<double, reco::CaloClusterPtr>& scMap,
00173 reco::Conversion& conv,
00174 reco::CaloClusterPtrVector& mSC);
00175
00176
00177
00178 double etaTransformation( float EtaParticle , float Zvertex);
00179
00180
00181 math::XYZPointF toFConverterP( const math::XYZPoint &val) {
00182 return math::XYZPointF(val.x(),val.y(),val.z());
00183 }
00184
00185 math::XYZVectorF toFConverterV( const math::XYZVector &val) {
00186 return math::XYZVectorF(val.x(),val.y(),val.z());
00187 }
00188
00189
00190 };
00191
00192
00193 inline const GeomDet * recHitDet( const TrackingRecHit & hit, const TrackingGeometry * geom ) {
00194 return geom->idToDet( hit.geographicalId() );
00195 }
00196
00197 inline const BoundPlane & recHitSurface( const TrackingRecHit & hit, const TrackingGeometry * geom ) {
00198 return recHitDet( hit, geom )->surface();
00199 }
00200
00201 inline LocalVector toLocal( const reco::Track::Vector & v, const Surface & s ) {
00202 return s.toLocal( GlobalVector( v.x(), v.y(), v.z() ) );
00203 }
00204
00205 #endif