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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeomToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopoToken_
 
const TrackerTopologytTopo_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 54 of file SiPixelClusterProducer.h.

Constructor & Destructor Documentation

◆ SiPixelClusterProducer()

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

References clusterMode_, edm::ParameterSet::getParameter(), HLT_2024v10_cff::payloadType, setupClusterizer(), AlCaHLTBitMon_QueryRunRegistry::string, theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, trackerGeomToken_, and trackerTopoToken_.

49  : tPutPixelClusters(produces<SiPixelClusterCollectionNew>()),
50  clusterMode_(conf.getParameter<std::string>("ClusterMode")),
51  maxTotalClusters_(conf.getParameter<int32_t>("maxNumberOfClusters")) {
52  if (clusterMode_ == "PixelThresholdReclusterizer")
53  tPixelClusters = consumes<SiPixelClusterCollectionNew>(conf.getParameter<edm::InputTag>("src"));
54  else
55  tPixelDigi = consumes<edm::DetSetVector<PixelDigi>>(conf.getParameter<edm::InputTag>("src"));
56 
57  trackerTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>();
58  trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
59 
60  const auto& payloadType = conf.getParameter<std::string>("payloadType");
61 
62  if (payloadType == "HLT")
63  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationForHLTService>(conf, consumesCollector());
64  else if (payloadType == "Offline")
65  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationOfflineService>(conf, consumesCollector());
66  else if (payloadType == "Full")
67  theSiPixelGainCalibration_ = std::make_unique<SiPixelGainCalibrationService>(conf, consumesCollector());
68  else if (payloadType == "None")
70 
71  //--- Make the algorithm(s) according to what the user specified
72  //--- in the ParameterSet.
73  setupClusterizer(conf);
74 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
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
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
const std::string clusterMode_

◆ ~SiPixelClusterProducer()

SiPixelClusterProducer::~SiPixelClusterProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 79 of file SiPixelClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, SiPixelGainCalibrationServiceBase::fillPSetDescription(), PixelThresholdClusterizer::fillPSetDescription(), ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

79  {
81 
82  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigis"));
83  desc.add<std::string>("ClusterMode", "PixelThresholdClusterizer");
84  desc.add<int>("maxNumberOfClusters", -1)->setComment("-1 means no limit");
85  desc.add<std::string>("payloadType", "Offline")
86  ->setComment("Options: HLT - column granularity, Offline - gain:col/ped:pix, None: no gain calibrations");
87 
89  SiPixelGainCalibrationServiceBase::fillPSetDescription(desc); // no-op, but in principle the structures are there...
90 
91  descriptions.add("SiPixelClusterizerDefault", desc);
92 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void SiPixelClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

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

Definition at line 97 of file SiPixelClusterProducer.cc.

References clusterMode_, bsc_activity_cfg::clusters, MillePedeFileConverter_cfg::e, relativeConstraints::geom, edm::EventSetup::getHandle(), HLT_FULL_cff::inputClusters, eostools::move(), edm::ESHandle< T >::product(), run(), theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, tPutPixelClusters, trackerGeomToken_, trackerTopoToken_, and tTopo_.

97  {
98  //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 
113  edm::ESHandle<TrackerTopology> trackerTopologyHandle = es.getHandle(trackerTopoToken_);
114  tTopo_ = trackerTopologyHandle.product();
115 
116  // Step B: create the final output collection
117  auto output = std::make_unique<SiPixelClusterCollectionNew>();
118  //FIXME: put a reserve() here
119 
120  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
121  // on each DetUnit
122  if (clusterMode_ == "PixelThresholdReclusterizer")
124  else
125  run(*inputDigi, geom, *output);
126 
127  // Step D: write output to file
128  output->shrink_to_fit();
129 
130  // set sequential identifier
131  for (auto clusters : *output) {
132  uint16_t id = 0;
133  for (auto& cluster : clusters) {
134  cluster.setOriginalId(id++);
135  }
136  }
138 }
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< SiPixelGainCalibrationServiceBase > theSiPixelGainCalibration_
edm::EDPutTokenT< SiPixelClusterCollectionNew > tPutPixelClusters
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
edm::EDGetTokenT< SiPixelClusterCollectionNew > tPixelClusters
Definition: output.py:1
void run(const T &input, const edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
const TrackerTopology * tTopo_
def move(src, dest)
Definition: eostools.py:511
const std::string clusterMode_

◆ run()

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

References cms::cuda::assert(), clusterizer_, relativeConstraints::empty, relativeConstraints::geom, input, maxTotalClusters_, electrons_cff::numberOfClusters, and tTopo_.

Referenced by produce().

165  {
166  int numberOfClusters = 0;
167 
168  // Iterate on detector units
169  for (auto const& dsv : input) {
170  // LogDebug takes very long time, get rid off.
171  //LogDebug("SiStripClusterizer") << "[SiPixelClusterProducer::run] DetID" << dsv.id;
172 
173  std::vector<short> badChannels;
174  DetId detIdObject(dsv.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
191  clusterizer_->clusterizeDetUnit(dsv, 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
199  edm::LogError("TooManyClusters")
200  << "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 }
Log< level::Error, false > LogError
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
std::unique_ptr< PixelClusterizerBase > clusterizer_
const int32_t maxTotalClusters_
Optional limit on the total number of clusters.
Definition: DetId.h:17
Definition: output.py:1
const TrackerTopology * tTopo_

◆ setupClusterizer()

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

References clusterizer_, clusterMode_, Exception, and theSiPixelGainCalibration_.

Referenced by SiPixelClusterProducer().

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

Member Data Documentation

◆ clusterizer_

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

Definition at line 80 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

◆ clusterMode_

const std::string SiPixelClusterProducer::clusterMode_
private

Definition at line 79 of file SiPixelClusterProducer.h.

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

◆ maxTotalClusters_

const int32_t SiPixelClusterProducer::maxTotalClusters_
private

Optional limit on the total number of clusters.

Definition at line 84 of file SiPixelClusterProducer.h.

Referenced by run().

◆ theSiPixelGainCalibration_

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

Definition at line 78 of file SiPixelClusterProducer.h.

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

◆ tPixelClusters

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

Definition at line 72 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ tPixelDigi

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

Definition at line 73 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ tPutPixelClusters

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

Definition at line 74 of file SiPixelClusterProducer.h.

Referenced by produce().

◆ trackerGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelClusterProducer::trackerGeomToken_
private

Definition at line 76 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ trackerTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelClusterProducer::trackerTopoToken_
private

Definition at line 75 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ tTopo_

const TrackerTopology* SiPixelClusterProducer::tTopo_
private

Definition at line 81 of file SiPixelClusterProducer.h.

Referenced by produce(), and run().