CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDAQInfo.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * \author G. Cerminara - INFN Torino
6  *
7  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my
8  *
9  */
10 
11 
14 
18 
21 
25 
26 
29 
31 
32 
33 
34 using namespace std;
35 using namespace edm;
36 
37 
38 
40 
41  bookingdone = 0;
42 
43 }
44 
46 
48  edm::EventSetup const & setup) {
49 
50  if (!bookingdone) {
51  // retrieve the mapping
52  setup.get<DTReadOutMappingRcd>().get(mapping);
53 
54  // book the ME
55  // global fraction
56 
57  ibooker.setCurrentFolder("DT/EventInfo");
58 
59  totalDAQFraction = ibooker.bookFloat("DAQSummary");
60  totalDAQFraction->Fill(-1);
61  cout << " totalDAQFraction done " << endl;
62 
63  // map
64  daqMap = ibooker.book2D("DAQSummaryMap","DT Certification Summary Map",12,1,13,5,-2,3);
65  daqMap->setAxisTitle("sector",1);
66  daqMap->setAxisTitle("wheel",2);
67  cout << " map done " << endl;
68 
69  // Wheel "fractions" -> will be 0 or 1
70 
71  ibooker.setCurrentFolder("DT/EventInfo/DAQContents");
72  for(int wheel = -2; wheel != 3; ++wheel) {
73  stringstream streams;
74  streams << "DT_Wheel" << wheel;
75 
76  daqFractions[wheel] = ibooker.bookFloat(streams.str());
77  daqFractions[wheel]->Fill(-1);
78  }
79 
80  //
81 
82  // create a record key for RunInfoRcd
84 
85  if(setup.find(recordKey) != 0) {
86 
87  //FR not sure that the lines below are still useful, we have just booked the histo!
88  // reset to 0
89  totalDAQFraction->Fill(0.);
90  daqFractions[-2]->Fill(0.);
91  daqFractions[-1]->Fill(0.);
92  daqFractions[-0]->Fill(0.);
93  daqFractions[1]->Fill(0.);
94  daqFractions[2]->Fill(0.);
95 
96  daqMap->Reset();
97  //get fed summary information
98  ESHandle<RunInfo> sumFED;
99  setup.get<RunInfoRcd>().get(sumFED);
100  vector<int> fedInIDs = sumFED->m_fed_in;
101 
102  // the range of DT feds
103  static int FEDIDmin = FEDNumbering::MINDTFEDID;
104  static int FEDIDMax = FEDNumbering::MAXDTFEDID;
105 
106  // loop on all active feds
107  for(vector<int>::const_iterator fed = fedInIDs.begin();
108  fed != fedInIDs.end();
109  ++fed) {
110  // check if the fed is in the DT range
111  if(!(*fed >= FEDIDmin && *fed <= FEDIDMax)) continue;
112 
113  // check if the 12 channels are connected to any sector and fill the wheel percentage accordignly
114  int wheel = -99;
115  int sector = -99;
116  int dummy = -99;
117 
118  for(int ros = 1; ros != 13; ++ros) {
119  if(!mapping->readOutToGeometry(*fed,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy)) {
120  LogTrace("DQM|DTMonitorClient|DTDAQInfo")
121  << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
122  daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1./12.);
123  totalDAQFraction->Fill(totalDAQFraction->getFloatValue() + 1./60.);
124  daqMap->Fill(sector,wheel);
125  }
126  }
127  }
128  } else {
129 
130  LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
131  totalDAQFraction->Fill(-1);
132  for(int wheel = -2; wheel != 3; ++wheel) {
133  daqFractions[wheel]->Fill(-1);
134 
135  }
136  return;
137  }
138 
139  }
140  bookingdone = 1;
141 
142  // create a record key for RunInfoRcd
144 
145  if(setup.find(recordKey) != 0) {
146  // reset to 0
147  totalDAQFraction->Fill(0.);
148  daqFractions[-2]->Fill(0.);
149  daqFractions[-1]->Fill(0.);
150  daqFractions[-0]->Fill(0.);
151  daqFractions[1]->Fill(0.);
152  daqFractions[2]->Fill(0.);
153 
154 
155  daqMap->Reset();
156  //get fed summary information
157  ESHandle<RunInfo> sumFED;
158  setup.get<RunInfoRcd>().get(sumFED);
159  vector<int> fedInIDs = sumFED->m_fed_in;
160 
161  // the range of DT feds
162  static int FEDIDmin = FEDNumbering::MINDTFEDID;
163  static int FEDIDMax = FEDNumbering::MAXDTFEDID;
164 
165  // loop on all active feds
166  for(vector<int>::const_iterator fed = fedInIDs.begin();
167  fed != fedInIDs.end();
168  ++fed) {
169  // check if the fed is in the DT range
170  if(!(*fed >= FEDIDmin && *fed <= FEDIDMax)) continue;
171 
172  // check if the 12 channels are connected to any sector and fill the wheel percentage accordignly
173  int wheel = -99;
174  int sector = -99;
175  int dummy = -99;
176  for(int ros = 1; ros != 13; ++ros) {
177  if(!mapping->readOutToGeometry(*fed,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy)) {
178  LogTrace("DQM|DTMonitorClient|DTDAQInfo")
179  << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
180  daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1./12.);
181  totalDAQFraction->Fill(totalDAQFraction->getFloatValue() + 1./60.);
182  daqMap->Fill(sector,wheel);
183  }
184  cout << " daqMap->Fill , ros = " << ros<<endl;
185  }
186  }
187  } else {
188  cout << " recordkey nehi "<<endl;
189  LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
190  totalDAQFraction->Fill(-1);
191  for(int wheel = -2; wheel != 3; ++wheel) {
192  daqFractions[wheel]->Fill(-1);
193  }
194  return;
195  }
196 }
197 
199 
200 
201 
202 
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:76
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
void Fill(long long x)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: DTDAQInfo.cc:198
#define LogTrace(id)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DTDAQInfo.cc:47
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:55
virtual ~DTDAQInfo()
Destructor.
Definition: DTDAQInfo.cc:45
DTDAQInfo(const edm::ParameterSet &pset)
Constructor.
Definition: DTDAQInfo.cc:39
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")