Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:53:51

0001 #ifndef L1Trigger_Phase2L1ParticleFlow_RegionMapper_h
0002 #define L1Trigger_Phase2L1ParticleFlow_RegionMapper_h
0003 
0004 #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
0005 #include "L1Trigger/Phase2L1ParticleFlow/interface/Region.h"
0006 #include "DataFormats/Math/interface/deltaPhi.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 
0009 #include "DataFormats/L1TCorrelator/interface/TkMuon.h"
0010 #include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h"
0011 
0012 #include <unordered_map>
0013 
0014 namespace edm {
0015   class Event;
0016 }
0017 
0018 namespace l1tpf_impl {
0019   class RegionMapper {
0020     // This does the input and filling of regions.
0021   public:
0022     RegionMapper(const edm::ParameterSet &);
0023 
0024     // add object, without tracking references
0025     void addTrack(const l1t::PFTrack &t);
0026     void addMuon(const l1t::Muon &t);
0027     void addMuon(const l1t::TkMuon &t);
0028     void addCalo(const l1t::PFCluster &t);
0029     void addEmCalo(const l1t::PFCluster &t);
0030 
0031     // add object, tracking references
0032     void addTrack(const l1t::PFTrack &t, l1t::PFTrackRef ref);
0033     void addCalo(const l1t::PFCluster &t, l1t::PFClusterRef ref);
0034     void addEmCalo(const l1t::PFCluster &t, l1t::PFClusterRef ref);
0035 
0036     void clear();
0037     std::vector<Region> &regions() { return regions_; }
0038 
0039     std::unique_ptr<l1t::PFCandidateCollection> fetch(bool puppi = true, float ptMin = 0.01) const;
0040     std::unique_ptr<l1t::PFCandidateCollection> fetchCalo(float ptMin = 0.01, bool emcalo = false) const;
0041     std::unique_ptr<l1t::PFCandidateCollection> fetchTracks(float ptMin = 0.01, bool fromPV = false) const;
0042 
0043     void putEgObjects(edm::Event &iEvent,
0044                       const bool writeEgSta,
0045                       const std::string &egLablel,
0046                       const std::string &tkEmLabel,
0047                       const std::string &tkEleLabel,
0048                       const float ptMin = 0.01) const;
0049 
0050     std::pair<unsigned, unsigned> totAndMaxInput(/*Region::InputType*/ int type) const;
0051     std::pair<unsigned, unsigned> totAndMaxOutput(/*Region::OutputType*/ int type, bool puppi) const;
0052     std::unique_ptr<std::vector<unsigned>> vecInput(int type) const;
0053     std::unique_ptr<std::vector<unsigned>> vecOutput(int type, bool puppi) const;
0054 
0055   protected:
0056     std::vector<Region> regions_;
0057     bool useRelativeRegionalCoordinates_;  // whether the eta,phi in each region are global or relative to the region center
0058     enum class TrackAssoMode { atVertex, atCalo, any = 999 } trackRegionMode_;
0059 
0060     // these are used to link items back
0061     std::unordered_map<const l1t::PFCluster *, l1t::PFClusterRef> clusterRefMap_;
0062     std::unordered_map<const l1t::PFTrack *, l1t::PFTrackRef> trackRefMap_;
0063   };
0064 
0065 }  // namespace l1tpf_impl
0066 #endif