9 #include "Geometry/LArTPC.h" 11 #include "Helpers/XmlHelper.h" 13 #include "Managers/GeometryManager.h" 15 #include "Objects/CartesianVector.h" 17 #include "Pandora/Pandora.h" 41 m_maxAngularDiscrepancyU(0.03),
42 m_maxAngularDiscrepancyV(0.03),
43 m_maxAngularDiscrepancyW(0.03),
44 m_maxSigmaDiscrepancy(0.01)
135 const double sigmaV,
const double sigmaW,
double &
y,
double &
z,
double &chiSquared)
const 137 const double sigmaU2(sigmaU * sigmaU), sigmaV2(sigmaV * sigmaV), sigmaW2(sigmaW * sigmaW);
161 chiSquared = ((deltaU * deltaU) / sigmaU2) + ((deltaV * deltaV) / sigmaV2) + ((deltaW * deltaW) / sigmaW2);
167 const double sigmaW,
const double uFit,
const double vFit,
const double wFit,
const double sigmaFit,
double &
y,
double &
z,
double &chiSquared)
const 169 const double sigmaU2(sigmaU * sigmaU), sigmaV2(sigmaV * sigmaV), sigmaW2(sigmaW * sigmaW), sigmaFit2(sigmaFit * sigmaFit);
229 wFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosU *
m_sinU * m_sinW - wFit * sigmaV2 * sigmaW2 * sigmaFit2 *
m_cosU *
m_sinU * m_sinW -
230 sigmaU2 * sigmaV2 * sigmaFit2 * w *
m_cosU *
m_sinU * m_sinW - sigmaV2 * sigmaFit2 * sigmaFit2 * w *
m_cosU *
m_sinU * m_sinW -
231 uFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosW *
m_sinU * m_sinW - uFit * sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosW *
m_sinU * m_sinW -
232 sigmaV2 * sigmaW2 * sigmaFit2 * u *
m_cosW *
m_sinU * m_sinW - sigmaV2 * sigmaFit2 * sigmaFit2 * u *
m_cosW *
m_sinU * m_sinW -
233 wFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosV *
m_sinV * m_sinW - wFit * sigmaU2 * sigmaW2 * sigmaFit2 *
m_cosV *
m_sinV * m_sinW -
234 sigmaU2 * sigmaV2 * sigmaFit2 * w *
m_cosV *
m_sinV * m_sinW - sigmaU2 * sigmaFit2 * sigmaFit2 * w *
m_cosV *
m_sinV * m_sinW -
235 vFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosW *
m_sinV * m_sinW - vFit * sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosW *
m_sinV * m_sinW -
236 sigmaU2 * sigmaW2 * sigmaFit2 * v *
m_cosW *
m_sinV * m_sinW - sigmaU2 * sigmaFit2 * sigmaFit2 * v *
m_cosW *
m_sinV * m_sinW +
237 uFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosU * m_sinW * m_sinW + uFit * sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosU * m_sinW * m_sinW +
238 sigmaV2 * sigmaW2 * sigmaFit2 * u *
m_cosU * m_sinW * m_sinW + sigmaV2 * sigmaFit2 * sigmaFit2 * u *
m_cosU * m_sinW * m_sinW +
239 vFit * sigmaU2 * sigmaV2 * sigmaW2 *
m_cosV * m_sinW * m_sinW + vFit * sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosV * m_sinW * m_sinW +
240 sigmaU2 * sigmaW2 * sigmaFit2 * v *
m_cosV * m_sinW * m_sinW + sigmaU2 * sigmaFit2 * sigmaFit2 * v *
m_cosV * m_sinW *
m_sinW) /
257 sigmaU2 * sigmaV2 * sigmaW2 *
m_cosU *
m_cosU * m_sinW * m_sinW + sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosU *
m_cosU * m_sinW * m_sinW +
258 sigmaV2 * sigmaW2 * sigmaFit2 *
m_cosU *
m_cosU * m_sinW * m_sinW + sigmaV2 * sigmaFit2 * sigmaFit2 *
m_cosU *
m_cosU * m_sinW * m_sinW +
259 sigmaU2 * sigmaV2 * sigmaW2 *
m_cosV *
m_cosV * m_sinW * m_sinW + sigmaU2 * sigmaV2 * sigmaFit2 *
m_cosV *
m_cosV * m_sinW * m_sinW +
260 sigmaU2 * sigmaW2 * sigmaFit2 *
m_cosV *
m_cosV * m_sinW * m_sinW + sigmaU2 * sigmaFit2 * sigmaFit2 *
m_cosV *
m_cosV * m_sinW * m_sinW);
266 const double deltaU(u - outputU), deltaV(v - outputV), deltaW(w - outputW);
267 const double deltaUFit(uFit - outputU), deltaVFit(vFit - outputV), deltaWFit(wFit - outputW);
269 chiSquared = ((deltaU * deltaU) / sigmaU2) + ((deltaV * deltaV) / sigmaV2) + ((deltaW * deltaW) / sigmaW2) +
270 ((deltaUFit * deltaUFit) / sigmaFit2) + ((deltaVFit * deltaVFit) / sigmaFit2) + ((deltaWFit * deltaWFit) / sigmaFit2);
277 const LArTPCMap &larTPCMap(this->GetPandora().
GetGeometry()->GetLArTPCMap());
279 if (larTPCMap.empty())
281 std::cout <<
"LArRotationalTransformationPlugin::Initialize - LArTPC description not registered with Pandora as required " <<
std::endl;
282 return STATUS_CODE_NOT_INITIALIZED;
285 const LArTPC *
const pFirstLArTPC(larTPCMap.begin()->second);
286 m_thetaU = pFirstLArTPC->GetWireAngleU();
287 m_thetaV = pFirstLArTPC->GetWireAngleV();
288 m_thetaW = pFirstLArTPC->GetWireAngleW();
289 const double sigmaUVW(pFirstLArTPC->GetSigmaUVW());
291 m_sinU = std::sin(m_thetaU);
294 m_cosU = std::cos(m_thetaU);
302 if ((std::fabs(
m_sinVminusU) < std::numeric_limits<double>::epsilon()) ||
303 (std::fabs(
m_sinWminusV) < std::numeric_limits<double>::epsilon()) || (std::fabs(
m_sinUminusW) < std::numeric_limits<double>::epsilon()))
305 std::cout <<
"LArRotationalTransformationPlugin::Initialize - Equal wire angles; Plugin does not support provided LArTPC configurations. " 307 return STATUS_CODE_INVALID_PARAMETER;
310 for (
const LArTPCMap::value_type &mapEntry : larTPCMap)
312 const LArTPC *
const pLArTPC(mapEntry.second);
319 std::cout <<
"LArRotationalTransformationPlugin::Initialize - Dissimilar drift volumes; Plugin does not support provided LArTPC configurations. " 321 return STATUS_CODE_INVALID_PARAMETER;
325 return STATUS_CODE_SUCCESS;
332 PANDORA_RETURN_RESULT_IF_AND_IF(
333 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxAngularDiscrepancyU",
m_maxAngularDiscrepancyU));
335 PANDORA_RETURN_RESULT_IF_AND_IF(
336 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxAngularDiscrepancyV",
m_maxAngularDiscrepancyV));
338 PANDORA_RETURN_RESULT_IF_AND_IF(
339 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxAngularDiscrepancyW",
m_maxAngularDiscrepancyW));
341 PANDORA_RETURN_RESULT_IF_AND_IF(
342 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxSigmaDiscrepancy",
m_maxSigmaDiscrepancy));
344 return STATUS_CODE_SUCCESS;
virtual void GetMinChiSquaredYZ(const double u, const double v, const double w, const double sigmaU, const double sigmaV, const double sigmaW, double &y, double &z, double &chiSquared) const
virtual double UVtoY(const double u, const double v) const
virtual double UVtoW(const double u, const double v) const
pandora::StatusCode Initialize()
virtual double YZtoW(const double y, const double z) const
virtual double UVtoZ(const double u, const double v) const
double m_sinVminusU
sin(thetaV - thetaU)
virtual double VWtoU(const double v, const double w) const
double m_thetaW
inclination of W wires (radians)
double m_maxAngularDiscrepancyU
Maximum allowed difference between u wire angles between LArTPCs.
double m_sinUminusW
sin(thetaU - thetaW)
virtual double UWtoZ(const double u, const double w) const
double m_thetaV
inclination of V wires (radians)
virtual double YZtoV(const double y, const double z) const
double m_maxAngularDiscrepancyV
Maximum allowed difference between v wire angles between LArTPCs.
double m_maxAngularDiscrepancyW
Maximum allowed difference between w wire angles between LArTPCs.
double m_sinWminusV
sin(thetaW - thetaV)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
virtual double VWtoZ(const double v, const double w) const
virtual double WUtoV(const double w, const double u) const
double m_thetaU
inclination of U wires (radians)
virtual double YZtoU(const double y, const double z) const
double m_maxSigmaDiscrepancy
Maximum allowed difference between like wire sigma values between LArTPCs.
LArRotationalTransformationPlugin()
Default constructor.
virtual double VWtoY(const double v, const double w) const
QTextStream & endl(QTextStream &s)
GeomAnalyzerI * GetGeometry(void)
virtual double UWtoY(const double u, const double w) const