#include"TVector3.h" #include"TMatrixT.h" #include"TFile.h" #include"TTree.h" #include"TRandom3.h" #include"src/TCcluster.h" #include"src/TCtrack.h" #include"src/TCevent.h" #include"src/StdoutKiller.h" TCcluster makeCluster(TCtrack *t,int id){ TVector3 trans; TMatrixT rot(3,3); double pitch,theta,d1,d2,res; TCalign* a = TCalign::getInstance("alignment/AlignmentFiles/simRealAlign1.txt"); // cout<<"before getting reading file"<clear(); a->read("alignment/AlignmentFiles/simRealAlign1.txt"); // cout<<"before getting convertion id"<getConv(id,trans,rot,pitch,theta,d1,d2,res); // cout<<"x "<getAx()*trans.Z()+t->getBx(); double y=t->getAy()*trans.Z()+t->getBy(); TVector3 globPos(x,y,trans.Z()); TVector3 pos = a->XYZtoUVW(id,globPos); //cout<<"x glob:"<Branch("event","TCevent",&outEv,32000,99); // int nTracks = 10000; TRandom3 rand(0); for(int i=0;iclear(); outEv->clear(); TVector3 pos1,pos2; //pos1.SetXYZ(0.,0.,0.); //pos2.SetXYZ(1.,2.,100.); pos1.SetX(rand.Uniform(13.890,16.716)); pos1.SetY(rand.Uniform(21.079,21.618)); pos1.SetZ(rand.Uniform(28.14,28.15)); pos2.SetX(rand.Uniform(13.688,16.506)); pos2.SetY(rand.Uniform(21.079,21.618)); pos2.SetZ(rand.Uniform(166.6,166.5)); TVector3 mom=pos2-pos1; mom.SetMag(1.); double ax,bx,ay,by; ax=mom.X()/mom.Z(); ay=mom.Y()/mom.Z(); //double t=(0.-pos1.Z())/mom.Z(); //bx=pos1.X()+t*ax; //by=pos1.Y()+t*ay; bx=pos1.X()-pos1.Z()*ax; by=pos1.Y()-pos1.Z()*ay; outTr->setPar(ax,bx,ay,by); for(int j=1;j<=8;++j){ TCcluster c = makeCluster(outTr,j); outTr->addCluster(c); outEv->addCluster(c); } //"************* ---------------------------------------- *************************"<print(); TCalign* a = TCalign::getInstance("alignment/AlignmentFiles/simRealAlign1.txt"); a->clear(); a->read(alignmentfile); if(outTr->fit(1,2,3,4,5,6,7,8)){ outEv->addTrack(outTr); // outTr->print(); outTree->Fill(); } if(i%100==0){ cout<Write(); }