/* TTree Builder */ #include #include #include //#if !defined(__CINT__) || defined (__MAKECINT__) #include "TTree.h" #include "TFile.h" #include "TEllipse.h" #include "TLine.h" //#endif class Lastra; class Track; // FUNCTION CALLED BY THE MAIN ROUTINE // It defines object TRACK and fill a tree. void azione(ifstream* file,Lastra* lastra,double flip,double delta,const char* nome){ Double_t scalex,scaley; Int_t ncol,nrow,incx,incy; *file>>scalex>>scaley>>ncol>>nrow>>incx>>incy; Int_t nevt=0; // n. evento Int_t imx=0;// n. colonna campo Int_t imy=0;// n. riga campo Double_t u=0;// x-coord relativa al centro campo (pixel) Double_t v=0;// y-coord relativa al centro campo (pixel) Double_t xa=0;// x-coord relativa allo stage (motorstep = micron ) Double_t ya=0;// y-coord relativa allo stage (motorstep = micron ) Double_t xar=0;// x-coord relativa al primo campo (micron) Double_t yar=0;// y-coord relativa al primo campo (micron) Double_t semiasse_m=0;// semi asse minore Double_t semiasse_M=0;// semi asse maggiore Double_t ecc=0;// rapporto semiasse_minore/semiasse_maggiore Double_t sen=0;// seno dell'angolo polare tra il semiasse amaggiore e la coord. u Double_t sdfit=0;// standard deviation del fit all'ellisse Double_t area_calc=0;// area calcolata OK dell'ellisse Double_t brill=0;// brillantezza centrale della traccia Double_t pigreco=acos(-1); TTree* t1 = new TTree(nome,"Data on front of the CR39"); t1->Branch("lastra","Lastra",&lastra,320000,2); t1->Fill(); Track* trr = new Track(); t1->Branch("tracce","Track",&trr,320000,2); Double_t tZ,tp,tzen,tdzen,tarea; t1->Branch("Z",&tZ,"tZ/D"); t1->Branch("p",&tp,"tp/D"); t1->Branch("zen",&tzen,"tzen/D"); t1->Branch("dzen",&tdzen,"tdzen/D"); t1->Branch("area",&tarea,"tarea/D"); while (*file>> nevt>> imx>> imy>> u>> v>> xa>> ya>> xar>> yar>> semiasse_m>> semiasse_M>> ecc>> sen>> sdfit>> area_calc>> brill) // take the data till the end of the input file { // Construction of track object // double polar = -asin(flip*sen); // if(polar>0)polar = polar+pigreco; // double polar = asin(flip*sen); trr = new Track(flip*xar,yar,semiasse_M,semiasse_m,polar); tr = trr->rotate(flip*pigreco/2-flip*delta);// traccia corretta per il tilt trr = tr; Double_t tZ=tr.Z(lastra); Double_t tp=tr.p(lastra); Double_t tzen=tr.zen(lastra); Double_t tdzen=tr.DeltaZen(lastra); Double_t tarea=tr.area(); t1->Fill(); } cout<<"Tree "<Load("mylib/libLastra.so"); if(!TClassTable::GetDict("Track")) gSystem->Load("mylib/libTrack.so"); //#endif //--------------------------------------------------- //--------- Make the LIST of the data ascii file to process ------------------ system("rm -f lista.txt"); system("'ls' link | awk -F '.' '{print $0, $1}' >> lista.txt"); ifstream listafile("lista.txt"); ifstream *ff[26]; char nomeintero[20]; char nomecorto[20]; int luppa=0; string st[26]; while(listafile>>nomeintero>>nomecorto) { ff[luppa] = new ifstream(nomeintero); st[luppa]=nomecorto; luppa++; } //-------------------------------------------------------- //------------------ OUTPUT file------------------------------ Int_t scan = jin;//the id for the output file // define the OUTPUT file where I put all the trees char tfilname[17]; sprintf(tfilname,"lastra%d_obj.root",scan); TFile *rf = new TFile(tfilname,"RECREATE"); //-------------------------------------------------------- //---------------- Some objects and constants -------------------------- double flip = +1; // flip = -1 usa fb come se fosse ff; Int_t maskf[]={0}; // maschera eventi rigettati // DEFINIZIONE DELLA LASTRA // CR39 xx(micron/hour,hours,micron) Lastra *cr;// initialize Lastrs cr = new CR39(1.19,40,700); Double_t pigreco=acos(-1); Double_t delta = 89.888095*pigreco/180; //angolo di tilt del piano della telecamera //-------------------------------------------------------- //--------- This part is for the FRAME determination -------------- // convertitore micron -> pixel Double_t scalex =0; Double_t scaley =0; //griglia dei campi Int_t ncol=0; Int_t nrow=0; // step scansione Int_t incx=0; Int_t incy=0; *ff[0]>>scalex>>scaley>>ncol>>nrow>>incx>>incy; ff[0]->seekg(0,ios::beg); if(incx>0 && incy>0){ // definizioni range assi per la mappa Axis_t xminr = -double(incx)/2; Axis_t yminr = -double(incy)/2; Axis_t xMaxr = ncol*incx-xminr; Axis_t yMaxr = nrow*incy-yminr; int kf=+1; } else if (incx<0 && incy >0){ // definizioni range assi per la mappa Axis_t xMaxr = double(incx)/2;//98 Axis_t yminr = -double(incy)/2;//98 Axis_t xminr = ncol*incx+xMaxr;//98 Axis_t yMaxr = nrow*incy-yminr;//98 int kf=-1; } //-------------------------------------------------------- //------------ 1st tree the HEADER --------------------------- // now I fill the header // with some variables: // define the tree header TTree head("head","General information"); // define header branches head.Branch("xminr",&xminr, "xminr/D"); head.Branch("yminr",&yminr, "yminr/D"); head.Branch("xMaxr",&xMaxr, "xMaxr/D"); head.Branch("yMaxr",&yMaxr, "yMaxr/D"); head.Branch("kf",&kf, "kf/I"); head.Branch("ncol",&ncol, "ncol/I"); head.Branch("nrow",&nrow, "nrow/I"); head.Branch("incx",&incx, "incx/I"); head.Branch("incy",&incy, "incy/I"); head.Fill();// fill header cout<<"Header created!"<Write(); }