44 useTimeWindow_(
pset.getParameter<
bool>(
"useTimeWindow")),
45 triggerWidth_(
pset.getParameter<double>(
"triggerWidth")),
46 timeWindowOffset_(
pset.getParameter<
int>(
"timeWindowOffset")),
47 maximumNoiseRate_(
pset.getParameter<double>(
"maximumNoiseRate")),
48 useAbsoluteRate_(
pset.getParameter<
bool>(
"useAbsoluteRate")),
51 dbLabel_(
pset.getUntrackedParameter<
string>(
"dbLabel",
"")),
62 if (
pset.exists(
"defaultTtrig")) {
67 if (
pset.exists(
"cellsWithHisto")) {
68 vector<string> cellsWithHisto =
pset.getParameter<vector<string> >(
"cellsWithHisto");
69 for (vector<string>::const_iterator cell = cellsWithHisto.begin(); cell != cellsWithHisto.end(); ++cell) {
71 if ((!cell->empty()) && (*cell) !=
"None") {
82 string rootFileName =
pset.getUntrackedParameter<
string>(
"rootFileName",
"noise.root");
88 LogVerbatim(
"Calibration") <<
"[DTNoiseCalibration]: Begin job";
92 TH1::SetDefaultSumw2(
true);
128 time_t eventTime = time_t(
event.time().value() >> 32);
129 unsigned int lumiSection =
event.luminosityBlock();
133 for (dtLayerId_It = dtdigis->begin(); dtLayerId_It != dtdigis->end(); ++dtLayerId_It) {
135 float upperLimit = 0.;
142 throw cms::Exception(
"DTNoiseCalibration") <<
"Could not find tTrig entry in DB for" << slId << endl;
149 double triggerWidth_s = 0.;
151 triggerWidth_s = ((upperLimit * 25) / 32) / 1e9;
154 LogTrace(
"Calibration") << ((*dtLayerId_It).first).superlayerId() <<
" Trigger width (s): " << triggerWidth_s;
157 digiIt != ((*dtLayerId_It).second).
second;
160 int tdcTime = (*digiIt).countsTDC();
163 LogError(
"Calibration") <<
"Digi has a TDC time (ns) higher than the pre-defined TDC trigger width: "
164 << ((
float)tdcTime * 25) / 32;
177 const DTLayerId dtLId = (*dtLayerId_It).first;
182 const int nWires = lastWire - firstWire + 1;
188 TH1F* hOccupancyHisto =
new TH1F(
histoName.c_str(),
histoName.c_str(), nWires, firstWire, lastWire + 1);
189 LogTrace(
"Calibration") <<
" Created occupancy Histo: " << hOccupancyHisto->GetName();
200 LogTrace(
"Calibration") <<
" Created occupancy histo: " << hOccupancyVsLumiHisto->GetName();
205 const DTWireId wireId(dtLId, (*digiIt).wire());
211 LogTrace(
"Calibration") <<
" Created occupancy histo: " << hOccupancyVsLumiHisto->GetName();
220 float secPerBin = 20.0;
223 TH1F* hOccupancyVsTimeHisto =
new TH1F(
225 for (
int k = 0;
k < hOccupancyVsTimeHisto->GetNbinsX(); ++
k) {
227 unsigned int binLowEdge = hOccupancyVsTimeHisto->GetBinLowEdge(
k + 1);
228 time_t timeValue = time_t(binLowEdge);
229 hOccupancyVsTimeHisto->GetXaxis()->SetBinLabel((
k + 1), ctime(&timeValue));
232 size_t lastBin = hOccupancyVsTimeHisto->GetNbinsX();
233 unsigned int binUpperEdge =
234 hOccupancyVsTimeHisto->GetBinLowEdge(lastBin) + hOccupancyVsTimeHisto->GetBinWidth(lastBin);
235 time_t timeValue = time_t(binUpperEdge);
236 hOccupancyVsTimeHisto->GetXaxis()->SetBinLabel((lastBin), ctime(&timeValue));
238 LogTrace(
"Calibration") <<
" Created occupancy histo: " << hOccupancyVsTimeHisto->GetName();
329 LogVerbatim(
"Calibration") <<
"[DTNoiseCalibration] Total number of events analyzed: " <<
nevents_;
341 (*wHisto).second->Write();
348 (*chHisto).second->Write();
355 (*chHisto).second->Write();
383 if ((*lHisto).second) {
386 (*lHisto).second->Write();
391 const int nWires = lastWire - firstWire + 1;
393 double averageRate = 0.;
394 for (
int bin = 1;
bin <= (*lHisto).second->GetNbinsX(); ++
bin)
395 averageRate += (*lHisto).second->GetBinContent(
bin);
398 averageRate /= nWires;
399 LogTrace(
"Calibration") <<
" Average rate = " << averageRate;
401 for (
int i_wire = firstWire; i_wire <= lastWire; ++i_wire) {
403 int bin = i_wire - firstWire + 1;
404 double channelRate = (*lHisto).second->GetBinContent(
bin);
407 DTWireId wireID((*lHisto).first, i_wire);
409 LogVerbatim(
"Calibration") <<
">>> Channel noisy: " << wireID;
414 LogVerbatim(
"Calibration") <<
"Writing noise map object to DB";
415 string record =
"DTStatusFlagRcd";
416 DTCalibDBUtils::writeToDB<DTStatusFlag>(
record, statusMap);
423 std::to_string(wId.
sector()) +
"_SL" + std::to_string(wId.
superlayer()) +
"_L" +
424 std::to_string(wId.
layer()) +
"_W" + std::to_string(wId.
wire());
431 string layerName =
"W" + std::to_string(dtChId.
wheel()) +
"_St" + std::to_string(dtChId.
station()) +
"_Sec" +
432 std::to_string(dtChId.
sector()) +
"_SL" + std::to_string(dtSLId.
superlayer()) +
"_L" +
433 std::to_string(lId.
layer());
441 string superLayerName =
"W" + std::to_string(dtChId.
wheel()) +
"_St" + std::to_string(dtChId.
station()) +
"_Sec" +
442 std::to_string(dtChId.
sector()) +
"_SL" + std::to_string(dtSLId.
superlayer());
444 return superLayerName;
448 string chamberName =
"W" + std::to_string(dtChId.
wheel()) +
"_St" + std::to_string(dtChId.
station()) +
"_Sec" +
449 std::to_string(dtChId.
sector());