test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::BasicClusterCollection
ebClustersToken_
 
edm::EDGetTokenT
< reco::BasicClusterCollection
eeClustersToken_
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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(), HLT_25ns10e33_v2_cff::InputTag, 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
tuple cout
Definition: gather_cfg.py:145
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

Definition at line 70 of file HiSuperClusterProducer.h.

References nEvt_, and nMaxPrintout_.

void HiSuperClusterProducer::endJob ( void  )
virtual

Definition at line 82 of file HiSuperClusterProducer.cc.

References noSuperClusters, 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 136 of file HiSuperClusterProducer.cc.

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

Referenced by produceSuperclustersForECALPart().

137 {
139 
140  evt.getByToken(clustersToken, bccHandle);
141 
142  if (!(bccHandle.isValid()))
143  {
144  edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
145  clusterPtrVector_p = 0;
146  }
147 
148  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
149  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
150  {
151  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
152  }
153 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
bool isValid() const
Definition: HandleBase.h:75
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

Implements edm::stream::EDProducerBase.

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(), 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  std::auto_ptr<reco::SuperClusterCollection>
119  superclusters_ap(new reco::SuperClusterCollection(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p)));
120 
121  // count the total energy and the number of superclusters
122  reco::SuperClusterCollection::iterator it;
123  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
124  {
125  totalE += it->energy();
126  noSuperClusters++;
127  }
128 
129  // put the SC collection in the event
130  evt.put(superclusters_ap, superclusterCollection);
131 
132  delete clusterPtrVector_p;
133 }
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
void getClusterPtrVector(edm::Event &evt, const edm::EDGetTokenT< reco::BasicClusterCollection > &clustersToken, reco::CaloClusterPtrVector *)
edm::PtrVector< CaloCluster > CaloClusterPtrVector
HiBremRecoveryClusterAlgo * bremAlgo_p

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 counterExceeded(), HiSuperClusterProducer(), and produce().

int HiSuperClusterProducer::nMaxPrintout_
private

Definition at line 34 of file HiSuperClusterProducer.h.

Referenced by counterExceeded().

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().