CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HybridClusterProducer Class Reference

#include <HybridClusterProducer.h>

Inheritance diagram for HybridClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

 HybridClusterProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HybridClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

std::string basicclusterCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionhitsToken_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 19 of file HybridClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file HybridClusterProducer.cc.

References basicclusterCollection_, cosmicSuperClusters_cfi::bremRecoveryPset, cosmicSuperClusters_cfi::dynamicPhiRoad, edm::ParameterSet::getParameter(), hitsToken_, hybrid_p, nEvt_, cleanAndMergeSuperClusters_cfi::posCalcParameters, posCalculator_, AlCaHLTBitMon_QueryRunRegistry::string, and superclusterCollection_.

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

Definition at line 97 of file HybridClusterProducer.cc.

References hybrid_p.

98 {
99  delete hybrid_p;
100 }
HybridClusterAlgo * hybrid_p

Member Function Documentation

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

Definition at line 103 of file HybridClusterProducer.cc.

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

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

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