-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeuteron.cpp
2934 lines (2524 loc) · 107 KB
/
Deuteron.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <fstream>
#include "Deuteron.h"
#include "EnvVars.h"
#include "CATS.h"
#include "CATStools.h"
#include "DLM_Source.h"
#include "DLM_Potentials.h"
#include "CommonAnaFunctions.h"
#include "CATSconstants.h"
#include "DLM_Histo.h"
#include "DLM_RootWrapper.h"
#include "DLM_MathFunctions.h"
#include "DLM_Ck.h"
#include "DLM_CkDecomposition.h"
#include "DLM_HistoAnalysis.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TFile.h"
#include "TF1.h"
#include "TRandom3.h"
#include "TTree.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TCanvas.h"
//s-wave only
void p_pn_cumulant(){
//estimated, based on pN = 1/2 pd, that the mT of the pN (N is p or n from the deuteron)
//that for mT(pd) = 1.65 we have mT(pN) of c.a. 1.3, so an effective radius of c.a. 1.25
const double SourceSize = 1.25;
const double lambda = 0.8/8.;
const double NumMomBins = 300;
const unsigned Reb = 20;
const double kMin = 0;
const double kMax = 600;
CATSparameters cSource(CATSparameters::tSource,2,true);
cSource.SetParameter(0,SourceSize);
cSource.SetParameter(1,2);
CATSparameters cPot_pp_1s0(CATSparameters::tPotential,8,true);
double pp_pars_1s0[8]={NN_AV18,v18_Coupled3P2,1,1,1,0,0,0};
cPot_pp_1s0.SetParameters(pp_pars_1s0);
CATSparameters cPot_pn_1s0(CATSparameters::tPotential,8,true);
//#,#,POT_ID,POT_FLAG,t_tot,t1,t2,s,l,j
double pn_pars_1s0[8]={NN_AV18,v18_Coupled3P2,1,1,-1,0,0,0};
cPot_pn_1s0.SetParameters(pn_pars_1s0);
CATSparameters cPot_pn_3s1(CATSparameters::tPotential,8,true);
double pn_pars_3s1[8]={NN_AV18,v18_Coupled3P2,1,1,-1,1,0,1};
cPot_pn_3s1.SetParameters(pn_pars_3s1);
CATS Cat_pp;
Cat_pp.SetMomBins(NumMomBins,kMin,kMax);
Cat_pp.SetThetaDependentSource(false);
Cat_pp.SetAnaSource(GaussSource, cSource);
Cat_pp.SetUseAnalyticSource(true);
Cat_pp.SetMomentumDependentSource(false);
Cat_pp.SetExcludeFailedBins(false);
Cat_pp.SetQ1Q2(1);
Cat_pp.SetQuantumStatistics(true);
Cat_pp.SetRedMass( 0.5*Mass_p );
Cat_pp.SetNumChannels(2);
Cat_pp.SetNumPW(0,1);
Cat_pp.SetNumPW(1,0);
Cat_pp.SetSpin(0,0);
Cat_pp.SetSpin(1,1);
Cat_pp.SetChannelWeight(0, 1./4.);
Cat_pp.SetChannelWeight(1, 3./4.);
Cat_pp.SetShortRangePotential(0,0,fDlmPot,cPot_pp_1s0);
Cat_pp.SetEpsilonConv(10e-8);
Cat_pp.SetEpsilonProp(10e-8);
Cat_pp.KillTheCat();
CATS Cat_pn;
Cat_pn.SetMomBins(NumMomBins,kMin,kMax);
Cat_pn.SetThetaDependentSource(false);
Cat_pn.SetAnaSource(GaussSource, cSource);
Cat_pn.SetUseAnalyticSource(true);
Cat_pn.SetMomentumDependentSource(false);
Cat_pn.SetExcludeFailedBins(false);
Cat_pn.SetQ1Q2(0);
//Cat_pn.SetPdgId(2212, 2112);
Cat_pn.SetQuantumStatistics(false);
Cat_pn.SetRedMass( (Mass_p*Mass_n)/(Mass_p+Mass_n) );
Cat_pn.SetNumChannels(2);
Cat_pn.SetNumPW(0,1);
Cat_pn.SetNumPW(1,1);
Cat_pn.SetSpin(0,0);
Cat_pn.SetSpin(1,1);
Cat_pn.SetChannelWeight(0, 1./4.);
Cat_pn.SetChannelWeight(1, 3./4.);
Cat_pn.SetShortRangePotential(0,0,fDlmPot,cPot_pn_1s0);
Cat_pn.SetShortRangePotential(1,0,fDlmPot,cPot_pn_3s1);
Cat_pn.SetEpsilonConv(10e-8);
Cat_pn.SetEpsilonProp(10e-8);
Cat_pn.KillTheCat();
TFile fInputME(TString::Format("%s/Deuteron/pd_files/UnfoldedME.root",GetFemtoOutputFolder()),"read");
TDirectoryFile* dirResults=(TDirectoryFile*)(fInputME.FindObjectAny("GraphHistoVar_0"));
printf("dirResults = %p\n",dirResults);
TH1F* hMeUnf=NULL;
dirResults->GetObject("hTotalME _Rebinned_10_Reweighted",hMeUnf);
printf("hMeUnf = %p\n",hMeUnf);
hMeUnf->Sumw2();
hMeUnf->Scale(1./hMeUnf->Integral(),"width");
TF1* fit_Me = new TF1("fit_Me",GaussSourceTF1,0,600,1);
fit_Me->SetParameter(0,400);
hMeUnf->Fit(fit_Me,"S, N, R, M");
TFile fOutput(TString::Format("%s/Deuteron/p_pn_cumulant.root",GetFemtoOutputFolder()),"recreate");
hMeUnf->Write();
fit_Me->Write();
TGraph graph_pp;
graph_pp.SetName("graph_pp");
graph_pp.SetLineWidth(5);
graph_pp.SetLineColor(kBlue);
graph_pp.SetLineStyle(7);
TGraph graph_pn;
graph_pn.SetName("graph_pn");
graph_pn.SetLineWidth(5);
graph_pn.SetLineColor(kGreen+2);
graph_pn.SetLineStyle(2);
TGraph graph_pp_x_pn;
graph_pp_x_pn.SetName("graph_pp_x_pn");
graph_pp_x_pn.SetLineWidth(5);
graph_pp_x_pn.SetLineColor(kBlack);
TH1F* weighted_pp_x_pn = new TH1F("weighted_pp_x_pn","weighted_pp_x_pn",NumMomBins/Reb*2.,kMin,kMax*2.);
weighted_pp_x_pn->SetLineWidth(5);
weighted_pp_x_pn->SetLineColor(kAzure+2);
TH1F* weighted2_pp_x_pn = new TH1F("weighted2_pp_x_pn","weighted2_pp_x_pn",NumMomBins/Reb*2.,kMin,kMax*2.);
weighted2_pp_x_pn->SetLineWidth(5);
weighted2_pp_x_pn->SetLineColor(kAzure+2);
for(unsigned uBin=0; uBin<NumMomBins/Reb*2.; uBin++){
weighted_pp_x_pn->SetBinContent(uBin+1,1);
weighted2_pp_x_pn->SetBinContent(uBin+1,1);
}
double kstar,c_pp,c_pn;
int wBin=0;
double CkInt=0;
double CkNorm=0;
for(unsigned uBin=0; uBin<NumMomBins; uBin++){
kstar = Cat_pp.GetMomentum(uBin);
c_pp = lambda*Cat_pp.EvalCorrFun(kstar*0.75)+1.-lambda;
c_pn = lambda*Cat_pn.EvalCorrFun(kstar*0.75)+1.-lambda;
graph_pp.SetPoint(uBin,kstar,c_pp);
graph_pn.SetPoint(uBin,kstar,c_pn);
graph_pp_x_pn.SetPoint(uBin,kstar,c_pp*c_pn);
CkInt += (c_pp*c_pn)*fit_Me->Eval(kstar);
CkNorm += fit_Me->Eval(kstar);
//the last bin
if((uBin+1)%Reb==0){
double BinCenter = 20;
BinCenter += (40.)*double(wBin);
if(wBin==0) BinCenter = 30;
if(BinCenter<kMax/0.75){
weighted_pp_x_pn->SetBinContent(wBin+1,CkInt/CkNorm);
weighted2_pp_x_pn->SetBinContent(wBin+1,graph_pp_x_pn.Eval(BinCenter));
}
else{
weighted_pp_x_pn->SetBinContent(wBin+1,1);
weighted2_pp_x_pn->SetBinContent(wBin+1,1);
}
CkInt=0;
CkNorm=0;
wBin++;
}
}
graph_pp.Write();
graph_pn.Write();
graph_pp_x_pn.Write();
weighted_pp_x_pn->Write();
weighted2_pp_x_pn->Write();
delete weighted_pp_x_pn;
}
void SetUpKaonDeuteronFSI(CATS& cat, TString FSI_type){
}
void SetUpKaonDeuteronSource(CATS& cat, TString Source_type){
}
//takes the output of SetUp_Kdp_Kd, to produce the correlation functions
//in addition, it creates some basic correlations to compare to, see below (some extra files are set up there !)
// /that is 9% (so 91% the genuine)
// pol1 to fit
void MyOwn_Kd_v1(){
//1.04 original, 0.96 updated
const double SourceSize = 1.04;
//const double lam_gen = 0.91;//real values
const double lam_gen = 1.0;
const double avg_mt = 1500;
DLM_CommonAnaFunctions AnalysisObject;
AnalysisObject.SetCatsFilesFolder(TString::Format("%s/CatsFiles",GetCernBoxDimi()).Data());
double kMin = 0;
double kMax = 400;
unsigned kSteps = 20;
TGraph* gCk_ER_CECA_Tau = NULL;
/*
gCk_ER_CECA_Tau = new TGraph [21];
//here we create the graphs for different taus
DLM_Histo<KdpPars> dlm_kdp_3D;
dlm_kdp_3D.QuickLoad(TString::Format("%s/dKaon/SetUp_Kdp_Kd/Full_v1/dlm_kdp_3D.dlm",GetCernBoxDimi()).Data());
//printf("dim = %u\n",dlm_kdp_3D.GetDim());
//for(int iDim=0; iDim<3; iDim++){
// printf(" D%i: %i; %.2f <> %.2f\n",iDim, dlm_kdp_3D.GetNbins(iDim), dlm_kdp_3D.GetLowEdge(iDim), dlm_kdp_3D.GetUpEdge(iDim));
//}
//dlm_kdp_3D.GetBinContent(int(0)).Print();
//return;
DLM_MtKstar_KdpSource source_kdp(&dlm_kdp_3D);
CATS Kd_ER_CECA_Tau;
Kd_ER_CECA_Tau.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_CECA_Tau,"DG_ER","",0,0);//NLO_Coupled_S
Kd_ER_CECA_Tau.SetUseAnalyticSource(true);
Kd_ER_CECA_Tau.SetMomentumDependentSource(true);
Kd_ER_CECA_Tau.SetAnaSource(CatsSourceForwarder, &source_kdp, 2);
Kd_ER_CECA_Tau.SetAnaSource(0, avg_mt);
for(int iTau=0; iTau<21; iTau++){
double Tau = double(iTau)*0.5;
//if(Tau==0) Tau = 0.01;
gCk_ER_CECA_Tau[iTau].SetName(TString::Format("gCk_ER_CECA_Tau_%.2f",Tau));
gCk_ER_CECA_Tau[iTau].SetLineColor(kOrange+iTau);
gCk_ER_CECA_Tau[iTau].SetLineWidth(3);
Kd_ER_CECA_Tau.SetAnaSource(1, Tau);
Kd_ER_CECA_Tau.KillTheCat();
for(unsigned uPts=0; uPts<kSteps; uPts++){
double kstar = Kd_ER_CECA_Tau.GetMomentum(uPts);
gCk_ER_CECA_Tau[iTau].SetPoint(uPts,kstar,Kd_ER_CECA_Tau.GetCorrFun(uPts)*lam_gen+1-lam_gen);
}
}
*/
//here we define from which file we would like to take a CECA kstar integrated source
//TFile fSrcInput(TString::Format("%s/FunWithCeca/Ceca_Kd_EffFix/old/CECA_Kd_Source.root",GetFemtoOutputFolder()),"read");
//TFile fSrcInput(TString::Format("%s/dKaon/Source/Full/CECA_Kd_Source_t3.root",GetCernBoxDimi()),"read");
TFile fSrcInput(TString::Format("%s/FunWithCeca/Ceca_KdReso_FAST/Eta0.8_KdReso_ET1_PR1_DD0.0_EF-1402.root",GetFemtoOutputFolder()),"read");
TH1F* GhettoFemto_rstar = (TH1F*)fSrcInput.Get("GhettoFemto_rstar");
DLM_Histo<float>* dlmGhettoFemto_rstar = Convert_TH1F_DlmHisto(GhettoFemto_rstar);
DLM_HistoSource dlmCecaSource(dlmGhettoFemto_rstar);
CATS Kd_ER;
Kd_ER.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER,"DG_ER","McGauss_ResoTM",0,202);//NLO_Coupled_S
Kd_ER.SetAnaSource(0, SourceSize);
Kd_ER.KillTheCat();
CATS Kd_ER_G;
Kd_ER_G.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_G,"DG_ER","DoubleGauss",0,0);//NLO_Coupled_S
//Kd_ER_G.SetAnaSource(0, 1.1);//old source
//Kd_ER_G.SetAnaSource(1, 2.14);//old source
Kd_ER_G.SetAnaSource(0, 1.04);//updated source
Kd_ER_G.SetAnaSource(1, 2.01);//updated source
Kd_ER_G.SetAnaSource(2, 0.76);
Kd_ER_G.KillTheCat();
CATS Kd_ER_CECA;
Kd_ER_CECA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_CECA,"DG_ER","",0,0);//NLO_Coupled_S
Kd_ER_CECA.SetUseAnalyticSource(true);
Kd_ER_CECA.SetAnaSource(CatsSourceForwarder, &dlmCecaSource, 0);
Kd_ER_CECA.KillTheCat();
CATS Kd_FCA;
Kd_FCA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_FCA,"DG_FCA","McGauss_ResoTM",0,202);//NLO_Coupled_S
Kd_FCA.SetAnaSource(0, SourceSize);
Kd_FCA.KillTheCat();
CATS Kd_FCA_G;
Kd_FCA_G.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_FCA_G,"DG_ER","DoubleGauss",0,0);//NLO_Coupled_S
//Kd_FCA_G.SetAnaSource(0, 1.1);//old source
//Kd_FCA_G.SetAnaSource(1, 2.14);//old source
Kd_FCA_G.SetAnaSource(0, 1.04);//updated source
Kd_FCA_G.SetAnaSource(1, 2.01);//updated source
Kd_FCA_G.SetAnaSource(2, 0.76);
Kd_FCA_G.KillTheCat();
TGraph gCk_ER;
gCk_ER.SetName("gCk_ER");
gCk_ER.SetLineColor(kCyan);
gCk_ER.SetLineWidth(6);
TGraph gCk_ER_G;
gCk_ER_G.SetName("gCk_ER_G");
gCk_ER_G.SetLineColor(kCyan+1);
gCk_ER_G.SetLineWidth(5);
TGraph gCk_ER_CECA;
gCk_ER_CECA.SetName("gCk_ER_CECA");
gCk_ER_CECA.SetLineColor(kCyan+2);
gCk_ER_CECA.SetLineWidth(5);
TGraph gCk_FCA;
gCk_FCA.SetName("gCk_FCA");
gCk_FCA.SetLineColor(kAzure+1);
gCk_FCA.SetLineWidth(4);
TGraph gCk_FCA_G;
gCk_FCA_G.SetName("gCk_FCA_G");
gCk_FCA_G.SetLineColor(kAzure+2);
gCk_FCA_G.SetLineWidth(5);
double rMin = 0;
double rMax = 64;
unsigned rSteps = 4096;
TH1F* hSrc_RSM = new TH1F("hSrc_RSM","hSrc_RSM",rSteps,rMin,rMax);
TH1F* hSrc_DG = new TH1F("hSrc_DG","hSrc_DG",rSteps,rMin,rMax);
for(unsigned uPts=0; uPts<kSteps; uPts++){
double kstar = Kd_ER.GetMomentum(uPts);
gCk_ER.SetPoint(uPts,kstar,Kd_ER.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_ER_G.SetPoint(uPts,kstar,Kd_ER_G.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_ER_CECA.SetPoint(uPts,kstar,Kd_ER_CECA.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_FCA.SetPoint(uPts,kstar,Kd_FCA.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_FCA_G.SetPoint(uPts,kstar,Kd_FCA_G.GetCorrFun(uPts)*lam_gen+1-lam_gen);
}
for(unsigned uRad=0; uRad<rSteps; uRad++){
double rstar = hSrc_RSM->GetBinCenter(uRad+1);
double src_rsm = Kd_ER.EvaluateTheSource(1,rstar,0);
double src_dg = Kd_ER_G.EvaluateTheSource(1,rstar,0);
hSrc_RSM->SetBinContent(uRad+1,src_rsm);
hSrc_DG->SetBinContent(uRad+1,src_dg);
}
TFile fOutput(TString::Format("%s/Deuteron/MyOwn_Kd_v1/MyOwn_Kd_v1_Full.root",GetFemtoOutputFolder()),"recreate");
gCk_ER.Write();
gCk_ER_G.Write();
gCk_ER_CECA.Write();
gCk_FCA.Write();
gCk_FCA_G.Write();
for(int iTau=0; iTau<21; iTau++){
if(gCk_ER_CECA_Tau)
gCk_ER_CECA_Tau[iTau].Write();
}
hSrc_RSM->Write();
hSrc_DG->Write();
if(gCk_ER_CECA_Tau)
delete [] gCk_ER_CECA_Tau;
delete hSrc_RSM;
delete hSrc_DG;
delete dlmGhettoFemto_rstar;
}
//in frascatti, compare to LL, produce the needed output for Oton
void MyOwn_Kd_v2(){
//1.04 original, 0.96 updated
const double SourceSize = 1.04;
//const double lam_gen = 0.91;//real values
const double lam_gen = 1.0;
const double avg_mt = 1500;
DLM_CommonAnaFunctions AnalysisObject;
AnalysisObject.SetCatsFilesFolder(TString::Format("%s/CatsFiles",GetCernBoxDimi()).Data());
double kMin = 0;
double kMax = 400;
unsigned kSteps = 100;
double ScatLen, EffRan;
TH1F* hFit;
TF1* fitSP;
CATS Kd_ER;
Kd_ER.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER,"DG_ER","Gauss",0,202);//NLO_Coupled_S
Kd_ER.SetAnaSource(0, SourceSize);
Kd_ER.KillTheCat();
CATS Kd_ER_G;
Kd_ER_G.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_G,"DG_ER","DoubleGauss",0,0);//NLO_Coupled_S
//Kd_ER_G.SetAnaSource(0, 1.1);//old source
//Kd_ER_G.SetAnaSource(1, 2.14);//old source
Kd_ER_G.SetAnaSource(0, 1.04);//updated source
Kd_ER_G.SetAnaSource(1, 2.01);//updated source
Kd_ER_G.SetAnaSource(2, 0.76);
Kd_ER_G.SetQ1Q2(0);
Kd_ER_G.KillTheCat();
GetScattParameters(Kd_ER_G, ScatLen, EffRan, hFit, fitSP, 3, false, false, 0);
printf("ER DG Scattering Parameters: f0 = %.2f, d0 = %.2f\n", ScatLen, EffRan);
Kd_ER_G.SetQ1Q2(1);
Kd_ER_G.KillTheCat();
CATS Kd_ER_SG_1fm;
Kd_ER_SG_1fm.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_SG_1fm,"DG_ER","Gauss",0,0);//NLO_Coupled_S
Kd_ER_SG_1fm.SetAnaSource(0, 1);
Kd_ER_SG_1fm.KillTheCat();
CATS Kd_ER_SG_3fm;
Kd_ER_SG_3fm.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_ER_SG_3fm,"DG_ER","Gauss",0,0);//NLO_Coupled_S
Kd_ER_SG_3fm.SetAnaSource(0, 3);
Kd_ER_SG_3fm.KillTheCat();
CATS Kd_FCA;
Kd_FCA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_FCA,"DG_FCA","McGauss_ResoTM",0,202);//NLO_Coupled_S
Kd_FCA.SetAnaSource(0, SourceSize);
Kd_FCA.KillTheCat();
CATS Kd_FCA_G;
Kd_FCA_G.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_FCA_G,"DG_FCA","DoubleGauss",0,0);//NLO_Coupled_S
//Kd_FCA_G.SetAnaSource(0, 1.1);//old source
//Kd_FCA_G.SetAnaSource(1, 2.14);//old source
Kd_FCA_G.SetAnaSource(0, 1.04);//updated source
Kd_FCA_G.SetAnaSource(1, 2.01);//updated source
Kd_FCA_G.SetAnaSource(2, 0.76);
Kd_FCA_G.KillTheCat();
CATS Kd_FCA_SG;
Kd_FCA_SG.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_FCA_SG,"DG_FCA","Gauss",0,0);//NLO_Coupled_S
Kd_FCA_SG.SetAnaSource(0, 3);
Kd_FCA_SG.KillTheCat();
//square well potential,see mail from Johann @ CERN on 27.11.2024
CATS Kd_SW_G;
Kd_SW_G.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_SW_G,"SW_ER","DoubleGauss",0,0);//NLO_Coupled_S
//Kd_ER_G.SetAnaSource(0, 1.1);//old source
//Kd_ER_G.SetAnaSource(1, 2.14);//old source
Kd_SW_G.SetAnaSource(0, 1.04);//updated source
Kd_SW_G.SetAnaSource(1, 2.01);//updated source
Kd_SW_G.SetAnaSource(2, 0.76);
Kd_SW_G.SetQ1Q2(0);
Kd_SW_G.KillTheCat();
GetScattParameters(Kd_SW_G, ScatLen, EffRan, hFit, fitSP, 3, false, false, 0);
printf("Square Well Scattering Parameters: f0 = %.2f, d0 = %.2f\n", ScatLen, EffRan);
Kd_SW_G.SetQ1Q2(1);
Kd_SW_G.KillTheCat();
CATS Kd_SW_SG_1fm;
Kd_SW_SG_1fm.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_SW_SG_1fm,"SW_ER","Gauss",0,0);//NLO_Coupled_S
Kd_SW_SG_1fm.SetAnaSource(0, 1);
Kd_SW_SG_1fm.KillTheCat();
CATS Kd_SW_SG_3fm;
Kd_SW_SG_3fm.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_SW_SG_3fm,"SW_ER","Gauss",0,0);//NLO_Coupled_S
Kd_SW_SG_3fm.SetAnaSource(0, 3);
Kd_SW_SG_3fm.KillTheCat();
TGraph gCk_ER;
gCk_ER.SetName("gCk_ER");
gCk_ER.SetLineColor(kCyan);
gCk_ER.SetLineWidth(6);
TGraph gCk_ER_G;
gCk_ER_G.SetName("gCk_ER_G");
gCk_ER_G.SetLineColor(kCyan+1);
gCk_ER_G.SetLineWidth(5);
TGraph gCk_ER_SG_1fm;
gCk_ER_SG_1fm.SetName("gCk_ER_SG_1fm");
gCk_ER_SG_1fm.SetLineColor(kCyan+3);
gCk_ER_SG_1fm.SetLineWidth(5);
TGraph gCk_ER_SG_3fm;
gCk_ER_SG_3fm.SetName("gCk_ER_SG_3fm");
gCk_ER_SG_3fm.SetLineColor(kCyan-2);
gCk_ER_SG_3fm.SetLineWidth(5);
TGraph gCk_ER_CECA;
gCk_ER_CECA.SetName("gCk_ER_CECA");
gCk_ER_CECA.SetLineColor(kCyan+2);
gCk_ER_CECA.SetLineWidth(5);
TGraph gCk_SWER_G;
gCk_SWER_G.SetName("gCk_SWER_G");
gCk_SWER_G.SetLineColor(kCyan-1);
gCk_SWER_G.SetLineWidth(5);
TGraph gCk_SWER_SG_1fm;
gCk_SWER_SG_1fm.SetName("gCk_SWER_SG_1fm");
gCk_SWER_SG_1fm.SetLineColor(kCyan-3);
gCk_SWER_SG_1fm.SetLineWidth(5);
TGraph gCk_SWER_SG_3fm;
gCk_SWER_SG_3fm.SetName("gCk_SWER_SG_3fm");
gCk_SWER_SG_3fm.SetLineColor(kCyan-4);
gCk_SWER_SG_3fm.SetLineWidth(5);
TGraph gCk_FCA;
gCk_FCA.SetName("gCk_FCA");
gCk_FCA.SetLineColor(kAzure+1);
gCk_FCA.SetLineWidth(4);
TGraph gCk_FCA_G;
gCk_FCA_G.SetName("gCk_FCA_G");
gCk_FCA_G.SetLineColor(kAzure+2);
gCk_FCA_G.SetLineWidth(5);
TGraph gCk_FCA_SG;
gCk_FCA_SG.SetName("gCk_FCA_SG");
gCk_FCA_SG.SetLineColor(kAzure+3);
gCk_FCA_SG.SetLineWidth(5);
double rMin = 0;
double rMax = 64;
unsigned rSteps = 4096;
TH1F* hSrc_RSM = new TH1F("hSrc_RSM","hSrc_RSM",rSteps,rMin,rMax);
TH1F* hSrc_DG = new TH1F("hSrc_DG","hSrc_DG",rSteps,rMin,rMax);
for(unsigned uPts=0; uPts<kSteps; uPts++){
double kstar = Kd_ER.GetMomentum(uPts);
gCk_ER.SetPoint(uPts,kstar,Kd_ER.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_ER_G.SetPoint(uPts,kstar,Kd_ER_G.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_ER_SG_1fm.SetPoint(uPts,kstar,Kd_ER_SG_1fm.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_ER_SG_3fm.SetPoint(uPts,kstar,Kd_ER_SG_3fm.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_FCA.SetPoint(uPts,kstar,Kd_FCA.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_FCA_G.SetPoint(uPts,kstar,Kd_FCA_G.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_FCA_SG.SetPoint(uPts,kstar,Kd_FCA_SG.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_SWER_G.SetPoint(uPts,kstar,Kd_SW_G.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_SWER_SG_1fm.SetPoint(uPts,kstar,Kd_SW_SG_1fm.GetCorrFun(uPts)*lam_gen+1-lam_gen);
gCk_SWER_SG_3fm.SetPoint(uPts,kstar,Kd_SW_SG_3fm.GetCorrFun(uPts)*lam_gen+1-lam_gen);
}
for(unsigned uRad=0; uRad<rSteps; uRad++){
double rstar = hSrc_RSM->GetBinCenter(uRad+1);
double src_rsm = Kd_ER.EvaluateTheSource(1,rstar,0);
double src_dg = Kd_ER_G.EvaluateTheSource(1,rstar,0);
hSrc_RSM->SetBinContent(uRad+1,src_rsm);
hSrc_DG->SetBinContent(uRad+1,src_dg);
}
TFile fOutput(TString::Format("%s/Deuteron/MyOwn_Kd_v2/MyOwn_Kd_v2_Full.root",GetFemtoOutputFolder()),"recreate");
gCk_ER.Write();
gCk_ER_G.Write();
gCk_ER_SG_1fm.Write();
gCk_ER_SG_3fm.Write();
gCk_SWER_G.Write();
gCk_SWER_SG_1fm.Write();
gCk_SWER_SG_3fm.Write();
gCk_FCA.Write();
gCk_FCA_G.Write();
gCk_FCA_SG.Write();
hSrc_RSM->Write();
hSrc_DG->Write();
delete hSrc_RSM;
delete hSrc_DG;
}
//takes the CECA output, and creates a KDP file with certain settings for the kstar and mT.
//the output will contain the full mt binnig so that we can better estimate the source for a specific mT,
//but has a single kstar bin, that is integrated up to a cutoff value (100 MeV to mimic CECA paper)
//the input file is NOT the root, but the DLM_Histo
void MyOwn_Kd_v2_CreateKdp(double kstar_cutoff=100){
TFile fSummary(TString::Format("%s/dKaon/Frascati/Sources/kdp_maps_full_v2.root",GetCernBoxDimi()), "recreate");
std::vector<double> DD = {0,0.5,1.0,1.5,2.0,2.25,2.5,3.0,3.5,4.0,4.5,4.75,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0};
//std::vector<double> DD = {0,3.0};
std::vector<double> DD_bins;
DD_bins.push_back( DD.at(0) - (DD.at(1)-DD.at(0))*0.5 );
for(unsigned uEl=0; uEl<DD.size()-1; uEl++){
DD_bins.push_back( (DD.at(uEl+1)+DD.at(uEl))*0.5 );
}
DD_bins.push_back( DD.at(DD.size()-1) + (DD.at(DD.size()-1)-DD.at(DD.size()-2))*0.5 );
//for(unsigned uEl=0; uEl<DD.size()+1; uEl++){
// printf("%.3f ", DD_bins.at(uEl));
//}
//printf("\n");
//return;
std::vector<float> KR = {47.16, 52.40, 57.64};
std::vector<TString> SPAR = {"FIT","NLO19"};
std::vector<TString> TYPE = {"Kd","KdReso"};
for(TString& sTYPE : TYPE){
printf("sTYPE = %s\n",sTYPE.Data());
for(TString& sSPAR : SPAR){
printf(" sSPAR = %s\n",sSPAR.Data());
for(float& fKR : KR){
printf(" fKR = %.3f\n",fKR);
//this will be a 2D kdp map in mt and d_delay
DLM_Histo<KdpPars>* dlm_kdp_map = NULL;
for(double& fDD : DD){
printf(" fDD = %.3f\n",fDD);
TString InputFileName = TString::Format("%s/dKaon/Frascati/Sources/Raw/%s/Eta0.8_%s_PR35.78_KR%.2f_DD%.2f.Ghetto_kstar_rstar_mT",
GetCernBoxDimi(), sSPAR.Data(), sTYPE.Data(), fKR, fDD);
DLM_Histo<float> dlmSrc;
dlmSrc.QuickLoad(InputFileName.Data());
dlmSrc.ComputeError();
DLM_Histo<float> dlmSrc_trimmed;
dlmSrc_trimmed.SetUp(3);
dlmSrc_trimmed.SetUp(0,1,0,kstar_cutoff);
dlmSrc_trimmed.SetUp(1,dlmSrc,1);//rstar
dlmSrc_trimmed.SetUp(2,dlmSrc,2);//mT
dlmSrc_trimmed.Initialize();
for(unsigned uKstar=0; uKstar<dlmSrc.GetNbins(0); uKstar++){
double kstar = dlmSrc.GetBinCenter(0, uKstar);
if(kstar>kstar_cutoff) break;
for(unsigned uRstar=0; uRstar<dlmSrc.GetNbins(1); uRstar++){
for(unsigned uMt=0; uMt<dlmSrc.GetNbins(2); uMt++){
double current_value = dlmSrc_trimmed.GetBinContent(0, uRstar, uMt);
double current_error = dlmSrc_trimmed.GetBinError(0, uRstar, uMt);
dlmSrc_trimmed.SetBinContent(0, uRstar, uMt, current_value + dlmSrc.GetBinContent(uKstar, uRstar, uMt));
dlmSrc_trimmed.SetBinError(0, uRstar, uMt, sqrt(current_error*current_error + pow(dlmSrc.GetBinError(uKstar, uRstar, uMt),2.)));
}
}
}
//takes a 3D histo of Kstar Rstar Mt and returns a 2D kdp histo of Mt Kstar (in that order)
DLM_Histo<KdpPars>* dlm_kdp_2D = Convert_3Dsource_Kdp(dlmSrc_trimmed,true,3,96,3);
//DLM_Histo<KdpPars>* dlm_kdp_2D_kstar = Convert_3Dsource_Kdp(dlmSrc,true,3,96,3);
//we create the 2D kdp histo, including tau, at the first iteration
if(dlm_kdp_map==NULL){
dlm_kdp_map = new DLM_Histo<KdpPars>();
dlm_kdp_map->SetUp(2);
dlm_kdp_map->SetUp(0, *dlm_kdp_2D, 0);//mT
double* a_DD_bins = &DD_bins[0];
double* a_DD = &DD[0];
dlm_kdp_map->SetUp(1, DD.size(), a_DD_bins, a_DD);
dlm_kdp_map->Initialize();
}
//we fill up the whole big histo
for(unsigned uMt=0; uMt<dlm_kdp_2D->GetNbins(0); uMt++){
dlm_kdp_map->SetBinContent(uMt, dlm_kdp_map->GetBin(1, fDD), dlm_kdp_2D->GetBinContent(uMt, 0));
}
TString base_name = TString::Format("%s_%s_PR35.78_KR%.2f_DD%.2f", sSPAR.Data(), sTYPE.Data(), fKR, fDD);
fSummary.cd();
TH1F* hSource = new TH1F("hSource_"+base_name, "hSource_"+base_name, 4096, 0, 64);
TGraph* gSource = new TGraph();
gSource->SetName("gSource_"+base_name);
double eval_at[2];
eval_at[0] = 1500;
eval_at[1] = kstar_cutoff*0.5;
KdpPars current_kdp = dlm_kdp_2D->Eval(eval_at);
//KdpPars current_kdp = dlm_kdp_2D->GetBinContent(2, 0);
//dlm_kdp_2D->GetBinContent(1, 0).Print();
//dlm_kdp_2D->GetBinContent(2, 0).Print();
//dlm_kdp_2D->GetBinContent(3, 0).Print();
//current_kdp.Print();
//printf("%f\n", dlm_kdp_2D->GetBinCenter(0, 0));
//printf("%f\n", dlm_kdp_2D->GetBinCenter(0, 1));
//printf("%f\n", dlm_kdp_2D->GetBinCenter(0, 2));
//printf("%f\n", dlm_kdp_2D->GetBinCenter(0, 3));
//printf("%f\n", dlm_kdp_2D->GetBinCenter(0, 4));
for(unsigned uRad=0; uRad<hSource->GetNbinsX(); uRad++){
double rstar = hSource->GetBinCenter(uRad+1);
double src = PoissonSum(rstar, current_kdp);
hSource->SetBinContent(uRad+1, src);
gSource->SetPoint(uRad, rstar, src);
}
DLM_Histo<float>* dlmSource = Convert_TH1F_DlmHisto(hSource);
DLM_CommonAnaFunctions AnalysisObject;
AnalysisObject.SetCatsFilesFolder(TString::Format("%s/CatsFiles",GetCernBoxDimi()).Data());
double kMin = 0;
double kMax = 400;
unsigned kSteps = 40;
//printf("hello\n");
CATS Kd_DG_ER_CECA;
Kd_DG_ER_CECA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_DG_ER_CECA,"DG_ER","",0,0);
DLM_HistoSource dlmCecaSource(dlmSource);
Kd_DG_ER_CECA.SetAnaSource(CatsSourceForwarder, &dlmCecaSource, 0);
Kd_DG_ER_CECA.SetUseAnalyticSource(true);
Kd_DG_ER_CECA.SetAutoNormSource(false);
Kd_DG_ER_CECA.SetNormalizedSource(true);
Kd_DG_ER_CECA.SetNotifications(CATS::nWarning);
Kd_DG_ER_CECA.KillTheCat();
TGraph gCk_DG_ER;
gCk_DG_ER.SetName("gCk_DG_ER_"+base_name);
for(unsigned uKstar=0; uKstar<kSteps; uKstar++){
double kstar = Kd_DG_ER_CECA.GetMomentum(uKstar);
gCk_DG_ER.SetPoint(uKstar, kstar, Kd_DG_ER_CECA.GetCorrFun(uKstar));
}
CATS Kd_SW_ER_CECA;
Kd_SW_ER_CECA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_SW_ER_CECA,"SW_ER","",0,0);
//DLM_HistoSource dlmCecaSource(dlmSource);
Kd_SW_ER_CECA.SetAnaSource(CatsSourceForwarder, &dlmCecaSource, 0);
Kd_SW_ER_CECA.SetUseAnalyticSource(true);
Kd_SW_ER_CECA.SetAutoNormSource(false);
Kd_SW_ER_CECA.SetNormalizedSource(true);
Kd_SW_ER_CECA.SetNotifications(CATS::nWarning);
Kd_SW_ER_CECA.KillTheCat();
TGraph gCk_SW_ER;
gCk_SW_ER.SetName("gCk_SW_ER_"+base_name);
for(unsigned uKstar=0; uKstar<kSteps; uKstar++){
double kstar = Kd_SW_ER_CECA.GetMomentum(uKstar);
gCk_SW_ER.SetPoint(uKstar, kstar, Kd_SW_ER_CECA.GetCorrFun(uKstar));
}
/*
CATS Kd_DG_ER_CECA_kstar;
Kd_DG_ER_CECA_kstar.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_DG_ER_CECA_kstar,"DG_ER","",0,0);
DLM_MtKstar_KdpSource source_kdp(dlm_kdp_2D_kstar);
Kd_DG_ER_CECA_kstar.SetUseAnalyticSource(true);
Kd_DG_ER_CECA_kstar.SetMomentumDependentSource(true);
Kd_DG_ER_CECA_kstar.SetAnaSource(CatsSourceForwarder, &source_kdp, 2);
Kd_DG_ER_CECA_kstar.SetAnaSource(0, 1500);
Kd_DG_ER_CECA_kstar.SetAutoNormSource(false);
Kd_DG_ER_CECA_kstar.SetNormalizedSource(true);
Kd_DG_ER_CECA_kstar.SetNotifications(CATS::nWarning);
Kd_DG_ER_CECA_kstar.KillTheCat();
TGraph gCk_DG_ER_kstar;
gCk_DG_ER_kstar.SetName("gCk_DG_ER_kstar_"+base_name);
for(unsigned uKstar=0; uKstar<kSteps; uKstar++){
double kstar = Kd_DG_ER_CECA_kstar.GetMomentum(uKstar);
gCk_DG_ER_kstar.SetPoint(uKstar, kstar, Kd_DG_ER_CECA_kstar.GetCorrFun(uKstar));
}
*/
CATS Kd_DG_FCA_CECA;
Kd_DG_FCA_CECA.SetMomBins(kSteps, kMin, kMax);
AnalysisObject.SetUpCats_Kd(Kd_DG_FCA_CECA,"DG_FCA","",0,0);
//DLM_HistoSource dlmCecaSource(dlmSource);
Kd_DG_FCA_CECA.SetAnaSource(CatsSourceForwarder, &dlmCecaSource, 0);
Kd_DG_FCA_CECA.SetUseAnalyticSource(true);
Kd_DG_FCA_CECA.SetAutoNormSource(false);
Kd_DG_FCA_CECA.SetNormalizedSource(true);
Kd_DG_FCA_CECA.SetNotifications(CATS::nWarning);
Kd_DG_FCA_CECA.KillTheCat();
TGraph gCk_DG_FCA;
gCk_DG_FCA.SetName("gCk_DG_FCA_"+base_name);
for(unsigned uKstar=0; uKstar<kSteps; uKstar++){
double kstar = Kd_DG_FCA_CECA.GetMomentum(uKstar);
gCk_DG_FCA.SetPoint(uKstar, kstar, Kd_DG_FCA_CECA.GetCorrFun(uKstar));
}
//printf("hello\n");
fSummary.cd();
gSource->Write();
hSource->Write();
//gCk_DG_ER_kstar.Write();
gCk_DG_ER.Write();
gCk_SW_ER.Write();
gCk_DG_FCA.Write();
//printf("hello2\n");
delete hSource;
delete gSource;
delete dlmSource;
delete dlm_kdp_2D;
//printf("hello3\n");
}//fDD
//printf("hello4\n");
dlm_kdp_map->QuickWrite(TString::Format("%s/dKaon/Frascati/Sources/kdp_map_%s_%s_PR35.78_KR%.2f.dlm",
GetCernBoxDimi(),sSPAR.Data(), sTYPE.Data(), fKR), true);
delete dlm_kdp_map;
}
}
}
}
//it creates a TGraph, which though will have to be deleted later by you
//example: TGraph* MyGraph = MyOwn_Kd_v2_InterpolateCk(...);
// --- do something ---
// delete MyGraph;
//InputFileName -> full path to the kdp_maps file that you use
//FSI_type -> DG_ER or SW_ER or DG_FCA
//CECA_type -> FIT or NLO19
//d_type -> Kd or KdReso
//KR_val -> 47.16 or 52.40 or 57.64
//binning -> the currectly available delay_step
TGraph* MyOwn_Kd_v2_InterpolateCk(TString InputFileName, TString FSI_type, TString CECA_type, TString d_type, double KR_val, double delay_val, double delay_step = 0.5){
TFile InputFile(InputFileName, "read");
TGraph* gCkFinal = NULL;
//if we are almost demanding a specific existing step
if( fabs((delay_val/delay_step) - TMath::Nint(delay_val/delay_step))<1e-4 ){
InputFile.Get(TString::Format("gCk_"));
return gCkFinal;
}
}
void Check_Source_Means(){
TFile fSummary(TString::Format("%s/dKaon/Frascati/Sources/kdp_maps_full_v2.root",GetCernBoxDimi()), "read");
TH1F* hSource_A_up = (TH1F*)fSummary.Get("hSource_FIT_KdReso_PR35.78_KR47.16_DD1.00");
TH1F* hSource_A_low = (TH1F*)fSummary.Get("hSource_FIT_KdReso_PR35.78_KR57.64_DD1.00");
TH1F* hSource_B_up = (TH1F*)fSummary.Get("hSource_FIT_Kd_PR35.78_KR47.16_DD1.00");
TH1F* hSource_B_low = (TH1F*)fSummary.Get("hSource_FIT_Kd_PR35.78_KR57.64_DD1.00");
double mean_A_up = hSource_A_up->GetMean();
TF1* fSource = new TF1("fSource",NormDoubleGaussSourceTF1,0,100,4);
fSource->FixParameter(3,1);
fSource->FixParameter(0,1.10+0.04);
fSource->FixParameter(1,2.14+0.03);
fSource->FixParameter(2,0.76);
double prx_mean_up = fSource->Mean(0, 100);
fSource->FixParameter(3,1);
fSource->FixParameter(0,1.10-0.04);
fSource->FixParameter(1,2.14-0.07);
fSource->FixParameter(2,0.76);
double prx_mean_low = fSource->Mean(0, 100);
double prx_mean = 0.5*(prx_mean_up+prx_mean_low);
double prx_err = 0.5*(prx_mean_up-prx_mean_low);
double SceA_up = hSource_A_up->GetMean();
double SceA_low = hSource_A_low->GetMean();
double SceA_mean = 0.5*(SceA_up+SceA_low);
double SceA_err = 0.5*(SceA_up-SceA_low);
double SceB_up = hSource_B_up->GetMean();
double SceB_low = hSource_B_low->GetMean();
double SceB_mean = 0.5*(SceB_up+SceB_low);
double SceB_err = 0.5*(SceB_up-SceB_low);
printf("PRX: %.3f +/- %.3f\n",prx_mean,prx_err);
printf("SCA: %.3f +/- %.3f\n",SceA_mean,SceA_err);
printf("SCB: %.3f +/- %.3f\n",SceB_mean,SceB_err);
//TH1F* hSource_DG_up;
//TH1F* hSource_DG_low;
}
void MyOwn_Kd_v2_CreateCk(TString InputFile, TString OutputFile){
}
//creates a KDP source, where the dimensions are mt, kstar, tau(delay)
void SetUp_Kdp_Kd(){
DLM_Histo<KdpPars>* dlm_kdp_3D = NULL;
//cout << sizeof(KdpPars) << endl;
double Chi2;
TH1F* hSrc;
int tau_min = 0;
int tau_max = 0;
int tau_absolute_max = 0;
std::vector<TString> list_of_files;
for(int iTau=tau_min; iTau<=tau_max; iTau++){
//printf("iTau = %i\n",iTau);
list_of_files.push_back(TString::Format("%s/dKaon/Source/Full/Eta0.8_Kd_ET1_PR1_DD%i.0_EF-1402.Ghetto_kstar_rstar_mT",GetCernBoxDimi(),iTau));
}
for(int iTau=tau_min; iTau<=tau_max; iTau++){
DLM_Histo<float> dlmSrc;
dlmSrc.QuickLoad(list_of_files.at(iTau));
dlmSrc.ComputeError();
//takes a 3D histo of Kstar Rstar Mt and returns a 2D kdp histo of Mt Kstar (in that order)
printf("hi\n");
DLM_Histo<KdpPars>* dlm_kdp_2D = Convert_3Dsource_Kdp(dlmSrc,true,3,96,3);
//we create the 3D kdp histo, including tau, at the first iteration
if(dlm_kdp_3D==NULL){
printf("A\n");
dlm_kdp_3D = new DLM_Histo<KdpPars>();
dlm_kdp_3D->SetUp(3);
printf("B\n");
dlm_kdp_3D->SetUp(0, *dlm_kdp_2D, 0);
printf("C\n");
dlm_kdp_3D->SetUp(1, *dlm_kdp_2D, 1);
printf("D\n");
dlm_kdp_3D->SetUp(2, tau_absolute_max+1, -0.5, double(tau_absolute_max)+0.5);
printf("E\n");
dlm_kdp_3D->Initialize();
}
//we fill up the whole big histo
for(unsigned uMt=0; uMt<dlm_kdp_2D->GetNbins(0); uMt++){
for(unsigned uKstar=0; uKstar<dlm_kdp_2D->GetNbins(1); uKstar++){
//printf("%u %u %i\n",uMt, uKstar, iTau);
dlm_kdp_3D->SetBinContent(uMt, uKstar, iTau, dlm_kdp_2D->GetBinContent(uMt, uKstar));
}
}
delete dlm_kdp_2D;
}
dlm_kdp_3D->QuickWrite(TString::Format("%s/dKaon/SetUp_Kdp_Kd/Full_v1/dlm_kdp_3D.dlm",GetCernBoxDimi()).Data());
delete dlm_kdp_3D;
}
DLM_Ck* fitter_Kd_Ck=NULL;
double fitter_Kd(double* x, double* pars){
return fitter_Kd_Ck?DLM_Baseline(x,pars)*(fitter_Kd_Ck->Eval(*x)*pars[5] + 1 - pars[5]):0;
}
//a fit with a kstar integrated CECA source
//we take stat + syst in quadr., and use a castrated pol3 for the BL.
//further, we make full bootstrap, including variations on:
// - fit range
// - lambda parameters (phys. hypothesis)
// - tau parameter (phys. hypothesis)
// - dlmck cutoff (phys. hyptothesis)
// - potential (phys. hyptothesis)
//for each tau (in steps of 0.5 fm) we plot the corresponding best chi2, and evaluate the allowed limits
void Fit_WithCECA_kstarInt(const unsigned NumBootstrap, const unsigned SEED){
std::vector<TString> src_var = {"ceca_default"};
std::vector<double> tau = {0.0, 0.5, 1.0};//
std::vector<double> lam_gen = {0.901, 0.921, 0.941};//
//std::vector<double> fit_max = {1200, 1500, 1800};
std::vector<double> fit_max = {800, 1000, 1200, 1400, 1600, 1800, 2000};
std::vector<double> femto_converge = {500, 700, 900};
const double cats_min = 0;
const double cats_max = 400;
const unsigned cats_steps = 20;
const double ck_min = 0;
const double ck_max = 2000;
const unsigned ck_steps = 100;
std::vector<TString> pot_var = {"DG_ER", "DG_FCA"};
DLM_CommonAnaFunctions AnalysisObject;
AnalysisObject.SetCatsFilesFolder(TString::Format("%s/CatsFiles",GetCernBoxDimi()).Data());
//here we have [variation][tau]
DLM_HistoSource*** dlmCecaSource = new DLM_HistoSource** [src_var.size()];
for(unsigned uSrc=0; uSrc<src_var.size(); uSrc++){
dlmCecaSource[uSrc] = new DLM_HistoSource* [tau.size()];
for(unsigned uTau=0; uTau<tau.size(); uTau++){
TFile fSrcInput(TString::Format("%s/FunWithCeca/Ceca_KdReso_FAST/Eta0.8_KdReso_ET1_PR1_DD%.1f_EF-1402.root",GetFemtoOutputFolder(), tau.at(uTau)),"read");
TH1F* GhettoFemto_rstar = (TH1F*)fSrcInput.Get("GhettoFemto_rstar");
DLM_Histo<float>* dlmGhettoFemto_rstar = Convert_TH1F_DlmHisto(GhettoFemto_rstar);
dlmCecaSource[uSrc][uTau] = new DLM_HistoSource(*dlmGhettoFemto_rstar);
delete dlmGhettoFemto_rstar;
delete GhettoFemto_rstar;
fSrcInput.Close();
}
}
TGraphErrors* gKd_stat;
TGraphErrors* gKd_syst;
TGraphErrors* gKd_total;