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 
25 
28 
31 
34 
36 
37 // std
38 #include <algorithm>
39 #include <cmath>
40 #include <cstdlib>
41 #include <numeric>
42 
44  : BadFedNumber(nullptr),
45  dqmStore_(edm::Service<DQMStore>().operator->()),
46  conf_(iConfig),
47  m_cacheID_(0)
48 
49 {
50  // retrieve producer name of input StripDigiCollection
52  std::string digiType = "VirginRaw";
53  digiToken_ = consumes<edm::DetSetVector<SiStripRawDigi>>(edm::InputTag(digiProducer, digiType));
54 
55  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
56  << " Constructing....... ";
57 }
58 
60  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData "
61  << " Destructing....... ";
62 }
63 //
64 // -- BeginRun
65 //
66 
68  const edm::Run &run,
69  const edm::EventSetup &eSetup) {
70  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
71 
72  if (BadFedNumber)
74  if (m_cacheID_ != cacheID) {
75  m_cacheID_ = cacheID;
76  eSetup.get<SiStripDetCablingRcd>().get(detcabling);
77  SelectedDetIds.clear();
79 
80  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::bookHistograms: "
81  << " Creating MEs for new Cabling ";
82  ibooker.setCurrentFolder("Track/GlobalParameter");
83  if (!BadFedNumber) {
84  BadFedNumber =
85  ibooker.book1D("FaultyFedNumberAndChannel", "Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
86  BadFedNumber->setAxisTitle("Fed Id and Channel numbers", 1);
87  }
88  }
89 }
90 
91 // ------------ method called to produce the data ------------
93  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::analyze: Run " << iEvent.id().run() << " Event "
94  << iEvent.id().event();
95 
96  iSetup.get<SiStripDetCablingRcd>().get(detcabling);
97 
98  // get DigiCollection object from Event
100  iEvent.getByToken(digiToken_, digi_collection);
101 
102  for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
103  idetid != iEnd;
104  ++idetid) {
105  std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find((*idetid));
106  if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
107  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections((*idetid));
108  for (unsigned int k = 0; k < fed_conns.size(); k++) {
109  if (fed_conns[k] && fed_conns[k]->isConnected()) {
110  float fed_id = fed_conns[k]->fedId() + 0.01 * fed_conns[k]->fedCh();
111  BadFedNumber->Fill(fed_id);
112  }
113  }
114  continue;
115  }
116  }
117 }
118 //
119 // -- End Run
120 //
122  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
124  if (outputMEsInRootFile) {
125  // dqmStore_->showDirStructure();
126  dqmStore_->save(outputFileName);
127  }
128 }
129 //
130 // -- End Job
131 //
133  edm::LogInfo("SiStripMonitorRawData") << "SiStripMonitorRawData::EndJob: "
134  << " Finishing!! ";
135 }
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
#define nullptr
void analyze(const edm::Event &, const edm::EventSetup &) override
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
void Fill(long long x)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
edm::ESHandle< SiStripDetCabling > detcabling
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void Reset()
reset ME (ie. contents, errors, etc)
int k[5][pyjets_maxn]
std::vector< uint32_t > SelectedDetIds
unsigned long long m_cacheID_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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:2465
SiStripMonitorRawData(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
T get() const
Definition: EventSetup.h:71
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
MonitorElement * BadFedNumber
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: Run.h:45