CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HiSuperClusterProducer Class Reference

#include <HiSuperClusterProducer.h>

Inheritance diagram for HiSuperClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob ()
 
 HiSuperClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HiSuperClusterProducer ()
 
- 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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 Member Functions

bool counterExceeded () const
 
void getClusterPtrVector (edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, reco::CaloClusterPtrVector *)
 
void outputValidationInfo (reco::SuperClusterCollection &superclusterCollection)
 
void produceSuperclustersForECALPart (edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, std::string superclusterColection)
 

Private Attributes

float barrelBCEnergyThreshold_
 
float barrelEtaSearchRoad_
 
float barrelPhiSearchRoad_
 
std::string barrelSuperclusterCollection_
 
HiBremRecoveryClusterAlgobremAlgo_p
 
bool doBarrel_
 
bool doEndcaps_
 
edm::EDGetTokenT< reco::BasicClusterCollectionebClustersToken_
 
edm::EDGetTokenT< reco::BasicClusterCollectioneeClustersToken_
 
float endcapBCEnergyThreshold_
 
float endcapEtaSearchRoad_
 
float endcapPhiSearchRoad_
 
std::string endcapSuperclusterCollection_
 
int nEvt_
 
int nMaxPrintout_
 
int noSuperClusters
 
float seedTransverseEnergyThreshold_
 
double totalE
 
HiBremRecoveryClusterAlgo::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 20 of file HiSuperClusterProducer.h.

Constructor & Destructor Documentation

HiSuperClusterProducer::HiSuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 26 of file HiSuperClusterProducer.cc.

References barrelBCEnergyThreshold_, barrelEtaSearchRoad_, barrelPhiSearchRoad_, barrelSuperclusterCollection_, bremAlgo_p, gather_cfg::cout, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapBCEnergyThreshold_, endcapEtaSearchRoad_, endcapPhiSearchRoad_, endcapSuperclusterCollection_, edm::ParameterSet::getParameter(), nEvt_, noSuperClusters, HiBremRecoveryClusterAlgo::pDEBUG, HiBremRecoveryClusterAlgo::pERROR, HiBremRecoveryClusterAlgo::pINFO, HiBremRecoveryClusterAlgo::pWARNING, seedTransverseEnergyThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, totalE, and verbosity.

27 {
28  // The verbosity level
29  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
30  if (verbosityString == "DEBUG") verbosity = HiBremRecoveryClusterAlgo::pDEBUG;
31  else if (verbosityString == "WARNING") verbosity = HiBremRecoveryClusterAlgo::pWARNING;
32  else if (verbosityString == "INFO") verbosity = HiBremRecoveryClusterAlgo::pINFO;
34 
35 
36  endcapSuperclusterCollection_ = ps.getParameter<std::string>("endcapSuperclusterCollection");
37  barrelSuperclusterCollection_ = ps.getParameter<std::string>("barrelSuperclusterCollection");
38 
39  doBarrel_ = ps.getParameter<bool>("doBarrel");
40  doEndcaps_ = ps.getParameter<bool>("doEndcaps");
41 
42 
43  barrelEtaSearchRoad_ = ps.getParameter<double>("barrelEtaSearchRoad");
44  barrelPhiSearchRoad_ = ps.getParameter<double>("barrelPhiSearchRoad");
45  endcapEtaSearchRoad_ = ps.getParameter<double>("endcapEtaSearchRoad");
46  endcapPhiSearchRoad_ = ps.getParameter<double>("endcapPhiSearchRoad");
47  seedTransverseEnergyThreshold_ = ps.getParameter<double>("seedTransverseEnergyThreshold");
48  barrelBCEnergyThreshold_ = ps.getParameter<double>("barrelBCEnergyThreshold");
49  endcapBCEnergyThreshold_ = ps.getParameter<double>("endcapBCEnergyThreshold");
50 
51  if (verbosityString == "INFO") {
52  std::cout <<"Barrel BC Energy threshold = "<<barrelBCEnergyThreshold_<<std::endl;
53  std::cout <<"Endcap BC Energy threshold = "<<endcapBCEnergyThreshold_<<std::endl;
54  }
55 
56  bremAlgo_p = new HiBremRecoveryClusterAlgo(barrelEtaSearchRoad_, barrelPhiSearchRoad_,
57  endcapEtaSearchRoad_, endcapPhiSearchRoad_,
58  seedTransverseEnergyThreshold_,
59  barrelBCEnergyThreshold_,
60  endcapBCEnergyThreshold_,
61  verbosity);
62 
63  produces< reco::SuperClusterCollection >(endcapSuperclusterCollection_);
64  produces< reco::SuperClusterCollection >(barrelSuperclusterCollection_);
65 
66  eeClustersToken_ = consumes<reco::BasicClusterCollection>(edm::InputTag(ps.getParameter<std::string>("endcapClusterProducer"),
67  ps.getParameter<std::string>("endcapClusterCollection")));
68  ebClustersToken_ = consumes<reco::BasicClusterCollection>(edm::InputTag(ps.getParameter<std::string>("barrelClusterProducer"),
69  ps.getParameter<std::string>("barrelClusterCollection")));
70 
71  totalE = 0;
72  noSuperClusters = 0;
73  nEvt_ = 0;
74 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
HiBremRecoveryClusterAlgo::VerbosityLevel verbosity
HiBremRecoveryClusterAlgo * bremAlgo_p
HiSuperClusterProducer::~HiSuperClusterProducer ( )

Definition at line 77 of file HiSuperClusterProducer.cc.

References bremAlgo_p.

78 {
79  delete bremAlgo_p;
80 }
HiBremRecoveryClusterAlgo * bremAlgo_p

Member Function Documentation

bool HiSuperClusterProducer::counterExceeded ( ) const
inlineprivate
void HiSuperClusterProducer::endJob ( void  )
virtual

Definition at line 82 of file HiSuperClusterProducer.cc.

References noSuperClusters, harvestTrackValidationPlots::str, and totalE.

82  {
83  double averEnergy = 0.;
84  std::ostringstream str;
85  str << "HiSuperClusterProducer::endJob()\n"
86  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
87  << " total energy of all clusters: " << totalE << "\n";
88  if(noSuperClusters>0) {
89  averEnergy = totalE / noSuperClusters;
90  str << " average SuperCluster energy = " << averEnergy << "\n";
91  }
92  edm::LogInfo("HiSuperClusterProducerInfo") << str.str() << "\n";
93 
94 }
void HiSuperClusterProducer::getClusterPtrVector ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
reco::CaloClusterPtrVector clusterPtrVector_p 
)
private

Definition at line 135 of file HiSuperClusterProducer.cc.

References DEFINE_FWK_MODULE, edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), edm::Handle< T >::product(), and edm::PtrVector< T >::push_back().

Referenced by produceSuperclustersForECALPart().

136 {
138 
139  evt.getByToken(clustersToken, bccHandle);
140 
141  if (!(bccHandle.isValid()))
142  {
143  edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
144  clusterPtrVector_p = 0;
145  }
146 
147  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
148  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
149  {
150  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
151  }
152 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:140
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:81
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void HiSuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void HiSuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Definition at line 97 of file HiSuperClusterProducer.cc.

References barrelSuperclusterCollection_, doBarrel_, doEndcaps_, ebClustersToken_, eeClustersToken_, endcapSuperclusterCollection_, nEvt_, and produceSuperclustersForECALPart().

98 {
99  if(doEndcaps_)
101 
102  if(doBarrel_)
104 
105  nEvt_++;
106 }
edm::EDGetTokenT< reco::BasicClusterCollection > ebClustersToken_
edm::EDGetTokenT< reco::BasicClusterCollection > eeClustersToken_
void produceSuperclustersForECALPart(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, std::string superclusterColection)
void HiSuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
const edm::EDGetTokenT< reco::BasicClusterCollection > &  clustersToken,
std::string  superclusterColection 
)
private

Definition at line 109 of file HiSuperClusterProducer.cc.

References bremAlgo_p, getClusterPtrVector(), HiBremRecoveryClusterAlgo::makeSuperClusters(), eostools::move(), noSuperClusters, edm::Event::put(), and totalE.

Referenced by produce().

112 {
113  // get the cluster collection out and turn it to a BasicClusterRefVector:
114  reco::CaloClusterPtrVector *clusterPtrVector_p = new reco::CaloClusterPtrVector;
115  getClusterPtrVector(evt, clustersToken, clusterPtrVector_p);
116 
117  // run the brem recovery and get the SC collection
118  auto superclusters_ap = std::make_unique<reco::SuperClusterCollection>(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p));
119 
120  // count the total energy and the number of superclusters
121  reco::SuperClusterCollection::iterator it;
122  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
123  {
124  totalE += it->energy();
125  noSuperClusters++;
126  }
127 
128  // put the SC collection in the event
129  evt.put(std::move(superclusters_ap), superclusterCollection);
130 
131  delete clusterPtrVector_p;
132 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
void getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, reco::CaloClusterPtrVector *)
edm::PtrVector< CaloCluster > CaloClusterPtrVector
HiBremRecoveryClusterAlgo * bremAlgo_p
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

float HiSuperClusterProducer::barrelBCEnergyThreshold_
private

Definition at line 50 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 45 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 46 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::barrelSuperclusterCollection_
private

Definition at line 40 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

HiBremRecoveryClusterAlgo* HiSuperClusterProducer::bremAlgo_p
private
bool HiSuperClusterProducer::doBarrel_
private

Definition at line 53 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

bool HiSuperClusterProducer::doEndcaps_
private

Definition at line 54 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

edm::EDGetTokenT<reco::BasicClusterCollection> HiSuperClusterProducer::ebClustersToken_
private

Definition at line 43 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

edm::EDGetTokenT<reco::BasicClusterCollection> HiSuperClusterProducer::eeClustersToken_
private

Definition at line 42 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

float HiSuperClusterProducer::endcapBCEnergyThreshold_
private

Definition at line 51 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 47 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 48 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::endcapSuperclusterCollection_
private

Definition at line 39 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

int HiSuperClusterProducer::nEvt_
private

Definition at line 35 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

int HiSuperClusterProducer::nMaxPrintout_
private

Definition at line 34 of file HiSuperClusterProducer.h.

int HiSuperClusterProducer::noSuperClusters
private
float HiSuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 49 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

double HiSuperClusterProducer::totalE
private
HiBremRecoveryClusterAlgo::VerbosityLevel HiSuperClusterProducer::verbosity
private

Definition at line 37 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().