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