CMS 3D CMS Logo

CSCRecoBadChannelsAnalyzer.cc
Go to the documentation of this file.
1 
4 #include <string>
5 #include <vector>
6 
12 
16 
21 
23 
27 
29 
31 public:
33  : dashedLineWidth_(80),
35  myName_("CSCRecoBadChannelsAnalyzer"),
36  readBadChannels_(ps.getParameter<bool>("readBadChannels")),
41 
43  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
44 
46  bool readBadChannels() const { return readBadChannels_; }
47  const std::string& myName() { return myName_; }
48 
49 private:
50  const int dashedLineWidth_;
53 
59 };
60 
62  using namespace edm::eventsetup;
63 
64  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze running...";
65  edm::LogVerbatim("CSCBadChannels") << "start " << dashedLine_;
66 
67  edm::LogVerbatim("CSCBadChannels") << "RUN# " << ev.id().run();
68  edm::LogVerbatim("CSCBadChannels") << "EVENT# " << ev.id().event();
69 
71 
72  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze sees indexer " << theIndexer->name()
73  << " in Event Setup";
74 
76 
77  edm::LogVerbatim("CSCBadChannels") << myName() << "::analyze sees mapper " << theMapper->name() << " in Event Setup";
78 
80 
81  edm::LogVerbatim("CSCBadChannels") << " Geometry node for CSCGeom is " << &(*theGeometry);
82  edm::LogVerbatim("CSCBadChannels") << " There are " << theGeometry->dets().size() << " dets";
83  edm::LogVerbatim("CSCBadChannels") << " There are " << theGeometry->detTypes().size() << " types"
84  << "\n";
85 
86  // INITIALIZE CSCConditions
88 
89  // HERE NEED TO ITERATE OVER ALL CSCDetId
90 
91  edm::LogVerbatim("CSCBadChannels") << myName() << ": Begin iteration over geometry...";
92 
93  const CSCGeometry::LayerContainer& vecOfLayers = theGeometry->layers();
94  edm::LogVerbatim("CSCBadChannels") << "There are " << vecOfLayers.size() << " layers";
95 
96  edm::LogVerbatim("CSCBadChannels") << dashedLine_;
97 
98  int ibadchannels = 0; // COUNT OF BAD STRIP CHANNELS
99  int ibadlayers = 0; //COUNT OF LAYERS WITH BAD STRIP CHANNELS
100 
101  for (auto it = vecOfLayers.begin(); it != vecOfLayers.end(); ++it) {
102  const CSCLayer* layer = *it;
103 
104  if (layer) {
105  CSCDetId id = layer->id();
106  int nstrips = layer->geometry()->numberOfStrips();
107  edm::LogVerbatim("CSCBadChannels") << "Layer " << id << " has " << nstrips << " strips";
108 
109  // GET BAD CHANNELS FOR THIS LAYER
110 
112 
113  // SEARCH FOR BAD STRIP CHANNELS IN THIS LAYER - GEOMETRIC STRIP INPUT!!
114 
115  bool layerhasbadchannels = false;
116  for (short is = 1; is <= nstrips; ++is) {
117  if (recoConditions_->badStrip(id, is, nstrips)) {
118  ++ibadchannels;
119  layerhasbadchannels = true;
120  edm::LogVerbatim("CSCBadChannels") << id << " strip " << is << " is bad";
121  }
122  }
123 
124  for (short is = 1; is <= nstrips; ++is) {
125  if (recoConditions_->nearBadStrip(id, is, nstrips)) {
126  edm::LogVerbatim("CSCBadChannels") << id << " strip " << is << " is a neighbor of a bad strip";
127  }
128  }
129 
130  if (layerhasbadchannels)
131  ++ibadlayers;
132 
133  } else {
134  edm::LogVerbatim("CSCBadChannels") << "WEIRD ERROR: a null CSCLayer* was seen";
135  }
136  }
137 
138  edm::LogVerbatim("CSCBadChannels") << "No. of layers with bad strip channels = " << ibadlayers;
139  edm::LogVerbatim("CSCBadChannels") << "No. of bad strip channels seen = " << ibadchannels;
140 
141  edm::LogVerbatim("CSCBadChannels") << dashedLine_ << " end";
142 }
143 
CSCRecoBadChannelsAnalyzer::readBadChannels
bool readBadChannels() const
did we request reading bad channel info from db?
Definition: CSCRecoBadChannelsAnalyzer.cc:46
CSCRecoBadChannelsAnalyzer::dashedLineWidth_
const int dashedLineWidth_
Definition: CSCRecoBadChannelsAnalyzer.cc:50
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
CSCRecoBadChannelsAnalyzer::indexerToken_
edm::ESGetToken< CSCIndexerBase, CSCIndexerRecord > indexerToken_
Definition: CSCRecoBadChannelsAnalyzer.cc:56
CSCRecoConditions::initializeEvent
void initializeEvent(const edm::EventSetup &es)
fetch the cond data from the database
Definition: CSCRecoConditions.cc:10
ESHandle.h
CSCRecoBadChannelsAnalyzer
Definition: CSCRecoBadChannelsAnalyzer.cc:30
CSCRecoConditions.h
CSCRecoBadChannelsAnalyzer::geometryToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geometryToken_
Definition: CSCRecoBadChannelsAnalyzer.cc:58
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
CSCLayer
Definition: CSCLayer.h:24
EDAnalyzer.h
ESGetToken.h
CSCDetId.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
CSCIndexerBase::name
virtual std::string name() const
Definition: CSCIndexerBase.h:82
CSCGeometry
Definition: CSCGeometry.h:24
MakerMacros.h
CSCRecoBadChannelsAnalyzer::CSCRecoBadChannelsAnalyzer
CSCRecoBadChannelsAnalyzer(edm::ParameterSet const &ps)
Definition: CSCRecoBadChannelsAnalyzer.cc:32
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESHandle< CSCIndexerBase >
CSCChannelMapperRecord
Definition: CSCChannelMapperRecord.h:6
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCRecoConditions::badStrip
bool badStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is the strip bad?
Definition: CSCRecoConditions.cc:138
CSCRecoBadChannelsAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: CSCRecoBadChannelsAnalyzer.cc:61
CSCIndexerRecord.h
CSCRecoBadChannelsAnalyzer::dashedLine_
const std::string dashedLine_
Definition: CSCRecoBadChannelsAnalyzer.cc:51
edm::ParameterSet
Definition: ParameterSet.h:47
CSCRecoBadChannelsAnalyzer::myName_
const std::string myName_
Definition: CSCRecoBadChannelsAnalyzer.cc:52
Event.h
CSCRecoBadChannelsAnalyzer::myName
const std::string & myName()
Definition: CSCRecoBadChannelsAnalyzer.cc:47
CSCRecoBadChannelsAnalyzer::readBadChannels_
bool readBadChannels_
Definition: CSCRecoBadChannelsAnalyzer.cc:54
CSCRecoConditions::nearBadStrip
bool nearBadStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is a neighbour bad?
Definition: CSCRecoConditions.cc:132
CSCRecoBadChannelsAnalyzer::mapperToken_
edm::ESGetToken< CSCChannelMapperBase, CSCChannelMapperRecord > mapperToken_
Definition: CSCRecoBadChannelsAnalyzer.cc:57
CSCGeometry::detTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: CSCGeometry.cc:79
CSCDetId
Definition: CSCDetId.h:26
CSCRecoConditions::fillBadChannelWords
void fillBadChannelWords(const CSCDetId &id)
fill bad strip & bad wiregroup bitsets from conditions data
Definition: CSCRecoConditions.cc:13
CSCGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: CSCGeometry.cc:83
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
CSCIndexerBase
Definition: CSCIndexerBase.h:69
edm::EventSetup
Definition: EventSetup.h:58
CSCChannelMapperRecord.h
CSCRecoBadChannelsAnalyzer::recoConditions_
CSCRecoConditions * recoConditions_
Definition: CSCRecoBadChannelsAnalyzer.cc:55
edm::ESGetToken< CSCIndexerBase, CSCIndexerRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCRecoBadChannelsAnalyzer::~CSCRecoBadChannelsAnalyzer
~CSCRecoBadChannelsAnalyzer() override
Definition: CSCRecoBadChannelsAnalyzer.cc:42
std
Definition: JetResolutionObject.h:76
CSCChannelMapperBase
Definition: CSCChannelMapperBase.h:42
CSCLayer.h
CSCRecoConditions
Definition: CSCRecoConditions.h:25
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
CSCChannelMapperBase::name
virtual std::string name() const
Definition: CSCChannelMapperBase.h:47
CSCGeometry::layers
const LayerContainer & layers() const
Return a vector of all layers.
Definition: CSCGeometry.cc:98
EventSetup.h
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
CSCIndexerRecord
Definition: CSCIndexerRecord.h:6
ParameterSet.h
MuonGeometryRecord.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
edm::eventsetup
Definition: ES_DDDetector.cc:16
CSCGeometry::LayerContainer
std::vector< const CSCLayer * > LayerContainer
Definition: CSCGeometry.h:31
CSCChannelMapperBase.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
CSCIndexerBase.h
CSCGeometry.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37