CMS 3D CMS Logo

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

#include <CosmicClusterProducer.h>

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

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_
 
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<>
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 CosmicClusterProducer.h.

Constructor & Destructor Documentation

◆ CosmicClusterProducer()

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

Definition at line 39 of file CosmicClusterProducer.cc.

39  {
40  // The verbosity level
41  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
42  if (verbosityString == "DEBUG")
44  else if (verbosityString == "WARNING")
46  else if (verbosityString == "INFO")
48  else
50 
51  // Parameters to identify the hit collections
52  ebHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
53  eeHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
54 
55  ebUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("barrelUncalibHits"));
56  eeUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("endcapUncalibHits"));
57 
58  // The names of the produced cluster collections
59  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
60  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
61 
62  // Island algorithm parameters
63  double barrelSeedThreshold = ps.getParameter<double>("BarrelSeedThr");
64  double barrelSingleThreshold = ps.getParameter<double>("BarrelSingleThr");
65  double barrelSecondThreshold = ps.getParameter<double>("BarrelSecondThr");
66  double barrelSupThreshold = ps.getParameter<double>("BarrelSupThr");
67  double endcapSeedThreshold = ps.getParameter<double>("EndcapSeedThr");
68  double endcapSingleThreshold = ps.getParameter<double>("EndcapSingleThr");
69  double endcapSecondThreshold = ps.getParameter<double>("EndcapSecondThr");
70  double endcapSupThreshold = ps.getParameter<double>("EndcapSupThr");
71 
72  // Parameters for the position calculation:
74 
77 
78  clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
79  clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
80 
81  //AssociationMap
82  barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
83  endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
84 
85  // Produces a collection of barrel and a collection of endcap clusters
86 
87  produces<reco::ClusterShapeCollection>(clustershapecollectionEE_);
88  produces<reco::BasicClusterCollection>(endcapClusterCollection_);
89  produces<reco::ClusterShapeCollection>(clustershapecollectionEB_);
90  produces<reco::BasicClusterCollection>(barrelClusterCollection_);
91  produces<reco::BasicClusterShapeAssociationCollection>(barrelClusterShapeAssociation_);
92  produces<reco::BasicClusterShapeAssociationCollection>(endcapClusterShapeAssociation_);
93 
94  island_p = new CosmicClusterAlgo(barrelSeedThreshold,
95  barrelSingleThreshold,
96  barrelSecondThreshold,
97  barrelSupThreshold,
98  endcapSeedThreshold,
99  endcapSingleThreshold,
100  endcapSecondThreshold,
101  endcapSupThreshold,
103  verbosity);
104 
105  nEvt_ = 0;
106 }

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

◆ ~CosmicClusterProducer()

CosmicClusterProducer::~CosmicClusterProducer ( )
override

Definition at line 108 of file CosmicClusterProducer.cc.

108 { delete island_p; }

References 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 128 of file CosmicClusterProducer.cc.

134  {
135  // get the hit collection from the event:
136 
139 
140  evt.getByToken(hitsToken, hits_h);
141  evt.getByToken(uhitsToken, uhits_h);
142 
143  const EcalRecHitCollection* hitCollection_p = hits_h.product();
144  const EcalUncalibratedRecHitCollection* uhitCollection_p = uhits_h.product();
145 
146  // get the geometry and topology from the event setup:
147  edm::ESHandle<CaloGeometry> geoHandle;
148  es.get<CaloGeometryRecord>().get(geoHandle);
149 
150  const CaloSubdetectorGeometry* geometry_p;
151  std::unique_ptr<CaloSubdetectorTopology> topology_p;
152 
153  std::string clustershapetag;
154  if (ecalPart == CosmicClusterAlgo::barrel) {
155  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
156  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
157  } else {
158  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
159  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
160  }
161 
162  const CaloSubdetectorGeometry* geometryES_p;
163  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
164 
165  // Run the clusterization algorithm:
167  clusters =
168  island_p->makeClusters(hitCollection_p, uhitCollection_p, geometry_p, topology_p.get(), geometryES_p, ecalPart);
169 
170  //Create associated ClusterShape objects.
171  std::vector<reco::ClusterShape> ClusVec;
172 
173  for (int erg = 0; erg < int(clusters.size()); ++erg) {
174  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg], hitCollection_p, geometry_p, topology_p.get());
175  ClusVec.push_back(TestShape);
176  }
177 
178  //Put clustershapes in event, but retain a Handle on them.
179  auto clustersshapes_p = std::make_unique<reco::ClusterShapeCollection>();
180  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
182  if (ecalPart == CosmicClusterAlgo::barrel)
183  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEB_);
184  else
185  clusHandle = evt.put(std::move(clustersshapes_p), clustershapecollectionEE_);
186 
187  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
188  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
189  clusters_p->assign(clusters.begin(), clusters.end());
191 
192  if (ecalPart == CosmicClusterAlgo::barrel)
193  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
194  else
195  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
196 
197  // BasicClusterShapeAssociationMap
198  auto shapeAssocs_p = std::make_unique<reco::BasicClusterShapeAssociationCollection>(bccHandle, clusHandle);
199 
200  for (unsigned int i = 0; i < clusHandle->size(); i++) {
201  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle, i),
203  }
204  evt.put(std::move(shapeAssocs_p), clusterShapeAssociation);
205 }

References CosmicClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), bsc_activity_cfg::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), get, edm::Event::getByToken(), 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().

◆ counterExceeded()

bool CosmicClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 60 of file CosmicClusterProducer.h.

60 { return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0)); }

References nEvt_, and nMaxPrintout_.

◆ outputValidationInfo()

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

◆ produce()

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

Member Data Documentation

◆ barrelClusterCollection_

std::string CosmicClusterProducer::barrelClusterCollection_
private

Definition at line 46 of file CosmicClusterProducer.h.

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

◆ barrelClusterShapeAssociation_

std::string CosmicClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 53 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

◆ clustershapecollectionEB_

std::string CosmicClusterProducer::clustershapecollectionEB_
private

Definition at line 49 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ clustershapecollectionEE_

std::string CosmicClusterProducer::clustershapecollectionEE_
private

Definition at line 50 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ ebHitsToken_

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

Definition at line 40 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

◆ ebUHitsToken_

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

Definition at line 43 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

◆ eeHitsToken_

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

Definition at line 41 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

◆ eeUHitsToken_

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

Definition at line 44 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

◆ endcapClusterCollection_

std::string CosmicClusterProducer::endcapClusterCollection_
private

Definition at line 47 of file CosmicClusterProducer.h.

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

◆ endcapClusterShapeAssociation_

std::string CosmicClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 54 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

◆ island_p

CosmicClusterAlgo* CosmicClusterProducer::island_p
private

◆ nEvt_

int CosmicClusterProducer::nEvt_
private

Definition at line 36 of file CosmicClusterProducer.h.

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

◆ nMaxPrintout_

int CosmicClusterProducer::nMaxPrintout_
private

Definition at line 35 of file CosmicClusterProducer.h.

Referenced by counterExceeded().

◆ posCalculator_

PositionCalc CosmicClusterProducer::posCalculator_
private

Definition at line 56 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

◆ shapeAlgo_

ClusterShapeAlgo CosmicClusterProducer::shapeAlgo_
private

Definition at line 57 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

◆ verbosity

CosmicClusterAlgo::VerbosityLevel CosmicClusterProducer::verbosity
private

Definition at line 38 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

mps_fire.i
i
Definition: mps_fire.py:355
CosmicClusterProducer::barrelClusterCollection_
std::string barrelClusterCollection_
Definition: CosmicClusterProducer.h:46
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CosmicClusterProducer::ebUHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > ebUHitsToken_
Definition: CosmicClusterProducer.h:43
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
CosmicClusterProducer::island_p
CosmicClusterAlgo * island_p
Definition: CosmicClusterProducer.h:58
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
CosmicClusterAlgo::endcap
Definition: CosmicClusterAlgo.h:29
edm::SortedCollection< EcalRecHit >
CosmicClusterProducer::nEvt_
int nEvt_
Definition: CosmicClusterProducer.h:36
MonitorAlCaEcalPi0_cfi.posCalcParameters
posCalcParameters
Definition: MonitorAlCaEcalPi0_cfi.py:72
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
edm::Ref
Definition: AssociativeIterator.h:58
CosmicClusterAlgo::makeClusters
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 >())
Definition: CosmicClusterAlgo.cc:16
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
reco::ClusterShape
Definition: ClusterShape.h:21
edm::ESHandle< CaloGeometry >
CosmicClusterProducer::endcapClusterShapeAssociation_
std::string endcapClusterShapeAssociation_
Definition: CosmicClusterProducer.h:54
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
ClusterShapeAlgo
Definition: ClusterShapeAlgo.h:35
reco::BasicClusterCollection
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
Definition: BasicClusterFwd.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
CosmicClusterProducer::shapeAlgo_
ClusterShapeAlgo shapeAlgo_
Definition: CosmicClusterProducer.h:57
edm::ParameterSet
Definition: ParameterSet.h:36
CosmicClusterProducer::barrelClusterShapeAssociation_
std::string barrelClusterShapeAssociation_
Definition: CosmicClusterProducer.h:53
CosmicClusterProducer::endcapClusterCollection_
std::string endcapClusterCollection_
Definition: CosmicClusterProducer.h:47
CosmicClusterAlgo
Definition: CosmicClusterAlgo.h:27
PositionCalc
Definition: PositionCalc.h:29
createfilelist.int
int
Definition: createfilelist.py:10
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
DetId::Ecal
Definition: DetId.h:27
get
#define get
CosmicClusterAlgo::pERROR
Definition: CosmicClusterAlgo.h:30
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalPreshower
Definition: EcalSubdetector.h:10
ClusterShapeAlgo::Calculate
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
Definition: ClusterShapeAlgo.cc:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
CosmicClusterAlgo::pWARNING
Definition: CosmicClusterAlgo.h:30
CosmicClusterProducer::nMaxPrintout_
int nMaxPrintout_
Definition: CosmicClusterProducer.h:35
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
CosmicClusterProducer::ebHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > ebHitsToken_
Definition: CosmicClusterProducer.h:40
CosmicClusterProducer::verbosity
CosmicClusterAlgo::VerbosityLevel verbosity
Definition: CosmicClusterProducer.h:38
CosmicClusterProducer::clustershapecollectionEB_
std::string clustershapecollectionEB_
Definition: CosmicClusterProducer.h:49
CosmicClusterAlgo::pDEBUG
Definition: CosmicClusterAlgo.h:30
CosmicClusterAlgo::barrel
Definition: CosmicClusterAlgo.h:29
CosmicClusterProducer::clustershapecollectionEE_
std::string clustershapecollectionEE_
Definition: CosmicClusterProducer.h:50
edm::InputTag
Definition: InputTag.h:15
CosmicClusterAlgo::pINFO
Definition: CosmicClusterAlgo.h:30
CosmicClusterProducer::eeUHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > eeUHitsToken_
Definition: CosmicClusterProducer.h:44
CosmicClusterProducer::eeHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > eeHitsToken_
Definition: CosmicClusterProducer.h:41
CosmicClusterProducer::posCalculator_
PositionCalc posCalculator_
Definition: CosmicClusterProducer.h:56
CosmicClusterProducer::clusterizeECALPart
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)
Definition: CosmicClusterProducer.cc:128