Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:35

0001 
0002 #include "DQM/HcalTasks/interface/ZDCQIE10Task.h"
0003 
0004 ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) {
0005   //    tags
0006   _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis", "ZDC"));
0007   _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
0008 }
0009 
0010 /* virtual */ void ZDCQIE10Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0011   ib.cd();
0012 
0013   //book histos per channel
0014   std::string histoname;
0015   for (int channel = 1; channel < 6; channel++) {
0016     // EM Pos
0017     HcalZDCDetId didp(HcalZDCDetId::EM, true, channel);
0018     histoname = "EM_P_" + std::to_string(channel) + "_1";
0019     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0020     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0021     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0022     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0023     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0024     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0025     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0026     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0027 
0028     // EM Minus
0029     HcalZDCDetId didm(HcalZDCDetId::EM, false, channel);
0030     histoname = "EM_M_" + std::to_string(channel) + "_1";
0031     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0032     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0033     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0034     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0035     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0036     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0037     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0038     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0039   }
0040 
0041   for (int channel = 1; channel < 5; channel++) {
0042     // HAD Pos
0043     HcalZDCDetId didp(HcalZDCDetId::HAD, true, channel);
0044     histoname = "HAD_P_" + std::to_string(channel) + "_" + std::to_string(channel + 2);
0045     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0046     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0047     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0048     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0049     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0050     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0051     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0052     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0053 
0054     // HAD Minus
0055     HcalZDCDetId didm(HcalZDCDetId::HAD, false, channel);
0056     histoname = "HAD_M_" + std::to_string(channel) + "_" + std::to_string(channel + 2);
0057     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0058     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0059     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0060     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0061     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0062     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0063     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0064     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0065   }
0066 
0067   for (int channel = 1; channel < 17; channel++) {
0068     // RPD Pos
0069     HcalZDCDetId didp(HcalZDCDetId::RPD, true, channel);
0070     histoname = "RPD_P_" + std::to_string(channel) + "_2";
0071     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0072     _cADC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0073     _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
0074     _cADC_EChannel[didp()]->setAxisTitle("N", 2);
0075     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0076     _cADC_vs_TS_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0077     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
0078     _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
0079 
0080     // RPD Minus
0081     HcalZDCDetId didm(HcalZDCDetId::RPD, false, channel);
0082     histoname = "RPD_M_" + std::to_string(channel) + "_2";
0083     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
0084     _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
0085     _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
0086     _cADC_EChannel[didm()]->setAxisTitle("N", 2);
0087     ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
0088     _cADC_vs_TS_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 10, 0, 10);
0089     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
0090     _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
0091   }
0092 }
0093 
0094 /* virtual */ void ZDCQIE10Task::analyze(edm::Event const& e, edm::EventSetup const&) {
0095   edm::Handle<QIE10DigiCollection> digis;
0096   if (!e.getByToken(_tokQIE10, digis))
0097     edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " +
0098                   _tagQIE10.instance());
0099 
0100   for (auto it = digis->begin(); it != digis->end(); it++) {
0101     const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
0102     HcalZDCDetId const& did = digi.detid();
0103 
0104     for (int i = 0; i < digi.samples(); i++) {
0105       // iter over all samples
0106       if (_cADC_EChannel.find(did()) != _cADC_EChannel.end()) {
0107         _cADC_EChannel[did()]->Fill(digi[i].adc());
0108       }
0109       if (_cADC_vs_TS_EChannel.find(did()) != _cADC_vs_TS_EChannel.end()) {
0110         _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc());
0111       }
0112     }
0113   }
0114 }
0115 
0116 DEFINE_FWK_MODULE(ZDCQIE10Task);