CMS 3D CMS Logo

SiStripFedCablingReader.cc
Go to the documentation of this file.
1 // system includes
2 #include <iostream>
3 #include <sstream>
4 
5 // user includes
20 
21 class SiStripFedCablingReader : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
22 public:
24  ~SiStripFedCablingReader() override = default;
25 
26  void beginRun(const edm::Run&, const edm::EventSetup&) override;
27  void endRun(const edm::Run&, const edm::EventSetup&) override{};
28  void analyze(const edm::Event&, const edm::EventSetup&) override{};
29 
30 private:
31  bool printFecCabling_;
39 };
40 
41 // -----------------------------------------------------------------------------
42 //
44  : printFecCabling_(pset.getUntrackedParameter<bool>("PrintFecCabling", false)),
45  printDetCabling_(pset.getUntrackedParameter<bool>("PrintDetCabling", false)),
46  printRegionCabling_(pset.getUntrackedParameter<bool>("PrintRegionCabling", false)),
47  fedCablingToken_(esConsumes<edm::Transition::BeginRun>()),
48  fecCablingToken_(esConsumes<edm::Transition::BeginRun>()),
49  detCablingToken_(esConsumes<edm::Transition::BeginRun>()),
50  regionCablingToken_(esConsumes<edm::Transition::BeginRun>()),
51  tTopoToken_(esConsumes<edm::Transition::BeginRun>()) {}
52 
53 // -----------------------------------------------------------------------------
54 //
56  auto const fedRec = setup.tryToGet<SiStripFedCablingRcd>();
57  auto const fecRec = setup.tryToGet<SiStripFecCablingRcd>();
58  auto const detRec = setup.tryToGet<SiStripDetCablingRcd>();
59  auto const regRec = setup.tryToGet<SiStripRegionCablingRcd>();
60 
62  if (fedRec) {
63  edm::LogVerbatim("SiStripFedCablingReader") << "[SiStripFedCablingReader::" << __func__ << "]"
64  << " Retrieving FED cabling...";
65  fed = setup.getHandle(fedCablingToken_);
66  }
67 
69  if (fecRec) {
70  edm::LogVerbatim("SiStripFedCablingReader") << "[SiStripFedCablingReader::" << __func__ << "]"
71  << " Retrieving FEC cabling...";
72  fec = setup.getHandle(fecCablingToken_);
73  }
74 
76  if (detRec) {
77  edm::LogVerbatim("SiStripFedCablingReader") << "[SiStripFedCablingReader::" << __func__ << "]"
78  << " Retrieving DET cabling...";
79  det = setup.getHandle(detCablingToken_);
80  }
81 
83  if (regRec) {
84  edm::LogVerbatim("SiStripFedCablingReader") << "[SiStripFedCablingReader::" << __func__ << "]"
85  << " Retrieving REGION cabling...";
86  region = setup.getHandle(regionCablingToken_);
87  }
88 
89  if (!fed.isValid()) {
90  edm::LogError("SiStripFedCablingReader") << " Invalid handle to FED cabling object: ";
91  return;
92  }
93 
94  {
95  std::stringstream ss;
96  ss << "[SiStripFedCablingReader::" << __func__ << "]"
97  << " VERBOSE DEBUG" << std::endl;
98  if (fedRec) {
99  fed->print(ss, &setup.getData(tTopoToken_));
100  }
101  ss << std::endl;
102  if (fecRec && printFecCabling_ && fec.isValid()) {
103  fec->print(ss);
104  }
105  ss << std::endl;
106  if (detRec && printDetCabling_ && det.isValid()) {
107  det->print(ss);
108  }
109  ss << std::endl;
110  if (regRec && printRegionCabling_ && region.isValid()) {
111  region->print(ss);
112  }
113  ss << std::endl;
114  edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
115  }
116 
117  if (fedRec) {
118  std::stringstream ss;
119  ss << "[SiStripFedCablingReader::" << __func__ << "]"
120  << " TERSE DEBUG" << std::endl;
121  fed->terse(ss);
122  ss << std::endl;
123  edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
124  }
125 
126  if (fedRec) {
127  std::stringstream ss;
128  ss << "[SiStripFedCablingReader::" << __func__ << "]"
129  << " SUMMARY DEBUG" << std::endl;
130  fed->summary(ss, &setup.getData(tTopoToken_));
131  ss << std::endl;
132  edm::LogVerbatim("SiStripFedCablingReader") << ss.str();
133  }
134 }
135 
138 
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< SiStripFecCabling, SiStripFecCablingRcd > fecCablingToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
~SiStripFedCablingReader() override=default
const edm::ESGetToken< SiStripRegionCabling, SiStripRegionCablingRcd > regionCablingToken_
void print(std::stringstream &) const
Log< level::Error, false > LogError
void analyze(const edm::Event &, const edm::EventSetup &) override
const edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
const edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
void endRun(const edm::Run &, const edm::EventSetup &) override
void print(std::stringstream &) const
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool isValid() const
Definition: ESHandle.h:44
SiStripFedCablingReader(const edm::ParameterSet &)
HLT enums.
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: Run.h:45