Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-18 09:15:18

0001 #ifndef RecoParticleFlow_PFClusterProducer_HGCRecHitNavigator_h
0002 #define RecoParticleFlow_PFClusterProducer_HGCRecHitNavigator_h
0003 
0004 #include "RecoParticleFlow/PFClusterProducer/interface/PFRecHitNavigatorBase.h"
0005 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
0006 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0007 
0008 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0010 #include "FWCore/Framework/interface/ConsumesCollector.h"
0011 
0012 template <ForwardSubdetector D1,
0013           typename hgcee,
0014           ForwardSubdetector D2,
0015           typename hgchef,
0016           ForwardSubdetector D3,
0017           typename hgcheb>
0018 class HGCRecHitNavigator : public PFRecHitNavigatorBase {
0019 public:
0020   HGCRecHitNavigator() = default;
0021 
0022   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0023     edm::ParameterSetDescription desc;
0024 
0025     desc.add<std::string>("name", "PFRecHitHGCNavigator");
0026 
0027     edm::ParameterSetDescription descee;
0028     descee.add<std::string>("name", "PFRecHitHGCEENavigator");
0029     descee.add<std::string>("topologySource", "HGCalEESensitive");
0030     desc.add<edm::ParameterSetDescription>("hgcee", descee);
0031 
0032     edm::ParameterSetDescription deschef;
0033     deschef.add<std::string>("name", "PFRecHitHGCHENavigator");
0034     deschef.add<std::string>("topologySource", "HGCalHESiliconSensitive");
0035     desc.add<edm::ParameterSetDescription>("hgchef", deschef);
0036 
0037     edm::ParameterSetDescription descheb;
0038     descheb.add<std::string>("name", "PFRecHitHGCHENavigator");
0039     descheb.add<std::string>("topologySource", "HGCalHEScintillatorSensitive");
0040     desc.add<edm::ParameterSetDescription>("hgcheb", descheb);
0041 
0042     descriptions.add("navigator", desc);
0043   }
0044 
0045   HGCRecHitNavigator(const edm::ParameterSet& iConfig, edm::ConsumesCollector& cc) {
0046     if (iConfig.exists("hgcee")) {
0047       eeNav_ = new hgcee(iConfig.getParameter<edm::ParameterSet>("hgcee"), cc);
0048     } else {
0049       eeNav_ = nullptr;
0050     }
0051     if (iConfig.exists("hgchef")) {
0052       hefNav_ = new hgchef(iConfig.getParameter<edm::ParameterSet>("hgchef"), cc);
0053     } else {
0054       hefNav_ = nullptr;
0055     }
0056     if (iConfig.exists("hgcheb")) {
0057       hebNav_ = new hgcheb(iConfig.getParameter<edm::ParameterSet>("hgcheb"), cc);
0058     } else {
0059       hebNav_ = nullptr;
0060     }
0061   }
0062 
0063   void init(const edm::EventSetup& iSetup) override {
0064     if (nullptr != eeNav_)
0065       eeNav_->init(iSetup);
0066     if (nullptr != hefNav_)
0067       hefNav_->init(iSetup);
0068     if (nullptr != hebNav_)
0069       hebNav_->init(iSetup);
0070   }
0071 
0072   void associateNeighbours(reco::PFRecHit& hit,
0073                            std::unique_ptr<reco::PFRecHitCollection>& hits,
0074                            edm::RefProd<reco::PFRecHitCollection>& refProd) override {
0075     switch (DetId(hit.detId()).subdetId()) {
0076       case D1:
0077         if (nullptr != eeNav_)
0078           eeNav_->associateNeighbours(hit, hits, refProd);
0079         break;
0080       case D2:
0081         if (nullptr != hefNav_)
0082           hefNav_->associateNeighbours(hit, hits, refProd);
0083         break;
0084       case D3:
0085         if (nullptr != hebNav_)
0086           hebNav_->associateNeighbours(hit, hits, refProd);
0087         break;
0088       default:
0089         break;
0090     }
0091   }
0092 
0093 protected:
0094   hgcee* eeNav_;
0095   hgchef* hefNav_;
0096   hgcheb* hebNav_;
0097 };
0098 
0099 #endif