]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/Make_Init.C
Added some gas and electronic parameters.
[u/mrichter/AliRoot.git] / HLT / exa / Make_Init.C
1 /** $Id$ 
2
3 Important macro to get certain Aliroot parameters. They are stored
4 in a file "Init.cxx". Compare the contents of the class AliL3Transform
5 with the result of this macro to check that there are no differences.
6 */
7
8 void Make_Init(char *file, char *tofile="Init.cxx"){
9
10   TFile * rootf = new TFile(file,"READ");
11
12   if(!rootf->IsOpen()){
13     cerr<<"no file: "<<file<<endl;
14     return;
15   }
16
17   AliTPCParam* par = (AliTPCParam*)rootf->Get("75x40_100x60");
18
19   if(!par){
20     cerr<<"no AliTPCParam 75x40_100x60 in file: "<<file<<endl;
21     return;
22   }
23   
24   AliTPCParamSR *param=(AliTPCParamSR*)par;
25   AliTPCPRF2D    * prfinner   = new AliTPCPRF2D;
26   AliTPCPRF2D    * prfouter   = new AliTPCPRF2D;
27   AliTPCRF1D     * rf    = new AliTPCRF1D(kTRUE);
28   rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
29   rf->SetOffset(3*param->GetZSigma());
30   rf->Update();
31   
32   TDirectory *savedir=gDirectory;
33   TFile *if=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
34   if (!if->IsOpen()) { 
35     cerr<<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !\n" ;
36     exit(3);
37   }
38   prfinner->Read("prf_07504_Gati_056068_d02");
39   prfouter->Read("prf_10006_Gati_047051_d03");
40   if->Close();
41   savedir->cd();
42   
43   param->SetInnerPRF(prfinner);
44   param->SetOuterPRF(prfouter); 
45   param->SetTimeRF(rf);
46   
47   int fNTimeBins = par->GetMaxTBin()+1;
48   int fNRowLow = par->GetNRowLow();
49   int fNRowUp  = par->GetNRowUp();
50   int fNRow= fNRowLow + fNRowUp;
51   int fNSectorLow = par->GetNInnerSector();
52   int fNSectorUp = par->GetNOuterSector();
53   int fNSector = fNSectorLow + fNSectorUp;
54   int fNSlice = fNSectorLow;
55
56   FILE *f = fopen(tofile,"w");
57   fprintf(f,"void AliL3Transform::Init(){\n");
58
59   fprintf(f,"  //sector:\n");
60   fprintf(f,"  fNTimeBins = %d ;\n",fNTimeBins);
61   fprintf(f,"  fNRowLow = %d ;\n",fNRowLow);
62   fprintf(f,"  fNRowUp = %d ;\n",fNRowUp);
63   fprintf(f,"  fNSectorLow = %d ;\n",fNSectorLow);
64   fprintf(f,"  fNSectorUp = %d ;\n",fNSectorUp);
65   fprintf(f,"  fNSector = %d ;\n",fNSector);
66   fprintf(f,"  fPadPitchWidthLow = %f ;\n",par->GetPadPitchWidth(0));
67   fprintf(f,"  fPadPitchWidthUp = %f ;\n",par->GetPadPitchWidth(fNSectorLow));
68   fprintf(f,"  fZWidth = %.20f ;\n",par->GetZWidth());
69   fprintf(f,"  fZSigma = %.20f ;\n",par->GetZSigma());
70   fprintf(f,"  fZOffset = %.20f\n",par->GetZOffset());
71   fprintf(f,"  fDiffT = %.20f ;\n",par->GetDiffT());
72   fprintf(f,"  fDiffL = %.20f ;\n",par->GetDiffL());
73   fprintf(f,"  fInnerPadLength = %f\n",par->GetInnerPadLength());
74   fprintf(f,"  fOuterPadLength = %f\n",par->GetOuterPadLength());
75   fprintf(f,"  fInnerPRFSigma = %.20f\n",param->GetInnerPRF()->GetSigmaX());
76   fprintf(f,"  fOuterPRFSigma = %.20f\n",param->GetOuterPRF()->GetSigmaX());
77   fprintf(f,"  fTimeSigma = %.20f\n",param->GetTimeRF()->GetSigma());
78   fprintf(f,"  fZLength = %f\n",par->GetZLength());
79   
80   fprintf(f,"\n  //slices:\n");
81   fprintf(f,"  fNSlice = %d ;\n",fNSectorLow);
82   fprintf(f,"  fNRow = %d ;\n",fNRow);
83
84   //rotation shift put in by hand -> Constantin 
85   fprintf(f,"  fNRotShift = 0.5 ;\n");
86
87   fprintf(f,"  fPi = %.15f ;\n",TMath::Pi());
88   fprintf(f,"  for(Int_t i=0;i<36;i++){\n");
89   fprintf(f,"    fCos[i] = cos(2*fPi/9*(i+0.5));\n");
90   fprintf(f,"    fSin[i] = sin(2*fPi/9*(i+0.5));\n");
91   fprintf(f,"  }\n\n");
92
93   for(Int_t i=0;i<fNRow;i++){
94     int sec,row;
95     if( i < fNRowLow){sec =0;row =i;}
96     else{sec = fNSectorLow;row =i-fNRowLow;}
97     fprintf(f,"  fX[%d] = %3.15f ;\n",i,par->GetPadRowRadii(sec,row));
98   }
99   for(Int_t i=0;i<fNRow;i++){
100     int sec,row;
101     if( i < fNRowLow){sec =0;row =i;}
102     else{sec = fNSectorLow;row =i-fNRowLow;}
103     fprintf(f,"  fNPads[%d] = %d ;\n",i,par->GetNPads(sec,row));
104   }
105
106   fprintf(f,"}\n");
107   fclose(f);
108 }
109
110 void Make_Default(char *file,char *tofile)
111 {
112   /*
113     Macro to write out default values, which should be used to initialize
114     the static data members of the AliL3Transform class. Macro does more
115     or less the same as the above, only the output syntax is changed in order
116     to use it for static data member initialization.
117   */
118   
119   TFile * rootf = new TFile(file,"READ");
120   
121   if(!rootf->IsOpen()){
122     cerr<<"no file: "<<file<<endl;
123     return;
124   }
125
126   AliTPCParam* par = (AliTPCParam*)rootf->Get("75x40_100x60");
127
128   if(!par){
129     cerr<<"no AliTPCParam 75x40_100x60 in file: "<<file<<endl;
130     return;
131   }
132
133   int fNTimeBins = par->GetMaxTBin()+1;
134   int fNRowLow = par->GetNRowLow();
135   int fNRowUp  = par->GetNRowUp();
136   int fNRow= fNRowLow + fNRowUp;
137   int fNSectorLow = par->GetNInnerSector();
138   int fNSectorUp = par->GetNOuterSector();
139   int fNSector = fNSectorLow + fNSectorUp;
140   int fNSlice = fNSectorLow;
141
142   FILE *f = fopen(tofile,"w");
143   fprintf(f,"Int_t AliL3Transform::fNTimeBins = %d ;\n",fNTimeBins);
144   fprintf(f,"Int_t AliL3Transform::fNRowLow = %d ;\n",fNRowLow);
145   fprintf(f,"Int_t AliL3Transform::fNRowUp = %d ;\n",fNRowUp);
146   fprintf(f,"Int_t AliL3Transform::fNSectorLow = %d ;\n",fNSectorLow);
147   fprintf(f,"Int_t AliL3Transform::fNSectorUp = %d ;\n",fNSectorUp);
148   fprintf(f,"Int_t AliL3Transform::fNSector = %d ;\n",fNSector);
149   fprintf(f,"Double_t AliL3Transform::fPadPitchWidthLow = %f ;\n",par->GetPadPitchWidth(0));
150   fprintf(f,"Double_t AliL3Transform::fPadPitchWidthUp = %f ;\n",par->GetPadPitchWidth(fNSectorLow));
151   fprintf(f,"Double_t AliL3Transform::fZWidth = %.20f ;\n",par->GetZWidth());
152   fprintf(f,"Double_t AliL3Transform::fZSigma = %.20f ;\n",par->GetZSigma());
153   fprintf(f,"Int_t AliL3Transform::fNSlice = %d ;\n",fNSectorLow);
154   fprintf(f,"Int_t AliL3Transform::fNRow = %d ;\n",fNRow);
155   fprintf(f,"Double_t AliL3Transform::fNRotShift = 0.5 ;\n");
156   fprintf(f,"Double_t AliL3Transform::fPi = %.15f ;\n",TMath::Pi());
157   fprintf(f,"Double_t AliL3Transform::fX[176] = {\n");
158   for(Int_t i=0;i<fNRow;i++){
159     int sec,row;
160     if( i < fNRowLow){sec =0;row =i;}
161     else{sec = fNSectorLow;row =i-fNRowLow;}
162     
163   fprintf(f,"                                    %3.15f,\n",par->GetPadRowRadii(sec,row));
164   }
165   fprintf(f,"};\n\n");
166   
167   fprintf(f,"Int_t AliL3Transform::fNPads[176] = {\n");
168   for(Int_t i=0;i<fNRow;i++){
169     int sec,row;
170     if( i < fNRowLow){sec =0;row =i;}
171     else{sec = fNSectorLow;row =i-fNRowLow;}
172   fprintf(f,"                                     %d,\n",par->GetNPads(sec,row));
173   }
174   fprintf(f,"};\n");
175   fclose(f);
176 }