CMS 3D CMS Logo

CalibrationSummaryClient.cc
Go to the documentation of this file.
2 
5 
7 
9 
10 #include <algorithm>
11 
12 namespace ecaldqm {
14  : DQWorkerClient(),
15  laserWlToME_(),
16  ledWlToME_(),
17  tpGainToME_(),
18  tpPNGainToME_(),
19  pedGainToME_(),
20  pedPNGainToME_() {}
21 
23  std::vector<std::string> sourceList(_params.getUntrackedParameter<std::vector<std::string> >("activeSources"));
24  if (std::find(sourceList.begin(), sourceList.end(), "Laser") == sourceList.end()) {
25  sources_.erase(std::string("Laser"));
26  sources_.erase(std::string("LaserPN"));
27  }
28  if (std::find(sourceList.begin(), sourceList.end(), "Led") == sourceList.end()) {
29  sources_.erase(std::string("Led"));
30  sources_.erase(std::string("LedPN"));
31  }
32  if (std::find(sourceList.begin(), sourceList.end(), "TestPulse") == sourceList.end()) {
33  sources_.erase(std::string("TestPulse"));
34  sources_.erase(std::string("TestPulsePN"));
35  }
36  if (std::find(sourceList.begin(), sourceList.end(), "Pedestal") == sourceList.end()) {
37  sources_.erase(std::string("Pedestal"));
38  sources_.erase(std::string("PedestalPN"));
39  }
40 
42 
43  if (using_("Laser")) {
44  repl.clear();
45  std::vector<int> laserWavelengths(_params.getUntrackedParameter<std::vector<int> >("laserWavelengths"));
46  MESetMulti const& laser(static_cast<MESetMulti const&>(sources_.at("Laser")));
47  unsigned nWL(laserWavelengths.size());
48  for (unsigned iWL(0); iWL != nWL; ++iWL) {
49  int wl(laserWavelengths[iWL]);
50  if (wl <= 0 || wl >= 5)
51  throw cms::Exception("InvalidConfiguration") << "Laser Wavelength";
52  repl["wl"] = std::to_string(wl);
53  laserWlToME_[wl] = laser.getIndex(repl);
54  }
55  }
56 
57  if (using_("Led")) {
58  repl.clear();
59  std::vector<int> ledWavelengths(_params.getUntrackedParameter<std::vector<int> >("ledWavelengths"));
60  MESetMulti const& led(static_cast<MESetMulti const&>(sources_.at("Led")));
61  unsigned nWL(ledWavelengths.size());
62  for (unsigned iWL(0); iWL != nWL; ++iWL) {
63  int wl(ledWavelengths[iWL]);
64  if (wl <= 0 || wl >= 5)
65  throw cms::Exception("InvalidConfiguration") << "Led Wavelength";
66  repl["wl"] = std::to_string(wl);
67  ledWlToME_[wl] = led.getIndex(repl);
68  }
69  }
70 
71  if (using_("TestPulse")) {
72  repl.clear();
73  std::vector<int> tpMGPAGains(_params.getUntrackedParameter<std::vector<int> >("testPulseMGPAGains"));
74  MESetMulti const& tp(static_cast<MESetMulti const&>(sources_.at("TestPulse")));
75  unsigned nG(tpMGPAGains.size());
76  for (unsigned iG(0); iG != nG; ++iG) {
77  int gain(tpMGPAGains[iG]);
78  if (gain != 1 && gain != 6 && gain != 12)
79  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
80  repl["gain"] = std::to_string(gain);
81  tpGainToME_[gain] = tp.getIndex(repl);
82  }
83 
84  repl.clear();
85  std::vector<int> tpMGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("testPulseMGPAGainsPN"));
86  MESetMulti const& tppn(static_cast<MESetMulti const&>(sources_.at("TestPulsePN")));
87  unsigned nGPN(tpMGPAGainsPN.size());
88  for (unsigned iG(0); iG != nGPN; ++iG) {
89  int gain(tpMGPAGainsPN[iG]);
90  if (gain != 1 && gain != 16)
91  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
92  repl["pngain"] = std::to_string(gain);
93  tpPNGainToME_[gain] = tppn.getIndex(repl);
94  }
95  }
96 
97  if (using_("Pedestal")) {
98  repl.clear();
99  std::vector<int> pedMGPAGains(_params.getUntrackedParameter<std::vector<int> >("pedestalMGPAGains"));
100  MESetMulti const& ped(static_cast<MESetMulti const&>(sources_.at("Pedestal")));
101  unsigned nG(pedMGPAGains.size());
102  for (unsigned iG(0); iG != nG; ++iG) {
103  int gain(pedMGPAGains[iG]);
104  if (gain != 1 && gain != 6 && gain != 12)
105  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
106  repl["gain"] = std::to_string(gain);
107  pedGainToME_[gain] = ped.getIndex(repl);
108  }
109 
110  repl.clear();
111  std::vector<int> pedMGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("pedestalMGPAGainsPN"));
112  MESetMulti const& pedpn(static_cast<MESetMulti const&>(sources_.at("PedestalPN")));
113  unsigned nGPN(pedMGPAGainsPN.size());
114  for (unsigned iG(0); iG != nGPN; ++iG) {
115  int gain(pedMGPAGainsPN[iG]);
116  if (gain != 1 && gain != 16)
117  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
118  repl["pngain"] = std::to_string(gain);
119  pedPNGainToME_[gain] = pedpn.getIndex(repl);
120  }
121  }
122 
123  qualitySummaries_.insert("QualitySummary");
124  qualitySummaries_.insert("PNQualitySummary");
125  }
126 
128  using namespace std;
129 
130  MESet& meQualitySummary(MEs_.at("QualitySummary"));
131  MESet& mePNQualitySummary(MEs_.at("PNQualitySummary"));
132 
133  MESetMulti const* sLaser(using_("Laser") ? static_cast<MESetMulti const*>(&sources_.at("Laser")) : nullptr);
134  MESetMulti const* sLaserPN(using_("LaserPN") ? static_cast<MESetMulti const*>(&sources_.at("LaserPN")) : nullptr);
135  MESetMulti const* sLed(using_("Led") ? static_cast<MESetMulti const*>(&sources_.at("Led")) : nullptr);
136  MESetMulti const* sLedPN(using_("LedPN") ? static_cast<MESetMulti const*>(&sources_.at("LedPN")) : nullptr);
137  MESetMulti const* sTestPulse(using_("TestPulse") ? static_cast<MESetMulti const*>(&sources_.at("TestPulse"))
138  : nullptr);
139  MESetMulti const* sTestPulsePN(using_("TestPulsePN") ? static_cast<MESetMulti const*>(&sources_.at("TestPulsePN"))
140  : nullptr);
141  MESetMulti const* sPedestal(using_("Pedestal") ? static_cast<MESetMulti const*>(&sources_.at("Pedestal"))
142  : nullptr);
143  MESetMulti const* sPedestalPN(using_("PedestalPN") ? static_cast<MESetMulti const*>(&sources_.at("PedestalPN"))
144  : nullptr);
145  MESet const& sPNIntegrity(sources_.at("PNIntegrity"));
146 
147  MESet::iterator qEnd(meQualitySummary.end(GetElectronicsMap()));
148  for (MESet::iterator qItr(meQualitySummary.beginChannel(GetElectronicsMap())); qItr != qEnd;
150  DetId id(qItr->getId());
151 
152  int status(kGood);
153 
154  if (status == kGood && sLaser) {
155  for (map<int, unsigned>::iterator wlItr(laserWlToME_.begin()); wlItr != laserWlToME_.end(); ++wlItr) {
156  sLaser->use(wlItr->second);
157  if (sLaser->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
158  status = kBad;
159  break;
160  }
161  }
162  }
163 
164  if (status == kGood && sLed) {
165  DetId id(qItr->getId());
166  if (id.subdetId() == EcalEndcap) {
167  for (map<int, unsigned>::iterator wlItr(ledWlToME_.begin()); wlItr != ledWlToME_.end(); ++wlItr) {
168  sLed->use(wlItr->second);
169  if (sLed->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
170  status = kBad;
171  break;
172  }
173  }
174  }
175  }
176 
177  if (status == kGood && sTestPulse) {
178  for (map<int, unsigned>::iterator gainItr(tpGainToME_.begin()); gainItr != tpGainToME_.end(); ++gainItr) {
179  sTestPulse->use(gainItr->second);
180  if (sTestPulse->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
181  status = kBad;
182  break;
183  }
184  }
185  }
186 
187  if (status == kGood && sPedestal) {
188  for (map<int, unsigned>::iterator gainItr(pedGainToME_.begin()); gainItr != pedGainToME_.end(); ++gainItr) {
189  sPedestal->use(gainItr->second);
190  if (sPedestal->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
191  status = kBad;
192  break;
193  }
194  }
195  }
196 
197  qItr->setBinContent(status);
198  }
199 
200  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
201  if (memDCCIndex(iDCC + 1) == unsigned(-1))
202  continue;
203  for (unsigned iPN(0); iPN < 10; ++iPN) {
204  int subdet(0);
205  if (iDCC >= kEBmLow && iDCC <= kEBpHigh)
206  subdet = EcalBarrel;
207  else
208  subdet = EcalEndcap;
209 
210  EcalPnDiodeDetId id(subdet, iDCC + 1, iPN + 1);
211 
212  int status(kGood);
213 
214  if (sPNIntegrity.getBinContent(getEcalDQMSetupObjects(), id) == kBad)
215  status = kBad;
216 
217  if (status == kGood && sLaserPN) {
218  for (map<int, unsigned>::iterator wlItr(laserWlToME_.begin()); wlItr != laserWlToME_.end(); ++wlItr) {
219  sLaserPN->use(wlItr->second);
220  if (sLaserPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
221  status = kBad;
222  break;
223  }
224  }
225  }
226 
227  if (status == kGood && sLedPN) {
228  for (map<int, unsigned>::iterator wlItr(ledWlToME_.begin()); wlItr != ledWlToME_.end(); ++wlItr) {
229  sLedPN->use(wlItr->second);
230  if (sLedPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
231  status = kBad;
232  break;
233  }
234  }
235  }
236 
237  if (status == kGood && sTestPulsePN) {
238  for (map<int, unsigned>::iterator gainItr(tpPNGainToME_.begin()); gainItr != tpPNGainToME_.end(); ++gainItr) {
239  sTestPulsePN->use(gainItr->second);
240  if (sTestPulsePN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
241  status = kBad;
242  break;
243  }
244  }
245  }
246 
247  if (status == kGood && sPedestalPN) {
248  for (map<int, unsigned>::iterator gainItr(pedPNGainToME_.begin()); gainItr != pedPNGainToME_.end();
249  ++gainItr) {
250  sPedestalPN->use(gainItr->second);
251  if (sPedestalPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
252  status = kBad;
253  break;
254  }
255  }
256  }
257 
258  mePNQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, status);
259  }
260  }
261  }
262 
264 } // namespace ecaldqm
ecaldqm::DQWorkerClient::using_
bool using_(std::string const &_name, ProcessType _type=kJob) const
Definition: DQWorkerClient.h:43
ecaldqm
Definition: DQWorker.h:29
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel(EcalElectronicsMapping const *electronicsMap)
Definition: MESet.h:320
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
mps_update.status
status
Definition: mps_update.py:69
ecaldqm::CalibrationSummaryClient::tpGainToME_
std::map< int, unsigned > tpGainToME_
Definition: CalibrationSummaryClient.h:20
ecaldqm::MESet::PathReplacements
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::memDCCIndex
unsigned memDCCIndex(unsigned)
Definition: EcalDQMCommonUtils.cc:46
ecaldqm::CalibrationSummaryClient
Definition: CalibrationSummaryClient.h:8
ecaldqm::CalibrationSummaryClient::pedPNGainToME_
std::map< int, unsigned > pedPNGainToME_
Definition: CalibrationSummaryClient.h:23
EcalCondDBWriter_cfi.led
led
Definition: EcalCondDBWriter_cfi.py:47
EcalPnDiodeDetId
Definition: EcalPnDiodeDetId.h:22
ecaldqm::MESetMulti::use
void use(unsigned) const
Definition: MESetMulti.cc:135
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:104
EcalBarrel
Definition: EcalSubdetector.h:10
ecaldqm::CalibrationSummaryClient::ledWlToME_
std::map< int, unsigned > ledWlToME_
Definition: CalibrationSummaryClient.h:19
ecaldqm::CalibrationSummaryClient::producePlots
void producePlots(ProcessType) override
Definition: CalibrationSummaryClient.cc:127
DetId
Definition: DetId.h:17
CalibrationSummaryClient.h
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:15
ecaldqm::MESetMulti::getIndex
unsigned getIndex(PathReplacements const &) const
Definition: MESetMulti.cc:142
ecaldqm::kEBpHigh
Definition: EcalDQMCommonUtils.h:87
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:104
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::DQWorkerClient::kBad
Definition: DQWorkerClient.h:37
EcalPnDiodeDetId.h
CalibrationSummaryClient_cfi.laserWavelengths
laserWavelengths
Definition: CalibrationSummaryClient_cfi.py:15
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::CalibrationSummaryClient::CalibrationSummaryClient
CalibrationSummaryClient()
Definition: CalibrationSummaryClient.cc:13
ecaldqm::MESetMulti
Definition: MESetMulti.h:13
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::MESet::iterator
Definition: MESet.h:297
ecaldqm::MESetCollection::erase
void erase(const std::string &key)
Definition: MESet.h:390
ecaldqm::kEBmLow
Definition: EcalDQMCommonUtils.h:84
CalibrationSummaryClient_cfi.ledWavelengths
ledWavelengths
Definition: CalibrationSummaryClient_cfi.py:16
ecaldqm::DQWorkerClient
Definition: DQWorkerClient.h:13
ecaldqm::CalibrationSummaryClient::pedGainToME_
std::map< int, unsigned > pedGainToME_
Definition: CalibrationSummaryClient.h:22
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:128
std
Definition: JetResolutionObject.h:76
ecaldqm::CalibrationSummaryClient::laserWlToME_
std::map< int, unsigned > laserWlToME_
Definition: CalibrationSummaryClient.h:18
ecaldqm::CalibrationSummaryClient::tpPNGainToME_
std::map< int, unsigned > tpPNGainToME_
Definition: CalibrationSummaryClient.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
Exception
Definition: hltDiff.cc:245
MESetMulti.h
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:141
ecaldqm::CalibrationSummaryClient::setParams
void setParams(edm::ParameterSet const &) override
Definition: CalibrationSummaryClient.cc:22
ParameterSet.h
EcalCondDBWriter_cfi.laser
laser
Definition: EcalCondDBWriter_cfi.py:46
EcalDQMCommonUtils.h
ecaldqm::MESetMulti::getBinContent
double getBinContent(EcalDQMSetupObjects const edso, DetId const &_id, int _bin=0) const override
Definition: MESetMulti.h:111
ecaldqm::MESet
Definition: MESet.h:42