CMS 3D CMS Logo

ZDCQIE10Task.cc
Go to the documentation of this file.
1 
3 
5 {
6  // tags
8  edm::InputTag("hcalDigis", "ZDC"));
9  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
10 }
11 
13  edm::Run const& r, edm::EventSetup const& es)
14 {
15 
16  ib.cd();
17 
18  //book histos per channel
19  std::string histoname;
20  for ( int channel = 1; channel < 6; channel++ ) {
21  // EM Pos
22  HcalZDCDetId didp(HcalZDCDetId::EM, true, channel);
23  histoname = "EM_P_" + std::to_string(channel) + "_1";
24  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
25  _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
26  _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
27  _cADC_EChannel[didp()]->setAxisTitle("N", 2);
28  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
29  _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
30  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
31  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
32 
33  // EM Minus
34  HcalZDCDetId didm(HcalZDCDetId::EM, false, channel);
35  histoname = "EM_M_" + std::to_string(channel) + "_1";
36  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
37  _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
38  _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
39  _cADC_EChannel[didm()]->setAxisTitle("N", 2);
40  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
41  _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
42  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
43  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
44  }
45 
46  for ( int channel = 1; channel < 5; channel++ ) {
47  // HAD Pos
48  HcalZDCDetId didp(HcalZDCDetId::HAD, true, channel);
49  histoname = "HAD_P_" + std::to_string(channel) + "_" + std::to_string(channel+2);
50  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
51  _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
52  _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
53  _cADC_EChannel[didp()]->setAxisTitle("N", 2);
54  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
55  _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
56  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
57  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
58 
59  // HAD Minus
60  HcalZDCDetId didm(HcalZDCDetId::HAD, false, channel);
61  histoname = "HAD_M_" + std::to_string(channel) + "_" + std::to_string(channel+2);
62  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
63  _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
64  _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
65  _cADC_EChannel[didm()]->setAxisTitle("N", 2);
66  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
67  _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
68  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
69  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
70  }
71 
72  for ( int channel = 1; channel < 17; channel++ ) {
73  // RPD Pos
74  HcalZDCDetId didp(HcalZDCDetId::RPD, true, channel);
75  histoname = "RPD_P_" + std::to_string(channel) + "_2";
76  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
77  _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
78  _cADC_EChannel[didp()]->setAxisTitle("ADC", 1);
79  _cADC_EChannel[didp()]->setAxisTitle("N", 2);
80  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
81  _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
82  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1);
83  _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2);
84 
85  // RPD Minus
86  HcalZDCDetId didm(HcalZDCDetId::RPD, false, channel);
87  histoname = "RPD_M_" + std::to_string(channel) + "_2";
88  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
89  _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256);
90  _cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
91  _cADC_EChannel[didm()]->setAxisTitle("N", 2);
92  ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel");
93  _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10);
94  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
95  _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
96  }
97 
98 }
99 
100 
101 /* virtual */ void ZDCQIE10Task::analyze(edm::Event const& e, edm::EventSetup const&)
102 {
104  if (!e.getByToken(_tokQIE10, digis))
105  edm::LogError("Collection QIE10DigiCollection for ZDC isn't available"
106  + _tagQIE10.label() + " " + _tagQIE10.instance());
107 
108  for ( auto it = digis->begin(); it != digis->end(); it++ ) {
109  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
110  HcalZDCDetId const& did = digi.detid();
111 
112  for ( int i = 0; i < digi.samples(); i++ ) {
113  // iter over all samples
114  if ( _cADC_EChannel.find( did()) != _cADC_EChannel.end() ) {
115  _cADC_EChannel[did()]->Fill(digi[i].adc());
116  }
117  if ( _cADC_vs_TS_EChannel.find( did() ) != _cADC_vs_TS_EChannel.end() ) {
118  _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc());
119  }
120 
121  }
122  }
123 }
124 
125 
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
T getUntrackedParameter(std::string const &, T const &) const
std::map< uint32_t, MonitorElement * > _cADC_vs_TS_EChannel
Definition: ZDCQIE10Task.h:31
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
ZDCQIE10Task(edm::ParameterSet const &)
Definition: ZDCQIE10Task.cc:4
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::InputTag _tagQIE10
Definition: ZDCQIE10Task.h:26
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: ZDCQIE10Task.h:27
const_iterator begin() const
std::map< uint32_t, MonitorElement * > _cADC_EChannel
Definition: ZDCQIE10Task.h:30
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ZDCQIE10Task.cc:12
DetId detid() const
Get the detector id.
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
void analyze(edm::Event const &, edm::EventSetup const &) override
std::string const & instance() const
Definition: InputTag.h:37
Definition: Run.h:44
ib
Definition: cuy.py:662