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(0),
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 // -- Begin Job
67 //
69 }
70 //
71 // -- BeginRun
72 //
73 
75 {
76  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
77 
79  if (m_cacheID_ != cacheID) {
80  m_cacheID_ = cacheID;
81  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
82  SelectedDetIds.clear();
84 
85  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::bookHistograms: "
86  << " Creating MEs for new Cabling ";
87  ibooker.setCurrentFolder("Track/GlobalParameter");
88  if (!BadFedNumber) {
89  BadFedNumber = ibooker.book1D("FaultyFedNumberAndChannel","Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
90  BadFedNumber->setAxisTitle("Fed Id and Channel numbers",1);
91  }
92  }
93 }
94 
95 // ------------ method called to produce the data ------------
97 {
98 
99  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::analyze: Run "<<
100  iEvent.id().run() << " Event " << iEvent.id().event();
101 
102 
103  iSetup.get<SiStripDetCablingRcd>().get( detcabling );
104 
105  // get DigiCollection object from Event
107  iEvent.getByToken(digiToken_, digi_collection);
108 
109  for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(),
110  iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
111  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( (*idetid) );
112  if (digis == digi_collection->end() ||
113  digis->data.size() == 0 ||
114  digis->data.size() > 768 ) {
115  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections((*idetid));
116  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
117  if(fed_conns[k] && fed_conns[k]->isConnected()) {
118  float fed_id = fed_conns[k]->fedId() + 0.01*fed_conns[k]->fedCh();
119  BadFedNumber->Fill(fed_id);
120  }
121  }
122  continue;
123  }
124  }
125 }
126 //
127 // -- End Run
128 //
130  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
132  if (outputMEsInRootFile) {
133  //dqmStore_->showDirStructure();
134  dqmStore_->save(outputFileName);
135  }
136 }
137 //
138 // -- End Job
139 //
141  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::EndJob: "
142  << " Finishing!! ";
143 }
145 
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:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
edm::ESHandle< SiStripDetCabling > detcabling
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:115
int k[5][pyjets_maxn]
std::vector< uint32_t > SelectedDetIds
unsigned long long m_cacheID_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
const T & get() const
Definition: EventSetup.h:56
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
SiStripMonitorRawData(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:58
HLT enums.
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", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2649
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)
void Reset(void)
reset ME (ie. contents, errors, etc)
Definition: Run.h:42