CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
22 
24 
27 
30 
33 
35 
36 // std
37 #include <algorithm>
38 #include <cmath>
39 #include <cstdlib>
40 #include <numeric>
41 
43  : BadFedNumber(nullptr),
44  dqmStore_(edm::Service<DQMStore>().operator->()),
45  conf_(iConfig),
46  detCablingToken_(esConsumes<edm::Transition::BeginRun>())
47 
48 {
49  // retrieve producer name of input StripDigiCollection
51  std::string digiType = "VirginRaw";
52  digiToken_ = consumes<edm::DetSetVector<SiStripRawDigi>>(edm::InputTag(digiProducer, digiType));
53 
54  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
55  << " Constructing....... ";
56 }
57 
59  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
60  << " Destructing....... ";
61 }
62 //
63 // -- BeginRun
64 //
65 
67  const edm::Run &run,
68  const edm::EventSetup &eSetup) {
69  if (BadFedNumber)
71 
72  if (detCablingWatcher_.check(eSetup)) {
73  SelectedDetIds.clear();
74  const auto &detcabling = eSetup.getData(detCablingToken_);
75  detcabling.addActiveDetectorsRawIds(SelectedDetIds);
76 
77  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::bookHistograms: "
78  << " Creating MEs for new Cabling ";
79  ibooker.setCurrentFolder("Track/GlobalParameter");
80  if (!BadFedNumber) {
81  BadFedNumber =
82  ibooker.book1D("FaultyFedNumberAndChannel", "Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
83  BadFedNumber->setAxisTitle("Fed Id and Channel numbers", 1);
84  }
85  }
86 }
87 
88 // ------------ method called to produce the data ------------
90  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::analyze: Run " << iEvent.id().run() << " Event "
91  << iEvent.id().event();
92 
93  const auto &detcabling = iSetup.getData(detCablingToken_);
94 
95  // get DigiCollection object from Event
97  iEvent.getByToken(digiToken_, digi_collection);
98 
99  for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
100  idetid != iEnd;
101  ++idetid) {
102  std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find((*idetid));
103  if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
104  std::vector<const FedChannelConnection *> fed_conns = detcabling.getConnections((*idetid));
105  for (unsigned int k = 0; k < fed_conns.size(); k++) {
106  if (fed_conns[k] && fed_conns[k]->isConnected()) {
107  float fed_id = fed_conns[k]->fedId() + 0.01 * fed_conns[k]->fedCh();
108  BadFedNumber->Fill(fed_id);
109  }
110  }
111  continue;
112  }
113  }
114 }
115 //
116 // -- End Run
117 //
119  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
121  if (outputMEsInRootFile) {
122  dqmStore_->save(outputFileName);
123  }
124 }
125 //
126 // -- End Job
127 //
129  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::EndJob: "
130  << " Finishing!! ";
131 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &) override
void Fill(long long x)
bool getData(T &iHolder) const
Definition: EventSetup.h:128
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
Log< level::Info, false > LogInfo
std::vector< uint32_t > SelectedDetIds
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 &)
edm::EventID id() const
Definition: EventBase.h:59
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
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
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
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)