Belle II Software development
CDCDatabaseImporter Class Reference

CDC database importer. More...

#include <CDCDatabaseImporter.h>

Public Member Functions

 CDCDatabaseImporter ()
 Default constructor.
 
 CDCDatabaseImporter (int fexp, int frun, int lexp, int lrun)
 Constructor.
 
virtual ~CDCDatabaseImporter ()
 Destructor.
 
void importChannelMap (std::string fileName)
 Import channel map to the data base.
 
void printChannelMap ()
 Get the channel map from the database and print it.
 
void importFEElectronics (std::string fileName)
 Import FEE params.
 
void printFEElectronics ()
 Get FEE params.
 
void importEDepToADC (std::string fileName)
 Import edep-to-adc params.
 
void printEDepToADC ()
 Get edep-to-adc params.
 
void importCorrToThreshold (std::string fileName)
 Import corrtothreshold to the data base.
 
void printCorrToThreshold ()
 Get corrtothreshold from the database and print.
 
void importTimeZero (std::string fileName)
 Import t0 table to the data base.
 
void printTimeZero ()
 Get the t0 table from the database and print it.
 
void importADCDeltaPedestal (std::string fileName)
 Import ADC delta pedestal table to the data base specifying the text data.
 
void importADCDeltaPedestal ()
 Import ADC delta pedestal with all 0.
 
void printADCDeltaPedestal ()
 Get the ADC delta pedestal table from the database and print it.
 
void importBadWire (std::string fileName)
 Import badwire table to the data base.
 
void printBadWire ()
 Get the badwire table from the database and print it.
 
void importBadBoards (std::string fileName)
 Import badboards table to the data base.
 
void printBadBoards ()
 Get the badboard table from the database and print it.
 
void importPropSpeed (std::string fileName)
 Import propspeed table to the database.
 
void printPropSpeed ()
 Get the propspeed table from the database and print it.
 
void importTimeWalk (std::string fileName)
 Import time-walk coeff.
 
void printTimeWalk ()
 Get the time-walk coeff.
 
void importXT (std::string fileName)
 Import xt table to the database.
 
void printXT ()
 Get the xt table from the database and print it.
 
void importSigma (std::string fileName)
 Import sigma table to the database.
 
void printSigma ()
 Get the sigma table from the database and print it.
 
void importFFactor (std::string fileName)
 Import fudge factor table to the database.
 
void printFFactor ()
 Get the fudge factor table from the database and print it.
 
void importAlphaScaleFactors (std::string fileName)
 Import alpha scale factors table to the database.
 
void printAlphaScaleFactors ()
 Get the fudge factor table from the database and print it.
 
void importDisplacement (std::string fileName)
 Import displacement of wire position to the database.
 
void printDisplacement ()
 Get the displacement of wire position from the database and print it.
 
void importWirPosAlign (std::string fileName)
 Import wire alignment table to the database.
 
void printWirPosAlign ()
 Get the wire alignment table from the database and print it.
 
void importWirPosMisalign (std::string fileName)
 Import wire misalignment table to the database.
 
void printWirPosMisalign ()
 Get the wire misalignment table from the database and print it.
 
void importCDCWireHitRequirements (const std::string &jsonFileName) const
 Import CDCWireHits cut values to the database.
 
void printCDCWireHitRequirements () const
 Get CDCWireHits cut values from the database and print them.
 
void importCDCCrossTalkLibrary (const std::string &rootFileName) const
 Import crosstalk library prepared in rootFileName.
 
void printCDCCrossTalkLibrary () const
 Print the content of the crosstalk library.
 
void testCDCCrossTalkLibrary (bool spotChecks=false) const
 Do some basic testing of the CDCCrossTalkLibrary.
 
void importCDClayerTimeCut (const std::string &jsonFileName) const
 import CDClayerTimeCut
 
void printCDClayerTimeCut () const
 Print content of CDClayerTimeCut.
 

Private Attributes

int m_firstExperiment
 CDC geometory parameter.
 
int m_firstRun
 First run.
 
int m_lastExperiment
 Last experiment.
 
int m_lastRun
 Last run.
 
ushort m_firstLayerOffset = 0
 Offset of first layer in case some CDC layers are removed.
 
ushort m_superLayerOffset = 0
 Offset of first super layer in case some CDC super layers are removed.
 
ushort m_nSenseWires = 14336
 Number of sense wires in the CDC.
 

Detailed Description

CDC database importer.

Definition at line 22 of file CDCDatabaseImporter.h.

Constructor & Destructor Documentation

◆ CDCDatabaseImporter() [1/2]

CDCDatabaseImporter ( )
inline

Default constructor.

Definition at line 29 of file CDCDatabaseImporter.h.

29 :
30 m_firstExperiment(0), m_firstRun(0),
31 m_lastExperiment(-1), m_lastRun(-1)
32 {
33 }

◆ CDCDatabaseImporter() [2/2]

CDCDatabaseImporter ( int fexp,
int frun,
int lexp,
int lrun )

Constructor.

Definition at line 63 of file CDCDatabaseImporter.cc.

63 :
64 m_firstExperiment(fexp), m_firstRun(frun), m_lastExperiment(lexp), m_lastRun(lrun)
65{
67 m_firstLayerOffset = cdcgp.getOffsetOfFirstLayer();
68 m_superLayerOffset = cdcgp.getOffsetOfFirstSuperLayer();
69 m_nSenseWires = cdcgp.getNumberOfSenseWires();
70}
The Class for CDC Geometry Parameters.
ushort getOffsetOfFirstLayer() const
Get the offset of the first layer.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
ushort getOffsetOfFirstSuperLayer() const
Get the offset of the first super layer.
ushort getNumberOfSenseWires() const
Get the number of sense wires.

◆ ~CDCDatabaseImporter()

virtual ~CDCDatabaseImporter ( )
inlinevirtual

Destructor.

Definition at line 44 of file CDCDatabaseImporter.h.

45 {}

Member Function Documentation

◆ importADCDeltaPedestal() [1/2]

void importADCDeltaPedestal ( )

Import ADC delta pedestal with all 0.

Definition at line 1071 of file CDCDatabaseImporter.cc.

1072{
1073
1075 dbPed.construct();
1076
1077 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
1078 m_lastExperiment, m_lastRun);
1079 dbPed.import(iov);
1080
1081 B2INFO("ADC delta pedestal w/ zero imported to database.");
1082}
bool import(const IntervalOfValidity &iov)
Import the object to database.
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
A class that describes the interval of experiments/runs for which an object in the database is valid.

◆ importADCDeltaPedestal() [2/2]

void importADCDeltaPedestal ( std::string fileName)

Import ADC delta pedestal table to the data base specifying the text data.

Definition at line 1025 of file CDCDatabaseImporter.cc.

1026{
1027 std::ifstream stream;
1028 stream.open(fileName.c_str());
1029 if (!stream.is_open()) {
1030 B2ERROR("openFile: " << fileName << " *** failed to open");
1031 return;
1032 }
1033 B2INFO(fileName << ": open for reading");
1034
1036 dbPed.construct();
1037
1038 int iB(0);
1039 int iC(0);
1040 float ped(0);
1041 int nRead(0);
1042 int sample(0);
1043
1044 while (true) {
1045 if (nRead == 0) {
1046 stream >> sample;
1047 } else {
1048 stream >> iB >> iC >> ped;
1049 }
1050 if (stream.eof()) break;
1051 if (nRead == 0) {
1052 if (sample == 0) {
1053 B2FATAL("sample window is zero !");
1054 }
1055 dbPed->setSamplingWindow(sample);
1056 } else {
1057 dbPed->setPedestal(iB, iC, ped);
1058 }
1059 ++nRead;
1060
1061 }
1062 stream.close();
1063
1064 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
1065 m_lastExperiment, m_lastRun);
1066 dbPed.import(iov);
1067
1068 B2INFO("ADC delta pedestal table imported to database.");
1069}

◆ importAlphaScaleFactors()

void importAlphaScaleFactors ( std::string fileName)

Import alpha scale factors table to the database.

Definition at line 735 of file CDCDatabaseImporter.cc.

736{
737 std::ifstream stream;
738 stream.open(fileName.c_str());
739 if (!stream) {
740 B2FATAL("openFile: " << fileName << " *** failed to open");
741 return;
742 }
743 B2INFO(fileName << ": open for reading");
744
746 asf.construct();
747
748 std::array<std::array<float, CDCAlphaScaleFactorForAsymmetry::c_nAlphaBins>, CDCAlphaScaleFactorForAsymmetry::c_nLayers>
749 alphaRatios;
750
751 std::string line;
752 unsigned short iLayer = 0;
753 while (std::getline(stream, line)) {
754 std::stringstream ss(line);
755 std::string value;
757 B2FATAL("The number of layers " << iLayer + 1 << " is more than expected " <<
759
760 int iElement = 0;
761 while (std::getline(ss, value, ',')) {
763 B2FATAL("The number of alpha scale factors is " << iElement + 1 << " for layer " << iLayer << ", not equal " <<
765 alphaRatios[iLayer][iElement] = std::stof(value);
766 iElement++;
767 }
768 iLayer++;
769 }
770 asf->setScaleFactors(alphaRatios);
771
772 stream.close();
773
774 if (iLayer != CDCAlphaScaleFactorForAsymmetry::c_nLayers) B2FATAL("#lines read-in (=" << iLayer << ") is not equal #cdclayers (=" <<
776
777 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
778 m_lastExperiment, m_lastRun);
779 asf.import(iov);
780 B2INFO("Alpha scale factor table imported to database.");
781}

◆ importBadBoards()

void importBadBoards ( std::string fileName)

Import badboards table to the data base.

Definition at line 292 of file CDCDatabaseImporter.cc.

293{
294 std::ifstream stream;
295 stream.open(fileName.c_str());
296 if (!stream) {
297 B2FATAL("openFile: " << fileName << " *** failed to open");
298 return;
299 }
300 B2INFO(fileName << ": open for reading");
301
303 bb.construct();
304
305 uint iB(0);
306 double effi(0.);
307
308 while (true) {
309 stream >> iB >> effi;
310 if (stream.eof()) break;
311 bb->setBoard(iB, effi);
312 }
313 stream.close();
314
315 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
316 m_lastExperiment, m_lastRun);
317 bb.import(iov);
318 B2INFO("BadBoard table imported to database.");
319}

◆ importBadWire()

void importBadWire ( std::string fileName)

Import badwire table to the data base.

Definition at line 251 of file CDCDatabaseImporter.cc.

252{
253 std::ifstream stream;
254 stream.open(fileName.c_str());
255 if (!stream) {
256 B2FATAL("openFile: " << fileName << " *** failed to open");
257 return;
258 }
259 B2INFO(fileName << ": open for reading");
260
262 bw.construct();
263
264 uint iL(0), iC(0), nRead(0);
265 double effi(0.);
266
267 while (true) {
268 stream >> iL >> iC >> effi;
269 if (stream.eof()) break;
270
271 if (iL < m_firstLayerOffset) {
272 continue;
273 }
274
275 ++nRead;
276 bw->setWire(WireID(iL, iC), effi);
277 // if (m_debug) {
278 // std::cout << iL << " " << iC << " " << effi << std::endl;
279 // }
280 }
281 stream.close();
282
283 if (nRead > static_cast<int>(m_nSenseWires)) B2FATAL("#lines read-in (=" << nRead << ") is larger than #sense wires (=" <<
284 m_nSenseWires << ") !");
285
286 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
287 m_lastExperiment, m_lastRun);
288 bw.import(iov);
289 B2INFO("BadWire table imported to database.");
290}

◆ importCDCCrossTalkLibrary()

void importCDCCrossTalkLibrary ( const std::string & rootFileName) const

Import crosstalk library prepared in rootFileName.

Definition at line 1128 of file CDCDatabaseImporter.cc.

1129{
1130 DBImportObjPtr<CDCCrossTalkLibrary> dbCDCCrossTalkLibrary;
1131 dbCDCCrossTalkLibrary.construct();
1132
1133 TFile fIn = TFile(rootFileName.c_str());
1134 TTreeReader reader("my_ttree", &fIn);
1135 TTreeReaderValue<UChar_t> Board(reader, "Board");
1136 TTreeReaderValue<UChar_t> Channel(reader, "Channel");
1137 TTreeReaderValue<Short_t> Asic_ADC0(reader, "Asic_ADC0");
1138 TTreeReaderValue<Short_t> Asic_TDC0(reader, "Asic_TDC0");
1139 TTreeReaderValue<Short_t> Asic_TOT0(reader, "Asic_TOT0");
1140 TTreeReaderValue<Short_t> Asic_ADC1(reader, "Asic_ADC1");
1141 TTreeReaderValue<Short_t> Asic_TDC1(reader, "Asic_TDC1");
1142 TTreeReaderValue<Short_t> Asic_TOT1(reader, "Asic_TOT1");
1143 TTreeReaderValue<Short_t> Asic_ADC2(reader, "Asic_ADC2");
1144 TTreeReaderValue<Short_t> Asic_TDC2(reader, "Asic_TDC2");
1145 TTreeReaderValue<Short_t> Asic_TOT2(reader, "Asic_TOT2");
1146 TTreeReaderValue<Short_t> Asic_ADC3(reader, "Asic_ADC3");
1147 TTreeReaderValue<Short_t> Asic_TDC3(reader, "Asic_TDC3");
1148 TTreeReaderValue<Short_t> Asic_TOT3(reader, "Asic_TOT3");
1149 TTreeReaderValue<Short_t> Asic_ADC4(reader, "Asic_ADC4");
1150 TTreeReaderValue<Short_t> Asic_TDC4(reader, "Asic_TDC4");
1151 TTreeReaderValue<Short_t> Asic_TOT4(reader, "Asic_TOT4");
1152 TTreeReaderValue<Short_t> Asic_ADC5(reader, "Asic_ADC5");
1153 TTreeReaderValue<Short_t> Asic_TDC5(reader, "Asic_TDC5");
1154 TTreeReaderValue<Short_t> Asic_TOT5(reader, "Asic_TOT5");
1155 TTreeReaderValue<Short_t> Asic_ADC6(reader, "Asic_ADC6");
1156 TTreeReaderValue<Short_t> Asic_TDC6(reader, "Asic_TDC6");
1157 TTreeReaderValue<Short_t> Asic_TOT6(reader, "Asic_TOT6");
1158 TTreeReaderValue<Short_t> Asic_ADC7(reader, "Asic_ADC7");
1159 TTreeReaderValue<Short_t> Asic_TDC7(reader, "Asic_TDC7");
1160 TTreeReaderValue<Short_t> Asic_TOT7(reader, "Asic_TOT7");
1161
1162 while (reader.Next()) {
1163 asicChannels record{
1164 asicChannel{*Asic_TDC0, *Asic_ADC0, *Asic_TOT0},
1165 asicChannel{*Asic_TDC1, *Asic_ADC1, *Asic_TOT1},
1166 asicChannel{*Asic_TDC2, *Asic_ADC2, *Asic_TOT2},
1167 asicChannel{*Asic_TDC3, *Asic_ADC3, *Asic_TOT3},
1168 asicChannel{*Asic_TDC4, *Asic_ADC4, *Asic_TOT4},
1169 asicChannel{*Asic_TDC5, *Asic_ADC5, *Asic_TOT5},
1170 asicChannel{*Asic_TDC6, *Asic_ADC6, *Asic_TOT6},
1171 asicChannel{*Asic_TDC7, *Asic_ADC7, *Asic_TOT7}
1172 };
1173 // Determine ADC of the signal
1174 UChar_t asicCh = *Channel % 8;
1175 Short_t ADC = record[asicCh].ADC;
1176 dbCDCCrossTalkLibrary->addAsicRecord(asicCh, ADC, record);
1177 }
1178
1179 // Now also get the x-talk probability
1180 double probs[8196];
1181 TH1F* prob;
1182 fIn.GetObject("ProbXTalk", prob);
1183 for (size_t a = 1; a <= 8196; a += 1) {
1184 probs[a - 1] = prob->GetBinContent(a);
1185 }
1186 fIn.Close();
1187 dbCDCCrossTalkLibrary->setPCrossTalk(probs);
1188
1189 dbCDCCrossTalkLibrary->dump(0);
1190 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
1191 m_lastExperiment, m_lastRun);
1192 dbCDCCrossTalkLibrary.import(iov);
1193 B2INFO("CDCCrossTalkLibrary requirements imported to database.");
1194}
array< asicChannel, 8 > asicChannels
fixed sized array of ASIC channels
record to be used to store ASIC info

◆ importCDClayerTimeCut()

void importCDClayerTimeCut ( const std::string & jsonFileName) const

import CDClayerTimeCut

Definition at line 1251 of file CDCDatabaseImporter.cc.

1252{
1253 // Create a property tree
1254 boost::property_tree::ptree tree;
1255 try {
1256 // Load the json file in this property tree.
1257 B2INFO("Loading json file: " << jsonFileName);
1258 boost::property_tree::read_json(jsonFileName, tree);
1259 } catch (boost::property_tree::ptree_error& e) {
1260 B2FATAL("Error when loading json file: " << e.what());
1261 }
1262
1263 DBImportObjPtr<CDClayerTimeCut> dbCDClayerTimeCut;
1264 dbCDClayerTimeCut.construct(tree);
1265
1266 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
1267 m_lastExperiment, m_lastRun);
1268 dbCDClayerTimeCut.import(iov);
1269 B2INFO("dbCDClayerTimeCut imported to database.");
1270}

◆ importCDCWireHitRequirements()

void importCDCWireHitRequirements ( const std::string & jsonFileName) const

Import CDCWireHits cut values to the database.

The cut values are read from a json file. An example of legal json file can be found at cdc/data/CDCWireHitRequirements_example.json In the json file, upper values of -1 stand for unbounded.

Definition at line 1091 of file CDCDatabaseImporter.cc.

1092{
1093
1094 // Create a property tree
1095 boost::property_tree::ptree tree;
1096
1097 try {
1098
1099 // Load the json file in this property tree.
1100 B2INFO("Loading json file: " << jsonFileName);
1101 boost::property_tree::read_json(jsonFileName, tree);
1102
1103 } catch (boost::property_tree::ptree_error& e) {
1104 B2FATAL("Error when loading json file: " << e.what());
1105 }
1106
1107 DBImportObjPtr<CDCWireHitRequirements> dbWireHitReq;
1108 dbWireHitReq.construct(tree);
1109
1110 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
1111 m_lastExperiment, m_lastRun);
1112 dbWireHitReq.import(iov);
1113
1114 B2INFO("CDCWireHit requirements imported to database.");
1115}

◆ importChannelMap()

void importChannelMap ( std::string fileName)

Import channel map to the data base.

Definition at line 119 of file CDCDatabaseImporter.cc.

120{
121 std::ifstream stream;
122 stream.open(fileName.c_str());
123 if (!stream) {
124 B2ERROR("openFile: " << fileName << " *** failed to open");
125 return;
126 }
127 B2INFO(fileName << ": open for reading");
128
130
131 uint isl;
132 uint il;
133 uint iw;
134 uint iBoard;
135 uint iCh;
136
137 while (!stream.eof()) {
138 stream >> isl >> il >> iw >> iBoard >> iCh;
139
140 if (il < m_firstLayerOffset) {
141 continue;
142 }
143
144 cm.appendNew(isl, il, iw, iBoard, iCh);
145 }
146 stream.close();
147
148 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
149 m_lastExperiment, m_lastRun);
150
151 cm.import(iov);
152
153 B2INFO("Channel map imported to database.");
154
155}
Class for importing array of objects to the database.
T * appendNew()
Construct a new T object at the end of the array.

◆ importCorrToThreshold()

void importCorrToThreshold ( std::string fileName)

Import corrtothreshold to the data base.

Definition at line 366 of file CDCDatabaseImporter.cc.

367{
368 std::ifstream stream;
369 stream.open(fileName.c_str());
370 if (!stream) {
371 B2FATAL("openFile: " << fileName << " *** failed to open");
372 return;
373 }
374 B2INFO(fileName << ": open for reading");
375
377 cr.construct();
378
379 uint iCL(0), nRead(0);
380 double param(1.);
381
382 while (true) {
383 stream >> iCL >> param;
384 if (stream.eof()) break;
385
386 if (iCL < m_firstLayerOffset) {
387 continue;
388 }
389
390 ++nRead;
391 cr->setParam(iCL, param);
392 }
393 stream.close();
394
395 if (nRead != c_maxNSenseLayers) B2FATAL("#lines read-in (=" << nRead << ") is not equal to #sense layers (=" << c_maxNSenseLayers <<
396 ") !");
397
398 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
399 m_lastExperiment, m_lastRun);
400 cr.import(iov);
401 B2INFO("CorrToThreshold table imported to database.");
402}

◆ importDisplacement()

void importDisplacement ( std::string fileName)

Import displacement of wire position to the database.

Definition at line 784 of file CDCDatabaseImporter.cc.

785{
786 //read alpha bins
787 // std::ifstream ifs;
788 // ifs.open(fileName.c_str());
789 boost::iostreams::filtering_istream ifs;
790 if ((fileName.rfind(".gz") != string::npos) && (fileName.length() - fileName.rfind(".gz") == 3)) {
791 ifs.push(boost::iostreams::gzip_decompressor());
792 }
793 ifs.push(boost::iostreams::file_source(fileName));
794 if (!ifs) {
795 B2FATAL("openFile: " << fileName << " *** failed to open");
796 }
797 B2INFO(fileName << ": open for reading");
798
799 DBImportArray<CDCDisplacement> disp;
800
801 uint iL(0), iC(0);
802 const int np = 3;
803 double back[np], fwrd[np];
804 double tension = 0.;
805 unsigned nRead = 0;
806
807 while (true) {
808 ifs >> iL >> iC;
809 for (int i = 0; i < np; ++i) {
810 ifs >> back[i];
811 }
812 for (int i = 0; i < np; ++i) {
813 ifs >> fwrd[i];
814 }
815 ifs >> tension;
816
817 if (ifs.eof()) break;
818
819 if (iL < m_firstLayerOffset) {
820 continue;
821 }
822
823
824 ++nRead;
825 WireID wire(iL, iC);
826 ROOT::Math::XYZVector fwd(fwrd[0], fwrd[1], fwrd[2]);
827 ROOT::Math::XYZVector bwd(back[0], back[1], back[2]);
828 disp.appendNew(wire, fwd, bwd, tension);
829 }
830
831 if (nRead != m_nSenseWires) B2FATAL("CDCDatabaseimporter::importDisplacement: #lines read-in (=" << nRead <<
832 ") is inconsistent with total #sense wires (=" << m_nSenseWires << ") !");
833
834 // ifs.close();
835 boost::iostreams::close(ifs);
836
837 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
838 m_lastExperiment, m_lastRun);
839 disp.import(iov);
840 B2INFO("Wire displasement table imported to database.");
841}

◆ importEDepToADC()

void importEDepToADC ( std::string fileName)

Import edep-to-adc params.

to the data base.

Definition at line 193 of file CDCDatabaseImporter.cc.

194{
195 std::ifstream stream;
196 stream.open(fileName.c_str());
197 if (!stream) {
198 B2FATAL("openFile: " << fileName << " *** failed to open");
199 return;
200 }
201 B2INFO(fileName << ": open for reading");
202
204 etoa.construct();
205
206 unsigned short paramMode(0), nParams(0);
207 stream >> paramMode >> nParams;
208 etoa->setParamMode(paramMode);
209
210 unsigned short groupId(0);
211 stream >> groupId;
212 B2INFO(paramMode << " " << nParams << " " << groupId);
213 if (groupId > 1) B2FATAL("invalid groupId now !");
214 etoa->setGroupID(groupId);
215
216 unsigned short id = 0;
217 std::vector<float> coeffs(nParams);
218 uint nRead = 0;
219
220 while (stream >> id) {
221 for (unsigned short i = 0; i < nParams; ++i) {
222 stream >> coeffs[i];
223 }
224 // TODO: check these two if conditions
225 if (groupId == 0 and id < m_superLayerOffset) {
226 continue;
227 }
228 if (groupId == 1 and id < m_firstLayerOffset) {
229 continue;
230 }
231 ++nRead;
232 etoa->setParams(id, coeffs);
233 }
234 stream.close();
235
236 unsigned short nId = c_nSuperLayers;
237 if (groupId == 1) {
238 nId = c_maxNSenseLayers;
239 } else if (groupId == 2) {
240 nId = m_nSenseWires;
241 }
242 if (nRead != nId) B2FATAL("#lines read-in (=" << nRead << ") is not equal #ids (=" << nId << ") !");
243
244 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
245 m_lastExperiment, m_lastRun);
246 etoa.import(iov);
247 B2INFO("EDep-toADC table imported to database.");
248}

◆ importFEElectronics()

void importFEElectronics ( std::string fileName)

Import FEE params.

to the data base.

Definition at line 158 of file CDCDatabaseImporter.cc.

159{
160 std::ifstream stream;
161 stream.open(fileName.c_str());
162 if (!stream) {
163 B2ERROR("openFile: " << fileName << " *** failed to open");
164 return;
165 }
166 B2INFO(fileName << ": open for reading");
167
169
170 // short width, delay, aTh, tThmV, tTheV, l1late;
171 short ib, width, delay, aTh, tThmV;
172
173 // int i=-1;
174 while (stream >> ib) {
175 // stream >> delay >> aTh >> tThmV >> tTheV >> l1late;
176 stream >> width >> delay >> aTh >> tThmV;
177 // ++i;
178 // std::cout << i <<" "<< width << std::endl;
179 // cf.appendNew(width, delay, aTh, tThmV, tTheV, l1late);
180 cf.appendNew(ib, width, delay, aTh, tThmV);
181 }
182 stream.close();
183
184 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
185 m_lastExperiment, m_lastRun);
186
187 cf.import(iov);
188
189 B2INFO("FEEElectronics imported to database.");
190}

◆ importFFactor()

void importFFactor ( std::string fileName)

Import fudge factor table to the database.

Definition at line 694 of file CDCDatabaseImporter.cc.

695{
696 std::ifstream stream;
697 stream.open(fileName.c_str());
698 if (!stream) {
699 B2FATAL("openFile: " << fileName << " *** failed to open");
700 return;
701 }
702 B2INFO(fileName << ": open for reading");
703
705 etoa.construct();
706
707 unsigned short groupId(0), nParams(0);
708 stream >> groupId >> nParams;
709 B2INFO(groupId << " " << nParams);
710 if (groupId != 0) B2FATAL("invalid groupId now !");
711 etoa->setGroupID(groupId);
712
713 unsigned short id = 0;
714 std::vector<float> coeffs(nParams);
715 int nRead = 0;
716
717 while (stream >> id) {
718 for (unsigned short i = 0; i < nParams; ++i) {
719 stream >> coeffs[i];
720 }
721 ++nRead;
722 etoa->setFactors(id, coeffs);
723 }
724 stream.close();
725
726 unsigned short nId = 1;
727 if (nRead != nId) B2FATAL("#lines read-in (=" << nRead << ") is not equal #ids (=" << nId << ") !");
728
729 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
730 m_lastExperiment, m_lastRun);
731 etoa.import(iov);
732 B2INFO("Fudge factor table imported to database.");
733}

◆ importPropSpeed()

void importPropSpeed ( std::string fileName)

Import propspeed table to the database.

Definition at line 322 of file CDCDatabaseImporter.cc.

323{
324 std::ifstream stream;
325 stream.open(fileName.c_str());
326 if (!stream) {
327 B2FATAL("openFile: " << fileName << " *** failed to open");
328 return;
329 }
330 B2INFO(fileName << ": open for reading");
331
333 ps.construct();
334
335 uint iCL(0), nRead(0);
336 double speed(0.);
337
338 while (true) {
339 stream >> iCL >> speed;
340 if (stream.eof()) break;
341
342 if (iCL < m_firstLayerOffset) {
343 continue;
344 }
345
346 ++nRead;
347 // ps->setSpeed(speed);
348 ps->setSpeed(iCL, speed);
349 // ps->setSpeed(iCL, speed);
350 // if (m_debug) {
351 // std::cout << iCL << " " << value << std::endl;
352 // }
353 }
354 stream.close();
355
356 if (nRead != c_maxNSenseLayers) B2FATAL("#lines read-in (=" << nRead << ") is no equal #sense layers (=" << c_maxNSenseLayers <<
357 ") !");
358
359 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
360 m_lastExperiment, m_lastRun);
361 ps.import(iov);
362 B2INFO("PropSpeed table imported to database.");
363}

◆ importSigma()

void importSigma ( std::string fileName)

Import sigma table to the database.

Definition at line 575 of file CDCDatabaseImporter.cc.

576{
578 sg.construct();
579
580 //read alpha bins
581 std::ifstream ifs;
582 ifs.open(fileName.c_str());
583 if (!ifs) {
584 B2FATAL("openFile: " << fileName << " *** failed to open");
585 }
586 B2INFO(fileName << ": open for reading");
587
588 const double degrad = M_PI / 180.;
589 const double raddeg = 180. / M_PI;
590
591 unsigned short nAlphaBins = 0;
592 if (ifs >> nAlphaBins) {
593 if (nAlphaBins == 0 || nAlphaBins > c_maxNAlphaPoints) B2FATAL("Fail to read alpha bins !");
594 } else {
595 B2FATAL("Fail to read alpha bins !");
596 }
597 std::array<float, 3> alpha3;
598 for (unsigned short i = 0; i < nAlphaBins; ++i) {
599 for (unsigned short j = 0; j < 3; ++j) {
600 ifs >> alpha3[j];
601 alpha3[j] *= degrad;
602 }
603 sg->setAlphaBin(alpha3);
604 }
605
606 //read theta bins
607 unsigned short nThetaBins = 0;
608 if (ifs >> nThetaBins) {
609 if (nThetaBins == 0 || nThetaBins > c_maxNThetaPoints) B2FATAL("Fail to read theta bins !");
610 } else {
611 B2FATAL("Fail to read theta bins !");
612 }
613 std::array<float, 3> theta3;
614
615 for (unsigned short i = 0; i < nThetaBins; ++i) {
616 for (unsigned short j = 0; j < 3; ++j) {
617 ifs >> theta3[j];
618 theta3[j] *= degrad;
619 }
620 sg->setThetaBin(theta3);
621 }
622
623
624 //read sigma params.
625 short sgParamMode, np;
626 unsigned short iCL, iLR;
627 const unsigned short npx = c_nSigmaParams;
628 double sgm[npx];
629 double theta, alpha;
630 // unsigned nRead = 0;
631
632 ifs >> sgParamMode >> np;
633 if (sgParamMode < 0 || sgParamMode > 1) B2FATAL("Invalid sigma param mode read !");
634 if (np <= 0 || np > npx) B2FATAL("No. of sgm-params. outside limits !");
635
636 sg->setSigmaParamMode(sgParamMode);
637
638 float maxSigma;
639 ifs >> maxSigma;
640 sg->setMaxSpaceResol(maxSigma);
641
642 const double epsi = 0.1;
643
644 while (ifs >> iCL) {
645 ifs >> theta >> alpha >> iLR;
646 for (int i = 0; i < np; ++i) {
647 ifs >> sgm[i];
648 }
649
650 // TODO: check whether this is correct, as nRead isn't used, it might also be possible to only
651 // perform sg->setSigmaParams() below if the condition is met
652 if (iCL < m_firstLayerOffset) {
653 continue;
654 }
655
656 // ++nRead;
657
658 int ialpha = -99;
659 for (unsigned short i = 0; i < nAlphaBins; ++i) {
660 if (fabs(alpha - sg->getAlphaBin(i)[2]*raddeg) < epsi) {
661 ialpha = i;
662 break;
663 }
664 }
665 if (ialpha < 0) B2FATAL("alphas in sigma.dat are inconsistent !");
666
667 int itheta = -99;
668 for (unsigned short i = 0; i < nThetaBins; ++i) {
669 if (fabs(theta - sg->getThetaBin(i)[2]*raddeg) < epsi) {
670 itheta = i;
671 break;
672 }
673 }
674 if (itheta < 0) B2FATAL("thetas in sigma.dat are inconsistent !");
675
676 // std::vector<float> sgbuff = std::vector<float>(np);
677 std::vector<float> sgbuff;
678 for (int i = 0; i < np; ++i) {
679 sgbuff.push_back(sgm[i]);
680 }
681 // std::cout <<"iCL,iLR,ialpha,itheta= " << iCL <<" "<< iLR <<" "<< ialpha <<" "<< itheta << std::endl;
682 sg->setSigmaParams(iCL, iLR, ialpha, itheta, sgbuff);
683 }
684
685 ifs.close();
686
687 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
688 m_lastExperiment, m_lastRun);
689 sg.import(iov);
690 B2INFO("Sigma table imported to database.");
691}

◆ importTimeWalk()

void importTimeWalk ( std::string fileName)

Import time-walk coeff.

table to the database.

Definition at line 405 of file CDCDatabaseImporter.cc.

406{
407 std::ifstream stream;
408 stream.open(fileName.c_str());
409 if (!stream) {
410 B2FATAL("openFile: " << fileName << " *** failed to open");
411 return;
412 }
413 B2INFO(fileName << ": open for reading");
414
416 tw.construct();
417
418 unsigned short mode(0), nParams(0);
419 stream >> mode >> nParams;
420 tw->setTwParamMode(mode);
421
422 unsigned short iBoard(0);
423 std::vector<float> coeffs(nParams);
424 int nRead(0);
425
426 while (stream >> iBoard) {
427 for (unsigned short i = 0; i < nParams; ++i) {
428 stream >> coeffs[i];
429 }
430 ++nRead;
431 tw->setTimeWalkParams(iBoard, coeffs);
432 // if (m_debug) {
433 // std::cout << iBoard << " " << coeff << std::endl;
434 // }
435 }
436 stream.close();
437
438 if (nRead != c_nBoards) B2FATAL("#lines read-in (=" << nRead << ") is not equal #boards (=" << c_nBoards << ") !");
439
440 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
441 m_lastExperiment, m_lastRun);
442 tw.import(iov);
443 B2INFO("Time-walk coeff. table imported to database.");
444}

◆ importTimeZero()

void importTimeZero ( std::string fileName)

Import t0 table to the data base.

Definition at line 72 of file CDCDatabaseImporter.cc.

73{
74 std::ifstream stream;
75 stream.open(fileName.c_str());
76 if (!stream) {
77 B2ERROR("openFile: " << fileName << " *** failed to open");
78 return;
79 }
80 B2INFO(fileName << ": open for reading");
81
83 tz.construct();
84
85 uint iL(0);
86 int iC(0);
87 double t0(0.);
88 int nRead(0);
89
90 while (true) {
91 stream >> iL >> iC >> t0;
92
93 if (iL < m_firstLayerOffset) {
94 continue;
95 }
96
97 if (stream.eof()) break;
98 ++nRead;
99 WireID wire(iL, iC);
100 tz->setT0(wire, t0);
101 // if (m_debug) {
102 // std::cout << iL << " " << iC << " " << t0 << std::endl;
103 // }
104 }
105 stream.close();
106
107 if (nRead != m_nSenseWires) B2FATAL("#lines read-in (=" << nRead << ") is inconsistent with total #sense wires (=" << m_nSenseWires
108 << ") !");
109
110 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
111 m_lastExperiment, m_lastRun);
112 tz.import(iov);
113
114 B2INFO("Time zero table imported to database.");
115
116}

◆ importWirPosAlign()

void importWirPosAlign ( std::string fileName)

Import wire alignment table to the database.

Definition at line 844 of file CDCDatabaseImporter.cc.

845{
846 // std::ifstream ifs;
847 // ifs.open(fileName.c_str());
848 boost::iostreams::filtering_istream ifs;
849 if ((fileName.rfind(".gz") != string::npos) && (fileName.length() - fileName.rfind(".gz") == 3)) {
850 ifs.push(boost::iostreams::gzip_decompressor());
851 }
852 ifs.push(boost::iostreams::file_source(fileName));
853 if (!ifs) {
854 B2FATAL("openFile: " << fileName << " *** failed to open");
855 return;
856 }
857 B2INFO(fileName << ": open for reading");
858
859 DBImportObjPtr<CDCAlignment> al;
860 al.construct();
861
862 uint iL(0), iC(0);
863 const int np = 3;
864 double back[np], fwrd[np], tension;
865 unsigned nRead = 0;
866
867 while (true) {
868 ifs >> iL >> iC;
869 for (int i = 0; i < np; ++i) {
870 ifs >> back[i];
871 }
872 for (int i = 0; i < np; ++i) {
873 ifs >> fwrd[i];
874 }
875 ifs >> tension;
876 if (ifs.eof()) break;
877
878 if (iL < m_firstLayerOffset) {
879 continue;
880 }
881
882 ++nRead;
883 WireID wire(iL, iC);
884
885 for (int i = 0; i < np; ++i) {
886 al->set(wire, CDCAlignment::wireBwdX, back[0]);
887 al->set(wire, CDCAlignment::wireBwdY, back[1]);
888 al->set(wire, CDCAlignment::wireBwdZ, back[2]);
889 al->set(wire, CDCAlignment::wireFwdX, fwrd[0]);
890 al->set(wire, CDCAlignment::wireFwdY, fwrd[1]);
891 al->set(wire, CDCAlignment::wireFwdZ, fwrd[2]);
892 }
893 al->set(wire, CDCAlignment::wireTension, tension);
894 }
895
896 if (nRead != m_nSenseWires) B2FATAL("CDCDatabaseimporter::importWirPosAlign: #lines read-in (=" << nRead <<
897 ") is inconsistent with total #sense wires (=" << m_nSenseWires << ") !");
898
899 // ifs.close();
900 boost::iostreams::close(ifs);
901
902 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
903 m_lastExperiment, m_lastRun);
904 al.import(iov);
905 B2INFO("Wire alignment table imported to database.");
906}
static const baseType wireBwdZ
Wire Z position w.r.t. nominal on backward endplate.
static const baseType wireBwdY
Wire Y position w.r.t. nominal on backward endplate.
static const baseType wireFwdZ
Wire Z position w.r.t. nominal on forward endplate.
static const baseType wireFwdY
Wire Y position w.r.t. nominal on forward endplate.
static const baseType wireFwdX
Wire X position w.r.t. nominal on forward endplate.
static const baseType wireBwdX
Wire X position w.r.t. nominal on backward endplate.
static const baseType wireTension
Wire tension w.r.t. nominal (=50. ?)

◆ importXT()

void importXT ( std::string fileName)

Import xt table to the database.

Definition at line 447 of file CDCDatabaseImporter.cc.

448{
450 xt.construct();
451
452 //read alpha bins
453 // std::ifstream ifs;
454 // ifs.open(fileName.c_str());
455 boost::iostreams::filtering_istream ifs;
456 if ((fileName.rfind(".gz") != string::npos) && (fileName.length() - fileName.rfind(".gz") == 3)) {
457 ifs.push(boost::iostreams::gzip_decompressor());
458 }
459 ifs.push(boost::iostreams::file_source(fileName));
460 if (!ifs) {
461 B2FATAL("openFile: " << fileName << " *** failed to open");
462 }
463 B2INFO(fileName << ": open for reading");
464
465 const double degrad = M_PI / 180.;
466 const double raddeg = 180. / M_PI;
467
468 unsigned short nAlphaBins = 0;
469 if (ifs >> nAlphaBins) {
470 if (nAlphaBins == 0 || nAlphaBins > c_maxNAlphaPoints) B2FATAL("Fail to read alpha bins !");
471 } else {
472 B2FATAL("Fail to read alpha bins !");
473 }
474 std::array<float, 3> alpha3;
475 for (unsigned short i = 0; i < nAlphaBins; ++i) {
476 for (unsigned short j = 0; j < 3; ++j) {
477 ifs >> alpha3[j];
478 alpha3[j] *= degrad;
479 }
480 xt->setAlphaBin(alpha3);
481 }
482
483 //read theta bins
484 unsigned short nThetaBins = 0;
485 if (ifs >> nThetaBins) {
486 if (nThetaBins == 0 || nThetaBins > c_maxNThetaPoints) B2FATAL("Fail to read theta bins !");
487 } else {
488 B2FATAL("Fail to read theta bins !");
489 }
490 std::array<float, 3> theta3;
491
492 for (unsigned short i = 0; i < nThetaBins; ++i) {
493 for (unsigned short j = 0; j < 3; ++j) {
494 ifs >> theta3[j];
495 theta3[j] *= degrad;
496 }
497 xt->setThetaBin(theta3);
498 }
499
500
501 //read xt params.
502 /* std::ifstream ifs;
503 ifs.open(fileName.c_str());
504 if (!ifs) {
505 B2FATAL("openFile: " << fileName << " *** failed to open");
506 return;
507 }
508 B2INFO(fileName << ": open for reading");
509 */
510 short xtParamMode, np;
511 unsigned short iCL, iLR;
512 const unsigned short npx = c_nXTParams - 1;
513 double xtc[npx];
514 double theta, alpha, dummy1;
515 // unsigned nRead = 0;
516
517 ifs >> xtParamMode >> np;
518 if (xtParamMode < 0 || xtParamMode > 1) B2FATAL("Invalid xt param mode read !");
519 if (np <= 0 || np > npx) B2FATAL("No. of xt-params. outside limits !");
520
521 xt->setXtParamMode(xtParamMode);
522
523 const double epsi = 0.1;
524
525 while (ifs >> iCL) {
526 ifs >> theta >> alpha >> dummy1 >> iLR;
527 for (int i = 0; i < np; ++i) {
528 ifs >> xtc[i];
529 }
530
531 // TODO: check whether this is correct, as nRead isn't used, it might also be possible to only
532 // perform xt->setXtParams() below if the condition is met
533 if (iCL < m_firstLayerOffset) {
534 continue;
535 }
536
537 // ++nRead;
538
539 int ialpha = -99;
540 for (unsigned short i = 0; i < nAlphaBins; ++i) {
541 if (fabs(alpha - xt->getAlphaBin(i)[2]*raddeg) < epsi) {
542 ialpha = i;
543 break;
544 }
545 }
546 if (ialpha < 0) B2FATAL("alphas in xt.dat are inconsistent !");
547
548 int itheta = -99;
549 for (unsigned short i = 0; i < nThetaBins; ++i) {
550 if (fabs(theta - xt->getThetaBin(i)[2]*raddeg) < epsi) {
551 itheta = i;
552 break;
553 }
554 }
555 if (itheta < 0) B2FATAL("thetas in xt.dat are inconsistent !");
556
557 // std::vector<float> xtbuff = std::vector<float>(np);
558 std::vector<float> xtbuff;
559 for (int i = 0; i < np; ++i) {
560 xtbuff.push_back(xtc[i]);
561 }
562 // std::cout <<"iCL,iLR,ialpha,itheta= " << iCL <<" "<< iLR <<" "<< ialpha <<" "<< itheta << std::endl;
563 xt->setXtParams(iCL, iLR, ialpha, itheta, xtbuff);
564 }
565
566 // ifs.close();
567 boost::iostreams::close(ifs);
568
569 IntervalOfValidity iov(m_firstExperiment, m_firstRun,
570 m_lastExperiment, m_lastRun);
571 xt.import(iov);
572 B2INFO("XT table imported to database.");
573}

◆ printADCDeltaPedestal()

void printADCDeltaPedestal ( )

Get the ADC delta pedestal table from the database and print it.

Definition at line 1084 of file CDCDatabaseImporter.cc.

1085{
1086
1088 dbPed->dump();
1089}
Class for accessing objects in the database.
Definition DBObjPtr.h:21

◆ printAlphaScaleFactors()

void printAlphaScaleFactors ( )

Get the fudge factor table from the database and print it.

Definition at line 996 of file CDCDatabaseImporter.cc.

997{
999 asf->dump();
1000}

◆ printBadBoards()

void printBadBoards ( )

Get the badboard table from the database and print it.

Definition at line 960 of file CDCDatabaseImporter.cc.

961{
963 bb->dump();
964}

◆ printBadWire()

void printBadWire ( )

Get the badwire table from the database and print it.

Definition at line 954 of file CDCDatabaseImporter.cc.

955{
957 bw->dump();
958}

◆ printCDCCrossTalkLibrary()

void printCDCCrossTalkLibrary ( ) const

Print the content of the crosstalk library.

Definition at line 1196 of file CDCDatabaseImporter.cc.

1197{
1198 DBObjPtr<CDCCrossTalkLibrary> dbCDCCrossTalkLib;
1199 if (dbCDCCrossTalkLib.isValid()) {
1200 dbCDCCrossTalkLib->dump(1);
1201 } else {
1202 B2ERROR("DBObjPtr<CDCCrossTalkLibrary> not valid for the current run.");
1203 }
1204}
bool isValid() const
Check whether a valid object was obtained from the database.

◆ printCDClayerTimeCut()

void printCDClayerTimeCut ( ) const

Print content of CDClayerTimeCut.

Definition at line 1272 of file CDCDatabaseImporter.cc.

1273{
1274 DBObjPtr<CDClayerTimeCut> dbCDClayerTimeCut;
1275 if (dbCDClayerTimeCut.isValid()) {
1276 dbCDClayerTimeCut->dump();
1277 } else {
1278 B2WARNING("DBObjPtr<CDClayerTimeCut> not valid for the current run.");
1279 }
1280
1281}

◆ printCDCWireHitRequirements()

void printCDCWireHitRequirements ( ) const

Get CDCWireHits cut values from the database and print them.

Definition at line 1117 of file CDCDatabaseImporter.cc.

1118{
1119
1121 if (dbWireHitReq.isValid()) {
1122 dbWireHitReq->dump();
1123 } else {
1124 B2WARNING("DBObjPtr<CDCWireHitRequirements> not valid for the current run.");
1125 }
1126}

◆ printChannelMap()

void printChannelMap ( )

Get the channel map from the database and print it.

Definition at line 909 of file CDCDatabaseImporter.cc.

910{
911
912 DBArray<CDCChannelMap> channelMaps;
913
914 for (const auto& cm : channelMaps) {
915 std::cout << cm.getISuperLayer() << " " << cm.getILayer()
916 << " " << cm.getIWire() << " "
917 << cm.getBoardID() << " " << cm.getBoardChannel() << std::endl;
918 }
919
920}
Class for accessing arrays of objects in the database.
Definition DBArray.h:26

◆ printDisplacement()

void printDisplacement ( )

Get the displacement of wire position from the database and print it.

Definition at line 1002 of file CDCDatabaseImporter.cc.

1003{
1004 DBArray<CDCDisplacement> displacements;
1005 for (const auto& disp : displacements) {
1006 B2INFO(disp.getICLayer() << " " << disp.getIWire() << " "
1007 << disp.getXBwd() << " " << disp.getYBwd() << " " << disp.getZBwd() << " "
1008 << disp.getXFwd() << " " << disp.getYFwd() << " " << disp.getZFwd() << " " << disp.getTension());
1009 }
1010}

◆ printEDepToADC()

void printEDepToADC ( )

Get edep-to-adc params.

from the database and print.

Definition at line 934 of file CDCDatabaseImporter.cc.

935{
937 etoa->dump();
938}

◆ printFEElectronics()

void printFEElectronics ( )

Get FEE params.

from the database and print.

Definition at line 922 of file CDCDatabaseImporter.cc.

923{
924 DBArray<CDCFEElectronics> fEElectronics;
925 for (const auto& cf : fEElectronics) {
926 std::cout << cf.getBoardID() << " " << cf.getWidthOfTimeWindow() << " " << cf.getTrgDelay() << " " << cf.getADCThresh() << " " <<
927 cf.getTDCThreshInMV() << std::endl;
928 }
929 // << cf.getTDCThreshInMV() << " "
930 // << cf.getTDCThreshInEV() << " "
931 // << cf.getL1TrgLatency() << std::endl;
932}

◆ printFFactor()

void printFFactor ( )

Get the fudge factor table from the database and print it.

Definition at line 990 of file CDCDatabaseImporter.cc.

991{
993 ff->dump();
994}

◆ printPropSpeed()

void printPropSpeed ( )

Get the propspeed table from the database and print it.

Definition at line 966 of file CDCDatabaseImporter.cc.

967{
969 ps->dump();
970}

◆ printSigma()

void printSigma ( )

Get the sigma table from the database and print it.

Definition at line 984 of file CDCDatabaseImporter.cc.

985{
987 sgm->dump();
988}

◆ printTimeWalk()

void printTimeWalk ( )

Get the time-walk coeff.

table from the database and print it.

Definition at line 972 of file CDCDatabaseImporter.cc.

973{
975 tw->dump();
976}

◆ printTimeZero()

void printTimeZero ( )

Get the t0 table from the database and print it.

Definition at line 940 of file CDCDatabaseImporter.cc.

941{
942
943 DBObjPtr<CDCTimeZeros> timeZeros;
944
945 /* for (const auto& tz : timeZeros) {
946 std::cout << tz.getICLayer() << " " << tz.getIWire() << " "
947 << tz.getT0() << std::endl;
948 }
949 */
950 timeZeros->dump();
951
952}

◆ printWirPosAlign()

void printWirPosAlign ( )

Get the wire alignment table from the database and print it.

Definition at line 1012 of file CDCDatabaseImporter.cc.

1013{
1015 al->dump();
1016}

◆ printWirPosMisalign()

void printWirPosMisalign ( )

Get the wire misalignment table from the database and print it.

Definition at line 1018 of file CDCDatabaseImporter.cc.

1019{
1021 mal->dump();
1022}

◆ printXT()

void printXT ( )

Get the xt table from the database and print it.

Definition at line 978 of file CDCDatabaseImporter.cc.

979{
981 xt->dump();
982}

◆ testCDCCrossTalkLibrary()

void testCDCCrossTalkLibrary ( bool spotChecks = false) const

Do some basic testing of the CDCCrossTalkLibrary.

Definition at line 1206 of file CDCDatabaseImporter.cc.

1207{
1208 DBObjPtr<CDCCrossTalkLibrary> dbCDCCrossTalkLib;
1209
1210 if (dbCDCCrossTalkLib.isValid()) {
1211
1212 if (! spotChecks) {
1213 B2INFO("Performing CDCCrossTalkLibrary checks");
1214 auto timer = new Utils::Timer("CDCCrossTalkLibrary checks took"); // use "new" to avoid cpp-check warning
1215 int counter = 0;
1216 int size = 0;
1217 for (Short_t ADC = 0; ADC < 8196; ADC += 1) {
1218 for (Short_t channel = 0; channel < 48; channel += 1) {
1219 for (size_t rep = 0; rep < 100; rep += 1) {
1220 auto xtalk = dbCDCCrossTalkLib->getLibraryCrossTalk(channel, 4999, ADC, 5, 0, false);
1221 counter += 1;
1222 size += xtalk.size();
1223 }
1224 }
1225 }
1226 B2INFO("CDCCrossTalkLibrary called " << counter << " times. Total number of cross talk hits " << size);
1227 delete timer;
1228 return;
1229 }
1230
1231
1232 Short_t ADC_spot_checks[5] = {2, 100, 500, 1000, 5000};
1233 for (auto ADC : ADC_spot_checks) {
1234 B2INFO("CHECK ADC=" << ADC);
1235
1236 size_t NRep = ADC < 50 ? 100 : 10;
1237 for (size_t rep = 0; rep < NRep; rep += 1) {
1238 auto xtalk = dbCDCCrossTalkLib->getLibraryCrossTalk(0, 4999, ADC, 5, 0, true);
1239 B2INFO("Size = " << xtalk.size());
1240 for (auto [channel, rec] : xtalk) {
1241 B2INFO("Channel:" << channel << " TDC,ADC,TOT:" << rec.TDC << "," << rec.ADC << "," << rec.TOT);
1242 }
1243 }
1244 }
1245 } else {
1246 B2ERROR("DBObjPtr<CDCCrossTalkLibrary> not valid for the current run.");
1247 }
1248}
Small helper class that prints its lifetime when destroyed.
Definition Utils.h:79

Member Data Documentation

◆ m_firstExperiment

int m_firstExperiment
private

CDC geometory parameter.

First experiment.

Definition at line 254 of file CDCDatabaseImporter.h.

◆ m_firstLayerOffset

ushort m_firstLayerOffset = 0
private

Offset of first layer in case some CDC layers are removed.

Definition at line 259 of file CDCDatabaseImporter.h.

◆ m_firstRun

int m_firstRun
private

First run.

Definition at line 255 of file CDCDatabaseImporter.h.

◆ m_lastExperiment

int m_lastExperiment
private

Last experiment.

Definition at line 256 of file CDCDatabaseImporter.h.

◆ m_lastRun

int m_lastRun
private

Last run.

Definition at line 257 of file CDCDatabaseImporter.h.

◆ m_nSenseWires

ushort m_nSenseWires = 14336
private

Number of sense wires in the CDC.

Definition at line 261 of file CDCDatabaseImporter.h.

◆ m_superLayerOffset

ushort m_superLayerOffset = 0
private

Offset of first super layer in case some CDC super layers are removed.

Definition at line 260 of file CDCDatabaseImporter.h.


The documentation for this class was generated from the following files: