CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
HybridClusterProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

std::string basicclusterCollection_
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geoToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
hitsToken_
 
HybridClusterAlgohybrid_p
 
int nEvt_
 
PositionCalc posCalculator_
 
edm::ESGetToken
< EcalSeverityLevelAlgo,
EcalSeverityLevelAlgoRcd
sevLvToken_
 
std::string superclusterCollection_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 33 of file HybridClusterProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file HybridClusterProducer.cc.

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

58  {
59  basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection");
60  superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection");
61  hitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("recHitsCollection"));
62  geoToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
63  sevLvToken_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
64 
65  //Setup for core tools objects.
67 
69 
70  const std::vector<std::string> flagnames = ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
71 
72  const std::vector<int> flagsexcl = StringToEnumValue<EcalRecHit::Flags>(flagnames);
73 
74  const std::vector<std::string> severitynames =
75  ps.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcluded");
76 
77  const std::vector<int> severitiesexcl = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynames);
78 
79  hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"),
80  ps.getParameter<int>("step"),
81  ps.getParameter<double>("ethresh"),
82  ps.getParameter<double>("eseed"),
83  ps.getParameter<double>("xi"),
84  ps.getParameter<bool>("useEtForXi"),
85  ps.getParameter<double>("ewing"),
86  flagsexcl,
87  posCalculator_,
88  ps.getParameter<bool>("dynamicEThresh"),
89  ps.getParameter<double>("eThreshA"),
90  ps.getParameter<double>("eThreshB"),
91  severitiesexcl,
92  ps.getParameter<bool>("excludeFlagged"));
93  //bremRecoveryPset,
94 
95  // get brem recovery parameters
96  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
97  if (dynamicPhiRoad) {
98  edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
99  hybrid_p->setDynamicPhiRoad(bremRecoveryPset);
100  }
101 
102  produces<reco::BasicClusterCollection>(basicclusterCollection_);
103  produces<reco::SuperClusterCollection>(superclusterCollection_);
104  nEvt_ = 0;
105 }
edm::EDGetTokenT< EcalRecHitCollection > hitsToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
tuple posCalcParameters
void setDynamicPhiRoad(const edm::ParameterSet &bremRecoveryPset)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HybridClusterAlgo * hybrid_p
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
HybridClusterProducer::~HybridClusterProducer ( )
override

Definition at line 107 of file HybridClusterProducer.cc.

References hybrid_p.

107 { delete hybrid_p; }
HybridClusterAlgo * hybrid_p

Member Function Documentation

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

Definition at line 109 of file HybridClusterProducer.cc.

References basicclusterCollection_, DetId::Ecal, EcalBarrel, relativeConstraints::geometry, geoToken_, edm::Event::getByToken(), edm::EventSetup::getHandle(), 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< class >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), sevLvToken_, superclusterCollection_, and HLT_FULL_cff::superClusters.

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

Member Data Documentation

std::string HybridClusterProducer::basicclusterCollection_
private

Definition at line 44 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HybridClusterProducer::geoToken_
private

Definition at line 48 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().

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

Definition at line 47 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().

HybridClusterAlgo* HybridClusterProducer::hybrid_p
private

Definition at line 51 of file HybridClusterProducer.cc.

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

int HybridClusterProducer::nEvt_
private

Definition at line 42 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().

PositionCalc HybridClusterProducer::posCalculator_
private

Definition at line 52 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer().

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> HybridClusterProducer::sevLvToken_
private

Definition at line 49 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().

std::string HybridClusterProducer::superclusterCollection_
private

Definition at line 45 of file HybridClusterProducer.cc.

Referenced by HybridClusterProducer(), and produce().