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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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
 
const TrackerTopologytTopo_
 

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::ESHandle< T >::product(), edm::Event::put(), run(), SiPixelGainCalibrationServiceBase::setESObjects(), theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, and tTopo_.

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  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
107  es.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
108  tTopo_ = trackerTopologyHandle.product();
109 
110  // Step B: create the final output collection
111  auto output = std::make_unique< SiPixelClusterCollectionNew>();
112  //FIXME: put a reserve() here
113 
114  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
115  // on each DetUnit
116  if ( clusterMode_ == "PixelThresholdReclusterizer" )
117  run(*inputClusters, geom, *output );
118  else
119  run(*inputDigi, geom, *output );
120 
121  // Step D: write output to file
122  output->shrink_to_fit();
123  e.put(std::move(output));
124 
125  }
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.
T const * product() const
Definition: ESHandle.h:86
const TrackerTopology * tTopo_
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 153 of file SiPixelClusterProducer.cc.

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

Referenced by produce().

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

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

Referenced by SiPixelClusterProducer().

132  {
133 
134  if ( clusterMode_ == "PixelThresholdReclusterizer" || clusterMode_ == "PixelThresholdClusterizer" ) {
137  readyToCluster_ = true;
138  }
139  else {
140  edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:"
141  <<" choice " << clusterMode_ << " is invalid.\n"
142  << "Possible choices:\n"
143  << " PixelThresholdClusterizer";
144  readyToCluster_ = false;
145  }
146  }
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 80 of file SiPixelClusterProducer.h.

Referenced by run().

const std::string SiPixelClusterProducer::payloadType_
private

Definition at line 82 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().

const TrackerTopology* SiPixelClusterProducer::tTopo_
private

Definition at line 77 of file SiPixelClusterProducer.h.

Referenced by produce(), and run().