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
SuperClusterProducer Class Reference

#include <SuperClusterProducer.h>

Inheritance diagram for SuperClusterProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 SuperClusterProducer (const edm::ParameterSet &ps)
 
 ~SuperClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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

std::string barrelClusterCollection_
 
std::string barrelClusterProducer_
 
float barrelEtaSearchRoad_
 
float barrelPhiSearchRoad_
 
std::string barrelSuperclusterCollection_
 
BremRecoveryClusterAlgobremAlgo_p
 
bool doBarrel_
 
bool doEndcaps_
 
std::string endcapClusterCollection_
 
std::string endcapClusterProducer_
 
float endcapEtaSearchRoad_
 
float endcapPhiSearchRoad_
 
std::string endcapSuperclusterCollection_
 
int nEvt_
 
int nMaxPrintout_
 
int noSuperClusters
 
float seedTransverseEnergyThreshold_
 
double totalE
 
BremRecoveryClusterAlgo::VerbosityLevel verbosity
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 20 of file SuperClusterProducer.h.

Constructor & Destructor Documentation

SuperClusterProducer::SuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 24 of file SuperClusterProducer.cc.

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

25 {
26  // The verbosity level
27  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
28  if (verbosityString == "DEBUG") verbosity = BremRecoveryClusterAlgo::pDEBUG;
29  else if (verbosityString == "WARNING") verbosity = BremRecoveryClusterAlgo::pWARNING;
30  else if (verbosityString == "INFO") verbosity = BremRecoveryClusterAlgo::pINFO;
32 
33  endcapClusterProducer_ = ps.getParameter<std::string>("endcapClusterProducer");
34  barrelClusterProducer_ = ps.getParameter<std::string>("barrelClusterProducer");
35 
36  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
37  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
38 
39  endcapSuperclusterCollection_ = ps.getParameter<std::string>("endcapSuperclusterCollection");
40  barrelSuperclusterCollection_ = ps.getParameter<std::string>("barrelSuperclusterCollection");
41 
42  doBarrel_ = ps.getParameter<bool>("doBarrel");
43  doEndcaps_ = ps.getParameter<bool>("doEndcaps");
44 
45 
46  barrelEtaSearchRoad_ = ps.getParameter<double>("barrelEtaSearchRoad");
47  barrelPhiSearchRoad_ = ps.getParameter<double>("barrelPhiSearchRoad");
48  endcapEtaSearchRoad_ = ps.getParameter<double>("endcapEtaSearchRoad");
49  endcapPhiSearchRoad_ = ps.getParameter<double>("endcapPhiSearchRoad");
50  seedTransverseEnergyThreshold_ = ps.getParameter<double>("seedTransverseEnergyThreshold");
51 
52  bremAlgo_p = new BremRecoveryClusterAlgo(barrelEtaSearchRoad_, barrelPhiSearchRoad_,
53  endcapEtaSearchRoad_, endcapPhiSearchRoad_,
54  seedTransverseEnergyThreshold_, verbosity);
55 
56  produces< reco::SuperClusterCollection >(endcapSuperclusterCollection_);
57  produces< reco::SuperClusterCollection >(barrelSuperclusterCollection_);
58 
59  totalE = 0;
60  noSuperClusters = 0;
61  nEvt_ = 0;
62 }
T getParameter(std::string const &) const
std::string barrelClusterProducer_
BremRecoveryClusterAlgo::VerbosityLevel verbosity
std::string barrelSuperclusterCollection_
BremRecoveryClusterAlgo * bremAlgo_p
std::string endcapClusterProducer_
std::string barrelClusterCollection_
std::string endcapClusterCollection_
std::string endcapSuperclusterCollection_
SuperClusterProducer::~SuperClusterProducer ( )

Definition at line 65 of file SuperClusterProducer.cc.

References bremAlgo_p.

66 {
67  delete bremAlgo_p;
68 }
BremRecoveryClusterAlgo * bremAlgo_p

Member Function Documentation

bool SuperClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 72 of file SuperClusterProducer.h.

References nEvt_, and nMaxPrintout_.

void SuperClusterProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 71 of file SuperClusterProducer.cc.

References noSuperClusters, and totalE.

71  {
72  double averEnergy = 0.;
73  std::ostringstream str;
74  str << "SuperClusterProducer::endJob()\n"
75  << " total # reconstructed super clusters: " << noSuperClusters << "\n"
76  << " total energy of all clusters: " << totalE << "\n";
77  if(noSuperClusters>0) {
78  averEnergy = totalE / noSuperClusters;
79  str << " average SuperCluster energy = " << averEnergy << "\n";
80  }
81  edm::LogInfo("SuperClusterProducerInfo") << str.str() << "\n";
82 
83 }
void SuperClusterProducer::getClusterPtrVector ( edm::Event evt,
std::string  clusterProducer_,
std::string  clusterCollection_,
reco::CaloClusterPtrVector clusterPtrVector_p 
)
private

Definition at line 126 of file SuperClusterProducer.cc.

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

Referenced by produceSuperclustersForECALPart().

127 {
129 
130  evt.getByLabel(clusterProducer_, clusterCollection_, bccHandle);
131  if (!(bccHandle.isValid()))
132  {
133  edm::LogError("SuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
134  edm::LogError("SuperClusterProducerError") << "Error! can't get the product " << clusterCollection_.c_str();
135  clusterPtrVector_p = 0;
136  }
137 
138  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
139  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
140  {
141  clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
142  }
143 }
int i
Definition: DBlmapReader.cc:9
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:135
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:74
void SuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection)
private
void SuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 86 of file SuperClusterProducer.cc.

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

87 {
88  if(doEndcaps_)
90 
91  if(doBarrel_)
93 
94  nEvt_++;
95 }
std::string barrelClusterProducer_
std::string barrelSuperclusterCollection_
void produceSuperclustersForECALPart(edm::Event &evt, std::string clusterProducer, std::string clusterCollection, std::string superclusterColection)
std::string endcapClusterProducer_
std::string barrelClusterCollection_
std::string endcapClusterCollection_
std::string endcapSuperclusterCollection_
void SuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
std::string  clusterProducer,
std::string  clusterCollection,
std::string  superclusterColection 
)
private

Definition at line 98 of file SuperClusterProducer.cc.

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

Referenced by produce().

102 {
103  // get the cluster collection out and turn it to a BasicClusterRefVector:
104  reco::CaloClusterPtrVector *clusterPtrVector_p = new reco::CaloClusterPtrVector;
105  getClusterPtrVector(evt, clusterProducer, clusterCollection, clusterPtrVector_p);
106 
107  // run the brem recovery and get the SC collection
108  std::auto_ptr<reco::SuperClusterCollection>
109  superclusters_ap(new reco::SuperClusterCollection(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p)));
110 
111  // count the total energy and the number of superclusters
112  reco::SuperClusterCollection::iterator it;
113  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
114  {
115  totalE += it->energy();
116  noSuperClusters++;
117  }
118 
119  // put the SC collection in the event
120  evt.put(superclusters_ap, superclusterCollection);
121 
122  delete clusterPtrVector_p;
123 }
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:84
BremRecoveryClusterAlgo * bremAlgo_p
edm::PtrVector< CaloCluster > CaloClusterPtrVector

Member Data Documentation

std::string SuperClusterProducer::barrelClusterCollection_
private

Definition at line 40 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

std::string SuperClusterProducer::barrelClusterProducer_
private

Definition at line 43 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

float SuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 48 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().

float SuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 49 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().

std::string SuperClusterProducer::barrelSuperclusterCollection_
private

Definition at line 46 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

BremRecoveryClusterAlgo* SuperClusterProducer::bremAlgo_p
private
bool SuperClusterProducer::doBarrel_
private

Definition at line 54 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

bool SuperClusterProducer::doEndcaps_
private

Definition at line 55 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

std::string SuperClusterProducer::endcapClusterCollection_
private

Definition at line 39 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

std::string SuperClusterProducer::endcapClusterProducer_
private

Definition at line 42 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

float SuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 50 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().

float SuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 51 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().

std::string SuperClusterProducer::endcapSuperclusterCollection_
private

Definition at line 45 of file SuperClusterProducer.h.

Referenced by produce(), and SuperClusterProducer().

int SuperClusterProducer::nEvt_
private

Definition at line 35 of file SuperClusterProducer.h.

Referenced by counterExceeded(), produce(), and SuperClusterProducer().

int SuperClusterProducer::nMaxPrintout_
private

Definition at line 34 of file SuperClusterProducer.h.

Referenced by counterExceeded().

int SuperClusterProducer::noSuperClusters
private
float SuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 52 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().

double SuperClusterProducer::totalE
private
BremRecoveryClusterAlgo::VerbosityLevel SuperClusterProducer::verbosity
private

Definition at line 37 of file SuperClusterProducer.h.

Referenced by SuperClusterProducer().