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;
165 <<
"start cluster analyzer "<<endl;
172 if(!iEvent.
getByToken(fSiPixelClusterToken_, hClusterColl)){
173 edm::LogWarning(
"SiPixelStatusProducer") <<
" edmNew::DetSetVector<SiPixelCluster> "<<fPixelClusterLabel_<<
" does not exist!"<<endl;
177 iEvent.
getByToken(fSiPixelClusterToken_, hClusterColl);
181 for (
const auto&
clusters: *hClusterColl) {
183 int detid = clusters.detId();
184 int rowsperroc = fSensors[detid].first;
185 int colsperroc = fSensors[detid].second;
187 int nROCcolumns = fSensorLayout[detid].second;
190 std::map<int,int> fRocIds_detid;
191 if(fRocIds.find(detid)!=fRocIds.end()){
192 fRocIds_detid = fRocIds[detid];
195 const vector<SiPixelCluster::Pixel>& pixvector = clu.pixels();
196 for (
unsigned int i = 0;
i < pixvector.size(); ++
i) {
198 int mr0 = pixvector[
i].x;
199 int mc0 = pixvector[
i].y;
201 int irow = mr0/rowsperroc;
202 int icol = mc0/colsperroc;
204 int key = indexROC(irow,icol,nROCcolumns);
205 if(fRocIds_detid.find(key)!=fRocIds_detid.end()){
206 roc = fRocIds_detid[
key];
209 fDet.fillDIGI(detid, roc);
219 edm::LogWarning(
"SiPixelStatusProducer") <<
" edmNew::DetSetVector<SiPixelCluster> "<<fPixelClusterLabel_<<
" is NOT Valid!"<<endl;
230 if (!iEvent.
getByToken(tk, pixelFEDChannelCollectionHandle)) {
231 edm::LogWarning(
"SiPixelStatusProducer") <<
" PixelFEDChannelCollection with index "<<tk.index()<<
" does NOT exist!"<<endl;
234 iEvent.
getByToken(tk, pixelFEDChannelCollectionHandle);
236 if(!pixelFEDChannelCollectionHandle.
isValid()) {
237 edm::LogWarning(
"SiPixelStatusProducer") <<
" PixelFEDChannelCollection with index "<<tk.index()<<
" is NOT valid!"<<endl;
240 for (
const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
242 for(
const auto& ch: disabledChannels) {
244 DetId detId = disabledChannels.detId();
245 int detid = detId.
rawId();
246 fDet.fillFEDerror25(detid,ch);
270 <<
"endlumi producer "<<endl;
273 endRun_ = lumiSeg.
run();
276 if ( resetNLumi_ == -1 )
return;
277 if ( countLumi_ < resetNLumi_ )
return;
279 fDet.setRunRange(beginRun_,endRun_);
280 fDet.setLSRange(beginLumi_,endLumi_);
281 fDet.setNevents(ftotalevents);
284 auto result = std::make_unique<SiPixelDetectorStatus>();
290 <<
"new lumi-based data stored for run "<<beginRun_<<
" lumi from "<<beginLumi_<<
" to "<<endLumi_<<std::endl;
293 fDet.resetDetectorStatus();
307 detector.
rawId = detId.
rawId(); detector.
row = offlineRow; detector.
col = offlineCol;
337 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