55 src_(iConfig.getParameter<edm::
InputTag>(
"src")),
57 ignore_non_pattern_(iConfig.getParameter<bool>(
"ignoreNonPattern")),
58 control_pattern_size_(iConfig.getParameter<bool>(
"checkPatternEachEvent")),
59 includeErrors_(iConfig.getUntrackedParameter<bool>(
"includeErrors",
false)),
60 errorType(iConfig.getUntrackedParameter<int>(
"errorTypeNumber",1)),
62 number_of_pixels_per_pattern_(0),
63 use_realeventnumber_(iConfig.getParameter<bool>(
"useRealEventNumber"))
68 produces< edm::DetSetVector<SiPixelCalibDigi> >();
70 produces< edm::DetSetVector<SiPixelCalibDigiError> > ();
117 edm::LogInfo(
"SiPixelCalibProducer") <<
"in fill(), calibpoint " << icalibpoint <<
" ndigis " << pixelDigis->size() << std::endl;
120 for(digiIter=pixelDigis->begin(); digiIter!=pixelDigis->end(); ++digiIter){
121 uint32_t detid = digiIter->id;
124 for(ipix = digiIter->data.
begin(); ipix!=digiIter->
end(); ++ipix){
126 fillPixel(detid,ipix->row(),ipix->column(),icalibpoint,ipix->adc());
139 for(
int fedid=0; fedid<=40; ++fedid){
142 if(converter.hasDetUnit(detid)){
159 edm::LogError(
"SiPixelCalibDigiProducer") <<
" was unable to match detid " << detid <<
" to a FED!" << std::endl;
168 temppixelworker.first=detid;
169 temppixelworker.second.first=row;
170 temppixelworker.second.second=
col;
171 std::map<pixelstruct,SiPixelCalibDigi>::const_iterator ipix =
intermediate_data_.find(temppixelworker);
217 uint32_t rowpatternnumber = patternnumber/
calib_->nColumnPatterns();
218 uint32_t colpatternnumber = patternnumber%
calib_->nColumnPatterns();
219 edm::LogInfo(
"SiPixelCalibDigiProducer") <<
" rowpatternnumbers = " << rowpatternnumber <<
" " << colpatternnumber <<
" " << patternnumber << std::endl;
221 std::vector<short> calibcols =
calib_->getColumnPattern();
222 std::vector<short> calibrows =
calib_->getRowPattern();
223 std::vector<short> temprowvals(0);
224 std::vector<short> tempcolvals(0);
225 uint32_t nminuscol=0;
226 uint32_t nminusrow=0;
227 uint32_t npatterns=0;
228 for(uint32_t icol=0; icol<calibcols.size(); icol++){
229 if(calibcols[icol]==-1){
232 else if(nminuscol==colpatternnumber){
234 short val=calibcols[icol];
235 tempcolvals.push_back(val);
237 else if (nminuscol> colpatternnumber)
240 for(uint32_t irow=0; irow<calibrows.size(); irow++){
242 if(calibrows[irow]==-1)
244 else if(nminusrow==rowpatternnumber){
245 short val=calibrows[irow];
246 temprowvals.push_back(val);
248 else if(nminusrow>rowpatternnumber)
255 for(uint32_t irow=0; irow<temprowvals.size(); irow++){
256 for(uint32_t icol=0; icol<tempcolvals.size(); icol++){
257 std::pair<short,short>
pattern(temprowvals[irow],tempcolvals[icol]);
297 uint32_t detid=idet->first.first;
299 if(!
checkPixel(idet->first.first,idet->first.second.first,idet->first.second.second))
306 detSet.
data.push_back(tempdigi);
309 for(std::map<pixelstruct,SiPixelCalibDigiError>::const_iterator ierr=
error_data_.begin(); ierr!=
error_data_.end();++ierr){
310 uint32_t detid=ierr->first.first;
313 errSet.
data.push_back(temperror);
344 formatter.toCabling(cabling,detector);
361 std::ostringstream errorlog;
362 errorlog <<
"DETID "<<detid<<
", row, col (offline)="<<row<<
","<<col<<
" row, col (ROC) ="<<
currentpair_.first<<
","<<
currentpair_.second<<
" found no match in list of patterns: " ;
376 temppixelworker.first=detid;
377 temppixelworker.second.first=row;
378 temppixelworker.second.second=
col;
379 std::map<pixelstruct,SiPixelCalibDigiError>::const_iterator ierr =
error_data_.find(temppixelworker);
int adc(sample_type sample)
get the ADC sample (12 bits)
EventNumber_t event() const
std::pair< uint32_t, std::pair< short, short > > pixelstruct
virtual void fill(edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual bool checkFED(uint32_t detid)
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< uint32_t, uint32_t > detid_to_fedid_
identify pixel inside single ROC
std::map< pixelstruct, SiPixelCalibDigi > intermediate_data_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::ESHandle< SiPixelFedCablingMap > theCablingMap_
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
bool use_realeventnumber_
void setrowcol(uint16_t row, uint16_t col)
Abs< T >::type abs(const T &t)
virtual bool checkPixel(uint32_t detid, short row, short col)
std::map< pixelstruct, SiPixelCalibDigiError > error_data_
iterator end()
Return the off-the-end iterator.
double collumn and pixel ID in double collumn representation
std::vector< std::pair< short, short > > currentpattern_
~SiPixelCalibDigiProducer()
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_
SiPixelCalibDigiProducer(const edm::ParameterSet &iConfig)
edm::ESHandle< SiPixelCalibConfiguration > calib_
iterator begin()
Return an iterator to the first DetSet.
volatile std::atomic< bool > shutdown_flag false
std::pair< short, short > currentpair_
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
edm::ESHandle< TrackerGeometry > theGeometry_