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 //
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 //
74  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
75 
77  if (m_cacheID_ != cacheID) {
78  m_cacheID_ = cacheID;
79  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
80  SelectedDetIds.clear();
81  detcabling->addActiveDetectorsRawIds(SelectedDetIds);
82 
83  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::beginRun: "
84  << " Creating MEs for new Cabling ";
85  dqmStore_->setCurrentFolder("Track/GlobalParameter");
86  if (!BadFedNumber) {
87  BadFedNumber = dqmStore_->book1D("FaultyFedNumberAndChannel","Faulty Fed Id and Channel and Numbers", 60000, 0.5, 600.5);
88  BadFedNumber->setAxisTitle("Fed Id and Channel numbers",1);
89  }
90  }
91 }
92 
93 
94 // ------------ method called to produce the data ------------
96 {
97 
98  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::analyze: Run "<<
99  iEvent.id().run() << " Event " << iEvent.id().event();
100 
101 
102  iSetup.get<SiStripDetCablingRcd>().get( detcabling );
103 
104  // get DigiCollection object from Event
106  /*
107  // retrieve producer name of input StripDigiCollection
108  std::string digiProducer = conf_.getParameter<std::string>("DigiProducer");
109  std::string digiType = "VirginRaw";
110  //you have a collection as there are all the digis for the event for every detector
111  iEvent.getByLabel(digiProducer, digiType, digi_collection);
112  */
113  iEvent.getByToken(digiToken_, digi_collection);
114 
115  for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(),
116  iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
117  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( (*idetid) );
118  if (digis == digi_collection->end() ||
119  digis->data.size() == 0 ||
120  digis->data.size() > 768 ) {
121  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections((*idetid));
122  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
123  float fed_id = fed_conns[k]->fedId() + 0.01*fed_conns[k]->fedCh();
124  BadFedNumber->Fill(fed_id);
125  }
126  continue;
127  }
128  }
129 }
130 //
131 // -- End Run
132 //
134  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
136  if (outputMEsInRootFile) {
138  dqmStore_->save(outputFileName);
139  }
140 }
141 //
142 // -- End Job
143 //
145  edm::LogInfo("SiStripMonitorRawData") <<"SiStripMonitorRawData::EndJob: "
146  << " Finishing!! ";
147 }
149 
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:872
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::ESHandle< SiStripDetCabling > detcabling
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:243
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
virtual void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
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
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void showDirStructure(void) const
Definition: DQMStore.cc:2961
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:584
Definition: Run.h:41