CMS 3D CMS Logo

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

Public Member Functions

 HGCalClusterTestProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HGCalClusterTestProducer ()
 
- 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 & itemsToGetFromEvent () 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< HGCalDepthPreClusterermulticluster_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 29 of file HGCalClusterTestProducer.cc.

Constructor & Destructor Documentation

HGCalClusterTestProducer::HGCalClusterTestProducer ( const edm::ParameterSet ps)

Definition at line 55 of file HGCalClusterTestProducer.cc.

References algo, algoId, edm::EDConsumerBase::consumesCollector(), detector, doSharing, hgcalLayerClusters_cfi::ecut, 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, particleFlowClusterECALUncorrected_cfi::showerSigma, and verbosity.

55  :
57  doSharing(ps.getParameter<bool>("doSharing")),
58  detector(ps.getParameter<std::string >("detector")), //one of EE, EF or "both"
59  verbosity((HGCalImagingAlgo::VerbosityLevel)ps.getUntrackedParameter<unsigned int>("verbosity",3)){
60  double ecut = ps.getParameter<double>("ecut");
61  double delta_c = ps.getParameter<double>("deltac");
62  double kappa = ps.getParameter<double>("kappa");
63  double multicluster_radius = ps.getParameter<double>("multiclusterRadius");
64  double minClusters = ps.getParameter<unsigned>("minClusters");
65 
66 
67  if(detector=="all") {
68  hits_ee_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEInput"));
69  hits_fh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCFHInput"));
70  hits_bh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCBHInput"));
72  }else if(detector=="EE") {
73  hits_ee_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCEEInput"));
75  }else if(detector=="FH") {
76  hits_fh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCFHInput"));
78  } else {
79  hits_bh_token = consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("HGCBHInput"));
81  }
82 
83 
84  if(doSharing){
85  double showerSigma = ps.getParameter<double>("showerSigma");
86  algo = std::make_unique<HGCalImagingAlgo>(delta_c, kappa, ecut, showerSigma, algoId, verbosity);
87  }else{
88  algo = std::make_unique<HGCalImagingAlgo>(delta_c, kappa, ecut, algoId, verbosity);
89  }
90 
91  auto sumes = consumesCollector();
92 
93  multicluster_algo = std::make_unique<HGCalDepthPreClusterer>(ps, sumes, multicluster_radius, minClusters);
94 
95  // hydraTokens[0] = consumes<std::vector<reco::PFCluster> >( edm::InputTag("FakeClusterGen") );
96  // hydraTokens[1] = consumes<std::vector<reco::PFCluster> >( edm::InputTag("FakeClusterCaloFace") );
97 
98  //std::cout << "Constructing HGCalClusterTestProducer" << std::endl;
99 
100  produces<std::vector<reco::BasicCluster> >();
101  produces<std::vector<reco::BasicCluster> >("sharing");
102 
103  produces<std::vector<reco::HGCalMultiCluster> >();
104  produces<std::vector<reco::HGCalMultiCluster> >("sharing");
105 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
reco::CaloCluster::AlgoId algoId
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
std::unique_ptr< HGCalImagingAlgo > algo
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
HGCalImagingAlgo::VerbosityLevel verbosity
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
static const G4double kappa
std::unique_ptr< HGCalDepthPreClusterer > multicluster_algo
HGCalClusterTestProducer::~HGCalClusterTestProducer ( )
inline

Definition at line 32 of file HGCalClusterTestProducer.cc.

References produce().

32 { }

Member Function Documentation

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

Definition at line 107 of file HGCalClusterTestProducer.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, edm::PtrVector< T >::push_back(), edm::Event::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~HGCalClusterTestProducer().

108  {
109 
113 
114 
115  std::unique_ptr<std::vector<reco::BasicCluster> > clusters( new std::vector<reco::BasicCluster> ),
116  clusters_sharing( new std::vector<reco::BasicCluster> );
117 
118  algo->reset();
119 
120  algo->getEventSetup(es);
121 
122  multicluster_algo->getEvent(evt);
123  multicluster_algo->getEventSetup(es);
124 
125  switch(algoId){
127  evt.getByToken(hits_ee_token,ee_hits);
128  algo->makeClusters(*ee_hits);
129  break;
131  evt.getByToken(hits_fh_token,fh_hits);
132  evt.getByToken(hits_bh_token,bh_hits);
133  if( fh_hits.isValid() ) {
134  algo->makeClusters(*fh_hits);
135  } else if ( bh_hits.isValid() ) {
136  algo->makeClusters(*bh_hits);
137  }
138  break;
140  evt.getByToken(hits_ee_token,ee_hits);
141  algo->makeClusters(*ee_hits);
142  evt.getByToken(hits_fh_token,fh_hits);
143  algo->makeClusters(*fh_hits);
144  evt.getByToken(hits_bh_token,bh_hits);
145  algo->makeClusters(*bh_hits);
146  break;
147  default:
148  break;
149  }
150  *clusters = algo->getClusters(false);
151  if(doSharing)
152  *clusters_sharing = algo->getClusters(true);
153 
154  //std::cout << "Density based cluster size: " << clusters->size() << std::endl;
155  //if(doSharing)
156  //std::cout << "Sharing clusters size : " << clusters_sharing->size() << std::endl;
157 
158  // edm::Handle<std::vector<reco::PFCluster> > hydra[2];
159  std::vector<std::string> names;
160  names.push_back(std::string("gen"));
161  names.push_back(std::string("calo_face"));
162  // for( unsigned i = 0 ; i < 2; ++i ) {
163  // evt.getByToken(hydraTokens[i],hydra[i]);
164  // std::cout << "hydra " << names[i] << " size : " << hydra[i]->size() << std::endl;
165  // }
166 
167 
168 
169  auto clusterHandle = evt.put(std::move(clusters));
170  auto clusterHandleSharing = evt.put(std::move(clusters_sharing),"sharing");
171 
172  edm::PtrVector<reco::BasicCluster> clusterPtrs, clusterPtrsSharing;
173  for( unsigned i = 0; i < clusterHandle->size(); ++i ) {
174  edm::Ptr<reco::BasicCluster> ptr(clusterHandle,i);
175  clusterPtrs.push_back(ptr);
176  }
177 
178  for( unsigned i = 0; i < clusterHandleSharing->size(); ++i ) {
179  edm::Ptr<reco::BasicCluster> ptr(clusterHandleSharing,i);
180  clusterPtrsSharing.push_back(ptr);
181  }
182 
183  std::unique_ptr<std::vector<reco::HGCalMultiCluster> >
184  multiclusters( new std::vector<reco::HGCalMultiCluster> ),
185  multiclusters_sharing( new std::vector<reco::HGCalMultiCluster> );
186 
187  *multiclusters = std::move(multicluster_algo->makePreClusters(clusterPtrs));
188  *multiclusters_sharing = std::move(multicluster_algo->makePreClusters(clusterPtrsSharing));
189 
190  evt.put(std::move(multiclusters));
191  evt.put(std::move(multiclusters_sharing),"sharing");
192 
193 }
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:457
reco::CaloCluster::AlgoId algoId
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
std::unique_ptr< HGCalImagingAlgo > algo
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
std::unique_ptr< HGCalDepthPreClusterer > multicluster_algo
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 44 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

reco::CaloCluster::AlgoId HGCalClusterTestProducer::algoId
private

Definition at line 42 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

std::string HGCalClusterTestProducer::detector
private

Definition at line 47 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer().

bool HGCalClusterTestProducer::doSharing
private

Definition at line 46 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

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

Definition at line 40 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

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

Definition at line 38 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

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

Definition at line 39 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

std::unique_ptr<HGCalDepthPreClusterer> HGCalClusterTestProducer::multicluster_algo
private

Definition at line 45 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer(), and produce().

HGCalImagingAlgo::VerbosityLevel HGCalClusterTestProducer::verbosity
private

Definition at line 49 of file HGCalClusterTestProducer.cc.

Referenced by HGCalClusterTestProducer().