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::EDProducer 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 &)
 
 ~HiSuperClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
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, std::string clusterProducer_, std::string clusterCollection_, reco::CaloClusterPtrVector *)
 
void outputValidationInfo (reco::SuperClusterCollection &superclusterCollection)
 
void produceSuperclustersForECALPart (edm::Event &evt, std::string clusterProducer, std::string clusterCollection, std::string superclusterColection)
 

Private Attributes

float barrelBCEnergyThreshold_
 
std::string barrelClusterCollection_
 
std::string barrelClusterProducer_
 
float barrelEtaSearchRoad_
 
float barrelPhiSearchRoad_
 
std::string barrelSuperclusterCollection_
 
HiBremRecoveryClusterAlgobremAlgo_p
 
bool doBarrel_
 
bool doEndcaps_
 
float endcapBCEnergyThreshold_
 
std::string endcapClusterCollection_
 
std::string endcapClusterProducer_
 
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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 27 of file HiSuperClusterProducer.cc.

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

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

Definition at line 78 of file HiSuperClusterProducer.cc.

References bremAlgo_p.

79 {
80  delete bremAlgo_p;
81 }
HiBremRecoveryClusterAlgo * bremAlgo_p

Member Function Documentation

bool HiSuperClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 74 of file HiSuperClusterProducer.h.

References nEvt_, and nMaxPrintout_.

void HiSuperClusterProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 83 of file HiSuperClusterProducer.cc.

References noSuperClusters, and totalE.

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

Definition at line 138 of file HiSuperClusterProducer.cc.

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

Referenced by produceSuperclustersForECALPart().

139 {
141 
142  evt.getByLabel(clusterProducer_, clusterCollection_, bccHandle);
143  if (!(bccHandle.isValid()))
144  {
145  edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
146  edm::LogError("HiSuperClusterProducerError") << "Error! can't get the product " << clusterCollection_.c_str();
147  clusterPtrVector_p = 0;
148  }
149 
150  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
151  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
152  {
153  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
154  }
155 }
int i
Definition: DBlmapReader.cc:9
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:138
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:81
void HiSuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void HiSuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 98 of file HiSuperClusterProducer.cc.

References barrelClusterCollection_, barrelClusterProducer_, barrelSuperclusterCollection_, doBarrel_, doEndcaps_, endcapClusterCollection_, endcapClusterProducer_, endcapSuperclusterCollection_, nEvt_, and produceSuperclustersForECALPart().

99 {
100  if(doEndcaps_)
102 
103  if(doBarrel_)
105 
106  nEvt_++;
107 }
void produceSuperclustersForECALPart(edm::Event &evt, std::string clusterProducer, std::string clusterCollection, std::string superclusterColection)
void HiSuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
std::string  clusterProducer,
std::string  clusterCollection,
std::string  superclusterColection 
)
private

Definition at line 110 of file HiSuperClusterProducer.cc.

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

Referenced by produce().

114 {
115  // get the cluster collection out and turn it to a BasicClusterRefVector:
116  reco::CaloClusterPtrVector *clusterPtrVector_p = new reco::CaloClusterPtrVector;
117  getClusterPtrVector(evt, clusterProducer, clusterCollection, clusterPtrVector_p);
118 
119  // run the brem recovery and get the SC collection
120  std::auto_ptr<reco::SuperClusterCollection>
121  superclusters_ap(new reco::SuperClusterCollection(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p)));
122 
123  // count the total energy and the number of superclusters
124  reco::SuperClusterCollection::iterator it;
125  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
126  {
127  totalE += it->energy();
128  noSuperClusters++;
129  }
130 
131  // put the SC collection in the event
132  evt.put(superclusters_ap, superclusterCollection);
133 
134  delete clusterPtrVector_p;
135 }
void getClusterPtrVector(edm::Event &evt, std::string clusterProducer_, std::string clusterCollection_, reco::CaloClusterPtrVector *)
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:116
edm::PtrVector< CaloCluster > CaloClusterPtrVector
HiBremRecoveryClusterAlgo * bremAlgo_p

Member Data Documentation

float HiSuperClusterProducer::barrelBCEnergyThreshold_
private

Definition at line 53 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::barrelClusterCollection_
private

Definition at line 40 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

std::string HiSuperClusterProducer::barrelClusterProducer_
private

Definition at line 43 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

float HiSuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 48 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 49 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::barrelSuperclusterCollection_
private

Definition at line 46 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

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

Definition at line 56 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

bool HiSuperClusterProducer::doEndcaps_
private

Definition at line 57 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

float HiSuperClusterProducer::endcapBCEnergyThreshold_
private

Definition at line 54 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::endcapClusterCollection_
private

Definition at line 39 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

std::string HiSuperClusterProducer::endcapClusterProducer_
private

Definition at line 42 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

float HiSuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 50 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

float HiSuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 51 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

std::string HiSuperClusterProducer::endcapSuperclusterCollection_
private

Definition at line 45 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 52 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().