CMS 3D CMS Logo

SiStripMonitorRawData.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripMonitorRawData
4 // Class: SiStripMonitorRawData
5 //
13 //
14 // Original Author: Suchandra Dutta
15 // Created: Fri June 1 17:00:00 CET 2007
16 //
17 //
18 
21 
24 
27 
30 
33 
35 
36 // std
37 #include <cstdlib>
38 #include <cmath>
39 #include <numeric>
40 #include <algorithm>
41 
43  BadFedNumber(nullptr),
44  dqmStore_(edm::Service<DQMStore>().operator->()),
45  conf_(iConfig),
46  m_cacheID_(0)
47 
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 
59 
61 {
62  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData "
63  << " Destructing....... ";
64 }
65 //
66 // -- BeginRun
67 //
68 
70 {
71  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
72 
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 = 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 {
93 
94  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::analyze: Run "<<
95  iEvent.id().run() << " Event " << iEvent.id().event();
96 
97 
98  iSetup.get<SiStripDetCablingRcd>().get( detcabling );
99 
100  // get DigiCollection object from Event
102  iEvent.getByToken(digiToken_, digi_collection);
103 
104  for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(),
105  iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
106  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( (*idetid) );
107  if (digis == digi_collection->end() ||
108  digis->data.empty() ||
109  digis->data.size() > 768 ) {
110  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections((*idetid));
111  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
112  if(fed_conns[k] && fed_conns[k]->isConnected()) {
113  float fed_id = fed_conns[k]->fedId() + 0.01*fed_conns[k]->fedCh();
114  BadFedNumber->Fill(fed_id);
115  }
116  }
117  continue;
118  }
119  }
120 }
121 //
122 // -- End Run
123 //
125  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
127  if (outputMEsInRootFile) {
128  //dqmStore_->showDirStructure();
129  dqmStore_->save(outputFileName);
130  }
131 }
132 //
133 // -- End Job
134 //
136  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::EndJob: "
137  << " Finishing!! ";
138 }
140 
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:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void analyze(const edm::Event &, const edm::EventSetup &) override
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
edm::ESHandle< SiStripDetCabling > detcabling
#define nullptr
void Fill(long long x)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
int iEvent
Definition: GenABIO.cc:230
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2502
void Reset()
reset ME (ie. contents, errors, etc)
int k[5][pyjets_maxn]
std::vector< uint32_t > SelectedDetIds
unsigned long long m_cacheID_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
SiStripMonitorRawData(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
T get() const
Definition: EventSetup.h:63
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:44