4 namespace single_photon
8 double dist_line_point( std::vector<double>&X1, std::vector<double>& X2, std::vector<double>& point){
17 double x0 =point.at(0);
18 double y0 =point.at(1);
19 double z0 =point.at(2);
29 double t = -(x10*x21+y10*y21+z10*z21)/fabs(x21*x21+y21*y21+z21*z21 );
31 double d2 = pow(x1-x0,2)+pow(y1-y0,2)+pow(z1-z0,2)+2*t*((x2-x1)*(x1-x0)+(y2-y1)*(y1-y0)+(z2-z1)*(z1-z0))+t*t*( pow(x2-x1,2)+pow(y2-y1,2)+pow(z2-z1,2));
41 std::vector<double> vert = {
x,
y,z};
42 std::vector<double> start = {shr->ShowerStart().X(), shr->ShowerStart().Y(),shr->ShowerStart().Z()};
43 std::vector<double> abit = {shr->ShowerStart().X() + shr->Direction().X(), shr->ShowerStart().Y()+shr->Direction().Y(), shr->ShowerStart().Z()+shr->Direction().Z()};
50 double implied_invar_mass(
double vx,
double vy,
double vz, art::Ptr<recob::Shower> & s1,
double E1, art::Ptr<recob::Shower> &s2,
double E2){
52 double s1x = s1->ShowerStart().X()-vx;
53 double s1y = s1->ShowerStart().Y()-vy;
54 double s1z = s1->ShowerStart().Z()-vz;
55 double norm1 = std::hypot(s1x,s1y,s1z);
60 double s2x = s2->ShowerStart().X()-vx;
61 double s2y = s2->ShowerStart().Y()-vy;
62 double s2z = s2->ShowerStart().Z()-vz;
63 double norm2 = std::hypot(s2x,s2y,s2z);
68 return sqrt(2.0*E1*E2*(1.0-(s1x*s2x+s1y*s2y+s1z*s2z)));
74 double invar_mass(art::Ptr<recob::Shower> & s1,
double E1, art::Ptr<recob::Shower> &s2,
double E2){
76 double s1x = s1->Direction().X();
77 double s1y = s1->Direction().Y();
78 double s1z = s1->Direction().Z();
80 double s2x = s2->Direction().X();
81 double s2y = s2->Direction().Y();
82 double s2z = s2->Direction().Z();
84 return sqrt(2.0*E1*E2*(1.0-(s1x*s2x+s1y*s2y+s1z*s2z)));
89 size_t len = thisvector.size();
90 if(len < 1)
return NAN;
92 std::sort(thisvector.begin(), thisvector.end());
94 return 0.5*(thisvector[len/2]+thisvector[len/2+1]);
96 return thisvector[len/2];
103 double angle_wrt_plane0,
104 double angle_wrt_plane1,
105 double angle_wrt_plane2,
106 double median_plane0,
107 double median_plane1,
108 double median_plane2,
117 if(angle_wrt_plane1> angle_wrt_plane0){
118 return median_plane1;
120 return median_plane0;
124 if (plane2_nhits< 2){
125 if (plane1_nhits >=2 ){
126 return median_plane1;
127 }
else if (plane0_nhits >=2 ){
128 return median_plane0;
131 return median_plane2;
136 double amalgamateddEdx,
137 double median_plane0,
138 double median_plane1,
139 double median_plane2,
143 if (amalgamateddEdx == median_plane0){
146 if (amalgamateddEdx == median_plane1){
149 if (amalgamateddEdx == median_plane2){
164 std::vector<std::vector<double>>
buildRectangle(std::vector<double> cluster_start, std::vector<double> cluster_axis,
double width,
double length){
165 std::vector<std::vector<double>> corners;
168 double perp_axis[2] = {-cluster_axis[1], cluster_axis[0]};
172 std::vector<double> c1 = {cluster_start[0] + perp_axis[0] * width / 2, cluster_start[1] + perp_axis[1] * width / 2};
174 std::vector<double> c2 = {c1[0] + cluster_axis[0] * length, c1[1] + cluster_axis[1] * length};
176 std::vector<double> c3 = {cluster_start[0] - perp_axis[0] * width / 2, cluster_start[1] - perp_axis[1] * width / 2};
178 std::vector<double> c4 ={c3[0] + cluster_axis[0] * length, c3[1] + cluster_axis[1] * length};
181 corners.push_back(c1);
182 corners.push_back(c2);
183 corners.push_back(c4);
184 corners.push_back(c3);
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
int getAmalgamateddEdxNHits(double amalgamateddEdx, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
double degToRad(double deg)
double dist_line_point(std::vector< double > &X1, std::vector< double > &X2, std::vector< double > &point)
double invar_mass(art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
double implied_invar_mass(double vx, double vy, double vz, art::Ptr< recob::Shower > &s1, double E1, art::Ptr< recob::Shower > &s2, double E2)
process_name opflash particleana ie ie y
std::vector< std::vector< double > > buildRectangle(std::vector< double > cluster_start, std::vector< double > cluster_axis, double width, double length)
Calculates the four corners of a rectangle of given length and width around a cluster given the start...
double getAmalgamateddEdx(double angle_wrt_plane0, double angle_wrt_plane1, double angle_wrt_plane2, double median_plane0, double median_plane1, double median_plane2, int plane0_nhits, int plane1_nhits, int plane2_nhits)
double impact_paramater_shr(double x, double y, double z, art::Ptr< recob::Shower > &shr)
double getMedian(std::vector< double > thisvector)
helper function for LArPandoraInterface producer module