12 #include <cdc/calibration/CDCDatabaseImporter.h>
15 #include <framework/database/DBArray.h>
16 #include <framework/database/DBObjPtr.h>
17 #include <framework/database/IntervalOfValidity.h>
18 #include <framework/database/DBImportArray.h>
19 #include <framework/database/DBImportObjPtr.h>
22 #include <framework/logging/Logger.h>
24 #include <framework/utilities/Utils.h>
27 #include <cdc/dataobjects/WireID.h>
28 #include <cdc/dbobjects/CDCChannelMap.h>
29 #include <cdc/dbobjects/CDCTimeZeros.h>
30 #include <cdc/dbobjects/CDCBadWires.h>
31 #include <cdc/dbobjects/CDCPropSpeeds.h>
32 #include <cdc/dbobjects/CDCTimeWalks.h>
33 #include <cdc/dbobjects/CDCXtRelations.h>
34 #include <cdc/dbobjects/CDCSpaceResols.h>
35 #include <cdc/dbobjects/CDCFudgeFactorsForSigma.h>
36 #include <cdc/dbobjects/CDCDisplacement.h>
37 #include <cdc/dbobjects/CDCAlignment.h>
38 #include <cdc/dbobjects/CDCADCDeltaPedestals.h>
39 #include <cdc/dbobjects/CDCFEElectronics.h>
40 #include <cdc/dbobjects/CDCEDepToADCConversions.h>
41 #include <cdc/dbobjects/CDCWireHitRequirements.h>
42 #include <cdc/dbobjects/CDCCrossTalkLibrary.h>
44 #include <cdc/geometry/CDCGeometryPar.h>
46 #include <TTreeReader.h>
51 #include <boost/iostreams/filtering_stream.hpp>
52 #include <boost/iostreams/device/file.hpp>
53 #include <boost/iostreams/filter/gzip.hpp>
55 #include <boost/property_tree/ptree.hpp>
56 #include <boost/property_tree/json_parser.hpp>
61 void CDCDatabaseImporter::importTimeZero(std::string fileName)
64 stream.open(fileName.c_str());
66 B2ERROR(
"openFile: " << fileName <<
" *** failed to open");
69 B2INFO(fileName <<
": open for reading");
80 stream >> iL >> iC >> t0;
81 if (stream.eof())
break;
91 if (nRead != nSenseWires) B2FATAL(
"#lines read-in (=" << nRead <<
") is inconsistent with total #sense wires (=" << nSenseWires <<
95 m_lastExperiment, m_lastRun);
98 B2RESULT(
"Time zero table imported to database.");
103 void CDCDatabaseImporter::importChannelMap(std::string fileName)
105 std::ifstream stream;
106 stream.open(fileName.c_str());
108 B2ERROR(
"openFile: " << fileName <<
" *** failed to open");
111 B2INFO(fileName <<
": open for reading");
121 while (!stream.eof()) {
122 stream >> isl >> il >> iw >> iBoard >> iCh;
128 m_lastExperiment, m_lastRun);
132 B2RESULT(
"Channel map imported to database.");
137 void CDCDatabaseImporter::importFEElectronics(std::string fileName)
139 std::ifstream stream;
140 stream.open(fileName.c_str());
142 B2ERROR(
"openFile: " << fileName <<
" *** failed to open");
145 B2INFO(fileName <<
": open for reading");
150 short ib, width, delay, aTh, tThmV;
153 while (stream >> ib) {
155 stream >> width >> delay >> aTh >> tThmV;
159 cf.
appendNew(ib, width, delay, aTh, tThmV);
164 m_lastExperiment, m_lastRun);
168 B2RESULT(
"FEEElectronics imported to database.");
172 void CDCDatabaseImporter::importEDepToADC(std::string fileName)
174 std::ifstream stream;
175 stream.open(fileName.c_str());
177 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
180 B2INFO(fileName <<
": open for reading");
185 unsigned short paramMode(0), nParams(0);
186 stream >> paramMode >> nParams;
189 unsigned short groupId(0);
191 B2INFO(paramMode <<
" " << nParams <<
" " << groupId);
192 if (groupId > 1) B2FATAL(
"invalid groupId now !");
195 unsigned short id = 0;
196 std::vector<float> coeffs(nParams);
199 while (stream >>
id) {
200 for (
unsigned short i = 0; i < nParams; ++i) {
208 unsigned short nId = 9;
211 }
else if (groupId == 2) {
214 if (nRead != nId) B2FATAL(
"#lines read-in (=" << nRead <<
") is not equal #ids (=" << nId <<
") !");
217 m_lastExperiment, m_lastRun);
219 B2RESULT(
"EDep-toADC table imported to database.");
223 void CDCDatabaseImporter::importBadWire(std::string fileName)
225 std::ifstream stream;
226 stream.open(fileName.c_str());
228 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
231 B2INFO(fileName <<
": open for reading");
236 int iL(0), iC(0), nRead(0);
240 stream >> iL >> iC >> effi;
241 if (stream.eof())
break;
250 if (nRead >
static_cast<int>(nSenseWires)) B2FATAL(
"#lines read-in (=" << nRead <<
") is larger than #sense wires (=" << nSenseWires
254 m_lastExperiment, m_lastRun);
256 B2RESULT(
"BadWire table imported to database.");
260 void CDCDatabaseImporter::importPropSpeed(std::string fileName)
262 std::ifstream stream;
263 stream.open(fileName.c_str());
265 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
268 B2INFO(fileName <<
": open for reading");
273 int iCL(0), nRead(0);
277 stream >> iCL >> speed;
278 if (stream.eof())
break;
281 ps->setSpeed(iCL, speed);
289 if (nRead != MAX_N_SLAYERS) B2FATAL(
"#lines read-in (=" << nRead <<
") is no equal #sense layers (=" << MAX_N_SLAYERS <<
") !");
292 m_lastExperiment, m_lastRun);
294 B2RESULT(
"PropSpeed table imported to database.");
298 void CDCDatabaseImporter::importTimeWalk(std::string fileName)
300 std::ifstream stream;
301 stream.open(fileName.c_str());
303 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
306 B2INFO(fileName <<
": open for reading");
311 unsigned short mode(0), nParams(0);
312 stream >> mode >> nParams;
313 tw->setTwParamMode(mode);
315 unsigned short iBoard(0);
316 std::vector<float> coeffs(nParams);
319 while (stream >> iBoard) {
320 for (
unsigned short i = 0; i < nParams; ++i) {
324 tw->setTimeWalkParams(iBoard, coeffs);
331 if (nRead != nBoards) B2FATAL(
"#lines read-in (=" << nRead <<
") is not equal #boards (=" << nBoards <<
") !");
334 m_lastExperiment, m_lastRun);
336 B2RESULT(
"Time-walk coeff. table imported to database.");
340 void CDCDatabaseImporter::importXT(std::string fileName)
348 boost::iostreams::filtering_istream ifs;
349 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
350 ifs.push(boost::iostreams::gzip_decompressor());
352 ifs.push(boost::iostreams::file_source(fileName));
354 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
356 B2INFO(fileName <<
": open for reading");
358 const double degrad = M_PI / 180.;
359 const double raddeg = 180. / M_PI;
361 unsigned short nAlphaBins = 0;
362 if (ifs >> nAlphaBins) {
363 if (nAlphaBins == 0 || nAlphaBins > maxNAlphaPoints) B2FATAL(
"Fail to read alpha bins !");
365 B2FATAL(
"Fail to read alpha bins !");
367 std::array<float, 3> alpha3;
368 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
369 for (
unsigned short j = 0; j < 3; ++j) {
377 unsigned short nThetaBins = 0;
378 if (ifs >> nThetaBins) {
379 if (nThetaBins == 0 || nThetaBins > maxNThetaPoints) B2FATAL(
"Fail to read theta bins !");
381 B2FATAL(
"Fail to read theta bins !");
383 std::array<float, 3> theta3;
385 for (
unsigned short i = 0; i < nThetaBins; ++i) {
386 for (
unsigned short j = 0; j < 3; ++j) {
403 short xtParamMode, np;
404 unsigned short iCL, iLR;
405 const unsigned short npx = nXTParams - 1;
407 double theta, alpha, dummy1;
410 ifs >> xtParamMode >> np;
411 if (xtParamMode < 0 || xtParamMode > 1) B2FATAL(
"Invalid xt param mode read !");
412 if (np <= 0 || np > npx) B2FATAL(
"No. of xt-params. outside limits !");
416 const double epsi = 0.1;
419 ifs >> theta >> alpha >> dummy1 >> iLR;
420 for (
int i = 0; i < np; ++i) {
426 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
427 if (fabs(alpha - xt->
getAlphaBin(i)[2]*raddeg) < epsi) {
432 if (ialpha < 0) B2FATAL(
"alphas in xt.dat are inconsistent !");
435 for (
unsigned short i = 0; i < nThetaBins; ++i) {
436 if (fabs(theta - xt->
getThetaBin(i)[2]*raddeg) < epsi) {
441 if (itheta < 0) B2FATAL(
"thetas in xt.dat are inconsistent !");
444 std::vector<float> xtbuff;
445 for (
int i = 0; i < np; ++i) {
446 xtbuff.push_back(xtc[i]);
453 boost::iostreams::close(ifs);
456 m_lastExperiment, m_lastRun);
458 B2RESULT(
"XT table imported to database.");
461 void CDCDatabaseImporter::importSigma(std::string fileName)
468 ifs.open(fileName.c_str());
470 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
472 B2INFO(fileName <<
": open for reading");
474 const double degrad = M_PI / 180.;
475 const double raddeg = 180. / M_PI;
477 unsigned short nAlphaBins = 0;
478 if (ifs >> nAlphaBins) {
479 if (nAlphaBins == 0 || nAlphaBins > maxNAlphaPoints) B2FATAL(
"Fail to read alpha bins !");
481 B2FATAL(
"Fail to read alpha bins !");
483 std::array<float, 3> alpha3;
484 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
485 for (
unsigned short j = 0; j < 3; ++j) {
493 unsigned short nThetaBins = 0;
494 if (ifs >> nThetaBins) {
495 if (nThetaBins == 0 || nThetaBins > maxNThetaPoints) B2FATAL(
"Fail to read theta bins !");
497 B2FATAL(
"Fail to read theta bins !");
499 std::array<float, 3> theta3;
501 for (
unsigned short i = 0; i < nThetaBins; ++i) {
502 for (
unsigned short j = 0; j < 3; ++j) {
511 short sgParamMode, np;
512 unsigned short iCL, iLR;
513 const unsigned short npx = nSigmaParams;
518 ifs >> sgParamMode >> np;
519 if (sgParamMode < 0 || sgParamMode > 1) B2FATAL(
"Invalid sigma param mode read !");
520 if (np <= 0 || np > npx) B2FATAL(
"No. of sgm-params. outside limits !");
524 const double epsi = 0.1;
527 ifs >> theta >> alpha >> iLR;
528 for (
int i = 0; i < np; ++i) {
534 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
535 if (fabs(alpha - sg->
getAlphaBin(i)[2]*raddeg) < epsi) {
540 if (ialpha < 0) B2FATAL(
"alphas in sigma.dat are inconsistent !");
543 for (
unsigned short i = 0; i < nThetaBins; ++i) {
544 if (fabs(theta - sg->
getThetaBin(i)[2]*raddeg) < epsi) {
549 if (itheta < 0) B2FATAL(
"thetas in sigma.dat are inconsistent !");
552 std::vector<float> sgbuff;
553 for (
int i = 0; i < np; ++i) {
554 sgbuff.push_back(sgm[i]);
563 m_lastExperiment, m_lastRun);
565 B2RESULT(
"Sigma table imported to database.");
569 void CDCDatabaseImporter::importFFactor(std::string fileName)
571 std::ifstream stream;
572 stream.open(fileName.c_str());
574 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
577 B2INFO(fileName <<
": open for reading");
582 unsigned short groupId(0), nParams(0);
583 stream >> groupId >> nParams;
584 B2INFO(groupId <<
" " << nParams);
585 if (groupId != 0) B2FATAL(
"invalid groupId now !");
588 unsigned short id = 0;
589 std::vector<float> coeffs(nParams);
592 while (stream >>
id) {
593 for (
unsigned short i = 0; i < nParams; ++i) {
601 unsigned short nId = 1;
602 if (nRead != nId) B2FATAL(
"#lines read-in (=" << nRead <<
") is not equal #ids (=" << nId <<
") !");
605 m_lastExperiment, m_lastRun);
607 B2RESULT(
"Fudge factor table imported to database.");
611 void CDCDatabaseImporter::importDisplacement(std::string fileName)
616 boost::iostreams::filtering_istream ifs;
617 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
618 ifs.push(boost::iostreams::gzip_decompressor());
620 ifs.push(boost::iostreams::file_source(fileName));
622 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
624 B2INFO(fileName <<
": open for reading");
630 double back[np], fwrd[np];
636 for (
int i = 0; i < np; ++i) {
639 for (
int i = 0; i < np; ++i) {
644 if (ifs.eof())
break;
648 TVector3 fwd(fwrd[0], fwrd[1], fwrd[2]);
649 TVector3 bwd(back[0], back[1], back[2]);
653 if (nRead != nSenseWires) B2FATAL(
"CDCDatabaseimporter::importDisplacement: #lines read-in (=" << nRead <<
654 ") is inconsistent with total #sense wires (=" << nSenseWires <<
") !");
657 boost::iostreams::close(ifs);
660 m_lastExperiment, m_lastRun);
662 B2RESULT(
"Wire displasement table imported to database.");
666 void CDCDatabaseImporter::importWirPosAlign(std::string fileName)
670 boost::iostreams::filtering_istream ifs;
671 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
672 ifs.push(boost::iostreams::gzip_decompressor());
674 ifs.push(boost::iostreams::file_source(fileName));
676 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
679 B2INFO(fileName <<
": open for reading");
686 double back[np], fwrd[np], tension;
691 for (
int i = 0; i < np; ++i) {
694 for (
int i = 0; i < np; ++i) {
698 if (ifs.eof())
break;
703 for (
int i = 0; i < np; ++i) {
704 al->
set(wire, CDCAlignment::wireBwdX, back[0]);
705 al->
set(wire, CDCAlignment::wireBwdY, back[1]);
706 al->
set(wire, CDCAlignment::wireBwdZ, back[2]);
707 al->
set(wire, CDCAlignment::wireFwdX, fwrd[0]);
708 al->
set(wire, CDCAlignment::wireFwdY, fwrd[1]);
709 al->
set(wire, CDCAlignment::wireFwdZ, fwrd[2]);
711 al->
set(wire, CDCAlignment::wireTension, tension);
714 if (nRead != nSenseWires) B2FATAL(
"CDCDatabaseimporter::importWirPosAlign: #lines read-in (=" << nRead <<
715 ") is inconsistent with total #sense wires (=" << nSenseWires <<
") !");
718 boost::iostreams::close(ifs);
721 m_lastExperiment, m_lastRun);
723 B2RESULT(
"Wire alignment table imported to database.");
727 void CDCDatabaseImporter::printChannelMap()
732 for (
const auto& cm : channelMaps) {
733 std::cout << cm.getISuperLayer() <<
" " << cm.getILayer()
734 <<
" " << cm.getIWire() <<
" "
735 << cm.getBoardID() <<
" " << cm.getBoardChannel() << std::endl;
740 void CDCDatabaseImporter::printFEElectronics()
743 for (
const auto& cf : fEElectronics) {
744 std::cout << cf.getBoardID() <<
" " << cf.getWidthOfTimeWindow() <<
" " << cf.getTrgDelay() <<
" " << cf.getADCThresh() <<
" " <<
745 cf.getTDCThreshInMV() << std::endl;
752 void CDCDatabaseImporter::printEDepToADC()
758 void CDCDatabaseImporter::printTimeZero()
772 void CDCDatabaseImporter::printBadWire()
778 void CDCDatabaseImporter::printPropSpeed()
784 void CDCDatabaseImporter::printTimeWalk()
790 void CDCDatabaseImporter::printXT()
796 void CDCDatabaseImporter::printSigma()
802 void CDCDatabaseImporter::printFFactor()
808 void CDCDatabaseImporter::printDisplacement()
811 for (
const auto& disp : displacements) {
812 B2INFO(disp.getICLayer() <<
" " << disp.getIWire() <<
" "
813 << disp.getXBwd() <<
" " << disp.getYBwd() <<
" " << disp.getZBwd() <<
" "
814 << disp.getXFwd() <<
" " << disp.getYFwd() <<
" " << disp.getZFwd() <<
" " << disp.getTension());
818 void CDCDatabaseImporter::printWirPosAlign()
824 void CDCDatabaseImporter::printWirPosMisalign()
831 void CDCDatabaseImporter::importADCDeltaPedestal(std::string fileName)
833 std::ifstream stream;
834 stream.open(fileName.c_str());
835 if (!stream.is_open()) {
836 B2ERROR(
"openFile: " << fileName <<
" *** failed to open");
839 B2INFO(fileName <<
": open for reading");
854 stream >> iB >> iC >> ped;
856 if (stream.eof())
break;
859 B2FATAL(
"sample window is zero !");
871 m_lastExperiment, m_lastRun);
874 B2RESULT(
"ADC delta pedestal table imported to database.");
877 void CDCDatabaseImporter::importADCDeltaPedestal()
884 m_lastExperiment, m_lastRun);
887 B2RESULT(
"ADC delta pedestal w/ zero imported to database.");
890 void CDCDatabaseImporter::printADCDeltaPedestal()
897 void CDCDatabaseImporter::importCDCWireHitRequirements(
const std::string& jsonFileName)
const
901 boost::property_tree::ptree tree;
906 B2INFO(
"Loading json file: " << jsonFileName);
907 boost::property_tree::read_json(jsonFileName, tree);
909 }
catch (boost::property_tree::ptree_error& e) {
910 B2FATAL(
"Error when loading json file: " <<
e.what());
917 m_lastExperiment, m_lastRun);
920 B2RESULT(
"CDCWireHit requirements imported to database.");
923 void CDCDatabaseImporter::printCDCWireHitRequirements()
const
928 dbWireHitReq->dump();
930 B2WARNING(
"DBObjPtr<CDCWireHitRequirements> not valid for the current run.");
934 void CDCDatabaseImporter::importCDCCrossTalkLibrary(
const std::string& rootFileName)
const
939 TFile fIn = TFile(rootFileName.c_str());
940 TTreeReader reader(
"my_ttree", &fIn);
941 TTreeReaderValue<UChar_t> Board(reader,
"Board");
942 TTreeReaderValue<UChar_t> Channel(reader,
"Channel");
943 TTreeReaderValue<Short_t> Asic_ADC0(reader,
"Asic_ADC0");
944 TTreeReaderValue<Short_t> Asic_TDC0(reader,
"Asic_TDC0");
945 TTreeReaderValue<Short_t> Asic_TOT0(reader,
"Asic_TOT0");
946 TTreeReaderValue<Short_t> Asic_ADC1(reader,
"Asic_ADC1");
947 TTreeReaderValue<Short_t> Asic_TDC1(reader,
"Asic_TDC1");
948 TTreeReaderValue<Short_t> Asic_TOT1(reader,
"Asic_TOT1");
949 TTreeReaderValue<Short_t> Asic_ADC2(reader,
"Asic_ADC2");
950 TTreeReaderValue<Short_t> Asic_TDC2(reader,
"Asic_TDC2");
951 TTreeReaderValue<Short_t> Asic_TOT2(reader,
"Asic_TOT2");
952 TTreeReaderValue<Short_t> Asic_ADC3(reader,
"Asic_ADC3");
953 TTreeReaderValue<Short_t> Asic_TDC3(reader,
"Asic_TDC3");
954 TTreeReaderValue<Short_t> Asic_TOT3(reader,
"Asic_TOT3");
955 TTreeReaderValue<Short_t> Asic_ADC4(reader,
"Asic_ADC4");
956 TTreeReaderValue<Short_t> Asic_TDC4(reader,
"Asic_TDC4");
957 TTreeReaderValue<Short_t> Asic_TOT4(reader,
"Asic_TOT4");
958 TTreeReaderValue<Short_t> Asic_ADC5(reader,
"Asic_ADC5");
959 TTreeReaderValue<Short_t> Asic_TDC5(reader,
"Asic_TDC5");
960 TTreeReaderValue<Short_t> Asic_TOT5(reader,
"Asic_TOT5");
961 TTreeReaderValue<Short_t> Asic_ADC6(reader,
"Asic_ADC6");
962 TTreeReaderValue<Short_t> Asic_TDC6(reader,
"Asic_TDC6");
963 TTreeReaderValue<Short_t> Asic_TOT6(reader,
"Asic_TOT6");
964 TTreeReaderValue<Short_t> Asic_ADC7(reader,
"Asic_ADC7");
965 TTreeReaderValue<Short_t> Asic_TDC7(reader,
"Asic_TDC7");
966 TTreeReaderValue<Short_t> Asic_TOT7(reader,
"Asic_TOT7");
968 while (reader.Next()) {
980 UChar_t asicCh = *Channel % 8;
981 Short_t ADC = record[asicCh].
ADC;
988 fIn.GetObject(
"ProbXTalk", prob);
989 for (
size_t a = 1; a <= 8196; a += 1) {
990 probs[a - 1] = prob->GetBinContent(a);
995 dbCDCCrossTalkLibrary->
dump(0);
997 m_lastExperiment, m_lastRun);
998 dbCDCCrossTalkLibrary.
import(iov);
999 B2RESULT(
"CDCCrossTalkLibrary requirements imported to database.");
1002 void CDCDatabaseImporter::printCDCCrossTalkLibrary()
const
1005 if (dbCDCCrossTalkLib.
isValid()) {
1006 dbCDCCrossTalkLib->dump(1);
1008 B2ERROR(
"DBObjPtr<CDCCrossTalkLibrary> not valid for the current run.");
1012 void CDCDatabaseImporter::testCDCCrossTalkLibrary(
bool spotChecks)
const
1016 if (dbCDCCrossTalkLib.
isValid()) {
1019 B2INFO(
"Performing CDCCrossTalkLibrary checks");
1020 auto timer =
new Utils::Timer(
"CDCCrossTalkLibrary checks took");
1023 for (Short_t ADC = 0; ADC < 8196; ADC += 1) {
1024 for (Short_t channel = 0; channel < 48; channel += 1) {
1025 for (
size_t rep = 0; rep < 100; rep += 1) {
1026 auto xtalk = dbCDCCrossTalkLib->getLibraryCrossTalk(channel, 4999, ADC, 5, 0,
false);
1028 size += xtalk.size();
1032 B2INFO(
"CDCCrossTalkLibrary called " << counter <<
" times. Total number of cross talk hits " << size);
1038 Short_t ADC_spot_checks[5] = {2, 100, 500, 1000, 5000};
1039 for (
auto ADC : ADC_spot_checks) {
1040 B2INFO(
"CHECK ADC=" << ADC);
1042 size_t NRep = ADC < 50 ? 100 : 10;
1043 for (
size_t rep = 0; rep < NRep; rep += 1) {
1044 auto xtalk = dbCDCCrossTalkLib->getLibraryCrossTalk(0, 4999, ADC, 5, 0,
true);
1045 B2INFO(
"Size = " << xtalk.size());
1046 for (
auto [channel, rec] : xtalk) {
1047 B2INFO(
"Channel:" << channel <<
" TDC,ADC,TOT:" << rec.TDC <<
"," << rec.ADC <<
"," << rec.TOT);
1052 B2ERROR(
"DBObjPtr<CDCCrossTalkLibrary> not valid for the current run.");
1059 void CDCDatabaseImporter::importWirPosMisalign(std::string fileName)
1062 ifs.open(fileName.c_str());
1064 B2FATAL(
"openFile: " << fileName <<
" *** failed to open");
1067 B2INFO(fileName <<
": open for reading");
1074 double back[np], fwrd[np], tension;
1079 for (
int i = 0; i < np; ++i) {
1082 for (
int i = 0; i < np; ++i) {
1086 if (ifs.eof())
break;
1091 for (
int i = 0; i < np; ++i) {
1092 mal->
set(wire, CDCMisalignment::wireBwdX, back[0]);
1093 mal->
set(wire, CDCMisalignment::wireBwdY, back[1]);
1094 mal->
set(wire, CDCMisalignment::wireBwdZ, back[2]);
1095 mal->
set(wire, CDCMisalignment::wireFwdX, fwrd[0]);
1096 mal->
set(wire, CDCMisalignment::wireFwdY, fwrd[1]);
1097 mal->
set(wire, CDCMisalignment::wireFwdZ, fwrd[2]);
1099 mal->
set(wire, CDCMisalignment::wireTension, tension);
1102 if (nRead != nSenseWires) B2FATAL(
"CDCDatabaseimporter::importWirPosMisalign: #lines read-in (=" << nRead <<
1103 ") is inconsistent with total #sense wires (=" << nSenseWires <<
") !");
1108 m_lastExperiment, m_lastRun);
1110 B2RESULT(
"Wire misalignment table imported to database.");