Put back the doxygen comments in MUONTRGda.cxx
[u/mrichter/AliRoot.git] / HMPID / HmpOADBParams.C
CommitLineData
310a3458 1// macro to create and store in the OADB the root file containing the refractive index
2// values to be used for nSigmas and probabiltiy calculation in the PID framework
3// HmpParams: the refractive index is "manually" assigned . One for each chamber, constant vs y.
4// HmpParamsFromOCDB: the refracitve index is calulated starting from the parameters stored in OCDB. One for each radiator, not constant vs y.
5// Contact: giacomo.volpe@cern.ch
6
7HmpParams(Int_t runFirst, Int_t runLast)
8{
9 Double_t sizePcY = 48.*0.84;
10
11 TObjArray *arrayDef = new TObjArray(7);
12 TObjArray *array = new TObjArray(7);
13
14 TF1 *f1[7], *fIdx[7];
15
16 for(Int_t iCh=0; iCh<7; iCh++){
17
18 f1[iCh] = new TF1(Form("f1_%i",iCh),"1.284",0,3.*sizePcY);
19 arrayDef->AddAt(f1[iCh],iCh);
20
21 fIdx[iCh] = new TF1(Form("fIdx_ch%i",iCh),"1.290",0,3.*sizePcY);
22
23 array->AddAt(fIdx[iCh],iCh);
24 }
25
26 AliOADBContainer* con = new AliOADBContainer("HMPoadb");
27
28 AliHMPIDPIDParams *pPar = new AliHMPIDPIDParams("HMPparams");
29 pPar->SetHMPIDrefIndex(array);
30 Printf("Populating HMPID OADB for period **");
31 con->AppendObject(pPar,runFirst,runLast);
32
33 AliHMPIDPIDParams *pParDefault = new AliHMPIDPIDParams("HMPparams");
34 pParDefault->SetHMPIDrefIndex(arrayDef);
35// Printf("Populating HMPID OADB with default entry",period.Data());
36 Printf("Populating HMPID OADB with default entry");
37 con->AddDefaultObject(pParDefault);
38
39 con->WriteToFile("HMPIDPIDParams.root");
40}
41//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42HmpParamsFromOCDB( Int_t year, Int_t runNumber, Int_t runFirst, Int_t runLast)
43{
44 Double_t sizePcY = 48.*0.84;
45
46 TGrid::Connect("alien://");
47
48 AliCDBManager *man = AliCDBManager::Instance();
49
50 man->SetDefaultStorage(Form("alien://folder=/alice/data/%i/OCDB",year));
51
52 man->SetRun(runNumber);
53
54 AliCDBEntry *entry = man->Get("HMPID/Calib/Nmean");
55
56 TObjArray *arr = (TObjArray*)entry->GetObject();
57
58 TF1 *fEmean = (TF1*)arr->At(42);
59
60 TObjArray *arrayDef = new TObjArray(21);
61 TObjArray *array = new TObjArray(21);
62
63 TF1 *f1[21], *fIdx[21];
64
65 for(Int_t iCh=0; iCh<7; iCh++){
66
67 for(Int_t iRad=0; iRad<3; iRad++){
68
69 f1[3*iCh+iRad] = new TF1(Form("f1_%i_%i",iCh,iRad),"1.290",iRad*sizePcY,(iRad+1)*sizePcY);
70 arrayDef->AddAt(f1[3*iCh+iRad],3*iCh+iRad);
71
72 TF1 *fIn = (TF1*)arr->At(6*iCh+2*iRad);
73 TF1 *fOut = (TF1*)arr->At(6*iCh+2*iRad+1);
74
75 Double_t xmin, xmax;
76
77 fIn->GetRange(xmin,xmax);
78
79 Double_t tempIn = fIn->Eval(0.5*(xmax+xmin));
80 Double_t tempOut = fOut->Eval(0.5*(xmax+xmin));
81
82 Double_t emean = fEmean->Eval(0.5*(xmax+xmin));
83
84 Double_t idxIn = AliHMPIDParam::NIdxRad(emean,tempIn);
85 Double_t idxOut = AliHMPIDParam::NIdxRad(emean,tempOut);
86
87 Printf("ch = %i, rad = %i,Tin = %f, Tout = %f, emean = %f, ----- Tin(xmin) = %f, Tin(xmax) = %f, Tout(xmin) = %f, Tout(xmax) = %f",iCh,iRad,tempIn,tempOut,emean,fIn->Eval(xmin),fIn->Eval(xmax),fOut->Eval(xmin),fOut->Eval(xmax));
88
89 if(tempOut<tempIn) tempOut = tempIn;
90
91 Double_t gradT = (tempOut - tempIn)/sizePcY;
92
93 TF1 *fTemp = new TF1(Form("Temp_%i_%i",iCh,iRad),Form("%f*x + %f",gradT,tempIn),iRad*sizePcY,(iRad+1)*sizePcY);
94
95 // fIdx[3*iCh+iRad] = new TF1(Form("fIdx_ch%i_rad%i",iCh,iRad),Form("sqrt(1+0.554*(1239.84/6.675)*(1239.84/6.675)/((1239.84/6.675)*(1239.84/6.675)-5769))-0.0005*(Temp_%i_%i-20)",iCh,iRad),iRad*sizePcY,(iRad+1)*sizePcY);
96 fIdx[3*iCh+iRad] = new TF1(Form("fIdx_ch%i_rad%i",iCh,iRad),"1.290",iRad*sizePcY,(iRad+1)*sizePcY);
97
98 array->AddAt(fIdx[3*iCh+iRad],3*iCh+iRad);
99 }
100
101 }
102
103 //TString period = "LHC10b";
104 //Int_t startTime;
105
106 AliOADBContainer* con = new AliOADBContainer("HMPoadb");
107
108 AliHMPIDPIDParams *pPar = new AliHMPIDPIDParams("HMPparams");
109 pPar->SetHMPIDrefIndex(array);
110 Printf("Populating HMPID OADB for period **");
111 con->AppendObject(pPar,runFirst,runLast);
112
113 AliHMPIDPIDParams *pParDefault = new AliHMPIDPIDParams("HMPparams");
114 pParDefault->SetHMPIDrefIndex(arrayDef);
115// Printf("Populating HMPID OADB with default entry",period.Data());
116 Printf("Populating HMPID OADB with default entry");
117 con->AddDefaultObject(pParDefault);
118
119 con->WriteToFile("HMPIDPIDParams.root");
120}