CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CosmicClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~CosmicClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< EcalRecHitCollection
ebHitsToken_
 
edm::EDGetTokenT
< EcalUncalibratedRecHitCollection
ebUHitsToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
eeHitsToken_
 
edm::EDGetTokenT
< EcalUncalibratedRecHitCollection
eeUHitsToken_
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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, HLT_FULL_cff::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_
tuple posCalcParameters
CosmicClusterAlgo::VerbosityLevel verbosity
std::string endcapClusterShapeAssociation_
edm::EDGetTokenT< EcalRecHitCollection > ebHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > eeUHitsToken_
edm::EDGetTokenT< EcalUncalibratedRecHitCollection > ebUHitsToken_
std::string barrelClusterShapeAssociation_
CosmicClusterProducer::~CosmicClusterProducer ( )

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(), HLT_FULL_cff::clusters, clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), edm::Event::getByToken(), i, island_p, CosmicClusterAlgo::makeClusters(), edm::Handle< T >::product(), edm::Event::put(), shapeAlgo_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by 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  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 = new EcalBarrelTopology(geoHandle);
146  }
147  else
148  {
149  geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
150  topology_p = new 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, 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);
165  ClusVec.push_back(TestShape);
166  }
167 
168  //Put clustershapes in event, but retain a Handle on them.
169  std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
170  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
172  if (ecalPart == CosmicClusterAlgo::barrel)
173  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_);
174  else
175  clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_);
176 
177  // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
178  std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
179  clusters_p->assign(clusters.begin(), clusters.end());
181 
182  if (ecalPart == CosmicClusterAlgo::barrel)
183  bccHandle = evt.put(clusters_p, barrelClusterCollection_);
184  else
185  bccHandle = evt.put(clusters_p, endcapClusterCollection_);
186 
187 
188  // BasicClusterShapeAssociationMap
189  std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(
190  new reco::BasicClusterShapeAssociationCollection(bccHandle, clusHandle));
191 
192  for (unsigned int i = 0; i < clusHandle->size(); i++){
193  shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
194  }
195  evt.put(shapeAssocs_p,clusterShapeAssociation);
196 
197  delete topology_p;
198 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< ClusterShape > ClusterShapeCollection
collection of ClusterShape objects
CosmicClusterAlgo * island_p
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
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< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
bool CosmicClusterProducer::counterExceeded ( ) const
inlineprivate

Definition at line 64 of file CosmicClusterProducer.h.

References nEvt_, and nMaxPrintout_.

void CosmicClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector)
private
void CosmicClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

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(), counterExceeded(), and produce().

int CosmicClusterProducer::nMaxPrintout_
private

Definition at line 39 of file CosmicClusterProducer.h.

Referenced by counterExceeded().

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().