![]() |
![]() |
#include <RecoLocalTracker/SiPixelClusterizer/interface/SiPixelClusterProducer.h>
Public Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
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 () |
Set up the specific algorithm we are going to use. | |
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_ |
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(), HLT_VtxMuL3::payloadType, setupClusterizer(), and theSiPixelGainCalibration_.
00052 : 00053 conf_(conf), 00054 theSiPixelGainCalibration_(0), 00055 clusterMode_("None"), // bogus 00056 clusterizer_(0), // the default, in case we fail to make one 00057 readyToCluster_(false), // since we obviously aren't 00058 src_( conf.getParameter<edm::InputTag>( "src" ) ) 00059 { 00060 //--- Declare to the EDM what kind of collections we will be making. 00061 produces<SiPixelClusterCollectionNew>(); 00062 00063 std::string payloadType = conf.getParameter<std::string>( "payloadType" ); 00064 00065 if (strcmp(payloadType.c_str(), "HLT") == 0) 00066 theSiPixelGainCalibration_ = new SiPixelGainCalibrationForHLTService(conf); 00067 else if (strcmp(payloadType.c_str(), "Offline") == 0) 00068 theSiPixelGainCalibration_ = new SiPixelGainCalibrationOfflineService(conf); 00069 else if (strcmp(payloadType.c_str(), "Full") == 0) 00070 theSiPixelGainCalibration_ = new SiPixelGainCalibrationService(conf); 00071 00072 //--- Make the algorithm(s) according to what the user specified 00073 //--- in the ParameterSet. 00074 setupClusterizer(); 00075 00076 }
SiPixelClusterProducer::~SiPixelClusterProducer | ( | ) | [virtual] |
void SiPixelClusterProducer::beginJob | ( | const edm::EventSetup & | es | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 83 of file SiPixelClusterProducer.cc.
00083 { 00084 edm::LogInfo("SiPixelClusterizer") << "[SiPixelClusterizer::beginJob]"; 00085 clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_); 00086 }
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 91 of file SiPixelClusterProducer.cc.
References edm::EventSetup::get(), edm::Event::getByLabel(), iggi_31X_cfg::input, output(), edm::Event::put(), and mergeAndRegister_online::run.
00092 { 00093 00094 //Setup gain calibration service 00095 theSiPixelGainCalibration_->setESObjects( es ); 00096 00097 // Step A.1: get input data 00098 //edm::Handle<PixelDigiCollection> pixDigis; 00099 edm::Handle< edm::DetSetVector<PixelDigi> > input; 00100 e.getByLabel( src_, input); 00101 00102 // Step A.2: get event setup 00103 edm::ESHandle<TrackerGeometry> geom; 00104 es.get<TrackerDigiGeometryRecord>().get( geom ); 00105 00106 // Step B: create the final output collection 00107 std::auto_ptr<SiPixelClusterCollectionNew> output( new SiPixelClusterCollectionNew() ); 00108 //FIXME: put a reserve() here 00109 00110 // Step C: Iterate over DetIds and invoke the pixel clusterizer algorithm 00111 // on each DetUnit 00112 run(*input, geom, *output ); 00113 00114 // Step D: write output to file 00115 e.put( output ); 00116 00117 }
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 144 of file SiPixelClusterProducer.cc.
References edm::DetSetVector< T >::begin(), and edm::DetSetVector< T >::end().
00146 { 00147 if ( ! readyToCluster_ ) { 00148 edm::LogError("SiPixelClusterProducer") 00149 <<" at least one clusterizer is not ready -- can't run!" ; 00150 // TO DO: throw an exception here? The user may want to know... 00151 return; // clusterizer is invalid, bail out 00152 } 00153 00154 int numberOfDetUnits = 0; 00155 int numberOfClusters = 0; 00156 00157 // Iterate on detector units 00158 edm::DetSetVector<PixelDigi>::const_iterator DSViter = input.begin(); 00159 for( ; DSViter != input.end(); DSViter++) { 00160 ++numberOfDetUnits; 00161 00162 // LogDebug takes very long time, get rid off. 00163 //LogDebug("SiStripClusterizer") << "[SiPixelClusterProducer::run] DetID" << DSViter->id; 00164 00165 std::vector<short> badChannels; 00166 DetId detIdObject(DSViter->detId()); 00167 00168 // Comment: At the moment the clusterizer depends on geometry 00169 // to access information as the pixel topology (number of columns 00170 // and rows in a detector module). 00171 // In the future the geometry service will be replaced with 00172 // a ES service. 00173 const GeomDetUnit * geoUnit = geom->idToDetUnit( detIdObject ); 00174 const PixelGeomDetUnit * pixDet = dynamic_cast<const PixelGeomDetUnit*>(geoUnit); 00175 if (! pixDet) { 00176 // Fatal error! TO DO: throw an exception! 00177 assert(0); 00178 } 00179 // Produce clusters for this DetUnit and store them in 00180 // a DetSet 00181 edmNew::DetSetVector<SiPixelCluster>::FastFiller spc(output, DSViter->detId()); 00182 clusterizer_->clusterizeDetUnit(*DSViter, pixDet, badChannels, spc); 00183 if ( spc.empty() ) { 00184 spc.abort(); 00185 } else { 00186 numberOfClusters += spc.size(); 00187 } 00188 00189 } // end of DetUnit loop 00190 00191 //LogDebug ("SiPixelClusterProducer") << " Executing " 00192 // << clusterMode_ << " resulted in " << numberOfClusters 00193 // << " SiPixelClusters in " << numberOfDetUnits << " DetUnits."; 00194 }
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 124 of file SiPixelClusterProducer.cc.
Referenced by SiPixelClusterProducer().
00124 { 00125 clusterMode_ = 00126 conf_.getUntrackedParameter<std::string>("ClusterMode","PixelThresholdClusterizer"); 00127 00128 if ( clusterMode_ == "PixelThresholdClusterizer" ) { 00129 clusterizer_ = new PixelThresholdClusterizer(conf_); 00130 readyToCluster_ = true; 00131 } 00132 else { 00133 edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:" 00134 <<" choice " << clusterMode_ << " is invalid.\n" 00135 << "Possible choices:\n" 00136 << " PixelThresholdClusterizer"; 00137 readyToCluster_ = false; 00138 } 00139 }
Definition at line 82 of file SiPixelClusterProducer.h.
std::string cms::SiPixelClusterProducer::clusterMode_ [private] |
Definition at line 81 of file SiPixelClusterProducer.h.
Definition at line 78 of file SiPixelClusterProducer.h.
Definition at line 83 of file SiPixelClusterProducer.h.
Definition at line 84 of file SiPixelClusterProducer.h.