CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: SiStripMonitorRawData.cc,v 1.6 2008/03/01 00:38:25 dutta Exp $
17 //
18 //
19 
22 
25 
28 
31 
34 
36 
37 // std
38 #include <cstdlib>
39 #include <cmath>
40 #include <numeric>
41 #include <algorithm>
42 
44  BadFedNumber(0),
45  dqmStore_(edm::Service<DQMStore>().operator->()),
46  conf_(iConfig),
47  m_cacheID_(0)
48 
49 
50 {
51  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData "
52  << " Constructing....... ";
53 }
54 
55 
57 {
58  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData "
59  << " Destructing....... ";
60 }
61 //
62 // -- Begin Job
63 //
65 }
66 //
67 // -- BeginRun
68 //
70  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
71 
73  if (m_cacheID_ != cacheID) {
74  m_cacheID_ = cacheID;
75  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
76  SelectedDetIds.clear();
77  detcabling->addActiveDetectorsRawIds(SelectedDetIds);
78 
79  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::beginRun: "
80  << " Creating MEs for new Cabling ";
81  dqmStore_->setCurrentFolder("Track/GlobalParameter");
82  if (!BadFedNumber) {
83  BadFedNumber = dqmStore_->book1D("FaultyFedNumberAndChannel","Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
84  BadFedNumber->setAxisTitle("Fed Id and Channel numbers",1);
85  }
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  // retrieve producer name of input StripDigiCollection
101  std::string digiProducer = conf_.getParameter<std::string>("DigiProducer");
102  // get DigiCollection object from Event
104  std::string digiType = "VirginRaw";
105  //you have a collection as there are all the digis for the event for every detector
106  iEvent.getByLabel(digiProducer, digiType, digi_collection);
107 
108  for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(),
109  iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
110  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( (*idetid) );
111  if (digis == digi_collection->end() ||
112  digis->data.size() == 0 ||
113  digis->data.size() > 768 ) {
114  std::vector<FedChannelConnection> fed_conns = detcabling->getConnections((*idetid));
115  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
116  float fed_id = fed_conns[k].fedId() + 0.01*fed_conns[k].fedCh();
117  BadFedNumber->Fill(fed_id);
118  }
119  continue;
120  }
121  }
122 }
123 //
124 // -- End Run
125 //
127  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
128  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
129  if (outputMEsInRootFile) {
131  dqmStore_->save(outputFileName);
132  }
133 }
134 //
135 // -- End Job
136 //
138  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::EndJob: "
139  << " Finishing!! ";
140 }
142 
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1883
edm::ESHandle< SiStripDetCabling > detcabling
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:243
virtual void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
int k[5][pyjets_maxn]
std::vector< uint32_t > SelectedDetIds
unsigned long long m_cacheID_
const T & get() const
Definition: EventSetup.h:55
SiStripMonitorRawData(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:56
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void showDirStructure(void) const
Definition: DQMStore.cc:2539
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)
virtual void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
Definition: Run.h:31