forked from lpernie/limits_2a4mu
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plots.py
1947 lines (1614 loc) · 99.9 KB
/
Plots.py
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
import ROOT, array, os, re, math, random
from math import *
import numpy as np
execfile("scripts/tdrStyle.py")
execfile("scripts/fSetPalette.py")
execfile("scripts/fRange.py")
execfile("scripts/CmsLimitVsM.py")
execfile("scripts/SMHiggsCrossSections.py")
execfile("scripts/DarkPhotonWidths_and_Branchings.py")
execfile("scripts/R_Hadrons.py")
execfile("scripts/CmsDarkSusyAcceptance.py")
execfile("scripts/CmsNmssmAcceptance.py")
#NMSSM specific functions
execfile("scripts/NMSSM_Br_a_Function.py")
cnv = ROOT.TCanvas("cnv", "cnv")
cnv.SetCanvasSize(900,900)
txtHeader = ROOT.TLegend(.05,.933,0.99,1.)
#txtHeader = ROOT.TLegend(.15,.935,0.97,1.)
txtHeader.SetFillColor(ROOT.kWhite)
txtHeader.SetFillStyle(0)
txtHeader.SetBorderSize(0)
txtHeader.SetTextFont(42)
txtHeader.SetTextSize(0.045)
txtHeader.SetTextAlign(22)
txtHeader.SetHeader(" #bf{CMS} 35.9 fb^{-1} (13 TeV)")
#txtHeader.SetHeader(" #bf{CMS Preliminary} 35.9 fb^{-1} (13 TeV)")
l_CMS = ROOT.TLegend(0.6,0.8,0.9,0.95)
l_CMS.SetFillColor(ROOT.kWhite)
l_CMS.SetFillStyle(4050)
l_CMS.SetBorderSize(0)
l_CMS.SetTextFont(61)
l_CMS.SetTextSize(0.055)
l_CMS.SetTextAlign(22)
l_CMS.SetTextColor(ROOT.kBlack)
l_CMS.SetHeader("CMS")
#l_CMSLumi = ROOT.TLegend(0.6,0.68,0.9,0.95)
l_CMSLumi = ROOT.TLegend(0.6,0.9,0.9,0.98)
l_CMSLumi.SetFillColor(ROOT.kWhite)
l_CMSLumi.SetFillStyle(4050)
l_CMSLumi.SetBorderSize(0)
l_CMSLumi.SetTextFont(42)
l_CMSLumi.SetTextSize(0.042)
l_CMSLumi.SetTextAlign(22)
l_CMSLumi.SetTextColor(ROOT.kBlack)
l_CMSLumi.SetHeader("35.9 fb^{-1} (13 TeV)")
lumi_fbinv = 35.9 # fb-1
lumi_pbinv = 1000.*lumi_fbinv # pb-1
SF = 0.9265 # eFullData / eFullMc
eFullMc_over_aGen = 0.611
mGammaD_GeV = [0.25, 0.40, 0.55, 0.70, 0.85, 1.00]
mGammaD_GeV_bot = 0.00 # low boundary where histograms start in m
mGammaD_GeV_min = 0.25
mGammaD_GeV_max = 2.00
mGammaD_GeV_top = 10.0 # high boundary where histograms stops in m
ctau_mm = [0.0, 0.2, 0.5, 2.0, 5.0]
ctau_mm_bot = -0.5
ctau_mm_min = 0.0
ctau_mm_max = 5.0
ctau_mm_top = 5.5
c_hbar_mm_GeV = 1.974*pow(10.0, -13) # c = 3*10^11 mm/s; hbar = 6.58*10^-25 GeV*sec
epsilon2_min = 0.000000000001
epsilon2_max = 0.0001
epsilon2_bins = 1000
logEpsilon2_min = -12.1
logEpsilon2_max = -7.9
##
CL = 95
## output directory
topDirectory = "plots%d"%CL
################################################################################
# Plot Upper 95% CL Limit on number of events: 0.25 < mGammaD < 1.0
################################################################################
def save_canvas(cnv,title):
cnv.SaveAs(topDirectory + "/PNG/" + title + ".png")
cnv.SaveAs(topDirectory + "/PDF/" + title + ".pdf")
cnv.SaveAs(topDirectory + "/C/" + title + ".C")
def limit_vs_mGammaD_2016():
print "------------limit_vs_mGammaD_2016------------"
cnv.SetLogy(0)
padTop = ROOT.TPad( "padTop", "padTop", 0.0, 0.3, 1.0, 1.0 )
padTop.Draw()
padTop.cd()
array_mGammaD_limit = []
array_mGammaD_limit_T5000 = []
array_mGammaD_limit_T5000_error = []
rnd = ROOT.TRandom()
rnd.SetSeed(2016)
# MyMGammaD_array = [0.2113,0.2400,0.2600,0.3000,0.3300,0.3600,0.4000,0.4300,0.4600,0.5000,0.5300,0.5600,0.6000,0.7000,0.8000,0.8800,0.9000,0.9100,0.9200,0.9300,0.9400,1.0000,1.1000,1.15,1.2000,1.25,1.3000,1.4000,1.5000,1.6000,1.7000,1.8000,1.9000,2.0000,2.1000,2.2000,2.3000,2.4000,2.5000,2.6000,2.7000,2.8000,2.9000,3.0000,3.0200,3.0500,3.0800,3.0900,3.1000,3.1200,3.1500,3.2000,3.3000,3.4000,3.7000,4.0000,5.0000,6.0000,7.0000,8.0000,8.5000]
for m in np.arange(0.22, 8.5, 0.005):
array_mGammaD_limit.append(( m, fCmsLimitVsM(m) )) # Fit
for m in MGammaD_array: # MGammaD_array = Array with all masses consdered
# Point
array_mGammaD_limit_T5000.append(( m, fCmsLimitVsM_HybridNew(m) )) # fCmsLimitVsM_HybridNew(m) retireve the limit from toys experiments.
array_mGammaD_limit_T5000_error.append(( m, (fCmsLimitVsM_HybridNew(m) - fCmsLimitVsM(m) ) / fCmsLimitVsM(m) )) # Error is the difference between fit and toy limit
h_limit_vs_mGammaD_dummy = ROOT.TH2F("h_limit_vs_mGammaD_dummy", "h_limit_vs_mGammaD_dummy", 1000, 0.0, 9.0, 1000, 0.0, 10.0)
#h_limit_vs_mGammaD_dummy = ROOT.TH2F("h_limit_vs_mGammaD_dummy", "h_limit_vs_mGammaD_dummy", 108, 0.0455, 8.9973, 1000, 0.0, 10.0)
h_limit_vs_mGammaD_dummy.SetXTitle("m_{a} [GeV]")
h_limit_vs_mGammaD_dummy.SetYTitle("%d%% CL upper limit on N_{evt}"%CL)
h_limit_vs_mGammaD_dummy.SetTitleOffset(1.1, "Y")
h_limit_vs_mGammaD_dummy.GetXaxis().SetNdivisions(505)
#h_limit_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_limit_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_vs_mGammaD_dummy.Draw()
gr_limit_vs_mGammaD_T5000 = ROOT.TGraph( len(array_mGammaD_limit_T5000), array.array("d", zip(*array_mGammaD_limit_T5000)[0]), array.array("d", zip(*array_mGammaD_limit_T5000)[1]) )
gr_limit_vs_mGammaD_T5000.SetLineWidth(1)
gr_limit_vs_mGammaD_T5000.SetLineColor(ROOT.kBlue)
gr_limit_vs_mGammaD_T5000.SetLineStyle(1)
gr_limit_vs_mGammaD_T5000.Draw("P")
gr_limit_vs_mGammaD = ROOT.TGraph( len(array_mGammaD_limit), array.array("d", zip(*array_mGammaD_limit)[0]), array.array("d", zip(*array_mGammaD_limit)[1]) )
gr_limit_vs_mGammaD.SetLineWidth(2)
gr_limit_vs_mGammaD.SetLineColor(ROOT.kRed)
gr_limit_vs_mGammaD.SetLineStyle(1)
gr_limit_vs_mGammaD.SetMarkerColor(ROOT.kRed)
gr_limit_vs_mGammaD.Draw("L")
l_limit_vs_mGammaD = ROOT.TLegend(0.63,0.65,0.9,0.75)
l_limit_vs_mGammaD.SetFillColor(ROOT.kWhite)
l_limit_vs_mGammaD.SetMargin(0.13)
l_limit_vs_mGammaD.SetBorderSize(0)
l_limit_vs_mGammaD.SetTextFont(42)
l_limit_vs_mGammaD.SetTextSize(0.035)
l_limit_vs_mGammaD.AddEntry(gr_limit_vs_mGammaD_T5000,"Toys","L")
l_limit_vs_mGammaD.AddEntry(gr_limit_vs_mGammaD,"Fit","L")
l_limit_vs_mGammaD.Draw()
#l_CMS.Draw()
#l_CMSLumi.Draw()
txtHeader.Draw()
cnv.cd()
# Now Draw Errors
padBot = ROOT.TPad( "padBot", "padBot", 0.0, 0.0, 1.0, 0.3 )
padBot.Draw()
padBot.cd()
padBot.SetGrid()
h_limit_vs_mGammaD_error_dummy = ROOT.TH2F("h_limit_vs_mGammaD_error_dummy", "h_limit_vs_mGammaD_error_dummy", 1000, 0.0, 9.0, 1000, -0.2, 0.2)
#h_limit_vs_mGammaD_error_dummy = ROOT.TH2F("h_limit_vs_mGammaD_error_dummy", "h_limit_vs_mGammaD_error_dummy", 108, 0.0455, 8.9973, 1000, -0.2, 0.2)
h_limit_vs_mGammaD_error_dummy.SetXTitle("m_{a} [GeV]")
h_limit_vs_mGammaD_error_dummy.SetYTitle("Fit Uncertainty [%]")
h_limit_vs_mGammaD_error_dummy.SetTitleOffset(1.1, "Y")
h_limit_vs_mGammaD_error_dummy.GetXaxis().SetNdivisions(505)
#h_limit_vs_mGammaD_error_dummy.GetYaxis().CenterTitle(1)
h_limit_vs_mGammaD_error_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_vs_mGammaD_error_dummy.Draw()
gr_limit_vs_mGammaD_T5000_error = ROOT.TGraph( len(array_mGammaD_limit_T5000_error), array.array("d", zip(*array_mGammaD_limit_T5000_error)[0]), array.array("d", zip(*array_mGammaD_limit_T5000_error)[1]) )
gr_limit_vs_mGammaD_T5000_error.SetLineWidth(1)
gr_limit_vs_mGammaD_T5000_error.SetLineColor(ROOT.kBlue)
gr_limit_vs_mGammaD_T5000_error.SetLineStyle(1)
gr_limit_vs_mGammaD_T5000_error.Draw("L")
cnv.cd()
cnv.Update()
save_canvas(cnv,"limit_Events_vs_mGammaD_2016_FitUncert")
# Now same plots with no errors
cnv.cd()
h_limit_vs_mGammaD_dummy.Draw()
gr_limit_vs_mGammaD_T5000.Draw("P")
gr_limit_vs_mGammaD.Draw("L")
#l_CMS.Draw()
#l_CMSLumi.Draw()
txtHeader.Draw()
cnv.Update()
save_canvas(cnv,"limit_Events_vs_mGammaD_2016")
gr_limit_vs_mGammaD_T5000.SaveAs(topDirectory + "/C/limit_Events_vs_mGammaD_2016.root")
################################################################################
# Plot Upper 95% CL Limit on CSxBR2xAlpha = "Limit on number of events"/Luminosity/"Scale factor"
################################################################################
def limit_CSxBR2xAlpha_fb_vs_mGammaD_2016():
cnv.SetLogy(0)
array_mGammaD_limit_CSxBR2xAlpha_fb = []
for m in fRange(0.25, 8.5, 201):
array_mGammaD_limit_CSxBR2xAlpha_fb.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/eFullMc_over_aGen )) # Transforming the Limit on N_event to Xsec limit
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy = ROOT.TH2F("h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy", "h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy", 1000, 0.0, 9.0, 1000, 0.0, 10.0/lumi_fbinv/SF/eFullMc_over_aGen)
#h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy = ROOT.TH2F("h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy", "h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy", 108, 0.0455, 8.9973, 1000, 0.0, 10.0/lumi_fbinv/SF/eFullMc_over_aGen)
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.SetXTitle("m_{a} [GeV]")
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.SetYTitle("#sigma(pp #rightarrow 2a + X) B^{2}(a #rightarrow 2 #mu) #alpha_{gen} [fb]")
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.SetTitleOffset(1.47, "Y")
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.GetXaxis().SetNdivisions(505);
#h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_CSxBR2xAlpha_fb_vs_mGammaD_dummy.Draw()
gr_limit_CSxBR2xAlpha_fb_vs_mGammaD = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2xAlpha_fb), array.array("d", zip(*array_mGammaD_limit_CSxBR2xAlpha_fb)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2xAlpha_fb)[1]) )
gr_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetLineWidth(2)
gr_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetLineColor(ROOT.kRed)
gr_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetLineStyle(1)
gr_limit_CSxBR2xAlpha_fb_vs_mGammaD.Draw("C")
l_limit_CSxBR2xAlpha_fb_vs_mGammaD = ROOT.TLegend(0.6,0.65,0.9,0.75)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetFillColor(ROOT.kWhite)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetMargin(0.13)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetBorderSize(0)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetTextFont(42)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.SetTextSize(0.035)
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2xAlpha_fb_vs_mGammaD,"%d%% CL upper limit"%CL,"L")
l_limit_CSxBR2xAlpha_fb_vs_mGammaD.Draw()
#l_CMS.Draw()
#l_CMSLumi.Draw()
txtHeader.Draw()
save_canvas(cnv,"limit_CSxBR2xAlpha_fb_vs_mGammaD_2016")
################################################################################
# Plot acceptance Alpha vs mGammaD: 0.25 < mGammaD < 1.0
################################################################################
def Alpha_vs_mGammaD_2015():
print "------------Alpha_vs_mGammaD_2015------------"
cnv.SetLogy(0)
array_Alpha_vs_mGammaD_ctau0mm_LinearFit = []
array_Alpha_vs_mGammaD_ctau02mm_LinearFit = []
array_Alpha_vs_mGammaD_ctau05mm_LinearFit = []
array_Alpha_vs_mGammaD_ctau2mm_LinearFit = []
array_Alpha_vs_mGammaD_ctau5mm_LinearFit = []
for m_GeV in fRange(0.25, 8.5, 100):
array_Alpha_vs_mGammaD_ctau0mm_LinearFit.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.0, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau02mm_LinearFit.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.2, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau05mm_LinearFit.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.5, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau2mm_LinearFit.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 2.0, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau5mm_LinearFit.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 5.0, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau0mm_Marker = []
array_Alpha_vs_mGammaD_ctau02mm_Marker = []
array_Alpha_vs_mGammaD_ctau05mm_Marker = []
array_Alpha_vs_mGammaD_ctau2mm_Marker = []
array_Alpha_vs_mGammaD_ctau5mm_Marker = []
array_Alpha_vs_mGammaD_ctau0mm_Marker.append(( 0.25, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.0, 0.25 ) ))
array_Alpha_vs_mGammaD_ctau0mm_Marker.append(( 0.4, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.0, 0.4 ) ))
for m_GeV in mGammaD_GeV:
array_Alpha_vs_mGammaD_ctau02mm_Marker.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.2, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau05mm_Marker.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.5, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau2mm_Marker.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 2.0, m_GeV ) ))
array_Alpha_vs_mGammaD_ctau5mm_Marker.append(( m_GeV, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 5.0, m_GeV ) ))
h_Alpha_vs_mGammaD_dummy = ROOT.TH2F("h_Alpha_vs_mGammaD_dummy", "h_Alpha_vs_mGammaD_dummy", 1000, mGammaD_GeV_bot, mGammaD_GeV_top, 1000, 0.0, 25.0)
h_Alpha_vs_mGammaD_dummy.SetXTitle("m_{#gamma_{D}} [GeV]")
h_Alpha_vs_mGammaD_dummy.SetYTitle("#alpha (c#tau_{#gamma_{D}}, m_{#gamma_{D}}) [%]")
h_Alpha_vs_mGammaD_dummy.SetTitleOffset(1.1, "Y")
#h_Alpha_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_Alpha_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_Alpha_vs_mGammaD_dummy.Draw()
gr_Alpha_vs_mGammaD_ctau0mm = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau0mm_LinearFit), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau0mm_LinearFit)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau0mm_LinearFit)[1]) )
gr_Alpha_vs_mGammaD_ctau0mm.SetLineWidth(2)
gr_Alpha_vs_mGammaD_ctau0mm.SetLineColor(ROOT.kBlue)
gr_Alpha_vs_mGammaD_ctau0mm.SetLineStyle(2)
gr_Alpha_vs_mGammaD_ctau0mm.Draw("C")
gr_Alpha_vs_mGammaD_ctau0mm_Marker = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau0mm_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau0mm_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau0mm_Marker)[1]) )
gr_Alpha_vs_mGammaD_ctau0mm_Marker.SetMarkerColor(ROOT.kBlue)
gr_Alpha_vs_mGammaD_ctau0mm_Marker.SetMarkerStyle(20)
gr_Alpha_vs_mGammaD_ctau0mm_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_mGammaD_ctau0mm_Marker.Draw("P")
gr_Alpha_vs_mGammaD_ctau02mm = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau02mm_LinearFit), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau02mm_LinearFit)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau02mm_LinearFit)[1]) )
gr_Alpha_vs_mGammaD_ctau02mm.SetLineWidth(2)
gr_Alpha_vs_mGammaD_ctau02mm.SetLineColor(ROOT.kGreen+2)
gr_Alpha_vs_mGammaD_ctau02mm.SetLineStyle(9)
gr_Alpha_vs_mGammaD_ctau02mm.Draw("C")
gr_Alpha_vs_mGammaD_ctau02mm_Marker = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau02mm_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau02mm_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau02mm_Marker)[1]) )
gr_Alpha_vs_mGammaD_ctau02mm_Marker.SetMarkerColor(ROOT.kGreen+2)
gr_Alpha_vs_mGammaD_ctau02mm_Marker.SetMarkerStyle(20)
gr_Alpha_vs_mGammaD_ctau02mm_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_mGammaD_ctau02mm_Marker.Draw("P")
gr_Alpha_vs_mGammaD_ctau05mm = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau05mm_LinearFit), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau05mm_LinearFit)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau05mm_LinearFit)[1]) )
gr_Alpha_vs_mGammaD_ctau05mm.SetLineWidth(2)
gr_Alpha_vs_mGammaD_ctau05mm.SetLineColor(ROOT.kRed)
gr_Alpha_vs_mGammaD_ctau05mm.SetLineStyle(1)
gr_Alpha_vs_mGammaD_ctau05mm.Draw("C")
gr_Alpha_vs_mGammaD_ctau05mm_Marker = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau05mm_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau05mm_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau05mm_Marker)[1]) )
gr_Alpha_vs_mGammaD_ctau05mm_Marker.SetMarkerColor(ROOT.kRed)
gr_Alpha_vs_mGammaD_ctau05mm_Marker.SetMarkerStyle(20)
gr_Alpha_vs_mGammaD_ctau05mm_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_mGammaD_ctau05mm_Marker.Draw("P")
gr_Alpha_vs_mGammaD_ctau2mm = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau2mm_LinearFit), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau2mm_LinearFit)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau2mm_LinearFit)[1]) )
gr_Alpha_vs_mGammaD_ctau2mm.SetLineWidth(2)
gr_Alpha_vs_mGammaD_ctau2mm.SetLineColor(ROOT.kMagenta)
gr_Alpha_vs_mGammaD_ctau2mm.SetLineStyle(10)
gr_Alpha_vs_mGammaD_ctau2mm.Draw("C")
gr_Alpha_vs_mGammaD_ctau2mm_Marker = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau2mm_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau2mm_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau2mm_Marker)[1]) )
gr_Alpha_vs_mGammaD_ctau2mm_Marker.SetMarkerColor(ROOT.kMagenta)
gr_Alpha_vs_mGammaD_ctau2mm_Marker.SetMarkerStyle(20)
gr_Alpha_vs_mGammaD_ctau2mm_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_mGammaD_ctau2mm_Marker.Draw("P")
gr_Alpha_vs_mGammaD_ctau5mm = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau5mm_LinearFit), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau5mm_LinearFit)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau5mm_LinearFit)[1]) )
gr_Alpha_vs_mGammaD_ctau5mm.SetLineWidth(2)
gr_Alpha_vs_mGammaD_ctau5mm.SetLineColor(ROOT.kCyan)
gr_Alpha_vs_mGammaD_ctau5mm.SetLineStyle(8)
gr_Alpha_vs_mGammaD_ctau5mm.Draw("C")
gr_Alpha_vs_mGammaD_ctau5mm_Marker = ROOT.TGraph( len(array_Alpha_vs_mGammaD_ctau5mm_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau5mm_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau5mm_Marker)[1]) )
gr_Alpha_vs_mGammaD_ctau5mm_Marker.SetMarkerColor(ROOT.kCyan)
gr_Alpha_vs_mGammaD_ctau5mm_Marker.SetMarkerStyle(20)
gr_Alpha_vs_mGammaD_ctau5mm_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_mGammaD_ctau5mm_Marker.Draw("P")
l_Alpha_vs_mGammaD = ROOT.TLegend(0.25,0.6,0.6,0.9)
l_Alpha_vs_mGammaD.SetFillColor(ROOT.kWhite)
l_Alpha_vs_mGammaD.SetMargin(0.4)
l_Alpha_vs_mGammaD.SetBorderSize(0)
l_Alpha_vs_mGammaD.SetTextFont(42)
l_Alpha_vs_mGammaD.SetTextSize(0.035)
l_Alpha_vs_mGammaD.SetHeader("Acceptance for samples with #gamma_{D} life-time:")
l_Alpha_vs_mGammaD.AddEntry(gr_Alpha_vs_mGammaD_ctau0mm, "c#tau_{#gamma_{D}} = 0 mm (prompt)","L")
l_Alpha_vs_mGammaD.AddEntry(gr_Alpha_vs_mGammaD_ctau02mm,"c#tau_{#gamma_{D}} = 0.2 mm","L")
l_Alpha_vs_mGammaD.AddEntry(gr_Alpha_vs_mGammaD_ctau05mm,"c#tau_{#gamma_{D}} = 0.5 mm","L")
l_Alpha_vs_mGammaD.AddEntry(gr_Alpha_vs_mGammaD_ctau2mm, "c#tau_{#gamma_{D}} = 2 mm","L")
l_Alpha_vs_mGammaD.AddEntry(gr_Alpha_vs_mGammaD_ctau5mm, "c#tau_{#gamma_{D}} = 5 mm","L")
l_Alpha_vs_mGammaD.Draw()
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/Alpha_vs_mGammaD_2015.pdf")
cnv.SaveAs(topDirectory + "/C/Alpha_vs_mGammaD_2015.C")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/Alpha_vs_mGammaD_2015.pdf -resize 900x900 plots/PNG/Alpha_vs_mGammaD_2015.png")
################################################################################
# Plot acceptance Alpha vs ctau: 0.2 < ctau < 5.0
################################################################################
def Alpha_vs_ctau_2015():
print "------------Alpha_vs_ctau_2015------------"
cnv.SetLogy(0)
array_Alpha_vs_ctau_m025GeV = []
array_Alpha_vs_ctau_m04GeV = []
array_Alpha_vs_ctau_m1GeV = []
for ctau in fRange(ctau_mm_min, ctau_mm_max, 101):
array_Alpha_vs_ctau_m025GeV.append(( ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.25 ) ))
array_Alpha_vs_ctau_m04GeV.append(( ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.4 ) ))
array_Alpha_vs_ctau_m1GeV.append(( ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 1.0 ) ))
array_Alpha_vs_ctau_m025GeV_Marker = []
array_Alpha_vs_ctau_m04GeV_Marker = []
array_Alpha_vs_ctau_m1GeV_Marker = []
for ctau in ctau_mm:
array_Alpha_vs_ctau_m025GeV_Marker.append(( ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.25 ), 0.0, 100.0*fCmsDarkSusyAcceptanceUnct_LinearFit_2015_13TeV( ctau, 0.25 ) ))
array_Alpha_vs_ctau_m04GeV_Marker.append(( ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.4 ), 0.0, 100.0*fCmsDarkSusyAcceptanceUnct_LinearFit_2015_13TeV( ctau, 0.4 ) ))
# not in loop above becuase sample with mGammaD = 1 GeV and ctau = 0 mm is not yet generated as of April 8th, 2014
array_Alpha_vs_ctau_m1GeV_Marker.append(( 0.2, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.2, 1.0 ) ))
array_Alpha_vs_ctau_m1GeV_Marker.append(( 0.5, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.5, 1.0 ) ))
array_Alpha_vs_ctau_m1GeV_Marker.append(( 2.0, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 2.0, 1.0 ) ))
array_Alpha_vs_ctau_m1GeV_Marker.append(( 5.0, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 5.0, 1.0 ) ))
h_Alpha_vs_ctau_dummy = ROOT.TH2F("h_Alpha_vs_ctau_dummy", "h_Alpha_vs_ctau_dummy", 1000, ctau_mm_bot, ctau_mm_top, 1000, 0.0, 25.0)
h_Alpha_vs_ctau_dummy.SetXTitle("c#tau_{#gamma_{D}} [mm]")
h_Alpha_vs_ctau_dummy.SetYTitle("#alpha (c#tau_{#gamma_{D}}, m_{#gamma_{D}}) [%]")
h_Alpha_vs_ctau_dummy.SetTitleOffset(1.1, "Y")
#h_Alpha_vs_ctau_dummy.GetYaxis().CenterTitle(1)
h_Alpha_vs_ctau_dummy.GetYaxis().SetTitleSize(0.05)
h_Alpha_vs_ctau_dummy.Draw()
gr_Alpha_vs_ctau_m025GeV = ROOT.TGraph( len(array_Alpha_vs_ctau_m025GeV), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV)[1]) )
gr_Alpha_vs_ctau_m025GeV.SetLineWidth(2)
gr_Alpha_vs_ctau_m025GeV.SetLineColor(ROOT.kGreen+2)
gr_Alpha_vs_ctau_m025GeV.SetLineStyle(9)
# gr_Alpha_vs_ctau_m025GeV.Draw("C")
gr_Alpha_vs_ctau_m025GeV_Marker = ROOT.TGraph( len(array_Alpha_vs_ctau_m025GeV_Marker), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[1]) )
gr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerColor(ROOT.kGreen+2)
gr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerStyle(20)
gr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_ctau_m025GeV_Marker.Draw("P")
grErr_Alpha_vs_ctau_m025GeV_Marker = ROOT.TGraphErrors( len(array_Alpha_vs_ctau_m025GeV_Marker), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[1]), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[2]),
array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Marker)[3]) )
grErr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerColor(ROOT.kGreen+2)
grErr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerStyle(20)
grErr_Alpha_vs_ctau_m025GeV_Marker.SetMarkerSize(1.5)
# grErr_Alpha_vs_ctau_m025GeV_Marker.Draw("P")
# fit_Alpha_vs_ctau_m025GeV = get_Alpha_vs_ctau_FCN()
# fit_Alpha_vs_ctau_m025GeV.SetLineColor( grErr_Alpha_vs_ctau_m025GeV_Marker.getMarkerColor() )
# grErr_Alpha_vs_ctau_m025GeV_Marker.Fit(fit_Alpha_vs_ctau_m025GeV,"LVMR","",0.0,5.0);
gr_Alpha_vs_ctau_m04GeV = ROOT.TGraph( len(array_Alpha_vs_ctau_m04GeV), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV)[1]) )
gr_Alpha_vs_ctau_m04GeV.SetLineWidth(2)
gr_Alpha_vs_ctau_m04GeV.SetLineColor(ROOT.kRed)
gr_Alpha_vs_ctau_m04GeV.SetLineStyle(1)
# gr_Alpha_vs_ctau_m04GeV.Draw("C")
gr_Alpha_vs_ctau_m04GeV_Marker = ROOT.TGraph( len(array_Alpha_vs_ctau_m04GeV_Marker), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[1]) )
gr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerColor(ROOT.kRed)
gr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerStyle(20)
gr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerSize(1.5)
# gr_Alpha_vs_ctau_m04GeV_Marker.Draw("P")
grErr_Alpha_vs_ctau_m04GeV_Marker = ROOT.TGraphErrors( len(array_Alpha_vs_ctau_m04GeV_Marker), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[1]), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[2]),
array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Marker)[3]) )
grErr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerColor(ROOT.kRed)
grErr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerStyle(20)
grErr_Alpha_vs_ctau_m04GeV_Marker.SetMarkerSize(1.5)
# grErr_Alpha_vs_ctau_m04GeV_Marker.Draw("PE")
# fit_Alpha_vs_ctau_m04GeV = get_Alpha_vs_ctau_FCN()
# fFit_Alpha_vs_ctau.Draw("same")
# grErr_Alpha_vs_ctau_m04GeV_Marker.Fit(fit_Alpha_vs_ctau_m04GeV,"LVMR","",0.0,5.0);
array_Alpha_vs_ctau_m04GeV_Fit = []
array_Alpha_vs_ctau_m025GeV_Fit = []
for ctau in [0.001,0.2,0.5,2.0,5.0]:
array_Alpha_vs_ctau_m04GeV_Fit.append(( ctau, 100.0*f_Alpha_vs_ctau(0.4,45,ctau,0.068) ))
array_Alpha_vs_ctau_m025GeV_Fit.append(( ctau, 100.0*f_Alpha_vs_ctau(0.25,45,ctau,0.10077) ))
gr_Alpha_vs_ctau_m04GeV_Fit = ROOT.TGraph( len(array_Alpha_vs_ctau_m04GeV_Fit), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Fit)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m04GeV_Fit)[1]) )
gr_Alpha_vs_ctau_m04GeV_Fit.SetMarkerColor(ROOT.kBlue)
gr_Alpha_vs_ctau_m04GeV_Fit.SetMarkerStyle(20)
gr_Alpha_vs_ctau_m04GeV_Fit.SetMarkerSize(1.5)
# gr_Alpha_vs_ctau_m04GeV_Fit.Draw("PC")
gr_Alpha_vs_ctau_m025GeV_Fit = ROOT.TGraph( len(array_Alpha_vs_ctau_m025GeV_Fit), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Fit)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m025GeV_Fit)[1]) )
gr_Alpha_vs_ctau_m025GeV_Fit.SetMarkerColor(ROOT.kBlue)
gr_Alpha_vs_ctau_m025GeV_Fit.SetMarkerStyle(21)
gr_Alpha_vs_ctau_m025GeV_Fit.SetMarkerSize(1.5)
gr_Alpha_vs_ctau_m025GeV_Fit.Draw("PC")
gr_Alpha_vs_ctau_m1GeV = ROOT.TGraph( len(array_Alpha_vs_ctau_m1GeV), array.array("d", zip(*array_Alpha_vs_ctau_m1GeV)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m1GeV)[1]) )
gr_Alpha_vs_ctau_m1GeV.SetLineWidth(2)
gr_Alpha_vs_ctau_m1GeV.SetLineColor(ROOT.kBlue)
gr_Alpha_vs_ctau_m1GeV.SetLineStyle(2)
# gr_Alpha_vs_ctau_m1GeV.Draw("C")
gr_Alpha_vs_ctau_m1GeV_Marker = ROOT.TGraph( len(array_Alpha_vs_ctau_m1GeV_Marker), array.array("d", zip(*array_Alpha_vs_ctau_m1GeV_Marker)[0]), array.array("d", zip(*array_Alpha_vs_ctau_m1GeV_Marker)[1]) )
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerColor(ROOT.kBlue)
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerStyle(20)
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerSize(1.5)
# gr_Alpha_vs_ctau_m1GeV_Marker.Draw("P")
l_Alpha_vs_ctau = ROOT.TLegend(0.25,0.7,0.6,0.9)
l_Alpha_vs_ctau.SetFillColor(ROOT.kWhite)
l_Alpha_vs_ctau.SetMargin(0.4)
l_Alpha_vs_ctau.SetBorderSize(0)
l_Alpha_vs_ctau.SetTextFont(42)
l_Alpha_vs_ctau.SetTextSize(0.035)
l_Alpha_vs_ctau.SetHeader("Acceptance for samples with #gamma_{D} mass:")
# l_Alpha_vs_ctau.AddEntry(gr_Alpha_vs_ctau_m025GeV,"m_{#gamma_{D}} = 0.25 GeV/#it{c}^{2}","L")
l_Alpha_vs_ctau.AddEntry(gr_Alpha_vs_ctau_m04GeV, "m_{#gamma_{D}} = 0.4 GeV","LP")
# l_Alpha_vs_ctau.AddEntry(gr_Alpha_vs_ctau_m1GeV, "m_{#gamma_{D}} = 1.0 GeV/#it{c}^{2}","L")
l_Alpha_vs_ctau.Draw()
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/Alpha_vs_ctau_2015.pdf")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/Alpha_vs_ctau_2015.pdf -resize 900x900 plots/PNG/Alpha_vs_ctau_2015.png")
def get_Alpha_vs_ctau_FCN():
func = ROOT.TF1("Alpha_vs_ctau_FCN",Alpha_vs_ctau_FCN,0.0,5.0,2)
func.SetParameters(100.0, 0.068)
func.SetParNames("gamma","eff")
func.SetParLimits(0, 1.0, 500.0)
func.SetParLimits(1, 0.0, 1.0)
# func.FixParameter(1, 0.068)
return func
def Alpha_vs_ctau_FCN(v, par):
ctau_mm = v[0]
gamma = par[0]
Rmin = 0.0
R0 = 44.0
Rmax = 600.0
zmin = 0.0
zmax = 5.0*Rmax
eff = par[1]
if ( ctau_mm == 0.0 ):
N = 1.0
else:
N = 0.0
nSteps = 100
R_previous = 0.0
for i in range(nSteps):
R = (Rmax - Rmin)*float(i*i)/float(nSteps*nSteps)
dR = R - R_previous
R_previous = R
z_previous = 0.0
for j in range(nSteps):
z = (zmax - zmin)*float(j*j)/float(nSteps*nSteps)
dz = z - z_previous
z_previous = z
if ( gamma != 0.0 and ( R!= 0.0 or z!=0.0 ) ):
N = N+Eff_vs_R(R0, R)/(gamma*ctau_mm)*R/(R*R+z*z)*exp(-sqrt(R*R+z*z)/(gamma*ctau_mm))*dR*dz
return 100.0*eff*N
def f1(m,E,ctau_mm,R_mm,z_mm):
gamma = E/m
if ( gamma == 0.0 or ctau_mm == 0.0 ):
f1_out = 1.0
else:
if ( R_mm >0 or z_mm >0 ):
f1_out = 1.0/2.0*1.0/(gamma*ctau_mm)*R_mm/(R_mm*R_mm+z_mm*z_mm)*exp(-sqrt(R_mm*R_mm+z_mm*z_mm)/(gamma*ctau_mm))
else:
f1_out = 1.0
return f1_out
def f2(m,E,ctau_mm,R_mm):
gamma = E/m
f2_out = 0.0
nSteps = 300
z_mm_min = 0.0
if 10.0*gamma*ctau_mm < 10.0*R_mm:
z_mm_max = 10.0*gamma*ctau_mm
else:
z_mm_max = 10.0*R_mm
z_mm_previous = 0.0
for i in range(nSteps):
fraction = float(i*i)/float(nSteps*nSteps)
# fraction = float(i)/float(nSteps)
z_mm = (z_mm_max - z_mm_min)*fraction
dz_mm = z_mm - z_mm_previous
z_mm_previous = z_mm
f2_out = f2_out + f1(m,E,ctau_mm,R_mm,z_mm) * dz_mm
return 2.0*f2_out
def Eff_vs_R(R0_mm, R_mm):
R_mm_TIB_outer_layer = 600.0
R_mm_min = 0.0 # minimum radius from beamline
R_mm_max = R_mm_TIB_outer_layer # radius to last layer in TIB. eficiency is 0 after this layer
if ( R_mm >= R_mm_min and R_mm < R0_mm) :
eff = 1.0
elif ( R_mm >= R0_mm and R_mm < R_mm_max ) :
# eff = R0_mm*R0_mm/(R_mm*R_mm) # efficiency per event with 2 dimuons
eff = R0_mm/R_mm # efficiency per dimuon
else:
eff = 0.0
return eff
def Plot_Eff_vs_R():
print "------------Plot_Eff_vs_R------------"
cnv.SetLogy(0)
R0_mm = 44.0
R_mm_bot = 0.0
R_mm_top = 650.0
array_Eff_vs_R = []
for R_mm in fRange(R_mm_bot, R_mm_top, 651):
# array_Eff_vs_R.append(( R_mm, Eff_vs_R(R0_mm, R_mm) )) # Below is modified version of the efficiency. We decided to use 0 efficiency after first layer of pixel
if R_mm < R0_mm: array_Eff_vs_R.append(( R_mm, 1.0 ))
else: array_Eff_vs_R.append(( R_mm, 0.0 ))
h_Eff_vs_R_dummy = ROOT.TH2F("h_Eff_vs_R_dummy", "h_Eff_vs_R_dummy", 650, R_mm_bot, R_mm_top, 1000, 0.0, 1.1)
h_Eff_vs_R_dummy.SetXTitle("Radius from beamline [mm]")
h_Eff_vs_R_dummy.SetYTitle("#epsilon")
#h_Eff_vs_R_dummy.GetYaxis().CenterTitle(1)
h_Eff_vs_R_dummy.Draw()
gr_Eff_vs_R = ROOT.TGraph( len(array_Eff_vs_R), array.array("d", zip(*array_Eff_vs_R)[0]), array.array("d", zip(*array_Eff_vs_R)[1]) )
gr_Eff_vs_R.SetLineWidth(2)
gr_Eff_vs_R.SetLineColor(ROOT.kRed)
gr_Eff_vs_R.SetLineStyle(1)
gr_Eff_vs_R.Draw("L")
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/Eff_vs_R.pdf")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/Eff_vs_R.pdf -resize 900x900 plots/PNG/Eff_vs_R.png")
def f3(m,E,ctau_mm):
gamma = E/m
f3_out = 0.0
nSteps = 500
R_mm_min = 0.0
R_mm_TIB_outer_layer = 600.0
R_mm_Pixel_inner_layer = 44.0
if 10.0*gamma*ctau_mm < R_mm_TIB_outer_layer:
R_mm_max = 10.0*gamma*ctau_mm
else:
R_mm_max = R_mm_TIB_outer_layer
R_mm_previous = 0.0
for i in range(nSteps):
fraction = float(i*i)/float(nSteps*nSteps)
# fraction = float(i)/float(nSteps)
R_mm = (R_mm_max - R_mm_min)*fraction
dR_mm = R_mm - R_mm_previous
R_mm_previous = R_mm
f3_out = f3_out + Eff_vs_R(R_mm_Pixel_inner_layer, R_mm)*f2(m,E,ctau_mm,R_mm) * dR_mm
return f3_out
def f_Alpha_vs_ctau(m,E,ctau_mm,alpha0):
f3_ctau = f3(m,E,ctau_mm)
f3_0 = f3(m,E,0.001)
return alpha0*f3_ctau*f3_ctau/f3_0/f3_0
################################################################################
# Plot 3D acceptance Alpha vs mGammaD and ctau
################################################################################
def Alpha_vs_mGammaD_ctau_3D():
print "------------Alpha_vs_mGammaD_ctau_3D------------"
cnv.SetTheta(20.0);
cnv.SetPhi(-130.0);
nBins = 100
h_Alpha_vs_mGammaD_ctau_3D = ROOT.TH2F("h_Alpha_vs_mGammaD_ctau_3D", "h_Alpha_vs_mGammaD_ctau_3D", nBins, mGammaD_GeV_min, mGammaD_GeV_max, nBins, ctau_mm_min, ctau_mm_max)
h_Alpha_vs_mGammaD_ctau_3D.SetXTitle("m_{#gamma_{D}} [GeV]")
h_Alpha_vs_mGammaD_ctau_3D.GetXaxis().CenterTitle(1)
h_Alpha_vs_mGammaD_ctau_3D.GetXaxis().SetNdivisions(506)
h_Alpha_vs_mGammaD_ctau_3D.GetXaxis().SetTitleOffset(1.44)
h_Alpha_vs_mGammaD_ctau_3D.SetYTitle("c#tau_{#gamma_{D}} [mm]")
h_Alpha_vs_mGammaD_ctau_3D.GetYaxis().CenterTitle(1)
h_Alpha_vs_mGammaD_ctau_3D.GetYaxis().SetNdivisions(506)
h_Alpha_vs_mGammaD_ctau_3D.GetYaxis().SetTitleOffset(1.35)
h_Alpha_vs_mGammaD_ctau_3D.SetZTitle("#alpha (c#tau_{#gamma_{D}}, m_{#gamma_{D}}) [%]")
for i_ctau in range(nBins):
for i_m in range(nBins):
m = h_Alpha_vs_mGammaD_ctau_3D.GetXaxis().GetBinCenter( i_m + 1 )
ctau = h_Alpha_vs_mGammaD_ctau_3D.GetYaxis().GetBinCenter( i_ctau + 1 )
rightPart = 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, m )
h_Alpha_vs_mGammaD_ctau_3D.SetBinContent(i_m+1, i_ctau+1, rightPart)
fSetPalette("RainBow")
h_Alpha_vs_mGammaD_ctau_3D.Draw("surf1z")
array_Alpha_vs_mGammaD_ctau_3D_Marker = []
for ctau in ctau_mm:
for m in mGammaD_GeV:
if ( ctau == 0 and m >= 0.55 ):
print "Samples not simulated yet:", ctau, m
else:
array_Alpha_vs_mGammaD_ctau_3D_Marker.append(( m, ctau, 100.0*fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, m ) ))
gr_Alpha_vs_ctau_m1GeV_Marker = ROOT.TGraph2D( len(array_Alpha_vs_mGammaD_ctau_3D_Marker), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau_3D_Marker)[0]), array.array("d", zip(*array_Alpha_vs_mGammaD_ctau_3D_Marker)[1]), array.array("d",
zip(*array_Alpha_vs_mGammaD_ctau_3D_Marker)[2]) )
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerColor(ROOT.kRed)
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerStyle(20)
gr_Alpha_vs_ctau_m1GeV_Marker.SetMarkerSize(1.5)
gr_Alpha_vs_ctau_m1GeV_Marker.Draw("sameP")
txtHeader.Draw()
save_canvas(cnv,"Alpha_vs_mGammaD_ctau_3D")
################################################################################
# Plot Upper 95% CL Limit on CSxBR2 vs mGammaD: 0.25 < mGammaD < 1.0
################################################################################
def limit_CSxBR2_fb_vs_mGammaD_2015():
cnv.SetLogy(1)
array_mGammaD_prediction_CSxBR2_fb = []
BR_h_to_2n1 = 0.0025
BR_n1_to_gammaD_nD = 0.5
print BR_h_to_2n1*BR_n1_to_gammaD_nD*BR_n1_to_gammaD_nD*BR_GammaD_to_2mu( 0.4 )*BR_GammaD_to_2mu( 0.4 )
array_mGammaD_limit_CSxBR2_fb_ctau0mm = []
array_mGammaD_limit_CSxBR2_fb_ctau02mm = []
array_mGammaD_limit_CSxBR2_fb_ctau05mm = []
array_mGammaD_limit_CSxBR2_fb_ctau2mm = []
array_mGammaD_limit_CSxBR2_fb_ctau5mm = []
for m in fRange(mGammaD_GeV_min, mGammaD_GeV_max, 101):
prediction_CSxBR2_fb = 1000.0*fCS_SM_ggH_13TeV_pb(126.0)[0]*BR_h_to_2n1*BR_n1_to_gammaD_nD*BR_n1_to_gammaD_nD*BR_GammaD_to_2mu( m )*BR_GammaD_to_2mu( m )
array_mGammaD_prediction_CSxBR2_fb.append(( m, prediction_CSxBR2_fb ))
array_mGammaD_limit_CSxBR2_fb_ctau0mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.0, m ) ))
array_mGammaD_limit_CSxBR2_fb_ctau02mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.2, m ) ))
array_mGammaD_limit_CSxBR2_fb_ctau05mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.5, m ) ))
array_mGammaD_limit_CSxBR2_fb_ctau2mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 2.0, m ) ))
array_mGammaD_limit_CSxBR2_fb_ctau5mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 5.0, m ) ))
h_limit_CSxBR2_fb_vs_mGammaD_dummy = ROOT.TH2F("h_limit_CSxBR2_fb_vs_mGammaD_dummy", "h_limit_CSxBR2_fb_vs_mGammaD_dummy", 1000, mGammaD_GeV_bot, mGammaD_GeV_top, 1000, 0.01, 1000000.0)
h_limit_CSxBR2_fb_vs_mGammaD_dummy.SetXTitle("m_{#gamma_{D}} [GeV]")
h_limit_CSxBR2_fb_vs_mGammaD_dummy.SetYTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) B^{2}(#gamma_{D} #rightarrow 2 #mu) [fb]")
h_limit_CSxBR2_fb_vs_mGammaD_dummy.SetTitleOffset(1.35, "Y")
h_limit_CSxBR2_fb_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_limit_CSxBR2_fb_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_CSxBR2_fb_vs_mGammaD_dummy.Draw()
gr_prediction_CSxBR2_fb_vs_mGammaD = ROOT.TGraph( len(array_mGammaD_prediction_CSxBR2_fb), array.array("d", zip(*array_mGammaD_prediction_CSxBR2_fb)[0]), array.array("d", zip(*array_mGammaD_prediction_CSxBR2_fb)[1]) )
gr_prediction_CSxBR2_fb_vs_mGammaD.SetLineWidth(2)
gr_prediction_CSxBR2_fb_vs_mGammaD.SetLineColor(ROOT.kBlack)
gr_prediction_CSxBR2_fb_vs_mGammaD.SetLineStyle(1)
gr_prediction_CSxBR2_fb_vs_mGammaD.Draw("C")
gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2_fb_ctau0mm), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau0mm)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau0mm)[1]) )
gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm.SetLineColor(ROOT.kBlue)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm.SetLineStyle(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm.Draw("C")
gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2_fb_ctau02mm), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau02mm)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau02mm)[1]) )
gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm.SetLineColor(ROOT.kGreen+2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm.SetLineStyle(9)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm.Draw("C")
gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2_fb_ctau05mm), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau05mm)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau05mm)[1]) )
gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm.SetLineColor(ROOT.kRed)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm.SetLineStyle(1)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm.Draw("C")
gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2_fb_ctau2mm), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau2mm)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau2mm)[1]) )
gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm.SetLineColor(ROOT.kMagenta)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm.SetLineStyle(10)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm.Draw("C")
gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm = ROOT.TGraph( len(array_mGammaD_limit_CSxBR2_fb_ctau5mm), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau5mm)[0]), array.array("d", zip(*array_mGammaD_limit_CSxBR2_fb_ctau5mm)[1]) )
gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm.SetLineColor(ROOT.kCyan)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm.SetLineStyle(8)
gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm.Draw("C")
l_limit_CSxBR2_fb_vs_mGammaD = ROOT.TLegend(0.2,0.55,0.8,0.9)
l_limit_CSxBR2_fb_vs_mGammaD.SetFillColor(ROOT.kWhite)
l_limit_CSxBR2_fb_vs_mGammaD.SetMargin(0.4)
l_limit_CSxBR2_fb_vs_mGammaD.SetBorderSize(0)
l_limit_CSxBR2_fb_vs_mGammaD.SetTextFont(42)
l_limit_CSxBR2_fb_vs_mGammaD.SetTextSize(0.035)
l_limit_CSxBR2_fb_vs_mGammaD.SetHeader("%d%% CL limits for samples with #gamma_{D} life-time:"%CL)
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2_fb_vs_mGammaD_ctau0mm, "c#tau_{#gamma_{D}} = 0 mm (prompt)","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2_fb_vs_mGammaD_ctau02mm,"c#tau_{#gamma_{D}} = 0.2 mm","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2_fb_vs_mGammaD_ctau05mm,"c#tau_{#gamma_{D}} = 0.5 mm","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2_fb_vs_mGammaD_ctau2mm, "c#tau_{#gamma_{D}} = 2 mm","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_limit_CSxBR2_fb_vs_mGammaD_ctau5mm, "c#tau_{#gamma_{D}} = 5 mm","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_prediction_CSxBR2_fb_vs_mGammaD, "prediction with Br(h #rightarrow 2n_{1}) = 0.25%","L")
l_limit_CSxBR2_fb_vs_mGammaD.AddEntry(gr_prediction_CSxBR2_fb_vs_mGammaD, "and Br(n_{1} #rightarrow #gamma_{D} n_{D}) = 50%","")
l_limit_CSxBR2_fb_vs_mGammaD.Draw()
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/limit_CSxBR2_fb_vs_mGammaD_2015.pdf")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/limit_CSxBR2_fb_vs_mGammaD_2015.pdf -resize 900x900 plots/PNG/limit_CSxBR2_fb_vs_mGammaD_2015.png")
################################################################################
# Plot Upper 95% CL Limit on CS vs mGammaD: 0.25 < mGammaD < 1.0
################################################################################
def limit_CS_fb_vs_mGammaD_2015():
cnv.SetLogy(0)
array_mGammaD_prediction_CS_fb = []
BR_h_to_2n1 = 0.0025
BR_n1_to_gammaD_nD = 0.5
array_mGammaD_limit_CS_fb_ctau0mm = []
array_mGammaD_limit_CS_fb_ctau02mm = []
array_mGammaD_limit_CS_fb_ctau05mm = []
array_mGammaD_limit_CS_fb_ctau2mm = []
for m in fRange(0.25, 1.0, 101):
array_mGammaD_prediction_CS_fb.append(( m, 1000.0*fCS_SM_ggH_13TeV_pb(126.0)[0]*BR_h_to_2n1*BR_n1_to_gammaD_nD*BR_n1_to_gammaD_nD ))
array_mGammaD_limit_CS_fb_ctau0mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.0, m )/BR_GammaD_to_2mu( m )/BR_GammaD_to_2mu( m ) ))
array_mGammaD_limit_CS_fb_ctau02mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.2, m )/BR_GammaD_to_2mu( m )/BR_GammaD_to_2mu( m ) ))
array_mGammaD_limit_CS_fb_ctau05mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 0.5, m )/BR_GammaD_to_2mu( m )/BR_GammaD_to_2mu( m ) ))
array_mGammaD_limit_CS_fb_ctau2mm.append(( m, fCmsLimitVsM(m)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( 2.0, m )/BR_GammaD_to_2mu( m )/BR_GammaD_to_2mu( m ) ))
h_limit_CS_fb_vs_mGammaD_dummy = ROOT.TH2F("h_limit_CS_fb_vs_mGammaD_dummy", "h_limit_CS_fb_vs_mGammaD_dummy", 1000, mGammaD_GeV_bot, mGammaD_GeV_top, 1000, 0.0, 120.0)
h_limit_CS_fb_vs_mGammaD_dummy.SetXTitle("m_{#gamma_{D}} [GeV]")
h_limit_CS_fb_vs_mGammaD_dummy.SetYTitle("#sigma(pp #rightarrow h) #times Br(h #rightarrow 2#gamma_{D} + X) [fb]")
h_limit_CS_fb_vs_mGammaD_dummy.SetTitleOffset(1.35, "Y")
h_limit_CS_fb_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_limit_CS_fb_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_CS_fb_vs_mGammaD_dummy.Draw()
gr_prediction_CS_fb_vs_mGammaD = ROOT.TGraph( len(array_mGammaD_prediction_CS_fb), array.array("d", zip(*array_mGammaD_prediction_CS_fb)[0]), array.array("d", zip(*array_mGammaD_prediction_CS_fb)[1]) )
gr_prediction_CS_fb_vs_mGammaD.SetLineWidth(2)
gr_prediction_CS_fb_vs_mGammaD.SetLineColor(ROOT.kBlack)
gr_prediction_CS_fb_vs_mGammaD.SetLineStyle(1)
gr_prediction_CS_fb_vs_mGammaD.Draw("C")
gr_limit_CS_fb_vs_mGammaD_ctau0mm = ROOT.TGraph( len(array_mGammaD_limit_CS_fb_ctau0mm), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau0mm)[0]), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau0mm)[1]) )
gr_limit_CS_fb_vs_mGammaD_ctau0mm.SetLineWidth(2)
gr_limit_CS_fb_vs_mGammaD_ctau0mm.SetLineColor(ROOT.kBlue)
gr_limit_CS_fb_vs_mGammaD_ctau0mm.SetLineStyle(2)
gr_limit_CS_fb_vs_mGammaD_ctau0mm.Draw("C")
gr_limit_CS_fb_vs_mGammaD_ctau02mm = ROOT.TGraph( len(array_mGammaD_limit_CS_fb_ctau02mm), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau02mm)[0]), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau02mm)[1]) )
gr_limit_CS_fb_vs_mGammaD_ctau02mm.SetLineWidth(2)
gr_limit_CS_fb_vs_mGammaD_ctau02mm.SetLineColor(ROOT.kGreen+2)
gr_limit_CS_fb_vs_mGammaD_ctau02mm.SetLineStyle(9)
gr_limit_CS_fb_vs_mGammaD_ctau02mm.Draw("C")
gr_limit_CS_fb_vs_mGammaD_ctau05mm = ROOT.TGraph( len(array_mGammaD_limit_CS_fb_ctau05mm), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau05mm)[0]), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau05mm)[1]) )
gr_limit_CS_fb_vs_mGammaD_ctau05mm.SetLineWidth(2)
gr_limit_CS_fb_vs_mGammaD_ctau05mm.SetLineColor(ROOT.kRed)
gr_limit_CS_fb_vs_mGammaD_ctau05mm.SetLineStyle(1)
gr_limit_CS_fb_vs_mGammaD_ctau05mm.Draw("C")
gr_limit_CS_fb_vs_mGammaD_ctau2mm = ROOT.TGraph( len(array_mGammaD_limit_CS_fb_ctau2mm), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau2mm)[0]), array.array("d", zip(*array_mGammaD_limit_CS_fb_ctau2mm)[1]) )
gr_limit_CS_fb_vs_mGammaD_ctau2mm.SetLineWidth(2)
gr_limit_CS_fb_vs_mGammaD_ctau2mm.SetLineColor(ROOT.kMagenta)
gr_limit_CS_fb_vs_mGammaD_ctau2mm.SetLineStyle(10)
gr_limit_CS_fb_vs_mGammaD_ctau2mm.Draw("C")
l_limit_CS_fb_vs_mGammaD = ROOT.TLegend(0.4,0.6,0.8,0.9)
l_limit_CS_fb_vs_mGammaD.SetFillColor(ROOT.kWhite)
l_limit_CS_fb_vs_mGammaD.SetMargin(0.4)
l_limit_CS_fb_vs_mGammaD.SetBorderSize(0)
l_limit_CS_fb_vs_mGammaD.SetTextFont(42)
l_limit_CS_fb_vs_mGammaD.SetTextSize(0.035)
l_limit_CS_fb_vs_mGammaD.SetHeader("%d%% CL limits for samples"%CL)
l_limit_CS_fb_vs_mGammaD.AddEntry(gr_limit_CS_fb_vs_mGammaD_ctau0mm, "with #gamma_{D} life-time:","")
l_limit_CS_fb_vs_mGammaD.AddEntry(gr_limit_CS_fb_vs_mGammaD_ctau0mm, "c#tau_{#gamma_{D}} = 0 mm (prompt)","L")
l_limit_CS_fb_vs_mGammaD.AddEntry(gr_limit_CS_fb_vs_mGammaD_ctau02mm,"c#tau_{#gamma_{D}} = 0.2 mm","L")
l_limit_CS_fb_vs_mGammaD.AddEntry(gr_limit_CS_fb_vs_mGammaD_ctau05mm,"c#tau_{#gamma_{D}} = 0.5 mm","L")
l_limit_CS_fb_vs_mGammaD.AddEntry(gr_limit_CS_fb_vs_mGammaD_ctau2mm, "c#tau_{#gamma_{D}} = 2 mm","L")
l_limit_CS_fb_vs_mGammaD.Draw()
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/limit_CS_fb_vs_mGammaD_2015.pdf")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/limit_CS_fb_vs_mGammaD_2015.pdf -resize 900x900 plots/PNG/limit_CS_fb_vs_mGammaD_2015.png")
################################################################################
# Plot Upper 95% CL Limit on CSxBR2 vs ctau: 0.2 < ctau < 2.0
################################################################################
def limit_CSxBR2_fb_vs_ctau_2015():
cnv.SetLogy(0)
array_ctau_limit_CSxBR2_fb_m025GeV = []
array_ctau_limit_CSxBR2_fb_m04GeV = []
array_ctau_limit_CSxBR2_fb_m1GeV = []
for ctau in fRange(0.0, 2.0, 101):
array_ctau_limit_CSxBR2_fb_m025GeV.append(( ctau, fCmsLimitVsM(0.25)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.25 ) ))
array_ctau_limit_CSxBR2_fb_m04GeV.append(( ctau, fCmsLimitVsM( 0.4)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 0.4 ) ))
array_ctau_limit_CSxBR2_fb_m1GeV.append(( ctau, fCmsLimitVsM( 1.0)/lumi_fbinv/SF/fCmsDarkSusyAcceptance_LinearFit_2015_13TeV( ctau, 1.0 ) ))
h_limit_CSxBR2_fb_vs_ctau_dummy = ROOT.TH2F("h_limit_CSxBR2_fb_vs_ctau_dummy", "h_limit_CSxBR2_fb_vs_ctau_dummy", 1000, -0.2, 2.2, 1000, 0.0, 120.0)
h_limit_CSxBR2_fb_vs_ctau_dummy.SetXTitle("c#tau_{#gamma_{D}} [mm]")
h_limit_CSxBR2_fb_vs_ctau_dummy.SetYTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) B^{2}(#gamma_{D} #rightarrow 2 #mu) [fb]")
h_limit_CSxBR2_fb_vs_ctau_dummy.SetTitleOffset(1.35, "Y")
h_limit_CSxBR2_fb_vs_ctau_dummy.GetYaxis().CenterTitle(1)
h_limit_CSxBR2_fb_vs_ctau_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_CSxBR2_fb_vs_ctau_dummy.Draw()
gr_limit_CSxBR2_fb_vs_ctau_m025GeV = ROOT.TGraph( len(array_ctau_limit_CSxBR2_fb_m025GeV), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m025GeV)[0]), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m025GeV)[1]) )
gr_limit_CSxBR2_fb_vs_ctau_m025GeV.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_ctau_m025GeV.SetLineColor(ROOT.kGreen+2)
gr_limit_CSxBR2_fb_vs_ctau_m025GeV.SetLineStyle(9)
gr_limit_CSxBR2_fb_vs_ctau_m025GeV.Draw("C")
gr_limit_CSxBR2_fb_vs_ctau_m04GeV = ROOT.TGraph( len(array_ctau_limit_CSxBR2_fb_m04GeV), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m04GeV)[0]), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m04GeV)[1]) )
gr_limit_CSxBR2_fb_vs_ctau_m04GeV.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_ctau_m04GeV.SetLineColor(ROOT.kRed)
gr_limit_CSxBR2_fb_vs_ctau_m04GeV.SetLineStyle(1)
gr_limit_CSxBR2_fb_vs_ctau_m04GeV.Draw("C")
gr_limit_CSxBR2_fb_vs_ctau_m1GeV = ROOT.TGraph( len(array_ctau_limit_CSxBR2_fb_m1GeV), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m1GeV)[0]), array.array("d", zip(*array_ctau_limit_CSxBR2_fb_m1GeV)[1]) )
gr_limit_CSxBR2_fb_vs_ctau_m1GeV.SetLineWidth(2)
gr_limit_CSxBR2_fb_vs_ctau_m1GeV.SetLineColor(ROOT.kBlue)
gr_limit_CSxBR2_fb_vs_ctau_m1GeV.SetLineStyle(2)
gr_limit_CSxBR2_fb_vs_ctau_m1GeV.Draw("C")
l_limit_CSxBR2_fb_vs_ctau = ROOT.TLegend(0.25,0.65,0.6,0.9)
l_limit_CSxBR2_fb_vs_ctau.SetFillColor(ROOT.kWhite)
l_limit_CSxBR2_fb_vs_ctau.SetMargin(0.4)
l_limit_CSxBR2_fb_vs_ctau.SetBorderSize(0)
l_limit_CSxBR2_fb_vs_ctau.SetTextFont(42)
l_limit_CSxBR2_fb_vs_ctau.SetTextSize(0.035)
l_limit_CSxBR2_fb_vs_ctau.SetHeader("%d%% CL limits for samples"%CL)
l_limit_CSxBR2_fb_vs_ctau.AddEntry(gr_limit_CSxBR2_fb_vs_ctau_m025GeV,"with #gamma_{D} mass:","")
l_limit_CSxBR2_fb_vs_ctau.AddEntry(gr_limit_CSxBR2_fb_vs_ctau_m025GeV,"m_{#gamma_{D}} = 0.25 GeV","L")
l_limit_CSxBR2_fb_vs_ctau.AddEntry(gr_limit_CSxBR2_fb_vs_ctau_m04GeV, "m_{#gamma_{D}} = 0.4 GeV","L")
l_limit_CSxBR2_fb_vs_ctau.AddEntry(gr_limit_CSxBR2_fb_vs_ctau_m1GeV, "m_{#gamma_{D}} = 1.0 GeV","L")
l_limit_CSxBR2_fb_vs_ctau.Draw()
txtHeader.Draw()
cnv.SaveAs(topDirectory + "/PDF/limit_CSxBR2_fb_vs_ctau_2015.pdf")
os.system("convert -define pdf:use-cropbox=true -density 300 plots/PDF/limit_CSxBR2_fb_vs_ctau_2015.pdf -resize 900x900 plots/PNG/limit_CSxBR2_fb_vs_ctau_2015.png")
################################################################################
# Plot 95% CL Limit on CSxBR2 and on CS vs mGammaD and ctau
################################################################################
def limit_CSxBR2_fb_and_CS_fb_and_CS_over_CSsm_vs_mGammaD_ctau_3D_and_2D():
CSsm_fb = 1000.0 * fCS_SM_ggH_13TeV_pb(126.0)[0]
line_m_ctau_2 = ROOT.TLine(0.25, 2.0, 1.0, 2.0)
line_m_ctau_2.SetLineStyle(2)
line_m_ctau_2.SetLineWidth(1)
line_m_ctau_2.SetLineColor(ROOT.kBlack)
line_m_ctau_5 = ROOT.TLine(0.25, 5.0, 1.0, 5.0)
line_m_ctau_5.SetLineStyle(2)
line_m_ctau_5.SetLineWidth(1)
line_m_ctau_5.SetLineColor(ROOT.kBlack)
line_ctau_m_025 = ROOT.TLine(0.25, 0, 0.25, 2.0)
line_ctau_m_025.SetLineStyle(2)
line_ctau_m_025.SetLineWidth(1)
line_ctau_m_025.SetLineColor(ROOT.kBlack)
line_ctau_m_1 = ROOT.TLine(1.0, 0, 1.0, 2.0)
line_ctau_m_1.SetLineStyle(2)
line_ctau_m_1.SetLineWidth(1)
line_ctau_m_1.SetLineColor(ROOT.kBlack)
line_logEpsilon2_m_025 = ROOT.TLine(0.25, logEpsilon2_min, 0.25, logEpsilon2_max)
line_logEpsilon2_m_025.SetLineStyle(2)
line_logEpsilon2_m_025.SetLineWidth(1)
line_logEpsilon2_m_025.SetLineColor(ROOT.kBlack)
line_logEpsilon2_m_1 = ROOT.TLine(1.0, logEpsilon2_min, 1.0, logEpsilon2_max)
line_logEpsilon2_m_1.SetLineStyle(2)
line_logEpsilon2_m_1.SetLineWidth(1)
line_logEpsilon2_m_1.SetLineColor(ROOT.kBlack)
h_ctau_vs_mGammaD_dummy = ROOT.TH2F("h_ctau_vs_mGammaD_dummy", "h_ctau_vs_mGammaD_dummy", 100, mGammaD_GeV_bot, mGammaD_GeV_top, 100, ctau_mm_bot, ctau_mm_top)
h_ctau_vs_mGammaD_dummy.SetXTitle("m_{#gamma_{D}} [GeV]")
h_ctau_vs_mGammaD_dummy.SetYTitle("c#tau_{#gamma_{D}} [mm]")
h_ctau_vs_mGammaD_dummy.SetTitleOffset(1.1, "Y")
h_ctau_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_ctau_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
nBins = 100
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D = ROOT.TH2F("h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D", "h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D", nBins, mGammaD_GeV_min, mGammaD_GeV_max, nBins, ctau_mm_min, ctau_mm_max)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.SetXTitle("m_{#gamma_{D}} [GeV]")
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetXaxis().CenterTitle(1)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetXaxis().SetNdivisions(506)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetXaxis().SetTitleOffset(1.4)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.SetYTitle("c#tau [mm]")
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetYaxis().CenterTitle(1)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetYaxis().SetNdivisions(506)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetYaxis().SetTitleOffset(1.45)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.SetZTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) B^{2}(#gamma_{D} #rightarrow 2 #mu) [fb]")
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetZaxis().CenterTitle(1)
h_limit_CSxBR2_fb_vs_mGammaD_ctau_3D.GetZaxis().SetTitleOffset(1.3)
h_limit_CS_fb_vs_mGammaD_ctau_3D = ROOT.TH2F("h_limit_CS_fb_vs_mGammaD_ctau_3D", "h_limit_CS_fb_vs_mGammaD_ctau_3D", nBins, mGammaD_GeV_min, mGammaD_GeV_max, nBins, ctau_mm_min, ctau_mm_max)
h_limit_CS_fb_vs_mGammaD_ctau_3D.SetXTitle("m_{#gamma_{D}} [GeV/#it{c}^{2}]")
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetXaxis().CenterTitle(1)
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetXaxis().SetNdivisions(506)
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetXaxis().SetTitleOffset(1.4)
h_limit_CS_fb_vs_mGammaD_ctau_3D.SetYTitle("c#tau [mm]")
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetYaxis().CenterTitle(1)
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetYaxis().SetNdivisions(506)
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetYaxis().SetTitleOffset(1.45)
h_limit_CS_fb_vs_mGammaD_ctau_3D.SetZTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) [fb]")
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetZaxis().CenterTitle(1)
h_limit_CS_fb_vs_mGammaD_ctau_3D.GetZaxis().SetTitleOffset(1.3)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D = ROOT.TH2F("h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D", "h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D", nBins, mGammaD_GeV_min, mGammaD_GeV_max, nBins, ctau_mm_min, ctau_mm_max)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.SetXTitle("m_{#gamma_{D}} [GeV/#it{c}^{2}]")
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetXaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetXaxis().SetNdivisions(506)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetXaxis().SetTitleOffset(1.4)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.SetYTitle("c#tau [mm]")
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetYaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetYaxis().SetNdivisions(506)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetYaxis().SetTitleOffset(1.45)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.SetZTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) / #sigma_{SM}(pp #rightarrow h)")
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetZaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_ctau_3D.GetZaxis().SetTitleOffset(1.3)
h_logEpsilon2_vs_mGammaD_dummy = ROOT.TH2F("h_logEpsilon2_vs_mGammaD_dummy", "h_logEpsilon2_vs_mGammaD_dummy", 100, mGammaD_GeV_bot, mGammaD_GeV_top, 100, logEpsilon2_min, logEpsilon2_max)
h_logEpsilon2_vs_mGammaD_dummy.SetXTitle("m_{#gamma_{D}} [GeV/#it{c}^{2}]")
h_logEpsilon2_vs_mGammaD_dummy.SetYTitle("log_{10}(#epsilon^{2})")
h_logEpsilon2_vs_mGammaD_dummy.SetTitleOffset(1.1, "Y")
h_logEpsilon2_vs_mGammaD_dummy.GetYaxis().CenterTitle(1)
h_logEpsilon2_vs_mGammaD_dummy.GetYaxis().SetTitleSize(0.05)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D = ROOT.TH2F("h_limit_CS_over_CSsm_vs_mGammaD_epsilon2_3D", "h_limit_CS_over_CSsm_vs_mGammaD_epsilon2_3D", nBins, mGammaD_GeV_min, mGammaD_GeV_max, nBins, logEpsilon2_min, logEpsilon2_max)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.SetXTitle("m_{#gamma_{D}} [GeV/#it{c}^{2}]")
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetXaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetXaxis().SetNdivisions(506)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetXaxis().SetTitleOffset(1.4)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.SetYTitle("log_{10}(#epsilon^{2})")
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetYaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetYaxis().SetNdivisions(506)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetYaxis().SetTitleOffset(1.45)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.SetZTitle("#sigma(pp #rightarrow 2#gamma_{D} + X) / #sigma_{SM}(pp #rightarrow h)")
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetZaxis().CenterTitle(1)
h_limit_CS_over_CSsm_vs_mGammaD_logEpsilon2_3D.GetZaxis().SetTitleOffset(1.3)