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

#include <Multi5x5SuperClusterProducer.h>

Inheritance diagram for Multi5x5SuperClusterProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob ()
 
 Multi5x5SuperClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~Multi5x5SuperClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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

std::string barrelClusterCollection_
 
std::string barrelClusterProducer_
 
float barrelEtaSearchRoad_
 
float barrelPhiSearchRoad_
 
std::string barrelSuperclusterCollection_
 
Multi5x5BremRecoveryClusterAlgobremAlgo_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
 

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)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 18 of file Multi5x5SuperClusterProducer.h.

Constructor & Destructor Documentation

Multi5x5SuperClusterProducer::Multi5x5SuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 24 of file Multi5x5SuperClusterProducer.cc.

References barrelClusterCollection_, barrelClusterProducer_, barrelEtaSearchRoad_, barrelPhiSearchRoad_, barrelSuperclusterCollection_, bremAlgo_p, doBarrel_, doEndcaps_, endcapClusterCollection_, endcapClusterProducer_, endcapEtaSearchRoad_, endcapPhiSearchRoad_, endcapSuperclusterCollection_, edm::ParameterSet::getParameter(), nEvt_, noSuperClusters, seedTransverseEnergyThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, and totalE.

25 {
26 
27  endcapClusterProducer_ = ps.getParameter<std::string>("endcapClusterProducer");
28  barrelClusterProducer_ = ps.getParameter<std::string>("barrelClusterProducer");
29 
30  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
31  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
32 
33  endcapSuperclusterCollection_ = ps.getParameter<std::string>("endcapSuperclusterCollection");
34  barrelSuperclusterCollection_ = ps.getParameter<std::string>("barrelSuperclusterCollection");
35 
36  doBarrel_ = ps.getParameter<bool>("doBarrel");
37  doEndcaps_ = ps.getParameter<bool>("doEndcaps");
38 
39  barrelEtaSearchRoad_ = ps.getParameter<double>("barrelEtaSearchRoad");
40  barrelPhiSearchRoad_ = ps.getParameter<double>("barrelPhiSearchRoad");
41  endcapEtaSearchRoad_ = ps.getParameter<double>("endcapEtaSearchRoad");
42  endcapPhiSearchRoad_ = ps.getParameter<double>("endcapPhiSearchRoad");
43  seedTransverseEnergyThreshold_ = ps.getParameter<double>("seedTransverseEnergyThreshold");
44 
45  const edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
46  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
47 
48  bremAlgo_p = new Multi5x5BremRecoveryClusterAlgo(bremRecoveryPset, barrelEtaSearchRoad_, barrelPhiSearchRoad_,
49  endcapEtaSearchRoad_, endcapPhiSearchRoad_,
50  dynamicPhiRoad, seedTransverseEnergyThreshold_);
51 
52  produces< reco::SuperClusterCollection >(endcapSuperclusterCollection_);
53  produces< reco::SuperClusterCollection >(barrelSuperclusterCollection_);
54 
55  totalE = 0;
56  noSuperClusters = 0;
57  nEvt_ = 0;
58 }
T getParameter(std::string const &) const
Multi5x5BremRecoveryClusterAlgo * bremAlgo_p
Multi5x5SuperClusterProducer::~Multi5x5SuperClusterProducer ( )

Definition at line 61 of file Multi5x5SuperClusterProducer.cc.

References bremAlgo_p.

62 {
63  delete bremAlgo_p;
64 }
Multi5x5BremRecoveryClusterAlgo * bremAlgo_p

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 67 of file Multi5x5SuperClusterProducer.cc.

References noSuperClusters, and totalE.

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

Definition at line 122 of file Multi5x5SuperClusterProducer.cc.

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

Referenced by produceSuperclustersForECALPart().

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

Implements edm::EDProducer.

Definition at line 82 of file Multi5x5SuperClusterProducer.cc.

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

83 {
84  if(doEndcaps_)
86 
87  if(doBarrel_)
89 
90  nEvt_++;
91 }
void produceSuperclustersForECALPart(edm::Event &evt, std::string clusterProducer, std::string clusterCollection, std::string superclusterColection)
void Multi5x5SuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
std::string  clusterProducer,
std::string  clusterCollection,
std::string  superclusterColection 
)
private

Definition at line 94 of file Multi5x5SuperClusterProducer.cc.

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

Referenced by produce().

98 {
99  // get the cluster collection out and turn it to a BasicClusterRefVector:
100  reco::CaloClusterPtrVector *clusterPtrVector_p = new reco::CaloClusterPtrVector;
101  getClusterPtrVector(evt, clusterProducer, clusterCollection, clusterPtrVector_p);
102 
103  // run the brem recovery and get the SC collection
104  std::auto_ptr<reco::SuperClusterCollection>
105  superclusters_ap(new reco::SuperClusterCollection(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p)));
106 
107  // count the total energy and the number of superclusters
108  reco::SuperClusterCollection::iterator it;
109  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
110  {
111  totalE += it->energy();
112  noSuperClusters++;
113  }
114 
115  // put the SC collection in the event
116  evt.put(superclusters_ap, superclusterCollection);
117 
118  delete clusterPtrVector_p;
119 }
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
Multi5x5BremRecoveryClusterAlgo * bremAlgo_p
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
edm::PtrVector< CaloCluster > CaloClusterPtrVector
void getClusterPtrVector(edm::Event &evt, std::string clusterProducer_, std::string clusterCollection_, reco::CaloClusterPtrVector *)

Member Data Documentation

std::string Multi5x5SuperClusterProducer::barrelClusterCollection_
private

Definition at line 36 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

std::string Multi5x5SuperClusterProducer::barrelClusterProducer_
private

Definition at line 39 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

float Multi5x5SuperClusterProducer::barrelEtaSearchRoad_
private

Definition at line 44 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

float Multi5x5SuperClusterProducer::barrelPhiSearchRoad_
private

Definition at line 45 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

std::string Multi5x5SuperClusterProducer::barrelSuperclusterCollection_
private

Definition at line 42 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

Multi5x5BremRecoveryClusterAlgo* Multi5x5SuperClusterProducer::bremAlgo_p
private
bool Multi5x5SuperClusterProducer::doBarrel_
private

Definition at line 50 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

bool Multi5x5SuperClusterProducer::doEndcaps_
private

Definition at line 51 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

std::string Multi5x5SuperClusterProducer::endcapClusterCollection_
private

Definition at line 35 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

std::string Multi5x5SuperClusterProducer::endcapClusterProducer_
private

Definition at line 38 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

float Multi5x5SuperClusterProducer::endcapEtaSearchRoad_
private

Definition at line 46 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

float Multi5x5SuperClusterProducer::endcapPhiSearchRoad_
private

Definition at line 47 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

std::string Multi5x5SuperClusterProducer::endcapSuperclusterCollection_
private

Definition at line 41 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer(), and produce().

int Multi5x5SuperClusterProducer::nEvt_
private
int Multi5x5SuperClusterProducer::nMaxPrintout_
private

Definition at line 32 of file Multi5x5SuperClusterProducer.h.

Referenced by counterExceeded().

int Multi5x5SuperClusterProducer::noSuperClusters
private
float Multi5x5SuperClusterProducer::seedTransverseEnergyThreshold_
private

Definition at line 48 of file Multi5x5SuperClusterProducer.h.

Referenced by Multi5x5SuperClusterProducer().

double Multi5x5SuperClusterProducer::totalE
private