Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:18

0001 #ifndef IsolationAlgos_IsoDepositExtractor_H
0002 #define IsolationAlgos_IsoDepositExtractor_H
0003 
0004 //
0005 //
0006 //
0007 
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 
0013 #include "DataFormats/TrackReco/interface/Track.h"
0014 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0015 
0016 #include "DataFormats/Candidate/interface/Candidate.h"
0017 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0018 
0019 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0020 
0021 namespace reco {
0022   namespace isodeposit {
0023 
0024     class IsoDepositExtractor {
0025     public:
0026       //! Destructor
0027       virtual ~IsoDepositExtractor() {}
0028 
0029       //! fill vetoes: to exclude deposits at IsoDeposit creation stage
0030       //! check concrete extractors if it's no-op !
0031       virtual void fillVetos(const edm::Event& ev,
0032                              const edm::EventSetup& evSetup,
0033                              const reco::TrackCollection& tracks) = 0;
0034 
0035       //! perform some constly initialization
0036       virtual void initEvent(const edm::Event&, const edm::EventSetup&) {}
0037 
0038       //! make single IsoDeposit based on track as input
0039       //! purely virtual: have to implement in concrete implementations
0040       virtual reco::IsoDeposit deposit(const edm::Event& ev,
0041                                        const edm::EventSetup& evSetup,
0042                                        const reco::Track& track) const = 0;
0043 
0044       //! make single IsoDeposit based on trackRef as input
0045       virtual reco::IsoDeposit deposit(const edm::Event& ev,
0046                                        const edm::EventSetup& evSetup,
0047                                        const reco::TrackBaseRef& track) const {
0048         return deposit(ev, evSetup, *track);
0049       }
0050 
0051       //! make single IsoDeposit based on a candidate as input
0052       //! purely virtual: have to implement in concrete implementations
0053       virtual reco::IsoDeposit deposit(const edm::Event& ev,
0054                                        const edm::EventSetup& evSetup,
0055                                        const reco::Candidate& track) const {
0056         //track-based implementation as default <-- do I want this pure virtual?
0057         return deposit(
0058             ev,
0059             evSetup,
0060             reco::Track(10, 10, track.vertex(), track.momentum(), track.charge(), reco::Track::CovarianceMatrix()));
0061       }
0062 
0063       //! make single IsoDeposit based on a CandidateBaseRef as input
0064       virtual reco::IsoDeposit deposit(const edm::Event& ev,
0065                                        const edm::EventSetup& evSetup,
0066                                        const reco::CandidateBaseRef& track) const {
0067         return deposit(ev, evSetup, *track);
0068       }
0069 
0070       //! make multiple IsoDeposit(s) based on a track as input
0071       //! use these only if CPU-constrained
0072       //! for all derived types THIS METHOD HAS TO BE IMPLEMENTED at the minimum
0073       virtual std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0074                                                      const edm::EventSetup& evSetup,
0075                                                      const reco::Track& track) const {
0076         return std::vector<reco::IsoDeposit>(1, deposit(ev, evSetup, track));
0077       }
0078 
0079       //! make multiple IsoDeposit(s) based on a TrackBaseRef as input
0080       //! use these only if CPU-constrained
0081       virtual std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0082                                                      const edm::EventSetup& evSetup,
0083                                                      const reco::TrackBaseRef& track) const {
0084         return deposits(ev, evSetup, *track);
0085       }
0086 
0087       //! make multiple IsoDeposit(s) based on a candidate as input
0088       //! use these only if CPU-constrained
0089       virtual std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0090                                                      const edm::EventSetup& evSetup,
0091                                                      const reco::Candidate& track) const {
0092         return deposits(
0093             ev,
0094             evSetup,
0095             reco::Track(10, 10, track.vertex(), track.momentum(), track.charge(), reco::Track::CovarianceMatrix()));
0096       }
0097 
0098       //! make multiple IsoDeposit(s) based on a candidateBaseRef as input
0099       //! use these only if CPU-constrained
0100       virtual std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0101                                                      const edm::EventSetup& evSetup,
0102                                                      const reco::CandidateBaseRef& track) const {
0103         return deposits(ev, evSetup, *track);
0104       }
0105     };
0106   }  // namespace isodeposit
0107 }  // namespace reco
0108 #endif