-
Notifications
You must be signed in to change notification settings - Fork 0
/
A ROOT Guide For Beginners.html
2296 lines (2253 loc) · 280 KB
/
A ROOT Guide For Beginners.html
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
<!DOCTYPE html>
<!-- saved from url=(0062)http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="“Diving into ROOT”">
<title>A ROOT Guide For Beginners</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; position: absolute; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; }
pre.numberSource a.sourceLine:empty
{ position: absolute; }
pre.numberSource a.sourceLine::before
{ content: attr(data-line-number);
position: absolute; left: -5em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script src="./A ROOT Guide For Beginners_files/MathJax.js.下载" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
<style>
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
margin-top: 0 !important; }
body > *:last-child {
margin-bottom: 0 !important; }
a {
text-decoration: none;
color: #4183C4; }
a.absent {
color: #cc0000; }
a.anchor {
display: block;
padding-left: 30px;
margin-left: -30px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0; }
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
cursor: text;
position: relative; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA09pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoMTMuMCAyMDEyMDMwNS5tLjQxNSAyMDEyLzAzLzA1OjIxOjAwOjAwKSAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUM2NjlDQjI4ODBGMTFFMTg1ODlEODNERDJBRjUwQTQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUM2NjlDQjM4ODBGMTFFMTg1ODlEODNERDJBRjUwQTQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QzY2OUNCMDg4MEYxMUUxODU4OUQ4M0REMkFGNTBBNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QzY2OUNCMTg4MEYxMUUxODU4OUQ4M0REMkFGNTBBNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsQhXeAAAABfSURBVHjaYvz//z8DJYCRUgMYQAbAMBQIAvEqkBQWXI6sHqwHiwG70TTBxGaiWwjCTGgOUgJiF1J8wMRAIUA34B4Q76HUBelAfJYSA0CuMIEaRP8wGIkGMA54bgQIMACAmkXJi0hKJQAAAABJRU5ErkJggg==) no-repeat 10px center;
text-decoration: none; }
h1 tt, h1 code {
font-size: inherit; }
h2 tt, h2 code {
font-size: inherit; }
h3 tt, h3 code {
font-size: inherit; }
h4 tt, h4 code {
font-size: inherit; }
h5 tt, h5 code {
font-size: inherit; }
h6 tt, h6 code {
font-size: inherit; }
h1 {
font-size: 28px;
color: black; }
h2 {
font-size: 24px;
border-bottom: 1px solid #cccccc;
color: black; }
h3 {
font-size: 18px; }
h4 {
font-size: 16px; }
h5 {
font-size: 14px; }
h6 {
color: #777777;
font-size: 14px; }
p, blockquote, ul, ol, dl, li, table, pre {
margin: 15px 0; }
hr {
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OENDRjNBN0E2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OENDRjNBN0I2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4Q0NGM0E3ODY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4Q0NGM0E3OTY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqqezsUAAAAfSURBVHjaYmRABcYwBiM2QSA4y4hNEKYDQxAEAAIMAHNGAzhkPOlYAAAAAElFTkSuQmCC) repeat-x 0 0;
border: 0 none;
color: #cccccc;
height: 4px;
padding: 0;
}
body > h2:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child + h2 {
margin-top: 0;
padding-top: 0; }
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
margin-top: 0;
padding-top: 0; }
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0; }
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
margin-top: 0; }
li p.first {
display: inline-block; }
li {
margin: 0; }
ul, ol {
padding-left: 30px; }
ul :first-child, ol :first-child {
margin-top: 0; }
dl {
padding: 0; }
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px; }
dl dt:first-child {
padding: 0; }
dl dt > :first-child {
margin-top: 0; }
dl dt > :last-child {
margin-bottom: 0; }
dl dd {
margin: 0 0 15px;
padding: 0 15px; }
dl dd > :first-child {
margin-top: 0; }
dl dd > :last-child {
margin-bottom: 0; }
blockquote {
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
table {
padding: 0;border-collapse: collapse; }
table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
table tr:nth-child(2n) {
background-color: #f8f8f8; }
table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
table tr th :first-child, table tr td :first-child {
margin-top: 0; }
table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
img {
max-width: 100%; }
span.frame {
display: block;
overflow: hidden; }
span.frame > span {
border: 1px solid #dddddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto; }
span.frame span img {
display: block;
float: left; }
span.frame span span {
clear: both;
color: #333333;
display: block;
padding: 5px 0 0; }
span.align-center {
display: block;
overflow: hidden;
clear: both; }
span.align-center > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center; }
span.align-center span img {
margin: 0 auto;
text-align: center; }
span.align-right {
display: block;
overflow: hidden;
clear: both; }
span.align-right > span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right; }
span.align-right span img {
margin: 0;
text-align: right; }
span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left; }
span.float-left span {
margin: 13px 0 0; }
span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right; }
span.float-right > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right; }
code, tt {
margin: 0 2px;
padding: 0 5px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px; }
pre code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent; }
.highlight pre {
background-color: #f8f8f8;
border: 1px solid #cccccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px; }
pre {
background-color: #f8f8f8;
border: 1px solid #cccccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px; }
pre code, pre tt {
background-color: transparent;
border: none; }
sup {
font-size: 0.83em;
vertical-align: super;
line-height: 0;
}
* {
-webkit-print-color-adjust: exact;
}
@media screen and (min-width: 914px) {
body {
width: 854px;
margin:0 auto;
}
}
@media print {
table, pre {
page-break-inside: avoid;
}
pre {
word-wrap: break-word;
}
}
</style>
<style type="text/css">
.stackedit-open-button {
position: absolute;
width: 24px;
height: 24px;
background: no-repeat url("chrome-extension://ajehldoplanpchfokmeempkekhnhmoha/icon.svg");
background-size: 24px 24px;
cursor: pointer;
opacity: 0.5;
transition: opacity 0.5s;
}
.stackedit-open-button:focus,
.stackedit-open-button:hover {
opacity: 1;
}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Menu_Button .MathJax_Hover_Arrow {position: absolute; cursor: pointer; display: inline-block; border: 2px solid #AAA; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px; font-family: 'Courier New',Courier; font-size: 9px; color: #F0F0F0}
.MathJax_Menu_Button .MathJax_Hover_Arrow span {display: block; background-color: #AAA; border: 1px solid; border-radius: 3px; line-height: 0; padding: 4px}
.MathJax_Hover_Arrow:hover {color: white!important; border: 2px solid #CCC!important}
.MathJax_Hover_Arrow:hover span {background-color: #CCC!important}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_About.MathJax_MousePost {outline: none}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 2px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 2px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; padding-top: .25em; color: #666666; font-size: .75em}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuArrow.RTL {left: .5em; right: auto}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuCheck.RTL {right: .7em; left: auto}
.MathJax_MenuRadioCheck {position: absolute; left: 1em}
.MathJax_MenuRadioCheck.RTL {right: 1em; left: auto}
.MathJax_MenuLabel {padding: 2px 2em 4px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #CCCCCC; margin: 4px 1px 0px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: Highlight; color: HighlightText}
.MathJax_MenuDisabled:focus, .MathJax_MenuLabel:focus {background-color: #E8E8E8}
.MathJax_ContextMenu:focus {outline: none}
.MathJax_ContextMenu .MathJax_MenuItem:focus {outline: none}
#MathJax_AboutClose {top: .2em; right: .2em}
.MathJax_Menu .MathJax_MenuClose {top: -10px; left: -10px}
.MathJax_MenuClose {position: absolute; cursor: pointer; display: inline-block; border: 2px solid #AAA; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; font-family: 'Courier New',Courier; font-size: 24px; color: #F0F0F0}
.MathJax_MenuClose span {display: block; background-color: #AAA; border: 1.5px solid; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; line-height: 0; padding: 8px 0 6px}
.MathJax_MenuClose:hover {color: white!important; border: 2px solid #CCC!important}
.MathJax_MenuClose:hover span {background-color: #CCC!important}
.MathJax_MenuClose:hover:focus {outline: none}
</style><style type="text/css">.MathJax_Preview .MJXf-math {color: inherit!important}
</style><style type="text/css">.MJX_Assistive_MathML {position: absolute!important; top: 0; left: 0; clip: rect(1px, 1px, 1px, 1px); padding: 1px 0 0 0!important; border: 0!important; height: 1px!important; width: 1px!important; overflow: hidden!important; display: block!important; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none}
.MJX_Assistive_MathML.MJX_Assistive_MathML_Block {width: 100%!important}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MJXp-script {font-size: .8em}
.MJXp-right {-webkit-transform-origin: right; -moz-transform-origin: right; -ms-transform-origin: right; -o-transform-origin: right; transform-origin: right}
.MJXp-bold {font-weight: bold}
.MJXp-italic {font-style: italic}
.MJXp-scr {font-family: MathJax_Script,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-frak {font-family: MathJax_Fraktur,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-sf {font-family: MathJax_SansSerif,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-cal {font-family: MathJax_Caligraphic,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-mono {font-family: MathJax_Typewriter,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-largeop {font-size: 150%}
.MJXp-largeop.MJXp-int {vertical-align: -.2em}
.MJXp-math {display: inline-block; line-height: 1.2; text-indent: 0; font-family: 'Times New Roman',Times,STIXGeneral,serif; white-space: nowrap; border-collapse: collapse}
.MJXp-display {display: block; text-align: center; margin: 1em 0}
.MJXp-math span {display: inline-block}
.MJXp-box {display: block!important; text-align: center}
.MJXp-box:after {content: " "}
.MJXp-rule {display: block!important; margin-top: .1em}
.MJXp-char {display: block!important}
.MJXp-mo {margin: 0 .15em}
.MJXp-mfrac {margin: 0 .125em; vertical-align: .25em}
.MJXp-denom {display: inline-table!important; width: 100%}
.MJXp-denom > * {display: table-row!important}
.MJXp-surd {vertical-align: top}
.MJXp-surd > * {display: block!important}
.MJXp-script-box > * {display: table!important; height: 50%}
.MJXp-script-box > * > * {display: table-cell!important; vertical-align: top}
.MJXp-script-box > *:last-child > * {vertical-align: bottom}
.MJXp-script-box > * > * > * {display: block!important}
.MJXp-mphantom {visibility: hidden}
.MJXp-munderover {display: inline-table!important}
.MJXp-over {display: inline-block!important; text-align: center}
.MJXp-over > * {display: block!important}
.MJXp-munderover > * {display: table-row!important}
.MJXp-mtable {vertical-align: .25em; margin: 0 .125em}
.MJXp-mtable > * {display: inline-table!important; vertical-align: middle}
.MJXp-mtr {display: table-row!important}
.MJXp-mtd {display: table-cell!important; text-align: center; padding: .5em 0 0 .5em}
.MJXp-mtr > .MJXp-mtd:first-child {padding-left: 0}
.MJXp-mtr:first-child > .MJXp-mtd {padding-top: 0}
.MJXp-mlabeledtr {display: table-row!important}
.MJXp-mlabeledtr > .MJXp-mtd:first-child {padding-left: 0}
.MJXp-mlabeledtr:first-child > .MJXp-mtd {padding-top: 0}
.MJXp-merror {background-color: #FFFF88; color: #CC0000; border: 1px solid #CC0000; padding: 1px 3px; font-style: normal; font-size: 90%}
.MJXp-scale0 {-webkit-transform: scaleX(.0); -moz-transform: scaleX(.0); -ms-transform: scaleX(.0); -o-transform: scaleX(.0); transform: scaleX(.0)}
.MJXp-scale1 {-webkit-transform: scaleX(.1); -moz-transform: scaleX(.1); -ms-transform: scaleX(.1); -o-transform: scaleX(.1); transform: scaleX(.1)}
.MJXp-scale2 {-webkit-transform: scaleX(.2); -moz-transform: scaleX(.2); -ms-transform: scaleX(.2); -o-transform: scaleX(.2); transform: scaleX(.2)}
.MJXp-scale3 {-webkit-transform: scaleX(.3); -moz-transform: scaleX(.3); -ms-transform: scaleX(.3); -o-transform: scaleX(.3); transform: scaleX(.3)}
.MJXp-scale4 {-webkit-transform: scaleX(.4); -moz-transform: scaleX(.4); -ms-transform: scaleX(.4); -o-transform: scaleX(.4); transform: scaleX(.4)}
.MJXp-scale5 {-webkit-transform: scaleX(.5); -moz-transform: scaleX(.5); -ms-transform: scaleX(.5); -o-transform: scaleX(.5); transform: scaleX(.5)}
.MJXp-scale6 {-webkit-transform: scaleX(.6); -moz-transform: scaleX(.6); -ms-transform: scaleX(.6); -o-transform: scaleX(.6); transform: scaleX(.6)}
.MJXp-scale7 {-webkit-transform: scaleX(.7); -moz-transform: scaleX(.7); -ms-transform: scaleX(.7); -o-transform: scaleX(.7); transform: scaleX(.7)}
.MJXp-scale8 {-webkit-transform: scaleX(.8); -moz-transform: scaleX(.8); -ms-transform: scaleX(.8); -o-transform: scaleX(.8); transform: scaleX(.8)}
.MJXp-scale9 {-webkit-transform: scaleX(.9); -moz-transform: scaleX(.9); -ms-transform: scaleX(.9); -o-transform: scaleX(.9); transform: scaleX(.9)}
.MathJax_PHTML .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_About.MathJax_MousePost {outline: none}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 2px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 2px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; padding-top: .25em; color: #666666; font-size: .75em}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuArrow.RTL {left: .5em; right: auto}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuCheck.RTL {right: .7em; left: auto}
.MathJax_MenuRadioCheck {position: absolute; left: 1em}
.MathJax_MenuRadioCheck.RTL {right: 1em; left: auto}
.MathJax_MenuLabel {padding: 2px 2em 4px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #CCCCCC; margin: 4px 1px 0px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: Highlight; color: HighlightText}
.MathJax_MenuDisabled:focus, .MathJax_MenuLabel:focus {background-color: #E8E8E8}
.MathJax_ContextMenu:focus {outline: none}
.MathJax_ContextMenu .MathJax_MenuItem:focus {outline: none}
#MathJax_AboutClose {top: .2em; right: .2em}
.MathJax_Menu .MathJax_MenuClose {top: -10px; left: -10px}
.MathJax_MenuClose {position: absolute; cursor: pointer; display: inline-block; border: 2px solid #AAA; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; font-family: 'Courier New',Courier; font-size: 24px; color: #F0F0F0}
.MathJax_MenuClose span {display: block; background-color: #AAA; border: 1.5px solid; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; line-height: 0; padding: 8px 0 6px}
.MathJax_MenuClose:hover {color: white!important; border: 2px solid #CCC!important}
.MathJax_MenuClose:hover span {background-color: #CCC!important}
.MathJax_MenuClose:hover:focus {outline: none}
</style><style type="text/css">.mjx-chtml {display: inline-block; line-height: 0; text-indent: 0; text-align: left; text-transform: none; font-style: normal; font-weight: normal; font-size: 100%; font-size-adjust: none; letter-spacing: normal; word-wrap: normal; word-spacing: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; margin: 0; padding: 1px 0}
.MJXc-display {display: block; text-align: center; margin: 1em 0; padding: 0}
.mjx-chtml[tabindex]:focus, body :focus .mjx-chtml[tabindex] {display: inline-table}
.mjx-full-width {text-align: center; display: table-cell!important; width: 10000em}
.mjx-math {display: inline-block; border-collapse: separate; border-spacing: 0}
.mjx-math * {display: inline-block; -webkit-box-sizing: content-box!important; -moz-box-sizing: content-box!important; box-sizing: content-box!important; text-align: left}
.mjx-numerator {display: block; text-align: center}
.mjx-denominator {display: block; text-align: center}
.MJXc-stacked {height: 0; position: relative}
.MJXc-stacked > * {position: absolute}
.MJXc-bevelled > * {display: inline-block}
.mjx-stack {display: inline-block}
.mjx-op {display: block}
.mjx-under {display: table-cell}
.mjx-over {display: block}
.mjx-over > * {padding-left: 0px!important; padding-right: 0px!important}
.mjx-under > * {padding-left: 0px!important; padding-right: 0px!important}
.mjx-stack > .mjx-sup {display: block}
.mjx-stack > .mjx-sub {display: block}
.mjx-prestack > .mjx-presup {display: block}
.mjx-prestack > .mjx-presub {display: block}
.mjx-delim-h > .mjx-char {display: inline-block}
.mjx-surd {vertical-align: top}
.mjx-mphantom * {visibility: hidden}
.mjx-merror {background-color: #FFFF88; color: #CC0000; border: 1px solid #CC0000; padding: 2px 3px; font-style: normal; font-size: 90%}
.mjx-annotation-xml {line-height: normal}
.mjx-menclose > svg {fill: none; stroke: currentColor}
.mjx-mtr {display: table-row}
.mjx-mlabeledtr {display: table-row}
.mjx-mtd {display: table-cell; text-align: center}
.mjx-label {display: table-row}
.mjx-box {display: inline-block}
.mjx-block {display: block}
.mjx-span {display: inline}
.mjx-char {display: block; white-space: pre}
.mjx-itable {display: inline-table; width: auto}
.mjx-row {display: table-row}
.mjx-cell {display: table-cell}
.mjx-table {display: table; width: 100%}
.mjx-line {display: block; height: 0}
.mjx-strut {width: 0; padding-top: 1em}
.mjx-vsize {width: 0}
.MJXc-space1 {margin-left: .167em}
.MJXc-space2 {margin-left: .222em}
.MJXc-space3 {margin-left: .278em}
.mjx-chartest {display: block; visibility: hidden; position: absolute; top: 0; line-height: normal; font-size: 500%}
.mjx-chartest .mjx-char {display: inline}
.mjx-chartest .mjx-box {padding-top: 1000px}
.MJXc-processing {visibility: hidden; position: fixed; width: 0; height: 0; overflow: hidden}
.MJXc-processed {display: none}
.mjx-test {display: block; font-style: normal; font-weight: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow: hidden; height: 1px}
.mjx-ex-box-test {position: absolute; overflow: hidden; width: 1px; height: 60ex}
.mjx-line-box-test {display: table!important}
.mjx-line-box-test span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0}
#MathJax_CHTML_Tooltip {background-color: InfoBackground; color: InfoText; border: 1px solid black; box-shadow: 2px 2px 5px #AAAAAA; -webkit-box-shadow: 2px 2px 5px #AAAAAA; -moz-box-shadow: 2px 2px 5px #AAAAAA; -khtml-box-shadow: 2px 2px 5px #AAAAAA; padding: 3px 4px; z-index: 401; position: absolute; left: 0; top: 0; width: auto; height: auto; display: none}
.mjx-chtml .mjx-noError {line-height: 1.2; vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
.MJXc-TeX-unknown-R {font-family: STIXGeneral,'Cambria Math','Arial Unicode MS',serif; font-style: normal; font-weight: normal}
.MJXc-TeX-unknown-I {font-family: STIXGeneral,'Cambria Math','Arial Unicode MS',serif; font-style: italic; font-weight: normal}
.MJXc-TeX-unknown-B {font-family: STIXGeneral,'Cambria Math','Arial Unicode MS',serif; font-style: normal; font-weight: bold}
.MJXc-TeX-unknown-BI {font-family: STIXGeneral,'Cambria Math','Arial Unicode MS',serif; font-style: italic; font-weight: bold}
.MJXc-TeX-ams-R {font-family: MJXc-TeX-ams-R,MJXc-TeX-ams-Rw}
.MJXc-TeX-cal-B {font-family: MJXc-TeX-cal-B,MJXc-TeX-cal-Bx,MJXc-TeX-cal-Bw}
.MJXc-TeX-frak-R {font-family: MJXc-TeX-frak-R,MJXc-TeX-frak-Rw}
.MJXc-TeX-frak-B {font-family: MJXc-TeX-frak-B,MJXc-TeX-frak-Bx,MJXc-TeX-frak-Bw}
.MJXc-TeX-math-BI {font-family: MJXc-TeX-math-BI,MJXc-TeX-math-BIx,MJXc-TeX-math-BIw}
.MJXc-TeX-sans-R {font-family: MJXc-TeX-sans-R,MJXc-TeX-sans-Rw}
.MJXc-TeX-sans-B {font-family: MJXc-TeX-sans-B,MJXc-TeX-sans-Bx,MJXc-TeX-sans-Bw}
.MJXc-TeX-sans-I {font-family: MJXc-TeX-sans-I,MJXc-TeX-sans-Ix,MJXc-TeX-sans-Iw}
.MJXc-TeX-script-R {font-family: MJXc-TeX-script-R,MJXc-TeX-script-Rw}
.MJXc-TeX-type-R {font-family: MJXc-TeX-type-R,MJXc-TeX-type-Rw}
.MJXc-TeX-cal-R {font-family: MJXc-TeX-cal-R,MJXc-TeX-cal-Rw}
.MJXc-TeX-main-B {font-family: MJXc-TeX-main-B,MJXc-TeX-main-Bx,MJXc-TeX-main-Bw}
.MJXc-TeX-main-I {font-family: MJXc-TeX-main-I,MJXc-TeX-main-Ix,MJXc-TeX-main-Iw}
.MJXc-TeX-main-R {font-family: MJXc-TeX-main-R,MJXc-TeX-main-Rw}
.MJXc-TeX-math-I {font-family: MJXc-TeX-math-I,MJXc-TeX-math-Ix,MJXc-TeX-math-Iw}
.MJXc-TeX-size1-R {font-family: MJXc-TeX-size1-R,MJXc-TeX-size1-Rw}
.MJXc-TeX-size2-R {font-family: MJXc-TeX-size2-R,MJXc-TeX-size2-Rw}
.MJXc-TeX-size3-R {font-family: MJXc-TeX-size3-R,MJXc-TeX-size3-Rw}
.MJXc-TeX-size4-R {font-family: MJXc-TeX-size4-R,MJXc-TeX-size4-Rw}
.MJXc-TeX-vec-R {font-family: MJXc-TeX-vec-R,MJXc-TeX-vec-Rw}
.MJXc-TeX-vec-B {font-family: MJXc-TeX-vec-B,MJXc-TeX-vec-Bx,MJXc-TeX-vec-Bw}
@font-face {font-family: MJXc-TeX-ams-R; src: local('MathJax_AMS'), local('MathJax_AMS-Regular')}
@font-face {font-family: MJXc-TeX-ams-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_AMS-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_AMS-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-cal-B; src: local('MathJax_Caligraphic Bold'), local('MathJax_Caligraphic-Bold')}
@font-face {font-family: MJXc-TeX-cal-Bx; src: local('MathJax_Caligraphic'); font-weight: bold}
@font-face {font-family: MJXc-TeX-cal-Bw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Bold.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Bold.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-frak-R; src: local('MathJax_Fraktur'), local('MathJax_Fraktur-Regular')}
@font-face {font-family: MJXc-TeX-frak-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-frak-B; src: local('MathJax_Fraktur Bold'), local('MathJax_Fraktur-Bold')}
@font-face {font-family: MJXc-TeX-frak-Bx; src: local('MathJax_Fraktur'); font-weight: bold}
@font-face {font-family: MJXc-TeX-frak-Bw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Bold.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Bold.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-math-BI; src: local('MathJax_Math BoldItalic'), local('MathJax_Math-BoldItalic')}
@font-face {font-family: MJXc-TeX-math-BIx; src: local('MathJax_Math'); font-weight: bold; font-style: italic}
@font-face {font-family: MJXc-TeX-math-BIw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Math-BoldItalic.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Math-BoldItalic.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-sans-R; src: local('MathJax_SansSerif'), local('MathJax_SansSerif-Regular')}
@font-face {font-family: MJXc-TeX-sans-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-sans-B; src: local('MathJax_SansSerif Bold'), local('MathJax_SansSerif-Bold')}
@font-face {font-family: MJXc-TeX-sans-Bx; src: local('MathJax_SansSerif'); font-weight: bold}
@font-face {font-family: MJXc-TeX-sans-Bw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Bold.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Bold.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-sans-I; src: local('MathJax_SansSerif Italic'), local('MathJax_SansSerif-Italic')}
@font-face {font-family: MJXc-TeX-sans-Ix; src: local('MathJax_SansSerif'); font-style: italic}
@font-face {font-family: MJXc-TeX-sans-Iw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Italic.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Italic.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-script-R; src: local('MathJax_Script'), local('MathJax_Script-Regular')}
@font-face {font-family: MJXc-TeX-script-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Script-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Script-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-type-R; src: local('MathJax_Typewriter'), local('MathJax_Typewriter-Regular')}
@font-face {font-family: MJXc-TeX-type-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Typewriter-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Typewriter-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-cal-R; src: local('MathJax_Caligraphic'), local('MathJax_Caligraphic-Regular')}
@font-face {font-family: MJXc-TeX-cal-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-main-B; src: local('MathJax_Main Bold'), local('MathJax_Main-Bold')}
@font-face {font-family: MJXc-TeX-main-Bx; src: local('MathJax_Main'); font-weight: bold}
@font-face {font-family: MJXc-TeX-main-Bw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Main-Bold.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-main-I; src: local('MathJax_Main Italic'), local('MathJax_Main-Italic')}
@font-face {font-family: MJXc-TeX-main-Ix; src: local('MathJax_Main'); font-style: italic}
@font-face {font-family: MJXc-TeX-main-Iw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Main-Italic.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-main-R; src: local('MathJax_Main'), local('MathJax_Main-Regular')}
@font-face {font-family: MJXc-TeX-main-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Main-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-math-I; src: local('MathJax_Math Italic'), local('MathJax_Math-Italic')}
@font-face {font-family: MJXc-TeX-math-Ix; src: local('MathJax_Math'); font-style: italic}
@font-face {font-family: MJXc-TeX-math-Iw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Math-Italic.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-size1-R; src: local('MathJax_Size1'), local('MathJax_Size1-Regular')}
@font-face {font-family: MJXc-TeX-size1-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Size1-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-size2-R; src: local('MathJax_Size2'), local('MathJax_Size2-Regular')}
@font-face {font-family: MJXc-TeX-size2-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Size2-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-size3-R; src: local('MathJax_Size3'), local('MathJax_Size3-Regular')}
@font-face {font-family: MJXc-TeX-size3-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Size3-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-size4-R; src: local('MathJax_Size4'), local('MathJax_Size4-Regular')}
@font-face {font-family: MJXc-TeX-size4-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Size4-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-vec-R; src: local('MathJax_Vector'), local('MathJax_Vector-Regular')}
@font-face {font-family: MJXc-TeX-vec-Rw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Vector-Regular.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Vector-Regular.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Vector-Regular.otf') format('opentype')}
@font-face {font-family: MJXc-TeX-vec-B; src: local('MathJax_Vector Bold'), local('MathJax_Vector-Bold')}
@font-face {font-family: MJXc-TeX-vec-Bx; src: local('MathJax_Vector'); font-weight: bold}
@font-face {font-family: MJXc-TeX-vec-Bw; src /*1*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/eot/MathJax_Vector-Bold.eot'); src /*2*/: url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/woff/MathJax_Vector-Bold.woff') format('woff'), url('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS/TeX/otf/MathJax_Vector-Bold.otf') format('opentype')}
</style></head>
<body><div id="MathJax_Message" style="display: none;"></div>
<header>
<h1 class="title">A ROOT Guide For Beginners</h1>
<p class="author">“Diving into ROOT”</p>
</header>
<nav id="TOC">
<ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#motivation-and-introduction"><span class="toc-section-number">1</span> Motivation and Introduction</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-basics"><span class="toc-section-number">2</span> ROOT Basics</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-as-calculator"><span class="toc-section-number">2.1</span> ROOT as calculator</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#learn-c-at-the-root-prompt"><span class="toc-section-number">2.2</span> Learn C++ at the ROOT prompt</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-as-function-plotter"><span class="toc-section-number">2.3</span> ROOT as function plotter</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#controlling-root"><span class="toc-section-number">2.4</span> Controlling ROOT</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#plotting-measurements"><span class="toc-section-number">2.5</span> Plotting Measurements</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#histograms-in-root"><span class="toc-section-number">2.6</span> Histograms in ROOT</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#interactive-root"><span class="toc-section-number">2.7</span> Interactive ROOT</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-beginners-faq"><span class="toc-section-number">2.8</span> ROOT Beginners’ FAQ</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-macros"><span class="toc-section-number">3</span> ROOT Macros</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#general-remarks-on-root-macros"><span class="toc-section-number">3.1</span> General Remarks on ROOT macros</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#a-more-complete-example"><span class="toc-section-number">3.2</span> A more complete example</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#summary-of-visual-effects"><span class="toc-section-number">3.3</span> Summary of Visual effects</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#interpretation-and-compilation"><span class="toc-section-number">3.4</span> Interpretation and Compilation</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#graphs"><span class="toc-section-number">4</span> Graphs</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#read-graph-points-from-file"><span class="toc-section-number">4.1</span> Read Graph Points from File</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#polar-graphs"><span class="toc-section-number">4.2</span> Polar Graphs</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#d-graphs"><span class="toc-section-number">4.3</span> 2D Graphs</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#multiple-graphs"><span class="toc-section-number">4.4</span> Multiple graphs</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#histograms"><span class="toc-section-number">5</span> Histograms</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#your-first-histogram"><span class="toc-section-number">5.1</span> Your First Histogram</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#add-and-divide-histograms"><span class="toc-section-number">5.2</span> Add and Divide Histograms</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#two-dimensional-histograms"><span class="toc-section-number">5.3</span> Two-dimensional Histograms</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#multiple-histograms"><span class="toc-section-number">5.4</span> Multiple histograms</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#functions-and-parameter-estimation"><span class="toc-section-number">6</span> Functions and Parameter Estimation</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#fitting-functions-to-pseudo-data"><span class="toc-section-number">6.1</span> Fitting Functions to Pseudo Data</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#toy-monte-carlo-experiments"><span class="toc-section-number">6.2</span> Toy Monte Carlo Experiments</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#file-io-and-parallel-analysis"><span class="toc-section-number">7</span> File I/O and Parallel Analysis</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#storing-root-objects"><span class="toc-section-number">7.1</span> Storing ROOT Objects</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#n-tuples-in-root"><span class="toc-section-number">7.2</span> N-tuples in ROOT</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#root-in-python"><span class="toc-section-number">8</span> ROOT in Python</a><ul>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#pyroot"><span class="toc-section-number">8.1</span> PyROOT</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#custom-code-from-c-to-python"><span class="toc-section-number">8.2</span> Custom code: from C++ to Python</a></li>
</ul></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#concluding-remarks"><span class="toc-section-number">9</span> Concluding Remarks</a></li>
<li><a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#references">References</a></li>
</ul>
</nav>
<hr>
<p><strong>Abstract</strong></p>
<p>ROOT is a software framework for data analysis and I/O: a powerful tool to cope with the demanding tasks typical of state of the art scientific data analysis. Among its prominent features are an advanced graphical user interface, ideal for interactive analysis, an interpreter for the C++ programming language, for rapid and efficient prototyping and a persistency mechanism for C++ objects, used also to write every year petabytes of data recorded by the Large Hadron Collider experiments. This introductory guide illustrates the main features of ROOT which are relevant for the typical problems of data analysis: input and plotting of data from measurements and fitting of analytical functions.</p>
<p><em>Original Authors</em> - D. Piparo - G. Quast - M. Zeise</p>
<h1 id="motivation-and-introduction"><span class="header-section-number">1</span> Motivation and Introduction</h1>
<p><strong><em>Welcome to data analysis!</em></strong></p>
<p>Comparison of measurements to theoretical models is one of the standard tasks in experimental physics. In the most simple case, a “model” is just a function providing predictions of measured data. Very often, the model depends on parameters. Such a model may simply state “the current <em>I</em> is proportional to the voltage <em>U</em>”, and the task of the experimentalist consists of determining the resistance, <em>R</em>, from a set of measurements.</p>
<p>As a first step, a visualisation of the data is needed. Next, some manipulations typically have to be applied, e.g. corrections or parameter transformations. Quite often, these manipulations are complex ones, and a powerful library of mathematical functions and procedures should be provided - think for example of an integral or peak-search or a Fourier transformation applied to an input spectrum to obtain the actual measurement described by the model.</p>
<p>One specialty of experimental physics are the inevitable uncertainties affecting each measurement, and visualisation tools have to include these. In subsequent analysis, the statistical nature of the errors must be handled properly.</p>
<p>As the last step, measurements are compared to models, and free model parameters need to be determined in this process. See Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f11">1.1</a> for an example of a function (model) fit to data points. Several standard methods are available, and a data analysis tool should provide easy access to more than one of them. Means to quantify the level of agreement between measurements and model must also be available. <!--
[f11]: figures/examplefit.png "f11"
<a name="f11"></a>
![Measured data points with error bars and fitted quadratic
function.\label{f11}][f11]--></p>
<p>Quite often, the data volume to be analyzed is large - think of fine-granular measurements accumulated with the aid of computers. A usable tool therefore must contain easy-to-use and efficient methods for storing and handling data.</p>
<p>In Quantum mechanics, models typically only predict the probability density function (“pdf”) of measurements depending on a number of parameters, and the aim of the experimental analysis is to extract the parameters from the observed distribution of frequencies at which certain values of the measurement are observed. Measurements of this kind require means to generate and visualize frequency distributions, so-called histograms, and stringent statistical treatment to extract the model parameters from purely statistical distributions.</p>
<p>Simulation of expected data is another important aspect in data analysis. By repeated generation of “pseudo-data”, which are analysed in the same manner as intended for the real data, analysis procedures can be validated or compared. In many cases, the distribution of the measurement errors is not precisely known, and simulation offers the possibility to test the effects of different assumptions.</p>
<p>A powerful software framework addressing all of the above requirements is ROOT, an open source project coordinated by the European Organisation for Nuclear Research, CERN in Geneva.</p>
<p>ROOT is very flexible and provides both a programming interface to use in own applications and a graphical user interface for interactive data analysis. The purpose of this document is to serve as a beginners guide and provides extendable examples for your own use cases, based on typical problems addressed in student labs. This guide will hopefully lay the ground for more complex applications in your future scientific work building on a modern, state-of the art tool for data analysis.</p>
<p>This guide in form of a tutorial is intended to introduce you quickly to the ROOT package. This goal will be accomplished using concrete examples, according to the “learning by doing” principle. Also because of this reason, this guide cannot cover all the complexity of the ROOT package. Nevertheless, once you feel confident with the concepts presented in the following chapters, you will be able to appreciate the ROOT Users Guide <span class="citation" data-cites="ROOT_Users_Guide">(<em>The Root Users Guide</em> 2015)</span> and navigate through the Class Reference <span class="citation" data-cites="ROOT_Class_Reference">(<em>The Root Reference Guide</em> 2013)</span> to find all the details you might be interested in. You can even look at the code itself, since ROOT is a free, open-source product. Use these documents in parallel to this tutorial!</p>
<p>The ROOT Data Analysis Framework itself is written in and heavily relies on the <code>C++</code> programming language: some knowledge about <code>C++</code> is required. Jus take advantage from the immense available literature about <code>C++</code> if you do not have any idea of what this language is about.</p>
<p>ROOT is available for many platforms (Linux, Mac OS X, Windows…), but in this guide we will implicitly assume that you are using Linux. The first thing you need to do with ROOT is install it, don’t you ? Obtaining the latest ROOT version is straightforward. Just seek the “Pro” version on this webpage <a href="http://root.cern.ch/downloading-root" class="uri">http://root.cern.ch/downloading-root</a>. You will find precompiled versions for the different architectures, or the ROOT source code to compile yourself. Just pick up the flavour you need and follow the installation instructions.</p>
<p><strong>Let’s dive into ROOT!</strong></p>
<h1 id="root-basics"><span class="header-section-number">2</span> ROOT Basics</h1>
<p>Now that you have installed ROOT, what’s this interactive shell thing you’re running ? It’s like this: ROOT leads a double life. It has an interpreter for macros (Cling <span class="citation" data-cites="Cling">(“What is Cling” 2015)</span>) that you can run from the command line or run like applications. But it is also an interactive shell that can evaluate arbitrary statements and expressions. This is extremely useful for debugging, quick hacking and testing. Let us first have a look at some very simple examples.</p>
<h2 id="root-as-calculator"><span class="header-section-number">2.1</span> ROOT as calculator</h2>
<p>You can even use the ROOT interactive shell in lieu of a calculator! Launch the ROOT interactive shell with the command</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb1-1" data-line-number="1"> > root</a></code></pre></div>
<p>on your Linux box. The prompt should appear shortly:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb2-1" data-line-number="1"> root [<span class="dv">0</span>]</a></code></pre></div>
<p>and let’s dive in with the steps shown here:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb3-1" data-line-number="1">root [<span class="dv">0</span>] <span class="dv">1+1</span></a>
<a class="sourceLine" id="cb3-2" data-line-number="2">(<span class="dt">int</span>) <span class="dv">2</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3">root [<span class="dv">1</span>] <span class="dv">2</span>*(<span class="dv">4+2</span>)/<span class="fl">12.</span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4">(<span class="dt">double</span>) <span class="fl">1.000000</span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5">root [<span class="dv">2</span>] sqrt(<span class="fl">3.</span>)</a>
<a class="sourceLine" id="cb3-6" data-line-number="6">(<span class="dt">double</span>) <span class="fl">1.732051</span></a>
<a class="sourceLine" id="cb3-7" data-line-number="7">root [<span class="dv">3</span>] <span class="dv">1</span> > <span class="dv">2</span></a>
<a class="sourceLine" id="cb3-8" data-line-number="8">(<span class="dt">bool</span>) <span class="kw">false</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9">root [<span class="dv">4</span>] TMath::Pi()</a>
<a class="sourceLine" id="cb3-10" data-line-number="10">(<span class="dt">double</span>) <span class="fl">3.141593</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11">root [<span class="dv">5</span>] TMath::Erf(.<span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-12" data-line-number="12">(<span class="dt">double</span>) <span class="fl">0.222703</span></a></code></pre></div>
<p>Not bad. You can see that ROOT offers you the possibility not only to type in <code>C++</code> statements, but also advanced mathematical functions, which live in the <code>TMath</code> namespace.</p>
<p>Now let’s do something more elaborated. A numerical example with the well known geometrical series:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb4-1" data-line-number="1">root [<span class="dv">6</span>] <span class="dt">double</span> x=.<span class="dv">5</span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2">(<span class="dt">double</span>) <span class="fl">0.500000</span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3">root [<span class="dv">7</span>] <span class="dt">int</span> N=<span class="dv">30</span></a>
<a class="sourceLine" id="cb4-4" data-line-number="4">(<span class="dt">int</span>) <span class="dv">30</span></a>
<a class="sourceLine" id="cb4-5" data-line-number="5">root [<span class="dv">8</span>] <span class="dt">double</span> geom_series=<span class="dv">0</span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6">(<span class="dt">double</span>) <span class="fl">0.000000</span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7">root [<span class="dv">9</span>] <span class="cf">for</span> (<span class="dt">int</span> i=<span class="dv">0</span>;i<N;++i)geom_series+=TMath::Power(x,i)</a>
<a class="sourceLine" id="cb4-8" data-line-number="8">root [<span class="dv">10</span>] cout << TMath::Abs(geom_series - (<span class="dv">1</span>-TMath::Power(x,N<span class="dv">-1</span>))/(<span class="dv">1</span>-x)) <<endl;</a>
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="fl">1.86265e-09</span></a></code></pre></div>
<p>Here we made a step forward. We even declared variables and used a <em>for</em> control structure. Note that there are some subtle differences between Cling and the standard <code>C++</code> language. You do not need the “;” at the end of line in interactive mode – try the difference e.g. using the command at line <code>root [6]</code>.</p>
<h2 id="learn-c-at-the-root-prompt"><span class="header-section-number">2.2</span> Learn C++ at the ROOT prompt</h2>
<p>Behind the ROOT prompt there is an interpreter based on a real compiler toolkit: LLVM. It is therefore possible to exercise many features of <code>C++</code> and the standard library. For example in the following snippet we define a lambda function, a vector and we sort it in different ways:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb5-1" data-line-number="1">root [<span class="dv">0</span>] <span class="kw">using</span> doubles = <span class="bu">std::</span>vector<<span class="dt">double</span>>;</a>
<a class="sourceLine" id="cb5-2" data-line-number="2">root [<span class="dv">1</span>] <span class="kw">auto</span> pVec = [](<span class="at">const</span> doubles& v){<span class="cf">for</span> (<span class="kw">auto</span>&& x:v) cout << x << endl;};</a>
<a class="sourceLine" id="cb5-3" data-line-number="3">root [<span class="dv">2</span>] doubles v{<span class="dv">0</span>,<span class="dv">3</span>,<span class="dv">5</span>,<span class="dv">4</span>,<span class="dv">1</span>,<span class="dv">2</span>};</a>
<a class="sourceLine" id="cb5-4" data-line-number="4">root [<span class="dv">3</span>] pVec(v);</a>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="dv">0</span></a>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="dv">3</span></a>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="dv">5</span></a>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="dv">4</span></a>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="dv">1</span></a>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="dv">2</span></a>
<a class="sourceLine" id="cb5-11" data-line-number="11">root [<span class="dv">4</span>] <span class="bu">std::</span>sort(v.begin(),v.end());</a>
<a class="sourceLine" id="cb5-12" data-line-number="12">root [<span class="dv">5</span>] pVec(v);</a>
<a class="sourceLine" id="cb5-13" data-line-number="13"><span class="dv">0</span></a>
<a class="sourceLine" id="cb5-14" data-line-number="14"><span class="dv">1</span></a>
<a class="sourceLine" id="cb5-15" data-line-number="15"><span class="dv">2</span></a>
<a class="sourceLine" id="cb5-16" data-line-number="16"><span class="dv">3</span></a>
<a class="sourceLine" id="cb5-17" data-line-number="17"><span class="dv">4</span></a>
<a class="sourceLine" id="cb5-18" data-line-number="18"><span class="dv">5</span></a>
<a class="sourceLine" id="cb5-19" data-line-number="19">root [<span class="dv">6</span>] <span class="bu">std::</span>sort(v.begin(),v.end(),[](<span class="dt">double</span> a, <span class="dt">double</span> b){<span class="cf">return</span> a>b;});</a>
<a class="sourceLine" id="cb5-20" data-line-number="20">root [<span class="dv">7</span>] pVec(v);</a>
<a class="sourceLine" id="cb5-21" data-line-number="21"><span class="dv">5</span></a>
<a class="sourceLine" id="cb5-22" data-line-number="22"><span class="dv">4</span></a>
<a class="sourceLine" id="cb5-23" data-line-number="23"><span class="dv">3</span></a>
<a class="sourceLine" id="cb5-24" data-line-number="24"><span class="dv">2</span></a>
<a class="sourceLine" id="cb5-25" data-line-number="25"><span class="dv">1</span></a>
<a class="sourceLine" id="cb5-26" data-line-number="26"><span class="dv">0</span></a></code></pre></div>
<p>Or, if you prefer random number generation:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb6-1" data-line-number="1">root [<span class="dv">0</span>] <span class="bu">std::</span>default_random_engine generator;</a>
<a class="sourceLine" id="cb6-2" data-line-number="2">root [<span class="dv">1</span>] <span class="bu">std::</span>normal_distribution<<span class="dt">double</span>> distribution(<span class="fl">0.</span>,<span class="fl">1.</span>);</a>
<a class="sourceLine" id="cb6-3" data-line-number="3">root [<span class="dv">2</span>] distribution(generator)</a>
<a class="sourceLine" id="cb6-4" data-line-number="4">(<span class="bu">std::</span>normal_distribution<<span class="dt">double</span>>::<span class="dt">result_type</span>) <span class="fl">-1.219658e-01</span></a>
<a class="sourceLine" id="cb6-5" data-line-number="5">root [<span class="dv">3</span>] distribution(generator)</a>
<a class="sourceLine" id="cb6-6" data-line-number="6">(<span class="bu">std::</span>normal_distribution<<span class="dt">double</span>>::<span class="dt">result_type</span>) <span class="fl">-1.086818e+00</span></a>
<a class="sourceLine" id="cb6-7" data-line-number="7">root [<span class="dv">4</span>] distribution(generator)</a>
<a class="sourceLine" id="cb6-8" data-line-number="8">(<span class="bu">std::</span>normal_distribution<<span class="dt">double</span>>::<span class="dt">result_type</span>) <span class="fl">6.842899e-01</span></a></code></pre></div>
<p>Impressive isn’t it?</p>
<h2 id="root-as-function-plotter"><span class="header-section-number">2.3</span> ROOT as function plotter</h2>
<p>Using one of ROOT’s powerful classes, here <code>TF1</code>,<a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> will allow us to display a function of one variable, <em>x</em>. Try the following:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb7-1" data-line-number="1">root [<span class="dv">11</span>] TF1 f1(<span class="st">"f1"</span>,<span class="st">"sin(x)/x"</span>,<span class="fl">0.</span>,<span class="fl">10.</span>);</a>
<a class="sourceLine" id="cb7-2" data-line-number="2">root [<span class="dv">12</span>] f1.Draw();</a></code></pre></div>
<p><code>f1</code> is an instance of a TF1 class, the arguments are used in the constructor; the first one of type string is a name to be entered in the internal ROOT memory management system, the second string type parameter defines the function, here <code>sin(x)/x</code>, and the two parameters of type double define the range of the variable <em>x</em>. The <code>Draw()</code> method, here without any parameters, displays the function in a window which should pop up after you typed the above two lines.</p>
<p>A slightly extended version of this example is the definition of a function with parameters, called <code>[0]</code>, <code>[1]</code> and so on in the ROOT formula syntax. We now need a way to assign values to these parameters; this is achieved with the method <code>SetParameter(<parameter_number>,<parameter_value>)</code> of class <code>TF1</code>. Here is an example:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb8-1" data-line-number="1">root [<span class="dv">13</span>] TF1 f2(<span class="st">"f2"</span>,<span class="st">"[0]*sin([1]*x)/x"</span>,<span class="fl">0.</span>,<span class="fl">10.</span>);</a>
<a class="sourceLine" id="cb8-2" data-line-number="2">root [<span class="dv">14</span>] f2.SetParameter(<span class="dv">0</span>,<span class="dv">1</span>);</a>
<a class="sourceLine" id="cb8-3" data-line-number="3">root [<span class="dv">15</span>] f2.SetParameter(<span class="dv">1</span>,<span class="dv">1</span>);</a>
<a class="sourceLine" id="cb8-4" data-line-number="4">root [<span class="dv">16</span>] f2.Draw();</a></code></pre></div>
<p>Of course, this version shows the same results as the initial one. Try playing with the parameters and plot the function again. The class <code>TF1</code> has a large number of very useful methods, including integration and differentiation. To make full use of this and other ROOT classes, visit the documentation on the Internet under <a href="http://root.cern.ch/drupal/content/reference-guide" class="uri">http://root.cern.ch/drupal/content/reference-guide</a>. Formulae in ROOT are evaluated using the class <code>TFormula</code>, so also look up the relevant class documentation for examples, implemented functions and syntax.</p>
<p>You should definitely download this guide to your own system to have it at you disposal whenever you need it.</p>
<p>To extend a little bit on the above example, consider a more complex function you would like to define. You can also do this using standard <code>C</code> or <code>C++</code> code.</p>
<p>Consider the example below, which calculates and displays the interference pattern produced by light falling on a multiple slit. Please do not type in the example below at the ROOT command line, there is a much simpler way: Make sure you have the file <code>slits.C</code> on disk, and type <code>root slits.C</code> in the shell. This will start root and make it read the “macro” <code>slits.C</code>, i.e. all the lines in the file will be executed one after the other.</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode numberSource cpp numberLines"><code class="sourceCode cpp"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="co">// Example drawing the interference pattern of light</span></a>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co">// falling on a grid with n slits and ratio r of slit</span></a>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co">// width over distance between slits.</span></a>
<a class="sourceLine" id="cb9-4" data-line-number="4"></a>
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="kw">auto</span> pi = TMath::Pi();</a>
<a class="sourceLine" id="cb9-6" data-line-number="6"></a>
<a class="sourceLine" id="cb9-7" data-line-number="7"><span class="co">// function code in C</span></a>
<a class="sourceLine" id="cb9-8" data-line-number="8"><span class="dt">double</span> single(<span class="dt">double</span> *x, <span class="dt">double</span> *par) {</a>
<a class="sourceLine" id="cb9-9" data-line-number="9"> <span class="cf">return</span> pow(sin(pi*par[<span class="dv">0</span>]*x[<span class="dv">0</span>])/(pi*par[<span class="dv">0</span>]*x[<span class="dv">0</span>]),<span class="dv">2</span>);</a>
<a class="sourceLine" id="cb9-10" data-line-number="10">}</a>
<a class="sourceLine" id="cb9-11" data-line-number="11"></a>
<a class="sourceLine" id="cb9-12" data-line-number="12"><span class="dt">double</span> nslit0(<span class="dt">double</span> *x,<span class="dt">double</span> *par){</a>
<a class="sourceLine" id="cb9-13" data-line-number="13"> <span class="cf">return</span> pow(sin(pi*par[<span class="dv">1</span>]*x[<span class="dv">0</span>])/sin(pi*x[<span class="dv">0</span>]),<span class="dv">2</span>);</a>
<a class="sourceLine" id="cb9-14" data-line-number="14">}</a>
<a class="sourceLine" id="cb9-15" data-line-number="15"></a>
<a class="sourceLine" id="cb9-16" data-line-number="16"><span class="dt">double</span> nslit(<span class="dt">double</span> *x, <span class="dt">double</span> *par){</a>
<a class="sourceLine" id="cb9-17" data-line-number="17"> <span class="cf">return</span> single(x,par) * nslit0(x,par);</a>
<a class="sourceLine" id="cb9-18" data-line-number="18">}</a>
<a class="sourceLine" id="cb9-19" data-line-number="19"></a>
<a class="sourceLine" id="cb9-20" data-line-number="20"><span class="co">// This is the main program</span></a>
<a class="sourceLine" id="cb9-21" data-line-number="21"><span class="dt">void</span> slits() {</a>
<a class="sourceLine" id="cb9-22" data-line-number="22"> <span class="dt">float</span> r,ns;</a>
<a class="sourceLine" id="cb9-23" data-line-number="23"></a>
<a class="sourceLine" id="cb9-24" data-line-number="24"> <span class="co">// request user input</span></a>
<a class="sourceLine" id="cb9-25" data-line-number="25"> cout << <span class="st">"slit width / g ? "</span>;</a>
<a class="sourceLine" id="cb9-26" data-line-number="26"> scanf(<span class="st">"</span><span class="sc">%f</span><span class="st">"</span>,&r);</a>
<a class="sourceLine" id="cb9-27" data-line-number="27"> cout << <span class="st">"# of slits? "</span>;</a>
<a class="sourceLine" id="cb9-28" data-line-number="28"> scanf(<span class="st">"</span><span class="sc">%f</span><span class="st">"</span>,&ns);</a>
<a class="sourceLine" id="cb9-29" data-line-number="29"> cout <<<span class="st">"interference pattern for "</span><< ns</a>
<a class="sourceLine" id="cb9-30" data-line-number="30"> <<<span class="st">" slits, width/distance: "</span><<r<<endl;</a>
<a class="sourceLine" id="cb9-31" data-line-number="31"></a>
<a class="sourceLine" id="cb9-32" data-line-number="32"> <span class="co">// define function and set options</span></a>
<a class="sourceLine" id="cb9-33" data-line-number="33"> TF1 *Fnslit = <span class="kw">new</span> TF1(<span class="st">"Fnslit"</span>,nslit,<span class="dv">-5</span><span class="fl">.001</span>,<span class="fl">5.</span>,<span class="dv">2</span>);</a>
<a class="sourceLine" id="cb9-34" data-line-number="34"> Fnslit->SetNpx(<span class="dv">500</span>);</a>
<a class="sourceLine" id="cb9-35" data-line-number="35"></a>
<a class="sourceLine" id="cb9-36" data-line-number="36"> <span class="co">// set parameters, as read in above</span></a>
<a class="sourceLine" id="cb9-37" data-line-number="37"> Fnslit->SetParameter(<span class="dv">0</span>,r);</a>
<a class="sourceLine" id="cb9-38" data-line-number="38"> Fnslit->SetParameter(<span class="dv">1</span>,ns);</a>
<a class="sourceLine" id="cb9-39" data-line-number="39"></a>
<a class="sourceLine" id="cb9-40" data-line-number="40"> <span class="co">// draw the interference pattern for a grid with n slits</span></a>
<a class="sourceLine" id="cb9-41" data-line-number="41"> Fnslit->Draw();</a>
<a class="sourceLine" id="cb9-42" data-line-number="42">}</a></code></pre></div>
<p><a name="f21"></a></p>
<figure>
<img src="./A ROOT Guide For Beginners_files/TF1_DoubleSlit.png" title="f21" alt="Output of slits.C with parameters 0.2 and 2."><figcaption>Output of slits.C with parameters 0.2 and 2.</figcaption>
</figure>
<p>The example first asks for user input, namely the ratio of slit width over slit distance, and the number of slits. After entering this information, you should see the graphical output as is shown in Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f21">2.1</a>.</p>
<p>This is a more complicated example than the ones we have seen before, so spend some time analysing it carefully, you should have understood it before continuing. Let us go through it in detail:</p>
<p>Lines <em>7-18</em> define the necessary functions in <code>C++</code> code, split into three separate functions, as suggested by the problem considered. The full interference pattern is given by the product of a function depending on the ratio of the width and distance of the slits, and a second one depending on the number of slits. More important for us here is the definition of the interface of these functions to make them usable for the ROOT class <code>TF1</code>: the first argument is the pointer to <em>x</em>, the second one points to the array of parameters.</p>
<p>The main program starts at line 21 with the definition of a function <code>slits()</code> of type <code>void</code>. After asking for user input, a ROOT function is defined using the C-type function given in the beginning. We can now use all methods of the <code>TF1</code> class to control the behaviour of our function – nice, isn’t it ?</p>
<p>If you like, you can easily extend the example to also plot the interference pattern of a single slit, using function <code>double single</code>, or of a grid with narrow slits, function <code>double nslit0</code>, in <code>TF1</code> instances.</p>
<p>Here, we used a macro, some sort of lightweight program, that the interpreter distributed with ROOT, Cling, is able to execute. This is a rather extraordinary situation, since <code>C++</code> is not natively an interpreted language! There is much more to say: chapter is indeed dedicated to macros.</p>
<h2 id="controlling-root"><span class="header-section-number">2.4</span> Controlling ROOT</h2>
<p>One more remark at this point: as every command you type into ROOT is usually interpreted by Cling, an “escape character” is needed to pass commands to ROOT directly. This character is the dot at the beginning of a line:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb10-1" data-line-number="1">root [<span class="dv">1</span>] .<command></a></code></pre></div>
<p>This is a selection of the most common commands.</p>
<ul>
<li><p><strong>quit root</strong>, simply type <code>.q</code></p></li>
<li><p>obtain a <strong>list of commands</strong>, use <code>.?</code></p></li>
<li><p><strong>access the shell</strong> of the operating system, type <code>.!<OS_command></code>; try, e.g. <code>.!ls</code> or <code>.!pwd</code></p></li>
<li><p><strong>execute a macro</strong>, enter <code>.x <file_name></code>; in the above example, you might have used <code>.x slits.C</code> at the ROOT prompt</p></li>
<li><p><strong>load a macro</strong>, type <code>.L <file_name></code>; in the above example, you might instead have used the command <code>.L slits.C</code> followed by the function call <code>slits();</code>. Note that after loading a macro all functions and procedures defined therein are available at the ROOT prompt.</p></li>
<li><p><strong>compile a macro</strong>, type <code>.L <file_name>+</code>; ROOT is able to manage for you the <code>C++</code> compiler behind the scenes and to produce machine code starting from your macro. One could decide to compile a macro in order to obtain better performance or to get nearer to the production environment.</p></li>
</ul>
<p>Use <code>.help</code> at the prompt to inspect the full list.</p>
<h2 id="plotting-measurements"><span class="header-section-number">2.5</span> Plotting Measurements</h2>
<p>To display measurements in ROOT, including errors, there exists a powerful class <code>TGraphErrors</code> with different types of constructors. In the example here, we use data from the file <code>ExampleData.txt</code> in text format:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb11-1" data-line-number="1">root [<span class="dv">0</span>] TGraphErrors gr(<span class="st">"ExampleData.txt"</span>);</a>
<a class="sourceLine" id="cb11-2" data-line-number="2">root [<span class="dv">1</span>] gr.Draw(<span class="st">"AP"</span>);</a></code></pre></div>
<p>You should see the output shown in Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f22">2.2</a>.</p>
<p><a name="f22"></a></p>
<figure>
<img src="./A ROOT Guide For Beginners_files/TGraphErrors_Example.png" title="f22" alt="Visualisation of data points with errors using the class TGraphErrors. "><figcaption>Visualisation of data points with errors using the class TGraphErrors. </figcaption>
</figure>
<p>Make sure the file <code>ExampleData.txt</code> is available in the directory from which you started ROOT. Inspect this file now with your favourite editor, or use the command <code>less ExampleData.txt</code> to inspect the file, you will see that the format is very simple and easy to understand. Lines beginning with <code>#</code> are ignored. It is very convenient to add some comments about the type of data. The data itself consist of lines with four real numbers each, representing the x- and y- coordinates and their errors of each data point.</p>
<p>The argument of the method <code>Draw("AP")</code> is important here. Behind the scenes, it tells the <code>TGraphPainter</code> class to show the axes and to plot markers at the <em>x</em> and <em>y</em> positions of the specified data points. Note that this simple example relies on the default settings of ROOT, concerning the size of the canvas holding the plot, the marker type and the line colours and thickness used and so on. In a well-written, complete example, all this would need to be specified explicitly in order to obtain nice and well readable results. A full chapter on graphs will explain many more of the features of the class <code>TGraphErrors</code> and its relation to other ROOT classes in much more detail.</p>
<h2 id="histograms-in-root"><span class="header-section-number">2.6</span> Histograms in ROOT</h2>
<p>Frequency distributions in ROOT are handled by a set of classes derived from the histogram class <code>TH1</code>, in our case <code>TH1F</code>. The letter <code>F</code> stands for “float”, meaning that the data type <code>float</code> is used to store the entries in one histogram bin.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb12-1" data-line-number="1">root [<span class="dv">0</span>] TF1 efunc(<span class="st">"efunc"</span>,<span class="st">"exp([0]+[1]*x)"</span>,<span class="fl">0.</span>,<span class="fl">5.</span>);</a>
<a class="sourceLine" id="cb12-2" data-line-number="2">root [<span class="dv">1</span>] efunc.SetParameter(<span class="dv">0</span>,<span class="dv">1</span>);</a>
<a class="sourceLine" id="cb12-3" data-line-number="3">root [<span class="dv">2</span>] efunc.SetParameter(<span class="dv">1</span>,<span class="dv">-1</span>);</a>
<a class="sourceLine" id="cb12-4" data-line-number="4">root [<span class="dv">3</span>] TH1F h(<span class="st">"h"</span>,<span class="st">"example histogram"</span>,<span class="dv">100</span>,<span class="fl">0.</span>,<span class="fl">5.</span>);</a>
<a class="sourceLine" id="cb12-5" data-line-number="5">root [<span class="dv">4</span>] <span class="cf">for</span> (<span class="dt">int</span> i=<span class="dv">0</span>;i<<span class="dv">1000</span>;i++) {h.Fill(efunc.GetRandom());}</a>
<a class="sourceLine" id="cb12-6" data-line-number="6">root [<span class="dv">5</span>] h.Draw();</a></code></pre></div>
<p>The first three lines of this example define a function, an exponential in this case, and set its parameters. In line <em>3</em> a histogram is instantiated, with a name, a title, a certain number of bins (100 of them, equidistant, equally sized) in the range from 0 to 5.</p>
<p><a name="f23"></a></p>
<figure>
<img src="./A ROOT Guide For Beginners_files/TH1F_Example.png" title="f23" alt="Visualisation of a histogram filled with exponentially distributed, random numbers. "><figcaption>Visualisation of a histogram filled with exponentially distributed, random numbers. </figcaption>
</figure>
<p>We use yet another new feature of ROOT to fill this histogram with data, namely pseudo-random numbers generated with the method <code>TF1::GetRandom</code>, which in turn uses an instance of the ROOT class <code>TRandom</code> created when ROOT is started. Data is entered in the histogram at line <em>4</em> using the method <code>TH1F::Fill</code> in a loop construct. As a result, the histogram is filled with 1000 random numbers distributed according to the defined function. The histogram is displayed using the method <code>TH1F::Draw()</code>. You may think of this example as repeated measurements of the life time of a quantum mechanical state, which are entered into the histogram, thus giving a visual impression of the probability density distribution. The plot is shown in Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f23">2.3</a>.</p>
<p>Note that you will not obtain an identical plot when executing the lines above, depending on how the random number generator is initialised.</p>
<p>The class <code>TH1F</code> does not contain a convenient input format from plain text files. The following lines of <code>C++</code> code do the job. One number per line stored in the text file “expo.dat” is read in via an input stream and filled in the histogram until end of file is reached.</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb13-1" data-line-number="1">root [<span class="dv">1</span>] TH1F h(<span class="st">"h"</span>,<span class="st">"example histogram"</span>,<span class="dv">100</span>,<span class="fl">0.</span>,<span class="fl">5.</span>);</a>
<a class="sourceLine" id="cb13-2" data-line-number="2">root [<span class="dv">2</span>] ifstream inp; <span class="dt">double</span> x;</a>
<a class="sourceLine" id="cb13-3" data-line-number="3">root [<span class="dv">3</span>] inp.open(<span class="st">"expo.dat"</span>);</a>
<a class="sourceLine" id="cb13-4" data-line-number="4">root [<span class="dv">4</span>] <span class="cf">while</span> (inp >> x) { h.Fill(x); }</a>
<a class="sourceLine" id="cb13-5" data-line-number="5">root [<span class="dv">5</span>] h.Draw();</a>
<a class="sourceLine" id="cb13-6" data-line-number="6">root [<span class="dv">6</span>] inp.close();</a></code></pre></div>
<p>Histograms and random numbers are very important tools in statistical data analysis, a whole chapter will be dedicated to this topic.</p>
<h2 id="interactive-root"><span class="header-section-number">2.7</span> Interactive ROOT</h2>
<p>Look at one of your plots again and move the mouse across. You will notice that this is much more than a static picture, as the mouse pointer changes its shape when touching objects on the plot. When the mouse is over an object, a right-click opens a pull-down menu displaying in the top line the name of the ROOT class you are dealing with, e.g. <code>TCanvas</code> for the display window itself, <code>TFrame</code> for the frame of the plot, <code>TAxis</code> for the axes, <code>TPaveText</code> for the plot name. Depending on which plot you are investigating, menus for the ROOT classes <code>TF1</code>, <code>TGraphErrors</code> or <code>TH1F</code> will show up when a right-click is performed on the respective graphical representations. The menu items allow direct access to the members of the various classes, and you can even modify them, e.g. change colour and size of the axis ticks or labels, the function lines, marker types and so on. Try it!</p>
<p><a name="f24"></a></p>
<figure>
<img src="./A ROOT Guide For Beginners_files/ROOTPanel_SetParameters.png" title="f24" alt="Interactive ROOT panel for setting function parameters."><figcaption>Interactive ROOT panel for setting function parameters.</figcaption>
</figure>
<p>You will probably like the following: in the output produced by the example <code>slits.C</code>, right-click on the function line and select “SetLineAttributes”, then left-click on “Set Parameters”. This gives access to a panel allowing you to interactively change the parameters of the function, as shown in Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f24">2.4</a>. Change the slit width, or go from one to two and then three or more slits, just as you like. When clicking on “Apply”, the function plot is updated to reflect the actual value of the parameters you have set.</p>
<p><a name="f25"></a></p>
<figure>
<img src="./A ROOT Guide For Beginners_files/ROOTPanel_FitPanel.png" title="f25" alt="Fit Panel. "><figcaption>Fit Panel. </figcaption>
</figure>
<p>Another very useful interactive tool is the <code>FitPanel</code>, available for the classes <code>TGraphErrors</code> and <code>TH1F</code>. Predefined fit functions can be selected from a pull-down menu, including “<code>gaus</code>”, “<code>expo</code>” and “<code>pol0</code>” - “<code>pol9</code>” for Gaussian and exponential functions or polynomials of degree 0 to 9, respectively. In addition, user-defined functions using the same syntax as for functions with parameters are possible.</p>
<p>After setting the initial parameters, a fit of the selected function to the data of a graph or histogram can be performed and the result displayed on the plot. The fit panel is shown in Figure <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#f25">2.5</a>. The fit panel has a number of control options to select the fit method, fix or release individual parameters in the fit, to steer the level of output printed on the console, or to extract and display additional information like contour lines showing parameter correlations. As function fitting is of prime importance in any kind of data analysis, this topic will again show up later.</p>
<p>If you are satisfied with your plot, you probably want to save it. Just close all selector boxes you opened previously and select the menu item <code>Save as...</code> from the menu line of the window. It will pop up a file selector box to allow you to choose the format, file name and target directory to store the image. There is one very noticeable feature here: you can store a plot as a root macro! In this macro, you find the C++ representation of all methods and classes involved in generating the plot. This is a valuable source of information for your own macros, which you will hopefully write after having worked through this tutorial.</p>
<p>Using ROOT’s interactive capabilities is useful for a first exploration of possibilities. Other ROOT classes you will encounter in this tutorial have such graphical interfaces. We will not comment further on this, just be aware of the existence of ROOT’s interactive features and use them if you find them convenient. Some trial-and-error is certainly necessary to find your way through the huge number of menus and parameter settings.</p>
<h2 id="root-beginners-faq"><span class="header-section-number">2.8</span> ROOT Beginners’ FAQ</h2>
<p>At this point of the guide, some basic questions could have already come to your mind. We will try to clarify some of them with further explanations in the following.</p>
<h3 id="root-type-declarations-for-basic-data-types"><span class="header-section-number">2.8.1</span> ROOT type declarations for basic data types</h3>
<p>In the official ROOT documentation, you find special data types replacing the normal ones, e.g. <code>Double_t</code>, <code>Float_t</code> or <code>Int_t</code> replacing the standard <code>double</code>, <code>float</code> or <code>int</code> types. Using the ROOT types makes it easier to port code between platforms (64/32 bit) or operating systems (windows/Linux), as these types are mapped to suitable ones in the ROOT header files. If you want adaptive code of this type, use the ROOT type declarations. However, usually you do not need such adaptive code, and you can safely use the standard C type declarations for your private code, as we did and will do throughout this guide. If you intend to become a ROOT developer, however, you better stick to the official coding rules!</p>
<h3 id="configure-root-at-start-up"><span class="header-section-number">2.8.2</span> Configure ROOT at start-up</h3>
<p>The behaviour of a ROOT session can be tailored with the options in the <code>.rootrc</code> file. Examples of the tunable parameters are the ones related to the operating and window system, to the fonts to be used, to the location of start-up files. At start-up, ROOT looks for a <code>.rootrc</code> file in the following order:</p>
<ul>
<li><p><code>./.rootrc //local directory</code></p></li>
<li><p><code>$HOME/.rootrc //user directory</code></p></li>
<li><p><code>$ROOTSYS/etc/system.rootrc //global ROOT directory</code></p></li>
</ul>
<p>If more than one <code>.rootrc</code> files are found in the search paths above, the options are merged, with precedence local, user, global. The parsing and interpretation of this file is handled by the ROOT class <code>TEnv</code>. Have a look to its documentation if you need such rather advanced features. The file <code>.rootrc</code> defines the location of two rather important files inspected at start-up: <code>rootalias.C</code> and <code>rootlogon.C</code>. They can contain code that needs to be loaded and executed at ROOT startup. <code>rootalias.C</code> is only loaded and best used to define some often used functions. <code>rootlogon.C</code> contains code that will be executed at startup: this file is extremely useful for example to pre-load a custom style for the plots created with ROOT. This is done most easily by creating a new <code>TStyle</code> object with your preferred settings, as described in the class reference guide, and then use the command <code>gROOT->SetStyle("MyStyleName");</code> to make this new style definition the default one. As an example, have a look in the file <code>rootlogon.C</code> coming with this tutorial. Another relevant file is <code>rootlogoff.C</code> that it called when the session is finished.</p>
<h3 id="root-command-history"><span class="header-section-number">2.8.3</span> ROOT command history</h3>
<p>Every command typed at the ROOT prompt is stored in a file <code>.root_hist</code> in your home directory. ROOT uses this file to allow for navigation in the command history with the up-arrow and down-arrow keys. It is also convenient to extract successful ROOT commands with the help of a text editor for use in your own macros.</p>
<h3 id="root-global-pointers"><span class="header-section-number">2.8.4</span> ROOT Global Pointers</h3>
<p>All global pointers in ROOT begin with a small “g”. Some of them were already implicitly introduced (for example in the section <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#configure-root-at-start-up">Configure ROOT at start-up</a>). The most important among them are presented in the following:</p>
<ul>
<li><p><strong><a href="http://root.cern.ch/root/htmldoc/TROOT.html">gROOT</a></strong>: the <code>gROOT</code> variable is the entry point to the ROOT system. Technically it is an instance of the <code>TROOT</code> class. Using the <code>gROOT</code> pointer one has access to basically every object created in a ROOT based program. The <code>TROOT</code> object is essentially a container of several lists pointing to the main <code>ROOT</code> objects.</p></li>
<li><p><strong><a href="http://root.cern.ch/root/htmldoc/TStyle.html">gStyle</a></strong>: By default ROOT creates a default style that can be accessed via the <code>gStyle</code> pointer. This class includes functions to set some of the following object attributes.</p>
<ul>
<li>Canvas</li>
<li>Pad</li>
<li>Histogram axis</li>
<li>Lines</li>
<li>Fill areas</li>
<li>Text</li>
<li>Markers</li>
<li>Functions</li>
<li>Histogram Statistics and Titles</li>
<li>etc …</li>
</ul></li>
<li><p><strong><a href="http://root.cern.ch/root/htmldoc/TSystem.html">gSystem</a></strong>: An instance of a base class defining a generic interface to the underlying Operating System, in our case <code>TUnixSystem</code>.</p></li>
<li><p><strong><a href="http://root.cern.ch/htmldoc/html/TInterpreter.html">gInterpreter</a></strong>: The entry point for the ROOT interpreter. Technically an abstraction level over a singleton instance of <code>TCling</code>.</p></li>
</ul>
<p>At this point you have already learnt quite a bit about some basic features of ROOT.</p>
<p><strong><em>Please move on to become an expert!</em></strong></p>
<h1 id="root-macros"><span class="header-section-number">3</span> ROOT Macros</h1>
<p>You know how other books go on and on about programming fundamentals and finally work up to building a complete, working program ? Let’s skip all that. In this guide, we will describe macros executed by the ROOT C++ interpreter Cling.</p>
<p>It is relatively easy to compile a macro, either as a pre-compiled library to load into ROOT, or as a stand-alone application, by adding some include statements for header file or some “dressing code” to any macro.</p>
<h2 id="general-remarks-on-root-macros"><span class="header-section-number">3.1</span> General Remarks on ROOT macros</h2>
<p>If you have a number of lines which you were able to execute at the ROOT prompt, they can be turned into a ROOT macro by giving them a name which corresponds to the file name without extension. The general structure for a macro stored in file <code>MacroName.C</code> is</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="dt">void</span> MacroName() {</a>
<a class="sourceLine" id="cb14-2" data-line-number="2"> < ...</a>
<a class="sourceLine" id="cb14-3" data-line-number="3"> your lines of C++ code</a>
<a class="sourceLine" id="cb14-4" data-line-number="4"> ... ></a>
<a class="sourceLine" id="cb14-5" data-line-number="5">}</a></code></pre></div>
<p>The macro is executed by typing</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb15-1" data-line-number="1"> > root MacroName.C</a></code></pre></div>
<p>at the system prompt, or executed using <code>.x</code></p>
<div class="sourceCode" id="cb16"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb16-1" data-line-number="1"> > root</a>
<a class="sourceLine" id="cb16-2" data-line-number="2"> root [<span class="dv">0</span>] .x MacroName.C</a></code></pre></div>
<p>at the ROOT prompt. or it can be loaded into a ROOT session and then be executed by typing</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb17-1" data-line-number="1">root [<span class="dv">0</span>].L MacroName.C</a>
<a class="sourceLine" id="cb17-2" data-line-number="2">root [<span class="dv">1</span>] MacroName();</a></code></pre></div>
<p>at the ROOT prompt. Note that more than one macro can be loaded this way, as each macro has a unique name in the ROOT name space. A small set of options can help making your plot nicer.</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb18-1" data-line-number="1">gROOT->SetStyle(<span class="st">"Plain"</span>); <span class="co">// set plain TStyle</span></a>
<a class="sourceLine" id="cb18-2" data-line-number="2">gStyle->SetOptStat(<span class="dv">111111</span>); <span class="co">// draw statistics on plots,</span></a>
<a class="sourceLine" id="cb18-3" data-line-number="3"> <span class="co">// (0) for no output</span></a>
<a class="sourceLine" id="cb18-4" data-line-number="4">gStyle->SetOptFit(<span class="dv">1111</span>); <span class="co">// draw fit results on plot,</span></a>
<a class="sourceLine" id="cb18-5" data-line-number="5"> <span class="co">// (0) for no ouput</span></a>
<a class="sourceLine" id="cb18-6" data-line-number="6">gStyle->SetPalette(<span class="dv">57</span>); <span class="co">// set color map</span></a>
<a class="sourceLine" id="cb18-7" data-line-number="7">gStyle->SetOptTitle(<span class="dv">0</span>); <span class="co">// suppress title box</span></a>
<a class="sourceLine" id="cb18-8" data-line-number="8"> ...</a></code></pre></div>
<p>Next, you should create a canvas for graphical output, with size, subdivisions and format suitable to your needs, see documentation of class <code>TCanvas</code>:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb19-1" data-line-number="1">TCanvas c1(<span class="st">"c1"</span>,<span class="st">"<Title>"</span>,<span class="dv">0</span>,<span class="dv">0</span>,<span class="dv">400</span>,<span class="dv">300</span>); <span class="co">// create a canvas, specify position and size in pixels</span></a>
<a class="sourceLine" id="cb19-2" data-line-number="2">c1.Divide(<span class="dv">2</span>,<span class="dv">2</span>); <span class="co">//set subdivisions, called pads</span></a>
<a class="sourceLine" id="cb19-3" data-line-number="3">c1.cd(<span class="dv">1</span>); <span class="co">//change to pad 1 of canvas c1</span></a></code></pre></div>
<p>These parts of a well-written macro are pretty standard, and you should remember to include pieces of code like in the examples above to make sure your plots always look as you had intended.</p>
<p>Below, in section <a href="http://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html#interpretation-and-compilation">Interpretation and Compilation</a>, some more code fragments will be shown, allowing you to use the system compiler to compile macros for more efficient execution, or turn macros into stand-alone applications linked against the ROOT libraries.</p>
<h2 id="a-more-complete-example"><span class="header-section-number">3.2</span> A more complete example</h2>