-
Notifications
You must be signed in to change notification settings - Fork 0
/
HEP_Project_ProgramV12.C
1044 lines (862 loc) · 38 KB
/
HEP_Project_ProgramV12.C
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 to read data from root file and make invarient mass hist
// Based on: https://mhance.scipp.ucsc.edu/analysisintro.php
//V2: Taken from HEP_practice program, then fitted for CERN data. Got Invarient mass for Z with muons
//V3: Added invarient mass for W with electrons using transverse mass
//V4: Changes made with Nick, added Iso bounds and UseAllMuonsForW bool to get only pos muons for W+. Adding more hists for mT and MET
//V5: Fixing MET_phi
//V6: Added more iso hists
//V7: Adding electron W's back.
///Note: Add WElectrons to WMuons or keep them seperate (currently seperate)
//V8: Added bJet with Nick, not working correctly? Keeps crashing when added bJet with WMuon
//V9: Fixed V8 so it will run
//V10: Made NMuon and NJet = 2 case allowed. This is not the whole picture - Muons and Jets are not parallel arrays. Look in notebook to make V11
//V11: Completely changed how WMuon loop works. Now collecting tops correctly?
///Note: This still isnt making Top dist correctly, also W has no distibution
//V12: V11 but Nicks version will all declarations up top
# 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"
# include <TLorentzVector.h>
//gDebug = 1;
using namespace std;
int main(){
/////Controls/////
char rootFilePrefix[50] = "HEPTutorial/files/"; //Prefix to root file, this is the path to it - all the way up until its name.
char rootFileName[50] = "data.root"; //The root file name itself - this is where the tree is.
char TreeName1[50] = "events;1";
char rootOutputFileName1[50] = "NoBounds_InvarientMassHist.root"; //Name of an output root file
char rootOutputFileName2[50] = "NoBounds_PosVNegPrime.root"; //Name of an output root file
char rootOutputFileName3[50] = "NoBounds_PosVNeg.root"; //Name of an output root file
char rootOutputFileName4[50] = "NoBounds_MuonIso_btag.root"; //Name of an output root file
char rootOutputFileName5[50] = "NoBounds_MET_WMuonMass.root";
char rootOutputFileName6[50] = "NoBounds_TransverseMassHist.root";
char rootOutputFileName7[50] = "NoBounds_InvarientMassHist_TOP.root";
char rootOutputFileName8[50] = "NoBounds_InvarientMassHist_W.root";
double MuonIsoBound_ForZ = 0.05; //Upper bound to muon iso when looking for ZMuons
double MuonIsoBound_ForW = 0.05; //Upper bound to muon iso when looking for WMuons
double ElectronIsoBound_ForW = 0.05; //Upper bound to electron iso when looking for WElectrons
double Jet_btag_Bound = 1.74; //Lower bound to Jet_btag
double mT_MaxCount = 1000; //Max counts for mT hists. About 1,000 for full data set and 25 for 1/44
double xMin = -100;
double xMax = 100;
double yMin = -300;
double yMax = 300;
const int xNChannels = 1000; //Number of channels for root hist on x axis
const int yNChannels = 500; //Number of channels for root hist on y axis
bool SaveAsRootFile = true; //If true, will save canvases to root file instead of printing to screen.
bool FitInvarientMassHist = true; //If true, will fit Invarient mass hist for Z from muons with gaus, and W from muons with gaus
// bool UseAllMuonsForW = false; //If true, will use all Muons for W and not just positive ones
// bool UseAllMuonsForW = false; //If true, will use all Muons for W and not just positive ones
///////////////////////////////////////
/////Varibles (Pre-stated)/////
char rootFilePath1[100];
int NJet, NMuon, NElectron, NPhoton, MCleptonPDGid, NPrimaryVertices;
const int NMuonArray = 20;
const int NElectronArray = 20;
const int NJetArray = 20;
int Muon_Charge[NMuonArray], Electron_Charge[NElectronArray];
float Jet_Px[NJetArray], Jet_Py[NJetArray], Jet_Pz[NJetArray], Jet_E[NJetArray], Jet_btag[NJetArray], Muon_Px[NMuonArray], Muon_Py[NMuonArray], Muon_Pz[NMuonArray], Muon_E[NMuonArray], Muon_Iso[NMuonArray],
Electron_Px[NElectronArray], Electron_Py[NElectronArray], Electron_Pz[NElectronArray], Electron_E[NElectronArray], Electron_Iso[NElectronArray], Photon_Px, Photon_Py, Photon_Pz, Photon_E, Photon_Iso,
MET_px, MET_py, MChadronicBottom_px, MChadronicBottom_py, MChadronicBottom_pz, MCleptonicBottom_px, MCleptonicBottom_py, MCleptonicBottom_pz,
MChadronicWDecayQuark_px, MChadronicWDecayQuark_py, MChadronicWDecayQuark_pz, MChadronicWDecayQuarkBar_px, MChadronicWDecayQuarkBar_py, MChadronicWDecayQuarkBar_pz,
MClepton_px, MClepton_py, MClepton_pz, MCneutrino_px, MCneutrino_py, MCneutrino_pz, EventWeight;
bool Jet_ID[NJetArray], triggerIsoMu24;
double InvarientMass;
ofstream outFile1;
TH1F *histM_Muon = new TH1F("histM_Muon", "Invarient Mass hist: Muon", xNChannels, 0, 150);
TH1F *histM_WMuon = new TH1F("histM_WMuon", "Transverse Mass hist: WMuon", xNChannels, 0, 150);
TH1F *histM_WMuon2 = new TH1F("histM_WMuon2", "Transverse Mass hist2: WMuon", xNChannels, 0, 150);
TH1F *histM_WMuon3 = new TH1F("histM_WMuon3", "Transverse Mass hist3: WMuon", xNChannels, 0, 150);
TH1F *histM_WMuonPos = new TH1F("histM_WMuonPos", "Transverse Mass hist: WMuon Pos", xNChannels, 0, 150);
TH1F *histM_WMuonNeg = new TH1F("histM_WMuonNeg", "Transverse Mass hist: WMuon Neg", xNChannels, 0, 150);
TH1F *histM_WElectron = new TH1F("histM_WElectron", "Transverse Mass hist: WElectron", xNChannels, 0, 150);
TH1F *histM_WElectronPos = new TH1F("histM_WElectronPos", "Transverse Mass hist: WElectron Pos", xNChannels, 0, 150);
TH1F *histM_WElectronNeg = new TH1F("histM_WElectronNeg", "Transverse Mass hist: WElectron Neg", xNChannels, 0, 150);
TH1F *histNMuon = new TH1F("histNMuon", "NMuon hist", 10, -5, 5);
TH1F *histNElectron = new TH1F("histNElectron", "NElectron hist", 10, -5, 5);
TH1F *histPosPxPrime = new TH1F("histPosPxPrime", "PosPxPrime hist", xNChannels, xMin, xMax);
TH1F *histPosPyPrime = new TH1F("histPosPyPrime", "PosPyPrime hist", xNChannels, xMin, xMax);
TH1F *histPosPzPrime = new TH1F("histPosPzPrime", "PosPzPrime hist", xNChannels, xMin, xMax);
TH1F *histPosEPrime = new TH1F("histPosEPrime", "PosEPrime hist", xNChannels, xMin, xMax);
TH1F *histNegPxPrime = new TH1F("histNegPxPrime", "NegPx hist", xNChannels, xMin, xMax);
TH1F *histNegPyPrime = new TH1F("histNegPyPrime", "NegPy hist", xNChannels, xMin, xMax);
TH1F *histNegPzPrime = new TH1F("histNegPzPrime", "NegPz hist", xNChannels, xMin, xMax);
TH1F *histNegEPrime = new TH1F("histNegEPrime", "NegE hist", xNChannels, xMin, xMax);
TH2F *histPosVNegPx = new TH2F("histPosVNegPx", "PosVNegPx hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegPy = new TH2F("histPosVNegPy", "PosVNegPy hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegPz = new TH2F("histPosVNegPz", "PosVNegPz hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegE = new TH2F("histPosVNegE", "PosVNegE hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegPxPrime = new TH2F("histPosVNegPxPrime", "PosVNegPxPrime hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegPyPrime = new TH2F("histPosVNegPyPrime", "PosVNegPyPrime hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegPzPrime = new TH2F("histPosVNegPzPrime", "PosVNegPzPrime hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH2F *histPosVNegEPrime = new TH2F("histPosVNegEPrime", "PosVNegEPrime hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH1F *histMuonIso = new TH1F("histMuonIso", "MuonIso hist", xNChannels, 0, 20);
TH1F *histMuonPt = new TH1F("histMuonPt", "MuonPt hist", xNChannels, xMin, xMax);
TH1F *histWMuonIso = new TH1F("histMuonIso", "MuonIso hist", xNChannels, 0, 20);
TH1F *histWElectronIso = new TH1F("histElectronIso", "ElectronIso hist", xNChannels, 0, 20);
TH2F *hist_WMuonVIso = new TH2F("hist_WMuonVIso", "WMuonVIso hist", xNChannels, 0, 20, 0, 1000);
TH2F *hist_bJetVbtag = new TH2F("hist_bJetVbtag", "bJetVbtag hist", xNChannels, 0, 20, 0, 1000);
TH2F *histMETxy = new TH2F("histMETxy", "METxy hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
TH1F *histMET = new TH1F("histMET", "MET hist", xNChannels, xMin, xMax);
TH1F *histMET_Phi = new TH1F("histMET_Phi", "MET_Phi hist", xNChannels, 0, 360);
TH1F *histM_TopPos = new TH1F("histM_TopPos", "Invarient Mass hist: TopPos", xNChannels, 0, 200);
TH1F *histM_TopNeg = new TH1F("histM_TopNeg", "Invarient Mass hist: TopNeg", xNChannels, 0, 200);
TH1F *histM_Top = new TH1F("histM_Top", "Invarient Mass hist: Top", xNChannels, 0, 200);
TH1F *histM_WPos = new TH1F("histM_WPos", "Invarient Mass hist: WPos", xNChannels, 0, 200);
TH1F *histM_WNeg = new TH1F("histM_WNeg", "Invarient Mass hist: WNeg", xNChannels, 0, 200);
TH1F *histM_W = new TH1F("histM_W", "Invarient Mass hist: W", xNChannels, 0, 200);
double Pi = acos(-1.);
double Deg2Rad = Pi/180.;
//////////////////////////////////////
//Creating path to root file and getting tree//
strcpy(rootFilePath1, rootFilePrefix);
strcat(rootFilePath1, rootFileName);
cout<<"Root file path 1: "<<rootFilePath1<<endl;
TFile *file = new TFile(rootFilePath1);
TTree *t1 = (TTree*)file->Get(TreeName1);
t1->SetBranchAddress("NJet",&NJet);
t1->SetBranchAddress("Jet_Px",&Jet_Px[0]);
t1->SetBranchAddress("Jet_Py",&Jet_Py[0]);
t1->SetBranchAddress("Jet_Pz",&Jet_Pz[0]);
t1->SetBranchAddress("Jet_E",&Jet_E[0]);
t1->SetBranchAddress("Jet_btag",&Jet_btag[0]);
t1->SetBranchAddress("Jet_ID",&Jet_ID[0]);
t1->SetBranchAddress("NMuon",&NMuon);
t1->SetBranchAddress("Muon_Px",&Muon_Px[0]);
t1->SetBranchAddress("Muon_Py",&Muon_Py[0]);
t1->SetBranchAddress("Muon_Pz",&Muon_Pz[0]);
t1->SetBranchAddress("Muon_E",&Muon_E[0]);
t1->SetBranchAddress("Muon_Charge",&Muon_Charge[0]);
t1->SetBranchAddress("Muon_Iso",&Muon_Iso[0]);
t1->SetBranchAddress("NElectron",&NElectron);
t1->SetBranchAddress("Electron_Px",&Electron_Px[0]);
t1->SetBranchAddress("Electron_Py",&Electron_Py[0]);
t1->SetBranchAddress("Electron_Pz",&Electron_Pz[0]);
t1->SetBranchAddress("Electron_E",&Electron_E[0]);
t1->SetBranchAddress("Electron_Charge",&Electron_Charge[0]);
t1->SetBranchAddress("Electron_Iso",&Electron_Iso[0]);
// t1->SetBranchAddress("NPhoton",&NPhoton);
// t1->SetBranchAddress("Photon_Px",&Photon_Px);
// t1->SetBranchAddress("Photon_Py",&Photon_Py);
// t1->SetBranchAddress("Photon_Pz",&Photon_Pz);
// t1->SetBranchAddress("Photon_E",&Photon_E);
// t1->SetBranchAddress("Photon_Iso",&Photon_Iso);
t1->SetBranchAddress("MET_px",&MET_px);
t1->SetBranchAddress("MET_py",&MET_py);
// t1->SetBranchAddress("MChadronicBottom_px",&MChadronicBottom_px);
// t1->SetBranchAddress("MChadronicBottom_py",&MChadronicBottom_py);
// t1->SetBranchAddress("MChadronicBottom_pz",&MChadronicBottom_pz);
// t1->SetBranchAddress("MCleptonicBottom_px",&MCleptonicBottom_px);
// t1->SetBranchAddress("MCleptonicBottom_py",&MCleptonicBottom_py);
// t1->SetBranchAddress("MCleptonicBottom_pz",&MCleptonicBottom_pz);
// t1->SetBranchAddress("MChadronicWDecayQuark_px",&MChadronicWDecayQuark_px);
// t1->SetBranchAddress("MChadronicWDecayQuark_py",&MChadronicWDecayQuark_py);
// t1->SetBranchAddress("MChadronicWDecayQuark_pz",&MChadronicWDecayQuark_pz);
// t1->SetBranchAddress("MChadronicWDecayQuarkBar_px",&MChadronicWDecayQuarkBar_px);
// t1->SetBranchAddress("MChadronicWDecayQuarkBar_py",&MChadronicWDecayQuarkBar_py);
// t1->SetBranchAddress("MChadronicWDecayQuarkBar_pz",&MChadronicWDecayQuarkBar_pz);
// t1->SetBranchAddress("MClepton_px",&MClepton_px);
// t1->SetBranchAddress("MClepton_py",&MClepton_py);
// t1->SetBranchAddress("MClepton_pz",&MClepton_pz);
// t1->SetBranchAddress("MCleptonPDGid",&MCleptonPDGid);
// t1->SetBranchAddress("MCneutrino_px",&MCneutrino_px);
// t1->SetBranchAddress("MCneutrino_py",&MCneutrino_py);
// t1->SetBranchAddress("MCneutrino_pz",&MCneutrino_pz);
// t1->SetBranchAddress("NPrimaryVertices",&NPrimaryVertices);
// t1->SetBranchAddress("triggerIsoMu24",&triggerIsoMu24);
// t1->SetBranchAddress("EventWeight",&EventWeight);
int NWMuon = 0;
int NbJet = 0;
TLorentzVector pos_Muon_prime;
TLorentzVector neg_Muon_prime;
TLorentzVector tot_Muon_prime;
TLorentzVector pos_Muon;
TLorentzVector neg_Muon;
TLorentzVector tot_Muon;
TLorentzVector WMuon_prime;
TLorentzVector WMuon_prime_Pos;
TLorentzVector WMuon_prime_Neg;
TLorentzVector WElectron_prime;
TLorentzVector WElectron_prime_Pos;
TLorentzVector WElectron_prime_Neg;
TLorentzVector bJet_Pos;
TLorentzVector bJet_Neg;
TLorentzVector TopPos;
TLorentzVector TopNeg;
TLorentzVector MuonTemp;
TLorentzVector MET;
TLorentzVector Neutrino1_Pos;
TLorentzVector Neutrino1_Neg;
TLorentzVector Neutrino2_Pos;
TLorentzVector Neutrino2_Neg;
TLorentzVector WPos;
TLorentzVector WNeg;
double Muon_Pt_pos;
double Muon_Pt_neg;
double MET_pz;
double MET_E;
int NEntries1 = t1->GetEntries();
cout<<"NEntries 1: "<<NEntries1<<endl;
NEntries1 = NEntries1; //Cut for testing
for(int i = 0; i < NEntries1; i++){
cout<<"*************"<<endl;
cout<<"i: "<<i<<endl;
t1->GetEntry(i);
/*pos_Muon_prime = new TLorentzVector;
neg_Muon_prime = new TLorentzVector;
tot_Muon_prime = new TLorentzVector;
pos_Muon = new TLorentzVector;
neg_Muon = new TLorentzVector;
tot_Muon = new TLorentzVector;
WMuon_prime = new TLorentzVector;
WMuon_prime_Pos = new TLorentzVector;
WMuon_prime_Neg = new TLorentzVector;
WElectron_prime = new TLorentzVector;
WElectron_prime_Pos = new TLorentzVector;
WElectron_prime_Neg = new TLorentzVector;
bJet_prime_Pos = new TLorentzVector;
bJet_prime_Neg = new TLorentzVector;
TopPos = new TLorentzVector;
TopNeg = new TLorentzVector;
MuonTemp = new TLorentzVector;
MET = new TLorentzVector; */
bool WPosHappened = false;
bool WNegHappened = false;
//histMuonIso->Fill(Muon_Iso);
//For the Z//
if(NMuon >= 2){
cout<<"NMuon: "<<NMuon<<endl;
histNMuon->Fill(NMuon);
for(int j = 0; j < NMuon; j++){
histMuonIso->Fill(Muon_Iso[j]);
MuonTemp.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
if((Muon_Iso[j] < MuonIsoBound_ForZ) && (MuonTemp.P() > 0)){
cout<<"Z| i: "<<i<<" j: "<<j<<" Muon_Charge: "<<Muon_Charge[j]<<endl;
if(Muon_Charge[j] == 1){
pos_Muon_prime.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
// histPosPxPrime->Fill(Muon_Px[j]);
// histPosPyPrime->Fill(Muon_Py[j]);
// histPosPzPrime->Fill(Muon_Pz[j]);
// histPosEPrime->Fill(Muon_E[j]);
double Muon_Iso_pos = Muon_Iso[j];
Muon_Pt_pos = pos_Muon_prime.Pt();
}
if(Muon_Charge[j] == -1){
neg_Muon_prime.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
// histNegPxPrime->Fill(Muon_Px[j]);
// histNegPyPrime->Fill(Muon_Py[j]);
// histNegPzPrime->Fill(Muon_Pz[j]);
// histNegEPrime->Fill(Muon_E[j]);
double Muon_Iso_neg = Muon_Iso[j];
double Muon_Pt_neg = neg_Muon_prime.Pt();
}
histPosVNegPxPrime->Fill(pos_Muon_prime.Px(), neg_Muon_prime.Px());
histPosVNegPyPrime->Fill(pos_Muon_prime.Py(), neg_Muon_prime.Py());
histPosVNegPzPrime->Fill(pos_Muon_prime.Pz(), neg_Muon_prime.Pz());
histPosVNegEPrime->Fill(pos_Muon_prime.E(), neg_Muon_prime.E());
}
}
//if(((Muon_Charge[0] == 1 && Muon_Charge[1] == -1) || (Muon_Charge[0] == -1 && Muon_Charge[1] == 1)) && ((Muon_Iso[0] < MuonIsoBound_ForZ) && (Muon_Iso[1] < MuonIsoBound_ForZ)) && (MuonTemp.P() > 0)){
tot_Muon_prime = pos_Muon_prime + neg_Muon_prime;
histM_Muon->Fill(tot_Muon_prime.M());
//histMuonIso->Fill(Muon_Iso_pos); ///neg_Muon_prime.Pt());
histMuonPt->Fill(Muon_Pt_pos);
histMuonPt->Fill(Muon_Pt_neg);
TVector3 tot_Muon_boost;
tot_Muon_boost = tot_Muon_prime.BoostVector();
TLorentzRotation l;
TLorentzRotation l2;
l.Boost(0,0,0);
l.Boost(tot_Muon_boost);
l2 = l.Inverse();
neg_Muon = l2*neg_Muon_prime;
pos_Muon = l2*pos_Muon_prime;
tot_Muon = pos_Muon + neg_Muon;
histPosVNegPx->Fill(pos_Muon.Px(), neg_Muon.Px());
histPosVNegPy->Fill(pos_Muon.Px(), neg_Muon.Px());
histPosVNegPz->Fill(pos_Muon.Px(), neg_Muon.Px());
histPosVNegE->Fill(pos_Muon.Px(), neg_Muon.Px());
//}
}
for(int jet = 0; jet < NJet; jet++){ // Does the Muon loop for every jet
if(Jet_ID[jet] && (Jet_btag[jet] > Jet_btag_Bound)){
//For the WMuon and Top//
if(NMuon > 1){
cout<<"NMuon: "<<NMuon<<endl;
histNMuon->Fill(NMuon);
for(int j = 0; j < NMuon; j++){ // Muon loop: Looks at every loop
if(Muon_Iso[j] < MuonIsoBound_ForW){
histWMuonIso->Fill(Muon_Iso[j]);
cout<<"W| i: "<<i<<" j: "<<j<<" Muon_Charge: "<<Muon_Charge[j]<<endl;
cout<<"Muon_Px: "<<Muon_Px[j]<<" Muon_Py: "<<Muon_Py[j]<<" Muon_Pz: "<<Muon_Pz[j]<<endl;
WMuon_prime.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
if(Muon_Charge[j] > 0){
cout<<"W+| i: "<<i<<" j: "<<j<<" Muon_Charge: "<<Muon_Charge[j]<<endl;
cout<<"Muon_Px: "<<Muon_Px[j]<<" Muon_Py: "<<Muon_Py[j]<<" Muon_Pz: "<<Muon_Pz[j]<<endl;
WMuon_prime_Pos.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
WPosHappened = true;
MET.SetXYZM(MET_px, MET_py, 0., 0.);
bJet_Pos.SetPxPyPzE(Jet_Px[j], Jet_Py[j], Jet_Pz[j], Jet_E[j]);
double mW = 80.4;
double A = pow(WMuon_prime_Pos.E(), 2) - pow(WMuon_prime_Pos.Pz(), 2);
double B = mW * mW / 2. + (WMuon_prime_Pos.Px() * MET_px + WMuon_prime_Pos.Py() * MET_py);
double D = pow(WMuon_prime_Pos.E(), 2) * (pow(B, 2) - pow(MET.Pt(), 2) * A);
// first solution
if(D >= 0){
double MET_pz = WMuon_prime_Pos.Pz() * B / A + sqrt(D) / A;
double MET_E = sqrt(MET_px * MET_px + MET_py * MET_py + MET_pz * MET_pz);
Neutrino1_Pos.SetPxPyPzE(MET_px, MET_py, MET_pz, MET_E);
WPos = Neutrino1_Pos + WMuon_prime_Pos;
histM_WPos->Fill(WPos.M());
histM_W->Fill(WPos.M());
TopPos = WPos + bJet_Pos;
histM_TopPos->Fill(TopPos.M());
histM_Top->Fill(TopPos.M());
}
// second solution
if(D > 0){
double pz = WMuon_prime_Pos.Pz() * B / A - sqrt(D) / A;
double E = sqrt(MET_px * MET_px + MET_py * MET_py + MET_pz * MET_pz);
Neutrino2_Pos.SetPxPyPzE(MET_px, MET_py, MET_pz, MET_E);
WPos = Neutrino2_Pos + WMuon_prime_Pos;
histM_WPos->Fill(WPos.M());
histM_W->Fill(WPos.M());
TopPos = WPos + bJet_Pos;
histM_TopPos->Fill(TopPos.M());
histM_Top->Fill(TopPos.M());
}
}
if(Muon_Charge[j] < 0){
cout<<"W-| i: "<<i<<" j: "<<j<<" Muon_Charge: "<<Muon_Charge[j]<<endl;
cout<<"Muon_Px: "<<Muon_Px[j]<<" Muon_Py: "<<Muon_Py[j]<<" Muon_Pz: "<<Muon_Pz[j]<<endl;
WMuon_prime_Neg.SetPxPyPzE(Muon_Px[j], Muon_Py[j], Muon_Pz[j], Muon_E[j]);
WNegHappened = true;
MET.SetXYZM(MET_px, MET_py, 0., 0.);
bJet_Neg.SetPxPyPzE(Jet_Px[j], Jet_Py[j], Jet_Pz[j], Jet_E[j]);
double mW = 80.4;
double A = pow(WMuon_prime_Neg.E(), 2) - pow(WMuon_prime_Neg.Pz(), 2);
double B = mW * mW / 2. + (WMuon_prime_Neg.Px() * MET_px + WMuon_prime_Neg.Py() * MET_py);
double D = pow(WMuon_prime_Neg.E(), 2) * (pow(B, 2) - pow(MET.Pt(), 2) * A);
// first solution
if(D >= 0){
double MET_pz = WMuon_prime_Neg.Pz() * B / A + sqrt(D) / A;
double MET_E = sqrt(MET_px * MET_px + MET_py * MET_py + MET_pz * MET_pz);
Neutrino1_Neg.SetPxPyPzE(MET_px, MET_py, MET_pz, MET_E);
WNeg = Neutrino1_Neg + WMuon_prime_Neg;
histM_WNeg->Fill(WNeg.M());
histM_W->Fill(WNeg.M());
TopNeg = WNeg + bJet_Neg;
histM_TopNeg->Fill(TopNeg.M());
histM_Top->Fill(TopNeg.M());
}
// second solution
if(D > 0){
double pz = WMuon_prime_Neg.Pz() * B / A - sqrt(D) / A;
double E = sqrt(MET_px * MET_px + MET_py * MET_py + MET_pz * MET_pz);
Neutrino2_Neg.SetPxPyPzE(MET_px, MET_py, MET_pz, MET_E);
WNeg = Neutrino2_Neg + WMuon_prime_Neg;
histM_WNeg->Fill(WNeg.M());
histM_W->Fill(WNeg.M());
TopNeg = WNeg + bJet_Neg;
histM_TopNeg->Fill(TopNeg.M());
histM_Top->Fill(TopNeg.M());
}
}
}
}
// if(((Muon_Charge[0] == 1 && Muon_Charge[1] == -1) || (Muon_Charge[0] == -1 && Muon_Charge[1] == 1)) && (Muon_Iso[j] < MuonIsoBound_ForW) && (Jet_ID[j] && (Jet_btag[j] > Jet_btag_Bound))){
// for(int j = 0; j < NMuon; j++){
// WPosHappened = true;
// WNegHappened = true;
// NWMuon = NWMuon + 1;
// hist_WMuonVIso->Fill(Muon_Iso[j], NWMuon);
// double MET_prime = sqrt((MET_px*MET_px) + (MET_py*MET_py));
// if(MET_px != 0){
// double MET_prime_Phi_Reference = abs(atan(MET_py/MET_px));
// }
// double MET_prime_Phi;
// if(MET_px > 0 && MET_py > 0){
// MET_prime_Phi = MET_prime_Phi_Reference;
// }
// if(MET_px > 0 && MET_py < 0){
// MET_prime_Phi = Pi + MET_prime_Phi_Reference;
// }
// if(MET_px < 0 && MET_py > 0){
// MET_prime_Phi = Pi - MET_prime_Phi_Reference;
// }
// if(MET_px < 0 && MET_py < 0){
// MET_prime_Phi = 2*Pi - MET_prime_Phi_Reference;
// }
// if(MET_px == 0 && MET_py > 0){
// MET_prime_Phi = Pi/2.;
// }
// if(MET_px == 0 && MET_py < 0){
// MET_prime_Phi = (3./2.)*Pi;
// }
// if(MET_px > 0 && MET_py == 0){
// MET_prime_Phi = 0;
// }
// if(MET_px < 0 && MET_py == 0){
// MET_prime_Phi = Pi;
// }
// cout<<MET_prime_Phi<<endl;
// histMETxy->Fill(MET_px, MET_py);
// histMET->Fill(MET_prime);
// histMET_Phi->Fill(MET_prime_Phi * (1./Deg2Rad));
// double WMuon_prime_Phi = WMuon_prime.Phi();
// double WMuon_prime_Pt = WMuon_prime.Pt();
// double WMuon_prime_Et = WMuon_prime.Et();
// double WMuon_prime_Phi_Pos = WMuon_prime_Pos.Phi();
// double WMuon_prime_Pt_Pos = WMuon_prime_Pos.Pt();
// double WMuon_prime_Et_Pos = WMuon_prime_Pos.Et();
// double WMuon_prime_Phi_Neg = WMuon_prime_Neg.Phi();
// double WMuon_prime_Pt_Neg = WMuon_prime_Neg.Pt();
// double WMuon_prime_Et_Neg = WMuon_prime_Neg.Et();
// double mT_mine = sqrt(2.*MET_prime*WMuon_prime_Pt*(1-cos(MET_prime_Phi - WMuon_prime_Phi)));
// double mT_mine2 = sqrt(2.*MET_prime*WMuon_prime_Et*(1-cos(MET_prime_Phi - WMuon_prime_Phi)));
// double mT_mine3 = sqrt(2.*(MET_prime*WMuon_prime_Et-(MET_prime*WMuon_prime_Pt*cos(MET_prime_Phi - WMuon_prime_Phi))));
// double mT_mine_Pos = sqrt(2.*MET_prime*WMuon_prime_Et_Pos*(1-cos(MET_prime_Phi - WMuon_prime_Phi_Pos)));
// double mT_mine_Neg = sqrt(2.*MET_prime*WMuon_prime_Et_Neg*(1-cos(MET_prime_Phi - WMuon_prime_Phi_Neg)));
// histM_WMuon->Fill(mT_mine);
// histM_WMuon2->Fill(mT_mine2);
// histM_WMuon3->Fill(mT_mine3);
// histM_WMuonPos->Fill(mT_mine_Pos);
// histM_WMuonNeg->Fill(mT_mine_Neg);
// }
// }
}
}
}
//For the WElectron//
// if(NElectron == 1){
// cout<<"NElectron: "<<NElectron<<endl;
// histNElectron->Fill(NElectron);
// for(int j = 0; j < NElectron; j++){
// if(Electron_Iso[j] < ElectronIsoBound_ForW){
// histWElectronIso->Fill(Electron_Iso[j]);
// cout<<"W| i: "<<i<<" j: "<<j<<" Electron_Charge: "<<Electron_Charge[j]<<endl;
// WElectron_prime.SetPxPyPzE(Electron_Px[j], Electron_Py[j], Electron_Pz[j], Electron_E[j]);
// if(Electron_Charge[j] > 0){
// cout<<"W+| i: "<<i<<" j: "<<j<<" Electron_Charge: "<<Electron_Charge[j]<<endl;
// WElectron_prime_Pos.SetPxPyPzE(Electron_Px[j], Electron_Py[j], Electron_Pz[j], Electron_E[j]);
// }
// if(Electron_Charge[j] < 0){
// cout<<"W-| i: "<<i<<" j: "<<j<<" Electron_Charge: "<<Electron_Charge[j]<<endl;
// WElectron_prime_Neg.SetPxPyPzE(Electron_Px[j], Electron_Py[j], Electron_Pz[j], Electron_E[j]);
// }
// }
// }
// double MET_prime = sqrt((MET_px*MET_px) + (MET_py*MET_py));
// if(MET_px != 0){
// double MET_prime_Phi_Reference = abs(atan(MET_py/MET_px));
// }
// double MET_prime_Phi;
// if(MET_px > 0 && MET_py > 0){
// MET_prime_Phi = MET_prime_Phi_Reference;
// }
// if(MET_px > 0 && MET_py < 0){
// MET_prime_Phi = Pi + MET_prime_Phi_Reference;
// }
// if(MET_px < 0 && MET_py > 0){
// MET_prime_Phi = Pi - MET_prime_Phi_Reference;
// }
// if(MET_px < 0 && MET_py < 0){
// MET_prime_Phi = 2*Pi - MET_prime_Phi_Reference;
// }
// if(MET_px == 0 && MET_py > 0){
// MET_prime_Phi = Pi/2.;
// }
// if(MET_px == 0 && MET_py < 0){
// MET_prime_Phi = (3./2.)*Pi;
// }
// if(MET_px > 0 && MET_py == 0){
// MET_prime_Phi = 0;
// }
// if(MET_px < 0 && MET_py == 0){
// MET_prime_Phi = Pi;
// }
// cout<<MET_prime_Phi<<endl;
// histMETxy->Fill(MET_px, MET_py);
// histMET->Fill(MET_prime);
// histMET_Phi->Fill(MET_prime_Phi * (1./Deg2Rad));
// double WElectron_prime_Phi = WElectron_prime.Phi();
// double WElectron_prime_Pt = WElectron_prime.Pt();
// double WElectron_prime_Et = WElectron_prime.Et();
// double WElectron_prime_Phi_Pos = WElectron_prime_Pos.Phi();
// double WElectron_prime_Pt_Pos = WElectron_prime_Pos.Pt();
// double WElectron_prime_Et_Pos = WElectron_prime_Pos.Et();
// double WElectron_prime_Phi_Neg = WElectron_prime_Neg.Phi();
// double WElectron_prime_Pt_Neg = WElectron_prime_Neg.Pt();
// double WElectron_prime_Et_Neg = WElectron_prime_Neg.Et();
// double mT_mine = sqrt(2.*MET_prime*WElectron_prime_Et*(1-cos(MET_prime_Phi - WElectron_prime_Phi)));
// double mT_mine_Pos = sqrt(2.*MET_prime*WElectron_prime_Et_Pos*(1-cos(MET_prime_Phi - WElectron_prime_Phi_Pos)));
// double mT_mine_Neg = sqrt(2.*MET_prime*WElectron_prime_Et_Neg*(1-cos(MET_prime_Phi - WElectron_prime_Phi_Neg)));
// histM_WElectron->Fill(mT_mine);
// histM_WElectronPos->Fill(mT_mine_Pos);
// histM_WElectronNeg->Fill(mT_mine_Neg);
// }
// if(NJet == 2){
// cout<<"NJet: "<<NJet<<endl;
// for(int j = 0; j < NJet; j++){
// if(Jet_ID[j] && (Jet_btag[j] > Jet_btag_Bound)){
// cout<<"Found good bJet"<<endl;
// if(WPosHappened){
// cout<<"b| i: "<<i<<" j: "<<j<<endl;
// bJet_prime_Pos.SetPxPyPzE(Jet_Px[j], Jet_Py[j], Jet_Pz[j], Jet_E[j]);
// cout<<"Made 4 Vect"<<endl;
// }
// if(WNegHappened){
// cout<<"b-| i: "<<i<<" j: "<<j<<endl;
// bJet_prime_Neg.SetPxPyPzE(Jet_Px[j], Jet_Py[j], Jet_Pz[j], Jet_E[j]);
// cout<<"Made 4 Vect"<<endl;
// }
// }
// if((WPosHappened && WNegHappened) && (Jet_ID[j] && (Jet_btag[j] > Jet_btag_Bound))){
// NbJet = NbJet + 1;
// hist_bJetVbtag->Fill(Jet_btag[j], NbJet);
// Top_Pos = bJet_prime_Pos + WMuon_prime_Pos;
// Top_Neg = bJet_prime_Neg + WMuon_prime_Neg;
// cout<<"Added Vects"<<endl;
// histM_TopPos->Fill(Top_Pos.M());
// histM_TopNeg->Fill(Top_Neg.M());
// histM_Top->Fill(Top_Pos.M());
// histM_Top->Fill(Top_Neg.M());
// cout<<"Filled hists"<<endl;
// }
// }
// }
// delete pos_Muon_prime;
// delete neg_Muon_prime;
// delete tot_Muon_prime;
// delete pos_Muon;
// delete neg_Muon;
// delete tot_Muon;
// delete WMuon_prime;
// delete WMuon_prime_Pos;
// delete WMuon_prime_Neg;
// delete WElectron_prime;
// delete WElectron_prime_Pos;
// delete WElectron_prime_Neg;
// delete bJet_prime_Pos;
// delete bJet_prime_Neg;
// delete TopPos;
// delete TopNeg;
// delete MuonTemp;
// delete WPosHappened = false;
// delete WNegHappened = false;
}
// if(FitInvarientMassHist){
TF1 *f1 = new TF1("f1","gaus",80,100);
TF1 *f2 = new TF1("f2","([0]*exp(-((x-[1])^2)/(2*[2]^2)))",60,85);
f2->SetParameters(0, 200); //Normal
f2->SetParameters(1, 70); //Centroid
f2->SetParameters(2, 25); //Width
// }
//////Graphics//////
cout<<"Making histrograms..."<<endl;
TCanvas *c1 = new TCanvas("c1","InvarientMass Histrogram" ,200,10,900,700);
c1->Divide(2,2);
c1->SetFillColor(10);
c1->SetGrid();
c1->GetFrame()->SetFillColor(10);
c1->GetFrame()->SetBorderSize(12);
c1->Range(0,0,1,1);
gStyle->SetOptStat(1);
if(FitInvarientMassHist){
gStyle->SetOptFit(1);
}
c1->cd(1);
histM_Muon->SetXTitle("Invarient Mass");
histM_Muon->SetYTitle("Counts");
histM_Muon->SetStats(1);
if(FitInvarientMassHist){
histM_Muon->Fit(f1, "M");
}
histM_Muon->Draw();
c1->cd(2);
histM_WMuon->SetXTitle("Mt Mass");
histM_WMuon->SetYTitle("Counts");
histM_WMuon->SetStats(1);
if(FitInvarientMassHist){
histM_WMuon->Fit(f2, "M");
}
histM_WMuon->Draw();
c1->cd(3);
histM_WMuon2->SetXTitle("Mt 2 Mass");
histM_WMuon2->SetYTitle("Counts");
histM_WMuon2->SetStats(1);
histM_WMuon2->Draw();
c1->cd(4);
histM_WMuon3->SetXTitle("Mt 3 Mass");
histM_WMuon3->SetYTitle("Counts");
histM_WMuon3->SetStats(1);
histM_WMuon3->Draw();
if(SaveAsRootFile){
TFile outfile1(rootOutputFileName1, "RECREATE");
c1->Write(rootOutputFileName1);
outfile1.Close();
}
TCanvas *c2 = new TCanvas("c2","PosVNegPrime Histrogram" ,200,10,900,700);
c2->Divide(2,2);
c2->SetFillColor(10);
c2->SetGrid();
c2->GetFrame()->SetFillColor(10);
c2->GetFrame()->SetBorderSize(12);
c2->Range(0,0,1,1);
gStyle->SetOptStat(1);
c2->cd(1);
histPosVNegPxPrime->SetXTitle("PosPxPrime");
histPosVNegPxPrime->SetYTitle("NegPxPrime");
histPosVNegPxPrime->SetStats(1);
histPosVNegPxPrime->Draw();
c2->cd(2);
histPosVNegPyPrime->SetXTitle("PosPyPrime");
histPosVNegPyPrime->SetYTitle("NegPxPrime");
histPosVNegPyPrime->SetStats(1);
histPosVNegPyPrime->Draw();
c2->cd(3);
histPosVNegPzPrime->SetXTitle("PosPzPrime");
histPosVNegPzPrime->SetYTitle("NegPxPrime");
histPosVNegPzPrime->SetStats(1);
histPosVNegPzPrime->Draw();
c2->cd(4);
histPosVNegEPrime->SetXTitle("PosEPrime");
histPosVNegEPrime->SetYTitle("NegPxPrime");
histPosVNegEPrime->SetStats(1);
histPosVNegEPrime->Draw();
if(SaveAsRootFile){
TFile outfile2(rootOutputFileName2, "RECREATE");
c2->Write(rootOutputFileName2);
outfile2.Close();
}
TCanvas *c3 = new TCanvas("c3","PosVNeg Histrogram" ,200,10,900,700);
c3->Divide(2,2);
c3->SetFillColor(10);
c3->SetGrid();
c3->GetFrame()->SetFillColor(10);
c3->GetFrame()->SetBorderSize(12);
c3->Range(0,0,1,1);
gStyle->SetOptStat(1);
c3->cd(1);
histPosVNegPx->SetXTitle("PosPx");
histPosVNegPx->SetYTitle("NegPx");
histPosVNegPx->SetStats(1);
histPosVNegPx->Draw();
c3->cd(2);
histPosVNegPy->SetXTitle("PosPy");
histPosVNegPy->SetYTitle("NegPx");
histPosVNegPy->SetStats(1);
histPosVNegPy->Draw();
c3->cd(3);
histPosVNegPz->SetXTitle("PosPz");
histPosVNegPz->SetYTitle("NegPx");
histPosVNegPz->SetStats(1);
histPosVNegPz->Draw();
c3->cd(4);
histPosVNegE->SetXTitle("PosE");
histPosVNegE->SetYTitle("NegPx");
histPosVNegE->SetStats(1);
histPosVNegE->Draw();
if(SaveAsRootFile){
TFile outfile3(rootOutputFileName3, "RECREATE");
c3->Write(rootOutputFileName3);
outfile3.Close();
}
TCanvas *c4 = new TCanvas("c4","Iso and Jet_btag Histrograms" ,200,10,900,700);
c4->Divide(2,2);
c4->SetFillColor(10);
c4->SetGrid();
c4->GetFrame()->SetFillColor(10);
c4->GetFrame()->SetBorderSize(12);
c4->Range(0,0,1,1);
gStyle->SetOptStat(1);
c4->cd(1);
histMuonIso->SetXTitle("MuonIso");
histMuonIso->SetYTitle("Counts");
histMuonIso->SetStats(1);
histMuonIso->Draw();
c4->cd(2);
hist_WMuonVIso->SetXTitle("Muon_Iso");
hist_WMuonVIso->SetYTitle("NWMuon");
hist_WMuonVIso->SetStats(1);
hist_WMuonVIso->Draw();
c4->cd(3);
histWMuonIso->SetXTitle("WMuonIso");
histWMuonIso->SetYTitle("Counts");
histWMuonIso->SetStats(1);
histWMuonIso->Draw();
c4->cd(4);
hist_bJetVbtag->SetXTitle("Jet_btag");
hist_bJetVbtag->SetYTitle("NbJet");
hist_bJetVbtag->SetStats(1);
hist_bJetVbtag->Draw();
if(SaveAsRootFile){
TFile outfile4(rootOutputFileName4, "RECREATE");
c4->Write(rootOutputFileName4);
outfile4.Close();
}
TCanvas *c5 = new TCanvas("c5","MET (And WMuon mass) Histrogram" ,200,10,900,700);
c5->Divide(1,3);
c5->SetFillColor(10);
c5->SetGrid();
c5->GetFrame()->SetFillColor(10);
c5->GetFrame()->SetBorderSize(12);
c5->Range(0,0,1,1);
gStyle->SetOptStat(1);
c5->cd(1);
histMET->SetXTitle("MET");
histMET->SetYTitle("Counts");
histMET->SetStats(1);
histMET->Draw();
c5->cd(2);
histMETxy->SetXTitle("MET_px");
histMETxy->SetYTitle("MET_py");
histMETxy->SetStats(1);
histMETxy->Draw();
c5->cd(3);
histMET_Phi->SetXTitle("MET_Phi");
histMET_Phi->SetYTitle("counts");
histMET_Phi->SetStats(1);
histMET_Phi->Draw();
// c5_4->cd();
// histWMuonM->SetXTitle("WMuonMass");
// histWMuonM->SetYTitle("counts");
// histWMuonM->SetStats(1);
// histWMuonM->Draw();
if(SaveAsRootFile){
TFile outfile5(rootOutputFileName5, "RECREATE");
c5->Write(rootOutputFileName5);
outfile5.Close();
}
TCanvas *c6 = new TCanvas("c6","Transverse Mass Histrogram" ,200,10,900,700);
c6->Divide(2,2);
c6->SetFillColor(10);
c6->SetGrid();
c6->GetFrame()->SetFillColor(10);
c6->GetFrame()->SetBorderSize(12);
c6->Range(0,0,1,1);
gStyle->SetOptStat(1);
if(FitInvarientMassHist){
gStyle->SetOptFit(1);
}
c6->cd(1);
histM_WMuon2->SetXTitle("Mt Mass"); //Using WMuon2 here so all defs use Et
histM_WMuon2->SetYTitle("Counts");
histM_WMuon2->SetStats(1);
histM_WMuon2->SetMaximum(mT_MaxCount);
histM_WMuon2->Draw();
c6->cd(2);
histM_WMuonPos->SetXTitle("Mt Pos Mass");
histM_WMuonPos->SetYTitle("Counts");
histM_WMuonPos->SetStats(1);
histM_WMuonPos->SetMaximum(mT_MaxCount);
histM_WMuonPos->Draw();
c6->cd(3);
histM_WMuonNeg->SetXTitle("Mt Neg Mass");
histM_WMuonNeg->SetYTitle("Counts");
histM_WMuonNeg->SetStats(1);
histM_WMuonNeg->SetMaximum(mT_MaxCount);
histM_WMuonNeg->Draw();
c6->cd(4);
histM_WElectron->SetXTitle("Mt e- Mass");
histM_WElectron->SetYTitle("Counts");
histM_WElectron->SetStats(1);
histM_WElectron->SetMaximum(mT_MaxCount);
histM_WElectron->Draw();
if(SaveAsRootFile){
TFile outfile6(rootOutputFileName6, "RECREATE");
c6->Write(rootOutputFileName6);
outfile6.Close();
}
TCanvas *c7 = new TCanvas("c7","Transverse Mass Histrogram" ,200,10,900,700);
c7->Divide(1,3);
c7->SetFillColor(10);
c7->SetGrid();
c7->GetFrame()->SetFillColor(10);
c7->GetFrame()->SetBorderSize(12);
c7->Range(0,0,1,1);
gStyle->SetOptStat(1);
c7->cd(1);
histM_Top->SetXTitle("Invarient Mass");
histM_Top->SetYTitle("Counts");
histM_Top->SetStats(1);
//histM_Top->SetMaximum(mT_MaxCount);
histM_Top->Draw();
c7->cd(2);
histM_TopPos->SetXTitle("Invarient Mass");
histM_TopPos->SetYTitle("Counts");
histM_TopPos->SetStats(1);
//histM_TopPos->SetMaximum(mT_MaxCount);
histM_TopPos->Draw();
c7->cd(3);
histM_TopNeg->SetXTitle("Invarient Mass");
histM_TopNeg->SetYTitle("Counts");
histM_TopNeg->SetStats(1);
//histM_TopNeg->SetMaximum(mT_MaxCount);
histM_TopNeg->Draw();
// c7_4->cd();
// histM_WElectron->SetXTitle("Mt e- Mass");
// histM_WElectron->SetYTitle("Counts");
// histM_WElectron->SetStats(1);
// histM_WElectron->SetMaximum(mT_MaxCount);
// histM_WElectron->Draw();
if(SaveAsRootFile){
TFile outfile7(rootOutputFileName7, "RECREATE");
c7->Write(rootOutputFileName7);
outfile7.Close();
}
TCanvas *c8 = new TCanvas("c8","Invariant Mass of W Histrogram" ,200,10,900,700);
c8->Divide(1,3);
c8->SetFillColor(10);