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
cms::SiPixelClusterProducer Class Reference

#include <SiPixelClusterProducer.h>

Inheritance diagram for cms::SiPixelClusterProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 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::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 57 of file SiPixelClusterProducer.h.

Constructor & Destructor Documentation

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

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

Definition at line 51 of file SiPixelClusterProducer.cc.

References edm::ParameterSet::getParameter(), setupClusterizer(), and theSiPixelGainCalibration_.

52  :
53  conf_(conf),
55  clusterMode_("None"), // bogus
56  clusterizer_(0), // the default, in case we fail to make one
57  readyToCluster_(false), // since we obviously aren't
58  src_( conf.getParameter<edm::InputTag>( "src" ) ),
59  maxTotalClusters_( conf.getParameter<int32_t>( "maxNumberOfClusters" ) )
60  {
61  //--- Declare to the EDM what kind of collections we will be making.
62  produces<SiPixelClusterCollectionNew>();
63 
64  std::string payloadType = conf.getParameter<std::string>( "payloadType" );
65 
66  if (strcmp(payloadType.c_str(), "HLT") == 0)
68  else if (strcmp(payloadType.c_str(), "Offline") == 0)
70  else if (strcmp(payloadType.c_str(), "Full") == 0)
72 
73  //--- Make the algorithm(s) according to what the user specified
74  //--- in the ParameterSet.
76 
77  }
T getParameter(std::string const &) const
PixelClusterizerBase * clusterizer_
int32_t maxTotalClusters_
Optional limit on the total number of clusters.
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
SiPixelClusterProducer::~SiPixelClusterProducer ( )
virtual

Definition at line 80 of file SiPixelClusterProducer.cc.

References clusterizer_, and theSiPixelGainCalibration_.

80  {
81  delete clusterizer_;
83  }
PixelClusterizerBase * clusterizer_
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_

Member Function Documentation

void SiPixelClusterProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 86 of file SiPixelClusterProducer.cc.

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

87  {
88  edm::LogInfo("SiPixelClusterizer") << "[SiPixelClusterizer::beginJob]";
90  }
PixelClusterizerBase * clusterizer_
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void setSiPixelGainCalibrationService(SiPixelGainCalibrationServiceBase *in)
void SiPixelClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

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

Implements edm::EDProducer.

Definition at line 95 of file SiPixelClusterProducer.cc.

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

96  {
97 
98  //Setup gain calibration service
100 
101  // Step A.1: get input data
102  //edm::Handle<PixelDigiCollection> pixDigis;
104  e.getByLabel( src_, input);
105 
106  // Step A.2: get event setup
108  es.get<TrackerDigiGeometryRecord>().get( geom );
109 
110  // Step B: create the final output collection
111  std::auto_ptr<SiPixelClusterCollectionNew> output( new 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  run(*input, geom, *output );
117 
118  // Step D: write output to file
119  e.put( output );
120 
121  }
virtual void setESObjects(const edm::EventSetup &es)=0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edmNew::DetSetVector< SiPixelCluster > SiPixelClusterCollectionNew
void run(const edm::DetSetVector< PixelDigi > &input, edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
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 148 of file SiPixelClusterProducer.cc.

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

Referenced by produce().

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

References clusterizer_, clusterMode_, conf_, edm::ParameterSet::getUntrackedParameter(), and readyToCluster_.

Referenced by SiPixelClusterProducer().

128  {
129  clusterMode_ =
130  conf_.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer");
131 
132  if ( clusterMode_ == "PixelThresholdClusterizer" ) {
134  readyToCluster_ = true;
135  }
136  else {
137  edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:"
138  <<" choice " << clusterMode_ << " is invalid.\n"
139  << "Possible choices:\n"
140  << " PixelThresholdClusterizer";
141  readyToCluster_ = false;
142  }
143  }
T getUntrackedParameter(std::string const &, T const &) const
PixelClusterizerBase * clusterizer_
An explicit threshold-based clustering algorithm.

Member Data Documentation

PixelClusterizerBase* cms::SiPixelClusterProducer::clusterizer_
private

Definition at line 82 of file SiPixelClusterProducer.h.

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

std::string cms::SiPixelClusterProducer::clusterMode_
private

Definition at line 81 of file SiPixelClusterProducer.h.

Referenced by setupClusterizer().

edm::ParameterSet cms::SiPixelClusterProducer::conf_
private

Definition at line 78 of file SiPixelClusterProducer.h.

Referenced by setupClusterizer().

int32_t cms::SiPixelClusterProducer::maxTotalClusters_
private

Optional limit on the total number of clusters.

Definition at line 87 of file SiPixelClusterProducer.h.

Referenced by run().

bool cms::SiPixelClusterProducer::readyToCluster_
private

Definition at line 83 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

edm::InputTag cms::SiPixelClusterProducer::src_
private

Definition at line 84 of file SiPixelClusterProducer.h.

Referenced by produce().

SiPixelGainCalibrationServiceBase* cms::SiPixelClusterProducer::theSiPixelGainCalibration_
private