CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiPixelClusterProducer Class Referencefinal

EDProducer to cluster PixelDigis into SiPixelClusters. More...

#include <SiPixelClusterProducer.h>

Inheritance diagram for SiPixelClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 The "Event" entrypoint: gets called by framework for every event. More...
 
template<typename T >
void run (const T &input, const edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
 Iterate over DetUnits, and invoke the PixelClusterizer on each. More...
 
void setupClusterizer (const edm::ParameterSet &conf)
 
 SiPixelClusterProducer (const edm::ParameterSet &conf)
 Constructor: set the ParameterSet and defer all thinking to setupClusterizer(). More...
 
virtual ~SiPixelClusterProducer ()
 
- 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)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

PixelClusterizerBaseclusterizer_
 
const std::string clusterMode_
 
const int32_t maxTotalClusters_
 Optional limit on the total number of clusters. More...
 
const std::string payloadType_
 
bool readyToCluster_
 
SiPixelGainCalibrationServiceBasetheSiPixelGainCalibration_
 
edm::EDGetTokenT< SiPixelClusterCollectionNewtPixelClusters
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
 

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
 
- 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

EDProducer to cluster PixelDigis into SiPixelClusters.

SiPixelClusterProducer is an EDProducer subclass (i.e., a module) which orchestrates clustering of PixelDigis to SiPixelClusters. Consequently, the input is edm::DetSetVector<PixelDigi> and the output is edm::DetSetVector<SiPixelCluster>.

SiPixelClusterProducer invokes one of descendents from PixelClusterizerBase, e.g. PixelThresholdClusterizer (which is the only available option right now). SiPixelClusterProducer loads the PixelDigis, and then iterates over DetIds, invoking PixelClusterizer's clusterizeDetUnit to perform the clustering. clusterizeDetUnit() returns a DetSetVector of SiPixelClusters, which are then recorded in the event.

The calibrations are not loaded at the moment (v1), although that is being planned for the near future.

Author
porting from ORCA by Petar Maksimovic (JHU). DetSetVector implementation by Vincenzo Chiochia (Uni Zurich) Modify the local container (cache) to improve the speed. D.K. 5/07
Version
v1, Oct 26, 2005

Definition at line 52 of file SiPixelClusterProducer.h.

Constructor & Destructor Documentation

SiPixelClusterProducer::SiPixelClusterProducer ( const edm::ParameterSet conf)
explicit

Constructor: set the ParameterSet and defer all thinking to setupClusterizer().

SiPixelClusterProducer.cc

Description: see SiPixelClusterProducer.h Author: P. Maksimovic (porting from original ORCA version) History: Oct 14, 2005, initial version Get rid of the noiseVector. d.k. 28/3/06 Implementation of the DetSetVector container. V.Chiochia, May 06 SiPixelClusterCollection typedef of DetSetVector V.Chiochia, June 06 Introduce the DetSet local container (cache) for speed. d.k. 05/07


Definition at line 49 of file SiPixelClusterProducer.cc.

References clusterMode_, edm::ParameterSet::getParameter(), payloadType_, setupClusterizer(), theSiPixelGainCalibration_, tPixelClusters, and tPixelDigi.

50  :
52  clusterMode_( conf.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer") ),
53  clusterizer_(0), // the default, in case we fail to make one
54  readyToCluster_(false), // since we obviously aren't
55  maxTotalClusters_( conf.getParameter<int32_t>( "maxNumberOfClusters" ) ),
56  payloadType_( conf.getParameter<std::string>( "payloadType" ) )
57  {
58  if ( clusterMode_ == "PixelThresholdReclusterizer" )
59  tPixelClusters = consumes<SiPixelClusterCollectionNew>( conf.getParameter<edm::InputTag>("src") );
60  else
61  tPixelDigi = consumes<edm::DetSetVector<PixelDigi>>( conf.getParameter<edm::InputTag>("src") );
62  //--- Declare to the EDM what kind of collections we will be making.
63  produces<SiPixelClusterCollectionNew>();
64 
65  if (strcmp(payloadType_.c_str(), "HLT") == 0)
67  else if (strcmp(payloadType_.c_str(), "Offline") == 0)
69  else if (strcmp(payloadType_.c_str(), "Full") == 0)
71 
72  //--- Make the algorithm(s) according to what the user specified
73  //--- in the ParameterSet.
74  setupClusterizer(conf);
75 
76  }
PixelClusterizerBase * clusterizer_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string payloadType_
const int32_t maxTotalClusters_
Optional limit on the total number of clusters.
void setupClusterizer(const edm::ParameterSet &conf)
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
edm::EDGetTokenT< SiPixelClusterCollectionNew > tPixelClusters
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
const std::string clusterMode_
SiPixelClusterProducer::~SiPixelClusterProducer ( )
virtual

Definition at line 79 of file SiPixelClusterProducer.cc.

References clusterizer_, and theSiPixelGainCalibration_.

79  {
80  delete clusterizer_;
82  }
PixelClusterizerBase * clusterizer_
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_

Member Function Documentation

void SiPixelClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

The "Event" entrypoint: gets called by framework for every event.

Definition at line 88 of file SiPixelClusterProducer.cc.

References clusterMode_, relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByToken(), eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), run(), SiPixelGainCalibrationServiceBase::setESObjects(), theSiPixelGainCalibration_, tPixelClusters, and tPixelDigi.

89  {
90 
91  //Setup gain calibration service
93 
94  // Step A.1: get input data
97  if ( clusterMode_ == "PixelThresholdReclusterizer" )
98  e.getByToken(tPixelClusters, inputClusters);
99  else
100  e.getByToken(tPixelDigi, inputDigi);
101 
102  // Step A.2: get event setup
104  es.get<TrackerDigiGeometryRecord>().get( geom );
105 
106  // Step B: create the final output collection
107  auto output = std::make_unique< SiPixelClusterCollectionNew>();
108  //FIXME: put a reserve() here
109 
110  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
111  // on each DetUnit
112  if ( clusterMode_ == "PixelThresholdReclusterizer" )
113  run(*inputClusters, geom, *output );
114  else
115  run(*inputDigi, geom, *output );
116 
117  // Step D: write output to file
118  output->shrink_to_fit();
119  e.put(std::move(output));
120 
121  }
virtual void setESObjects(const edm::EventSetup &es)=0
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
edm::EDGetTokenT< SiPixelClusterCollectionNew > tPixelClusters
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void run(const T &input, const edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
def move(src, dest)
Definition: eostools.py:510
const std::string clusterMode_
template<typename T >
void SiPixelClusterProducer::run ( const T input,
const edm::ESHandle< TrackerGeometry > &  geom,
edmNew::DetSetVector< SiPixelCluster > &  output 
)

Iterate over DetUnits, and invoke the PixelClusterizer on each.

Definition at line 149 of file SiPixelClusterProducer.cc.

References PixelClusterizerBase::clusterizeDetUnit(), clusterizer_, DEFINE_FWK_MODULE, relativeConstraints::empty, TrackerGeometry::idToDetUnit(), maxTotalClusters_, readyToCluster_, and edmNew::DetSetVector< T >::swap().

Referenced by produce().

151  {
152  if ( ! readyToCluster_ ) {
153  edm::LogError("SiPixelClusterProducer")
154  <<" at least one clusterizer is not ready -- can't run!" ;
155  // TO DO: throw an exception here? The user may want to know...
156  return; // clusterizer is invalid, bail out
157  }
158 
159  int numberOfDetUnits = 0;
160  int numberOfClusters = 0;
161 
162  // Iterate on detector units
163  typename T::const_iterator DSViter = input.begin();
164  for( ; DSViter != input.end(); DSViter++) {
165  ++numberOfDetUnits;
166 
167  // LogDebug takes very long time, get rid off.
168  //LogDebug("SiStripClusterizer") << "[SiPixelClusterProducer::run] DetID" << DSViter->id;
169 
170  std::vector<short> badChannels;
171  DetId detIdObject(DSViter->detId());
172 
173  // Comment: At the moment the clusterizer depends on geometry
174  // to access information as the pixel topology (number of columns
175  // and rows in a detector module).
176  // In the future the geometry service will be replaced with
177  // a ES service.
178  const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject );
179  const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
180  if (! pixDet) {
181  // Fatal error! TO DO: throw an exception!
182  assert(0);
183  }
184  {
185  // Produce clusters for this DetUnit and store them in
186  // a DetSet
187  edmNew::DetSetVector<SiPixelCluster>::FastFiller spc(output, DSViter->detId());
188  clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc);
189  if ( spc.empty() ) {
190  spc.abort();
191  } else {
192  numberOfClusters += spc.size();
193  }
194  } // spc is not deleted and detsetvector updated
195  if ((maxTotalClusters_ >= 0) && (numberOfClusters > maxTotalClusters_)) {
196  edm::LogError("TooManyClusters") << "Limit on the number of clusters exceeded. An empty cluster collection will be produced instead.\n";
198  empty.swap(output);
199  break;
200  }
201  } // end of DetUnit loop
202 
203  //LogDebug ("SiPixelClusterProducer") << " Executing "
204  // << clusterMode_ << " resulted in " << numberOfClusters
205  // << " SiPixelClusters in " << numberOfDetUnits << " DetUnits.";
206  }
PixelClusterizerBase * clusterizer_
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void swap(DetSetVector &rh)
static std::string const input
Definition: EdmProvDump.cc:44
const int32_t maxTotalClusters_
Optional limit on the total number of clusters.
Definition: DetId.h:18
virtual void clusterizeDetUnit(const edm::DetSet< PixelDigi > &input, const PixelGeomDetUnit *pixDet, const std::vector< short > &badChannels, edmNew::DetSetVector< SiPixelCluster >::FastFiller &output)=0
void SiPixelClusterProducer::setupClusterizer ( const edm::ParameterSet conf)

Set up the specific algorithm we are going to use. TO DO: in the future, we should allow for a different algorithm for each detector subset (e.g. barrel vs forward, per layer, etc).

Definition at line 128 of file SiPixelClusterProducer.cc.

References clusterizer_, clusterMode_, readyToCluster_, PixelClusterizerBase::setSiPixelGainCalibrationService(), and theSiPixelGainCalibration_.

Referenced by SiPixelClusterProducer().

128  {
129 
130  if ( clusterMode_ == "PixelThresholdReclusterizer" || clusterMode_ == "PixelThresholdClusterizer" ) {
133  readyToCluster_ = true;
134  }
135  else {
136  edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:"
137  <<" choice " << clusterMode_ << " is invalid.\n"
138  << "Possible choices:\n"
139  << " PixelThresholdClusterizer";
140  readyToCluster_ = false;
141  }
142  }
PixelClusterizerBase * clusterizer_
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void setSiPixelGainCalibrationService(SiPixelGainCalibrationServiceBase *in)
const std::string clusterMode_
A specific threshold-based pixel clustering algorithm.

Member Data Documentation

PixelClusterizerBase* SiPixelClusterProducer::clusterizer_
private

Definition at line 75 of file SiPixelClusterProducer.h.

Referenced by run(), setupClusterizer(), and ~SiPixelClusterProducer().

const std::string SiPixelClusterProducer::clusterMode_
private

Definition at line 74 of file SiPixelClusterProducer.h.

Referenced by produce(), setupClusterizer(), and SiPixelClusterProducer().

const int32_t SiPixelClusterProducer::maxTotalClusters_
private

Optional limit on the total number of clusters.

Definition at line 79 of file SiPixelClusterProducer.h.

Referenced by run().

const std::string SiPixelClusterProducer::payloadType_
private

Definition at line 81 of file SiPixelClusterProducer.h.

Referenced by SiPixelClusterProducer().

bool SiPixelClusterProducer::readyToCluster_
private

Definition at line 76 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

SiPixelGainCalibrationServiceBase* SiPixelClusterProducer::theSiPixelGainCalibration_
private
edm::EDGetTokenT<SiPixelClusterCollectionNew> SiPixelClusterProducer::tPixelClusters
private

Definition at line 70 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > SiPixelClusterProducer::tPixelDigi
private

Definition at line 71 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().