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 
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  m_cacheID_(0)
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  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
70 
71  if (BadFedNumber)
73  if (m_cacheID_ != cacheID) {
74  m_cacheID_ = cacheID;
75  eSetup.get<SiStripDetCablingRcd>().get(detcabling);
76  SelectedDetIds.clear();
78 
79  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::bookHistograms: "
80  << " Creating MEs for new Cabling ";
81  ibooker.setCurrentFolder("Track/GlobalParameter");
82  if (!BadFedNumber) {
83  BadFedNumber =
84  ibooker.book1D("FaultyFedNumberAndChannel", "Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
85  BadFedNumber->setAxisTitle("Fed Id and Channel numbers", 1);
86  }
87  }
88 }
89 
90 // ------------ method called to produce the data ------------
92  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::analyze: Run " << iEvent.id().run() << " Event "
93  << iEvent.id().event();
94 
95  iSetup.get<SiStripDetCablingRcd>().get(detcabling);
96 
97  // get DigiCollection object from Event
99  iEvent.getByToken(digiToken_, digi_collection);
100 
101  for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
102  idetid != iEnd;
103  ++idetid) {
104  std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find((*idetid));
105  if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
106  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections((*idetid));
107  for (unsigned int k = 0; k < fed_conns.size(); k++) {
108  if (fed_conns[k] && fed_conns[k]->isConnected()) {
109  float fed_id = fed_conns[k]->fedId() + 0.01 * fed_conns[k]->fedCh();
110  BadFedNumber->Fill(fed_id);
111  }
112  }
113  continue;
114  }
115  }
116 }
117 //
118 // -- End Run
119 //
121  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
123  if (outputMEsInRootFile) {
124  // dqmStore_->showDirStructure();
125  dqmStore_->save(outputFileName);
126  }
127 }
128 //
129 // -- End Job
130 //
132  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::EndJob: "
133  << " Finishing!! ";
134 }
RunNumber_t run() const
Definition: EventID.h:38
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:40
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
#define nullptr
void analyze(const edm::Event &, const edm::EventSetup &) override
void Fill(long long x)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
virtual void Reset()
reset ME (ie. contents, errors, etc)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESHandle< SiStripDetCabling > detcabling
void dqmEndRun(edm::Run const &run, edm::EventSetup const &eSetup) override
std::vector< uint32_t > SelectedDetIds
unsigned long long m_cacheID_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
SiStripMonitorRawData(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
T get() const
Definition: EventSetup.h:73
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
MonitorElement * BadFedNumber
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2244
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)