-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotterProgramV3.cpp
2350 lines (2138 loc) · 66.9 KB
/
PlotterProgramV3.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//Program adopted from "DataFitter", primary use for creating Figure 4 in Smolec. May be formed for general use later on?
//V1: Making program able to create figure 5 in smolec for sets A B C and D.
//V2: Adding directroy output for easier sorting. Will now automatically find size of file and make arrays also
//V3: Updating for up to ninth overtone
# include <iostream>
# include <fstream>
# include <math.h>
# include <iomanip>
# include <cmath>
# include <stdlib.h>
# include <cstdlib>
//# include <fstream.h>
# include <string.h>
# include <string>
//# include <dos.h> //For Sleep()
# include "TROOT.h"
# include "TFile.h"
# include "TTree.h"
# include "TBrowser.h"
# include "TH1.h"
# include "TH2.h"
# include "TH3.h"
# include "TRandom.h"
//Gauss user defined: [0]*exp((-(x-[1])*(x-[1]))/(2*[2]*[2]))
// L50 L100 L150 L200 L250 L300
// Z0.013 Z0.00834 Z0.00424 Z0.00135 Z0.00061 Z0.00043 Z0.00014
int main(){
//////Controls//////
int NumOfInputFiles = 28; //Number of input files IN ONE SET, 28 is max. Total files is Sets*Files
int NumOfSets = 4; //A, B, C, D
char inputFileName[50] = "ResonanceData_Fig4"; //"Prefix" to the input files. Full suffix will be "suffix" + Label
char outputFileName[50] = "Fig4_m06"; //"Prefix" to the input files.
char OutputDirectory[100] = "D:/Research_Data_Storage/LINA/Fig4_Plotter/Fig4_All_V3"; //The directroy the plots are put into - will NOT create if not existing.
char Suffix_1[50] = "_L50_Z0.013";
char Suffix_2[50] = "_L50_Z0.00834";
char Suffix_3[50] = "_L50_Z0.00424";
char Suffix_4[50] = "_L50_Z0.00135";
char Suffix_5[50] = "_L50_Z0.00061";
char Suffix_6[50] = "_L50_Z0.00043";
char Suffix_7[50] = "_L50_Z0.00014";
char Suffix_8[50] = "_L100_Z0.013";
char Suffix_9[50] = "_L100_Z0.00834";
char Suffix_10[50] = "_L100_Z0.00424";
char Suffix_11[50] = "_L100_Z0.00135";
char Suffix_12[50] = "_L100_Z0.00061";
char Suffix_13[50] = "_L100_Z0.00043";
char Suffix_14[50] = "_L100_Z0.00014";
char Suffix_15[50] = "_L150_Z0.013";
char Suffix_16[50] = "_L150_Z0.00834";
char Suffix_17[50] = "_L150_Z0.00424";
char Suffix_18[50] = "_L150_Z0.00135";
char Suffix_19[50] = "_L150_Z0.00061";
char Suffix_20[50] = "_L150_Z0.00043";
char Suffix_21[50] = "_L150_Z0.00014";
char Suffix_22[50] = "_L200_Z0.013";
char Suffix_23[50] = "_L200_Z0.00834";
char Suffix_24[50] = "_L200_Z0.00424";
char Suffix_25[50] = "_L200_Z0.00135";
char Suffix_26[50] = "_L200_Z0.00061";
char Suffix_27[50] = "_L200_Z0.00043";
char Suffix_28[50] = "_L200_Z0.00014";
char Label_1[10] = "_SetA"; //Labels associated with input files, will be used as suffix to outfile names (Without .dat)
char Label_2[10] = "_SetB";
char Label_3[10] = "_SetC";
char Label_4[10] = "_SetD";
char PlotTitle_1[100] = "m = 0.6, L = 50, z = 0.013"; //Title of the plot
char PlotTitle_2[100] = "m = 0.6, L = 50, z = 0.00834"; //Title of the plot
char PlotTitle_3[100] = "m = 0.6, L = 50, z = 0.00424"; //Title of the plot
char PlotTitle_4[100] = "m = 0.6, L = 50, z = 0.00135"; //Title of the plot
char PlotTitle_5[100] = "m = 0.6, L = 50, z = 0.00061"; //Title of the plot
char PlotTitle_6[100] = "m = 0.6, L = 50, z = 0.00043"; //Title of the plot
char PlotTitle_7[100] = "m = 0.6, L = 50, z = 0.00014"; //Title of the plot
char PlotTitle_8[100] = "m = 0.6, L = 100, z = 0.013"; //Title of the plot
char PlotTitle_9[100] = "m = 0.6, L = 100, z = 0.00834"; //Title of the plot
char PlotTitle_10[100] = "m = 0.6, L = 100, z = 0.00424"; //Title of the plot
char PlotTitle_11[100] = "m = 0.6, L = 100, z = 0.00135"; //Title of the plot
char PlotTitle_12[100] = "m = 0.6, L = 100, z = 0.00061"; //Title of the plot
char PlotTitle_13[100] = "m = 0.6, L = 100, z = 0.00043"; //Title of the plot
char PlotTitle_14[100] = "m = 0.6, L = 100, z = 0.00014"; //Title of the plot
char PlotTitle_15[50] = "m = 0.6, L = 150, z = 0.013"; //Title of the plot
char PlotTitle_16[50] = "m = 0.6, L = 150, z = 0.00834"; //Title of the plot
char PlotTitle_17[50] = "m = 0.6, L = 150, z = 0.00424"; //Title of the plot
char PlotTitle_18[50] = "m = 0.6, L = 150, z = 0.00135"; //Title of the plot
char PlotTitle_19[50] = "m = 0.6, L = 150, z = 0.00061"; //Title of the plot
char PlotTitle_20[50] = "m = 0.6, L = 150, z = 0.00043"; //Title of the plot
char PlotTitle_21[50] = "m = 0.6, L = 150, z = 0.00014"; //Title of the plot
char PlotTitle_22[50] = "m = 0.6, L = 200, z = 0.013"; //Title of the plot
char PlotTitle_23[50] = "m = 0.6, L = 200, z = 0.00834"; //Title of the plot
char PlotTitle_24[50] = "m = 0.6, L = 200, z = 0.00424"; //Title of the plot
char PlotTitle_25[50] = "m = 0.6, L = 200, z = 0.00135"; //Title of the plot
char PlotTitle_26[50] = "m = 0.6, L = 200, z = 0.00061"; //Title of the plot
char PlotTitle_27[50] = "m = 0.6, L = 200, z = 0.00043"; //Title of the plot
char PlotTitle_28[50] = "m = 0.6, L = 200, z = 0.00014"; //Title of the plot
//Top plot of Fig4//
char xTitle_1[50] = "T_{eff}"; //Title for x-axis, first column of data file
char yTitle_1[50] = "Frequency"; //Title for y-axis, second column of data file
double xLowerLimit_1 = 4000; //Limits for top plot in Fig4
double xUpperLimit_1 = 8000;
double yLowerLimit_1 = 0;
double yUpperLimit_1 = 6.0;
//Bottom plot of Fig4//
char xTitle_2[50] = "T_{eff}"; //Title for x-axis, first column of data file
char yTitle_2[50] = "Growth Rate"; //Title for y-axis, second column of data file
double xLowerLimit_2 = 4000; //Limits for bottom plot in Fig4
double xUpperLimit_2 = 8000;
double yLowerLimit_2 = -2.0;
double yUpperLimit_2 = 0.5;
bool DataWithHeaders = true; //If true, will account for headers by using getline function
bool SavePlotAsPNG = true; //If true, will save plot with file name above.
bool SavePlotAsRootFile = true; //If true, will save plot in root file with name above.
////////////////////////////
//////Variables//////
ifstream inFile;
ofstream outFile;
int NumOfLines;
double xMax;
double xMin;
double yMax;
double yMin;
char line[100];
char header[100];
char Full_RootFileName[100];
char Full_PNGFileName[100];
char Full_RootFilePath[100];
char Full_PNGFilePath[100];
//Dummy Variables//
double dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7;
////////////////////////////
//////Main Program//////
for(int f = 0; f < NumOfInputFiles; f++){
for(int s = 0; s < NumOfSets; s++){
//////Variables//////
char inputFileName_temp[100] = "";
/////////////////////
if(f == 0){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_1);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 1){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_2);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 2){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_3);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 3){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_4);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 4){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_5);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 5){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_6);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 6){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_7);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 7){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_8);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 8){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_9);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 9){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_10);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 10){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_11);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 11){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_12);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 12){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_13);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 13){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_14);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 14){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_15);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 15){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_16);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 16){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_17);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 17){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_18);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 18){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_19);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 19){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_20);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 20){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_21);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 21){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_22);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 22){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_23);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 23){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_24);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 24){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_25);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 25){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_26);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 26){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_27);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
if(f == 27){
strcpy(inputFileName_temp,inputFileName);
strcat(inputFileName_temp,Suffix_28);
if(s == 0){
strcat(inputFileName_temp,Label_1);
}
if(s == 1){
strcat(inputFileName_temp,Label_2);
}
if(s == 2){
strcat(inputFileName_temp,Label_3);
}
if(s == 3){
strcat(inputFileName_temp,Label_4);
}
strcat(inputFileName_temp,".dat");
}
cout<<"Input file name: "<<inputFileName_temp<<endl;
//Getting x,y from file//
inFile.open(inputFileName_temp,ios::in);
if(inFile.is_open()){
cout<<"Input file was opened successfully"<<endl;
int NumOfLines = 0;
while(!inFile.eof()){
getline(inFile, line);
NumOfLines++;
}
if(DataWithHeaders){
NumOfLines = NumOfLines - 2;
}
else{NumOfLines = NumOfLines - 1;}
cout<<"Lines in input file: "<<NumOfLines<<endl;
//Creating sized arrays//
const int nArray = NumOfLines + 20;
double Teff[nArray];
double freq_FU[nArray];
double freq_FO[nArray];
double freq_2O[nArray];
double freq_ThirdO[nArray];
double freq_ForthO[nArray];
double freq_FifthO[nArray];
double freq_SixthO[nArray];
double freq_SeventhO[nArray];
double freq_EighthO[nArray];
double freq_NinthO[nArray];
double growth_FU[nArray];
double growth_FO[nArray];
double growth_2O[nArray];
double growth_ThirdO[nArray];
double growth_ForthO[nArray];
double growth_FifthO[nArray];
double growth_SixthO[nArray];
double growth_SeventhO[nArray];
double growth_EighthO[nArray];
double growth_NinthO[nArray];
double freq_BG1[nArray];
double freq_BG2[nArray];
double freq_BG3[nArray];
double freq_BG4[nArray];
double freq_BG5[nArray];
double freq_BG6[nArray];
double freq_BG7[nArray];
}
else{cout<<"Input file not found, check name?"<<endl;}
inFile.close();
inFile.open(inputFileName_temp,ios::in);
if(inFile.good()){
if(DataWithHeaders){
getline(inFile,header);
cout<<header<<endl;
}
for(int i = 0; i < NumOfLines; i++){
inFile>>Teff[i]>>freq_FU[i]>>freq_FO[i]>>freq_2O[i]>>freq_ThirdO[i]>>freq_ForthO[i]>>freq_FifthO[i]>>freq_SixthO[i]>>freq_SeventhO[i]>>freq_EighthO[i]>>freq_NinthO[i]>>growth_FU[i]>>growth_FO[i]>>growth_2O[i]>>growth_ThirdO[i]>>growth_ForthO[i]>>growth_FifthO[i]>>growth_SixthO[i]>>growth_SeventhO[i]>>growth_EighthO[i]>>growth_NinthO[i];
//inFile.ignore(50, '\n'); //This allows for only the defined lines to be read (unless data file is 50+ columns long)
cout<<setw(5)<<Teff[i]<<setw(10)<<freq_FU[i]<<setw(10)<<freq_FO[i]<<setw(10)<<freq_2O[i]<<setw(10)<<freq_ThirdO[i]<<setw(10)<<freq_ForthO[i]<<setw(10)<<freq_FifthO[i]<<setw(10)<<freq_SixthO[i]<<setw(10)<<freq_SeventhO[i]<<setw(10)<<freq_EighthO[i]<<setw(10)<<freq_NinthO[i]<<setw(10)<<growth_FU[i]<<setw(10)<<growth_FO[i]<<setw(10)<<growth_2O[i]<<setw(10)<<growth_ThirdO[i]<<setw(10)<<growth_ForthO[i]<<setw(10)<<growth_FifthO[i]<<setw(10)<<growth_SixthO[i]<<setw(10)<<growth_SeventhO[i]<<setw(10)<<growth_EighthO[i]<<setw(10)<<growth_NinthO[i]<<endl;
freq_BG1[i] = 1.5*freq_FU[i];
freq_BG2[i] = 2.0*freq_FU[i];
freq_BG3[i] = 2.5*freq_FU[i];
freq_BG4[i] = 3.5*freq_FU[i];
freq_BG5[i] = 4.5*freq_FU[i];
freq_BG6[i] = 5.5*freq_FU[i];
freq_BG7[i] = 6.5*freq_FU[i];
}
cout<<"************* End of file ********************"<<endl;
//////Graphics//////
//Output file name creation//
if(f == 0){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_1);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_1);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);
cout<<"Root file path: "<<Full_RootFilePath<<endl;
cout<<"PNG file path: "<<Full_PNGFilePath<<endl;
}
if(f == 1){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_2);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_2);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);
cout<<"Root file path: "<<Full_RootFilePath<<endl;
cout<<"PNG file path: "<<Full_PNGFilePath<<endl;
}
if(f == 2){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_3);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_3);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);
cout<<"Root file path: "<<Full_RootFilePath<<endl;
cout<<"PNG file path: "<<Full_PNGFilePath<<endl;
}
if(f == 3){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_4);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_4);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);
cout<<"Root file path: "<<Full_RootFilePath<<endl;
cout<<"PNG file path: "<<Full_PNGFilePath<<endl;
}
if(f == 4){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_5);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_5);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);
cout<<"Root file path: "<<Full_RootFilePath<<endl;
cout<<"PNG file path: "<<Full_PNGFilePath<<endl;
}
if(f == 5){
strcpy(Full_RootFileName, outputFileName);
strcat(Full_RootFileName, Suffix_6);
if(s == 0){
strcat(Full_RootFileName, Label_1);
}
if(s == 1){
strcat(Full_RootFileName, Label_2);
}
if(s == 2){
strcat(Full_RootFileName, Label_3);
}
if(s == 3){
strcat(Full_RootFileName, Label_4);
}
strcat(Full_RootFileName, ".root");
strcpy(Full_RootFilePath, OutputDirectory);
strcat(Full_RootFilePath, "/RootFiles/");
strcat(Full_RootFilePath, Full_RootFileName);
strcpy(Full_PNGFileName, outputFileName);
strcat(Full_PNGFileName, Suffix_6);
if(s == 0){
strcat(Full_PNGFileName, Label_1);
}
if(s == 1){
strcat(Full_PNGFileName, Label_2);
}
if(s == 2){
strcat(Full_PNGFileName, Label_3);
}
if(s == 3){
strcat(Full_PNGFileName, Label_4);
}
strcat(Full_PNGFileName, ".png");
strcpy(Full_PNGFilePath, OutputDirectory);
strcat(Full_PNGFilePath, "/PNGFiles/");
strcat(Full_PNGFilePath, Full_PNGFileName);