/* This script is generating gain curves from the ADC.C script. In addition number of points in graph must be changed. The fit that used must also be adjusted if needed. The output is for each layer. This data should be copied in one file that contain all parameters for gain curves. */ { gROOT->Reset(); gStyle->SetOptFit(); int ly,a,b; cout<<"Enter Layer # "<>ly; if(ly==1) {a=10; const b=30;} if(ly==2) {a=6; const b=24;} if(ly==3) {a=6; const b=22;} if(ly==4) {a=4; const b=12;} if(ly==5) {a=4; const b=12;} if(ly==6) {a=4; const b=12;} //================================================= LEFT ============================================================= double peakL_1[12]={1504.12, 3806.18, 3630.55, 2602.29, 2264.42, 2574.96, 2399.16, 4213.23, 924.68, 1788.41, 2079.88, 3064.96}; double peakLerr_1[12]={11.77, 29.25, 33.62, 16.39, 13.81, 14.72, 15.36, 42.94, 8.51, 11.44, 23.00, 27.10}; double VoltL_1[12]={-1279,-1410,-1465,-1304,-1329,-1291,-1301,-1296,-1198,-1282,-1349,-1417}; double peakL_2[12]={2767.20, 1996.17, 1902.69, 1806.53, 2442.67, 2181.09, 2327.17, 2152.88, 1999.75, 2111.14, 1996.17, 2226.17}; double peakLerr_2[12]={24.23, 17.20, 18.10, 10.93, 15.77, 14.58, 16.13, 23.25, 19.15, 14.41, 22.54, 18.18}; double VoltL_2[12]={-1345,-1350,-1400,-1270,-1340,-1275,-1300,-1230,-1275,-1300,-1350,-1380}; double peakL_3[12]={3321.97, 2553.82, 2355.89, 2344.11, 2816.96, 2369.36, 2555.11, 2321.12, 2595.54, 2565.03, 2297.59, 2527.26}; double peakLerr_3[12]={14.69, 10.79, 11.08, 7.74, 9.65, 9.24, 9.04, 13.09, 12.83, 9.54, 13.41, 11.37}; double VoltL_3[12]={-1365,-1375,-1420,-1295,-1355,-1284,-1310,-1240,-1300,-1320,-1365,-1395}; double peakL_4[12]={1298.76, 1028.06, 299.33, 833.32, 1082.46, 859.75, 946.21, 822.22, 940.55, 947.16, 892.32, 1011.49}; double peakLerr_4[12]={6.67, 5.47, 0.83, 3.38, 4.53, 3.90, 3.70, 4.46, 6.84, 3.56, 7.03, 5.50}; double VoltL_4[12]={-1265,-1275,-1220,-1195,-1255,-1184,-1210,-1140,-1200,-1220,-1265,-1295}; //================================================================================================================ //================================================= RIGHT ================================================================= double peakR_1[12]={1504.12, 3806.18, 3630.55, 2602.29, 2264.42, 2574.96, 2399.16, 4213.23, 924.68, 1788.41, 2079.88, 3064.96}; double peakRerr_1[12]={11.77, 29.25, 33.62, 16.39, 13.81, 14.72, 15.36, 42.94, 8.51, 11.44, 23.00, 27.10}; double VoltR_1[12]={-1279,-1410,-1465,-1304,-1329,-1291,-1301,-1296,-1198,-1282,-1349,-1417}; double peakR_2[12]={2767.20, 1996.17, 1902.69, 1806.53, 2442.67, 2181.09, 2327.17, 2152.88, 1999.75, 2111.14, 1996.17, 2226.17}; double peakRerr_2[12]={24.23, 17.20, 18.10, 10.93, 15.77, 14.58, 16.13, 23.25, 19.15, 14.41, 22.54, 18.18}; double VoltR_2[12]={-1345,-1350,-1400,-1270,-1340,-1275,-1300,-1230,-1275,-1300,-1350,-1380}; double peakR_3[12]={3321.97, 2553.82, 2355.89, 2344.11, 2816.96, 2369.36, 2555.11, 2321.12, 2595.54, 2565.03, 2297.59, 2527.26}; double peakRerr_3[12]={14.69, 10.79, 11.08, 7.74, 9.65, 9.24, 9.04, 13.09, 12.83, 9.54, 13.41, 11.37}; double VoltR_3[12]={-1365,-1375,-1420,-1295,-1355,-1284,-1310,-1240,-1300,-1320,-1365,-1395}; double peakR_4[12]={1298.76, 1028.06, 299.33, 833.32, 1082.46, 859.75, 946.21, 822.22, 940.55, 947.16, 892.32, 1011.49}; double peakRerr_4[12]={6.67, 5.47, 0.83, 3.38, 4.53, 3.90, 3.70, 4.46, 6.84, 3.56, 7.03, 5.50}; double VoltR_4[12]={-1265,-1275,-1220,-1195,-1255,-1184,-1210,-1140,-1200,-1220,-1265,-1295}; //===================================================================================================================== double xL[10]={0}; double yL[10]={0}; double yerrL[10]={0}; double xR[10]={0}; double yR[10]={0}; double yerrR[10]={0}; char titleL[200],titleR[200]; double xerr[10]={0}; double pL[30]={0}, pR[30]={0}, parL[30]={0}, parR[30]={0}, par1L[30]={0}, par1R[30]={0}; TCanvas c1; c1.Divide(3,a); TCanvas c2; c2.Divide(3,a); char function[100]; int n=12; sprintf(function,"[0]*x**%d+[1]",n); TF1 *f1=new TF1("fit1",function, -2500, -950); for(int i=0;i