34 LogVerbatim(
"DTDQM|DTMonitorClient|DTRunConditionVarClient") <<
"DTRunConditionVarClient: Constructor called";
57 if (readLegacyVDriftDB) {
58 mTimeMapToken_ = esConsumes<edm::Transition::BeginRun>();
60 vDriftToken_ = esConsumes<edm::Transition::BeginRun>();
65 LogVerbatim(
"DTDQM|DTMonitorClient|DTRunConditionVarClient") <<
"DTRunConditionVarClient: Destructor called";
69 LogTrace(
"DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<
"[DTRunConditionVarClient]: BeginRun";
72 mTimeMap_ = &context.
getData(mTimeMapToken_);
75 vDriftMap_ = &context.
getData(vDriftToken_);
78 int version = vDriftMap_->version();
80 throw cms::Exception(
"Configuration") <<
"only version 1 is presently supported for VDriftDB";
91 LogVerbatim(
"DTDQM|DTMonitorClient|DTRunConditionVarClient") <<
"DTRunConditionVarClient: end job";
96 ibooker.
book2D(
"VDriftGlbSummary",
"# of MBs with good mean and good sigma of vDrift", 12, 1, 13, 5, -2, 3);
97 glbT0Summary = ibooker.
book2D(
"T0GlbSummary",
"# of MBs with good mean and good sigma of t0", 12, 1, 13, 5, -2, 3);
101 summaryHistos[
"MeanVDriftGlbSummary"] =
102 ibooker.
book2D(
"MeanVDriftGlbSummary",
"mean VDrift average per sector", 12, 1., 13., 5, -2., 3.);
103 allwheelHistos[
"allMeanVDrift"] =
104 ibooker.
book1D(
"VDriftMeanAllWheels",
"mean VDrift for all chambers", 60, 0.0048, 0.006);
108 summaryHistos[
"SigmaVDriftGlbSummary"] =
109 ibooker.
book2D(
"SigmaVDriftGlbSummary",
"# of Chambers with good sigma VDrift", 12, 1., 13., 5, -2., 3.);
110 allwheelHistos[
"allSigmaVDrift"] =
111 ibooker.
book1D(
"VDriftSigmaAllWheels",
"sigma VDrift for all chambers", 30, 0., 0.0006);
115 summaryHistos[
"MeanT0GlbSummary"] =
116 ibooker.
book2D(
"MeanT0GlbSummary",
"mean T0 average per sector", 12, 1., 13., 5, -2., 3.);
117 allwheelHistos[
"allMeanT0"] = ibooker.
book1D(
"T0MeanAllWheels",
"mean T0 for all chambers", 100, -25., 25.);
121 summaryHistos[
"SigmaT0GlbSummary"] =
122 ibooker.
book2D(
"SigmaT0GlbSummary",
"# of Chambers with good sigma T0", 12, 1., 13., 5, -2., 3.);
123 allwheelHistos[
"allSigmaT0"] = ibooker.
book1D(
"T0SigmaAllWheels",
"sigma T0 for all chambers", 50, 0, 25);
125 for (
int wh = -2; wh <= 2; wh++) {
126 bookWheelHistos(ibooker,
"MeanVDrift",
"02-MeanVDrift", wh, 60, 0.0048, 0.006,
true);
127 bookWheelHistos(ibooker,
"SigmaVDrift",
"02-SigmaVDrift", wh, 30, 0., 0.0006);
128 bookWheelHistos(ibooker,
"MeanT0",
"03-MeanT0", wh, 100, -25., 25.,
false,
true);
129 bookWheelHistos(ibooker,
"SigmaT0",
"03-SigmaT0", wh, 50, 0, 25,
false,
true);
132 for (
int wheel = -2; wheel <= 2; wheel++) {
133 for (
int sec = 1; sec <= 14; sec++) {
135 if ((sec == 13 || sec == 14) &&
stat != 4)
142 if (!VDriftME || !T0ME) {
143 edm::LogWarning(
"DTRunConditionVarClient") <<
"ME not available" << std::endl;
148 float vDriftMean = VDriftME->
getMean();
150 float t0Mean = T0ME->
getMean();
153 float vDriftSigma = VDriftME->
getRMS();
154 float t0Sigma = T0ME->
getRMS();
157 allwheelHistos[
"allMeanVDrift"]->Fill(vDriftMean);
158 allwheelHistos[
"allSigmaVDrift"]->Fill(vDriftSigma);
160 (wheelHistos[wheel])[
"MeanVDrift"]->
Fill(vDriftMean);
161 (wheelHistos[wheel])[
"SigmaVDrift"]->
Fill(vDriftSigma);
165 allwheelHistos[
"allMeanT0"]->Fill(t0Mean);
166 allwheelHistos[
"allSigmaT0"]->Fill(t0Sigma);
168 (wheelRingHistos[wheel][
stat])[
"MeanT0"]->
Fill(t0Mean);
169 (wheelRingHistos[wheel][
stat])[
"SigmaT0"]->
Fill(t0Sigma);
174 float vDriftDev(0.), errvDriftDev(0.);
175 percDevVDrift(indexCh, vDriftMean, vDriftSigma, vDriftDev, errvDriftDev);
178 if (sec == 13 || sec == 14)
179 sec_ = (sec == 13) ? 4 : 10;
181 float fillvDriftDev =
max(
min(vDriftDev, maxRangeVDrift), minRangeVDrift);
182 float fillT0Mean =
max(
min(t0Mean, maxRangeT0), minRangeT0);
184 float vDriftDevQ = varQuality(fabs(vDriftDev), maxGoodVDriftDev, minBadVDriftDev);
185 float t0MeanQ = varQuality(fabs(t0Mean), maxGoodT0, minBadT0);
187 float vDriftSigmQ = varQuality(vDriftSigma, maxGoodVDriftSigma, minBadVDriftSigma);
188 float t0SigmQ = varQuality(t0Sigma, maxGoodT0Sigma, minBadT0Sigma);
190 if (sec == 13 || sec == 14) {
191 float binVDriftDev = (wheelHistos[wheel])[
"MeanVDriftSummary"]->getBinContent(sec_,
stat);
192 binVDriftDev = (fabs(binVDriftDev) > fabs(fillvDriftDev)) ? binVDriftDev : fillvDriftDev;
193 (wheelHistos[wheel])[
"MeanVDriftSummary"]->setBinContent(sec_,
stat, binVDriftDev);
195 float binT0MeanVal = (wheelHistos[wheel])[
"MeanT0Summary"]->getBinContent(sec_,
stat);
196 binT0MeanVal = (fabs(binT0MeanVal) > fabs(fillT0Mean)) ? binT0MeanVal : fillT0Mean;
197 (wheelHistos[wheel])[
"MeanT0Summary"]->setBinContent(sec_,
stat, binT0MeanVal);
199 float binVDriftSigmVal = (wheelHistos[wheel])[
"SigmaVDriftSummary"]->getBinContent(sec_,
stat);
200 binVDriftSigmVal = (binVDriftSigmVal > 0. && binVDriftSigmVal < vDriftSigmQ) ? binVDriftSigmVal : vDriftSigmQ;
201 (wheelHistos[wheel])[
"SigmaVDriftSummary"]->setBinContent(sec_,
stat, binVDriftSigmVal);
203 float binT0SigmVal = (wheelHistos[wheel])[
"SigmaT0Summary"]->getBinContent(sec_,
stat);
204 binT0SigmVal = (binT0SigmVal > 0. && binT0SigmVal < t0SigmQ) ? binT0SigmVal : t0SigmQ;
205 (wheelHistos[wheel])[
"SigmaT0Summary"]->setBinContent(sec_,
stat, binT0SigmVal);
208 (wheelHistos[wheel])[
"MeanVDriftSummary"]->setBinContent(sec_,
stat, fillvDriftDev);
209 (wheelHistos[wheel])[
"MeanT0Summary"]->setBinContent(sec_,
stat, fillT0Mean);
210 (wheelHistos[wheel])[
"SigmaVDriftSummary"]->setBinContent(sec_,
stat, vDriftSigmQ);
211 (wheelHistos[wheel])[
"SigmaT0Summary"]->setBinContent(sec_,
stat, t0SigmQ);
215 if ((sec_ == 4 || sec_ == 10) &&
stat == 4)
218 if (vDriftDevQ > 0.85 && vDriftSigmQ > 0.85) {
219 glbVDriftSummary->Fill(sec_, wheel, weight);
220 summaryHistos[
"MeanVDriftGlbSummary"]->Fill(sec_, wheel, weight);
221 summaryHistos[
"SigmaVDriftGlbSummary"]->Fill(sec_, wheel, weight);
224 if (vDriftDevQ > 0.85 && vDriftSigmQ < 0.85) {
225 summaryHistos[
"MeanVDriftGlbSummary"]->Fill(sec_, wheel, weight);
227 if (vDriftDevQ < 0.85 && vDriftSigmQ > 0.85) {
228 summaryHistos[
"SigmaVDriftGlbSummary"]->Fill(sec_, wheel, weight);
232 if (t0MeanQ > 0.85 && t0SigmQ > 0.85) {
233 glbT0Summary->Fill(sec_, wheel, weight);
234 summaryHistos[
"MeanT0GlbSummary"]->Fill(sec_, wheel, weight);
235 summaryHistos[
"SigmaT0GlbSummary"]->Fill(sec_, wheel, weight);
237 if (t0MeanQ > 0.85 && t0SigmQ < 0.85) {
238 summaryHistos[
"MeanT0GlbSummary"]->Fill(sec_, wheel, weight);
240 if (t0MeanQ < 0.85 && t0SigmQ > 0.85) {
241 summaryHistos[
"SigmaT0GlbSummary"]->Fill(sec_, wheel, weight);
254 if (var <= maxGood) {
256 }
else if (var > maxGood && var < minBad) {
258 }
else if (var >= minBad) {
266 DTChamberId indexCh,
float meanVD,
float sigmaVD,
float& devVD,
float& errdevVD) {
270 float vDriftPhi1(0.), vDriftPhi2(0.);
271 float ResPhi1(0.), ResPhi2(0.);
276 if (status1 != 0 || status2 != 0) {
278 throw cms::Exception(
"DTRunConditionVarClient") <<
"Could not find vDrift entry in DB for" << sl << endl;
285 float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.;
287 devVD = (meanVD - vDriftMed) / vDriftMed;
288 devVD = devVD < 1. ? devVD : 1.;
290 errdevVD = sigmaVD / vDriftMed;
307 string folder =
"DT/02-Segments/" + subfolder;
316 for (
int st = 1; st <= 4; st++) {
320 histoName = histoType +
"_W" + wheel.str() +
"_MB" + station.str();
321 histoLabel = histoType;
323 (wheelRingHistos[wh][st])[histoType] = ibooker.
book1D(histoName, histoLabel, nbins, min, max);
326 histoName = histoType +
"_W" + wheel.str();
327 histoLabel = histoType;
329 (wheelHistos[wh])[histoType] = ibooker.
book1D(histoName, histoLabel, nbins, min, max);
335 histoLabel =
"Summary of corrections to VDrift DB values";
336 histoName =
"CorrTo" + histoType +
"Summary_W" + wheel.str();
338 histoLabel = histoType +
"Summary";
339 histoName = histoType +
"Summary_W" + wheel.str();
350 (wheelHistos[wh])[histoType +
"Summary"] = me;
358 int wh = dtCh.
wheel();
368 string folder =
"DT/02-Segments/Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str();
369 string histoTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
370 string MEpath = folder +
"/" + histoType + histoTag;
374 LogTrace(
"DTDQM|DTMonitorModule|DTRunConditionVar") <<
"[DTRunConditionVar]: getting ME from " << folder << endl;
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
virtual void setCurrentFolder(std::string const &fullpath)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
DQM Client Diagnostic.
constexpr uint32_t rawId() const
get the raw id
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * getChamberHistos(DQMStore::IGetter &, const DTChamberId &, std::string)
float varQuality(float var, float maxGood, float minBad)
bool getData(T &iHolder) const
virtual void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual double getEntries() const
get # of entries
void percDevVDrift(DTChamberId indexCh, float meanVD, float sigmaVD, float &devVD, float &errdevVD)
virtual MonitorElement * get(std::string const &fullpath) const
EventID const & min(EventID const &lh, EventID const &rh)
virtual 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)
DTRunConditionVarClient(const edm::ParameterSet &ps)
Constructor.
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void bookWheelHistos(DQMStore::IBooker &, std::string histoType, std::string subfolder, int wh, int nbins, float min, float max, bool isVDCorr=false, bool makeRings=false)
book the report summary
~DTRunConditionVarClient() override
Destructor.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
T getParameter(std::string const &) const
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
dqm::harvesting::MonitorElement ME
Log< level::Warning, false > LogWarning
int station() const
Return the station number.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int wheel() const
Return the wheel number.
EventID const & max(EventID const &lh, EventID const &rh)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)