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 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...
 
void run (const edm::DetSetVector< PixelDigi > &input, edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
 Iterate over DetUnits, and invoke the PixelClusterizer on each. More...
 
void setupClusterizer ()
 
 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)
 
 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 (const std::string &iProcessName, std::vector< const char * > &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 Attributes

PixelClusterizerBaseclusterizer_
 
std::string clusterMode_
 
edm::ParameterSet conf_
 
int32_t maxTotalClusters_
 Optional limit on the total number of clusters. More...
 
bool readyToCluster_
 
edm::InputTag src_
 
SiPixelGainCalibrationServiceBasetheSiPixelGainCalibration_
 
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, 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

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 edm::ParameterSet::getParameter(), HLT_25ns14e33_v1_cff::payloadType, setupClusterizer(), src_, AlCaHLTBitMon_QueryRunRegistry::string, theSiPixelGainCalibration_, and tPixelDigi.

50  :
51  conf_(conf),
53  clusterMode_("None"), // bogus
54  clusterizer_(0), // the default, in case we fail to make one
55  readyToCluster_(false), // since we obviously aren't
56  src_( conf.getParameter<edm::InputTag>( "src" ) ),
57  maxTotalClusters_( conf.getParameter<int32_t>( "maxNumberOfClusters" ) )
58  {
59  tPixelDigi = consumes<edm::DetSetVector<PixelDigi>>(src_);
60  //--- Declare to the EDM what kind of collections we will be making.
61  produces<SiPixelClusterCollectionNew>();
62 
63  std::string payloadType = conf.getParameter<std::string>( "payloadType" );
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.
75 
76  }
PixelClusterizerBase * clusterizer_
T getParameter(std::string const &) const
int32_t maxTotalClusters_
Optional limit on the total number of clusters.
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
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.

Implements edm::stream::EDProducerBase.

Definition at line 88 of file SiPixelClusterProducer.cc.

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

89  {
90 
91  //Setup gain calibration service
93 
94  // Step A.1: get input data
95  //edm::Handle<PixelDigiCollection> pixDigis;
97  e.getByToken(tPixelDigi, input);
98 
99  // Step A.2: get event setup
101  es.get<TrackerDigiGeometryRecord>().get( geom );
102 
103  // Step B: create the final output collection
104  std::auto_ptr<SiPixelClusterCollectionNew> output( new SiPixelClusterCollectionNew() );
105  //FIXME: put a reserve() here
106 
107  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
108  // on each DetUnit
109  run(*input, geom, *output );
110 
111  // Step D: write output to file
112  output->shrink_to_fit();
113  e.put( output );
114 
115  }
virtual void setESObjects(const edm::EventSetup &es)=0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
static std::string const input
Definition: EdmProvDump.cc:43
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
edmNew::DetSetVector< SiPixelCluster > SiPixelClusterCollectionNew
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void run(const edm::DetSetVector< PixelDigi > &input, edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
void SiPixelClusterProducer::run ( const edm::DetSetVector< PixelDigi > &  input,
edm::ESHandle< TrackerGeometry > &  geom,
edmNew::DetSetVector< SiPixelCluster > &  output 
)

Iterate over DetUnits, and invoke the PixelClusterizer on each.

Definition at line 143 of file SiPixelClusterProducer.cc.

References assert(), edm::DetSetVector< T >::begin(), PixelClusterizerBase::clusterizeDetUnit(), clusterizer_, relativeConstraints::empty, edm::DetSetVector< T >::end(), maxTotalClusters_, readyToCluster_, and edmNew::DetSetVector< T >::swap().

Referenced by produce().

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

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 122 of file SiPixelClusterProducer.cc.

References clusterizer_, clusterMode_, conf_, edm::ParameterSet::getUntrackedParameter(), readyToCluster_, PixelClusterizerBase::setSiPixelGainCalibrationService(), AlCaHLTBitMon_QueryRunRegistry::string, and theSiPixelGainCalibration_.

Referenced by SiPixelClusterProducer().

122  {
123  clusterMode_ =
124  conf_.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer");
125 
126  if ( clusterMode_ == "PixelThresholdClusterizer" ) {
129  readyToCluster_ = true;
130  }
131  else {
132  edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:"
133  <<" choice " << clusterMode_ << " is invalid.\n"
134  << "Possible choices:\n"
135  << " PixelThresholdClusterizer";
136  readyToCluster_ = false;
137  }
138  }
PixelClusterizerBase * clusterizer_
T getUntrackedParameter(std::string const &, T const &) const
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void setSiPixelGainCalibrationService(SiPixelGainCalibrationServiceBase *in)
A specific threshold-based pixel clustering algorithm.

Member Data Documentation

PixelClusterizerBase* SiPixelClusterProducer::clusterizer_
private

Definition at line 74 of file SiPixelClusterProducer.h.

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

std::string SiPixelClusterProducer::clusterMode_
private

Definition at line 73 of file SiPixelClusterProducer.h.

Referenced by setupClusterizer().

edm::ParameterSet SiPixelClusterProducer::conf_
private

Definition at line 69 of file SiPixelClusterProducer.h.

Referenced by setupClusterizer().

int32_t SiPixelClusterProducer::maxTotalClusters_
private

Optional limit on the total number of clusters.

Definition at line 79 of file SiPixelClusterProducer.h.

Referenced by run().

bool SiPixelClusterProducer::readyToCluster_
private

Definition at line 75 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

edm::InputTag SiPixelClusterProducer::src_
private

Definition at line 76 of file SiPixelClusterProducer.h.

Referenced by SiPixelClusterProducer().

SiPixelGainCalibrationServiceBase* SiPixelClusterProducer::theSiPixelGainCalibration_
private
edm::EDGetTokenT<edm::DetSetVector<PixelDigi> > SiPixelClusterProducer::tPixelDigi
private

Definition at line 70 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().