12 #include <klm/eklm/calibration/EKLMChannelDataImporter.h>
15 #include <klm/dataobjects/eklm/EKLMElementNumbers.h>
16 #include <klm/dataobjects/KLMElementNumbers.h>
17 #include <klm/dbobjects/eklm/EKLMChannels.h>
18 #include <klm/dbobjects/KLMElectronicsMap.h>
19 #include <klm/eklm/geometry/GeometryData.h>
22 #include <framework/database/IntervalOfValidity.h>
23 #include <framework/database/DBImportObjPtr.h>
24 #include <framework/database/DBObjPtr.h>
25 #include <framework/logging/Logger.h>
42 int experimentHigh,
int runHigh)
55 int iSection, iLayer, iSector, iPlane, iStrip, strip;
56 for (iSection = 1; iSection <= geoDat->
getNSections(); iSection++) {
59 for (iSector = 1; iSector <= geoDat->
getNSectors(); iSector++) {
60 for (iPlane = 1; iPlane <= geoDat->
getNPlanes(); iPlane++) {
61 for (iStrip = 1; iStrip <= geoDat->
getNStrips(); iStrip++) {
63 iSection, iLayer, iSector, iPlane, iStrip);
64 m_Channels->setChannelData(strip, channelData);
73 int section,
int layer,
int sector,
int plane,
int strip,
78 stripGlobal = elementNumbers->
stripNumber(section, layer, sector, plane,
80 m_Channels->setChannelData(stripGlobal, channelData);
86 int copper, dataConcentrator, lane, daughterCard, channel, active;
88 int subdetector, section, layer, sector, plane, strip, stripGlobal;
90 const uint16_t* detectorChannel;
97 file =
new TFile(activeChannelsData,
"");
98 tree = (TTree*)file->Get(
"tree");
99 n = tree->GetEntries();
100 tree->SetBranchAddress(
"copper", &copper);
101 tree->SetBranchAddress(
"data_concentrator", &dataConcentrator);
102 tree->SetBranchAddress(
"lane", &lane);
103 tree->SetBranchAddress(
"daughter_card", &daughterCard);
104 tree->SetBranchAddress(
"channel", &channel);
105 tree->SetBranchAddress(
"active", &active);
106 for (i = 0; i < n; i++) {
109 electronicsChannel.
setSlot(dataConcentrator);
110 electronicsChannel.
setLane(lane);
113 detectorChannel = electronicsMap->getDetectorChannel(&electronicsChannel);
114 if (detectorChannel ==
nullptr) {
115 B2FATAL(
"Wrong DAQ channel in calibration data: copper = " << copper <<
116 ", data_concentrator = " << dataConcentrator <<
", lane = " <<
120 *detectorChannel, &subdetector, §ion, §or, &layer, &plane,
122 stripGlobal = elementNumbers->
stripNumber(section, layer, sector, plane,
126 if (channelData ==
nullptr)
127 B2FATAL(
"Channel data are not loaded. Use loadChannelData().");
136 int copper, dataConcentrator, lane, daughterCard, channel;
139 int subdetector, section, layer, sector, plane, strip, stripGlobal;
141 const uint16_t* detectorChannel;
148 file =
new TFile(highVoltageData,
"");
149 tree = (TTree*)file->Get(
"tree");
150 n = tree->GetEntries();
151 tree->SetBranchAddress(
"copper", &copper);
152 tree->SetBranchAddress(
"data_concentrator", &dataConcentrator);
153 tree->SetBranchAddress(
"lane", &lane);
154 tree->SetBranchAddress(
"daughter_card", &daughterCard);
155 tree->SetBranchAddress(
"channel", &channel);
156 tree->SetBranchAddress(
"voltage", &voltage);
157 for (i = 0; i < n; i++) {
160 electronicsChannel.
setSlot(dataConcentrator);
161 electronicsChannel.
setLane(lane);
164 detectorChannel = electronicsMap->getDetectorChannel(&electronicsChannel);
165 if (detectorChannel ==
nullptr) {
166 B2FATAL(
"Wrong DAQ channel in calibration data: copper = " << copper <<
167 ", data_concentrator = " << dataConcentrator <<
", lane = " <<
171 *detectorChannel, &subdetector, §ion, §or, &layer, &plane,
173 stripGlobal = elementNumbers->
stripNumber(section, layer, sector, plane,
177 if (channelData ==
nullptr)
178 B2FATAL(
"Channel data are not loaded. Use loadChannelData().");
188 int copper, dataConcentrator, lane, daughterCard, channel;
189 int lookbackTime, lookbackWindowWidth;
191 int subdetector, section, layer, sector, plane, strip, stripGlobal;
193 const uint16_t* detectorChannel;
200 file =
new TFile(lookbackWindowData,
"");
201 tree = (TTree*)file->Get(
"tree");
202 n = tree->GetEntries();
203 tree->SetBranchAddress(
"copper", &copper);
204 tree->SetBranchAddress(
"data_concentrator", &dataConcentrator);
205 tree->SetBranchAddress(
"lane", &lane);
206 tree->SetBranchAddress(
"daughter_card", &daughterCard);
207 tree->SetBranchAddress(
"channel", &channel);
208 tree->SetBranchAddress(
"lookback_time", &lookbackTime);
209 tree->SetBranchAddress(
"lookback_window_width", &lookbackWindowWidth);
210 for (i = 0; i < n; i++) {
213 electronicsChannel.
setSlot(dataConcentrator);
214 electronicsChannel.
setLane(lane);
217 detectorChannel = electronicsMap->getDetectorChannel(&electronicsChannel);
218 if (detectorChannel ==
nullptr) {
219 B2FATAL(
"Wrong DAQ channel in calibration data: copper = " << copper <<
220 ", data_concentrator = " << dataConcentrator <<
", lane = " <<
224 *detectorChannel, &subdetector, §ion, §or, &layer, &plane,
226 stripGlobal = elementNumbers->
stripNumber(section, layer, sector, plane,
230 if (channelData ==
nullptr)
231 B2FATAL(
"Channel data are not loaded. Use loadChannelData().");
242 int copper, dataConcentrator, lane, daughterCard, channel;
243 int active, pedestalMin, threshold, adjustmentVoltage;
245 int subdetector, section, layer, sector, plane, strip, stripGlobal;
247 const uint16_t* detectorChannel;
254 file =
new TFile(thresholdsData,
"");
255 tree = (TTree*)file->Get(
"tree");
256 n = tree->GetEntries();
257 tree->SetBranchAddress(
"copper", &copper);
258 tree->SetBranchAddress(
"data_concentrator", &dataConcentrator);
259 tree->SetBranchAddress(
"lane", &lane);
260 tree->SetBranchAddress(
"daughter_card", &daughterCard);
261 tree->SetBranchAddress(
"channel", &channel);
262 tree->SetBranchAddress(
"active", &active);
263 tree->SetBranchAddress(
"pedestal_min", &pedestalMin);
264 tree->SetBranchAddress(
"threshold", &threshold);
265 tree->SetBranchAddress(
"adjustment_voltage", &adjustmentVoltage);
266 for (i = 0; i < n; i++) {
269 electronicsChannel.
setSlot(dataConcentrator);
270 electronicsChannel.
setLane(lane);
273 detectorChannel = electronicsMap->getDetectorChannel(&electronicsChannel);
274 if (detectorChannel ==
nullptr) {
275 B2FATAL(
"Wrong DAQ channel in calibration data: copper = " << copper <<
276 ", data_concentrator = " << dataConcentrator <<
", lane = " <<
280 *detectorChannel, &subdetector, §ion, §or, &layer, &plane,
282 stripGlobal = elementNumbers->
stripNumber(section, layer, sector, plane,
286 if (channelData ==
nullptr)
287 B2FATAL(
"Channel data are not loaded. Use loadChannelData().");