58 std::vector<edm::InputTag> badPixelFEDChannelCollectionLabels_ = iConfig.
getParameter<
edm::ParameterSet>(
"SiPixelStatusProducerParameters").getParameter<std::vector<edm::InputTag> >(
"badPixelFEDChannelCollections");
59 for (
auto &
t : badPixelFEDChannelCollectionLabels_)
60 theBadPixelFEDChannelsTokens_.push_back(consumes<PixelFEDChannelCollection>(
t));
63 fPixelClusterLabel_ = iConfig.
getParameter<
edm::ParameterSet>(
"SiPixelStatusProducerParameters").getUntrackedParameter<edm::InputTag>(
"pixelClusterLabel");
64 fSiPixelClusterToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(fPixelClusterLabel_);
70 beginLumi_ = endLumi_ = -1;
71 endLumi_ = endRun_ = -1;
73 produces<SiPixelDetectorStatus, edm::Transition::EndLuminosityBlock>(
"siPixelStatus");
85 <<
"beginlumi setup "<<endl;
87 if ( countLumi_ == 0 && resetNLumi_ > 0 ) {
90 beginRun_ = lumiSeg.
run();
96 if(siPixelFedCablingMapWatcher_.check(iSetup)||trackerDIGIGeoWatcher_.check(iSetup)||trackerTopoWatcher_.check(iSetup)){
100 fCablingMap_ = fCablingMap.product();
103 fFedIds = fCablingMap_->det2fedMap();
110 for (TrackerGeometry::DetContainer::const_iterator it = fTG->dets().begin(); it != fTG->dets().end(); it++){
113 if (pgdu ==
nullptr)
continue;
114 DetId detId = (*it)->geographicalId();
115 int detid = detId.
rawId();
124 int nrocs = nROCrows*nROCcolumns;
126 fDet.addModule(detid, nrocs);
128 fSensors[detid] = std::make_pair(rowsperroc,colsperroc);
129 fSensorLayout[detid] = std::make_pair(nROCrows,nROCcolumns);
131 std::map<int, int> rocIdMap;
132 for(
int irow = 0; irow<nROCrows; irow++){
134 for(
int icol = 0; icol<nROCcolumns; icol++){
136 int dummyOfflineRow = (rowsperroc/2-1) + irow*rowsperroc;
137 int dummeOfflineColumn = (colsperroc/2-1) + icol*colsperroc;
139 int key = indexROC(irow,icol,nROCcolumns);
141 int roc(-1), rocR(-1), rocC(-1);
142 onlineRocColRow(detId, dummyOfflineRow, dummeOfflineColumn, roc, rocR, rocC);
150 fRocIds[detid] = rocIdMap;
166 <<
"start cluster analyzer "<<endl;
173 if(!iEvent.
getByToken(fSiPixelClusterToken_, hClusterColl)){
174 edm::LogWarning(
"SiPixelStatusProducer") <<
" edmNew::DetSetVector<SiPixelCluster> "<<fPixelClusterLabel_<<
" does not exist!"<<endl;
178 iEvent.
getByToken(fSiPixelClusterToken_, hClusterColl);
182 for (
const auto&
clusters: *hClusterColl) {
184 int detid = clusters.detId();
185 int rowsperroc = fSensors[detid].first;
186 int colsperroc = fSensors[detid].second;
188 int nROCcolumns = fSensorLayout[detid].second;
191 std::map<int,int> fRocIds_detid;
192 if(fRocIds.find(detid)!=fRocIds.end()){
193 fRocIds_detid = fRocIds[detid];
196 const vector<SiPixelCluster::Pixel>& pixvector = clu.pixels();
197 for (
unsigned int i = 0;
i < pixvector.size(); ++
i) {
199 int mr0 = pixvector[
i].x;
200 int mc0 = pixvector[
i].y;
202 int irow = mr0/rowsperroc;
203 int icol = mc0/colsperroc;
205 int key = indexROC(irow,icol,nROCcolumns);
206 if(fRocIds_detid.find(key)!=fRocIds_detid.end()){
207 roc = fRocIds_detid[
key];
210 fDet.fillDIGI(detid, roc);
220 edm::LogWarning(
"SiPixelStatusProducer") <<
" edmNew::DetSetVector<SiPixelCluster> "<<fPixelClusterLabel_<<
" is NOT Valid!"<<endl;
231 if (!iEvent.
getByToken(tk, pixelFEDChannelCollectionHandle)) {
232 edm::LogWarning(
"SiPixelStatusProducer") <<
" PixelFEDChannelCollection with index "<<tk.index()<<
" does NOT exist!"<<std::endl;
235 iEvent.
getByToken(tk, pixelFEDChannelCollectionHandle);
237 if(!pixelFEDChannelCollectionHandle.
isValid()) {
238 edm::LogWarning(
"SiPixelStatusProducer") <<
" PixelFEDChannelCollection with index "<<tk.index()<<
" is NOT valid!"<<endl;
242 std::map<int, std::vector<PixelFEDChannel> > tmpFEDerror25;
243 for (
const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
245 for(
const auto& ch: disabledChannels) {
247 DetId detId = disabledChannels.detId();
248 int detid = detId.
rawId();
252 FEDerror25_[detid].push_back(ch);
254 else tmpFEDerror25[detid].push_back(ch);
262 if(!tmpFEDerror25.empty() && !FEDerror25_.empty()){
264 std::map<int, std::vector<PixelFEDChannel> >::iterator itFEDerror25;
265 for (itFEDerror25 = FEDerror25_.begin(); itFEDerror25 != FEDerror25_.end(); itFEDerror25++) {
267 int detid = itFEDerror25->first;
268 if(tmpFEDerror25.find(detid)!=tmpFEDerror25.end()){
270 std::vector<PixelFEDChannel> chs = itFEDerror25->second;
271 std::vector<PixelFEDChannel> chs_tmp = tmpFEDerror25[detid];
273 std::vector<PixelFEDChannel> chs_common;
274 for(
unsigned int ich = 0; ich<chs.size(); ich++){
278 for(
unsigned int ich_tmp = 0; ich_tmp<chs_tmp.size(); ich_tmp++){
282 chs_common.push_back(ch);
break;
288 if(chs_common.empty()) FEDerror25_.erase(itFEDerror25);
290 else { FEDerror25_[detid].clear();
291 FEDerror25_[detid] = chs_common;
295 FEDerror25_.erase(itFEDerror25);
320 <<
"endlumi producer "<<endl;
323 endRun_ = lumiSeg.
run();
326 if ( resetNLumi_ == -1 )
return;
327 if ( countLumi_ < resetNLumi_ )
return;
330 if(!FEDerror25_.empty()){
331 std::map<int, std::vector<PixelFEDChannel> >::iterator itFEDerror25;
332 for (itFEDerror25 = FEDerror25_.begin(); itFEDerror25 != FEDerror25_.end(); itFEDerror25++) {
333 int detid = itFEDerror25->first;
334 std::vector<PixelFEDChannel> chs = itFEDerror25->second;
335 for(
unsigned int ich = 0; ich<chs.size(); ich++){
336 fDet.fillFEDerror25(detid,chs[ich]);
341 fDet.setRunRange(beginRun_,endRun_);
342 fDet.setLSRange(beginLumi_,endLumi_);
343 fDet.setNevents(ftotalevents);
346 auto result = std::make_unique<SiPixelDetectorStatus>();
352 <<
"new lumi-based data stored for run "<<beginRun_<<
" lumi from "<<beginLumi_<<
" to "<<endLumi_<<std::endl;
355 fDet.resetDetectorStatus();
369 detector.
rawId = detId.
rawId(); detector.
row = offlineRow; detector.
col = offlineCol;
399 return int(icol+irow*nROCcolumns);
T getParameter(std::string const &) const
virtual int nrows() const =0
virtual int rowsperroc() const =0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void accumulate(edm::Event const &, const edm::EventSetup &iSetup) final
SiPixelStatusProducer(const edm::ParameterSet &)
identify pixel inside single ROC
~SiPixelStatusProducer() override
LuminosityBlockNumber_t luminosityBlock() const
uint32_t rawId() const
get the raw id
virtual int colsperroc() const =0
void put(std::unique_ptr< PROD > product)
Put a new product.
virtual void onlineRocColRow(const DetId &detId, int offlineRow, int offlineCol, int &roc, int &row, int &col) final
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
double collumn and pixel ID in double collumn representation
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) final
virtual int ncolumns() const =0
sipixelobjects::PixelROC const * toRoc(int link, int roc) const
virtual int indexROC(int irow, int icol, int nROCcolumns) final
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) final