11 #include "art/Utilities/ToolMacros.h"
12 #include "art/Utilities/make_tool.h"
13 #include "fhiclcpp/types/Atom.h"
14 #include "art/Utilities/ToolConfigTable.h"
30 fhicl::Comment(
"Weight exponent for YZ barycenters")
41 double& Ycenter,
double& Zcenter,
42 double& Ywidth,
double& Zwidth)
override;
52 : fWeightExp{ config().WeightExp() }
58 double& Ycenter,
double& Zcenter,
59 double& Ywidth,
double& Zwidth)
63 Ycenter = Zcenter = 0.;
64 Ywidth = Zwidth = -999.;
66 double sumy = 0., sumz = 0., sumy2 = 0., sumz2 = 0.;
68 for (
unsigned int opch = 0; opch < pePerOpChannel.size(); opch++) {
74 if(
fWeightExp==1) weight = pePerOpChannel[opch];
75 else if(
fWeightExp==2) weight = pePerOpChannel[opch]*pePerOpChannel[opch];
76 else weight = std::pow(pePerOpChannel[opch],
fWeightExp);
79 sumy += weight*PMTxyz[1];
80 sumy2 += weight*PMTxyz[1]*PMTxyz[1];
81 sumz += weight*PMTxyz[2];
82 sumz2 += weight*PMTxyz[2]*PMTxyz[2];
86 Ycenter = sumy/totalPE;
87 Zcenter = sumz/totalPE;
90 if ( (sumy2*totalPE - sumy*sumy) > 0. )
91 Ywidth = std::sqrt(sumy2*totalPE - sumy*sumy)/totalPE;
93 if ( (sumz2*totalPE - sumz*sumz) > 0. )
94 Zwidth = std::sqrt(sumz2*totalPE - sumz*sumz)/totalPE;
BEGIN_PROLOG vertical distance to the surface Name
void OpDetCenterFromOpChannel(size_t opch, double *xyz)
fhicl::Atom< unsigned int > WeightExp
void GetFlashLocation(std::vector< double > pePerOpChannel, double &Ycenter, double &Zcenter, double &Ywidth, double &Zwidth) override
FlashGeoBarycenter(art::ToolConfigTable< Config > const &config)