本文整理汇总了C++中TVector2::Phi方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector2::Phi方法的具体用法?C++ TVector2::Phi怎么用?C++ TVector2::Phi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector2
的用法示例。
在下文中一共展示了TVector2::Phi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
SimulationOutput* LightSimulator::Run(){
TRandom3 randgen = TRandom3(0);
if (debug) cout << ntoys*nrays << " light propagations to simulate" << endl;
long counter_ray=0;
if (output) delete output;
output = new SimulationOutput(deposit);
if (!isinsideboundaries()) return output;
for (int nrun = 0; nrun<ntoys; nrun++){
vector<Int_t> myphotons(4,0);
for (int nray = 0; nray<nrays; nray++){
counter_ray++;
// if (counter_ray%(ntoys*nrays/10)==0) cout << "Done " << counter_ray << " rays" << endl;
Double_t phi = randgen.Uniform(-Pi(),Pi());
Double_t costheta = randgen.Uniform(-1,1);
TVector3 dir; dir.SetMagThetaPhi(1,ACos(costheta),phi);
LightRay lr(deposit.position,dir);
bool matched = false;
Int_t matchx = 999;
Int_t matchy = 999;
Int_t firstmatchx = 999;
Int_t firstmatchy = 999;
Int_t index=0;
MatchObject m;
vector<MatchObject> matches;
while (index>=0 && index<pars.max_distance_unit_propagation && index<Max(firstmatchx,firstmatchy)){
if (propray(lr,kNS,index,matchx,m)){
if (!matched) firstmatchx=matchx;
matched=true;
matches.push_back(m);
}
if (propray(lr,kEW,index,matchy,m)){
if (!matched) firstmatchy=matchy;
matched=true;
matches.push_back(m);
}
index++;
}
vector<GoodMatchObject> goodmatches=convert_matches(matches);
Double_t pathxy = pars.max_distance_unit_propagation*10*pars.xtalsize;
GoodMatchObject finalmatch;
for (size_t i=0; i<goodmatches.size(); i++){
Double_t path = sqrt(pow(goodmatches[i].positionx-lr.origin.x(),2)+pow(goodmatches[i].positiony-lr.origin.y(),2));
if (path<pathxy) {pathxy=path; finalmatch=goodmatches[i];}
}
if (pathxy>1e4){
if (debug) cout << "LOOPER" << endl;
continue;
}
Int_t channel = findchannel(finalmatch.x,finalmatch.y)-1;
if (debug) cout << finalmatch.x << " " << finalmatch.y << " " << pathxy << " " << channel+1 << endl;
Double_t path3d = pathxy/Sin(lr.dirvect.Theta());
TVector3 rotated_origin_xy = lr.origin; rotated_origin_xy.SetZ(0);
TVector3 rotated_impact = TVector3(finalmatch.positionx,finalmatch.positiony,0);
TRotation r;
r.RotateZ(-Pi()/4);
rotated_origin_xy = r*rotated_origin_xy;
rotated_impact = r*rotated_impact;
Int_t nx = 0;
Int_t ny = 0;
Int_t nz = 0;
{
Int_t sx = finalmatch.x+finalmatch.y;
if (sx==0) nx=0;
else if (sx>0) nx = sx/2-1;
else nx = TMath::Abs(sx)/2;
Int_t dy = finalmatch.y-finalmatch.x;
if (dy==0) ny=0;
else if (dy>0) ny = dy/2-1;
else ny = TMath::Abs(dy)/2;
Float_t finalz = path3d*Cos(lr.dirvect.Theta())+deposit.position.z()-pars.xtalheight/2;
nz = Int_t((fabs(finalz)+pars.xtalheight/2)/pars.xtalheight);
}
Int_t all_crossings = nx+ny+nz;
Int_t my_paper_refl = 0;
TVector2 difference = TVector2(fabs(rotated_origin_xy.x()-rotated_impact.x()),fabs(rotated_origin_xy.y()-rotated_impact.y()));
if (difference.Phi()<limit_angle) my_paper_refl+=nx;
if (Pi()/2-difference.Phi()<limit_angle) my_paper_refl+=ny;
if (lr.dirvect.Theta()<limit_angle) my_paper_refl+=nz;
//.........这里部分代码省略.........