1001 for(
int i=0; i<6; i++){ tpc[i] +=
fTPCBuffer[i]; }
1005 for(
int i=0; i<6; i++){ cryo[i] +=
fCryoBuffer[i]; }
1007 CLHEP::RandFlat
flat(engine);
1011 mf::LogInfo(
"Gen311") <<
"Trigger muon not found! Only Background";
1018 double p=0,
theta=0, phi=0;
1029 double xyz[3] ={0.};
1030 xyz[0]=(tpc[5]-tpc[4])/2-tpc[5];
1031 xyz[1]=(tpc[1]-tpc[0])/2-tpc[1];
1032 xyz[2]=(tpc[3]-tpc[2])/2-tpc[2];
1035 double cos_x=cos(
theta);
1036 double cos_y=sin(phi)*sin(
theta);
1037 double cos_z=cos(phi)*sin(
theta);
1038 double dxyz[3] = { cos_z, cos_x, cos_y };
1041 double length[2]={0.};
1043 double rdm_start[3] ={0.};
1044 double xyzo[3]={0.};
1047 for(
int i=0; i<2; i++){
1048 for(
int j=2; j<4; j++){
1049 for(
int k=4;
k<6;
k++){
1052 double proj[3]={0.};
1053 double u=0;
double v=0;
1061 for(
int p=0; p<3; p++ ){ dot+=(corner[
p]-xyz[
p])*dxyz[p]; }
1062 for(
int p=0; p<3; p++ ){ proj[
p] = corner[
p]-(dot*dxyz[
p]); }
1064 proj[0] -= (tpc[5]-tpc[4])/2;
1068 double (*p_R)[3][3]=&
R;
1072 for(
int p=0; p<3; p++ ){ u += (*p_R)[
p][0]*proj[
p]; }
1073 if(length[0] < u){ length[0] = u; }
1076 for(
int p=0; p<3; p++ ){ v += (*p_R)[
p][2]*proj[
p]; }
1077 if(length[1] < v){ length[1] = v; }
1083 bool is_inside=
false;
1086 while(!is_inside && iteration > 0){
1089 double u =
flat()*2*length[0]-length[0];
1090 double v =
flat()*2*length[1]-length[1];;
1093 double urv[3] ={ u, 0, v };
1094 double dir[3]={ 0., 0., 0. };
1098 rdm_start[0] = (double)dir[1];
1099 rdm_start[1] = (double)dir[2];
1100 rdm_start[2] = (double)dir[0]+(tpc[5]-tpc[4])/2;
1103 this->
ProjectToBoxEdge(rdm_start, dx, cryo[0], cryo[1], cryo[2], cryo[3], cryo[4], cryo[5], xyzo);
1116 mf::LogInfo(
"Gen311") <<
"Trigger muon not found in 20 iterations. Only Background";
1133 fTriggerPos.SetXYZT(rdm_start[0],rdm_start[1],rdm_start[2],0);
const TLorentzVector & Position(const int i=0) const
void DoRotation(double urv[], double dir[], double theta, double phi)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > fCryoBuffer
void GetCryoSize(double cryo[])
TLorentzVector fTriggerPos
void ProjectToBoxEdge(const double xyz[], const double indxyz[], const double xlo, const double xhi, const double ylo, const double yhi, const double zlo, const double zhi, double xyzout[])
void GetMatrix(double theta, double phi, double(*p_R)[3][3])
void GetTPCSize(double tpc[])
double GetPhi(const double py, const double pz)
const TLorentzVector & Momentum(const int i=0) const
simb::MCParticle fTriggerMu
std::vector< double > fTPCBuffer
std::vector< simb::MCParticle > fMuonList
bool Intersect(const double x0[], const double dx[], const double bounds[])