00001 #ifndef PF_PU_AssoMapAlgos_h
00002 #define PF_PU_AssoMapAlgos_h
00003
00004
00009
00010
00011
00012
00013 #include <string>
00014
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/Utilities/interface/InputTag.h"
00017 #include "FWCore/Framework/interface/Event.h"
00018
00019 #include "DataFormats/Common/interface/AssociationMap.h"
00020 #include "DataFormats/Common/interface/Handle.h"
00021 #include "DataFormats/Common/interface/OneToManyWithQuality.h"
00022 #include "DataFormats/Common/interface/OneToManyWithQualityGeneric.h"
00023 #include "DataFormats/Common/interface/View.h"
00024
00025 #include "DataFormats/Math/interface/Point3D.h"
00026 #include "DataFormats/TrackReco/interface/Track.h"
00027 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00028 #include "DataFormats/TrackReco/interface/TrackBase.h"
00029 #include "DataFormats/VertexReco/interface/Vertex.h"
00030 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00031 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00032 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00033 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
00034 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
00035 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h"
00036 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00037 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00038 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00039
00040 typedef edm::AssociationMap<edm::OneToManyWithQuality< reco::VertexCollection, reco::TrackCollection, float> > TrackVertexAssMap;
00041
00042 typedef std::pair<reco::TrackRef, float> TrackQualityPair;
00043 typedef std::pair<reco::VertexRef, TrackQualityPair> VertexTrackQuality;
00044
00045 class PF_PU_AssoMapAlgos{
00046
00047 public:
00048
00049
00050 PF_PU_AssoMapAlgos(const edm::ParameterSet&);
00051
00052
00053 bool GetInputCollections(edm::Event&, const edm::EventSetup&);
00054
00055
00056 VertexTrackQuality DoTrackAssociation(const reco::TrackRef&, const edm::EventSetup&);
00057
00058
00059 reco::VertexRef GetFirstVertex();
00060
00061
00062 static std::auto_ptr<TrackVertexAssMap> SortAssociationMap(TrackVertexAssMap*);
00063
00064 protected:
00065
00066
00067 private:
00068
00069
00070
00071
00072 static VertexTrackQuality TrackWeightAssociation(const reco::TrackRef&, edm::Handle<reco::VertexCollection>);
00073
00074
00075 static double dR(math::XYZPoint, math::XYZVector, edm::Handle<reco::BeamSpot>);
00076
00077
00078 static VertexTrackQuality AssociateClosestZ(reco::TrackRef, edm::Handle<reco::VertexCollection>, double tWeight = 0.);
00079
00080
00081 static reco::VertexRef FindClosest3D(reco::TransientTrack, edm::Handle<reco::VertexCollection>, double tWeight = 0.);
00082
00083
00084 static VertexTrackQuality AssociateClosest3D(reco::TrackRef, edm::Handle<reco::VertexCollection>,
00085 edm::ESHandle<MagneticField>, const edm::EventSetup&,
00086 edm::Handle<reco::BeamSpot>, double);
00087
00088
00089 static std::auto_ptr<reco::ConversionCollection> GetCleanedConversions(edm::Handle<reco::ConversionCollection>,
00090 edm::Handle<reco::BeamSpot>, bool);
00091
00092
00093 static bool ComesFromConversion(const reco::TrackRef, reco::ConversionCollection, reco::Conversion*);
00094
00095 static VertexTrackQuality FindConversionVertex(const reco::TrackRef, reco::Conversion,
00096 edm::ESHandle<MagneticField>, const edm::EventSetup&,
00097 edm::Handle<reco::BeamSpot>, edm::Handle<reco::VertexCollection>,
00098 double);
00099
00100
00101 static std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedKshort(edm::Handle<reco::VertexCompositeCandidateCollection>, edm::Handle<reco::BeamSpot>, bool);
00102
00103
00104 static std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedLambda(edm::Handle<reco::VertexCompositeCandidateCollection>, edm::Handle<reco::BeamSpot>, bool);
00105
00106
00107 static bool ComesFromV0Decay(const reco::TrackRef, reco::VertexCompositeCandidateCollection,
00108 reco::VertexCompositeCandidateCollection, reco::VertexCompositeCandidate*);
00109
00110 static VertexTrackQuality FindV0Vertex(const reco::TrackRef, reco::VertexCompositeCandidate,
00111 edm::ESHandle<MagneticField>, const edm::EventSetup&,
00112 edm::Handle<reco::BeamSpot>, edm::Handle<reco::VertexCollection>, double);
00113
00114
00115 static std::auto_ptr<reco::PFDisplacedVertexCollection> GetCleanedNI(edm::Handle<reco::PFDisplacedVertexCollection>, edm::Handle<reco::BeamSpot>, bool);
00116
00117
00118 static bool ComesFromNI(const reco::TrackRef, reco::PFDisplacedVertexCollection, reco::PFDisplacedVertex*);
00119
00120 static VertexTrackQuality FindNIVertex(const reco::TrackRef, reco::PFDisplacedVertex,
00121 edm::ESHandle<MagneticField>, const edm::EventSetup&,
00122 edm::Handle<reco::BeamSpot>, edm::Handle<reco::VertexCollection>, double);
00123
00124
00125 static bool CheckBeamSpotCompability(reco::TransientTrack, double);
00126
00127
00128
00129
00130 edm::InputTag input_VertexCollection_;
00131 edm::Handle<reco::VertexCollection> vtxcollH;
00132
00133 double input_PtCut_;
00134
00135 edm::InputTag input_BeamSpot_;
00136 edm::Handle<reco::BeamSpot> beamspotH;
00137
00138 edm::ESHandle<MagneticField> bFieldH;
00139
00140 bool input_doReassociation_;
00141 bool cleanedColls_;
00142
00143 edm::InputTag ConversionsCollection_;
00144 edm::Handle<reco::ConversionCollection> convCollH;
00145 std::auto_ptr<reco::ConversionCollection> cleanedConvCollP;
00146
00147 edm::InputTag KshortCollection_;
00148 edm::Handle<reco::VertexCompositeCandidateCollection> vertCompCandCollKshortH;
00149 std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedKshortCollP;
00150
00151 edm::InputTag LambdaCollection_;
00152 edm::Handle<reco::VertexCompositeCandidateCollection> vertCompCandCollLambdaH;
00153 std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedLambdaCollP;
00154
00155 edm::InputTag NIVertexCollection_;
00156 edm::Handle<reco::PFDisplacedVertexCollection> displVertexCollH;
00157 std::auto_ptr<reco::PFDisplacedVertexCollection> cleanedNICollP;
00158
00159 bool UseBeamSpotCompatibility_;
00160 double input_BSCut_;
00161
00162 int input_FinalAssociation_;
00163
00164 bool ignoremissingpfcollection_;
00165 bool missingColls;
00166
00167 double input_nTrack_;
00168
00169 int maxNumWarnings_;
00170 int numWarnings_;
00171
00172 };
00173
00174 #endif