Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-25 23:56:58

0001 #include "DQM/HcalTasks/interface/ZDCQIE10Task.h"
0002 using namespace std;
0003 using namespace hcaldqm;
0004 using namespace hcaldqm::constants;
0005 using namespace hcaldqm::filter;
0006 
0007 ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
0008 
0009     : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
0010   //tags
0011   _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis", "ZDC"));
0012   _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
0013 
0014   sumTag = ps.getUntrackedParameter<edm::InputTag>("etSumTag", edm::InputTag("etSumZdcProducer", ""));
0015   sumToken_ = consumes<l1t::EtSumBxCollection>(sumTag);
0016 
0017   htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
0018   paramsToken_ = esConsumes<HcalLongRecoParams, HcalLongRecoParamsRcd>();
0019 }
0020 
0021 /* virtual */ void ZDCQIE10Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0022   DQTask::bookHistograms(ib, r, es);
0023   ib.cd();
0024   edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
0025   _emap = dbs->getHcalMapping();
0026   // Book LED calibration channels from emap
0027   std::vector<HcalElectronicsId> eids = _emap->allElectronicsId();
0028   _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap);
0029 
0030   //    BOOK HISTOGRAMS
0031   std::string histoname;
0032   histoname = "Crate28";
0033   ib.setCurrentFolder("Hcal/ZDCQIE10Task/DigiSize");
0034   _cDigiSize_Crate[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 21, -0.5, 20.5);
0035   _cDigiSize_Crate[0]->setAxisTitle("DigiSize", 1);
0036   _cDigiSize_Crate[0]->setAxisTitle("N", 2);
0037 
0038   histoname = "FED1136";
0039   ib.setCurrentFolder("Hcal/ZDCQIE10Task/DigiSize");
0040   _cDigiSize_FED[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 21, -0.5, 20.5);
0041   _cDigiSize_FED[0]->setAxisTitle("DigiSize", 1);
0042   _cDigiSize_FED[0]->setAxisTitle("N", 2);
0043 
0044   histoname = "ZDCM";
0045   ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC");
0046   _cADC_PM[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0047   _cADC_PM[0]->setAxisTitle("ADC", 1);
0048   _cADC_PM[0]->setAxisTitle("N", 2);
0049 
0050   histoname = "ZDCP";
0051   ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC");
0052   _cADC_PM[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0053   _cADC_PM[1]->setAxisTitle("ADC", 1);
0054   _cADC_PM[1]->setAxisTitle("N", 2);
0055 
0056   histoname = "ZDCM";
0057   ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADCvsTS");
0058   _cADC_vs_TS_PM[0] = ib.book2DD(histoname.c_str(), histoname.c_str(), 6, 0, 6, 256, 0, 256);
0059   _cADC_vs_TS_PM[0]->setAxisTitle("TS", 1);
0060   _cADC_vs_TS_PM[0]->setAxisTitle("ADC", 2);
0061 
0062   histoname = "ZDCP";
0063   ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADCvsTS");
0064   _cADC_vs_TS_PM[1] = ib.book2DD(histoname.c_str(), histoname.c_str(), 6, 0, 6, 256, 0, 256);
0065   _cADC_vs_TS_PM[1]->setAxisTitle("TS", 1);
0066   _cADC_vs_TS_PM[1]->setAxisTitle("ADC", 2);
0067 
0068   histoname = "Crate28";
0069   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Occupancy/Crate");
0070   _cOccupancy_Crate[0] = ib.book2DD(histoname.c_str(), histoname.c_str(), 12, 0, 12, 144, 0, 144);
0071   _cOccupancy_Crate[0]->setAxisTitle("SlotuTCA", 1);
0072   _cOccupancy_Crate[0]->setAxisTitle("FiberuTCAFiberCh", 2);
0073 
0074   histoname = "Crate28S3";
0075   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Occupancy/CrateSlote");
0076   _cOccupancy_CrateSlot[0] = ib.book2DD(histoname.c_str(), histoname.c_str(), 24, 0, 24, 6, 0, 6);
0077   _cOccupancy_CrateSlot[0]->setAxisTitle("SlotuTCA", 1);
0078   _cOccupancy_CrateSlot[0]->setAxisTitle("FiberCh", 2);
0079 
0080   histoname = "uTCA_for_FED1136";
0081   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Occupancy/Electronics");
0082   _cOccupancy_ElectronicsuTCA[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 12, 0, 12);
0083   _cOccupancy_ElectronicsuTCA[0]->setAxisTitle("N", 1);
0084   _cOccupancy_ElectronicsuTCA[0]->setAxisTitle("SlotuTCA", 1);
0085 
0086   histoname = "ZDCP_Sum";
0087   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0088   _cZDC_SUMS[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, -1, 5000);
0089   _cZDC_SUMS[1]->setAxisTitle("GeV", 1);
0090   _cZDC_SUMS[1]->setAxisTitle("N", 2);
0091 
0092   histoname = "ZDCM_Sum";
0093   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0094   _cZDC_SUMS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, -1, 5000);
0095   _cZDC_SUMS[0]->setAxisTitle("GeV", 1);
0096   _cZDC_SUMS[0]->setAxisTitle("N", 2);
0097 
0098   histoname = "ZDCM_SumBX";
0099   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0100   _cZDC_BXSUMS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 3500, 0, 3500);
0101   _cZDC_BXSUMS[0]->setAxisTitle("globalBX", 1);
0102   _cZDC_BXSUMS[0]->setAxisTitle("GeV", 2);
0103 
0104   histoname = "ZDCP_SumBX";
0105   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0106   _cZDC_BXSUMS[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 3500, 0, 3500);
0107   _cZDC_BXSUMS[1]->setAxisTitle("globalBX", 1);
0108   _cZDC_BXSUMS[1]->setAxisTitle("GeV", 2);
0109 
0110   histoname = "ZDCM_EmuSumBX";
0111   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0112   _cZDC_BX_EmuSUMS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 3500, 0, 3500);
0113   _cZDC_BX_EmuSUMS[0]->setAxisTitle("globalBX", 1);
0114   _cZDC_BX_EmuSUMS[0]->setAxisTitle("0-255 weighted output", 2);
0115 
0116   histoname = "ZDCP_EmuSumBX";
0117   ib.setCurrentFolder("Hcal/ZDCQIE10Task/Sums");
0118   _cZDC_BX_EmuSUMS[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 3500, 0, 3500);
0119   _cZDC_BX_EmuSUMS[1]->setAxisTitle("globalBX", 1);
0120   _cZDC_BX_EmuSUMS[1]->setAxisTitle("0-255 weighted output", 2);
0121 
0122   histoname = "CapIDs";
0123   ib.setCurrentFolder("Hcal/ZDCQIE10Task");
0124   _cZDC_CapIDS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 4, 0, 4);
0125   _cZDC_CapIDS[0]->setAxisTitle("CapID", 1);
0126   _cZDC_CapIDS[0]->setAxisTitle("N", 2);
0127 
0128   histoname = "EM_M_Timings";
0129   ib.setCurrentFolder("Hcal/ZDCQIE10Task");
0130   _cZDC_EM_TM[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 1, 11);
0131   _cZDC_EM_TM[0]->setAxisTitle("Channel", 1);
0132   _cZDC_EM_TM[0]->setAxisTitle("N", 2);
0133   _cZDC_EM_TM[0]->setBinLabel(1, "EM_M_1 good timing");
0134   _cZDC_EM_TM[0]->setBinLabel(2, "EM_M_1 bad timing");
0135   _cZDC_EM_TM[0]->setBinLabel(3, "EM_M_2 good timing");
0136   _cZDC_EM_TM[0]->setBinLabel(4, "EM_M_2 bad timing");
0137   _cZDC_EM_TM[0]->setBinLabel(5, "EM_M_3 good timing");
0138   _cZDC_EM_TM[0]->setBinLabel(6, "EM_M_3 bad timing");
0139   _cZDC_EM_TM[0]->setBinLabel(7, "EM_M_4 good timing");
0140   _cZDC_EM_TM[0]->setBinLabel(8, "EM_M_4 bad timing");
0141   _cZDC_EM_TM[0]->setBinLabel(9, "EM_M_5 good timing");
0142   _cZDC_EM_TM[0]->setBinLabel(10, "EM_M_5 bad timing");
0143 
0144   histoname = "EM_P_Timings";
0145   ib.setCurrentFolder("Hcal/ZDCQIE10Task");
0146   _cZDC_EM_TM[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 1, 11);
0147   _cZDC_EM_TM[1]->setAxisTitle("Channel", 1);
0148   _cZDC_EM_TM[1]->setAxisTitle("N", 2);
0149   _cZDC_EM_TM[1]->setBinLabel(1, "EM_P_1 good timing");
0150   _cZDC_EM_TM[1]->setBinLabel(2, "EM_P_1 bad timing");
0151   _cZDC_EM_TM[1]->setBinLabel(3, "EM_P_2 good timing");
0152   _cZDC_EM_TM[1]->setBinLabel(4, "EM_P_2 bad timing");
0153   _cZDC_EM_TM[1]->setBinLabel(5, "EM_P_3 good timing");
0154   _cZDC_EM_TM[1]->setBinLabel(6, "EM_P_3 bad timing");
0155   _cZDC_EM_TM[1]->setBinLabel(7, "EM_P_4 good timing");
0156   _cZDC_EM_TM[1]->setBinLabel(8, "EM_P_4 bad timing");
0157   _cZDC_EM_TM[1]->setBinLabel(9, "EM_P_5 good timing");
0158   _cZDC_EM_TM[1]->setBinLabel(10, "EM_P_5 bad timing");
0159 
0160   histoname = "HAD_M_Timings";
0161   ib.setCurrentFolder("Hcal/ZDCQIE10Task");
0162   _cZDC_HAD_TM[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 8, 1, 9);
0163   _cZDC_HAD_TM[0]->setAxisTitle("Channel", 1);
0164   _cZDC_HAD_TM[0]->setAxisTitle("N", 2);
0165   _cZDC_HAD_TM[0]->setBinLabel(1, "HAD_M_1 good timing");
0166   _cZDC_HAD_TM[0]->setBinLabel(2, "HAD_M_1 bad timing");
0167   _cZDC_HAD_TM[0]->setBinLabel(3, "HAD_M_2 good timing");
0168   _cZDC_HAD_TM[0]->setBinLabel(4, "HAD_M_2 bad timing");
0169   _cZDC_HAD_TM[0]->setBinLabel(5, "HAD_M_3 good timing");
0170   _cZDC_HAD_TM[0]->setBinLabel(6, "HAD_M_3 bad timing");
0171   _cZDC_HAD_TM[0]->setBinLabel(7, "HAD_M_4 good timing");
0172   _cZDC_HAD_TM[0]->setBinLabel(8, "HAD_M_4 bad timing");
0173 
0174   histoname = "HAD_P_Timings";
0175   ib.setCurrentFolder("Hcal/ZDCQIE10Task");
0176   _cZDC_HAD_TM[1] = ib.book1DD(histoname.c_str(), histoname.c_str(), 8, 1, 9);
0177   _cZDC_HAD_TM[1]->setAxisTitle("Channel", 1);
0178   _cZDC_HAD_TM[1]->setAxisTitle("N", 2);
0179   _cZDC_HAD_TM[1]->setBinLabel(1, "HAD_P_1 good timing");
0180   _cZDC_HAD_TM[1]->setBinLabel(2, "HAD_P_1 bad timing");
0181   _cZDC_HAD_TM[1]->setBinLabel(3, "HAD_P_2 good timing");
0182   _cZDC_HAD_TM[1]->setBinLabel(4, "HAD_P_2 bad timing");
0183   _cZDC_HAD_TM[1]->setBinLabel(5, "HAD_P_3 good timing");
0184   _cZDC_HAD_TM[1]->setBinLabel(6, "HAD_P_3 bad timing");
0185   _cZDC_HAD_TM[1]->setBinLabel(7, "HAD_P_4 good timing");
0186   _cZDC_HAD_TM[1]->setBinLabel(8, "HAD_P_4 bad timing");
0187 
0188   //book histos per channel
0189   //std::string histoname;
0190   for (int channel = 1; channel < 6; channel++) {
0191     // EM Pos
0192     HcalZDCDetId didp(HcalZDCDetId::EM, true, channel);
0193 
0194     histoname = "EM_P_" + std::to_string(channel);
0195     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0196     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0197     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0198     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0199     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0200     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0201     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0202     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0203 
0204     histoname = "EM_P_" + std::to_string(channel);
0205     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0206     _cfC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0207     _cfC_EChannel[didp()]->setAxisTitle("fC", 1);
0208     _cfC_EChannel[didp()]->setAxisTitle("N", 2);
0209     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0210     _cfC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0211     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0212     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
0213 
0214     histoname = "EM_P_" + std::to_string(channel);
0215     _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0216     _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
0217     _cTDC_EChannel[didp()]->setAxisTitle("N", 2);
0218 
0219     // EM Minus
0220     HcalZDCDetId didm(HcalZDCDetId::EM, false, channel);
0221 
0222     histoname = "EM_M_" + std::to_string(channel);
0223     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0224     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0225     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0226     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0227     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0228     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0229     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0230     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0231 
0232     histoname = "EM_M_" + std::to_string(channel);
0233     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0234     _cfC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0235     _cfC_EChannel[didm()]->setAxisTitle("fC", 1);
0236     _cfC_EChannel[didm()]->setAxisTitle("N", 2);
0237     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0238     _cfC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0239     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0240     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
0241 
0242     histoname = "EM_M_" + std::to_string(channel);
0243     _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0244     _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
0245     _cTDC_EChannel[didm()]->setAxisTitle("N", 2);
0246   }
0247 
0248   for (int channel = 1; channel < 5; channel++) {
0249     // HAD Pos
0250     HcalZDCDetId didp(HcalZDCDetId::HAD, true, channel);
0251 
0252     histoname = "HAD_P_" + std::to_string(channel);
0253     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0254     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0255     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0256     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0257     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0258     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0259     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0260     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0261 
0262     histoname = "HAD_P_" + std::to_string(channel);
0263     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0264     _cfC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0265     _cfC_EChannel[didp()]->setAxisTitle("fC", 1);
0266     _cfC_EChannel[didp()]->setAxisTitle("N", 2);
0267     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0268     _cfC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0269     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0270     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
0271 
0272     histoname = "HAD_P_" + std::to_string(channel);
0273     _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0274     _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
0275     _cTDC_EChannel[didp()]->setAxisTitle("N", 2);
0276 
0277     // HAD Minus
0278     HcalZDCDetId didm(HcalZDCDetId::HAD, false, channel);
0279 
0280     histoname = "HAD_M_" + std::to_string(channel);
0281     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0282     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0283     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0284     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0285     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0286     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0287     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0288     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0289 
0290     histoname = "HAD_M_" + std::to_string(channel);
0291     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0292     _cfC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0293     _cfC_EChannel[didm()]->setAxisTitle("fC", 1);
0294     _cfC_EChannel[didm()]->setAxisTitle("N", 2);
0295     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0296     _cfC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0297     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0298     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
0299 
0300     histoname = "HAD_M_" + std::to_string(channel);
0301     _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0302     _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
0303     _cTDC_EChannel[didm()]->setAxisTitle("N", 2);
0304   }
0305 
0306   for (int channel = 1; channel < 17; channel++) {
0307     // RPD Pos
0308     HcalZDCDetId didp(HcalZDCDetId::RPD, true, channel);
0309 
0310     histoname = "RPD_P_" + std::to_string(channel);
0311     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0312     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0313     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0314     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0315     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0316     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0317     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0318     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0319 
0320     histoname = "RPD_P_" + std::to_string(channel);
0321     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0322     _cfC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0323     _cfC_EChannel[didp()]->setAxisTitle("fC", 1);
0324     _cfC_EChannel[didp()]->setAxisTitle("N", 2);
0325     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0326     _cfC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0327     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0328     _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
0329 
0330     histoname = "RPD_P_" + std::to_string(channel);
0331     _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0332     _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
0333     _cTDC_EChannel[didp()]->setAxisTitle("N", 2);
0334 
0335     // RPD Minus
0336     HcalZDCDetId didm(HcalZDCDetId::RPD, false, channel);
0337     histoname = "RPD_M_" + std::to_string(channel);
0338 
0339     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0340     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0341     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0342     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0343     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0344     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0345     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0346     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0347 
0348     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
0349     _cfC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
0350     _cfC_EChannel[didm()]->setAxisTitle("fC", 1);
0351     _cfC_EChannel[didm()]->setAxisTitle("N", 2);
0352     ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_vs_TS_perChannel");
0353     _cfC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 6, 0, 6);
0354     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0355     _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
0356 
0357     histoname = "RPD_M_" + std::to_string(channel);
0358     _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
0359     _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
0360     _cTDC_EChannel[didm()]->setAxisTitle("N", 2);
0361   }
0362 }
0363 
0364 /* virtual */
0365 void ZDCQIE10Task::_process(edm::Event const& e, edm::EventSetup const& es) {
0366   const HcalTopology& htopo = es.getData(htopoToken_);
0367   const HcalLongRecoParams& p = es.getData(paramsToken_);
0368   longRecoParams_ = std::make_unique<HcalLongRecoParams>(p);
0369   longRecoParams_->setTopo(&htopo);
0370 
0371   int bx = e.bunchCrossing();
0372 
0373   edm::Handle<BXVector<l1t::EtSum> > sums;
0374   e.getByToken(sumToken_, sums);
0375 
0376   int startBX = sums->getFirstBX();
0377 
0378   for (int ibx = startBX; ibx <= sums->getLastBX(); ++ibx) {
0379     for (auto itr = sums->begin(ibx); itr != sums->end(ibx); ++itr) {
0380       l1t::EtSum::EtSumType type = itr->getType();
0381 
0382       if (type == l1t::EtSum::EtSumType::kZDCP) {
0383         if (ibx == 0)
0384           _cZDC_BX_EmuSUMS[1]->Fill(bx, itr->hwPt());
0385       }
0386       if (type == l1t::EtSum::EtSumType::kZDCM) {
0387         if (ibx == 0)
0388           _cZDC_BX_EmuSUMS[0]->Fill(bx, itr->hwPt());
0389       }
0390     }
0391   }
0392 
0393   edm::Handle<QIE10DigiCollection> digis;
0394   if (!e.getByToken(_tokQIE10, digis))
0395     edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " +
0396                   _tagQIE10.instance());
0397 
0398   double HADM_sum = 0, HADP_sum = 0, EMM_sum = 0, EMP_sum = 0;
0399   double HADM_tot_sum = 0, HADP_tot_sum = 0, EMM_tot_sum = 0, EMP_tot_sum = 0;
0400 
0401   for (auto it = digis->begin(); it != digis->end(); it++) {
0402     const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
0403 
0404     HcalZDCDetId const& did = digi.detid();
0405 
0406     uint32_t rawid = _ehashmap.lookup(did);
0407     if (rawid == 0) {
0408       continue;
0409     }
0410     HcalElectronicsId const& eid(rawid);
0411 
0412     _cDigiSize_Crate[0]->Fill(digi.samples());
0413 
0414     if (_ptype != fOffline) {  // hidefed2crate
0415 
0416       _cDigiSize_FED[0]->Fill(digi.samples());
0417 
0418       _cOccupancy_ElectronicsuTCA[0]->Fill(eid.slot());
0419     }
0420     if (_ptype == fOnline || _ptype == fLocal) {
0421       _cOccupancy_Crate[0]->Fill(eid.slot(), eid.fiberIndex());
0422       _cOccupancy_CrateSlot[0]->Fill(eid.slot(), eid.fiberChanId());
0423     }
0424 
0425     double sample_ZDCm_TS1 = 0, sample_ZDCp_TS1 = 0, sample_ZDCm_TS2 = 0, sample_ZDCp_TS2 = 0;
0426     double sample[2][6] = {{0}};
0427 
0428     for (int i = 0; i < digi.samples(); i++) {
0429       // ZDC Plus
0430       if (did.zside() > 0) {
0431         _cADC_PM[1]->Fill(digi[i].adc());
0432         _cADC_vs_TS_PM[1]->Fill(i, digi[i].adc());
0433         sample[1][i] = constants::adc2fC[digi[i].adc()];
0434         if (i == 1) {
0435           sample_ZDCp_TS1 = constants::adc2fC[digi[i].adc()];
0436         }
0437         if (i == 2) {
0438           sample_ZDCp_TS2 = constants::adc2fC[digi[i].adc()];
0439         }
0440 
0441       }
0442       // ZDC Minus
0443       else {
0444         _cADC_PM[0]->Fill(digi[i].adc());
0445         _cADC_vs_TS_PM[0]->Fill(i, digi[i].adc());
0446         sample[0][i] = constants::adc2fC[digi[i].adc()];
0447         if (i == 1) {
0448           sample_ZDCm_TS1 = constants::adc2fC[digi[i].adc()];
0449         }
0450         if (i == 2) {
0451           sample_ZDCm_TS2 = constants::adc2fC[digi[i].adc()];
0452         }
0453       }
0454 
0455       // iter over all samples
0456       if (_cADC_EChannel.find(did()) != _cADC_EChannel.end()) {
0457         _cADC_EChannel[did()]->Fill(digi[i].adc());
0458         _cfC_EChannel[did()]->Fill(constants::adc2fC[digi[i].adc()]);
0459         _cTDC_EChannel[did()]->Fill(digi[i].le_tdc());
0460       }
0461       if (_cADC_vs_TS_EChannel.find(did()) != _cADC_vs_TS_EChannel.end()) {
0462         _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc());
0463         _cfC_vs_TS_EChannel[did()]->Fill(i, constants::adc2fC[digi[i].adc()]);
0464       }
0465       _cZDC_CapIDS[0]->Fill(digi[i].capid());
0466     }
0467 
0468     if (did.section() == 1) {
0469       if ((did.channel() > 0) && (did.channel() < 6)) {
0470         EMM_sum += (sample_ZDCm_TS2 - sample_ZDCm_TS1);
0471         EMP_sum += (sample_ZDCp_TS2 - sample_ZDCp_TS1);
0472         for (int k = 0; k < 6; k++) {
0473           EMP_tot_sum += sample[1][k];
0474           EMM_tot_sum += sample[0][k];
0475         }
0476         if (did.zside() == -1) {
0477           if (sample[0][2] > (0.0 * EMM_tot_sum)) {
0478             _cZDC_EM_TM[0]->Fill((did.channel() * 2) - 1);
0479           } else {
0480             _cZDC_EM_TM[0]->Fill((did.channel() * 2));
0481           }
0482         }
0483         if (did.zside() == 1) {
0484           if (sample[1][2] > (0.0 * EMP_tot_sum)) {
0485             _cZDC_EM_TM[1]->Fill((did.channel() * 2) - 1);
0486           } else {
0487             _cZDC_EM_TM[1]->Fill((did.channel() * 2));
0488           }
0489         }
0490       }
0491     }
0492     if (did.section() == 2) {
0493       if ((did.channel() > 0) && (did.channel() < 5)) {
0494         HADP_sum += (sample_ZDCp_TS2 - sample_ZDCp_TS1);
0495         HADM_sum += (sample_ZDCm_TS2 - sample_ZDCm_TS1);
0496         for (int k = 0; k < 6; k++) {
0497           HADP_tot_sum += sample[1][k];
0498           HADM_tot_sum += sample[0][k];
0499         }
0500         if (did.zside() == -1) {
0501           if (sample[0][2] > (0.0 * HADM_tot_sum)) {
0502             _cZDC_HAD_TM[0]->Fill((did.channel() * 2) - 1);
0503           } else {
0504             _cZDC_HAD_TM[0]->Fill((did.channel() * 2));
0505           }
0506         }
0507         if (did.zside() == 1) {
0508           if (sample[1][2] > (0.0 * HADP_tot_sum)) {
0509             _cZDC_HAD_TM[1]->Fill((did.channel() * 2) - 1);
0510           } else {
0511             _cZDC_HAD_TM[1]->Fill((did.channel() * 2));
0512           }
0513         }
0514       }
0515     }
0516   }
0517 
0518   // Hardcoded callibrations currently
0519   _cZDC_SUMS[0]->Fill(((EMM_sum * 0.1) + HADM_sum) * 0.5031);
0520   _cZDC_SUMS[1]->Fill(((EMP_sum * 0.12) + HADP_sum) * 0.9397);
0521   _cZDC_BXSUMS[0]->Fill(bx, ((EMM_sum * 0.1) + HADM_sum) * 0.5031);
0522   _cZDC_BXSUMS[1]->Fill(bx, ((EMP_sum * 0.12) + HADP_sum) * 0.9397);
0523 }
0524 
0525 DEFINE_FWK_MODULE(ZDCQIE10Task);