File indexing completed on 2024-04-06 12:07:33
0001
0002 #include "DQM/HcalTasks/interface/HFRaddamTask.h"
0003
0004 using namespace hcaldqm;
0005 using namespace hcaldqm::constants;
0006 using namespace hcaldqm::filter;
0007
0008 HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) {
0009
0010 _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1));
0011 _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1));
0012 _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1));
0013 _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1));
0014 _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1));
0015 _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1));
0016 _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1));
0017 _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1));
0018 _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1));
0019 _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1));
0020 _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1));
0021 _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1));
0022 _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1));
0023 _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1));
0024 _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2));
0025 _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2));
0026 _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2));
0027 _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2));
0028 _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2));
0029 _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2));
0030 _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2));
0031 _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2));
0032 _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2));
0033 _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2));
0034 _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2));
0035 _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2));
0036 _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2));
0037 _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2));
0038
0039 _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1));
0040 _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1));
0041 _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1));
0042 _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1));
0043 _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1));
0044 _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1));
0045 _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1));
0046 _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1));
0047 _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1));
0048 _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1));
0049 _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1));
0050 _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1));
0051 _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1));
0052 _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1));
0053 _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2));
0054 _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2));
0055 _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2));
0056 _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2));
0057 _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2));
0058 _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2));
0059 _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2));
0060 _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2));
0061 _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2));
0062 _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2));
0063 _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2));
0064 _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2));
0065 _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2));
0066 _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2));
0067
0068
0069 _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
0070 _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
0071 _tokHF = consumes<QIE10DigiCollection>(_tagHF);
0072 _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
0073 }
0074
0075 void HFRaddamTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0076
0077 for (std::vector<HcalDetId>::const_iterator it = _vDetIds.begin(); it != _vDetIds.end(); ++it) {
0078 _vcShape.push_back(ContainerSingle1D(_name,
0079 "Shape",
0080 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0081 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000)));
0082 }
0083
0084 DQTask::bookHistograms(ib, r, es);
0085 char aux[200];
0086 for (unsigned int i = 0; i < _vDetIds.size(); i++) {
0087 sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), _vDetIds[i].iphi(), _vDetIds[i].depth());
0088 _vcShape[i].book(ib, _subsystem, aux);
0089 }
0090 }
0091
0092 void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) {
0093 auto const chf = e.getHandle(_tokHF);
0094 if (not(chf.isValid())) {
0095 edm::LogWarning("HFRaddamTask") << "QIE10 collection not valid for HF";
0096 return;
0097 }
0098
0099 for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
0100 const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
0101 HcalDetId const& did = digi.detid();
0102 if (did.subdet() != HcalForward)
0103 continue;
0104
0105 CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
0106
0107 for (unsigned int i = 0; i < _vDetIds.size(); i++)
0108 if (did == _vDetIds[i]) {
0109 for (int j = 0; j < digi.samples(); j++) {
0110 double q = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, j);
0111 _vcShape[i].fill(j, q);
0112 }
0113 }
0114 }
0115 }
0116
0117 bool HFRaddamTask::_isApplicable(edm::Event const& e) {
0118 if (_ptype == fOnline) {
0119 edm::Handle<HcalUMNioDigi> cumn;
0120 if (!e.getByToken(_tokuMN, cumn))
0121 return false;
0122
0123
0124 uint8_t eventType = cumn->eventType();
0125 if (eventType == constants::EVENTTYPE_HFRADDAM)
0126 return true;
0127 } else if (_ptype == fLocal) {
0128
0129 return true;
0130 }
0131
0132 return false;
0133 }
0134
0135 DEFINE_FWK_MODULE(HFRaddamTask);