CMS 3D CMS Logo

ZDCTask.cc
Go to the documentation of this file.
1 
3 #include <map>
4 
5 using namespace hcaldqm;
6 using namespace hcaldqm::constants;
8  // tags
9  _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis"));
10  _tokQIE10 = consumes<ZDCDigiCollection>(_tagQIE10);
11 
12  // cuts
13  _cut = ps.getUntrackedParameter<double>("cut", 50.0);
14  _ped = ps.getUntrackedParameter<int>("ped", 4);
15 }
16 
17 /* virtual */ void ZDCTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
18  //############################## hardcode manually the zdc mapping #############################
19  //############################# this follows from https://github.com/cms-sw/cmssw/blob/CMSSW_8_0_X/EventFilter/CastorRawToDigi/src/ZdcUnpacker.cc#L118
20  //##############################################################################################
22  //PZDC
23  std::map<HcalElectronicsId, DetId> myEMap;
25  eid.setHTR(18, 8, 1);
26  myEMap[eid] = DetId(0x54000051); //PZDC EM1
27 
28  eid = HcalElectronicsId(1, 1, 0, 3);
29  eid.setHTR(18, 8, 1);
30  myEMap[eid] = DetId(0x54000052); //PZDC EM2
31 
32  eid = HcalElectronicsId(2, 1, 0, 3);
33  eid.setHTR(18, 8, 1);
34  myEMap[eid] = DetId(0x54000053); //PZDC EM3
35 
36  eid = HcalElectronicsId(0, 2, 0, 3);
37  eid.setHTR(18, 8, 1);
38  myEMap[eid] = DetId(0x54000061); //PZDC HAD1
39 
40  eid = HcalElectronicsId(1, 2, 0, 3);
41  eid.setHTR(18, 8, 1);
42  myEMap[eid] = DetId(0x54000054); //PZDC EM4
43 
44  eid = HcalElectronicsId(2, 2, 0, 3);
45  eid.setHTR(18, 8, 1);
46  myEMap[eid] = DetId(0x54000055); //PZDC EM5
47 
48  eid = HcalElectronicsId(0, 3, 0, 3);
49  eid.setHTR(18, 8, 1);
50  myEMap[eid] = DetId(0x54000062); //PZDC HAD2
51 
52  eid = HcalElectronicsId(1, 3, 0, 3);
53  eid.setHTR(18, 8, 1);
54  myEMap[eid] = DetId(0x54000063); //PZDC HAD3
55 
56  eid = HcalElectronicsId(2, 3, 0, 3);
57  eid.setHTR(18, 8, 1);
58  myEMap[eid] = DetId(0x54000064); //PZDC HAD4
59 
60  //NZDC
61  eid = HcalElectronicsId(0, 1, 1, 3);
62  eid.setHTR(18, 8, 0);
63  myEMap[eid] = DetId(0x54000011); //NZDC EM1
64 
65  eid = HcalElectronicsId(1, 1, 1, 3);
66  eid.setHTR(18, 8, 0);
67  myEMap[eid] = DetId(0x54000012); //NZDC EM2
68 
69  eid = HcalElectronicsId(2, 1, 1, 3);
70  eid.setHTR(18, 8, 0);
71  myEMap[eid] = DetId(0x54000013); //NZDC EM3
72 
73  eid = HcalElectronicsId(0, 2, 1, 3);
74  eid.setHTR(18, 8, 0);
75  myEMap[eid] = DetId(0x54000015); //NZDC EM5
76 
77  eid = HcalElectronicsId(1, 2, 1, 3);
78  eid.setHTR(18, 8, 0);
79  myEMap[eid] = DetId(0x54000021); //NZDC HAD1
80 
81  eid = HcalElectronicsId(2, 2, 1, 3);
82  eid.setHTR(18, 8, 0);
83  myEMap[eid] = DetId(0x54000014); //NZDC EM4
84 
85  eid = HcalElectronicsId(0, 3, 1, 3);
86  eid.setHTR(18, 8, 0);
87  myEMap[eid] = DetId(0x54000022); //NZDC HAD2
88 
89  eid = HcalElectronicsId(1, 3, 1, 3);
90  eid.setHTR(18, 8, 0);
91  myEMap[eid] = DetId(0x54000023); //NZDC HAD3
92 
93  eid = HcalElectronicsId(2, 3, 1, 3);
94  eid.setHTR(18, 8, 0);
95  myEMap[eid] = DetId(0x54000024); //NZDC HAD4
96  //##################################### end hardcoding ###################################
97 
98  ib.cd();
99 
100  //quantities for axis
103 
105 
106  //book histos per channel
107  for (std::map<HcalElectronicsId, DetId>::const_iterator itr = myEMap.begin(); itr != myEMap.end(); ++itr) {
108  char histoname[300];
109 
110  sprintf(histoname,
111  "%d_%d_%d_%d",
112  itr->first.fiberChanId(),
113  itr->first.fiberIndex(),
114  itr->first.spigot(),
115  itr->first.dccid());
116 
117  ib.setCurrentFolder("Hcal/ZDCTask/Shape_perChannel");
118  _cShape_EChannel[histoname] = ib.bookProfile(histoname,
119  histoname,
120  xAxisShape.nbins(),
121  xAxisShape.min(),
122  xAxisShape.max(),
123  yAxisShape.nbins(),
124  yAxisShape.min(),
125  yAxisShape.max());
126  _cShape_EChannel[histoname]->setAxisTitle("Timing", 1);
127  _cShape_EChannel[histoname]->setAxisTitle("fC QIE8", 2);
128 
129  ib.setCurrentFolder("Hcal/ZDCTask/ADC_perChannel");
130  _cADC_EChannel[histoname] = ib.book1D(histoname, histoname, xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max());
131  _cADC_EChannel[histoname]->getTH1()->SetBit(
133  _cADC_EChannel[histoname]->setAxisTitle("ADC QIE8", 1);
134 
135  ib.setCurrentFolder("Hcal/ZDCTask/ADC_vs_TS_perChannel");
136  _cADC_vs_TS_EChannel[histoname] = ib.book2D(histoname,
137  histoname,
138  xAxisShape.nbins(),
139  xAxisShape.min(),
140  xAxisShape.max(),
141  xAxisADC.nbins(),
142  xAxisADC.min(),
143  xAxisADC.max());
144  _cADC_vs_TS_EChannel[histoname]->getTH1()->SetBit(
146  _cADC_vs_TS_EChannel[histoname]->setAxisTitle("Timing", 1);
147  _cADC_vs_TS_EChannel[histoname]->setAxisTitle("ADC QIE8", 2);
148  }
149 
150  //book global histos
151  ib.setCurrentFolder("Hcal/ZDCTask");
152 
153  _cShape = ib.bookProfile("Shape",
154  "Shape",
155  xAxisShape.nbins(),
156  xAxisShape.min(),
157  xAxisShape.max(),
158  yAxisShape.nbins(),
159  yAxisShape.min(),
160  yAxisShape.max());
161  _cShape->setAxisTitle("Timing", 1);
162  _cShape->setAxisTitle("fC QIE8", 2);
163 
164  _cADC = ib.book1D("ADC", "ADC", xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max());
166  _cADC->setAxisTitle("ADC QIE8", 1);
167 
168  _cADC_vs_TS = ib.book2D("ADC_vs_TS",
169  "ADC_vs_TS",
170  xAxisShape.nbins(),
171  xAxisShape.min(),
172  xAxisShape.max(),
173  xAxisADC.nbins(),
174  xAxisADC.min(),
175  xAxisADC.max());
176  _cADC_vs_TS->getTH1()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis));
177  _cADC_vs_TS->setAxisTitle("Timing", 1);
178  _cADC_vs_TS->setAxisTitle("ADC QIE8", 2);
179 }
180 
181 /* virtual */ void ZDCTask::analyze(edm::Event const& e, edm::EventSetup const&) {
183  if (!e.getByToken(_tokQIE10, cqie10))
184  edm::LogError("Collection ZDCDigiCollection isn't available" + _tagQIE10.label() + " " + _tagQIE10.instance());
185 
186  for (uint32_t i = 0; i < cqie10->size(); i++) {
187  ZDCDataFrame frame = static_cast<ZDCDataFrame>((*cqie10)[i]);
188  HcalElectronicsId eid = frame.elecId();
189 
190  char histoname[300];
191  sprintf(histoname, "%d_%d_%d_%d", eid.fiberChanId(), eid.fiberIndex(), eid.spigot(), eid.dccid());
192 
193  // compute the signal, ped subracted
194  //double q = hcaldqm::utilities::sumQ_v10<ZDCDataFrame>(frame, constants::adc2fC[_ped], 0, frame.size()-1);
195 
196  // iterate thru all TS and fill
197  for (int j = 0; j < frame.size(); j++) {
198  _cShape_EChannel[histoname]->Fill(j, frame[j].nominal_fC());
199  _cShape->Fill(j, frame[j].nominal_fC());
200 
201  _cADC_EChannel[histoname]->Fill(frame[j].adc());
202  _cADC->Fill(frame[j].adc());
203 
204  _cADC_vs_TS_EChannel[histoname]->Fill(j, frame[j].adc());
205  _cADC_vs_TS->Fill(j, frame[j].adc());
206  }
207  }
208 }
209 
hcaldqm::quantity::fADC_128
Definition: ValueQuantity.h:15
hcaldqm::quantity::ValueQuantity::nbins
int nbins() override
Definition: ValueQuantity.h:343
hcaldqm::quantity::ValueQuantity::min
double min() override
Definition: ValueQuantity.h:344
mps_fire.i
i
Definition: mps_fire.py:428
hcaldqm::constants
Definition: Constants.h:9
edm::Run
Definition: Run.h:45
hcaldqm::quantity::ValueQuantity
Definition: ValueQuantity.h:309
hcaldqm
Definition: Constants.h:8
hcaldqm::quantity::ffC_10000
Definition: ValueQuantity.h:18
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
ZDCTask::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ZDCTask.cc:17
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
hcaldqm::constants::BIT_OFFSET
const int BIT_OFFSET
Definition: Constants.h:279
ZDCTask
Definition: ZDCTask.py:1
edm::Handle
Definition: AssociativeIterator.h:50
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
DetId
Definition: DetId.h:17
ZDCTask::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: ZDCTask.cc:181
ZDCTask.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
ZDCDataFrame
Definition: ZDCDataFrame.h:15
hcaldqm::quantity::fYAxis
Definition: Quantity.h:25
edm::ParameterSet
Definition: ParameterSet.h:47
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
hcaldqm::quantity::ValueQuantity::max
double max() override
Definition: ValueQuantity.h:345
cuy.ib
ib
Definition: cuy.py:662
edm::EventSetup
Definition: EventSetup.h:57
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ZDCTask::ZDCTask
ZDCTask(edm::ParameterSet const &)
Definition: ZDCTask.cc:7
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
dqm::implementation::IBooker
Definition: DQMStore.h:43
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
hcaldqm::quantity::fTiming_TS
Definition: ValueQuantity.h:21
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37