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>>();
98 edm::LogInfo(
"SiPixelCalibProducer") <<
"in fill(), calibpoint " << icalibpoint <<
" ndigis " << pixelDigis->size()
102 for (digiIter = pixelDigis->begin(); digiIter != pixelDigis->end(); ++digiIter) {
103 uint32_t detid = digiIter->id;
106 for (ipix = digiIter->data.
begin(); ipix != digiIter->
end(); ++ipix) {
108 fillPixel(detid, ipix->row(), ipix->column(), icalibpoint, ipix->adc());
121 for (
int fedid = 0; fedid <= 40; ++fedid) {
127 <<
"matched detid " << detid <<
" to fed " <<
detid_to_fedid_[detid] << std::endl;
142 edm::LogError(
"SiPixelCalibDigiProducer") <<
" was unable to match detid " << detid <<
" to a FED!" << std::endl;
151 temppixelworker.first = detid;
152 temppixelworker.second.first = row;
153 temppixelworker.second.second =
col;
154 std::map<pixelstruct, SiPixelCalibDigi>::const_iterator ipix =
intermediate_data_.find(temppixelworker);
179 edm::LogError(
"SiPixelCalibDigiProducer") <<
"Number of pixels in pattern is now: " << tempsize <<
", size is was " 201 <<
" rowpatternnumbers = " << rowpatternnumber <<
" " << colpatternnumber <<
" " << patternnumber << std::endl;
205 std::vector<short> temprowvals(0);
206 std::vector<short> tempcolvals(0);
207 uint32_t nminuscol = 0;
208 uint32_t nminusrow = 0;
209 uint32_t npatterns = 0;
210 for (uint32_t icol = 0; icol < calibcols.size(); icol++) {
211 if (calibcols[icol] == -1) {
213 }
else if (nminuscol == colpatternnumber) {
215 short val = calibcols[icol];
216 tempcolvals.push_back(val);
217 }
else if (nminuscol > colpatternnumber)
220 for (uint32_t irow = 0; irow < calibrows.size(); irow++) {
222 if (calibrows[irow] == -1)
224 else if (nminusrow == rowpatternnumber) {
225 short val = calibrows[irow];
226 temprowvals.push_back(val);
227 }
else if (nminusrow > rowpatternnumber)
231 while (
currentpattern_.size() > temprowvals.size() * tempcolvals.size()) {
234 for (uint32_t irow = 0; irow < temprowvals.size(); irow++) {
235 for (uint32_t icol = 0; icol < tempcolvals.size(); icol++) {
236 std::pair<short, short>
pattern(temprowvals[irow], tempcolvals[icol]);
264 fill(iEvent, iSetup);
266 auto pOut = std::make_unique<edm::DetSetVector<SiPixelCalibDigi>>();
267 auto pErr = std::make_unique<edm::DetSetVector<SiPixelCalibDigiError>>();
272 for (std::map<pixelstruct, SiPixelCalibDigi>::const_iterator idet =
intermediate_data_.begin();
275 uint32_t detid = idet->first.first;
277 if (!
checkPixel(idet->first.first, idet->first.second.first, idet->first.second.second))
283 detSet.
data.push_back(tempdigi);
286 for (std::map<pixelstruct, SiPixelCalibDigiError>::const_iterator ierr =
error_data_.begin();
289 uint32_t detid = ierr->first.first;
292 errSet.
data.push_back(temperror);
322 formatter.toCabling(cabling, detector);
339 std::ostringstream errorlog;
340 errorlog <<
"DETID " << detid <<
", row, col (offline)=" << row <<
"," << col
342 <<
" found no match in list of patterns: ";
356 temppixelworker.first = detid;
357 temppixelworker.second.first = row;
358 temppixelworker.second.second =
col;
359 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)
std::vector< short > getRowPattern() const
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()
uint32_t nColumnPatterns() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< pixelstruct, SiPixelCalibDigiError > error_data_
std::map< pixelstruct, SiPixelCalibDigi > intermediate_data_
identify pixel inside single ROC
std::vector< std::pair< short, short > > currentpattern_
#define DEFINE_FWK_MODULE(type)
uint32_t expectedTotalEvents() const
short vcalIndexForEvent(const uint32_t &eventnumber) const
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)
virtual bool checkPixel(uint32_t detid, short row, short col)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
iterator end()
Return the off-the-end iterator.
double collumn and pixel ID in double collumn representation
std::pair< uint32_t, std::pair< short, short > > pixelstruct
~SiPixelCalibDigiProducer() override
std::vector< short > getColumnPattern() 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_
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_
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
short getNTriggers() const
T const * product() const
edm::ESHandle< TrackerGeometry > theGeometry_