CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalClusterProducer Class Reference
Inheritance diagram for HGCalClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HGCalClusterProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HGCalClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::unique_ptr< HGCalImagingAlgoalgo
 
reco::CaloCluster::AlgoId algoId
 
std::string detector
 
bool doSharing
 
edm::EDGetTokenT< HGCRecHitCollectionhits_bh_token
 
edm::EDGetTokenT< HGCRecHitCollectionhits_ee_token
 
edm::EDGetTokenT< HGCRecHitCollectionhits_fh_token
 
std::unique_ptr< HGCal3DClusteringmulticluster_algo
 
HGCalImagingAlgo::VerbosityLevel verbosity
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file HGCalClusterProducer.cc.

Constructor & Destructor Documentation

HGCalClusterProducer::HGCalClusterProducer ( const edm::ParameterSet ps)

Definition at line 57 of file HGCalClusterProducer.cc.

References algo, algoId, edm::EDConsumerBase::consumesCollector(), hgcalLayerClusters_cfi::dEdXweights, hgcalLayerClusters_cfi::dependSensor, detector, doSharing, hgcalLayerClusters_cfi::ecut, hgcalLayerClusters_cfi::fcPerEle, hgcalLayerClusters_cfi::fcPerMip, edm::ParameterSet::getParameter(), reco::CaloCluster::hgcal_em, reco::CaloCluster::hgcal_had, reco::CaloCluster::hgcal_mixed, hits_bh_token, hits_ee_token, hits_fh_token, kappa, hgcalLayerClusters_cfi::minClusters, multicluster_algo, hgcalLayerClusters_cfi::noiseMip, hgcalLayerClusters_cfi::nonAgedNoises, particleFlowClusterECALUncorrected_cfi::showerSigma, hgcalLayerClusters_cfi::thicknessCorrection, and verbosity.

57  :
59  doSharing(ps.getParameter<bool>("doSharing")),
60  detector(ps.getParameter<std::string >("detector")), // one of EE, FH, BH or "all"
61  verbosity((HGCalImagingAlgo::VerbosityLevel)ps.getUntrackedParameter<unsigned int>("verbosity",3)){
62  double ecut = ps.getParameter<double>("ecut");
63  std::vector<double> vecDeltas = ps.getParameter<std::vector<double> >("deltac");
64  double kappa = ps.getParameter<double>("kappa");
65  std::vector<double> multicluster_radii = ps.getParameter<std::vector<double> >("multiclusterRadii");
66  double minClusters = ps.getParameter<unsigned>("minClusters");
67  std::vector<double> dEdXweights = ps.getParameter<std::vector<double> >("dEdXweights");
68  std::vector<double> thicknessCorrection = ps.getParameter<std::vector<double> >("thicknessCorrection");
69  std::vector<double> fcPerMip = ps.getParameter<std::vector<double> >("fcPerMip");
70  double fcPerEle = ps.getParameter<double>("fcPerEle");
71  std::vector<double> nonAgedNoises = ps.getParameter<std::vector<double> >("nonAgedNoises");
72  double noiseMip = ps.getParameter<double>("noiseMip");
73  bool dependSensor = ps.getParameter<bool>("dependSensor");
74 
75 
76  if(detector=="all") {
77  hits_ee_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEInput"));
78  hits_fh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCFHInput"));
79  hits_bh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCBHInput"));
81  }else if(detector=="EE") {
82  hits_ee_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEInput"));
84  }else if(detector=="FH") {
85  hits_fh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCFHInput"));
87  } else {
88  hits_bh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCBHInput"));
90  }
91 
92 
93  if(doSharing){
94  double showerSigma = ps.getParameter<double>("showerSigma");
95  algo = std::make_unique<HGCalImagingAlgo>(vecDeltas, kappa, ecut, showerSigma, algoId, dependSensor, dEdXweights, thicknessCorrection, fcPerMip, fcPerEle, nonAgedNoises, noiseMip, verbosity);
96  }else{
97  algo = std::make_unique<HGCalImagingAlgo>(vecDeltas, kappa, ecut, algoId, dependSensor, dEdXweights, thicknessCorrection, fcPerMip, fcPerEle, nonAgedNoises, noiseMip, verbosity);
98  }
99 
100  auto sumes = consumesCollector();
101 
102  multicluster_algo = std::make_unique<HGCal3DClustering>(ps, sumes, multicluster_radii, minClusters);
103 
104  produces<std::vector<reco::BasicCluster> >();
105  produces<std::vector<reco::BasicCluster> >("sharing");
106 
107  produces<std::vector<reco::HGCalMultiCluster> >();
108  produces<std::vector<reco::HGCalMultiCluster> >("sharing");
109 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< HGCalImagingAlgo > algo
HGCalImagingAlgo::VerbosityLevel verbosity
std::unique_ptr< HGCal3DClustering > multicluster_algo
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
reco::CaloCluster::AlgoId algoId
static const G4double kappa
HGCalClusterProducer::~HGCalClusterProducer ( )
inline

Definition at line 35 of file HGCalClusterProducer.cc.

References produce().

35 { }

Member Function Documentation

void HGCalClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Definition at line 111 of file HGCalClusterProducer.cc.

References algo, algoId, fastPrimaryVertexProducer_cfi::clusters, doSharing, edm::Event::getByToken(), reco::CaloCluster::hgcal_em, reco::CaloCluster::hgcal_had, reco::CaloCluster::hgcal_mixed, hits_bh_token, hits_ee_token, hits_fh_token, mps_fire::i, edm::HandleBase::isValid(), eostools::move(), multicluster_algo, cscdqm::h::names, cmsPerfSuiteHarvest::now, edm::PtrVector< T >::push_back(), edm::Event::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~HGCalClusterProducer().

112  {
113 
117 
118 
119  std::unique_ptr<std::vector<reco::BasicCluster> > clusters( new std::vector<reco::BasicCluster> ),
120  clusters_sharing( new std::vector<reco::BasicCluster> );
121 
122  algo->reset();
123 
124  algo->getEventSetup(es);
125 
126  multicluster_algo->getEvent(evt);
127  multicluster_algo->getEventSetup(es);
128 
129  switch(algoId){
131  evt.getByToken(hits_ee_token,ee_hits);
132  algo->populate(*ee_hits);
133  break;
135  evt.getByToken(hits_fh_token,fh_hits);
136  evt.getByToken(hits_bh_token,bh_hits);
137  if( fh_hits.isValid() ) {
138  algo->populate(*fh_hits);
139  } else if ( bh_hits.isValid() ) {
140  algo->populate(*bh_hits);
141  }
142  break;
144  evt.getByToken(hits_ee_token,ee_hits);
145  algo->populate(*ee_hits);
146  evt.getByToken(hits_fh_token,fh_hits);
147  algo->populate(*fh_hits);
148  evt.getByToken(hits_bh_token,bh_hits);
149  algo->populate(*bh_hits);
150  break;
151  default:
152  break;
153  }
154  algo->makeClusters();
155  *clusters = algo->getClusters(false);
156  if(doSharing)
157  *clusters_sharing = algo->getClusters(true);
158 
159  std::vector<std::string> names;
160  names.push_back(std::string("gen"));
161  names.push_back(std::string("calo_face"));
162 
163  auto clusterHandle = evt.put(std::move(clusters));
164  auto clusterHandleSharing = evt.put(std::move(clusters_sharing),"sharing");
165 
166  edm::PtrVector<reco::BasicCluster> clusterPtrs, clusterPtrsSharing;
167  for( unsigned i = 0; i < clusterHandle->size(); ++i ) {
168  edm::Ptr<reco::BasicCluster> ptr(clusterHandle,i);
169  clusterPtrs.push_back(ptr);
170  }
171 
172  if(doSharing){
173  for( unsigned i = 0; i < clusterHandleSharing->size(); ++i ) {
174  edm::Ptr<reco::BasicCluster> ptr(clusterHandleSharing,i);
175  clusterPtrsSharing.push_back(ptr);
176  }
177  }
178 
179  std::unique_ptr<std::vector<reco::HGCalMultiCluster> >
180  multiclusters( new std::vector<reco::HGCalMultiCluster> ),
181  multiclusters_sharing( new std::vector<reco::HGCalMultiCluster> );
182 
183  std::chrono::high_resolution_clock::time_point then = std::chrono::high_resolution_clock::now();
184  *multiclusters = multicluster_algo->makeClusters(clusterPtrs);
185  if(doSharing)
186  *multiclusters_sharing = multicluster_algo->makeClusters(clusterPtrsSharing);
187  evt.put(std::move(multiclusters));
188  if(doSharing)
189  evt.put(std::move(multiclusters_sharing),"sharing");
190  std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
191  std::chrono::duration<float> time_span = std::chrono::duration_cast<std::chrono::milliseconds>(now - then);
192  // delta += float (now.tv_usec - then.tv_usec)/1000.;
193  edm::LogInfo ("HGCalClusterProducer") << "Time taken by multiclustering " << time_span.count() << " ms";
194 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static const HistoName names[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
std::unique_ptr< HGCalImagingAlgo > algo
bool isValid() const
Definition: HandleBase.h:74
std::unique_ptr< HGCal3DClustering > multicluster_algo
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
reco::CaloCluster::AlgoId algoId
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::unique_ptr<HGCalImagingAlgo> HGCalClusterProducer::algo
private

Definition at line 47 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

reco::CaloCluster::AlgoId HGCalClusterProducer::algoId
private

Definition at line 45 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

std::string HGCalClusterProducer::detector
private

Definition at line 50 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer().

bool HGCalClusterProducer::doSharing
private

Definition at line 49 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

edm::EDGetTokenT<HGCRecHitCollection> HGCalClusterProducer::hits_bh_token
private

Definition at line 43 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

edm::EDGetTokenT<HGCRecHitCollection> HGCalClusterProducer::hits_ee_token
private

Definition at line 41 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

edm::EDGetTokenT<HGCRecHitCollection> HGCalClusterProducer::hits_fh_token
private

Definition at line 42 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

std::unique_ptr<HGCal3DClustering> HGCalClusterProducer::multicluster_algo
private

Definition at line 48 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer(), and produce().

HGCalImagingAlgo::VerbosityLevel HGCalClusterProducer::verbosity
private

Definition at line 52 of file HGCalClusterProducer.cc.

Referenced by HGCalClusterProducer().