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