CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
IslandClusterProducer Class Reference
Inheritance diagram for IslandClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &token, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)
 
bool counterExceeded () const
 
const EcalRecHitCollectiongetCollection (edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
 
void outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector)
 

Private Attributes

std::string barrelClusterCollection_
 
std::string barrelClusterShapeAssociation_
 
edm::EDGetTokenT< EcalRecHitCollectionbarrelRecHits_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
std::string clustershapecollectionEB_
 
std::string clustershapecollectionEE_
 
std::string endcapClusterCollection_
 
std::string endcapClusterShapeAssociation_
 
edm::EDGetTokenT< EcalRecHitCollectionendcapRecHits_
 
IslandClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
ClusterShapeAlgo shapeAlgo_
 
IslandClusterAlgo::VerbosityLevel verbosity
 

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 37 of file IslandClusterProducer.cc.

Constructor & Destructor Documentation

◆ IslandClusterProducer()

IslandClusterProducer::IslandClusterProducer ( const edm::ParameterSet ps)

Definition at line 86 of file IslandClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelRecHits_, caloGeometryToken_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapRecHits_, edm::ParameterSet::getParameter(), island_p, nEvt_, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, ecalPiZeroTask_cfi::posCalcParameters, posCalculator_, IslandClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

86  {
87  // The verbosity level
88  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
89  if (verbosityString == "DEBUG")
91  else if (verbosityString == "WARNING")
93  else if (verbosityString == "INFO")
95  else
97 
98  // Parameters to identify the hit collections
99  barrelRecHits_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
100  endcapRecHits_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
101 
102  //EventSetup Token for CaloGeometry
103  caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
104 
105  // The names of the produced cluster collections
106  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
107  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
108 
109  // Island algorithm parameters
110  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
111  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
112 
113  // Parameters for the position calculation:
117 
118  clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
119  clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
120 
121  //AssociationMap
122  barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
123  endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
124 
125  const std::vector<std::string> seedflagnamesEB =
126  ps.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB");
127  const std::vector<int> seedflagsexclEB = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEB);
128 
129  const std::vector<std::string> seedflagnamesEE =
130  ps.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE");
131  const std::vector<int> seedflagsexclEE = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEE);
132 
133  const std::vector<std::string> flagnamesEB = ps.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
134  const std::vector<int> flagsexclEB = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
135 
136  const std::vector<std::string> flagnamesEE = ps.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
137  const std::vector<int> flagsexclEE = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
138 
139  // Produces a collection of barrel and a collection of endcap clusters
140 
141  produces<reco::ClusterShapeCollection>(clustershapecollectionEE_);
142  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
143  produces<reco::ClusterShapeCollection>(clustershapecollectionEB_);
144  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
145  produces<reco::BasicClusterShapeAssociationCollection>(barrelClusterShapeAssociation_);
146  produces<reco::BasicClusterShapeAssociationCollection>(endcapClusterShapeAssociation_);
147 
148  island_p = new IslandClusterAlgo(barrelSeedThreshold,
149  endcapSeedThreshold,
151  seedflagsexclEB,
152  seedflagsexclEE,
153  flagsexclEB,
154  flagsexclEE,
155  verbosity);
156 
157  nEvt_ = 0;
158 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHits_
std::string barrelClusterShapeAssociation_
IslandClusterAlgo * island_p
std::string endcapClusterShapeAssociation_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
IslandClusterAlgo::VerbosityLevel verbosity

◆ ~IslandClusterProducer()

IslandClusterProducer::~IslandClusterProducer ( )
override

Definition at line 160 of file IslandClusterProducer.cc.

References island_p.

160 { delete island_p; }
IslandClusterAlgo * island_p

Member Function Documentation

◆ clusterizeECALPart()

void IslandClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const edm::EDGetTokenT< EcalRecHitCollection > &  token,
const std::string &  clusterCollection,
const std::string &  clusterShapeAssociation,
const IslandClusterAlgo::EcalPart ecalPart 
)
private

Definition at line 207 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), caloGeometryToken_, bsc_activity_cfg::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, getCollection(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), mps_fire::i, createfilelist::int, island_p, IslandClusterAlgo::makeClusters(), eostools::move(), edm::Event::put(), shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and unpackBuffers-CaloStage2::token.

Referenced by produce().

212  {
213  // get the hit collection from the event:
214  const EcalRecHitCollection* hitCollection_p = getCollection(evt, token);
215 
216  // get the geometry and topology from the event setup:
218 
219  const CaloSubdetectorGeometry* geometry_p;
220  std::unique_ptr<CaloSubdetectorTopology> topology_p;
221 
222  std::string clustershapetag;
223  if (ecalPart == IslandClusterAlgo::barrel) {
224  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
225  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
226  } else {
227  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
228  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
229  }
230 
231  const CaloSubdetectorGeometry* geometryES_p;
232  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
233 
234  // Run the clusterization algorithm:
236  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p.get(), geometryES_p, ecalPart);
237 
238  //Create associated ClusterShape objects.
239  std::vector<reco::ClusterShape> ClusVec;
240  for (int erg = 0; erg < int(clusters.size()); ++erg) {
241  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg], hitCollection_p, geometry_p, topology_p.get());
242  ClusVec.push_back(TestShape);
243  }
244 
245  //Put clustershapes in event, but retain a Handle on them.
246  auto clustersshapes_p = std::make_unique<reco::ClusterShapeCollection>();
247  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
249  if (ecalPart == IslandClusterAlgo::barrel)
250  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEB_);
251  else
252  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEE_);
253 
254  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
255  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
256  clusters_p->assign(clusters.begin(), clusters.end());
258  if (ecalPart == IslandClusterAlgo::barrel)
259  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
260  else
261  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
262 
263  // BasicClusterShapeAssociationMap
264  auto shapeAssocs_p = std::make_unique<reco::BasicClusterShapeAssociationCollection>(bccHandle, clusHandle);
265  for (unsigned int i = 0; i < clusHandle->size(); i++) {
266  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle, i),
268  }
269  evt.put(std::move(shapeAssocs_p), clusterShapeAssociation);
270 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
IslandClusterAlgo * island_p
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, EcalPart ecalPart, bool regional=false, const std::vector< RectangularEtaPhiRegion > &regions=std::vector< RectangularEtaPhiRegion >())
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const EcalRecHitCollection * getCollection(edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511

◆ counterExceeded()

bool IslandClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 69 of file IslandClusterProducer.cc.

References nEvt_, and nMaxPrintout_.

◆ fillDescriptions()

void IslandClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 162 of file IslandClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, ecalPiZeroTask_cfi::posCalcParameters, and AlCaHLTBitMon_QueryRunRegistry::string.

162  {
164  desc.add<std::string>("VerbosityLevel", "ERROR");
165  desc.add<edm::InputTag>("barrelHits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
166  desc.add<edm::InputTag>("endcapHits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
167  desc.add<std::string>("barrelClusterCollection", "islandBarrelBasicClusters");
168  desc.add<std::string>("endcapClusterCollection", "islandEndcapBasicClusters");
169  desc.add<double>("IslandBarrelSeedThr", 0.5);
170  desc.add<double>("IslandEndcapSeedThr", 0.18);
171 
173  posCalcParameters.add<bool>("LogWeighted", true);
174  posCalcParameters.add<double>("T0_barl", 7.4);
175  posCalcParameters.add<double>("T0_endc", 3.1);
176  posCalcParameters.add<double>("T0_endcPresh", 1.2);
177  posCalcParameters.add<double>("W0", 4.2);
178  posCalcParameters.add<double>("X0", 0.89);
179  desc.add<edm::ParameterSetDescription>("posCalcParameters", posCalcParameters);
180 
181  desc.add<std::string>("clustershapecollectionEE", "islandEndcapShape");
182  desc.add<std::string>("clustershapecollectionEB", "islandBarrelShape");
183  desc.add<std::string>("barrelShapeAssociation", "islandBarrelShapeAssoc");
184  desc.add<std::string>("endcapShapeAssociation", "islandEndcapShapeAssoc");
185  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB", {});
186  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE", {});
187  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEB", {});
188  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEE", {});
189  descriptions.add("IslandClusterProducer", desc);
190 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ getCollection()

const EcalRecHitCollection * IslandClusterProducer::getCollection ( edm::Event evt,
const edm::EDGetTokenT< EcalRecHitCollection > &  token 
)
private

Definition at line 200 of file IslandClusterProducer.cc.

References edm::Event::getByToken(), edm::Handle< T >::product(), and unpackBuffers-CaloStage2::token.

Referenced by clusterizeECALPart().

201  {
203  evt.getByToken(token, rhcHandle);
204  return rhcHandle.product();
205 }
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526

◆ outputValidationInfo()

void IslandClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

◆ produce()

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

Definition at line 192 of file IslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelRecHits_, clusterizeECALPart(), IslandClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapRecHits_, and nEvt_.

192  {
197  nEvt_++;
198 }
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHits_
std::string barrelClusterShapeAssociation_
std::string endcapClusterShapeAssociation_
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &token, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const IslandClusterAlgo::EcalPart &ecalPart)

Member Data Documentation

◆ barrelClusterCollection_

std::string IslandClusterProducer::barrelClusterCollection_
private

Definition at line 55 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), IslandClusterProducer(), and produce().

◆ barrelClusterShapeAssociation_

std::string IslandClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 62 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer(), and produce().

◆ barrelRecHits_

edm::EDGetTokenT<EcalRecHitCollection> IslandClusterProducer::barrelRecHits_
private

Definition at line 51 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer(), and produce().

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> IslandClusterProducer::caloGeometryToken_
private

Definition at line 53 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

◆ clustershapecollectionEB_

std::string IslandClusterProducer::clustershapecollectionEB_
private

Definition at line 58 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

◆ clustershapecollectionEE_

std::string IslandClusterProducer::clustershapecollectionEE_
private

Definition at line 59 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

◆ endcapClusterCollection_

std::string IslandClusterProducer::endcapClusterCollection_
private

Definition at line 56 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), IslandClusterProducer(), and produce().

◆ endcapClusterShapeAssociation_

std::string IslandClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 63 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer(), and produce().

◆ endcapRecHits_

edm::EDGetTokenT<EcalRecHitCollection> IslandClusterProducer::endcapRecHits_
private

Definition at line 52 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer(), and produce().

◆ island_p

IslandClusterAlgo* IslandClusterProducer::island_p
private

◆ nEvt_

int IslandClusterProducer::nEvt_
private

Definition at line 47 of file IslandClusterProducer.cc.

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

◆ nMaxPrintout_

int IslandClusterProducer::nMaxPrintout_
private

Definition at line 46 of file IslandClusterProducer.cc.

Referenced by counterExceeded().

◆ posCalculator_

PositionCalc IslandClusterProducer::posCalculator_
private

Definition at line 65 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer().

◆ shapeAlgo_

ClusterShapeAlgo IslandClusterProducer::shapeAlgo_
private

Definition at line 66 of file IslandClusterProducer.cc.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

◆ verbosity

IslandClusterAlgo::VerbosityLevel IslandClusterProducer::verbosity
private

Definition at line 49 of file IslandClusterProducer.cc.

Referenced by IslandClusterProducer().