Commit 62586fc8 authored by Adrien Matta's avatar Adrien Matta
Browse files

* Fixing binning issue and Nebula fitting algorithm

parent dcbf1466
Pipeline #125167 failed with stages
in 13 minutes and 43 seconds
...@@ -3,13 +3,14 @@ TChain* MakeChain2(); ...@@ -3,13 +3,14 @@ TChain* MakeChain2();
TChain* MakeChain(); TChain* MakeChain();
TH2F* MakeTH2(); TH2F* MakeTH2();
TH2F* GetTH2(); TH2F* GetTH2();
TGraph* graph = new TGraph(200); TGraph* graph = new TGraph();
unsigned int point = 1;
double off; double off;
double c_light=299.792458;//mm/ns double c_light=299.792458;//mm/ns
auto chain = MakeChain(); auto chain = MakeChain();
void process1bar(int b); void process1bar(int b);
auto h = new TH2F("h","h",200,0,200,500,0,1000); auto h = new TH2F("h","h",200,0,201,500,0,1000);
auto r = new TH2F("r","r",200,0,200,10000,17000,20000); auto r = new TH2F("r","r",200,0,201,10000,17000,20000);
ofstream output("Calibration/Nebula/offset_gamma.txt"); ofstream output("Calibration/Nebula/offset_gamma.txt");
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void gamma(){ void gamma(){
...@@ -30,12 +31,13 @@ void gamma(){ ...@@ -30,12 +31,13 @@ void gamma(){
h=GetTH2(); h=GetTH2();
h->Draw("colz"); h->Draw("colz");
new TCanvas(); new TCanvas();
for(unsigned int i = 0 ; i < 160 ; i++){ unsigned int select =60;
if(i!=61) for(unsigned int i = 0 ; i < 150 ; i++){
if(i!=select)
process1bar(i); process1bar(i);
} }
process1bar(61); process1bar(select);
output.close(); output.close();
new TCanvas(); new TCanvas();
graph->Draw("ap"); graph->Draw("ap");
...@@ -46,33 +48,36 @@ void process1bar(int b){ ...@@ -46,33 +48,36 @@ void process1bar(int b){
//new TCanvas(); //new TCanvas();
// Get the Radius for the distance to this barre // Get the Radius for the distance to this barre
auto r1 = r->ProjectionY(Form("h%d",b),b,b+1); auto r1 = r->ProjectionY(Form("h%d",b),b,b+1);
r1->Rebin(4);
double R = r1->GetBinCenter(r1->GetMaximumBin()); double R = r1->GetBinCenter(r1->GetMaximumBin());
auto h1 = h->ProjectionY(Form("h%d",b),b,b+1); auto h1 = h->ProjectionY(Form("h%d",b),b,b+1);
h1->Rebin(4); h1->Rebin(8);
double max = h1->GetBinCenter(h1->GetMaximumBin()); double max = h1->GetBinCenter(h1->GetMaximumBin());
//h1->Draw(); //h1->Draw();
auto f = new TF1("f","crystalball(0)+pol1(5)",max-50,max+50); auto f = new TF1("f","gaus(0)+pol0(3)",max-100,max+100);
f->SetParameter(0,h1->GetMaximum()); f->SetParameter(0,h1->GetMaximum());
f->SetParameter(1,max); f->SetParameter(1,max);
f->SetParameter(2,35); f->SetParameter(2,5);
f->SetParameter(3,0.1); f->SetParameter(3,5);
f->SetParameter(4,1);
h1->Fit(f,"W"); h1->Fit(f,"R");
// Vbad = R/(TOF) -> TOF/R = 1/Vbad // Vbad = R/(TOF) -> TOF/R = 1/Vbad
// c= R/(TOF+X) -> (TOF+X)/R = 1/c -> TOF/R+X/R=1/c // c= R/(TOF+X) -> (TOF+X)/R = 1/c -> TOF/R+X/R=1/c
// 1/Vbad +X/R = 1/c // 1/Vbad +X/R = 1/c
// X=R*(1/c-1/Vbad) // X=R*(1/c-1/Vbad)
//double offset=R*(1/c_light-1/f->GetParameter(1)) ; double offset=R*(1/c_light-1/f->GetParameter(1)) ;
double offset=R*(1/c_light-1/h1->GetMean()) ; cout << "hello " << max-f->GetParameter(1) << endl;
//double offset=R*(1/c_light-1/max) ;
cout <<f->GetParameter(1) << " " << offset << " " << R/(f->GetParameter(1)-offset) << endl; cout <<f->GetParameter(1) << " " << offset << " " << R/(offset+R/f->GetParameter(1)) << endl;
if(offset>0){ if(offset>0){
output << "NEBULA_T_ID" << b << " " << offset << endl; output << "NEBULA_T_ID" << b << " " << offset << endl;
graph->SetPoint(b,b,offset); graph->Set(graph->GetN()+1);
cout << point <<" " << b << " " << offset << endl;
graph->SetPoint(graph->GetN()-1,b,offset);
} }
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
NEBULA_T_ID1 33.4905 NEBULA_T_ID0 34.5443
NEBULA_T_ID2 33.4387 NEBULA_T_ID1 34.6041
NEBULA_T_ID3 33.2579 NEBULA_T_ID2 34.7518
NEBULA_T_ID4 33.1961 NEBULA_T_ID3 34.6263
NEBULA_T_ID5 33.3351 NEBULA_T_ID4 34.7264
NEBULA_T_ID6 33.4268 NEBULA_T_ID5 34.7805
NEBULA_T_ID7 33.3499 NEBULA_T_ID6 34.7154
NEBULA_T_ID8 33.2878 NEBULA_T_ID7 34.7419
NEBULA_T_ID9 33.2271 NEBULA_T_ID8 34.4646
NEBULA_T_ID10 33.1101 NEBULA_T_ID9 34.5757
NEBULA_T_ID11 33.1321 NEBULA_T_ID10 34.6319
NEBULA_T_ID12 33.1597 NEBULA_T_ID11 34.684
NEBULA_T_ID13 33.1065 NEBULA_T_ID12 34.6671
NEBULA_T_ID14 33.1347 NEBULA_T_ID13 34.5219
NEBULA_T_ID15 33.2256 NEBULA_T_ID14 34.6426
NEBULA_T_ID16 33.146 NEBULA_T_ID15 34.6614
NEBULA_T_ID17 33.0473 NEBULA_T_ID16 34.5045
NEBULA_T_ID18 32.9851 NEBULA_T_ID17 34.2474
NEBULA_T_ID19 32.9804 NEBULA_T_ID18 34.3315
NEBULA_T_ID20 33.0581 NEBULA_T_ID19 34.4367
NEBULA_T_ID21 33.0919 NEBULA_T_ID20 34.3501
NEBULA_T_ID22 33.0102 NEBULA_T_ID21 34.4006
NEBULA_T_ID23 32.9368 NEBULA_T_ID22 34.2355
NEBULA_T_ID24 32.8589 NEBULA_T_ID23 34.1699
NEBULA_T_ID25 32.8442 NEBULA_T_ID24 34.3718
NEBULA_T_ID26 33.0195 NEBULA_T_ID25 34.6248
NEBULA_T_ID27 33.1863 NEBULA_T_ID26 34.3355
NEBULA_T_ID28 33.187 NEBULA_T_ID27 34.3709
NEBULA_T_ID29 33.3282 NEBULA_T_ID28 34.6222
NEBULA_T_ID30 33.195 NEBULA_T_ID29 34.8974
NEBULA_T_ID31 32.978 NEBULA_T_ID30 33.9325
NEBULA_T_ID32 33.3618 NEBULA_T_ID31 34.4291
NEBULA_T_ID33 33.3447 NEBULA_T_ID32 34.1664
NEBULA_T_ID34 33.3058 NEBULA_T_ID33 34.0149
NEBULA_T_ID35 33.3803 NEBULA_T_ID34 34.1137
NEBULA_T_ID36 33.4223 NEBULA_T_ID35 34.2463
NEBULA_T_ID37 33.5491 NEBULA_T_ID36 34.4991
NEBULA_T_ID38 33.2656 NEBULA_T_ID37 34.4827
NEBULA_T_ID39 33.1152 NEBULA_T_ID38 34.3254
NEBULA_T_ID40 33.1433 NEBULA_T_ID39 34.1954
NEBULA_T_ID41 33.192 NEBULA_T_ID40 34.0749
NEBULA_T_ID42 33.442 NEBULA_T_ID41 34.4117
NEBULA_T_ID43 33.5688 NEBULA_T_ID42 34.459
NEBULA_T_ID44 33.5181 NEBULA_T_ID43 34.2735
NEBULA_T_ID45 33.34 NEBULA_T_ID44 34.1037
NEBULA_T_ID46 33.214 NEBULA_T_ID45 34.3806
NEBULA_T_ID47 33.3359 NEBULA_T_ID46 34.4906
NEBULA_T_ID48 33.4933 NEBULA_T_ID47 34.5923
NEBULA_T_ID49 33.2248 NEBULA_T_ID48 34.4633
NEBULA_T_ID50 33.0666 NEBULA_T_ID49 34.307
NEBULA_T_ID51 33.0149 NEBULA_T_ID50 34.3805
NEBULA_T_ID52 33.111 NEBULA_T_ID51 34.3969
NEBULA_T_ID53 33.4055 NEBULA_T_ID52 34.588
NEBULA_T_ID54 33.3783 NEBULA_T_ID53 34.5001
NEBULA_T_ID55 33.263 NEBULA_T_ID54 34.5203
NEBULA_T_ID56 33.0668 NEBULA_T_ID55 34.5992
NEBULA_T_ID57 33.1642 NEBULA_T_ID56 34.0684
NEBULA_T_ID58 33.4036 NEBULA_T_ID57 34.8204
NEBULA_T_ID59 33.3579 NEBULA_T_ID58 35.1604
NEBULA_T_ID60 33.2143 NEBULA_T_ID59 35.1723
NEBULA_T_ID62 34.5329 NEBULA_T_ID61 34.1618
NEBULA_T_ID63 34.9431 NEBULA_T_ID62 33.8713
NEBULA_T_ID64 35.1015 NEBULA_T_ID63 34.8467
NEBULA_T_ID65 35.1265 NEBULA_T_ID64 34.6529
NEBULA_T_ID66 35.1442 NEBULA_T_ID65 34.9478
NEBULA_T_ID67 34.9116 NEBULA_T_ID66 34.8999
NEBULA_T_ID68 34.6604 NEBULA_T_ID67 34.2035
NEBULA_T_ID69 34.4462 NEBULA_T_ID68 33.7549
NEBULA_T_ID70 34.5221 NEBULA_T_ID69 33.9205
NEBULA_T_ID71 35.0051 NEBULA_T_ID70 34.2526
NEBULA_T_ID72 35.1518 NEBULA_T_ID71 33.7645
NEBULA_T_ID73 34.9795 NEBULA_T_ID72 33.983
NEBULA_T_ID74 34.941 NEBULA_T_ID73 34.254
NEBULA_T_ID75 34.864 NEBULA_T_ID74 34.2696
NEBULA_T_ID76 35.2727 NEBULA_T_ID75 34.5276
NEBULA_T_ID77 35.4467 NEBULA_T_ID76 34.8105
NEBULA_T_ID78 35.1904 NEBULA_T_ID77 34.1207
NEBULA_T_ID79 35.2455 NEBULA_T_ID78 33.8232
NEBULA_T_ID80 35.4184 NEBULA_T_ID79 34.3802
NEBULA_T_ID81 35.4121 NEBULA_T_ID80 34.6536
NEBULA_T_ID82 35.1133 NEBULA_T_ID81 33.795
NEBULA_T_ID83 35.1475 NEBULA_T_ID82 33.5954
NEBULA_T_ID84 35.1741 NEBULA_T_ID83 34.5733
NEBULA_T_ID85 34.7787 NEBULA_T_ID84 33.7437
NEBULA_T_ID86 34.914 NEBULA_T_ID85 34.0008
NEBULA_T_ID87 34.9607 NEBULA_T_ID86 34.138
NEBULA_T_ID88 34.5766 NEBULA_T_ID87 33.5396
NEBULA_T_ID89 34.5742 NEBULA_T_ID88 32.7999
NEBULA_T_ID90 34.7277 NEBULA_T_ID89 34.0736
NEBULA_T_ID91 34.6957 NEBULA_T_ID90 34.04
NEBULA_T_ID92 35.0481 NEBULA_T_ID91 34.4174
NEBULA_T_ID93 35.2177 NEBULA_T_ID92 34.4746
NEBULA_T_ID94 35.4574 NEBULA_T_ID93 34.1962
NEBULA_T_ID95 35.4506 NEBULA_T_ID94 33.9695
NEBULA_T_ID96 35.5051 NEBULA_T_ID95 34.0982
NEBULA_T_ID97 35.8906 NEBULA_T_ID96 34.6771
NEBULA_T_ID98 36.0723 NEBULA_T_ID97 34.5538
NEBULA_T_ID99 35.617 NEBULA_T_ID98 34.8161
NEBULA_T_ID100 35.4569 NEBULA_T_ID99 34.8409
NEBULA_T_ID101 35.5729 NEBULA_T_ID100 34.5276
NEBULA_T_ID102 35.3768 NEBULA_T_ID101 34.2538
NEBULA_T_ID103 35.482 NEBULA_T_ID102 34.3322
NEBULA_T_ID104 35.3516 NEBULA_T_ID103 34.6166
NEBULA_T_ID105 35.4782 NEBULA_T_ID104 34.7776
NEBULA_T_ID106 35.6773 NEBULA_T_ID105 34.9334
NEBULA_T_ID107 35.7758 NEBULA_T_ID106 34.6325
NEBULA_T_ID108 35.6255 NEBULA_T_ID107 34.0925
NEBULA_T_ID109 35.3739 NEBULA_T_ID108 34.449
NEBULA_T_ID110 35.141 NEBULA_T_ID109 33.5975
NEBULA_T_ID111 35.2823 NEBULA_T_ID110 33.6435
NEBULA_T_ID112 35.8331 NEBULA_T_ID111 34.4499
NEBULA_T_ID113 35.3862 NEBULA_T_ID112 34.3772
NEBULA_T_ID114 34.9962 NEBULA_T_ID113 33.4742
NEBULA_T_ID115 35.2729 NEBULA_T_ID114 33.9552
NEBULA_T_ID116 35.3663 NEBULA_T_ID115 33.8484
NEBULA_T_ID117 35.2767 NEBULA_T_ID116 34.4536
NEBULA_T_ID118 35.1023 NEBULA_T_ID117 34.7238
NEBULA_T_ID119 35.1875 NEBULA_T_ID118 34.8648
NEBULA_T_ID120 35.46 NEBULA_T_ID119 35.1404
NEBULA_T_ID121 32.8085 NEBULA_T_ID120 35.5016
NEBULA_T_ID122 32.7149 NEBULA_T_ID121 33.6429
NEBULA_T_ID123 32.7373 NEBULA_T_ID122 33.969
NEBULA_T_ID124 32.7586 NEBULA_T_ID123 34.1937
NEBULA_T_ID125 32.7595 NEBULA_T_ID124 34.3994
NEBULA_T_ID126 32.5096 NEBULA_T_ID125 34.4839
NEBULA_T_ID127 32.5093 NEBULA_T_ID126 34.4435
NEBULA_T_ID128 32.7319 NEBULA_T_ID127 34.313
NEBULA_T_ID129 32.7193 NEBULA_T_ID128 34.2042
NEBULA_T_ID130 32.6077 NEBULA_T_ID129 34.2139
NEBULA_T_ID131 32.5304 NEBULA_T_ID130 34.3013
NEBULA_T_ID132 32.2799 NEBULA_T_ID131 33.3367
NEBULA_T_ID133 32.5294 NEBULA_T_ID132 32.8974
NEBULA_T_ID134 34.6905 NEBULA_T_ID133 34.331
NEBULA_T_ID135 34.8101 NEBULA_T_ID134 34.3026
NEBULA_T_ID136 35.0837 NEBULA_T_ID135 34.6377
NEBULA_T_ID137 35.0707 NEBULA_T_ID136 34.7342
NEBULA_T_ID138 34.4088 NEBULA_T_ID137 34.4055
NEBULA_T_ID139 34.235 NEBULA_T_ID138 34.4339
NEBULA_T_ID140 34.2653 NEBULA_T_ID139 34.7883
NEBULA_T_ID141 34.3418 NEBULA_T_ID140 29.8549
NEBULA_T_ID142 34.6938 NEBULA_T_ID141 31.701
NEBULA_T_ID143 34.4649 NEBULA_T_ID142 34.8278
NEBULA_T_ID144 34.6477 NEBULA_T_ID143 34.4204
NEBULA_T_ID145 34.8407 NEBULA_T_ID144 34.0676
NEBULA_T_ID61 33.1146 NEBULA_T_ID60 34.2291
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment