test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDAQInfo.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMO/HcalMonitorClient/HcalDAQInfo
4 // Class: HcalDAQInfo
5 //
13 //
14 // Original Author: "Igor Vodopiyanov"
15 // Created: Feb-21 2009
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <stdio.h>
22 #include <math.h>
23 #include <sstream>
24 #include <fstream>
25 #include <exception>
26 
33 
35 
39 
46 
47 //
48 // class declaration
49 //
50 
51 class HcalDAQInfo : public DQMEDHarvester {
52  public:
53  explicit HcalDAQInfo(const edm::ParameterSet&);
54  ~HcalDAQInfo();
55 
57  virtual void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) { }
58 
59  // ----------member data ---------------------------
60 
71  int debug_;
73 };
74 
75 //
76 // constants, enums and typedefs
77 //
78 
79 //
80 // static data member definitions
81 //
82 
83 //
84 // constructors and destructor
85 //
86 
88 {
89  // now do what ever initialization is needed
90  debug_=iConfig.getUntrackedParameter<int>("debug",0);
91  rootFolder_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder","Hcal");
92 
94 
95 }
96 
98 {
99  // do anything here that needs to be done at destruction time
100  // (e.g. close files, deallocate resources etc.)
101 }
102 
103 //
104 // member functions
105 //
106 
107 
108 // ------------ method called right after a luminosity block ends ------------
109 void
111 {
112  if (debug_>0) {
113  std::cout <<"<HcalDAQInfo::endLuminosityBlock> "<<std::endl;
114  }
115 
116  // check that MonitorElements exist
117  // if not, book the histograms
118  if ( !HcalDaqFraction ) {
120  std::string currDir = ib.pwd();
121  if (debug_>0) std::cout << "--- Current Directory " << currDir << std::endl;
122 
123  ib.setCurrentFolder(rootFolder_+"/EventInfo/");
124 
125  HcalDaqFraction = ib.bookFloat("DAQSummary");
126 
127  DAQSummaryMap = ib.book2D("DAQSummaryMap","HcalDAQSummaryMap",7,0.,7.,1,0.,1.);
128  DAQSummaryMap->setAxisRange(-1,1,3);
129  DAQSummaryMap->setBinLabel(1,"HB");
130  DAQSummaryMap->setBinLabel(2,"HE");
131  DAQSummaryMap->setBinLabel(3,"HO");
132  DAQSummaryMap->setBinLabel(4,"HF");
133  DAQSummaryMap->setBinLabel(5,"H00");
134  DAQSummaryMap->setBinLabel(6,"H012");
135  DAQSummaryMap->setBinLabel(7,"HFlumi");
136  DAQSummaryMap->setBinLabel(1,"Status",2);
137 
138  ib.setCurrentFolder(rootFolder_+"/EventInfo/DAQContents/");
139  HBDaqFraction = ib.bookFloat("Hcal_HB");
140  HEDaqFraction = ib.bookFloat("Hcal_HE");
141  HODaqFraction = ib.bookFloat("Hcal_HO");
142  HFDaqFraction = ib.bookFloat("Hcal_HF");
143  HO0DaqFraction = ib.bookFloat("Hcal_HO0");
144  HO12DaqFraction = ib.bookFloat("Hcal_HO12");
145  HFlumiDaqFraction = ib.bookFloat("Hcal_HFlumi");
146  }
147 
148  HcalDaqFraction->Fill(-1);
149 
150  for (int ii=0; ii<7; ii++) DAQSummaryMap->setBinContent(ii+1,1,-1);
151 
152  HBDaqFraction->Fill(-1);
153  HEDaqFraction->Fill(-1);
154  HODaqFraction->Fill(-1);
155  HFDaqFraction->Fill(-1);
156  HO0DaqFraction->Fill(-1);
157  HO12DaqFraction->Fill(-1);
158  HFlumiDaqFraction->Fill(-1);
159 
161 
162  if( iSetup.find( recordKey ) ) {
163 
164  edm::ESHandle<RunInfo> sumFED;
165  iSetup.get<RunInfoRcd>().get(sumFED);
166 
167  std::vector<int> FedsInIds= sumFED->m_fed_in;
168 
169  float HcalFedCount = 0.;
170  float HBFedCount = 0.;
171  float HEFedCount = 0.;
172  float HFFedCount = 0.;
173  float HOFedCount = 0.;
174  float HO0FedCount = 0.;
175  float HO12FedCount = 0.;
176  float HFlumiFedCount = 0.;
177 
178  // By FED taking into account Nchannels per FED
179 
180  for( unsigned int fedItr=0; fedItr<FedsInIds.size(); ++fedItr ) {
181 
182  int fedID=FedsInIds[fedItr];
183 
184  if (fedID >= 700 && fedID <= 731) {
185  HcalFedCount++;
186  if (fedID >= 700 && fedID <= 717) {
187  HBFedCount++;
188  HEFedCount++;
189  }
190  else if (fedID >= 718 && fedID <= 723) {
191  HFFedCount++;
192  HFlumiFedCount++;
193  }
194  else if (fedID >= 724 && fedID <= 731) {
195  if (fedID%2 == 0) {
196  HOFedCount += 276;
197  HO0FedCount += 84;
198  HO12FedCount += 192;
199  }
200  else {
201  HOFedCount += 264;
202  HO0FedCount += 60;
203  HO12FedCount += 204;
204  }
205  }
206  }
207 
208  //else if ( fedID == 735 ) std::cout<<fedID<<" -- LumiScaler"<<std::endl;
209  }
210 
211  HcalFedCount = (HBFedCount*144+HEFedCount*144+HFFedCount*288+HOFedCount)/9072;
212  HBFedCount /= 18;
213  HEFedCount /= 18;
214  HFFedCount /= 6;
215  HFlumiFedCount /= 6;
216  HOFedCount /= 2160;
217  HO0FedCount /= 576;
218  HO12FedCount /= 1584;
219 
220  DAQSummaryMap->setBinContent(1,1,HBFedCount);
221  DAQSummaryMap->setBinContent(2,1,HEFedCount);
222  DAQSummaryMap->setBinContent(3,1,HOFedCount);
223  DAQSummaryMap->setBinContent(4,1,HFFedCount);
224  DAQSummaryMap->setBinContent(5,1,HO0FedCount);
225  DAQSummaryMap->setBinContent(6,1,HO12FedCount);
226  DAQSummaryMap->setBinContent(7,1,HFlumiFedCount);
227 
228  HcalDaqFraction->Fill(HcalFedCount);
229  HBDaqFraction->Fill(HBFedCount);
230  HEDaqFraction->Fill(HEFedCount);
231  HFDaqFraction->Fill(HFFedCount);
232  HODaqFraction->Fill(HOFedCount);
233  HO0DaqFraction->Fill(HO0FedCount);
234  HO12DaqFraction->Fill(HO12FedCount);
235  HFlumiDaqFraction->Fill(HFlumiFedCount);
236 
237  if (debug_>0) {
238  std::cout<<" HcalFedCount= "<<HcalFedCount<<std::endl;
239  std::cout<<" HBFedCount= "<<HBFedCount<<std::endl;
240  std::cout<<" HEFedCount= "<<HEFedCount<<std::endl;
241  std::cout<<" HFFedCount= "<<HFFedCount<<std::endl;
242  std::cout<<" HOFedCount= "<<HOFedCount<<std::endl;
243  std::cout<<" HO0FedCount= "<<HO0FedCount<<std::endl;
244  std::cout<<" HO12FedCount= "<<HO12FedCount<<std::endl;
245  std::cout<<" HFlumiFedCount= "<<HFlumiFedCount<<std::endl;
246  }
247  }
248  else edm::LogInfo(rootFolder_+"/EventInfo/")<<"No RunInfoRcd"<<std::endl;
249 
250 // ---------------------- end of DAQ Info
251  if (debug_>0) std::cout << "HcalDAQInfo::MEfilled " << std::endl;
252 
253 }
254 
255 //define this as a plug-in
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
int ib
Definition: cuy.py:660
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const std::string & pwd(void)
Definition: DQMStore.cc:284
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define NULL
Definition: scimark2.h:8
virtual void dqmEndLuminosityBlock(DQMStore::IBooker &ib, DQMStore::IGetter &ig, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: HcalDAQInfo.cc:110
MonitorElement * HO0DaqFraction
Definition: HcalDAQInfo.cc:68
virtual void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
Definition: HcalDAQInfo.cc:57
int ii
Definition: cuy.py:588
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:91
void Fill(long long x)
MonitorElement * DAQSummaryMap
Definition: HcalDAQInfo.cc:63
MonitorElement * HBDaqFraction
Definition: HcalDAQInfo.cc:64
MonitorElement * HFDaqFraction
Definition: HcalDAQInfo.cc:67
MonitorElement * HODaqFraction
Definition: HcalDAQInfo.cc:66
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:56
HcalDAQInfo(const edm::ParameterSet &)
Definition: HcalDAQInfo.cc:87
MonitorElement * HcalDaqFraction
Definition: HcalDAQInfo.cc:62
edm::ParameterSet conf_
Definition: HcalDAQInfo.cc:61
MonitorElement * HFlumiDaqFraction
Definition: HcalDAQInfo.cc:70
tuple cout
Definition: gather_cfg.py:145
std::string rootFolder_
Definition: HcalDAQInfo.cc:72
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * HEDaqFraction
Definition: HcalDAQInfo.cc:65
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125
MonitorElement * HO12DaqFraction
Definition: HcalDAQInfo.cc:69