CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Phase2ITPixelClusterProducer Class Referencefinal

EDProducer to cluster PixelDigis into Phase2ITPixelClusters. More...

#include <Phase2ITPixelClusterProducer.h>

Inheritance diagram for Phase2ITPixelClusterProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Phase2ITPixelClusterProducer (const edm::ParameterSet &conf)
 Constructor: set the ParameterSet and defer all thinking to setupClusterizer(). More...
 
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< Phase2ITPixelCluster > &output)
 Iterate over DetUnits, and invoke the Phase2ITPixelClusterizer on each. More...
 
void setupClusterizer ()
 
virtual ~Phase2ITPixelClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

Phase2ITPixelClusterizerBaseclusterizer_
 
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::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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

EDProducer to cluster PixelDigis into Phase2ITPixelClusters.

Phase2ITPixelClusterProducer is an EDProducer subclass (i.e., a module) which orchestrates clustering of PixelDigis to Phase2ITPixelClusters. Consequently, the input is edm::DetSetVector<PixelDigi> and the output is edmNew::DetSetVector<Phase2ITPixelCluster>.

Phase2ITPixelClusterProducer invokes one of descendents from Phase2ITPixelClusterizerBase, e.g. PixelThresholdClusterizer (which is the only available option right now). Phase2ITPixelClusterProducer loads the PixelDigis, and then iterates over DetIds, invoking Phase2ITPixelClusterizer's clusterizeDetUnit to perform the clustering. clusterizeDetUnit() returns a DetSetVector of Phase2ITPixelClusters, 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
Petar Maksimovic (JHU). DetSetVector implementation by Vincenzo Chiochia (Uni Zurich) Modify the local container (cache) to improve the speed. D.K. 5/07

Definition at line 49 of file Phase2ITPixelClusterProducer.h.

Constructor & Destructor Documentation

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

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

Phase2ITPixelClusterProducer.cc

Description: see Phase2ITPixelClusterProducer.h Author: P. Maksimovic (porting from original ORCA version) Get rid of the noiseVector. d.k. 28/3/06 Implementation of the DetSetVector container. V.Chiochia, May 06 Phase2ITPixelClusterCollection 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 Phase2ITPixelClusterProducer.cc.

References edm::ParameterSet::getParameter(), Phase2ITPixelClusterizer_cfi::payloadType, setupClusterizer(), src_, AlCaHLTBitMon_QueryRunRegistry::string, theSiPixelGainCalibration_, and tPixelDigi.

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

Definition at line 78 of file Phase2ITPixelClusterProducer.cc.

References clusterizer_, and theSiPixelGainCalibration_.

78  {
79  delete clusterizer_;
81  }
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
Phase2ITPixelClusterizerBase * clusterizer_

Member Function Documentation

void Phase2ITPixelClusterProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

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

Definition at line 87 of file Phase2ITPixelClusterProducer.cc.

References relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByToken(), input, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), run(), SiPixelGainCalibrationServiceBase::setESObjects(), theSiPixelGainCalibration_, and tPixelDigi.

88  {
89 
90  //Setup gain calibration service
92 
93  // Step A.1: get input data
94  //edm::Handle<PixelDigiCollection> pixDigis;
96  e.getByToken(tPixelDigi, input);
97 
98  // Step A.2: get event setup
100  es.get<TrackerDigiGeometryRecord>().get( geom );
101 
102  // Step B: create the final output collection
103  auto output = std::make_unique<Phase2ITPixelClusterCollectionNew>();
104  //FIXME: put a reserve() here
105 
106  // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm
107  // on each DetUnit
108  run(*input, geom, *output );
109 
110  // Step D: write output to file
111  output->shrink_to_fit();
112  e.put(std::move(output));
113 
114  }
virtual void setESObjects(const edm::EventSetup &es)=0
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
static std::string const input
Definition: EdmProvDump.cc:44
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
void run(const edm::DetSetVector< PixelDigi > &input, edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< Phase2ITPixelCluster > &output)
Iterate over DetUnits, and invoke the Phase2ITPixelClusterizer on each.
def move(src, dest)
Definition: eostools.py:510
void Phase2ITPixelClusterProducer::run ( const edm::DetSetVector< PixelDigi > &  input,
edm::ESHandle< TrackerGeometry > &  geom,
edmNew::DetSetVector< Phase2ITPixelCluster > &  output 
)

Iterate over DetUnits, and invoke the Phase2ITPixelClusterizer on each.

Definition at line 142 of file Phase2ITPixelClusterProducer.cc.

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

Referenced by produce().

144  {
145  if ( ! readyToCluster_ ) {
146  edm::LogError("Phase2ITPixelClusterProducer")
147  <<" at least one clusterizer is not ready -- can't run!" ;
148  // TO DO: throw an exception here? The user may want to know...
149  return; // clusterizer is invalid, bail out
150  }
151 
152  int numberOfDetUnits = 0;
153  int numberOfClusters = 0;
154 
155  // Iterate on detector units
157  for( ; DSViter != input.end(); DSViter++) {
158  ++numberOfDetUnits;
159 
160  // LogDebug takes very long time, get rid off.
161  //LogDebug("SiStripClusterizer") << "[Phase2ITPixelClusterProducer::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  // Produce clusters for this DetUnit and store them in
178  // a DetSet
179  edmNew::DetSetVector<Phase2ITPixelCluster>::FastFiller spc(output, DSViter->detId());
180  clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc);
181  if ( spc.empty() ) {
182  spc.abort();
183  } else {
184  numberOfClusters += spc.size();
185  }
186 
187  if ((maxTotalClusters_ >= 0) && (numberOfClusters > maxTotalClusters_)) {
188  edm::LogError("TooManyClusters") << "Limit on the number of clusters exceeded. An empty cluster collection will be produced instead.\n";
190  empty.swap(output);
191  break;
192  }
193  } // end of DetUnit loop
194 
195  //LogDebug ("Phase2ITPixelClusterProducer") << " Executing "
196  // << clusterMode_ << " resulted in " << numberOfClusters
197  // << " Phase2ITPixelClusters in " << numberOfDetUnits << " DetUnits.";
198  }
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
int32_t maxTotalClusters_
Optional limit on the total number of clusters.
void swap(DetSetVector &rh)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
Definition: DetId.h:18
Phase2ITPixelClusterizerBase * clusterizer_
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
virtual void clusterizeDetUnit(const edm::DetSet< PixelDigi > &input, const PixelGeomDetUnit *pixDet, const std::vector< short > &badChannels, edmNew::DetSetVector< Phase2ITPixelCluster >::FastFiller &output)=0
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
void Phase2ITPixelClusterProducer::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 121 of file Phase2ITPixelClusterProducer.cc.

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

Referenced by Phase2ITPixelClusterProducer().

121  {
122  clusterMode_ =
123  conf_.getUntrackedParameter<std::string>("ClusterMode","Phase2ITPixelThresholdClusterizer");
124 
125  if ( clusterMode_ == "Phase2ITPixelThresholdClusterizer" ) {
128  readyToCluster_ = true;
129  }
130  else {
131  edm::LogError("Phase2ITPixelClusterProducer") << "[Phase2ITPixelClusterProducer]:"
132  <<" choice " << clusterMode_ << " is invalid.\n"
133  << "Possible choices:\n"
134  << " Phase2ITPixelThresholdClusterizer";
135  readyToCluster_ = false;
136  }
137  }
T getUntrackedParameter(std::string const &, T const &) const
A specific threshold-based pixel clustering algorithm.
void setSiPixelGainCalibrationService(SiPixelGainCalibrationServiceBase *in)
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_
Phase2ITPixelClusterizerBase * clusterizer_

Member Data Documentation

Phase2ITPixelClusterizerBase* Phase2ITPixelClusterProducer::clusterizer_
private
std::string Phase2ITPixelClusterProducer::clusterMode_
private

Definition at line 70 of file Phase2ITPixelClusterProducer.h.

Referenced by setupClusterizer().

edm::ParameterSet Phase2ITPixelClusterProducer::conf_
private

Definition at line 66 of file Phase2ITPixelClusterProducer.h.

Referenced by setupClusterizer().

int32_t Phase2ITPixelClusterProducer::maxTotalClusters_
private

Optional limit on the total number of clusters.

Definition at line 76 of file Phase2ITPixelClusterProducer.h.

Referenced by run().

bool Phase2ITPixelClusterProducer::readyToCluster_
private

Definition at line 72 of file Phase2ITPixelClusterProducer.h.

Referenced by run(), and setupClusterizer().

edm::InputTag Phase2ITPixelClusterProducer::src_
private

Definition at line 73 of file Phase2ITPixelClusterProducer.h.

Referenced by Phase2ITPixelClusterProducer().

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

Definition at line 67 of file Phase2ITPixelClusterProducer.h.

Referenced by Phase2ITPixelClusterProducer(), and produce().