bf4d737e34f1ad3fb98773590157cf5ecaaf899b
[u/mrichter/AliRoot.git] / HLT / exa / Make_Init.C
1 void make_init(char *file){
2
3   TFile * rootf = new TFile(file,"READ");
4
5   if(!rootf->IsOpen()){
6     cerr<<"no file: "<<file<<endl;
7     return;
8   }
9
10   AliTPCParam* par = (AliTPCParam*)rootf->Get("75x40_100x60");
11
12   if(!par){
13     cerr<<"no AliTPCParam 75x40_100x60 in file: "<<file<<endl;
14     return;
15   }
16
17   int fNRowLow = par->GetNRowLow();
18   int fNRowUp  = par->GetNRowUp();
19   int fNRow= fNRowLow+ fNRowUp;
20   int fNSectorLow = par->GetNInnerSector();
21   int fNSectorUp = par->GetNOuterSector();
22   int fNSector = fNSectorLow + fNSectorUp;
23   int fNSlice = fNSectorLow;
24
25   FILE *f = fopen("Init.cxx","w");
26   fprintf(f,"void AliL3Transform::Init(){\n");
27   fprintf(f,"  //sector:\n");
28   fprintf(f,"  fNRowLow = %d;\n",fNRowLow);
29   fprintf(f,"  fNRowUp = %d;\n",fNRowUp);
30   fprintf(f,"  fNSectorLow = %d;\n",fNSectorLow);
31   fprintf(f,"  fNSectorUp = %d;\n",fNSectorUp);
32   fprintf(f,"  fNSector = %d;\n",fNSector);
33   fprintf(f,"  fPadPitchWidthLow = %f;\n",par->GetPadPitchWidth(0));
34   fprintf(f,"  fPadPitchWidthUp = %f;\n",par->GetPadPitchWidth(fNSectorLow));
35   fprintf(f,"  fZWidth = %.20f;\n",par->GetZWidth());
36   fprintf(f,"  fZSigma = %.20f;\n",par->GetZSigma());
37   fprintf(f,"\n  //slices:\n");
38   fprintf(f,"  fNSlice = %d;\n",fNSectorLow);
39   fprintf(f,"  fNRow = %d;\n",fNRow);
40 //  fprintf(f,"  fPi = 3.14159265358979323846;\n");
41   fprintf(f,"  fPi = %.15f;\n",TMath::Pi());
42   fprintf(f,"  for(Int_t i=0;i<36;i++){\n");
43   fprintf(f,"    fCos[i] = cos(fPi/9*i);\n");
44   fprintf(f,"    fSin[i] = sin(fPi/9*i);\n");
45   fprintf(f,"  }\n\n");
46   for(Int_t i=0;i<fNRow;i++){
47     int sec,row;
48     if( i < fNRowLow){sec =0;row =i;}
49     else{sec = fNSectorLow;row =i-fNRowLow;}
50     fprintf(f,"  fX[%d] = %3.15f;\n",i,par->GetPadRowRadii(sec,row));
51   }
52   for(Int_t i=0;i<fNRow;i++){
53     int sec,row;
54     if( i < fNRowLow){sec =0;row =i;}
55     else{sec = fNSectorLow;row =i-fNRowLow;}
56     fprintf(f,"  fNPads[%d] = %d;\n",i,par->GetNPads(sec,row));
57   }
58
59   fprintf(f,"}\n");
60   fclose(f);
61 }