CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SelectiveReadoutClient.cc
Go to the documentation of this file.
1 #include "../interface/SelectiveReadoutClient.h"
2 
4 
6 
7 #include <cmath>
8 
9 namespace ecaldqm {
10 
12  DQWorkerClient(_params, _paths, "SelectiveReadoutClient")
13  {
14  edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
15  source_(sFlagCounterMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFlagCounterMap, sources);
16  source_(sRUForcedMap, "SelectiveReadoutTask", SelectiveReadoutTask::kRUForcedMap, sources);
17  source_(sFullReadoutMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFullReadoutMap, sources);
18  source_(sZS1Map, "SelectiveReadoutTask", SelectiveReadoutTask::kZS1Map, sources);
19  source_(sZSMap, "SelectiveReadoutTask", SelectiveReadoutTask::kZSMap, sources);
20  source_(sZSFullReadoutMap, "SelectiveReadoutTask", SelectiveReadoutTask::kZSFullReadoutMap, sources);
21  source_(sFRDroppedMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFRDroppedMap, sources);
22  }
23 
24  void
26  {
27  using namespace std;
28 
29  MEs_[kFRDropped]->reset();
30  MEs_[kZSReadout]->reset();
31  MEs_[kFR]->reset();
32  MEs_[kRUForced]->reset();
33  MEs_[kZS1]->reset();
34 
35  for(unsigned dccid(1); dccid <= 54; dccid++){
36 
37  for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
38  vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
39 
40  if(ids.size() == 0) continue;
41 
42  float nFlags(0.);
43  float nRUForced(0.);
44  float nFullReadoutFlags(0.);
45  float nZS1Flags(0.);
46  float nZS12Flags(0.);
47  float nZSFullReadout(0.);
48  float nFRDropped(0.);
49  if(dccid <= 9 || dccid >= 46){
50  vector<EcalScDetId> scids(getElectronicsMap()->getEcalScDetId(dccid, tower));
51  for(vector<EcalScDetId>::iterator scItr(scids.begin()); scItr != scids.end(); ++scItr){
52  nFlags += sources_[sFlagCounterMap]->getBinContent(*scItr);
53  nRUForced += sources_[sRUForcedMap]->getBinContent(*scItr);
54  nFullReadoutFlags += sources_[sFullReadoutMap]->getBinContent(*scItr);
55  nZS1Flags += sources_[sZS1Map]->getBinContent(*scItr);
56  nZS12Flags += sources_[sZSMap]->getBinContent(*scItr);
57  nZSFullReadout += sources_[sZSFullReadoutMap]->getBinContent(*scItr);
58  nFRDropped += sources_[sFRDroppedMap]->getBinContent(*scItr);
59  }
60 
61  for(vector<EcalScDetId>::iterator scItr(scids.begin()); scItr != scids.end(); ++scItr){
62  if(nFlags > 0.) MEs_[kFR]->setBinContent(*scItr, nFullReadoutFlags / nFlags);
63  if(nFlags > 0.) MEs_[kZS1]->setBinContent(*scItr, nZS1Flags / nFlags);
64  if(nFlags > 0.) MEs_[kRUForced]->setBinContent(*scItr, nRUForced / nFlags);
65  if(nZS12Flags > 0.) MEs_[kZSReadout]->setBinContent(*scItr, nZSFullReadout / nZS12Flags);
66  if(nFullReadoutFlags > 0.) MEs_[kFRDropped]->setBinContent(*scItr, nFRDropped / nFullReadoutFlags);
67  }
68  }
69  else{
70  nFlags = sources_[sFlagCounterMap]->getBinContent(ids[0]);
71  nRUForced = sources_[sRUForcedMap]->getBinContent(ids[0]);
72  nFullReadoutFlags = sources_[sFullReadoutMap]->getBinContent(ids[0]);
73  nZS1Flags = sources_[sZS1Map]->getBinContent(ids[0]);
74  nZS12Flags = sources_[sZSMap]->getBinContent(ids[0]);
75  nZSFullReadout = sources_[sZSFullReadoutMap]->getBinContent(ids[0]);
76  nFRDropped = sources_[sFRDroppedMap]->getBinContent(ids[0]);
77 
78 
79  if(nFlags > 0.) MEs_[kFR]->setBinContent(ids[0], nFullReadoutFlags / nFlags);
80  if(nFlags > 0.) MEs_[kZS1]->setBinContent(ids[0], nZS1Flags / nFlags);
81  if(nFlags > 0.) MEs_[kRUForced]->setBinContent(ids[0], nRUForced / nFlags);
82  if(nZS12Flags > 0.) MEs_[kZSReadout]->setBinContent(ids[0], nZSFullReadout / nZS12Flags);
83  if(nFullReadoutFlags > 0.) MEs_[kFRDropped]->setBinContent(ids[0], nFRDropped / nFullReadoutFlags);
84  }
85  }
86  }
87  }
88 
89  /*static*/
90  void
91  SelectiveReadoutClient::setMEData(std::vector<MEData>& _data)
92  {
98  }
99 
101 }
102 
const EcalElectronicsMapping * getElectronicsMap()
static void setMEData(std::vector< MEData > &)
SelectiveReadoutClient(const edm::ParameterSet &, const edm::ParameterSet &)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void source_(unsigned, std::string const &, unsigned, edm::ParameterSet const &)
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
unsigned getNSuperCrystals(unsigned)
std::vector< MESet const * > sources_
DEFINE_ECALDQM_WORKER(CertificationClient)