CMS 3D CMS Logo

CSCRecoBadChannelsAnalyzer.cc
Go to the documentation of this file.
1 
4 #include <string>
5 #include <vector>
6 
12 
15 
20 
22 
26 
28 
30 public:
32  : dashedLineWidth_(80),
34  myName_("CSCRecoBadChannelsAnalyzer"),
35  readBadChannels_(ps.getParameter<bool>("readBadChannels")),
37 
39  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
40 
42  bool readBadChannels() const { return readBadChannels_; }
43  const std::string& myName() { return myName_; }
44 
45 private:
46  const int dashedLineWidth_;
49 
52 };
53 
55  using namespace edm::eventsetup;
56 
57  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze running...";
58  edm::LogVerbatim("CSCBadChannels") << "start " << dashedLine_;
59 
60  edm::LogVerbatim("CSCBadChannels") << "RUN# " << ev.id().run();
61  edm::LogVerbatim("CSCBadChannels") << "EVENT# " << ev.id().event();
62 
64  evsetup.get<CSCIndexerRecord>().get(theIndexer);
65 
66  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze sees indexer " << theIndexer->name()
67  << " in Event Setup";
68 
70  evsetup.get<CSCChannelMapperRecord>().get(theMapper);
71 
72  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze sees mapper " << theMapper->name() << " in Event Setup";
73 
74  edm::ESHandle<CSCGeometry> theGeometry;
75  evsetup.get<MuonGeometryRecord>().get(theGeometry);
76 
77  edm::LogVerbatim("CSCBadChannels") << " Geometry node for CSCGeom is " << &(*theGeometry);
78  edm::LogVerbatim("CSCBadChannels") << " There are " << theGeometry->dets().size() << " dets";
79  edm::LogVerbatim("CSCBadChannels") << " There are " << theGeometry->detTypes().size() << " types"
80  << "\n";
81 
82  // INITIALIZE CSCConditions
84 
85  // HERE NEED TO ITERATE OVER ALL CSCDetId
86 
87  edm::LogVerbatim("CSCBadChannels") << myName() << ": Begin iteration over geometry...";
88 
89  const CSCGeometry::LayerContainer& vecOfLayers = theGeometry->layers();
90  edm::LogVerbatim("CSCBadChannels") << "There are " << vecOfLayers.size() << " layers";
91 
92  edm::LogVerbatim("CSCBadChannels") << dashedLine_;
93 
94  int ibadchannels = 0; // COUNT OF BAD STRIP CHANNELS
95  int ibadlayers = 0; //COUNT OF LAYERS WITH BAD STRIP CHANNELS
96 
97  for (auto it = vecOfLayers.begin(); it != vecOfLayers.end(); ++it) {
98  const CSCLayer* layer = *it;
99 
100  if (layer) {
101  CSCDetId id = layer->id();
102  int nstrips = layer->geometry()->numberOfStrips();
103  edm::LogVerbatim("CSCBadChannels") << "Layer " << id << " has " << nstrips << " strips";
104 
105  // GET BAD CHANNELS FOR THIS LAYER
106 
108 
109  // SEARCH FOR BAD STRIP CHANNELS IN THIS LAYER - GEOMETRIC STRIP INPUT!!
110 
111  bool layerhasbadchannels = false;
112  for (short is = 1; is <= nstrips; ++is) {
113  if (recoConditions_->badStrip(id, is, nstrips)) {
114  ++ibadchannels;
115  layerhasbadchannels = true;
116  edm::LogVerbatim("CSCBadChannels") << id << " strip " << is << " is bad";
117  }
118  }
119 
120  for (short is = 1; is <= nstrips; ++is) {
121  if (recoConditions_->nearBadStrip(id, is, nstrips)) {
122  edm::LogVerbatim("CSCBadChannels") << id << " strip " << is << " is a neighbor of a bad strip";
123  }
124  }
125 
126  if (layerhasbadchannels)
127  ++ibadlayers;
128 
129  } else {
130  edm::LogVerbatim("CSCBadChannels") << "WEIRD ERROR: a null CSCLayer* was seen";
131  }
132  }
133 
134  edm::LogVerbatim("CSCBadChannels") << "No. of layers with bad strip channels = " << ibadlayers;
135  edm::LogVerbatim("CSCBadChannels") << "No. of bad strip channels seen = " << ibadchannels;
136 
137  edm::LogVerbatim("CSCBadChannels") << dashedLine_ << " end";
138 }
139 
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
CSCDetId id() const
Definition: CSCLayer.h:39
int numberOfStrips() const
bool ev
bool nearBadStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is a neighbour bad?
CSCRecoBadChannelsAnalyzer(edm::ParameterSet const &ps)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool badStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is the strip bad?
void fillBadChannelWords(const CSCDetId &id)
fill bad strip & bad wiregroup bitsets from conditions data
void analyze(const edm::Event &e, const edm::EventSetup &c) override
bool readBadChannels() const
did we request reading bad channel info from db?
virtual std::string name() const
edm::EventID id() const
Definition: EventBase.h:59
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: CSCGeometry.cc:79
T get() const
Definition: EventSetup.h:73
virtual std::string name() const
std::vector< const CSCLayer * > LayerContainer
Definition: CSCGeometry.h:31
void initializeEvent(const edm::EventSetup &es)
fetch the cond data from the database
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: CSCGeometry.cc:83
const LayerContainer & layers() const
Return a vector of all layers.
Definition: CSCGeometry.cc:98