File indexing completed on 2024-04-06 12:07:36
0001
0002 #include "DQM/HcalTasks/interface/ZDCTask.h"
0003 #include <map>
0004
0005 using namespace hcaldqm;
0006 using namespace hcaldqm::constants;
0007 ZDCTask::ZDCTask(edm::ParameterSet const& ps) {
0008
0009 _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis"));
0010 _tokQIE10 = consumes<ZDCDigiCollection>(_tagQIE10);
0011
0012
0013 _cut = ps.getUntrackedParameter<double>("cut", 50.0);
0014 _ped = ps.getUntrackedParameter<int>("ped", 4);
0015 }
0016
0017 void ZDCTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0018
0019
0020
0021
0022
0023 std::map<HcalElectronicsId, DetId> myEMap;
0024 HcalElectronicsId eid = HcalElectronicsId(0, 1, 0, 3);
0025 eid.setHTR(18, 8, 1);
0026 myEMap[eid] = DetId(0x54000051);
0027
0028 eid = HcalElectronicsId(1, 1, 0, 3);
0029 eid.setHTR(18, 8, 1);
0030 myEMap[eid] = DetId(0x54000052);
0031
0032 eid = HcalElectronicsId(2, 1, 0, 3);
0033 eid.setHTR(18, 8, 1);
0034 myEMap[eid] = DetId(0x54000053);
0035
0036 eid = HcalElectronicsId(0, 2, 0, 3);
0037 eid.setHTR(18, 8, 1);
0038 myEMap[eid] = DetId(0x54000061);
0039
0040 eid = HcalElectronicsId(1, 2, 0, 3);
0041 eid.setHTR(18, 8, 1);
0042 myEMap[eid] = DetId(0x54000054);
0043
0044 eid = HcalElectronicsId(2, 2, 0, 3);
0045 eid.setHTR(18, 8, 1);
0046 myEMap[eid] = DetId(0x54000055);
0047
0048 eid = HcalElectronicsId(0, 3, 0, 3);
0049 eid.setHTR(18, 8, 1);
0050 myEMap[eid] = DetId(0x54000062);
0051
0052 eid = HcalElectronicsId(1, 3, 0, 3);
0053 eid.setHTR(18, 8, 1);
0054 myEMap[eid] = DetId(0x54000063);
0055
0056 eid = HcalElectronicsId(2, 3, 0, 3);
0057 eid.setHTR(18, 8, 1);
0058 myEMap[eid] = DetId(0x54000064);
0059
0060
0061 eid = HcalElectronicsId(0, 1, 1, 3);
0062 eid.setHTR(18, 8, 0);
0063 myEMap[eid] = DetId(0x54000011);
0064
0065 eid = HcalElectronicsId(1, 1, 1, 3);
0066 eid.setHTR(18, 8, 0);
0067 myEMap[eid] = DetId(0x54000012);
0068
0069 eid = HcalElectronicsId(2, 1, 1, 3);
0070 eid.setHTR(18, 8, 0);
0071 myEMap[eid] = DetId(0x54000013);
0072
0073 eid = HcalElectronicsId(0, 2, 1, 3);
0074 eid.setHTR(18, 8, 0);
0075 myEMap[eid] = DetId(0x54000015);
0076
0077 eid = HcalElectronicsId(1, 2, 1, 3);
0078 eid.setHTR(18, 8, 0);
0079 myEMap[eid] = DetId(0x54000021);
0080
0081 eid = HcalElectronicsId(2, 2, 1, 3);
0082 eid.setHTR(18, 8, 0);
0083 myEMap[eid] = DetId(0x54000014);
0084
0085 eid = HcalElectronicsId(0, 3, 1, 3);
0086 eid.setHTR(18, 8, 0);
0087 myEMap[eid] = DetId(0x54000022);
0088
0089 eid = HcalElectronicsId(1, 3, 1, 3);
0090 eid.setHTR(18, 8, 0);
0091 myEMap[eid] = DetId(0x54000023);
0092
0093 eid = HcalElectronicsId(2, 3, 1, 3);
0094 eid.setHTR(18, 8, 0);
0095 myEMap[eid] = DetId(0x54000024);
0096
0097
0098 ib.cd();
0099
0100
0101 hcaldqm::quantity::ValueQuantity xAxisShape(hcaldqm::quantity::fTiming_TS);
0102 hcaldqm::quantity::ValueQuantity yAxisShape(hcaldqm::quantity::ffC_10000);
0103
0104 hcaldqm::quantity::ValueQuantity xAxisADC(hcaldqm::quantity::fADC_128);
0105
0106
0107 for (std::map<HcalElectronicsId, DetId>::const_iterator itr = myEMap.begin(); itr != myEMap.end(); ++itr) {
0108 char histoname[300];
0109
0110 sprintf(histoname,
0111 "%d_%d_%d_%d",
0112 itr->first.fiberChanId(),
0113 itr->first.fiberIndex(),
0114 itr->first.spigot(),
0115 itr->first.dccid());
0116
0117 ib.setCurrentFolder("Hcal/ZDCTask/Shape_perChannel");
0118 _cShape_EChannel[histoname] = ib.bookProfile(histoname,
0119 histoname,
0120 xAxisShape.nbins(),
0121 xAxisShape.min(),
0122 xAxisShape.max(),
0123 yAxisShape.nbins(),
0124 yAxisShape.min(),
0125 yAxisShape.max());
0126 _cShape_EChannel[histoname]->setAxisTitle("Timing", 1);
0127 _cShape_EChannel[histoname]->setAxisTitle("fC QIE8", 2);
0128
0129 ib.setCurrentFolder("Hcal/ZDCTask/ADC_perChannel");
0130 _cADC_EChannel[histoname] = ib.book1DD(histoname, histoname, xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max());
0131 _cADC_EChannel[histoname]->getTH1()->SetBit(
0132 BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis));
0133 _cADC_EChannel[histoname]->setAxisTitle("ADC QIE8", 1);
0134
0135 ib.setCurrentFolder("Hcal/ZDCTask/ADC_vs_TS_perChannel");
0136 _cADC_vs_TS_EChannel[histoname] = ib.book2D(histoname,
0137 histoname,
0138 xAxisShape.nbins(),
0139 xAxisShape.min(),
0140 xAxisShape.max(),
0141 xAxisADC.nbins(),
0142 xAxisADC.min(),
0143 xAxisADC.max());
0144 _cADC_vs_TS_EChannel[histoname]->getTH1()->SetBit(
0145 BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis));
0146 _cADC_vs_TS_EChannel[histoname]->setAxisTitle("Timing", 1);
0147 _cADC_vs_TS_EChannel[histoname]->setAxisTitle("ADC QIE8", 2);
0148 }
0149
0150
0151 ib.setCurrentFolder("Hcal/ZDCTask");
0152
0153 _cShape = ib.bookProfile("Shape",
0154 "Shape",
0155 xAxisShape.nbins(),
0156 xAxisShape.min(),
0157 xAxisShape.max(),
0158 yAxisShape.nbins(),
0159 yAxisShape.min(),
0160 yAxisShape.max());
0161 _cShape->setAxisTitle("Timing", 1);
0162 _cShape->setAxisTitle("fC QIE8", 2);
0163
0164 _cADC = ib.book1DD("ADC", "ADC", xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max());
0165 _cADC->getTH1()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis));
0166 _cADC->setAxisTitle("ADC QIE8", 1);
0167
0168 _cADC_vs_TS = ib.book2D("ADC_vs_TS",
0169 "ADC_vs_TS",
0170 xAxisShape.nbins(),
0171 xAxisShape.min(),
0172 xAxisShape.max(),
0173 xAxisADC.nbins(),
0174 xAxisADC.min(),
0175 xAxisADC.max());
0176 _cADC_vs_TS->getTH1()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis));
0177 _cADC_vs_TS->setAxisTitle("Timing", 1);
0178 _cADC_vs_TS->setAxisTitle("ADC QIE8", 2);
0179 }
0180
0181 void ZDCTask::analyze(edm::Event const& e, edm::EventSetup const&) {
0182 edm::Handle<ZDCDigiCollection> cqie10;
0183 if (!e.getByToken(_tokQIE10, cqie10))
0184 edm::LogError("Collection ZDCDigiCollection isn't available" + _tagQIE10.label() + " " + _tagQIE10.instance());
0185
0186 for (uint32_t i = 0; i < cqie10->size(); i++) {
0187 ZDCDataFrame frame = static_cast<ZDCDataFrame>((*cqie10)[i]);
0188 HcalElectronicsId eid = frame.elecId();
0189
0190 char histoname[300];
0191 sprintf(histoname, "%d_%d_%d_%d", eid.fiberChanId(), eid.fiberIndex(), eid.spigot(), eid.dccid());
0192
0193
0194
0195
0196
0197 for (int j = 0; j < frame.size(); j++) {
0198 _cShape_EChannel[histoname]->Fill(j, frame[j].nominal_fC());
0199 _cShape->Fill(j, frame[j].nominal_fC());
0200
0201 _cADC_EChannel[histoname]->Fill(frame[j].adc());
0202 _cADC->Fill(frame[j].adc());
0203
0204 _cADC_vs_TS_EChannel[histoname]->Fill(j, frame[j].adc());
0205 _cADC_vs_TS->Fill(j, frame[j].adc());
0206 }
0207 }
0208 }
0209
0210 DEFINE_FWK_MODULE(ZDCTask);