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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob () override
 
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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
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::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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(), src_, AlCaHLTBitMon_QueryRunRegistry::string, theSiPixelGainCalibration_, and tPixelDigi.

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  tPixelDigi = consumes<edm::DetSetVector<PixelDigi>>(src_);
62  //--- Declare to the EDM what kind of collections we will be making.
63  produces<SiPixelClusterCollectionNew>();
64 
65  std::string payloadType = conf.getParameter<std::string>( "payloadType" );
66 
67  if (strcmp(payloadType.c_str(), "HLT") == 0)
69  else if (strcmp(payloadType.c_str(), "Offline") == 0)
71  else if (strcmp(payloadType.c_str(), "Full") == 0)
73 
74  //--- Make the algorithm(s) according to what the user specified
75  //--- in the ParameterSet.
77 
78  }
T getParameter(std::string const &) const
PixelClusterizerBase * clusterizer_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
int32_t maxTotalClusters_
Optional limit on the total number of clusters.
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
SiPixelClusterProducer::~SiPixelClusterProducer ( )
virtual

Definition at line 81 of file SiPixelClusterProducer.cc.

References clusterizer_, and theSiPixelGainCalibration_.

81  {
82  delete clusterizer_;
84  }
PixelClusterizerBase * clusterizer_
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_

Member Function Documentation

void SiPixelClusterProducer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 87 of file SiPixelClusterProducer.cc.

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

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

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

Implements edm::EDProducer.

Definition at line 96 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.

97  {
98 
99  //Setup gain calibration service
101 
102  // Step A.1: get input data
103  //edm::Handle<PixelDigiCollection> pixDigis;
105  e.getByToken(tPixelDigi, input);
106 
107  // Step A.2: get event setup
109  es.get<TrackerDigiGeometryRecord>().get( geom );
110 
111  // Step B: create the final output collection
112  std::auto_ptr<SiPixelClusterCollectionNew> output( new SiPixelClusterCollectionNew() );
113  //FIXME: put a reserve() here
114 
115  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
116  // on each DetUnit
117  run(*input, geom, *output );
118 
119  // Step D: write output to file
120  e.put( output );
121 
122  }
virtual void setESObjects(const edm::EventSetup &es)=0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
static std::string const input
Definition: EdmProvDump.cc:44
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
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 149 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().

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
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  // Produce clusters for this DetUnit and store them in
185  // a DetSet
186  edmNew::DetSetVector<SiPixelCluster>::FastFiller spc(output, DSViter->detId());
187  clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc);
188  if ( spc.empty() ) {
189  spc.abort();
190  } else {
191  numberOfClusters += spc.size();
192  }
193 
194  if ((maxTotalClusters_ >= 0) && (numberOfClusters > maxTotalClusters_)) {
195  edm::LogError("TooManyClusters") << "Limit on the number of clusters exceeded. An empty cluster collection will be produced instead.\n";
197  empty.swap(output);
198  break;
199  }
200  } // end of DetUnit loop
201 
202  //LogDebug ("SiPixelClusterProducer") << " Executing "
203  // << clusterMode_ << " resulted in " << numberOfClusters
204  // << " SiPixelClusters in " << numberOfDetUnits << " DetUnits.";
205  }
PixelClusterizerBase * clusterizer_
void swap(DetSetVector &rh)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:363
Definition: DetId.h:18
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:348
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 129 of file SiPixelClusterProducer.cc.

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

Referenced by SiPixelClusterProducer().

129  {
130  clusterMode_ =
131  conf_.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer");
132 
133  if ( clusterMode_ == "PixelThresholdClusterizer" ) {
135  readyToCluster_ = true;
136  }
137  else {
138  edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:"
139  <<" choice " << clusterMode_ << " is invalid.\n"
140  << "Possible choices:\n"
141  << " PixelThresholdClusterizer";
142  readyToCluster_ = false;
143  }
144  }
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 77 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 SiPixelClusterProducer().

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

Definition at line 78 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().