add fNTimeBins
[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 fNTimeBins = 446;
18   int fNRowLow = par->GetNRowLow();
19   int fNRowUp  = par->GetNRowUp();
20   int fNRow= fNRowLow+ fNRowUp;
21   int fNSectorLow = par->GetNInnerSector();
22   int fNSectorUp = par->GetNOuterSector();
23   int fNSector = fNSectorLow + fNSectorUp;
24   int fNSlice = fNSectorLow;
25
26   FILE *f = fopen("Init.cxx","w");
27   fprintf(f,"void AliL3Transform::Init(){\n");
28   fprintf(f,"  //sector:\n");
29   fprintf(f,"  fNTimeBins = %d;\n",fNTimeBins);
30   fprintf(f,"  fNRowLow = %d;\n",fNRowLow);
31   fprintf(f,"  fNRowUp = %d;\n",fNRowUp);
32   fprintf(f,"  fNSectorLow = %d;\n",fNSectorLow);
33   fprintf(f,"  fNSectorUp = %d;\n",fNSectorUp);
34   fprintf(f,"  fNSector = %d;\n",fNSector);
35   fprintf(f,"  fPadPitchWidthLow = %f;\n",par->GetPadPitchWidth(0));
36   fprintf(f,"  fPadPitchWidthUp = %f;\n",par->GetPadPitchWidth(fNSectorLow));
37   fprintf(f,"  fZWidth = %.20f;\n",par->GetZWidth());
38   fprintf(f,"  fZSigma = %.20f;\n",par->GetZSigma());
39   fprintf(f,"\n  //slices:\n");
40   fprintf(f,"  fNSlice = %d;\n",fNSectorLow);
41   fprintf(f,"  fNRow = %d;\n",fNRow);
42 //  fprintf(f,"  fPi = 3.14159265358979323846;\n");
43   fprintf(f,"  fPi = %.15f;\n",TMath::Pi());
44   fprintf(f,"  for(Int_t i=0;i<36;i++){\n");
45   fprintf(f,"    fCos[i] = cos(fPi/9*i);\n");
46   fprintf(f,"    fSin[i] = sin(fPi/9*i);\n");
47   fprintf(f,"  }\n\n");
48   for(Int_t i=0;i<fNRow;i++){
49     int sec,row;
50     if( i < fNRowLow){sec =0;row =i;}
51     else{sec = fNSectorLow;row =i-fNRowLow;}
52     fprintf(f,"  fX[%d] = %3.15f;\n",i,par->GetPadRowRadii(sec,row));
53   }
54   for(Int_t i=0;i<fNRow;i++){
55     int sec,row;
56     if( i < fNRowLow){sec =0;row =i;}
57     else{sec = fNSectorLow;row =i-fNRowLow;}
58     fprintf(f,"  fNPads[%d] = %d;\n",i,par->GetNPads(sec,row));
59   }
60
61   fprintf(f,"}\n");
62   fclose(f);
63 }