48 : src_(iConfig.getParameter<edm::
InputTag>(
"src")),
50 ignore_non_pattern_(iConfig.getParameter<bool>(
"ignoreNonPattern")),
51 control_pattern_size_(iConfig.getParameter<bool>(
"checkPatternEachEvent")),
52 includeErrors_(iConfig.getUntrackedParameter<bool>(
"includeErrors",
false)),
53 errorType(iConfig.getUntrackedParameter<int>(
"errorTypeNumber", 1)),
55 number_of_pixels_per_pattern_(0),
56 use_realeventnumber_(iConfig.getParameter<bool>(
"useRealEventNumber"))
61 produces<edm::DetSetVector<SiPixelCalibDigi>>();
63 produces<edm::DetSetVector<SiPixelCalibDigiError>>();
65 calibToken_ = esConsumes<SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd>();
67 cablingMapToken_ = esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>();
102 edm::LogInfo(
"SiPixelCalibProducer") <<
"in fill(), calibpoint " << icalibpoint <<
" ndigis " << pixelDigis->size()
106 for (digiIter = pixelDigis->begin(); digiIter != pixelDigis->end(); ++digiIter) {
107 uint32_t detid = digiIter->id;
110 for (ipix = digiIter->data.
begin(); ipix != digiIter->
end(); ++ipix) {
112 fillPixel(detid, ipix->row(), ipix->column(), icalibpoint, ipix->adc());
125 for (
int fedid = 0; fedid <= 40; ++fedid) {
128 if (converter.hasDetUnit(detid)) {
131 <<
"matched detid " << detid <<
" to fed " <<
detid_to_fedid_[detid] << std::endl;
146 edm::LogError(
"SiPixelCalibDigiProducer") <<
" was unable to match detid " << detid <<
" to a FED!" << std::endl;
155 temppixelworker.first = detid;
156 temppixelworker.second.first = row;
157 temppixelworker.second.second =
col;
158 std::map<pixelstruct, SiPixelCalibDigi>::const_iterator ipix =
intermediate_data_.find(temppixelworker);
183 edm::LogError(
"SiPixelCalibDigiProducer") <<
"Number of pixels in pattern is now: " << tempsize <<
", size is was "
202 uint32_t rowpatternnumber = patternnumber /
calib_->nColumnPatterns();
203 uint32_t colpatternnumber = patternnumber %
calib_->nColumnPatterns();
205 <<
" rowpatternnumbers = " << rowpatternnumber <<
" " << colpatternnumber <<
" " << patternnumber << std::endl;
207 std::vector<short> calibcols =
calib_->getColumnPattern();
208 std::vector<short> calibrows =
calib_->getRowPattern();
209 std::vector<short> temprowvals(0);
210 std::vector<short> tempcolvals(0);
211 uint32_t nminuscol = 0;
212 uint32_t nminusrow = 0;
213 uint32_t npatterns = 0;
214 for (uint32_t icol = 0; icol < calibcols.size(); icol++) {
215 if (calibcols[icol] == -1) {
217 }
else if (nminuscol == colpatternnumber) {
219 short val = calibcols[icol];
220 tempcolvals.push_back(val);
221 }
else if (nminuscol > colpatternnumber)
224 for (uint32_t irow = 0; irow < calibrows.size(); irow++) {
226 if (calibrows[irow] == -1)
228 else if (nminusrow == rowpatternnumber) {
229 short val = calibrows[irow];
230 temprowvals.push_back(val);
231 }
else if (nminusrow > rowpatternnumber)
235 while (
currentpattern_.size() > temprowvals.size() * tempcolvals.size()) {
238 for (uint32_t irow = 0; irow < temprowvals.size(); irow++) {
239 for (uint32_t icol = 0; icol < tempcolvals.size(); icol++) {
240 std::pair<short, short> pattern(temprowvals[irow], tempcolvals[icol]);
268 fill(iEvent, iSetup);
270 auto pOut = std::make_unique<edm::DetSetVector<SiPixelCalibDigi>>();
271 auto pErr = std::make_unique<edm::DetSetVector<SiPixelCalibDigiError>>();
276 for (std::map<pixelstruct, SiPixelCalibDigi>::const_iterator idet =
intermediate_data_.begin();
279 uint32_t detid = idet->first.first;
281 if (!
checkPixel(idet->first.first, idet->first.second.first, idet->first.second.second))
287 detSet.
data.push_back(tempdigi);
290 for (std::map<pixelstruct, SiPixelCalibDigiError>::const_iterator ierr =
error_data_.begin();
293 uint32_t detid = ierr->first.first;
296 errSet.
data.push_back(temperror);
326 formatter.toCabling(cabling, detector);
343 std::ostringstream errorlog;
344 errorlog <<
"DETID " << detid <<
", row, col (offline)=" << row <<
"," << col
346 <<
" found no match in list of patterns: ";
360 temppixelworker.first = detid;
361 temppixelworker.second.first = row;
362 temppixelworker.second.second =
col;
363 std::map<pixelstruct, SiPixelCalibDigiError>::const_iterator ierr =
error_data_.find(temppixelworker);
EventNumber_t event() const
virtual void fill(edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual bool checkFED(uint32_t detid)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
uint32_t number_of_pixels_per_pattern_
virtual void setPattern()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::map< pixelstruct, SiPixelCalibDigiError > error_data_
std::map< pixelstruct, SiPixelCalibDigi > intermediate_data_
Log< level::Error, false > LogError
identify pixel inside single ROC
std::vector< std::pair< short, short > > currentpattern_
edm::ESHandle< SiPixelFedCablingMap > theCablingMap_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
bool use_realeventnumber_
void setrowcol(uint16_t row, uint16_t col)
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
virtual bool checkPixel(uint32_t detid, short row, short col)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
iterator end()
Return the off-the-end iterator.
double collumn and pixel ID in double collumn representation
Log< level::Info, false > LogInfo
std::pair< uint32_t, std::pair< short, short > > pixelstruct
~SiPixelCalibDigiProducer() override
T const * product() const
virtual void fillPixel(uint32_t detid, short row, short col, short ipoint, short adc)
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > tPixelDigi
bool control_pattern_size_
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd > calibToken_
SiPixelCalibDigiProducer(const edm::ParameterSet &iConfig)
edm::ESHandle< SiPixelCalibConfiguration > calib_
std::pair< short, short > currentpair_
iterator begin()
Return an iterator to the first DetSet.
std::map< uint32_t, uint32_t > detid_to_fedid_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
edm::ESHandle< TrackerGeometry > theGeometry_
uint16_t *__restrict__ uint16_t const *__restrict__ adc