CMS 3D CMS Logo

SiPixelPhase1DeadFEDChannels.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1DeadFEDChannels
4 // Class: SiPixelPhase1DeadFEDChannels
5 //
6 
7 // Original Author: F.Fiori
8 
9 // C++ stuff
10 #include <iostream>
11 
12 // CMSSW stuff
22 
23 // DQM Stuff
25 
26 // Input data stuff
30 
31 // PixelDQM Framework
33 
34 namespace {
35 
36  class SiPixelPhase1DeadFEDChannels final : public SiPixelPhase1Base {
37  // List of quantities to be plotted.
38  enum {
39  DEADCHAN,
40  DEADCHANROC
41 
42  };
43 
44  public:
45 
46  explicit SiPixelPhase1DeadFEDChannels(const edm::ParameterSet& conf);
47  void analyze(const edm::Event&, const edm::EventSetup&) override ;
48 
49  private:
50  edm::EDGetTokenT<PixelFEDChannelCollection> pixelFEDChannelCollectionToken_;
51 
52  bool firstEvent_;
53  const TrackerGeometry* trackerGeometry_ = nullptr;
54  const SiPixelFedCabling* cablingMap = nullptr;
55  };
56 
57  SiPixelPhase1DeadFEDChannels::SiPixelPhase1DeadFEDChannels(const edm::ParameterSet& iConfig) :
58  SiPixelPhase1Base(iConfig)
59  {
60  pixelFEDChannelCollectionToken_ = consumes<PixelFEDChannelCollection>(edm::InputTag("siPixelDigis"));
61  firstEvent_=true;
62  };
63 
65  if( !checktrigger(iEvent,iSetup,DCS) ) return;
66 
67  if(firstEvent_){
68  edm::ESHandle<TrackerGeometry> tmpTkGeometry;
69  iSetup.get<TrackerDigiGeometryRecord>().get(tmpTkGeometry);
70  trackerGeometry_=&(*tmpTkGeometry);
71 
73  iSetup.get<SiPixelFedCablingMapRcd>().get(pixelCabling);
74  cablingMap = pixelCabling.product();
75 
76  firstEvent_=false;
77  }
78 
80 
81  iEvent.getByToken(pixelFEDChannelCollectionToken_, input);
82  if (!input.isValid()) return;
83 
84  for(const auto& disabledOnDetId: *input){
85 
86  for(const auto& ch: disabledOnDetId) {
87 
88  sipixelobjects::CablingPathToDetUnit path = {ch.fed, ch.link, 0};
89 
90  for (path.roc=1; path.roc<=(ch.roc_last-ch.roc_first)+1; path.roc++){
91  const sipixelobjects::PixelROC *roc = cablingMap->findItem(path);
92  assert(roc!=nullptr);
93  assert(roc->rawId()==disabledOnDetId.detId());
94 
95  const PixelGeomDetUnit * theGeomDet = dynamic_cast<const PixelGeomDetUnit*> (trackerGeometry_->idToDet(roc->rawId()));
96  PixelTopology const * topology = &(theGeomDet->specificTopology());
97  sipixelobjects::LocalPixel::RocRowCol local = {topology->rowsperroc()/2, topology->colsperroc()/2}; //center of ROC
99  histo[DEADCHANROC].fill(disabledOnDetId.detId(), &iEvent, global.col, global.row);
100  }
101 
102  histo[DEADCHAN].fill(disabledOnDetId.detId(), &iEvent); // global count
103  }
104  }
105 
106  histo[DEADCHAN].executePerEventHarvesting(&iEvent);
107  }
108 } //namespace
109 
110 DEFINE_FWK_MODULE(SiPixelPhase1DeadFEDChannels);
111 
virtual int rowsperroc() const =0
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
identify pixel inside single ROC
Definition: LocalPixel.h:7
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
static std::string const input
Definition: EdmProvDump.cc:48
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual int colsperroc() const =0
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:37
bool isValid() const
Definition: HandleBase.h:74
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override=0
row and collumn in ROC representation
Definition: LocalPixel.h:15
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:59