Moved this functionaly to a functio in AliL3Transform::MakeInitFile.
[u/mrichter/AliRoot.git] / HLT / exa / Make_Init.C
CommitLineData
086f41d8 1// $Id$
26a3eeae 2
086f41d8 3/**
e42b83c8 4 Macro to get the default parameters from AliTPCParam.
5 Output is written to a file, which can be inserted directly into
6 AliL3Transform.cxx as the default parameters to be set at top
26a3eeae 7*/
8
e42b83c8 9void Make_Init(char *tofile="Init.cxx")
10{
11 AliTPCParamSR *param = new AliTPCParamSR();
12 param->SetDefault();
13 if(!param)
14 {
15 cerr<<"AliL3Transform::MakeInitFile : No TPC parameters found"<<endl;
16 return;
17 }
18
6c481fe1 19 AliTPCPRF2D * prfinner = new AliTPCPRF2D;
e42b83c8 20 AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
21 AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
6c481fe1 22 AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
23 rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
24 rf->SetOffset(3*param->GetZSigma());
25 rf->Update();
26
27 TDirectory *savedir=gDirectory;
e42b83c8 28 TFile *f1=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
29 if (!f1->IsOpen())
30 {
31 cerr<<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !\n" ;
32 exit(3);
33 }
6c481fe1 34 prfinner->Read("prf_07504_Gati_056068_d02");
e42b83c8 35 prfouter1->Read("prf_10006_Gati_047051_d03");
36 prfouter2->Read("prf_15006_Gati_047051_d03");
37 f1->Close();
6c481fe1 38 savedir->cd();
39
40 param->SetInnerPRF(prfinner);
e42b83c8 41 param->SetOuter1PRF(prfouter1);
42 param->SetOuter2PRF(prfouter2);
6c481fe1 43 param->SetTimeRF(rf);
44
e42b83c8 45 Int_t fNTimeBins = param->GetMaxTBin()+1;
46 Int_t fNRowLow = param->GetNRowLow();
47 Int_t fNRowUp = param->GetNRowUp();
48 Int_t fNRowUp1 = param->GetNRowUp1();
49 Int_t fNRowUp2 = param->GetNRowUp2();
50 Int_t fNRow= fNRowLow + fNRowUp;
51 Int_t fNSectorLow = param->GetNInnerSector();
52 Int_t fNSectorUp = param->GetNOuterSector();
53 Int_t fNSector = fNSectorLow + fNSectorUp;
54 Int_t fNSlice = fNSectorLow;
6c481fe1 55
4ab9f8f0 56 FILE *f = fopen(tofile,"w");
e42b83c8 57 if(!f)
58 {
59 cerr<<"Error opening file "<<tofile<<endl;
60 return;
61 }
62 fprintf(f,"const Double_t AliL3Transform::fBFACT = 0.0029980;\n");
63 fprintf(f,"Double_t AliL3Transform::fBField = 0.2;\n");
64 fprintf(f,"Int_t AliL3Transform::fVersion = 0;\n");
65 fprintf(f,"Int_t AliL3Transform::fBFieldFactor = %d ;\n",gAlice->Field()->Factor());
4ab9f8f0 66 fprintf(f,"Int_t AliL3Transform::fNTimeBins = %d ;\n",fNTimeBins);
67 fprintf(f,"Int_t AliL3Transform::fNRowLow = %d ;\n",fNRowLow);
68 fprintf(f,"Int_t AliL3Transform::fNRowUp = %d ;\n",fNRowUp);
e42b83c8 69 fprintf(f,"Int_t AliL3Transform::fNRowUp1 = %d ;\n",fNRowUp1);
70 fprintf(f,"Int_t AliL3Transform::fNRowUp2 = %d ;\n",fNRowUp2);
4ab9f8f0 71 fprintf(f,"Int_t AliL3Transform::fNSectorLow = %d ;\n",fNSectorLow);
72 fprintf(f,"Int_t AliL3Transform::fNSectorUp = %d ;\n",fNSectorUp);
73 fprintf(f,"Int_t AliL3Transform::fNSector = %d ;\n",fNSector);
e42b83c8 74 fprintf(f,"Double_t AliL3Transform::fPadPitchWidthLow = %f ;\n",param->GetInnerPadPitchWidth());
75 fprintf(f,"Double_t AliL3Transform::fPadPitchWidthUp = %f ;\n",param->GetOuterPadPitchWidth());
76 fprintf(f,"Double_t AliL3Transform::fZWidth = %.20f ;\n",param->GetZWidth());
77 fprintf(f,"Double_t AliL3Transform::fZSigma = %.20f ;\n",param->GetZSigma());
78 fprintf(f,"Double_t AliL3Transform::fZLength = %.20f ;\n",param->GetZLength());
79 fprintf(f,"Double_t AliL3Transform::fZOffset = %.20f ;\n",param->GetZOffset());
80 fprintf(f,"Double_t AliL3Transform::fDiffT = %.20f ;\n",param->GetDiffT());
81 fprintf(f,"Double_t AliL3Transform::fDiffL = %.20f ;\n",param->GetDiffL());
82 fprintf(f,"Double_t AliL3Transform::fInnerPadLength = %f ;\n",param->GetInnerPadLength());
83 fprintf(f,"Double_t AliL3Transform::fOuter1PadLength = %f ;\n",param->GetOuter1PadLength());
84 fprintf(f,"Double_t AliL3Transform::fOuter2PadLength = %f ;\n",param->GetOuter2PadLength());
85 fprintf(f,"Double_t AliL3Transform::fInnerPRFSigma = %.20f ;\n",param->GetInnerPRF()->GetSigmaX());
86 fprintf(f,"Double_t AliL3Transform::fOuter1PRFSigma = %.20f ;\n",param->GetOuter1PRF()->GetSigmaX());
87 fprintf(f,"Double_t AliL3Transform::fOuter2PRFSigma = %.20f ;\n",param->GetOuter2PRF()->GetSigmaX());
88 fprintf(f,"Double_t AliL3Transform::fTimeSigma = %.20f ;\n",param->GetTimeRF()->GetSigma());
4ab9f8f0 89 fprintf(f,"Int_t AliL3Transform::fNSlice = %d ;\n",fNSectorLow);
90 fprintf(f,"Int_t AliL3Transform::fNRow = %d ;\n",fNRow);
e42b83c8 91 fprintf(f,"Int_t AliL3Transform::fNRotShift = 0.5 ;\n");
4ab9f8f0 92 fprintf(f,"Double_t AliL3Transform::fPi = %.15f ;\n",TMath::Pi());
e42b83c8 93
94 fprintf(f,"Double_t AliL3Transform::fX[159] = {");
4ab9f8f0 95 for(Int_t i=0;i<fNRow;i++){
96 int sec,row;
97 if( i < fNRowLow){sec =0;row =i;}
98 else{sec = fNSectorLow;row =i-fNRowLow;}
99
e42b83c8 100 fprintf(f," %3.15f,\n",param->GetPadRowRadii(sec,row));
4ab9f8f0 101 }
102 fprintf(f,"};\n\n");
103
e42b83c8 104 fprintf(f,"Int_t AliL3Transform::fNPads[159] = {");
4ab9f8f0 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;}
e42b83c8 109 fprintf(f," %d,\n",param->GetNPads(sec,row));
4ab9f8f0 110 }
e42b83c8 111
4ab9f8f0 112 fprintf(f,"};\n");
113 fclose(f);
114}