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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 27 of file CosmicClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file CosmicClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, clustershapecollectionEB_, clustershapecollectionEE_, ebHitsToken_, ebUHitsToken_, eeHitsToken_, eeUHitsToken_, endcapClusterCollection_, endcapClusterShapeAssociation_, edm::ParameterSet::getParameter(), island_p, nEvt_, CosmicClusterAlgo::pDEBUG, CosmicClusterAlgo::pERROR, CosmicClusterAlgo::pINFO, cleanAndMergeSuperClusters_cfi::posCalcParameters, posCalculator_, CosmicClusterAlgo::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") verbosity = CosmicClusterAlgo::pDEBUG;
44  else if (verbosityString == "WARNING") verbosity = CosmicClusterAlgo::pWARNING;
45  else if (verbosityString == "INFO") verbosity = CosmicClusterAlgo::pINFO;
47 
48 
49  // Parameters to identify the hit collections
50  ebHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelHits"));
51  eeHitsToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapHits"));
52 
53  ebUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("barrelUncalibHits"));
54  eeUHitsToken_ = consumes<EcalUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("endcapUncalibHits"));
55 
56 
57  // The names of the produced cluster collections
58  barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");
59  endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
60 
61  // Island algorithm parameters
62  double barrelSeedThreshold = ps.getParameter<double>("BarrelSeedThr");
63  double barrelSingleThreshold = ps.getParameter<double>("BarrelSingleThr");
64  double barrelSecondThreshold = ps.getParameter<double>("BarrelSecondThr");
65  double barrelSupThreshold = ps.getParameter<double>("BarrelSupThr");
66  double endcapSeedThreshold = ps.getParameter<double>("EndcapSeedThr");
67  double endcapSingleThreshold = ps.getParameter<double>("EndcapSingleThr");
68  double endcapSecondThreshold = ps.getParameter<double>("EndcapSecondThr");
69  double endcapSupThreshold = ps.getParameter<double>("EndcapSupThr");
70 
71  // Parameters for the position calculation:
73  ps.getParameter<edm::ParameterSet>("posCalcParameters");
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, barrelSingleThreshold, barrelSecondThreshold, barrelSupThreshold, endcapSeedThreshold, endcapSingleThreshold, endcapSecondThreshold, endcapSupThreshold, posCalculator_,verbosity);
95 
96  nEvt_ = 0;
97 }
T getParameter(std::string const &) const
CosmicClusterAlgo * island_p
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 ( )
override

Definition at line 100 of file CosmicClusterProducer.cc.

References island_p.

101 {
102  delete island_p;
103 }
CosmicClusterAlgo * island_p

Member Function Documentation

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

References CosmicClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), fastPrimaryVertexProducer_cfi::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::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 counterExceeded(), and produce().

122 {
123  // get the hit collection from the event:
124 
127 
128  evt.getByToken(hitsToken,hits_h);
129  evt.getByToken(uhitsToken,uhits_h);
130 
131  const EcalRecHitCollection *hitCollection_p = hits_h.product();
132  const EcalUncalibratedRecHitCollection *uhitCollection_p = uhits_h.product();
133 
134  // get the geometry and topology from the event setup:
135  edm::ESHandle<CaloGeometry> geoHandle;
136  es.get<CaloGeometryRecord>().get(geoHandle);
137 
138  const CaloSubdetectorGeometry *geometry_p;
139  std::unique_ptr<CaloSubdetectorTopology> topology_p;
140 
141  std::string clustershapetag;
142  if (ecalPart == CosmicClusterAlgo::barrel)
143  {
144  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
145  topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
146  }
147  else
148  {
149  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
150  topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
151  }
152 
153  const CaloSubdetectorGeometry *geometryES_p;
154  geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
155 
156  // Run the clusterization algorithm:
158  clusters = island_p->makeClusters(hitCollection_p, uhitCollection_p, geometry_p, topology_p.get(), geometryES_p, ecalPart);
159 
160  //Create associated ClusterShape objects.
161  std::vector <reco::ClusterShape> ClusVec;
162 
163  for (int erg=0;erg<int(clusters.size());++erg){
164  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p.get());
165  ClusVec.push_back(TestShape);
166  }
167 
168  //Put clustershapes in event, but retain a Handle on them.
169  auto clustersshapes_p = std::make_unique<reco::ClusterShapeCollection>();
170  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
172  if (ecalPart == CosmicClusterAlgo::barrel)
173  clusHandle= evt.put(std::move(clustersshapes_p), clustershapecollectionEB_);
174  else
175  clusHandle= evt.put(std::move(clustersshapes_p), clustershapecollectionEE_);
176 
177  // create a unique_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
178  auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
179  clusters_p->assign(clusters.begin(), clusters.end());
181 
182  if (ecalPart == CosmicClusterAlgo::barrel)
183  bccHandle = evt.put(std::move(clusters_p), barrelClusterCollection_);
184  else
185  bccHandle = evt.put(std::move(clusters_p), endcapClusterCollection_);
186 
187 
188  // BasicClusterShapeAssociationMap
189  auto shapeAssocs_p = std::make_unique<reco::BasicClusterShapeAssociationCollection>(bccHandle, clusHandle);
190 
191  for (unsigned int i = 0; i < clusHandle->size(); i++){
192  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
193  }
194  evt.put(std::move(shapeAssocs_p),clusterShapeAssociation);
195 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
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 >())
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
CosmicClusterAlgo * island_p
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
T const * product() const
Definition: Handle.h:74
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T get() const
Definition: EventSetup.h:71
def move(src, dest)
Definition: eostools.py:511
bool CosmicClusterProducer::counterExceeded ( ) const
inlineprivate
void CosmicClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private

Referenced by counterExceeded().

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

Definition at line 106 of file CosmicClusterProducer.cc.

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

107 {
110  nEvt_++;
111 }
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

std::string CosmicClusterProducer::barrelClusterCollection_
private

Definition at line 50 of file CosmicClusterProducer.h.

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

std::string CosmicClusterProducer::barrelClusterShapeAssociation_
private

Definition at line 57 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::clustershapecollectionEB_
private

Definition at line 53 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

std::string CosmicClusterProducer::clustershapecollectionEE_
private

Definition at line 54 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

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

Definition at line 44 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

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

Definition at line 47 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

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

Definition at line 45 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

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

Definition at line 48 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::endcapClusterCollection_
private

Definition at line 51 of file CosmicClusterProducer.h.

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

std::string CosmicClusterProducer::endcapClusterShapeAssociation_
private

Definition at line 58 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

CosmicClusterAlgo* CosmicClusterProducer::island_p
private
int CosmicClusterProducer::nEvt_
private

Definition at line 40 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

int CosmicClusterProducer::nMaxPrintout_
private

Definition at line 39 of file CosmicClusterProducer.h.

PositionCalc CosmicClusterProducer::posCalculator_
private

Definition at line 60 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

ClusterShapeAlgo CosmicClusterProducer::shapeAlgo_
private

Definition at line 61 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

CosmicClusterAlgo::VerbosityLevel CosmicClusterProducer::verbosity
private

Definition at line 42 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().