#include <SiPixelClusterProducer.h>
Public Member Functions | |
virtual void | beginJob () |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
The "Event" entrypoint: gets called by framework for every event. | |
void | run (const edm::DetSetVector< PixelDigi > &input, edm::ESHandle< TrackerGeometry > &geom, edmNew::DetSetVector< SiPixelCluster > &output) |
Iterate over DetUnits, and invoke the PixelClusterizer on each. | |
void | setupClusterizer () |
SiPixelClusterProducer (const edm::ParameterSet &conf) | |
Constructor: set the ParameterSet and defer all thinking to setupClusterizer(). | |
virtual | ~SiPixelClusterProducer () |
Private Attributes | |
PixelClusterizerBase * | clusterizer_ |
std::string | clusterMode_ |
edm::ParameterSet | conf_ |
int32_t | maxTotalClusters_ |
Optional limit on the total number of clusters. | |
bool | readyToCluster_ |
edm::InputTag | src_ |
SiPixelGainCalibrationServiceBase * | theSiPixelGainCalibration_ |
Definition at line 58 of file SiPixelClusterProducer.h.
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(), ExpressReco_HICollisions_FallBack::payloadType, setupClusterizer(), and theSiPixelGainCalibration_.
: conf_(conf), theSiPixelGainCalibration_(0), clusterMode_("None"), // bogus clusterizer_(0), // the default, in case we fail to make one readyToCluster_(false), // since we obviously aren't src_( conf.getParameter<edm::InputTag>( "src" ) ), maxTotalClusters_( conf.getParameter<int32_t>( "maxNumberOfClusters" ) ) { //--- Declare to the EDM what kind of collections we will be making. produces<SiPixelClusterCollectionNew>(); std::string payloadType = conf.getParameter<std::string>( "payloadType" ); if (strcmp(payloadType.c_str(), "HLT") == 0) theSiPixelGainCalibration_ = new SiPixelGainCalibrationForHLTService(conf); else if (strcmp(payloadType.c_str(), "Offline") == 0) theSiPixelGainCalibration_ = new SiPixelGainCalibrationOfflineService(conf); else if (strcmp(payloadType.c_str(), "Full") == 0) theSiPixelGainCalibration_ = new SiPixelGainCalibrationService(conf); //--- Make the algorithm(s) according to what the user specified //--- in the ParameterSet. setupClusterizer(); }
SiPixelClusterProducer::~SiPixelClusterProducer | ( | ) | [virtual] |
Definition at line 80 of file SiPixelClusterProducer.cc.
References clusterizer_, and theSiPixelGainCalibration_.
{ delete clusterizer_; delete theSiPixelGainCalibration_; }
void SiPixelClusterProducer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 86 of file SiPixelClusterProducer.cc.
References clusterizer_, PixelClusterizerBase::setSiPixelGainCalibrationService(), and theSiPixelGainCalibration_.
{ edm::LogInfo("SiPixelClusterizer") << "[SiPixelClusterizer::beginJob]"; clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_); }
void SiPixelClusterProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
The "Event" entrypoint: gets called by framework for every event.
Implements edm::EDProducer.
Definition at line 95 of file SiPixelClusterProducer.cc.
References relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByLabel(), collect_tpl::input, convertSQLitetoXML_cfg::output, edm::Event::put(), run(), SiPixelGainCalibrationServiceBase::setESObjects(), src_, and theSiPixelGainCalibration_.
{ //Setup gain calibration service theSiPixelGainCalibration_->setESObjects( es ); // Step A.1: get input data //edm::Handle<PixelDigiCollection> pixDigis; edm::Handle< edm::DetSetVector<PixelDigi> > input; e.getByLabel( src_, input); // Step A.2: get event setup edm::ESHandle<TrackerGeometry> geom; es.get<TrackerDigiGeometryRecord>().get( geom ); // Step B: create the final output collection std::auto_ptr<SiPixelClusterCollectionNew> output( new SiPixelClusterCollectionNew() ); //FIXME: put a reserve() here // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm // on each DetUnit run(*input, geom, *output ); // Step D: write output to file e.put( output ); }
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 148 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().
{ if ( ! readyToCluster_ ) { edm::LogError("SiPixelClusterProducer") <<" at least one clusterizer is not ready -- can't run!" ; // TO DO: throw an exception here? The user may want to know... return; // clusterizer is invalid, bail out } int numberOfDetUnits = 0; int numberOfClusters = 0; // Iterate on detector units edm::DetSetVector<PixelDigi>::const_iterator DSViter = input.begin(); for( ; DSViter != input.end(); DSViter++) { ++numberOfDetUnits; // LogDebug takes very long time, get rid off. //LogDebug("SiStripClusterizer") << "[SiPixelClusterProducer::run] DetID" << DSViter->id; std::vector<short> badChannels; DetId detIdObject(DSViter->detId()); // Comment: At the moment the clusterizer depends on geometry // to access information as the pixel topology (number of columns // and rows in a detector module). // In the future the geometry service will be replaced with // a ES service. const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject ); const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit); if (! pixDet) { // Fatal error! TO DO: throw an exception! assert(0); } // Produce clusters for this DetUnit and store them in // a DetSet edmNew::DetSetVector<SiPixelCluster>::FastFiller spc(output, DSViter->detId()); clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc); if ( spc.empty() ) { spc.abort(); } else { numberOfClusters += spc.size(); } if ((maxTotalClusters_ >= 0) && (numberOfClusters > maxTotalClusters_)) { edm::LogError("TooManyClusters") << "Limit on the number of clusters exceeded. An empty cluster collection will be produced instead.\n"; edmNew::DetSetVector<SiPixelCluster> empty; empty.swap(output); break; } } // end of DetUnit loop //LogDebug ("SiPixelClusterProducer") << " Executing " // << clusterMode_ << " resulted in " << numberOfClusters // << " SiPixelClusters in " << numberOfDetUnits << " DetUnits."; }
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 128 of file SiPixelClusterProducer.cc.
References clusterizer_, clusterMode_, conf_, edm::ParameterSet::getUntrackedParameter(), and readyToCluster_.
Referenced by SiPixelClusterProducer().
{ clusterMode_ = conf_.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer"); if ( clusterMode_ == "PixelThresholdClusterizer" ) { clusterizer_ = new PixelThresholdClusterizer(conf_); readyToCluster_ = true; } else { edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:" <<" choice " << clusterMode_ << " is invalid.\n" << "Possible choices:\n" << " PixelThresholdClusterizer"; readyToCluster_ = false; } }
Definition at line 83 of file SiPixelClusterProducer.h.
Referenced by beginJob(), run(), setupClusterizer(), and ~SiPixelClusterProducer().
std::string cms::SiPixelClusterProducer::clusterMode_ [private] |
Definition at line 82 of file SiPixelClusterProducer.h.
Referenced by setupClusterizer().
Definition at line 79 of file SiPixelClusterProducer.h.
Referenced by setupClusterizer().
int32_t cms::SiPixelClusterProducer::maxTotalClusters_ [private] |
Optional limit on the total number of clusters.
Definition at line 88 of file SiPixelClusterProducer.h.
Referenced by run().
bool cms::SiPixelClusterProducer::readyToCluster_ [private] |
Definition at line 84 of file SiPixelClusterProducer.h.
Referenced by run(), and setupClusterizer().
Definition at line 85 of file SiPixelClusterProducer.h.
Referenced by produce().
SiPixelGainCalibrationServiceBase* cms::SiPixelClusterProducer::theSiPixelGainCalibration_ [private] |
Definition at line 81 of file SiPixelClusterProducer.h.
Referenced by beginJob(), produce(), SiPixelClusterProducer(), and ~SiPixelClusterProducer().