CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RawTask.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
5  DQTask(ps)
6 {
7  // specify all the Containers
8  _cVMEEvnMsm.initialize(_name+"/VME/EvnMsm", "EvnMismatch",
11  _cVMEBcnMsm.initialize(_name+"/VME/BcnMsm", "BcnMismatch",
14  _cVMEOrnMsm.initialize(_name+"/VME/OrnMsm", "OrnMismatch",
17  _cuTCAEvnMsm.initialize(_name+"/uTCA/EvnMsm", "EvnMismatch",
20  _cuTCABcnMsm.initialize(_name+"/uTCA/BcnMsm", "BcnMismatch",
23  _cuTCAOrnMsm.initialize(_name+"/uTCA/OrnMsm", "OrnMismatch",
26  _cVMEOccupancy.initialize(_name+"/VME/Occupancy", "Occupancy",
29  _cuTCAOccupancy.initialize(_name+"/uTCA/Occupancy", "Occupancy",
32 
33  // Summary Containers
34  _cSummary.initialize(_name+"/Summary", "Summary",
36  new axis::FlagAxis(axis::fYaxis, "Flag", int(nRawFlag)));
37  _cSummaryvsLS_FED.initialize(_name+"/Summary/vsLS_FED", "SummaryvsLS",
40  new axis::FlagAxis(axis::fYaxis, "Flag", int(nRawFlag)));
41 
42  // tags
44  edm::InputTag("rawDataCollector"));
45  _tokFEDs = consumes<FEDRawDataCollection>(_tagFEDs);
46 
47  // Skip List
48  _vSkipFEDList = ps.getUntrackedParameter<std::vector<int> >("skipFEDList");
49 
50  // load labels
51  _fNames.push_back("EVN Mismatch");
52  _fNames.push_back("ORN Mismatch");
53  _fNames.push_back("BCN Mismatch");
56 }
57 
59  edm::Run const& r, edm::EventSetup const& es)
60 {
61  DQTask::bookHistograms(ib, r, es);
62  _cVMEEvnMsm.book(ib);
63  _cVMEBcnMsm.book(ib);
64  _cVMEOrnMsm.book(ib);
65  _cuTCAEvnMsm.book(ib);
66  _cuTCABcnMsm.book(ib);
67  _cuTCAOrnMsm.book(ib);
68  _cVMEOccupancy.book(ib);
70 
71  _cSummary.book(ib);
73 }
74 
76  edm::EventSetup const& es)
77 {
78  // statuses
79  // By default the flag is not applicable
81  for (int i=0; i<constants::FED_TOTAL_NUM; i++)
82  for (int j=fEvnMsm; j<nRawFlag; j++)
83  status[i][j] = constants::NOT_APPLICABLE;
84 
85  /*
86  * Do the checks here
87  * -> Evn Mismatch
88  * -> Bcn Mismatch
89  * -> Orn Mismatch (Not Applicable)
90  */
91 
92  // evn/bcn
93  for (int i=0; i<constants::FED_TOTAL_NUM; i++)
94  {
95  // skip status evaluation of empty FEDs
96  bool q = false;
97  for (std::vector<int>::const_iterator it=_vSkipFEDList.begin();
98  it!=_vSkipFEDList.end(); ++it)
99  if ((*it) == utilities::getFEDById(i))
100  {
101  q = true;
102  break;
103  }
104  if (q==true)
105  continue;
106 
107  if (_nEvnMsm[i]>0)
108  status[i][fEvnMsm] = constants::LOW;
109  else
110  status[i][fEvnMsm] = constants::GOOD;
111  if (_nBcnMsm[i]>0)
112  status[i][fBcnMsm] = constants::LOW;
113  else
114  status[i][fBcnMsm] = constants::GOOD;
115  }
116 
117  // finally set all the statuses
118  for (unsigned int i=0; i<constants::FED_TOTAL_NUM; i++)
119  for (int j=fEvnMsm; j<nRawFlag; j++)
120  {
121  _cSummary.setBinContent(i, j, status[i][j]);
123  j, status[i][j]);
124  }
125 
126  DQTask::endLuminosityBlock(l, es);
127 }
128 
129 /* virtual */ void RawTask::_process(edm::Event const& e,
130  edm::EventSetup const&)
131 {
133  if (!e.getByToken(_tokFEDs, craw))
134  _logger.dqmthrow("Collection FEDRawDataCollection isn't available"
135  + _tagFEDs.label() + " " + _tagFEDs.instance());
136 
137  for (int fed=FEDNumbering::MINHCALFEDID;
138  fed<+FEDNumbering::MAXHCALuTCAFEDID; fed++)
139  {
140  // skip all non-HCAL FEDs
141  if ((fed>FEDNumbering::MAXHCALFEDID &&
144  continue;
145 
146  FEDRawData const& raw = craw->FEDData(fed);
147  if (raw.size() < RAW_EMPTY)// skip if empty
148  continue;
149 
150  if (fed<=FEDNumbering::MAXHCALFEDID) // VME
151  {
152  HcalDCCHeader const* hdcc = (HcalDCCHeader const*)(raw.data());
153  if (!hdcc)
154  continue;;
155  unsigned int bcn = hdcc->getBunchId();
156  unsigned int orn = hdcc->getOrbitNumber();
157  unsigned long evn = hdcc->getDCCEventNumber();
158  int dccId = hdcc->getSourceId()-700; // 700 is the hard offset
159 
160  // Iterate over all the spigots
161  HcalHTRData htr;
162  for (int is=0; is<HcalDCCHeader::SPIGOT_COUNT; is++)
163  {
164  int r = hdcc->getSpigotData(is, htr, raw.size());
165 
166  // invalid data
167  if (r!=0)
168  continue;
169 
170  unsigned int htr_evn = htr.getL1ANumber();
171  unsigned int htr_orn = htr.getOrbitNumber();
172  unsigned int htr_bcn = htr.getBunchNumber();
173  bool qevn = htr_evn!=evn;
174  bool qorn = htr_orn!=orn;
175  bool qbcn = htr_bcn!=bcn;
176  HcalElectronicsId eid(0, 1, is, dccId);
177  _cVMEEvnMsm.fill(fed, eid, qevn ? 1 : 0);
178  _cVMEBcnMsm.fill(fed, eid, qbcn ? 1 : 0);
179  _cVMEOrnMsm.fill(fed, eid, qorn ? 1 : 0);
181  qevn ? 1 : 0;
183  qbcn ? 1 : 0;
184  _cVMEOccupancy.fill(fed, eid);
185  }
186 
187  }
188  else // uTCA
189  {
190  hcal::AMC13Header const* hamc13 = (hcal::AMC13Header const*)
191  (raw.data());
192  if (!hamc13)
193  continue;
194 
195  unsigned int bcn = hamc13->bunchId();
196  unsigned int orn = hamc13->orbitNumber();
197  unsigned int evn = hamc13->l1aNumber();
198  int namc = hamc13->NAMC();
199 
200  // itearte over all AMC13
201  for (int iamc=0; iamc<namc; iamc++)
202  {
203  int slot = hamc13->AMCSlot(iamc);
204  int crate = hamc13->AMCId(iamc)&0xFF;
205  HcalElectronicsId eid(crate, slot, 5, 0, false);
206  HcalUHTRData uhtr(hamc13->AMCPayload(iamc),
207  hamc13->AMCSize(iamc));
208  for (HcalUHTRData::const_iterator iuhtr=uhtr.begin();
209  iuhtr!=uhtr.end(); ++iuhtr)
210  {
211  if (!iuhtr.isHeader())
212  continue;
213 
214  _cuTCAOccupancy.fill(fed, eid);
215  // use data flavour - found in the unpacker
216  if (iuhtr.flavor()==UTCA_DATAFLAVOR)
217  {
218  uint32_t uhtr_evn = uhtr.l1ANumber();
219  uint32_t uhtr_bcn = uhtr.bunchNumber();
220  uint32_t uhtr_orn = uhtr.orbitNumber();
221  bool qevn = uhtr_evn!=evn;
222  bool qorn = uhtr_orn!=orn;
223  bool qbcn = uhtr_bcn!=bcn;
224  _cuTCAEvnMsm.fill(fed, eid,
225  qevn ? 1 : 0);
226  _cuTCABcnMsm.fill(fed, eid,
227  qbcn ? 1 : 0);
228  _cuTCAOrnMsm.fill(fed, eid,
229  qorn ? 1 : 0);
231  qevn ? 1 : 0;
233  qbcn ? 1 : 0;
234  }
235  }
236  }
237  }
238  }
239 }
240 
241 /* virtual */ void RawTask::_resetMonitors(UpdateFreq uf)
242 {
243  switch (uf)
244  {
245  case fEvent:
246  break;
247  case hcaldqm::fLS:
248  for (int i=0; i<constants::FED_TOTAL_NUM; i++)
249  {
250  _nEvnMsm[i] = 0;
251  _nOrnMsm[i] = 0;
252  _nBcnMsm[i] = 0;
253  }
254  break;
255  case hcaldqm::f10LS:
256 // _cVMEEvnMsm.reset();
257 // _cVMEOrnMsm.reset();
258 // _cVMEBcnMsm.reset();
259 // _cuTCAEvnMsm.reset();
260 // _cuTCAOrnMsm.reset();
261 // _cuTCABcnMsm.reset();
262  break;
263  default:
264  break;
265  }
266 
267  DQTask::_resetMonitors(uf);
268 }
269 
ContainerSingle2D _cVMEBcnMsm
Definition: RawTask.h:69
double const LOW
Definition: Constants.h:17
virtual void initialize(std::string const &folder, std::string const &nametitle, axis::Axis *xaxis, axis::Axis *yaxis=new CoordinateAxis(fYaxis, axis::fiphi), axis::Axis *zaxis=new ValueAxis(fZaxis, fEntries), int debug=0)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:233
ContainerSingle2D _cVMEEvnMsm
Definition: RawTask.h:68
int const RAW_EMPTY
Definition: Constants.h:171
virtual void initialize(std::string const &folder, std::string nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new axis::CoordinateAxis(axis::fYaxis, axis::fiphi), axis::Axis *zaxis=new axis::ValueAxis(axis::fZaxis, axis::fEntries), int debug=0)
Definition: Container2D.cc:30
int ib
Definition: cuy.py:660
ContainerSingle2D _cuTCABcnMsm
Definition: RawTask.h:72
ContainerSingle2D _cVMEOccupancy
Definition: RawTask.h:76
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: RawTask.cc:58
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ContainerSingle2D _cuTCAOccupancy
Definition: RawTask.h:77
UpdateFreq
Definition: DQTask.h:16
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: RawTask.cc:129
int l1aNumber() const
Definition: AMC13Header.h:19
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
virtual void setBinContent(int, int, double)
virtual void loadLabels(std::vector< std::string > const &)
unsigned int getOrbitNumber() const
Get the HTR orbit number.
Definition: HcalHTRData.cc:324
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void bookHistograms(fwlite::EventContainer &eventCont)
int const UTCA_DATAFLAVOR
Definition: Constants.h:172
int _nOrnMsm[constants::FED_VME_NUM+constants::FED_uTCA_NUM]
Definition: RawTask.h:59
int AMCSize(int i) const
Definition: AMC13Header.h:37
int getFEDById(int)
Definition: Utilities.cc:77
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > _vSkipFEDList
Definition: RawTask.h:46
unsigned int getOrbitNumber() const
Definition: HcalDCCHeader.h:46
ContainerSingle2D _cuTCAEvnMsm
Definition: RawTask.h:71
int getBunchId() const
Definition: HcalDCCHeader.h:34
int bunchId() const
Definition: AMC13Header.h:17
ContainerSingle2D _cSummary
Definition: RawTask.h:80
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
ContainerSingle2D _cuTCAOrnMsm
Definition: RawTask.h:73
virtual void _resetMonitors(UpdateFreq)
Definition: RawTask.cc:241
virtual void loadLabels(std::vector< std::string > const &)
Definition: Container2D.cc:294
int j
Definition: DBlmapReader.cc:9
RawTask(edm::ParameterSet const &)
Definition: RawTask.cc:4
Logger _logger
Definition: DQModule.h:62
double const GOOD
Definition: Constants.h:15
std::string _name
Definition: DQModule.h:50
edm::EDGetTokenT< FEDRawDataCollection > _tokFEDs
Definition: RawTask.h:50
Container2D _cSummaryvsLS_FED
Definition: RawTask.h:81
int getSourceId() const
Definition: HcalDCCHeader.h:32
unsigned int orbitNumber() const
Definition: AMC13Header.h:23
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: RawTask.cc:75
int getIdByFED(int)
Definition: Utilities.cc:87
ContainerSingle2D _cVMEOrnMsm
Definition: RawTask.h:70
std::string const & label() const
Definition: InputTag.h:36
virtual void setBinContent(int, int, int, double)
Definition: Container2D.cc:263
edm::InputTag _tagFEDs
Definition: RawTask.h:49
int NAMC() const
Definition: AMC13Header.h:25
double const NOT_APPLICABLE
Definition: Constants.h:19
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
int AMCSlot(int i) const
Definition: AMC13Header.h:33
const uint64_t * AMCPayload(int i) const
Definition: AMC13Header.cc:4
unsigned int getBunchNumber() const
Get the HTR bunch number.
Definition: HcalHTRData.h:115
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int const FED_TOTAL_NUM
Definition: Constants.h:35
std::vector< std::string > _fNames
Definition: RawTask.h:53
virtual void fill(int, int)
int _nBcnMsm[constants::FED_VME_NUM+constants::FED_uTCA_NUM]
Definition: RawTask.h:61
tuple status
Definition: ntuplemaker.py:245
uint16_t AMCId(int i) const
Definition: AMC13Header.h:31
unsigned int getL1ANumber() const
Get the HTR event number.
Definition: HcalHTRData.h:111
unsigned dccId(DetId const &)
unsigned long getDCCEventNumber() const
Definition: HcalDCCHeader.h:36
int _nEvnMsm[constants::FED_VME_NUM+constants::FED_uTCA_NUM]
Definition: RawTask.h:57
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
Definition: Run.h:43