#include "detector.h" #include "../../src/TCalign.h" #include "alignment.h" #include #include #include #include using namespace std; class sortDetector{ public: bool operator()(Detector *a1, Detector *a2){ return a1->getZ()getZ(); } }; void Alignment::generateTracks(int amount, double length, double startwidht, double startheight, double endheight, double endwidth) { TRandom3 random(0); for(int i=0;i ids = reader->getLoadedIDs(); // std::cout<<"ids vector size"<0&&ids[i]<20||ids[i]>50&&ids[i]<70){ TVector3 trans; TMatrixT rot(3,3); double pitch,res; double theta, phi, psi; TVector3 trans2; TMatrixT rot2(3,3); double pitch2,res2; double theta2, phi2, psi2; std::cout<<"id: "<getConv(ids[i],trans,rot,pitch,theta,phi,psi,res); reader->getConv(ids[i]+20,trans2,rot2,pitch2,theta2,phi2,psi2,res2); cout<<"theta="<getId(); hists_det.push_back(new TH1D(TString::Format("dU_%i",id),TString::Format("dU_%i",id),10000,-3,3)); profiles_det.push_back(new TProfile(TString::Format("dU_vs_U%i",id),TString::Format("dU_vs_U%i",id),1000,-3,3,-1,1)); } /* Here you can choose which alignment to run */ cout<<"Empty Histograms created"<getId(); if(detID==51||detID==52||detID==3||detID==4){ cout<<"Fix detid"<<(detectors[i]->getId())<getZ(); } } } zero =0.0; for( unsigned int i=0; igetId(); if(detID!=51&&detID!=52&&detID!=2&&detID!=4&&detID!=54){ double cosT_=detectors[i]->getCosT(); double sinT_=detectors[i]->getSinT(); double z=detectors[i]->getZ(); fixingX[NPARPLAN*i]=(float)cosT_/(z-z_fixed); fixingY[NPARPLAN*i]=(float)sinT_/(z-z_fixed); } } //constf_(fixingX,&zero); // constf_(fixingY,&zero); for(unsigned int i=0;i hit = detectors[j]->getHitU(tracks[i]); hists_det[j]->Fill(hit.second-hit.first); /*u_rec - u_hit*/ profiles_det[j]->Fill(hit.first,(hit.second-hit.first)); double x=detectors[j]->getX(); double y=detectors[j]->getY(); double cosT_=detectors[j]->getCosT(); double sinT_=detectors[j]->getSinT(); float u_hit=(float)hit.first+x*cosT_+y*sinT_ ; double z_=detectors[j]->getZ(); float sigma_=(float)detectors[j]->getSigma(); int detID = detectors[j]->getId(); if(i%1000==0&&detID!=51&&detID!=52&&detID!=2&&detID!=4&&detID!=5){ cout<<"detID "< ids = reader->getLoadedIDs(); for(unsigned int n=0;n rot(3,3); double pitch,res; double theta, phi, psi; cout<getId()<getConv(detectors[n]->getId(),trans,rot,pitch,theta,phi,psi,res); trans[0]+=par[NPARPLAN*n+0]; trans[1]+=par[NPARPLAN*n+1]; trans[2]+=par[NPARPLAN*n+2]; theta+=par[NPARPLAN*n+3]; pitch+=par[NPARPLAN*n+4]; cout<<"dTheta: "<setConv(detectors[n]->getId(),trans,rot,pitch,theta,phi,psi,res); } reader->write(outfile); //open file for histograms TFile* file = new TFile("histograms.root","RECREATE"); for(unsigned int i = 0; iWrite(); profiles_det[i]->Write(); } cout<<"Histograms written to file"<Close(); delete file; for(unsigned int i = 0; i