CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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<>

Public Member Functions

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...
 
 ~SiPixelClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::unique_ptr< PixelClusterizerBaseclusterizer_
 
const std::string clusterMode_
 
const int32_t maxTotalClusters_
 Optional limit on the total number of clusters. More...
 
std::unique_ptr< SiPixelGainCalibrationServiceBasetheSiPixelGainCalibration_
 
edm::EDGetTokenT< SiPixelClusterCollectionNewtPixelClusters
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
 
edm::EDPutTokenT< SiPixelClusterCollectionNewtPutPixelClusters
 
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
 

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

References clusterMode_, edm::ParameterSet::getParameter(), setupClusterizer(), AlCaHLTBitMon_QueryRunRegistry::string, theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, and ~SiPixelClusterProducer().

51  :
52  tPutPixelClusters(produces<SiPixelClusterCollectionNew>()),
53  clusterMode_( conf.getParameter<std::string>("ClusterMode") ),
54  maxTotalClusters_( conf.getParameter<int32_t>( "maxNumberOfClusters" ) )
55  {
56  if ( clusterMode_ == "PixelThresholdReclusterizer" )
57  tPixelClusters = consumes<SiPixelClusterCollectionNew>( conf.getParameter<edm::InputTag>("src") );
58  else
59  tPixelDigi = consumes<edm::DetSetVector<PixelDigi>>( conf.getParameter<edm::InputTag>("src") );
60 
61  const auto& payloadType = conf.getParameter<std::string>( "payloadType" );
62  if (payloadType == "HLT")
63  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationForHLTService>(conf);
64  else if (payloadType == "Offline")
65  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationOfflineService>(conf);
66  else if (payloadType == "Full")
67  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationService>(conf);
68 
69  //--- Make the algorithm(s) according to what the user specified
70  //--- in the ParameterSet.
71  setupClusterizer(conf);
72 
73  }
T getParameter(std::string const &) const
std::unique_ptr< SiPixelGainCalibrationServiceBase > theSiPixelGainCalibration_
edm::EDPutTokenT< SiPixelClusterCollectionNew > tPutPixelClusters
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
const std::string clusterMode_
SiPixelClusterProducer::~SiPixelClusterProducer ( )
overridedefault

Referenced by SiPixelClusterProducer().

Member Function Documentation

void SiPixelClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 78 of file SiPixelClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), SiPixelGainCalibrationServiceBase::fillPSetDescription(), PixelThresholdClusterizer::fillPSetDescription(), and AlCaHLTBitMon_QueryRunRegistry::string.

78  {
80 
81  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigis"));
82  desc.add<std::string>("ClusterMode", "PixelThresholdClusterizer");
83  desc.add<int>("maxNumberOfClusters", -1)->setComment("-1 means no limit");
84  desc.add<std::string>("payloadType", "Offline")->setComment("Options: HLT - column granularity, Offline - gain:col/ped:pix");
85 
87  SiPixelGainCalibrationServiceBase::fillPSetDescription(desc); // no-op, but in principle the structures are there...
88 
89  descriptions.add("SiPixelClusterizerDefault", desc);
90 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void SiPixelClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

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

Definition at line 96 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(), theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, tPutPixelClusters, and tTopo_.

97  {
98 
99  //Setup gain calibration service
100  theSiPixelGainCalibration_->setESObjects( es );
101 
102  // Step A.1: get input data
105  if ( clusterMode_ == "PixelThresholdReclusterizer" )
106  e.getByToken(tPixelClusters, inputClusters);
107  else
108  e.getByToken(tPixelDigi, inputDigi);
109 
110  // Step A.2: get event setup
112  es.get<TrackerDigiGeometryRecord>().get( geom );
113 
114  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
115  es.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
116  tTopo_ = trackerTopologyHandle.product();
117 
118  // Step B: create the final output collection
119  auto output = std::make_unique< SiPixelClusterCollectionNew>();
120  //FIXME: put a reserve() here
121 
122  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
123  // on each DetUnit
124  if ( clusterMode_ == "PixelThresholdReclusterizer" )
125  run(*inputClusters, geom, *output );
126  else
127  run(*inputDigi, geom, *output );
128 
129  // Step D: write output to file
130  output->shrink_to_fit();
132 
133  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::unique_ptr< SiPixelGainCalibrationServiceBase > theSiPixelGainCalibration_
edm::EDPutTokenT< SiPixelClusterCollectionNew > tPutPixelClusters
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
edm::EDGetTokenT< SiPixelClusterCollectionNew > tPixelClusters
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:511
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 159 of file SiPixelClusterProducer.cc.

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

Referenced by produce().

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

References clusterizer_, clusterMode_, Exception, and theSiPixelGainCalibration_.

Referenced by SiPixelClusterProducer().

140  {
141 
142  if ( clusterMode_ == "PixelThresholdReclusterizer" || clusterMode_ == "PixelThresholdClusterizer" ) {
143  clusterizer_ = std::make_unique<PixelThresholdClusterizer>(conf);
144  clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_.get());
145  }
146  else {
147  throw cms::Exception("Configuration") << "[SiPixelClusterProducer]:"
148  <<" choice " << clusterMode_ << " is invalid.\n"
149  << "Possible choices:\n"
150  << " PixelThresholdClusterizer";
151  }
152  }
std::unique_ptr< PixelClusterizerBase > clusterizer_
std::unique_ptr< SiPixelGainCalibrationServiceBase > theSiPixelGainCalibration_
const std::string clusterMode_

Member Data Documentation

std::unique_ptr<PixelClusterizerBase> SiPixelClusterProducer::clusterizer_
private

Definition at line 79 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

const std::string SiPixelClusterProducer::clusterMode_
private

Definition at line 78 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 83 of file SiPixelClusterProducer.h.

Referenced by run().

std::unique_ptr<SiPixelGainCalibrationServiceBase> SiPixelClusterProducer::theSiPixelGainCalibration_
private

Definition at line 77 of file SiPixelClusterProducer.h.

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

edm::EDGetTokenT<SiPixelClusterCollectionNew> SiPixelClusterProducer::tPixelClusters
private

Definition at line 73 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

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

Definition at line 74 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

edm::EDPutTokenT<SiPixelClusterCollectionNew> SiPixelClusterProducer::tPutPixelClusters
private

Definition at line 75 of file SiPixelClusterProducer.h.

Referenced by produce().

const TrackerTopology* SiPixelClusterProducer::tTopo_
private

Definition at line 80 of file SiPixelClusterProducer.h.

Referenced by produce(), and run().