Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:05:05

0001 #ifndef TrackAssociation_ParametersDefinerForTP_h
0002 #define TrackAssociation_ParametersDefinerForTP_h
0003 
0004 /**
0005  *
0006  *
0007  * \author Boris Mangano (UCSD)  5/7/2009
0008  */
0009 
0010 #include <memory>
0011 
0012 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0013 #include "DataFormats/Candidate/interface/Candidate.h"
0014 #include "FWCore/Framework/interface/ConsumesCollector.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 #include "MagneticField/Engine/interface/MagneticField.h"
0018 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0019 #include "SimGeneral/TrackingAnalysis/interface/SimHitTPAssociationProducer.h"
0020 #include <SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h>
0021 
0022 class ParametersDefinerForTP {
0023 public:
0024   ParametersDefinerForTP(const edm::InputTag &beamspot, edm::ConsumesCollector iC);
0025   virtual ~ParametersDefinerForTP();
0026 
0027   typedef int Charge;                              ///< electric charge type
0028   typedef math::XYZPointD Point;                   ///< point in the space
0029   typedef math::XYZTLorentzVectorD LorentzVector;  ///< Lorentz vector
0030 
0031   virtual TrackingParticle::Vector momentum(const edm::Event &iEvent,
0032                                             const edm::EventSetup &iSetup,
0033                                             const Charge ch,
0034                                             const Point &vtx,
0035                                             const LorentzVector &lv) const;
0036 
0037   virtual TrackingParticle::Vector momentum(const edm::Event &iEvent,
0038                                             const edm::EventSetup &iSetup,
0039                                             const TrackingParticleRef &tpr) const {
0040     return momentum(iEvent, iSetup, tpr->charge(), tpr->vertex(), tpr->p4());
0041   }
0042 
0043   virtual TrackingParticle::Vector momentum(const edm::Event &iEvent,
0044                                             const edm::EventSetup &iSetup,
0045                                             const reco::Candidate &tp) const {
0046     return momentum(iEvent, iSetup, tp.charge(), tp.vertex(), tp.p4());
0047   }
0048 
0049   virtual TrackingParticle::Point vertex(const edm::Event &iEvent,
0050                                          const edm::EventSetup &iSetup,
0051                                          const Charge ch,
0052                                          const Point &vtx,
0053                                          const LorentzVector &lv) const;
0054 
0055   virtual TrackingParticle::Point vertex(const edm::Event &iEvent,
0056                                          const edm::EventSetup &iSetup,
0057                                          const TrackingParticleRef &tpr) const {
0058     return vertex(iEvent, iSetup, tpr->charge(), tpr->vertex(), tpr->p4());
0059   }
0060 
0061   virtual TrackingParticle::Point vertex(const edm::Event &iEvent,
0062                                          const edm::EventSetup &iSetup,
0063                                          const reco::Candidate &tp) const {
0064     return vertex(iEvent, iSetup, tp.charge(), tp.vertex(), tp.p4());
0065   }
0066 
0067   virtual std::tuple<TrackingParticle::Vector, TrackingParticle::Point> momentumAndVertex(
0068       const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const {
0069     return momentumAndVertex(iEvent, iSetup, tpr->charge(), tpr->vertex(), tpr->p4());
0070   }
0071 
0072   std::tuple<TrackingParticle::Vector, TrackingParticle::Point> momentumAndVertex(const edm::Event &iEvent,
0073                                                                                   const edm::EventSetup &iSetup,
0074                                                                                   const Charge ch,
0075                                                                                   const Point &vtx,
0076                                                                                   const LorentzVector &lv) const;
0077 
0078   virtual void initEvent(edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> simHitsTPAssocToSet) {}
0079 
0080   virtual std::unique_ptr<ParametersDefinerForTP> clone() const {
0081     return std::make_unique<ParametersDefinerForTP>(*this);
0082   }
0083 
0084 protected:
0085   const edm::EDGetTokenT<reco::BeamSpot> bsToken_;
0086   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> mfToken_;
0087 };
0088 
0089 #endif