11 void dumpHeader (std::ostream& fOutput,
unsigned fRun,
const std::string& fTableName,
const std::string& fTypeName) {
12 fOutput <<
"<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << std::endl;
14 fOutput <<
"<ROOT>" << std::endl;
15 fOutput <<
" <HEADER>" << std::endl;
16 fOutput <<
" <TYPE>" << std::endl;
17 fOutput <<
" <EXTENSION_TABLE_NAME>" << fTableName <<
"</EXTENSION_TABLE_NAME>" << std::endl;
18 fOutput <<
" <NAME>" << fTypeName <<
"</NAME>" << std::endl;
19 fOutput <<
" </TYPE>" << std::endl;
20 fOutput <<
" <RUN>"<< std::endl;
21 fOutput <<
" <RUN_TYPE>" <<
"HcalCalibrations" <<
"</RUN_TYPE>"<< std::endl;
22 fOutput <<
" <RUN_NUMBER>" << fRun <<
"</RUN_NUMBER>"<< std::endl;
23 fOutput <<
" </RUN>" << std::endl;
24 fOutput <<
" <HINTS channelmap='HCAL_CHANNELS'/>" << std::endl;
25 fOutput <<
" </HEADER>" << std::endl;
28 void dumpMapping (std::ostream& fOutput,
unsigned fRun,
const std::string& fKind,
29 unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
30 const std::string& fTag,
unsigned fVersion,
const std::vector<DetId>& fChannels) {
33 fOutput <<
"<ELEMENTS>" << std::endl;
35 fOutput <<
"<DATA_SET id=\"-1\"/>" << std::endl;
36 fOutput <<
" <IOV id=\"1\">" << std::endl;
37 fOutput <<
" <INTERVAL_OF_VALIDITY_BEGIN>" << fGMTIOVBegin <<
"</INTERVAL_OF_VALIDITY_BEGIN>"<< std::endl;
38 fOutput <<
" <INTERVAL_OF_VALIDITY_END>" << fGMTIOVEnd <<
"</INTERVAL_OF_VALIDITY_END>"<< std::endl;
39 fOutput <<
" </IOV>" << std::endl;
41 fOutput <<
" <TAG id=\"2\" mode=\"auto\">"<< std::endl;
42 fOutput <<
" <TAG_NAME>" << fTag <<
"</TAG_NAME>"<< std::endl;
43 fOutput <<
" <DETECTOR_NAME>HCAL</DETECTOR_NAME>"<< std::endl;
44 fOutput <<
" <COMMENT_DESCRIPTION>Automatically created by HcalCondXML</COMMENT_DESCRIPTION>" << std::endl;
45 fOutput <<
" </TAG>" << std::endl;
47 fOutput <<
"</ELEMENTS>" << std::endl;
49 fOutput <<
"<MAPS>" << std::endl;
50 fOutput <<
" <TAG idref=\"2\">" << std::endl;
51 fOutput <<
" <IOV idref=\"1\">" << std::endl;
52 fOutput <<
" <DATA_SET idref=\"-1\"/>" << std::endl;
53 fOutput <<
" </IOV>" << std::endl;
54 fOutput <<
" </TAG>" << std::endl;
55 fOutput <<
"</MAPS>" << std::endl;
58 void dumpFooter (std::ostream& fOutput) {
59 fOutput <<
"</ROOT>" << std::endl;
62 void dumpDataset (std::ostream& fOutput,
unsigned fVersion = 0) {
63 fOutput <<
"<DATA_SET>" << std::endl;
64 fOutput <<
" <VERSION>" << fVersion <<
"</VERSION>" << std::endl;
67 void endDataset (std::ostream& fOutput) {
68 fOutput <<
"</DATA_SET>" << std::endl;
71 void dumpChannelIdOld (std::ostream& fOutput,
DetId fChannel) {
73 fOutput <<
"<CHANNEL> "<< std::endl;
74 fOutput <<
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME> "<< std::endl;
75 fOutput <<
" <ETA>" <<
abs (converter.getField (1)) <<
"</ETA>"<< std::endl;
76 fOutput <<
" <PHI>" << converter.getField (2) <<
"</PHI> "<< std::endl;
77 fOutput <<
" <DEPTH>" << converter.getField (3) <<
"</DEPTH> "<< std::endl;
78 fOutput <<
" <Z>" << (converter.getField (1) > 0 ?
"1" :
"-1") <<
"</Z> "<< std::endl;
79 fOutput <<
" <DETECTOR_NAME>" << converter.getFlavor () <<
"</DETECTOR_NAME> "<< std::endl;
80 fOutput <<
" <HCAL_CHANNEL_ID>" << converter.getId().rawId () <<
"</HCAL_CHANNEL_ID> "<< std::endl;
81 fOutput <<
"</CHANNEL>"<< std::endl;
85 void dumpChannelId (std::ostream& fOutput,
DetId fChannel) {
87 fOutput <<
"<CHANNEL> "<< std::endl;
88 fOutput <<
" <EXTENSION_TABLE_NAME>HCAL_CHANNELS</EXTENSION_TABLE_NAME> "<< std::endl;
89 fOutput <<
" <SUBDET>" << converter.getFlavor () <<
"</SUBDET> "<< std::endl;
90 fOutput <<
" <IETA>" << converter.getField (1) <<
"</IETA>"<< std::endl;
91 fOutput <<
" <IPHI>" << converter.getField (2) <<
"</IPHI> "<< std::endl;
92 fOutput <<
" <DEPTH>" << converter.getField (3) <<
"</DEPTH> "<< std::endl;
94 fOutput <<
"</CHANNEL>"<< std::endl;
99 fOutput <<
"<DATA> "<< std::endl;
100 fOutput <<
" <ZERO_SUPPRESSION>" << fValue.
getValue() <<
"</ZERO_SUPPRESSION> "<< std::endl;
101 fOutput <<
"</DATA> " << std::endl;
105 fOutput <<
"<DATA> "<< std::endl;
106 fOutput <<
" <CAP0>" << fValue.
getValue(0) <<
"</CAP0> "<< std::endl;
107 fOutput <<
" <CAP1>" << fValue.
getValue(1) <<
"</CAP1> "<< std::endl;
108 fOutput <<
" <CAP2>" << fValue.
getValue(2) <<
"</CAP2> "<< std::endl;
109 fOutput <<
" <CAP3>" << fValue.
getValue(3) <<
"</CAP3> "<< std::endl;
110 fOutput <<
" <SIGMA_00>" << fValue2.
getWidth(0) <<
"</SIGMA_00> "<< std::endl;
111 fOutput <<
" <SIGMA_11>" << fValue2.
getWidth(1) <<
"</SIGMA_11> "<< std::endl;
112 fOutput <<
" <SIGMA_22>" << fValue2.
getWidth(2) <<
"</SIGMA_22> "<< std::endl;
113 fOutput <<
" <SIGMA_33>" << fValue2.
getWidth(3) <<
"</SIGMA_33> "<< std::endl;
114 fOutput <<
" <SIGMA_01>" << fValue2.
getSigma(0,1) <<
"</SIGMA_01> "<< std::endl;
115 fOutput <<
" <SIGMA_02>" << fValue2.
getSigma(0,2) <<
"</SIGMA_02> "<< std::endl;
116 fOutput <<
" <SIGMA_03>" << fValue2.
getSigma(0,3) <<
"</SIGMA_03> "<< std::endl;
117 fOutput <<
" <SIGMA_12>" << fValue2.
getSigma(1,2) <<
"</SIGMA_12> "<< std::endl;
118 fOutput <<
" <SIGMA_13>" << fValue2.
getSigma(1,3) <<
"</SIGMA_13> "<< std::endl;
119 fOutput <<
" <SIGMA_23>" << fValue2.
getSigma(2,3) <<
"</SIGMA_23> "<< std::endl;
120 fOutput <<
" <IS_ADC_COUNTS>" << isADC <<
"</IS_ADC_COUNTS>" << std::endl;
121 fOutput <<
"</DATA> " << std::endl;
124 void dumpGainData (std::ostream& fOutput,
HcalGain fValue) {
125 fOutput <<
"<DATA> "<< std::endl;
126 fOutput <<
" <CAP0>" << fValue.
getValue(0) <<
"</CAP0> "<< std::endl;
127 fOutput <<
" <CAP1>" << fValue.
getValue(1) <<
"</CAP1> "<< std::endl;
128 fOutput <<
" <CAP2>" << fValue.
getValue(2) <<
"</CAP2> "<< std::endl;
129 fOutput <<
" <CAP3>" << fValue.
getValue(3) <<
"</CAP3> "<< std::endl;
130 fOutput <<
"</DATA> " << std::endl;
133 void dumpGainWidthData (std::ostream& fOutput,
HcalGainWidth fValue) {
134 fOutput <<
"<DATA> "<< std::endl;
135 fOutput <<
" <CAP0>" << fValue.
getValue(0) <<
"</CAP0> "<< std::endl;
136 fOutput <<
" <CAP1>" << fValue.
getValue(1) <<
"</CAP1> "<< std::endl;
137 fOutput <<
" <CAP2>" << fValue.
getValue(2) <<
"</CAP2> "<< std::endl;
138 fOutput <<
" <CAP3>" << fValue.
getValue(3) <<
"</CAP3> "<< std::endl;
139 fOutput <<
"</DATA> " << std::endl;
142 void dumpRespCorrData (std::ostream& fOutput,
HcalRespCorr fValue) {
143 fOutput <<
"<DATA> "<< std::endl;
144 fOutput <<
" <VALUE>" << fValue.
getValue() <<
"</VALUE> "<< std::endl;
145 fOutput <<
"</DATA> " << std::endl;
148 void dumpQIEData (std::ostream& fOutput,
HcalQIECoder fValue) {
149 fOutput <<
"<DATA> "<< std::endl;
150 fOutput <<
" <CAP0_RANGE0_SLOPE>" << fValue.
slope(0,0) <<
"</CAP0_RANGE0_SLOPE>" << std::endl;
151 fOutput <<
" <CAP0_RANGE1_SLOPE>" << fValue.
slope(0,1) <<
"</CAP0_RANGE1_SLOPE>" << std::endl;
152 fOutput <<
" <CAP0_RANGE2_SLOPE>" << fValue.
slope(0,2) <<
"</CAP0_RANGE2_SLOPE>" << std::endl;
153 fOutput <<
" <CAP0_RANGE3_SLOPE>" << fValue.
slope(0,3) <<
"</CAP0_RANGE3_SLOPE>" << std::endl;
154 fOutput <<
" <CAP1_RANGE0_SLOPE>" << fValue.
slope(1,0) <<
"</CAP1_RANGE0_SLOPE>" << std::endl;
155 fOutput <<
" <CAP1_RANGE1_SLOPE>" << fValue.
slope(1,1) <<
"</CAP1_RANGE1_SLOPE>" << std::endl;
156 fOutput <<
" <CAP1_RANGE2_SLOPE>" << fValue.
slope(1,2) <<
"</CAP1_RANGE2_SLOPE>" << std::endl;
157 fOutput <<
" <CAP1_RANGE3_SLOPE>" << fValue.
slope(1,3) <<
"</CAP1_RANGE3_SLOPE>" << std::endl;
158 fOutput <<
" <CAP2_RANGE0_SLOPE>" << fValue.
slope(2,0) <<
"</CAP2_RANGE0_SLOPE>" << std::endl;
159 fOutput <<
" <CAP2_RANGE1_SLOPE>" << fValue.
slope(2,1) <<
"</CAP2_RANGE1_SLOPE>" << std::endl;
160 fOutput <<
" <CAP2_RANGE2_SLOPE>" << fValue.
slope(2,2) <<
"</CAP2_RANGE2_SLOPE>" << std::endl;
161 fOutput <<
" <CAP2_RANGE3_SLOPE>" << fValue.
slope(2,3) <<
"</CAP2_RANGE3_SLOPE>" << std::endl;
162 fOutput <<
" <CAP3_RANGE0_SLOPE>" << fValue.
slope(3,0) <<
"</CAP3_RANGE0_SLOPE>" << std::endl;
163 fOutput <<
" <CAP3_RANGE1_SLOPE>" << fValue.
slope(3,1) <<
"</CAP3_RANGE1_SLOPE>" << std::endl;
164 fOutput <<
" <CAP3_RANGE2_SLOPE>" << fValue.
slope(3,2) <<
"</CAP3_RANGE2_SLOPE>" << std::endl;
165 fOutput <<
" <CAP3_RANGE3_SLOPE>" << fValue.
slope(3,3) <<
"</CAP3_RANGE3_SLOPE>" << std::endl;
166 fOutput <<
" <CAP0_RANGE0_OFFSET>" << fValue.
offset(0,0) <<
"</CAP0_RANGE0_OFFSET>" << std::endl;
167 fOutput <<
" <CAP0_RANGE1_OFFSET>" << fValue.
offset(0,1) <<
"</CAP0_RANGE1_OFFSET>" << std::endl;
168 fOutput <<
" <CAP0_RANGE2_OFFSET>" << fValue.
offset(0,2) <<
"</CAP0_RANGE2_OFFSET>" << std::endl;
169 fOutput <<
" <CAP0_RANGE3_OFFSET>" << fValue.
offset(0,3) <<
"</CAP0_RANGE3_OFFSET>" << std::endl;
170 fOutput <<
" <CAP1_RANGE0_OFFSET>" << fValue.
offset(1,0) <<
"</CAP1_RANGE0_OFFSET>" << std::endl;
171 fOutput <<
" <CAP1_RANGE1_OFFSET>" << fValue.
offset(1,1) <<
"</CAP1_RANGE1_OFFSET>" << std::endl;
172 fOutput <<
" <CAP1_RANGE2_OFFSET>" << fValue.
offset(1,2) <<
"</CAP1_RANGE2_OFFSET>" << std::endl;
173 fOutput <<
" <CAP1_RANGE3_OFFSET>" << fValue.
offset(1,3) <<
"</CAP1_RANGE3_OFFSET>" << std::endl;
174 fOutput <<
" <CAP2_RANGE0_OFFSET>" << fValue.
offset(2,0) <<
"</CAP2_RANGE0_OFFSET>" << std::endl;
175 fOutput <<
" <CAP2_RANGE1_OFFSET>" << fValue.
offset(2,1) <<
"</CAP2_RANGE1_OFFSET>" << std::endl;
176 fOutput <<
" <CAP2_RANGE2_OFFSET>" << fValue.
offset(2,2) <<
"</CAP2_RANGE2_OFFSET>" << std::endl;
177 fOutput <<
" <CAP2_RANGE3_OFFSET>" << fValue.
offset(2,3) <<
"</CAP2_RANGE3_OFFSET>" << std::endl;
178 fOutput <<
" <CAP3_RANGE0_OFFSET>" << fValue.
offset(3,0) <<
"</CAP3_RANGE0_OFFSET>" << std::endl;
179 fOutput <<
" <CAP3_RANGE1_OFFSET>" << fValue.
offset(3,1) <<
"</CAP3_RANGE1_OFFSET>" << std::endl;
180 fOutput <<
" <CAP3_RANGE2_OFFSET>" << fValue.
offset(3,2) <<
"</CAP3_RANGE2_OFFSET>" << std::endl;
181 fOutput <<
" <CAP3_RANGE3_OFFSET>" << fValue.
offset(3,3) <<
"</CAP3_RANGE3_OFFSET>" << std::endl;
182 fOutput <<
"</DATA> " << std::endl;
186 fOutput <<
"<DATA> "<< std::endl;
189 fOutput <<
" <CHANNEL_ON_OFF_STATE>0</CHANNEL_ON_OFF_STATE> "<< std::endl;
191 fOutput <<
" <CHANNEL_ON_OFF_STATE>1</CHANNEL_ON_OFF_STATE> "<< std::endl;
193 fOutput <<
" <CHANNEL_STATUS_WORD>" << fValue.
getValue() <<
"</CHANNEL_STATUS_WORD> "<< std::endl;
194 fOutput <<
"</DATA> " << std::endl;
198 fOutput <<
"<DATA> "<< std::endl;
199 fOutput <<
" <AVERAGE_PEDESTAL>" << fValue.
getPedestal() <<
"</AVERAGE_PEDESTAL> "<< std::endl;
200 fOutput <<
" <RESPONSE_CORRECTED_GAIN>" << fValue.
getRespGain() <<
"</RESPONSE_CORRECTED_GAIN> "<< std::endl;
201 fOutput <<
" <FLAG>" << fValue.
getFlag() <<
"</FLAG> "<< std::endl;
202 fOutput <<
"</DATA> " << std::endl;
208 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
210 const std::string KIND =
"HCAL zero suppression [type 1]";
211 const std::string TABLE =
"HCAL_ZERO_SUPPRESSION_TYPE01";
213 dumpHeader (fOutput, fRun, TABLE, KIND);
216 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
217 for (std::vector<DetId>::iterator channel = channels.begin ();
218 channel != channels.end ();
220 DetId chId = *channel;
224 dumpDataset (fOutput, fVersion);
225 dumpChannelId (fOutput,chId);
226 dumpZSData (fOutput, *item);
227 endDataset (fOutput);
231 dumpFooter (fOutput);
235 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
240 dumpHeader (fOutput, fRun, TABLE, KIND);
242 if(fObject.
isADC()) isADC = 1;
245 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
246 for (std::vector<DetId>::iterator channel = channels.begin ();
247 channel != channels.end ();
249 DetId chId = *channel;
255 dumpDataset (fOutput, fVersion);
256 dumpChannelId (fOutput,chId);
257 dumpPedData (fOutput, *item, *item2, isADC);
258 endDataset (fOutput);
262 dumpFooter (fOutput);
267 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
269 const std::string KIND =
"HCAL Response corrections [V1]";
270 const std::string TABLE =
"HCAL_RESPONSE_CORRECTIONS_V1";
272 dumpHeader (fOutput, fRun, TABLE, KIND);
275 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
276 for (std::vector<DetId>::iterator channel = channels.begin ();
277 channel != channels.end ();
279 DetId chId = *channel;
283 dumpDataset (fOutput, fVersion);
284 dumpChannelId (fOutput,chId);
285 dumpRespCorrData (fOutput, *item);
286 endDataset (fOutput);
290 dumpFooter (fOutput);
295 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
297 const std::string KIND =
"HCAL Inverse Gains [V1]";
300 dumpHeader (fOutput, fRun, TABLE, KIND);
303 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
304 for (std::vector<DetId>::iterator channel = channels.begin ();
305 channel != channels.end ();
307 DetId chId = *channel;
311 dumpDataset (fOutput, fVersion);
312 dumpChannelId (fOutput,chId);
313 dumpGainData (fOutput, *item);
314 endDataset (fOutput);
318 dumpFooter (fOutput);
323 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
325 const std::string KIND =
"HCAL Inverse Gain Widths [V1]";
326 const std::string TABLE =
"HCAL_INVERSE_GAIN_WIDTHS_V1";
328 dumpHeader (fOutput, fRun, TABLE, KIND);
331 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
332 for (std::vector<DetId>::iterator channel = channels.begin ();
333 channel != channels.end ();
335 DetId chId = *channel;
339 dumpDataset (fOutput, fVersion);
340 dumpChannelId (fOutput,chId);
341 dumpGainWidthData (fOutput, *item);
342 endDataset (fOutput);
346 dumpFooter (fOutput);
351 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
356 dumpHeader (fOutput, fRun, TABLE, KIND);
359 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
360 for (std::vector<DetId>::iterator channel = channels.begin ();
361 channel != channels.end ();
363 DetId chId = *channel;
367 dumpDataset (fOutput, fVersion);
368 dumpChannelId (fOutput,chId);
369 dumpQIEData (fOutput, *item);
370 endDataset (fOutput);
374 dumpFooter (fOutput);
379 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
381 const std::string KIND =
"HCAL_CHANNEL_QUALITY_V1";
382 const std::string TABLE =
"HCAL Channel Quality [V1]";
384 dumpHeader (fOutput, fRun, TABLE, KIND);
387 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
388 for (std::vector<DetId>::iterator channel = channels.begin ();
389 channel != channels.end ();
391 DetId chId = *channel;
395 dumpDataset (fOutput, fVersion);
396 dumpChannelId (fOutput,chId);
397 dumpChannelQualityData (fOutput, *item);
398 endDataset (fOutput);
402 dumpFooter (fOutput);
407 unsigned fRun,
unsigned long fGMTIOVBegin,
unsigned long fGMTIOVEnd,
const std::string& fTag,
unsigned fVersion,
409 const std::string KIND =
"HCAL_L1_TRIGGER_OBJECTS_V1";
410 const std::string TABLE =
"HCAL L1 Trigger Objects [V1]";
412 dumpHeader (fOutput, fRun, TABLE, KIND);
415 dumpMapping (fOutput, fRun, KIND, fGMTIOVBegin, fGMTIOVEnd, fTag, fVersion, channels);
416 for (std::vector<DetId>::iterator channel = channels.begin ();
417 channel != channels.end ();
419 DetId chId = *channel;
423 dumpDataset (fOutput, fVersion);
424 dumpChannelId (fOutput,chId);
425 dumpL1TriggerData (fOutput, *item);
426 endDataset (fOutput);
430 dumpFooter (fOutput);
float getPedestal() const
float slope(unsigned fCapId, unsigned fRange) const
const HcalQIECoder * getCoder(DetId fId) const
get QIE parameters
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
const Item * getValues(DetId fId, bool throwOnFail=true) const
float getValue(int fCapId) const
get value for capId = 0..3
float getValue(int fCapId) const
get value for capId = 0..3
float getRespGain() const
float offset(unsigned fCapId, unsigned fRange) const
const bool exists(DetId fId) const
std::vector< DetId > getAllChannels() const
float getValue(int fCapId) const
get value for capId = 0..3
bool dumpObject(std::ostream &fOutput, unsigned fRun, unsigned long fGMTIOVBegin, unsigned long fGMTIOVEnd, const std::string &fTag, unsigned fVersion, const HcalPedestals &fObject, const HcalPedestalWidths &fObject2)
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
bool isBitSet(unsigned int bitnumber) const
uint32_t getValue() const