CMS 3D CMS Logo

SiStripMonitorRawData.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripMonitorRawData
4 // Class: SiStripMonitorRawData
5 //
14 //
15 // Original Author: Suchandra Dutta
16 // Created: Fri June 1 17:00:00 CET 2007
17 //
18 //
19 
30 
31 // std
32 #include <algorithm>
33 #include <cmath>
34 #include <cstdlib>
35 #include <numeric>
36 
38  : BadFedNumber(nullptr),
39  dqmStore_(edm::Service<DQMStore>().operator->()),
40  conf_(iConfig),
41  detCablingToken_(esConsumes<edm::Transition::BeginRun>())
42 
43 {
44  // retrieve producer name of input StripDigiCollection
46  std::string digiType = "VirginRaw";
47  digiToken_ = consumes<edm::DetSetVector<SiStripRawDigi>>(edm::InputTag(digiProducer, digiType));
48 
49  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
50  << " Constructing....... ";
51 }
52 
54  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
55  << " Destructing....... ";
56 }
57 //
58 // -- BeginRun
59 //
60 
62  const edm::Run &run,
63  const edm::EventSetup &eSetup) {
64  if (BadFedNumber)
66 
67  if (detCablingWatcher_.check(eSetup)) {
68  SelectedDetIds.clear();
69  const auto &detcabling = eSetup.getData(detCablingToken_);
70  detcabling.addActiveDetectorsRawIds(SelectedDetIds);
71 
72  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::bookHistograms: "
73  << " Creating MEs for new Cabling ";
74  ibooker.setCurrentFolder("Track/GlobalParameter");
75  if (!BadFedNumber) {
76  BadFedNumber =
77  ibooker.book1D("FaultyFedNumberAndChannel", "Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
78  BadFedNumber->setAxisTitle("Fed Id and Channel numbers", 1);
79  }
80  }
81 }
82 
83 // ------------ method called to produce the data ------------
85  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::analyze: Run " << iEvent.id().run() << " Event "
86  << iEvent.id().event();
87 
88  const auto &detcabling = iSetup.getData(detCablingToken_);
89 
90  // get DigiCollection object from Event
92  iEvent.getByToken(digiToken_, digi_collection);
93 
94  for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
95  idetid != iEnd;
96  ++idetid) {
97  std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find((*idetid));
98  if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
99  std::vector<const FedChannelConnection *> fed_conns = detcabling.getConnections((*idetid));
100  for (unsigned int k = 0; k < fed_conns.size(); k++) {
101  if (fed_conns[k] && fed_conns[k]->isConnected()) {
102  float fed_id = fed_conns[k]->fedId() + 0.01 * fed_conns[k]->fedCh();
103  BadFedNumber->Fill(fed_id);
104  }
105  }
106  continue;
107  }
108  }
109 }
110 //
111 // -- End Run
112 //
114  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
116  if (outputMEsInRootFile) {
118  }
119 }
120 //
121 // -- End Job
122 //
124  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::EndJob: "
125  << " Finishing!! ";
126 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &) override
void Fill(long long x)
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
int iEvent
Definition: GenABIO.cc:224
edm::ESWatcher< SiStripDetCablingRcd > detCablingWatcher_
Transition
Definition: Transition.h:12
void dqmEndRun(edm::Run const &run, edm::EventSetup const &eSetup) override
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Log< level::Info, false > LogInfo
std::vector< uint32_t > SelectedDetIds
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
SiStripMonitorRawData(const edm::ParameterSet &)
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
HLT enums.
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * BadFedNumber
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)