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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () 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::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.

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

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

◆ ~SiPixelClusterProducer()

SiPixelClusterProducer::~SiPixelClusterProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 74 of file SiPixelClusterProducer.cc.

74  {
76 
77  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigis"));
78  desc.add<std::string>("ClusterMode", "PixelThresholdClusterizer");
79  desc.add<int>("maxNumberOfClusters", -1)->setComment("-1 means no limit");
80  desc.add<std::string>("payloadType", "Offline")
81  ->setComment("Options: HLT - column granularity, Offline - gain:col/ped:pix");
82 
84  SiPixelGainCalibrationServiceBase::fillPSetDescription(desc); // no-op, but in principle the structures are there...
85 
86  descriptions.add("SiPixelClusterizerDefault", desc);
87 }

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

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

92  {
93  //Setup gain calibration service
94  theSiPixelGainCalibration_->setESObjects(es);
95 
96  // Step A.1: get input data
99  if (clusterMode_ == "PixelThresholdReclusterizer")
100  e.getByToken(tPixelClusters, inputClusters);
101  else
102  e.getByToken(tPixelDigi, inputDigi);
103 
104  // Step A.2: get event setup
107 
108  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
109  es.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
110  tTopo_ = trackerTopologyHandle.product();
111 
112  // Step B: create the final output collection
113  auto output = std::make_unique<SiPixelClusterCollectionNew>();
114  //FIXME: put a reserve() here
115 
116  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
117  // on each DetUnit
118  if (clusterMode_ == "PixelThresholdReclusterizer")
119  run(*inputClusters, geom, *output);
120  else
121  run(*inputDigi, geom, *output);
122 
123  // Step D: write output to file
124  output->shrink_to_fit();
126 }

References clusterMode_, MillePedeFileConverter_cfg::e, relativeConstraints::geom, edm::EventSetup::get(), get, eostools::move(), convertSQLitetoXML_cfg::output, edm::ESHandle< T >::product(), run(), theSiPixelGainCalibration_, tPixelClusters, tPixelDigi, tPutPixelClusters, and tTopo_.

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

151  {
152  int numberOfDetUnits = 0;
153  int numberOfClusters = 0;
154 
155  // Iterate on detector units
156  typename T::const_iterator DSViter = input.begin();
157  for (; DSViter != input.end(); DSViter++) {
158  ++numberOfDetUnits;
159 
160  // LogDebug takes very long time, get rid off.
161  //LogDebug("SiStripClusterizer") << "[SiPixelClusterProducer::run] DetID" << DSViter->id;
162 
163  std::vector<short> badChannels;
164  DetId detIdObject(DSViter->detId());
165 
166  // Comment: At the moment the clusterizer depends on geometry
167  // to access information as the pixel topology (number of columns
168  // and rows in a detector module).
169  // In the future the geometry service will be replaced with
170  // a ES service.
171  const GeomDetUnit* geoUnit = geom->idToDetUnit(detIdObject);
172  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit);
173  if (!pixDet) {
174  // Fatal error! TO DO: throw an exception!
175  assert(0);
176  }
177  {
178  // Produce clusters for this DetUnit and store them in
179  // a DetSet
181  clusterizer_->clusterizeDetUnit(*DSViter, pixDet, tTopo_, badChannels, spc);
182  if (spc.empty()) {
183  spc.abort();
184  } else {
185  numberOfClusters += spc.size();
186  }
187  } // spc is not deleted and detsetvector updated
188  if ((maxTotalClusters_ >= 0) && (numberOfClusters > maxTotalClusters_)) {
189  edm::LogError("TooManyClusters")
190  << "Limit on the number of clusters exceeded. An empty cluster collection will be produced instead.\n";
192  empty.swap(output);
193  break;
194  }
195  } // end of DetUnit loop
196 
197  //LogDebug ("SiPixelClusterProducer") << " Executing "
198  // << clusterMode_ << " resulted in " << numberOfClusters
199  // << " SiPixelClusters in " << numberOfDetUnits << " DetUnits.";
200 }

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

Referenced by produce().

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

133  {
134  if (clusterMode_ == "PixelThresholdReclusterizer" || clusterMode_ == "PixelThresholdClusterizer") {
135  clusterizer_ = std::make_unique<PixelThresholdClusterizer>(conf);
136  clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_.get());
137  } else {
138  throw cms::Exception("Configuration") << "[SiPixelClusterProducer]:"
139  << " choice " << clusterMode_ << " is invalid.\n"
140  << "Possible choices:\n"
141  << " PixelThresholdClusterizer";
142  }
143 }

References clusterizer_, clusterMode_, Exception, and theSiPixelGainCalibration_.

Referenced by SiPixelClusterProducer().

Member Data Documentation

◆ clusterizer_

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

Definition at line 77 of file SiPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

◆ clusterMode_

const std::string SiPixelClusterProducer::clusterMode_
private

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

Referenced by run().

◆ theSiPixelGainCalibration_

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

Definition at line 75 of file SiPixelClusterProducer.h.

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

◆ tPixelClusters

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

Definition at line 71 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ tPixelDigi

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

Definition at line 72 of file SiPixelClusterProducer.h.

Referenced by produce(), and SiPixelClusterProducer().

◆ tPutPixelClusters

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

Definition at line 73 of file SiPixelClusterProducer.h.

Referenced by produce().

◆ tTopo_

const TrackerTopology* SiPixelClusterProducer::tTopo_
private

Definition at line 78 of file SiPixelClusterProducer.h.

Referenced by produce(), and run().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiPixelClusterProducer::tPixelClusters
edm::EDGetTokenT< SiPixelClusterCollectionNew > tPixelClusters
Definition: SiPixelClusterProducer.h:71
SiPixelClusterProducer::run
void run(const T &input, const edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output)
Iterate over DetUnits, and invoke the PixelClusterizer on each.
Definition: SiPixelClusterProducer.cc:149
input
static const std::string input
Definition: EdmProvDump.cc:48
GeomDet
Definition: GeomDet.h:27
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
SiPixelClusterProducer::clusterMode_
const std::string clusterMode_
Definition: SiPixelClusterProducer.h:76
SiPixelClusterProducer::tPutPixelClusters
edm::EDPutTokenT< SiPixelClusterCollectionNew > tPutPixelClusters
Definition: SiPixelClusterProducer.h:73
edm::Handle
Definition: AssociativeIterator.h:50
DetId
Definition: DetId.h:17
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SiPixelClusterProducer::tTopo_
const TrackerTopology * tTopo_
Definition: SiPixelClusterProducer.h:78
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
SiPixelClusterProducer::tPixelDigi
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
Definition: SiPixelClusterProducer.h:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelClusterProducer::clusterizer_
std::unique_ptr< PixelClusterizerBase > clusterizer_
Definition: SiPixelClusterProducer.h:77
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
SiPixelGainCalibrationServiceBase::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: SiPixelGainCalibrationServiceBase.h:36
edmNew::DetSetVector
Definition: DetSetNew.h:13
HLT_FULL_cff.payloadType
payloadType
Definition: HLT_FULL_cff.py:9452
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiPixelClusterProducer::maxTotalClusters_
const int32_t maxTotalClusters_
Optional limit on the total number of clusters.
Definition: SiPixelClusterProducer.h:81
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiPixelClusterProducer::theSiPixelGainCalibration_
std::unique_ptr< SiPixelGainCalibrationServiceBase > theSiPixelGainCalibration_
Definition: SiPixelClusterProducer.h:75
edm::InputTag
Definition: InputTag.h:15
PixelThresholdClusterizer::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: PixelThresholdClusterizer.cc:70
SiPixelClusterProducer::setupClusterizer
void setupClusterizer(const edm::ParameterSet &conf)
Definition: SiPixelClusterProducer.cc:133
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37