CMS 3D CMS Logo

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

#include <IslandClusterProducer.h>

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
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<>
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 26 of file IslandClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 40 of file IslandClusterProducer.cc.

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

40  {
41  // The verbosity level
42  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
43  if (verbosityString == "DEBUG")
45  else if (verbosityString == "WARNING")
47  else if (verbosityString == "INFO")
49  else
51 
52  // Parameters to identify the hit collections
53  barrelRecHits_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
54  endcapRecHits_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
55 
56  // The names of the produced cluster collections
57  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
58  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
59 
60  // Island algorithm parameters
61  double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
62  double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
63 
64  // Parameters for the position calculation:
66  posCalculator_ = PositionCalc(posCalcParameters);
67  shapeAlgo_ = ClusterShapeAlgo(posCalcParameters);
68 
69  clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
70  clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
71 
72  //AssociationMap
73  barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
74  endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
75 
76  const std::vector<std::string> seedflagnamesEB =
77  ps.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB");
78  const std::vector<int> seedflagsexclEB = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEB);
79 
80  const std::vector<std::string> seedflagnamesEE =
81  ps.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE");
82  const std::vector<int> seedflagsexclEE = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEE);
83 
84  const std::vector<std::string> flagnamesEB = ps.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
85  const std::vector<int> flagsexclEB = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
86 
87  const std::vector<std::string> flagnamesEE = ps.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
88  const std::vector<int> flagsexclEE = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
89 
90  // Produces a collection of barrel and a collection of endcap clusters
91 
92  produces<reco::ClusterShapeCollection>(clustershapecollectionEE_);
93  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
94  produces<reco::ClusterShapeCollection>(clustershapecollectionEB_);
95  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
96  produces<reco::BasicClusterShapeAssociationCollection>(barrelClusterShapeAssociation_);
97  produces<reco::BasicClusterShapeAssociationCollection>(endcapClusterShapeAssociation_);
98 
99  island_p = new IslandClusterAlgo(barrelSeedThreshold,
100  endcapSeedThreshold,
101  posCalculator_,
102  seedflagsexclEB,
103  seedflagsexclEE,
104  flagsexclEB,
105  flagsexclEE,
106  verbosity);
107 
108  nEvt_ = 0;
109 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHits_
std::string barrelClusterShapeAssociation_
IslandClusterAlgo * island_p
std::string endcapClusterShapeAssociation_
IslandClusterAlgo::VerbosityLevel verbosity
IslandClusterProducer::~IslandClusterProducer ( )
override

Definition at line 111 of file IslandClusterProducer.cc.

References island_p.

111 { delete island_p; }
IslandClusterAlgo * island_p

Member Function Documentation

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

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

Referenced by counterExceeded(), and produce().

163  {
164  // get the hit collection from the event:
165  const EcalRecHitCollection* hitCollection_p = getCollection(evt, token);
166 
167  // get the geometry and topology from the event setup:
168  edm::ESHandle<CaloGeometry> geoHandle;
169  es.get<CaloGeometryRecord>().get(geoHandle);
170 
171  const CaloSubdetectorGeometry* geometry_p;
172  std::unique_ptr<CaloSubdetectorTopology> topology_p;
173 
174  std::string clustershapetag;
175  if (ecalPart == IslandClusterAlgo::barrel) {
176  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
177  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
178  } else {
179  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
180  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
181  }
182 
183  const CaloSubdetectorGeometry* geometryES_p;
184  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
185 
186  // Run the clusterization algorithm:
188  clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p.get(), geometryES_p, ecalPart);
189 
190  //Create associated ClusterShape objects.
191  std::vector<reco::ClusterShape> ClusVec;
192  for (int erg = 0; erg < int(clusters.size()); ++erg) {
193  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg], hitCollection_p, geometry_p, topology_p.get());
194  ClusVec.push_back(TestShape);
195  }
196 
197  //Put clustershapes in event, but retain a Handle on them.
198  auto clustersshapes_p = std::make_unique<reco::ClusterShapeCollection>();
199  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
201  if (ecalPart == IslandClusterAlgo::barrel)
202  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEB_);
203  else
204  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEE_);
205 
206  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
207  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
208  clusters_p->assign(clusters.begin(), clusters.end());
210  if (ecalPart == IslandClusterAlgo::barrel)
211  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
212  else
213  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
214 
215  // BasicClusterShapeAssociationMap
216  auto shapeAssocs_p = std::make_unique<reco::BasicClusterShapeAssociationCollection>(bccHandle, clusHandle);
217  for (unsigned int i = 0; i < clusHandle->size(); i++) {
218  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle, i),
220  }
221  evt.put(std::move(shapeAssocs_p), clusterShapeAssociation);
222 }
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:131
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
IslandClusterAlgo * island_p
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
T get() const
Definition: EventSetup.h:73
const EcalRecHitCollection * getCollection(edm::Event &evt, const edm::EDGetTokenT< EcalRecHitCollection > &token)
def move(src, dest)
Definition: eostools.py:511
bool IslandClusterProducer::counterExceeded ( ) const
inlineprivate
void IslandClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 113 of file IslandClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, MonitorAlCaEcalPi0_cfi::posCalcParameters, and AlCaHLTBitMon_QueryRunRegistry::string.

113  {
115  desc.add<std::string>("VerbosityLevel", "ERROR");
116  desc.add<edm::InputTag>("barrelHits", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
117  desc.add<edm::InputTag>("endcapHits", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
118  desc.add<std::string>("barrelClusterCollection", "islandBarrelBasicClusters");
119  desc.add<std::string>("endcapClusterCollection", "islandEndcapBasicClusters");
120  desc.add<double>("IslandBarrelSeedThr", 0.5);
121  desc.add<double>("IslandEndcapSeedThr", 0.18);
122 
124  posCalcParameters.add<bool>("LogWeighted", true);
125  posCalcParameters.add<double>("T0_barl", 7.4);
126  posCalcParameters.add<double>("T0_endc", 3.1);
127  posCalcParameters.add<double>("T0_endcPresh", 1.2);
128  posCalcParameters.add<double>("W0", 4.2);
129  posCalcParameters.add<double>("X0", 0.89);
130  desc.add<edm::ParameterSetDescription>("posCalcParameters", posCalcParameters);
131 
132  desc.add<std::string>("clustershapecollectionEE", "islandEndcapShape");
133  desc.add<std::string>("clustershapecollectionEB", "islandBarrelShape");
134  desc.add<std::string>("barrelShapeAssociation", "islandBarrelShapeAssoc");
135  desc.add<std::string>("endcapShapeAssociation", "islandEndcapShapeAssoc");
136  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB", {});
137  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE", {});
138  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEB", {});
139  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEE", {});
140  descriptions.add("IslandClusterProducer", desc);
141 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const EcalRecHitCollection * IslandClusterProducer::getCollection ( edm::Event evt,
const edm::EDGetTokenT< EcalRecHitCollection > &  token 
)
private

Definition at line 151 of file IslandClusterProducer.cc.

References edm::Event::getByToken(), and edm::Handle< T >::product().

Referenced by clusterizeECALPart(), and counterExceeded().

152  {
154  evt.getByToken(token, rhcHandle);
155  return rhcHandle.product();
156 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
T const * product() const
Definition: Handle.h:69
void IslandClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

Referenced by counterExceeded().

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

Definition at line 143 of file IslandClusterProducer.cc.

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

143  {
148  nEvt_++;
149 }
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

std::string IslandClusterProducer::barrelClusterCollection_
private

Definition at line 43 of file IslandClusterProducer.h.

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

std::string IslandClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 50 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

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

Definition at line 40 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

std::string IslandClusterProducer::clustershapecollectionEB_
private

Definition at line 46 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

std::string IslandClusterProducer::clustershapecollectionEE_
private

Definition at line 47 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

std::string IslandClusterProducer::endcapClusterCollection_
private

Definition at line 44 of file IslandClusterProducer.h.

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

std::string IslandClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 51 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

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

Definition at line 41 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

IslandClusterAlgo* IslandClusterProducer::island_p
private
int IslandClusterProducer::nEvt_
private

Definition at line 36 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer(), and produce().

int IslandClusterProducer::nMaxPrintout_
private

Definition at line 35 of file IslandClusterProducer.h.

PositionCalc IslandClusterProducer::posCalculator_
private

Definition at line 53 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer().

ClusterShapeAlgo IslandClusterProducer::shapeAlgo_
private

Definition at line 54 of file IslandClusterProducer.h.

Referenced by clusterizeECALPart(), and IslandClusterProducer().

IslandClusterAlgo::VerbosityLevel IslandClusterProducer::verbosity
private

Definition at line 38 of file IslandClusterProducer.h.

Referenced by IslandClusterProducer().