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 Attributes
HybridClusterProducer Class Reference

#include <HybridClusterProducer.h>

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

Public Member Functions

 HybridClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HybridClusterProducer ()
 
- 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 Attributes

std::string basicclusterCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
hitsToken_
 
HybridClusterAlgohybrid_p
 
int nEvt_
 
PositionCalc posCalculator_
 
std::string superclusterCollection_
 

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 19 of file HybridClusterProducer.h.

Constructor & Destructor Documentation

HybridClusterProducer::HybridClusterProducer ( const edm::ParameterSet ps)

Definition at line 39 of file HybridClusterProducer.cc.

References basicclusterCollection_, edm::ParameterSet::getParameter(), hitsToken_, hybrid_p, nEvt_, HLT_25ns10e33_v2_cff::posCalcParameters, posCalculator_, AlCaHLTBitMon_QueryRunRegistry::string, and superclusterCollection_.

40 {
41 
42 
43  basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection");
44  superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection");
45  hitsToken_ =
46  consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("recHitsCollection"));
47 
48  //Setup for core tools objects.
50  ps.getParameter<edm::ParameterSet>("posCalcParameters");
51 
52  posCalculator_ = PositionCalc(posCalcParameters);
53 
54  const std::vector<std::string> flagnames =
55  ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
56 
57  const std::vector<int> flagsexcl=
58  StringToEnumValue<EcalRecHit::Flags>(flagnames);
59 
60  const std::vector<std::string> severitynames =
61  ps.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcluded");
62 
63  const std::vector<int> severitiesexcl=
64  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynames);
65 
66  hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"),
67  ps.getParameter<int>("step"),
68  ps.getParameter<double>("ethresh"),
69  ps.getParameter<double>("eseed"),
70  ps.getParameter<double>("xi"),
71  ps.getParameter<bool>("useEtForXi"),
72  ps.getParameter<double>("ewing"),
73  flagsexcl,
74  posCalculator_,
75  ps.getParameter<bool>("dynamicEThresh"),
76  ps.getParameter<double>("eThreshA"),
77  ps.getParameter<double>("eThreshB"),
78  severitiesexcl,
79  ps.getParameter<bool>("excludeFlagged")
80  );
81  //bremRecoveryPset,
82 
83  // get brem recovery parameters
84  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
85  if (dynamicPhiRoad) {
86  edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
87  hybrid_p->setDynamicPhiRoad(bremRecoveryPset);
88  }
89 
90  produces< reco::BasicClusterCollection >(basicclusterCollection_);
91  produces< reco::SuperClusterCollection >(superclusterCollection_);
92  nEvt_ = 0;
93 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > hitsToken_
void setDynamicPhiRoad(const edm::ParameterSet &bremRecoveryPset)
HybridClusterAlgo * hybrid_p
HybridClusterProducer::~HybridClusterProducer ( )

Definition at line 96 of file HybridClusterProducer.cc.

References hybrid_p.

97 {
98  delete hybrid_p;
99 }
HybridClusterAlgo * hybrid_p

Member Function Documentation

void HybridClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 102 of file HybridClusterProducer.cc.

References basicclusterCollection_, DetId::Ecal, EcalBarrel, geometry, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getSubdetectorGeometry(), hitsToken_, hybrid_p, i, edm::OrphanHandleBase::isValid(), edm::HandleBase::isValid(), LogTrace, HybridClusterAlgo::makeClusters(), HybridClusterAlgo::makeSuperClusters(), nEvt_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), superclusterCollection_, and ecaldqm::topology().

103 {
104  // get the hit collection from the event:
106 
107  evt.getByToken(hitsToken_, rhcHandle);
108  if (!(rhcHandle.isValid())){
109  edm::LogError("MissingProduct") << "could not get a handle on the EcalRecHitCollection!";
110  return;
111 
112  }
113  const EcalRecHitCollection *hit_collection = rhcHandle.product();
114 
115  // get the collection geometry:
116  edm::ESHandle<CaloGeometry> geoHandle;
117  es.get<CaloGeometryRecord>().get(geoHandle);
118  const CaloGeometry& geometry = *geoHandle;
119  const CaloSubdetectorGeometry *geometry_p;
120  std::auto_ptr<const CaloSubdetectorTopology> topology;
121 
123  es.get<EcalSeverityLevelAlgoRcd>().get(sevLv);
124 
125  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
126  topology.reset(new EcalBarrelTopology(geoHandle));
127 
128  // make the Basic clusters!
129  reco::BasicClusterCollection basicClusters;
130  hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, sevLv.product(),false,
131  std::vector<EcalEtaPhiRegion>());
132 
133  LogTrace("EcalClusters") << "Finished clustering - BasicClusterCollection returned to producer..." ;
134 
135  // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event:
136  std::auto_ptr< reco::BasicClusterCollection > basicclusters_p(new reco::BasicClusterCollection);
137  basicclusters_p->assign(basicClusters.begin(), basicClusters.end());
139 
140  //Basic clusters now in the event.
141  LogTrace("EcalClusters") << "Basic Clusters now put into event." ;
142 
143 
144  //Weird though it is, get the BasicClusters back out of the event. We need the
145  //edm::Ref to these guys to make our superclusters for Hybrid.
146 
147  if (!(bccHandle.isValid())) {
148  edm::LogError("Missing Product") << "could not get a handle on the BasicClusterCollection!" ;
149  return;
150  }
151 
152  reco::BasicClusterCollection clusterCollection = *bccHandle;
153 
154  LogTrace("EcalClusters")<< "Got the BasicClusterCollection" << std::endl;
155 
156  reco::CaloClusterPtrVector clusterPtrVector;
157  for (unsigned int i = 0; i < clusterCollection.size(); i++){
158  clusterPtrVector.push_back(reco::CaloClusterPtr(bccHandle, i));
159  }
160 
161  reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterPtrVector);
162  LogTrace("EcalClusters") << "Found: " << superClusters.size() << " superclusters." ;
163 
164  std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection);
165  superclusters_p->assign(superClusters.begin(), superClusters.end());
166 
167  evt.put(superclusters_p, superclusterCollection_);
168  LogTrace("EcalClusters") << "Hybrid Clusters (Basic/Super) added to the Event! :-)" ;
169 
170 
171  nEvt_++;
172 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:141
edm::EDGetTokenT< EcalRecHitCollection > hitsToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &)
bool isValid() const
Definition: HandleBase.h:75
#define LogTrace(id)
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
ESHandle< TrackerGeometry > geometry
HybridClusterAlgo * hybrid_p
void makeClusters(const EcalRecHitCollection *, const CaloSubdetectorGeometry *geometry, reco::BasicClusterCollection &basicClusters, const EcalSeverityLevelAlgo *sevLv, bool regional=false, const std::vector< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())

Member Data Documentation

std::string HybridClusterProducer::basicclusterCollection_
private

Definition at line 33 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> HybridClusterProducer::hitsToken_
private

Definition at line 36 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer(), and produce().

HybridClusterAlgo* HybridClusterProducer::hybrid_p
private

Definition at line 39 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer(), produce(), and ~HybridClusterProducer().

int HybridClusterProducer::nEvt_
private

Definition at line 31 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer(), and produce().

PositionCalc HybridClusterProducer::posCalculator_
private

Definition at line 40 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer().

std::string HybridClusterProducer::superclusterCollection_
private

Definition at line 34 of file HybridClusterProducer.h.

Referenced by HybridClusterProducer(), and produce().