CMS 3D CMS Logo

HGCalMultiClusterProducer.cc
Go to the documentation of this file.
1 #ifndef __RecoLocalCalo_HGCRecProducers_HGCalMultiClusterProducer_H__
2 #define __RecoLocalCalo_HGCRecProducers_HGCalMultiClusterProducer_H__
3 
4 // user include files
8 
19 
23 
27 
29 
31 public:
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35 
36  void produce(edm::Event&, const edm::EventSetup&) override;
37 
38 private:
44  std::unique_ptr<HGCal3DClustering> multicluster_algo;
45  bool doSharing;
47 };
48 
50 
52  : doSharing(ps.getParameter<bool>("doSharing")),
53  verbosity((HGCalClusteringAlgoBase::VerbosityLevel)ps.getUntrackedParameter<unsigned int>("verbosity", 3)) {
54  std::vector<double> multicluster_radii = ps.getParameter<std::vector<double>>("multiclusterRadii");
55  double minClusters = ps.getParameter<unsigned>("minClusters");
56  clusters_token = consumes<std::vector<reco::BasicCluster>>(ps.getParameter<edm::InputTag>("HGCLayerClusters"));
58  consumes<std::vector<reco::BasicCluster>>(ps.getParameter<edm::InputTag>("HGCLayerClustersSharing"));
59  hits_ee_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEInput"));
60  hits_fh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCFHInput"));
61  hits_bh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCBHInput"));
62  auto sumes = consumesCollector();
63 
64  multicluster_algo = std::make_unique<HGCal3DClustering>(ps, sumes, multicluster_radii, minClusters);
65 
66  produces<std::vector<reco::HGCalMultiCluster>>();
67  produces<std::vector<reco::HGCalMultiCluster>>("sharing");
68 }
69 
71  // hgcalMultiClusters
73  desc.add<edm::InputTag>("HGCLayerClusters", edm::InputTag("hgcalLayerClusters"));
74  desc.addUntracked<unsigned int>("verbosity", 3);
75  desc.add<bool>("doSharing", false);
76  desc.add<edm::InputTag>("HGCEEInput", edm::InputTag("HGCalRecHit", "HGCEERecHits"));
77  desc.add<edm::InputTag>("HGCFHInput", edm::InputTag("HGCalRecHit", "HGCHEFRecHits"));
78  desc.add<std::vector<double>>("multiclusterRadii",
79  {
80  2.0,
81  5.0,
82  5.0,
83  });
84  desc.add<edm::InputTag>("HGCBHInput", edm::InputTag("HGCalRecHit", "HGCHEBRecHits"));
85  desc.add<edm::InputTag>("HGCLayerClustersSharing", edm::InputTag("hgcalLayerClusters", "sharing"));
86  desc.add<unsigned int>("minClusters", 3);
87  descriptions.add("hgcalMultiClusters", desc);
88 }
89 
92  edm::Handle<std::vector<reco::BasicCluster>> clusterSharingHandle;
93 
94  evt.getByToken(clusters_token, clusterHandle);
95  if (doSharing)
96  evt.getByToken(clusters_sharing_token, clusterSharingHandle);
97 
98  edm::PtrVector<reco::BasicCluster> clusterPtrs, clusterPtrsSharing;
99  for (unsigned i = 0; i < clusterHandle->size(); ++i) {
100  edm::Ptr<reco::BasicCluster> ptr(clusterHandle, i);
101  clusterPtrs.push_back(ptr);
102  }
103 
104  if (doSharing) {
105  for (unsigned i = 0; i < clusterSharingHandle->size(); ++i) {
106  edm::Ptr<reco::BasicCluster> ptr(clusterSharingHandle, i);
107  clusterPtrsSharing.push_back(ptr);
108  }
109  }
110 
111  auto multiclusters = std::make_unique<std::vector<reco::HGCalMultiCluster>>();
112  auto multiclusters_sharing = std::make_unique<std::vector<reco::HGCalMultiCluster>>();
113 
114  multicluster_algo->getEvent(evt);
115  multicluster_algo->getEventSetup(es);
116 
117  *multiclusters = multicluster_algo->makeClusters(clusterPtrs);
118  if (doSharing)
119  *multiclusters_sharing = multicluster_algo->makeClusters(clusterPtrsSharing);
120  evt.put(std::move(multiclusters));
121  if (doSharing)
122  evt.put(std::move(multiclusters_sharing), "sharing");
123 }
124 
125 #endif
ConfigurationDescriptions.h
HIPAlignmentAlgorithm_cfi.verbosity
verbosity
Definition: HIPAlignmentAlgorithm_cfi.py:7
electrons_cff.bool
bool
Definition: electrons_cff.py:366
mps_fire.i
i
Definition: mps_fire.py:428
InitialClusteringStepBase.h
MessageLogger.h
HGCalMultiClusterProducer::hits_ee_token
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
Definition: HGCalMultiClusterProducer.cc:40
HGCalClusteringAlgoBase.h
SeedFinderBase.h
ESHandle.h
HGCalMultiClusterProducer::multicluster_algo
std::unique_ptr< HGCal3DClustering > multicluster_algo
Definition: HGCalMultiClusterProducer.cc:44
HGCalMultiClusterProducer::clusters_token
edm::EDGetTokenT< std::vector< reco::BasicCluster > > clusters_token
Definition: HGCalMultiClusterProducer.cc:42
edm::EDGetTokenT
Definition: EDGetToken.h:33
HLTEgPhaseIITestSequence_cff.doSharing
doSharing
Definition: HLTEgPhaseIITestSequence_cff.py:1317
HGCalDepthPreClusterer.h
beam_dqm_sourceclient-live_cfg.minClusters
minClusters
Definition: beam_dqm_sourceclient-live_cfg.py:352
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
HGCalMultiClusterProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HGCalMultiClusterProducer.cc:70
HGCal3DClustering.h
MakerMacros.h
PFClusterEnergyCorrectorBase.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::PtrVector
Definition: PtrVector.h:36
HGCalMultiClusterProducer
Definition: HGCalMultiClusterProducer.cc:30
PFClusterBuilderBase.h
PFCluster.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
ParameterSetDescription.h
PFCPositionCalculatorBase.h
HGCalMultiClusterProducer::doSharing
bool doSharing
Definition: HGCalMultiClusterProducer.cc:45
HGCalMultiClusterProducer::verbosity
HGCalClusteringAlgoBase::VerbosityLevel verbosity
Definition: HGCalMultiClusterProducer.cc:46
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
RecHitTopologicalCleanerBase.h
HGCalMultiClusterProducer::hits_fh_token
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
Definition: HGCalMultiClusterProducer.cc:39
HGCalGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HGCalMultiClusterProducer::HGCalMultiClusterProducer
HGCalMultiClusterProducer(const edm::ParameterSet &)
Definition: HGCalMultiClusterProducer.cc:51
createfilelist.int
int
Definition: createfilelist.py:10
HGCalMultiClusterProducer::hits_bh_token
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
Definition: HGCalMultiClusterProducer.cc:41
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
HGCalMultiClusterProducer::clusters_sharing_token
edm::EDGetTokenT< std::vector< reco::BasicCluster > > clusters_sharing_token
Definition: HGCalMultiClusterProducer.cc:43
edm::stream::EDProducer
Definition: EDProducer.h:38
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:58
edm::Ptr
Definition: AssociationVector.h:31
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalMultiClusterProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HGCalMultiClusterProducer.cc:90
Frameworkfwd.h
HLT_FULL_cff.VerbosityLevel
VerbosityLevel
Definition: HLT_FULL_cff.py:84494
HGCalMultiClusterProducer::~HGCalMultiClusterProducer
~HGCalMultiClusterProducer() override
Definition: HGCalMultiClusterProducer.cc:33
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Event
Definition: Event.h:73
HGCalClusteringAlgoBase::VerbosityLevel
VerbosityLevel
Definition: HGCalClusteringAlgoBase.h:49
HGCalClusteringAlgoBase
Definition: HGCalClusteringAlgoBase.h:47
edm::InputTag
Definition: InputTag.h:15