52 auto runInst = runWS->getInstrumentName();
53 auto peakInst = peaksWS->getInstrumentName();
54 if (peaksWS->getNumberPeaks() > 0 && (runInst != peakInst)) {
55 throw std::runtime_error(
"The peak from " + runWS->getName() +
" comes from a different instrument (" + runInst +
57 "already in the table (" +
58 peakInst +
"). It could not be added.");
66 const auto &detectorInfo = runWS->detectorInfo();
67 const auto &componentInfo = runWS->componentInfo();
76 double Qx = -sin(theta2) * cos(phi);
77 double Qy = -sin(theta2) * sin(phi);
78 double Qz = 1.0 - cos(theta2);
79 double l1 = detectorInfo.l1();
81 std::vector<int> emptyWarningVec;
85 if (unit->unitID() !=
"TOF") {
92 }
else if (componentInfo.hasParameter(
detectorIndex,
"Efixed")) {
95 const auto efixedValues = componentInfo.getNumberParameter(
detectorIndex,
"Efixed");
96 if (!efixedValues.empty()) {
97 efixed = efixedValues.front();
99 }
catch (std::runtime_error &) {
107 std::vector<double> xdata(1, tof);
108 std::vector<double> ydata;
109 unit->toTOF(xdata, ydata, l1, emode,
119 std::string m_qConvention = Kernel::ConfigService::Instance().getString(
"Q.convention");
121 if (m_qConvention ==
"Crystallography") {
131 peak->setDetectorID(detID);
132 peak->setGoniometerMatrix(runWS->run().getGoniometer().getR());
133 peak->setBinCount(
count);
134 peak->setRunNumber(runWS->getRunNumber());
135 peak->setIntensity(
height);
137 peak->setSigmaIntensity(std::sqrt(
height));
139 peaksWS->addPeak(*peak);