CMS 3D CMS Logo

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

Public Member Functions

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

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

Private Attributes

std::string barrelClusterCollection_
 
std::string barrelClusterShapeAssociation_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
std::string clustershapecollectionEB_
 
std::string clustershapecollectionEE_
 
edm::EDGetTokenT< EcalRecHitCollectionebHitsToken_
 
edm::EDGetTokenT< EcalUncalibratedRecHitCollectionebUHitsToken_
 
edm::EDGetTokenT< EcalRecHitCollectioneeHitsToken_
 
edm::EDGetTokenT< EcalUncalibratedRecHitCollectioneeUHitsToken_
 
std::string endcapClusterCollection_
 
std::string endcapClusterShapeAssociation_
 
CosmicClusterAlgoisland_p
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
ClusterShapeAlgo shapeAlgo_
 
CosmicClusterAlgo::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 36 of file CosmicClusterProducer.cc.

Constructor & Destructor Documentation

◆ CosmicClusterProducer()

CosmicClusterProducer::CosmicClusterProducer ( const edm::ParameterSet ps)

Definition at line 87 of file CosmicClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, caloGeometryToken_, clustershapecollectionEB_, clustershapecollectionEE_, ebHitsToken_, ebUHitsToken_, eeHitsToken_, eeUHitsToken_, endcapClusterCollection_, endcapClusterShapeAssociation_, edm::ParameterSet::getParameter(), island_p, nEvt_, CosmicClusterAlgo::pDEBUG, CosmicClusterAlgo::pERROR, CosmicClusterAlgo::pINFO, ecalPiZeroTask_cfi::posCalcParameters, posCalculator_, CosmicClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

87  {
88  // The verbosity level
89  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
90  if (verbosityString == "DEBUG")
92  else if (verbosityString == "WARNING")
94  else if (verbosityString == "INFO")
96  else
98 
99  // Parameters to identify the hit collections
100  ebHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
101  eeHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
102 
103  ebUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("barrelUncalibHits"));
104  eeUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("endcapUncalibHits"));
105 
106  caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
107 
108  // The names of the produced cluster collections
109  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
110  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
111 
112  // Island algorithm parameters
113  double barrelSeedThreshold = ps.getParameter<double>("BarrelSeedThr");
114  double barrelSingleThreshold = ps.getParameter<double>("BarrelSingleThr");
115  double barrelSecondThreshold = ps.getParameter<double>("BarrelSecondThr");
116  double barrelSupThreshold = ps.getParameter<double>("BarrelSupThr");
117  double endcapSeedThreshold = ps.getParameter<double>("EndcapSeedThr");
118  double endcapSingleThreshold = ps.getParameter<double>("EndcapSingleThr");
119  double endcapSecondThreshold = ps.getParameter<double>("EndcapSecondThr");
120  double endcapSupThreshold = ps.getParameter<double>("EndcapSupThr");
121 
122  // Parameters for the position calculation:
124 
127 
128  clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
129  clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
130 
131  //AssociationMap
132  barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
133  endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
134 
135  // Produces a collection of barrel and a collection of endcap clusters
136 
137  produces<reco::ClusterShapeCollection>(clustershapecollectionEE_);
138  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
139  produces<reco::ClusterShapeCollection>(clustershapecollectionEB_);
140  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
141  produces<reco::BasicClusterShapeAssociationCollection>(barrelClusterShapeAssociation_);
142  produces<reco::BasicClusterShapeAssociationCollection>(endcapClusterShapeAssociation_);
143 
144  island_p = new CosmicClusterAlgo(barrelSeedThreshold,
145  barrelSingleThreshold,
146  barrelSecondThreshold,
147  barrelSupThreshold,
148  endcapSeedThreshold,
149  endcapSingleThreshold,
150  endcapSecondThreshold,
151  endcapSupThreshold,
153  verbosity);
154 
155  nEvt_ = 0;
156 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
CosmicClusterAlgo * island_p
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
edm::EDGetTokenT< EcalRecHitCollection > eeHitsToken_
CosmicClusterAlgo::VerbosityLevel verbosity
std::string endcapClusterShapeAssociation_
edm::EDGetTokenT< EcalRecHitCollection > ebHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > eeUHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > ebUHitsToken_
std::string barrelClusterShapeAssociation_

◆ ~CosmicClusterProducer()

CosmicClusterProducer::~CosmicClusterProducer ( )
override

Definition at line 158 of file CosmicClusterProducer.cc.

References island_p.

158 { delete island_p; }
CosmicClusterAlgo * island_p

Member Function Documentation

◆ clusterizeECALPart()

void CosmicClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const edm::EDGetTokenT< EcalRecHitCollection > &  hitsToken,
const edm::EDGetTokenT< EcalUncalibratedRecHitCollection > &  uhitsToken,
const std::string &  clusterCollection,
const std::string &  clusterShapeAssociation,
const CosmicClusterAlgo::EcalPart ecalPart 
)
private

Definition at line 178 of file CosmicClusterProducer.cc.

References CosmicClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), caloGeometryToken_, bsc_activity_cfg::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::Event::getByToken(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), mps_fire::i, createfilelist::int, island_p, CosmicClusterAlgo::makeClusters(), eostools::move(), edm::Handle< T >::product(), edm::Event::put(), shapeAlgo_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

184  {
185  // get the hit collection from the event:
186 
189 
190  evt.getByToken(hitsToken, hits_h);
191  evt.getByToken(uhitsToken, uhits_h);
192 
193  const EcalRecHitCollection* hitCollection_p = hits_h.product();
194  const EcalUncalibratedRecHitCollection* uhitCollection_p = uhits_h.product();
195 
196  // get the geometry and topology from the event setup:
198 
199  const CaloSubdetectorGeometry* geometry_p;
200  std::unique_ptr<CaloSubdetectorTopology> topology_p;
201 
202  std::string clustershapetag;
203  if (ecalPart == CosmicClusterAlgo::barrel) {
204  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
205  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
206  } else {
207  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
208  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
209  }
210 
211  const CaloSubdetectorGeometry* geometryES_p;
212  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
213 
214  // Run the clusterization algorithm:
216  clusters =
217  island_p->makeClusters(hitCollection_p, uhitCollection_p, geometry_p, topology_p.get(), geometryES_p, ecalPart);
218 
219  //Create associated ClusterShape objects.
220  std::vector<reco::ClusterShape> ClusVec;
221 
222  for (int erg = 0; erg < int(clusters.size()); ++erg) {
223  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg], hitCollection_p, geometry_p, topology_p.get());
224  ClusVec.push_back(TestShape);
225  }
226 
227  //Put clustershapes in event, but retain a Handle on them.
228  auto clustersshapes_p = std::make_unique<reco::ClusterShapeCollection>();
229  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
231  if (ecalPart == CosmicClusterAlgo::barrel)
232  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEB_);
233  else
234  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEE_);
235 
236  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
237  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
238  clusters_p->assign(clusters.begin(), clusters.end());
240 
241  if (ecalPart == CosmicClusterAlgo::barrel)
242  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
243  else
244  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
245 
246  // BasicClusterShapeAssociationMap
247  auto shapeAssocs_p = std::make_unique<reco::BasicClusterShapeAssociationCollection>(bccHandle, clusHandle);
248 
249  for (unsigned int i = 0; i < clusHandle->size(); i++) {
250  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle, i),
252  }
253  evt.put(std::move(shapeAssocs_p), clusterShapeAssociation);
254 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const EcalUncalibratedRecHitCollection *uncalibhits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, EcalPart ecalPart, bool regional=false, const std::vector< RectangularEtaPhiRegion > &regions=std::vector< RectangularEtaPhiRegion >())
T const * product() const
Definition: Handle.h:70
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
CosmicClusterAlgo * island_p
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
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 CosmicClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 71 of file CosmicClusterProducer.cc.

References nEvt_, and nMaxPrintout_.

◆ outputValidationInfo()

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

◆ produce()

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

Definition at line 160 of file CosmicClusterProducer.cc.

References CosmicClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, clusterizeECALPart(), eeHitsToken_, eeUHitsToken_, CosmicClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, and nEvt_.

160  {
161  clusterizeECALPart(evt,
162  es,
163  eeHitsToken_,
168  clusterizeECALPart(evt,
169  es,
170  eeHitsToken_,
175  nEvt_++;
176 }
void clusterizeECALPart(edm::Event &evt, const edm::EventSetup &es, const edm::EDGetTokenT< EcalRecHitCollection > &hitsToken, const edm::EDGetTokenT< EcalUncalibratedRecHitCollection > &uhitsToken, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const CosmicClusterAlgo::EcalPart &ecalPart)
edm::EDGetTokenT< EcalRecHitCollection > eeHitsToken_
std::string endcapClusterShapeAssociation_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > eeUHitsToken_
std::string barrelClusterShapeAssociation_

Member Data Documentation

◆ barrelClusterCollection_

std::string CosmicClusterProducer::barrelClusterCollection_
private

Definition at line 57 of file CosmicClusterProducer.cc.

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

◆ barrelClusterShapeAssociation_

std::string CosmicClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 64 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer(), and produce().

◆ caloGeometryToken_

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

Definition at line 55 of file CosmicClusterProducer.cc.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ clustershapecollectionEB_

std::string CosmicClusterProducer::clustershapecollectionEB_
private

Definition at line 60 of file CosmicClusterProducer.cc.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ clustershapecollectionEE_

std::string CosmicClusterProducer::clustershapecollectionEE_
private

Definition at line 61 of file CosmicClusterProducer.cc.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ ebHitsToken_

edm::EDGetTokenT<EcalRecHitCollection> CosmicClusterProducer::ebHitsToken_
private

Definition at line 50 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer().

◆ ebUHitsToken_

edm::EDGetTokenT<EcalUncalibratedRecHitCollection> CosmicClusterProducer::ebUHitsToken_
private

Definition at line 53 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer().

◆ eeHitsToken_

edm::EDGetTokenT<EcalRecHitCollection> CosmicClusterProducer::eeHitsToken_
private

Definition at line 51 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer(), and produce().

◆ eeUHitsToken_

edm::EDGetTokenT<EcalUncalibratedRecHitCollection> CosmicClusterProducer::eeUHitsToken_
private

Definition at line 54 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer(), and produce().

◆ endcapClusterCollection_

std::string CosmicClusterProducer::endcapClusterCollection_
private

Definition at line 58 of file CosmicClusterProducer.cc.

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

◆ endcapClusterShapeAssociation_

std::string CosmicClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 65 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer(), and produce().

◆ island_p

CosmicClusterAlgo* CosmicClusterProducer::island_p
private

◆ nEvt_

int CosmicClusterProducer::nEvt_
private

Definition at line 46 of file CosmicClusterProducer.cc.

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

◆ nMaxPrintout_

int CosmicClusterProducer::nMaxPrintout_
private

Definition at line 45 of file CosmicClusterProducer.cc.

Referenced by counterExceeded().

◆ posCalculator_

PositionCalc CosmicClusterProducer::posCalculator_
private

Definition at line 67 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer().

◆ shapeAlgo_

ClusterShapeAlgo CosmicClusterProducer::shapeAlgo_
private

Definition at line 68 of file CosmicClusterProducer.cc.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ verbosity

CosmicClusterAlgo::VerbosityLevel CosmicClusterProducer::verbosity
private

Definition at line 48 of file CosmicClusterProducer.cc.

Referenced by CosmicClusterProducer().