-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRAA_randomcone.C
1382 lines (1235 loc) · 51.9 KB
/
RAA_randomcone.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
// Raghav Kunnawalkam Elayavalli
// Oct 6th 2014
// Rutgers
// For questions or comments: raghav.k.e at CERN dot CH
//
// Macro from Jorge to do the random cone study in the pf candidates
// one of the main comments is to look at the distribution in centrality and eta with pt on the z axis.
//
//
// May27, need to remove the leading and subleading jets to make the data and MC match in the most central regions
//
#include <TROOT.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <TVector3.h>
#include <stdio.h>
#include <string.h>
#include <TFile.h>
#include <TTree.h>
#include <TH1F.h>
#include <TMath.h>
#include <TRandom3.h>
//#include "hiForest.h"
#define pi 3.14159265
//#define nRan 100;
double Calc_deltaR(float eta1, float phi1, float eta2, float phi2)
{
float deta = eta1 - eta2;
float dphi = fabs(phi1 - phi2);
if(dphi > pi)dphi -= 2*pi;
double dr = sqrt(pow(deta,2) + pow(dphi,2));
return dr;
}
using namespace std;
void RAA_randomcone(int rad=4, const char* jet_type="PF", const char *algo="Pu",const char *type="data"){
TDatime date;
TFile *FileA;
if(type=="data")
FileA = TFile::Open("/mnt/hadoop/cms/store/user/belt/HiForest_MinBias_JetRAA_v1_final/HiForest_HIMinBiasUPC_14Mar2014_v2_JetRAA_lumi4_Part28.root");
else if(type=="MC")
FileA = TFile::Open("/mnt/hadoop/cms/store/user/dgulhan/HIMC/MB/Track8_Jet26_STARTHI53_LV1/merged2/HiForest_HYDJET_Track8_Jet26_STARTHI53_LV1_merged_forest_0.root");
TFile* outf = new TFile(Form("/export/d00/scratch/rkunnawa/rootfiles/test_randomcone_mideta_noleadSubleadjets_%s_ak%s%d%s_%d.root",type,algo,rad,jet_type,date.GetDate()),"recreate");
//TFile *FileA = TFile::Open(Form("/net/hisrv0001/home/icali/hadoop/HIMinBiasUPC_skimmed/MinBias-reTracking-merged/MinBias_Merged_tracking_all.root"));
//TString outname = "dataAKSkimNtupleRandomConeRings_v4_TkpTCut0_ak3dataMB.root";
//TFile* outf = new TFile(outname,"recreate");
cout<<"The radius is : "<<rad<<endl;
char *COLLTYPE = "PbPb";
cout<<" COLLTYPE : "<<COLLTYPE<<" "<<type<<endl;
//****** Analysis knobs *****************
Float_t JETRADIUS = (Float_t)rad/10;
//Float_t PTCUT1 = 120; //leading jet
//Float_t PTCUT2 = 50; //away jet
Float_t PTCUT3 = 20; //perp jets
Float_t ETACUT = 3.0; //eta acceptance
//Float_t PHICUT = 0.05; //dijets phi angle (in PI radians)
Float_t TRACKPTCUT = 0.0; //
Float_t TRACKETACUT = 2.0; //eta acceptance
Float_t PF_TRACKPTCUT = 0.0; //
Float_t PF_TRACKETACUT = 3.0; //eta acceptance
Float_t Tower_TRACKPTCUT = 0.0; //
Float_t Tower_TRACKETACUT = 2.0; //eta acceptance
//bool debug = true;
bool removeLeadandSubLeadjets = true;
double LOW_dR[] = { 0, 0.05, 0.10, 0.15, 0.20, 0.25};
double HI_dR[] = {0.05, 0.10, 0.15, 0.20, 0.25, 0.30};
const int nRings = 6; // rings for JetShapes
//const Int_t nRan = 100; // number of random cones
int nRandom = 100;
// int nRan= 100; - not used here
int Nevents = 10000;
int nMarks = 1000;
//****************************************
// test histogram for ranPFsumEt
//TH1F *test_ranpfsumet = new TH1F("test_ranpfsumet","",200,0,100);
TTree* ak;
ak = (TTree*)FileA->Get(Form("ak%s%d%sJetAnalyzer/t",algo,3,jet_type));
// - TTree* ic = (TTree*)FileA->Get("icPu5JetAnalyzer/t"); // - not there in the new forest
TTree* hlt = (TTree*)FileA->Get("hltanalysis/HltTree");
TTree* skim = (TTree*)FileA->Get("skimanalysis/HltTree");
TTree* hiEv = (TTree*)FileA->Get("hiEvtAnalyzer/HiTree");
//TTree* rhEB = (TTree*)FileA->Get("rechitanalyzer/eb");
//TTree* rhEE = (TTree*)FileA->Get("rechitanalyzer/ee");
//TTree* rhHBHE = (TTree*)FileA->Get("rechitanalyzer/hbhe");
TTree* rhtower = (TTree*)FileA->Get("rechitanalyzer/tower");
//TTree* hcal = (TTree*)FileA->Get("hcalNoise/hcalNoise"); //- not there in the new forests
//if(COLLTYPE=="pA") TTree* ttrack = (TTree*)FileA->Get("ppTrack/trackTree");
//if(COLLTYPE=="PbPb") TTree* ttrack = (TTree*)FileA->Get("mergedTrack/trackTree"); // - also not needed here
TTree* pflow = (TTree*)FileA->Get("pfcandAnalyzer/pfTree");
// variables for the input file:
Float_t vz;
Int_t nAKJets;
Float_t jteta[1000];
Float_t jtphi[1000];
Float_t jtpt[1000];
Float_t jtpu[1000];
Float_t rawpt[1000];
/*
Int_t nTrk;
Float_t trkEta[10000];
Float_t trkPhi[10000];
Float_t trkPt[10000];
Int_t HBHEn;
Float_t HBHEeta[10000];
Float_t HBHEphi[10000];
Float_t HBHEet[10000];
Int_t EEn;
Float_t EEeta[10000000];
Float_t EEphi[10000000];
Float_t EEet[10000000];
Int_t EBn;
Float_t EBeta[10000000];
Float_t EBphi[10000000];
Float_t EBet[10000000];
*/
Int_t PF_n;
Float_t PF_eta[10000000];
Float_t PF_phi[10000000];
Float_t PF_pt[10000000];
Float_t PF_vspt[10000000];
Float_t PF_sumpt[10000000];
Int_t PF_id[10000000];
Int_t Tower_n;
Float_t Tower_eta[10000000];
Float_t Tower_phi[10000000];
Float_t Tower_pt[10000000];
Float_t Tower_emEt[10000000];
Float_t Tower_hadEt[10000000];
Float_t Tower_sumpt[10000000];
Float_t Tower_vspt[10000000];
Int_t eventN;
Int_t runN;
Int_t lumiS;
Int_t cBin;
Int_t pCES;
//Int_t phfPosFilter1;
//Int_t phfNegFilter1;
//Int_t phltPixelClusterShapeFilter;
Int_t pprimaryvertexFilter;
Int_t pHBHENoiseFilter;
//Int_t HCALmaxhpdhits;
//Int_t HCALmaxrbxhits;
//Int_t HCALntrianglenoise;
//Int_t HCALnspikenoise;
//Bool_t HCALhasBadRBXTS4TS5;
//Take the variables from the incoming TTrees
skim->SetBranchAddress("pcollisionEventSelection",&pCES);
skim->SetBranchAddress("pHBHENoiseFilter",&pHBHENoiseFilter);
//if(COLLTYPE=="pA")skim->SetBranchAddress("pprimaryvertexFilter",&pprimaryvertexFilter);
//if(COLLTYPE=="pA")skim->SetBranchAddress("phltPixelClusterShapeFilter",&phltPixelClusterShapeFilter);
//if(COLLTYPE=="pA")skim->SetBranchAddress("phfNegFilter1",&phfNegFilter1);
//if(COLLTYPE=="pA")skim->SetBranchAddress("phfPosFilter1",&phfPosFilter1);
hlt->SetBranchAddress("Run",&runN);
hlt->SetBranchAddress("Event",&eventN);
hlt->SetBranchAddress("LumiBlock",&lumiS);
hiEv->SetBranchAddress("hiBin",&cBin);
hiEv->SetBranchAddress("vz",&vz);
/*
ak->SetBranchAddress("jteta",&jteta);
ak->SetBranchAddress("jtpt",&jtpt);
ak->SetBranchAddress("jtphi",&jtphi);
ak->SetBranchAddress("jtpu",&jtpu);
ak->SetBranchAddress("rawpt",&rawpt);
ak->SetBranchAddress("nref",&nAKJets);
*/
// ttrack->SetBranchAddress("trkEta",&trkEta);
// ttrack->SetBranchAddress("trkPt",&trkPt);
// ttrack->SetBranchAddress("trkPhi",&trkPhi);
// ttrack->SetBranchAddress("nTrk",&nTrk);
// rhHBHE->SetBranchAddress("eta",&HBHEeta);
// rhHBHE->SetBranchAddress("phi",&HBHEphi);
// rhHBHE->SetBranchAddress("et",&HBHEet);
// rhHBHE->SetBranchAddress("n",&HBHEn);
// rhEB->SetBranchAddress("eta",&EBeta);
// rhEB->SetBranchAddress("phi",&EBphi);
// rhEB->SetBranchAddress("et",&EBet);
// rhEB->SetBranchAddress("n",&EBn);
// rhEE->SetBranchAddress("eta",&EEeta);
// rhEE->SetBranchAddress("phi",&EEphi);
// rhEE->SetBranchAddress("et",&EEet);
// rhEE->SetBranchAddress("n",&EEn);
// hcal->SetBranchAddress("nspikenoise",&HCALnspikenoise);
// hcal->SetBranchAddress("hasBadRBXTS4TS5",&HCALhasBadRBXTS4TS5);
// hcal->SetBranchAddress("maxhpdhits",&HCALmaxhpdhits);
// hcal->SetBranchAddress("maxrbxhits",&HCALmaxrbxhits);
// hcal->SetBranchAddress("ntrianglenoise",&HCALntrianglenoise);
pflow->SetBranchAddress("nPFpart",&PF_n);
pflow->SetBranchAddress("pfEta",&PF_eta);
pflow->SetBranchAddress("pfPhi",&PF_phi);
pflow->SetBranchAddress("pfPt",&PF_pt);
pflow->SetBranchAddress("pfVsPt",&PF_vspt);
pflow->SetBranchAddress("sumpt",&PF_sumpt);
pflow->SetBranchAddress("pfId",&PF_id);
rhtower->SetBranchAddress("n",&Tower_n);
rhtower->SetBranchAddress("eta",&Tower_eta);
rhtower->SetBranchAddress("phi",&Tower_phi);
rhtower->SetBranchAddress("et",&Tower_pt);
rhtower->SetBranchAddress("emEt",&Tower_emEt);
rhtower->SetBranchAddress("hadEt",&Tower_hadEt);
rhtower->SetBranchAddress("sumpt",&Tower_sumpt);
rhtower->SetBranchAddress("vsPt",&Tower_vspt);
Int_t nJets;
Float_t jeta[1000];
Float_t jphi[1000];
Float_t jpt[1000];
Float_t jpu[1000];
Float_t jrawpt[1000];
Int_t nTracks;
// Float_t treta[1000];
// Float_t trphi[1000];
// Float_t trpt[1000];
// Int_t nTrInJet[1000];
// Float_t trkSumPtInJet[1000];
// Float_t dr_TrJet[10000][1000];
// Int_t nHBHErhits[1000];
// Float_t HBHEsumEt[1000];
// Int_t nEErhits[1000];
// Float_t EEsumEt[1000];
// Int_t nEBrhits[1000];
// Float_t EBsumEt[1000];
Int_t nTower_objs[1000];
Float_t Tower_sumEt[1000];
Int_t nTower_objs_ring0[1000];
Int_t nTower_objs_ring1[1000];
Int_t nTower_objs_ring2[1000];
Int_t nTower_objs_ring3[1000];
Int_t nTower_objs_ring4[1000];
Int_t nTower_objs_ring5[1000];
Float_t Tower_sumEt_ring0[1000];
Float_t Tower_sumEt_ring1[1000];
Float_t Tower_sumEt_ring2[1000];
Float_t Tower_sumEt_ring3[1000];
Float_t Tower_sumEt_ring4[1000];
Float_t Tower_sumEt_ring5[1000];
// we dont have charge identification in the towers
Int_t nPFobjs[1000];
Float_t PFsumEt[1000];
Int_t nPFobjs_ring0[1000];
Int_t nPFobjs_ring1[1000];
Int_t nPFobjs_ring2[1000];
Int_t nPFobjs_ring3[1000];
Int_t nPFobjs_ring4[1000];
Int_t nPFobjs_ring5[1000];
Float_t PFsumEt_ring0[1000];
Float_t PFsumEt_ring1[1000];
Float_t PFsumEt_ring2[1000];
Float_t PFsumEt_ring3[1000];
Float_t PFsumEt_ring4[1000];
Float_t PFsumEt_ring5[1000];
Int_t nPFchObjs_ring0[1000];
Int_t nPFchObjs_ring1[1000];
Int_t nPFchObjs_ring2[1000];
Int_t nPFchObjs_ring3[1000];
Int_t nPFchObjs_ring4[1000];
Int_t nPFchObjs_ring5[1000];
Float_t PFchSumEt_ring0[1000];
Float_t PFchSumEt_ring1[1000];
Float_t PFchSumEt_ring2[1000];
Float_t PFchSumEt_ring3[1000];
Float_t PFchSumEt_ring4[1000];
Float_t PFchSumEt_ring5[1000];
// not using tracks in the analysis
// Int_t nTks_ring0[10000];
// Int_t nTks_ring1[10000];
// Int_t nTks_ring2[10000];
// Int_t nTks_ring3[10000];
// Int_t nTks_ring4[10000];
// Int_t nTks_ring5[10000];
// Float_t TkSumEt_ring0[10000];
// Float_t TkSumEt_ring1[10000];
// Float_t TkSumEt_ring2[10000];
// Float_t TkSumEt_ring3[10000];
// Float_t TkSumEt_ring4[10000];
// Float_t TkSumEt_ring5[10000];
// Int_t nRanTks_ring0[1000];
// Int_t nRanTks_ring1[1000];
// Int_t nRanTks_ring2[1000];
// Int_t nRanTks_ring3[1000];
// Int_t nRanTks_ring4[1000];
// Int_t nRanTks_ring5[1000];
// Float_t ranTkSumEt_ring0[1000];
// Float_t ranTkSumEt_ring1[1000];
// Float_t ranTkSumEt_ring2[1000];
// Float_t ranTkSumEt_ring3[1000];
// Float_t ranTkSumEt_ring4[1000];
// Float_t ranTkSumEt_ring5[1000];
Int_t run ;
Int_t event ;
Int_t lumi ;
Float_t bin;
Int_t CES;
// Float_t dPhi_TT, dPhi_JT, dPhi_JJ;
// Float_t dEta_TT, dEta_JT, dEta_JJ;
// Int_t maxHPDhits;
// Int_t maxRBXhits;
// Int_t ntrianglenoise;
// Int_t nspikenoise;
// Bool_t hasBadRBXTS4TS5;
// //const Int_t InTracks_set = 3;
// Float_t inTreta;
// Float_t inTrphi;
// Float_t inTrpt;
// Float_t outTreta;
// Float_t outTrphi;
// Float_t outTrpt;
// Float_t dRinCone[1000][1000];
Float_t ranConeEta[1000];
Float_t ranConePhi[1000];
// Float_t ranTrkSumPt[1000];
// Int_t ranNtracks[1000];
// Float_t ranHBHEsumEt[1000];
// Int_t ranNHBHErhits[1000];
// Float_t ranEBsumEt[1000];
// Int_t ranNEBrhits[1000];
// Float_t ranEEsumEt[1000];
// Int_t ranNEErhits[1000];
Float_t ranTower_sumEt[1000];
Int_t ranNTower_objs[1000];
Int_t ranNTower_objsRing[1000];
Float_t ranTower_ringSumEt[1000];
Int_t ranNTower_objs_ring0[1000];
Float_t ranTower_sumEt_ring0[1000];
Int_t ranNTower_objs_ring1[1000];
Float_t ranTower_sumEt_ring1[1000];
Int_t ranNTower_objs_ring2[1000];
Float_t ranTower_sumEt_ring2[1000];
Int_t ranNTower_objs_ring3[1000];
Float_t ranTower_sumEt_ring3[1000];
Int_t ranNTower_objs_ring4[1000];
Float_t ranTower_sumEt_ring4[1000];
Int_t ranNTower_objs_ring5[1000];
Float_t ranTower_sumEt_ring5[1000];
Float_t ranPFsumEt[1000];
Int_t ranNPFobjs[1000];
Int_t ranNPFobjsRing[1000];
Float_t ranPFringSumEt[1000];
Int_t ranNPFobjs_ring0[1000];
Float_t ranPFsumEt_ring0[1000];
Int_t ranNPFobjs_ring1[1000];
Float_t ranPFsumEt_ring1[1000];
Int_t ranNPFobjs_ring2[1000];
Float_t ranPFsumEt_ring2[1000];
Int_t ranNPFobjs_ring3[1000];
Float_t ranPFsumEt_ring3[1000];
Int_t ranNPFobjs_ring4[1000];
Float_t ranPFsumEt_ring4[1000];
Int_t ranNPFobjs_ring5[1000];
Float_t ranPFsumEt_ring5[1000];
Int_t ranNPFchObjs_ring0[1000];
Float_t ranPFchSumEt_ring0[1000];
Int_t ranNPFchObjs_ring1[1000];
Float_t ranPFchSumEt_ring1[1000];
Int_t ranNPFchObjs_ring2[1000];
Float_t ranPFchSumEt_ring2[1000];
Int_t ranNPFchObjs_ring3[1000];
Float_t ranPFchSumEt_ring3[1000];
Int_t ranNPFchObjs_ring4[1000];
Float_t ranPFchSumEt_ring4[1000];
Int_t ranNPFchObjs_ring5[1000];
Float_t ranPFchSumEt_ring5[1000];
//Define the branches of the output TTree
TTree* nt = new TTree("nt","nt");
nt->Branch("run",&run,"run/I");
nt->Branch("lumi",&lumi,"lumi/I");
nt->Branch("event",&event,"event/I");
nt->Branch("bin", &bin, "bin/F");
nt->Branch("CES",&CES,"CES/I");
//nt->Branch("maxHPDhits",&maxHPDhits,"maxHPDhits/I");
//nt->Branch("maxRBXhits",&maxRBXhits,"maxRBXhits/I");
//nt->Branch("ntrianglenoise",&ntrianglenoise,"ntrianglenoise/I");
//nt->Branch("nspikenoise",&nspikenoise,"nspikenoise/I");
//nt->Branch("hasBadRBXTS4TS5",&hasBadRBXTS4TS5,"hasBadRBXTS4TS5/O");
nt->Branch("nJets",&nJets,"nJets/I");
nt->Branch("jeta",jeta,"jeta[nJets]/F");
nt->Branch("jphi",jphi,"jphi[nJets]/F");
nt->Branch("jpt",jpt,"jpt[nJets]/F");
nt->Branch("jpu",jpu,"jpu[nJets]/F");
nt->Branch("jrawpt",jrawpt,"jrawpt[nJets]/F");
nt->Branch("nRandom",&nRandom,"nRandom/I");
//nt->Branch("nTracks",&nTracks,"nTracks/I");
//nt->Branch("treta",treta,"treta[nTracks]/F");
//nt->Branch("trphi",trphi,"trphi[nTracks]/F");
//nt->Branch("trpt",trpt,"trpt[nTracks]/F");
//nt->Branch("nTrInJet",nTrInJet,"nTrInJet[nJets]/I");
//nt->Branch("trkSumPtInJet",trkSumPtInJet,"trkSumPtInJet[nJets]/F");
//nt->Branch("dr_TrJet",dr_TrJet,"dr_TrJet[nJets][nTracks]/F");
//nt->Branch("nHBHErhits",nHBHErhits,"nHBHErhits[nJets]/I");
//nt->Branch("HBHEsumEt",HBHEsumEt,"HBHEsumEt[nJets]/F");
//nt->Branch("nEBrhits",nEBrhits,"nEBrhits[nJets]/I");
//nt->Branch("EBsumEt",EBsumEt,"EBsumEt[nJets]/F");
//nt->Branch("nEErhits",nEErhits,"nEErhits[nJets]/I");
//nt->Branch("EEsumEt",EEsumEt,"EEsumEt[nJets]/F");
if(jet_type=="Calo"){
nt->Branch("nTower_objs",nTower_objs,"nTower_objs[nJets]/I");
nt->Branch("Tower_sumEt",Tower_sumEt,"Tower_sumEt[nJets]/F");
nt->Branch("nTower_objs_ring0",nTower_objs_ring0,"nTower_objs_ring0[nJets]/I");
nt->Branch("Tower_sumEt_ring0",Tower_sumEt_ring0,"Tower_sumEt_ring0[nJets]/F");
nt->Branch("nTower_objs_ring1",nTower_objs_ring1,"nTower_objs_ring1[nJets]/I");
nt->Branch("Tower_sumEt_ring1",Tower_sumEt_ring1,"Tower_sumEt_ring1[nJets]/F");
nt->Branch("nTower_objs_ring2",nTower_objs_ring2,"nTower_objs_ring2[nJets]/I");
nt->Branch("Tower_sumEt_ring2",Tower_sumEt_ring2,"Tower_sumEt_ring2[nJets]/F");
nt->Branch("nTower_objs_ring3",nTower_objs_ring3,"nTower_objs_ring3[nJets]/I");
nt->Branch("Tower_sumEt_ring3",Tower_sumEt_ring3,"Tower_sumEt_ring3[nJets]/F");
nt->Branch("nTower_objs_ring4",nTower_objs_ring4,"nTower_objs_ring4[nJets]/I");
nt->Branch("Tower_sumEt_ring4",Tower_sumEt_ring4,"Tower_sumEt_ring4[nJets]/F");
nt->Branch("nTower_objs_ring5",nTower_objs_ring5,"nTower_objs_ring5[nJets]/I");
nt->Branch("Tower_sumEt_ring5",Tower_sumEt_ring5,"Tower_sumEt_ring5[nJets]/F");
}else if(jet_type=="PF"){
nt->Branch("nPFobjs",nPFobjs,"nPFobjs[nJets]/I");
nt->Branch("PFsumEt",PFsumEt,"PFsumEt[nJets]/F");
nt->Branch("nPFobjs_ring0",nPFobjs_ring0,"nPFobjs_ring0[nJets]/I");
nt->Branch("PFsumEt_ring0",PFsumEt_ring0,"PFsumEt_ring0[nJets]/F");
nt->Branch("nPFobjs_ring1",nPFobjs_ring1,"nPFobjs_ring1[nJets]/I");
nt->Branch("PFsumEt_ring1",PFsumEt_ring1,"PFsumEt_ring1[nJets]/F");
nt->Branch("nPFobjs_ring2",nPFobjs_ring2,"nPFobjs_ring2[nJets]/I");
nt->Branch("PFsumEt_ring2",PFsumEt_ring2,"PFsumEt_ring2[nJets]/F");
nt->Branch("nPFobjs_ring3",nPFobjs_ring3,"nPFobjs_ring3[nJets]/I");
nt->Branch("PFsumEt_ring3",PFsumEt_ring3,"PFsumEt_ring3[nJets]/F");
nt->Branch("nPFobjs_ring4",nPFobjs_ring4,"nPFobjs_ring4[nJets]/I");
nt->Branch("PFsumEt_ring4",PFsumEt_ring4,"PFsumEt_ring4[nJets]/F");
nt->Branch("nPFobjs_ring5",nPFobjs_ring5,"nPFobjs_ring5[nJets]/I");
nt->Branch("PFsumEt_ring5",PFsumEt_ring5,"PFsumEt_ring5[nJets]/F");
nt->Branch("nPFchObjs_ring0",nPFchObjs_ring0,"nPFchObjs_ring0[nJets]/I");
nt->Branch("PFchSumEt_ring0",PFchSumEt_ring0,"PFchSumEt_ring0[nJets]/F");
nt->Branch("nPFchObjs_ring1",nPFchObjs_ring1,"nPFchObjs_ring1[nJets]/I");
nt->Branch("PFchSumEt_ring1",PFchSumEt_ring1,"PFchSumEt_ring1[nJets]/F");
nt->Branch("nPFchObjs_ring2",nPFchObjs_ring2,"nPFchObjs_ring2[nJets]/I");
nt->Branch("PFchSumEt_ring2",PFchSumEt_ring2,"PFchSumEt_ring2[nJets]/F");
nt->Branch("nPFchObjs_ring3",nPFchObjs_ring3,"nPFchObjs_ring3[nJets]/I");
nt->Branch("PFchSumEt_ring3",PFchSumEt_ring3,"PFchSumEt_ring3[nJets]/F");
nt->Branch("nPFchObjs_ring4",nPFchObjs_ring4,"nPFchObjs_ring4[nJets]/I");
nt->Branch("PFchSumEt_ring4",PFchSumEt_ring4,"PFchSumEt_ring4[nJets]/F");
nt->Branch("nPFchObjs_ring5",nPFchObjs_ring5,"nPFchObjs_ring5[nJets]/I");
nt->Branch("PFchSumEt_ring5",PFchSumEt_ring5,"PFchSumEt_ring5[nJets]/F");
}
/*
nt->Branch("nTks_ring0",nTks_ring0,"nTks_ring0[nJets]/I");
nt->Branch("TkSumEt_ring0",TkSumEt_ring0,"TkSumEt_ring0[nJets]/F");
nt->Branch("nTks_ring1",nTks_ring1,"nTks_ring1[nJets]/I");
nt->Branch("TkSumEt_ring1",TkSumEt_ring1,"TkSumEt_ring1[nJets]/F");
nt->Branch("nTks_ring2",nTks_ring2,"nTks_ring2[nJets]/I");
nt->Branch("TkSumEt_ring2",TkSumEt_ring2,"TkSumEt_ring2[nJets]/F");
nt->Branch("nTks_ring3",nTks_ring3,"nTks_ring3[nJets]/I");
nt->Branch("TkSumEt_ring3",TkSumEt_ring3,"TkSumEt_ring3[nJets]/F");
nt->Branch("nTks_ring4",nTks_ring4,"nTks_ring4[nJets]/I");
nt->Branch("TkSumEt_ring4",TkSumEt_ring4,"TkSumEt_ring4[nJets]/F");
nt->Branch("nTks_ring5",nTks_ring5,"nTks_ring5[nJets]/I");
nt->Branch("TkSumEt_ring5",TkSumEt_ring5,"TkSumEt_ring5[nJets]/F");
nt->Branch("nRanTks_ring0",nRanTks_ring0,"nRanTks_ring0[200]/I");
nt->Branch("ranTkSumEt_ring0",ranTkSumEt_ring0,"ranTkSumEt_ring0[200]/F");
nt->Branch("nRanTks_ring1",nRanTks_ring1,"nRanTks_ring1[200]/I");
nt->Branch("ranTkSumEt_ring1",ranTkSumEt_ring1,"ranTkSumEt_ring1[200]/F");
nt->Branch("nRanTks_ring2",nRanTks_ring2,"nRanTks_ring2[200]/I");
nt->Branch("ranTkSumEt_ring2",ranTkSumEt_ring2,"ranTkSumEt_ring2[200]/F");
nt->Branch("nRanTks_ring3",nRanTks_ring3,"nRanTks_ring3[200]/I");
nt->Branch("ranTkSumEt_ring3",ranTkSumEt_ring3,"ranTkSumEt_ring3[200]/F");
nt->Branch("nRanTks_ring4",nRanTks_ring4,"nRanTks_ring4[200]/I");
nt->Branch("ranTkSumEt_ring4",ranTkSumEt_ring4,"ranTkSumEt_ring4[200]/F");
nt->Branch("nRanTks_ring5",nRanTks_ring5,"nRanTks_ring5[200]/I");
nt->Branch("ranTkSumEt_ring5",ranTkSumEt_ring5,"ranTkSumEt_ring5[200]/F");
// nt->Branch("dPhi_JJ",&dPhi_JJ,"dPhi_JJ/F");
// nt->Branch("dPhi_JT",&dPhi_JT,"dPhi_JT/F");
// nt->Branch("dPhi_TT",&dPhi_TT,"dPhi_TT/F");
// nt->Branch("dEta_JJ",&dEta_JJ,"dEta_JJ/F");
// nt->Branch("dEta_JT",&dEta_JT,"dEta_JT/F");
// nt->Branch("dEta_TT",&dEta_TT,"dEta_TT/F");
nt->Branch("inTreta",&inTreta,"inTreta/F");
nt->Branch("inTrphi",&inTrphi,"inTrphi/F");
nt->Branch("inTrpt",&inTrpt,"inTrpt/F");
nt->Branch("outTreta",&outTreta,"outTreta/F");
nt->Branch("outTrphi",&outTrphi,"outTrphi/F");
nt->Branch("outTrpt",&outTrpt,"outTrpt/F");
nt->Branch("dRinCone",dRinCone,"dRinCone[nJets][1000]");
*/
nt->Branch("ranConeEta",ranConeEta,"ranConeEta[200]/F");
nt->Branch("ranConePhi",ranConePhi,"ranConePhi[200]/F");
//nt->Branch("ranTrkSumPt",ranTrkSumPt,"ranTrkSumPt[200]/F");
//nt->Branch("ranNtracks",ranNtracks,"ranNtracks[200]/I");
/*
nt->Branch("ranHBHEsumEt",ranHBHEsumEt,"ranHBHEsumEt[200]/F");
nt->Branch("ranNHBHErhits",ranNHBHErhits,"ranNHBHErhits[200]/I");
nt->Branch("ranEBsumEt",ranEBsumEt,"ranEBsumEt[200]/F");
nt->Branch("ranNEBrhits",ranNEBrhits,"ranNEBrhits[200]/I");
nt->Branch("ranEEsumEt",ranEEsumEt,"ranEEsumEt[200]/F");
nt->Branch("ranNEErhits",ranNEErhits,"ranNEErhits[200]/I");
*/
if(jet_type=="Calo"){
nt->Branch("ranTower_sumEt",ranTower_sumEt,"ranTower_sumEt[nRandom]/F");
nt->Branch("ranNTower_objs",ranNTower_objs,"ranNTower_objs[nRandom]/I");
nt->Branch("ranNTower_objs_ring0",ranNTower_objs_ring0,"ranNTower_objs_ring0[nRandom]/I");
nt->Branch("ranTower_sumEt_ring0",ranTower_sumEt_ring0,"ranTower_sumEt_ring0[nRandom]/F");
nt->Branch("ranNTower_objs_ring1",ranNTower_objs_ring1,"ranNTower_objs_ring1[nRandom]/I");
nt->Branch("ranTower_sumEt_ring1",ranTower_sumEt_ring1,"ranTower_sumEt_ring1[nRandom]/F");
nt->Branch("ranNTower_objs_ring2",ranNTower_objs_ring2,"ranNTower_objs_ring2[nRandom]/I");
nt->Branch("ranTower_sumEt_ring2",ranTower_sumEt_ring2,"ranTower_sumEt_ring2[nRandom]/F");
nt->Branch("ranNTower_objs_ring3",ranNTower_objs_ring3,"ranNTower_objs_ring3[nRandom]/I");
nt->Branch("ranTower_sumEt_ring3",ranTower_sumEt_ring3,"ranTower_sumEt_ring3[nRandom]/F");
nt->Branch("ranNTower_objs_ring4",ranNTower_objs_ring4,"ranNTower_objs_ring4[nRandom]/I");
nt->Branch("ranTower_sumEt_ring4",ranTower_sumEt_ring4,"ranTower_sumEt_ring4[nRandom]/F");
nt->Branch("ranNTower_objs_ring5",ranNTower_objs_ring5,"ranNTower_objs_ring5[nRandom]/I");
nt->Branch("ranTower_sumEt_ring5",ranTower_sumEt_ring5,"ranTower_sumEt_ring5[nRandom]/F");
}else if(jet_type=="PF"){
nt->Branch("ranPFsumEt",ranPFsumEt,"ranPFsumEt[nRandom]/F");
nt->Branch("ranNPFobjs",ranNPFobjs,"ranNPFobjs[nRandom]/I");
nt->Branch("ranNPFobjs_ring0",ranNPFobjs_ring0,"ranNPFobjs_ring0[nRandom]/I");
nt->Branch("ranPFsumEt_ring0",ranPFsumEt_ring0,"ranPFsumEt_ring0[nRandom]/F");
nt->Branch("ranNPFobjs_ring1",ranNPFobjs_ring1,"ranNPFobjs_ring1[nRandom]/I");
nt->Branch("ranPFsumEt_ring1",ranPFsumEt_ring1,"ranPFsumEt_ring1[nRandom]/F");
nt->Branch("ranNPFobjs_ring2",ranNPFobjs_ring2,"ranNPFobjs_ring2[nRandom]/I");
nt->Branch("ranPFsumEt_ring2",ranPFsumEt_ring2,"ranPFsumEt_ring2[nRandom]/F");
nt->Branch("ranNPFobjs_ring3",ranNPFobjs_ring3,"ranNPFobjs_ring3[nRandom]/I");
nt->Branch("ranPFsumEt_ring3",ranPFsumEt_ring3,"ranPFsumEt_ring3[nRandom]/F");
nt->Branch("ranNPFobjs_ring4",ranNPFobjs_ring4,"ranNPFobjs_ring4[nRandom]/I");
nt->Branch("ranPFsumEt_ring4",ranPFsumEt_ring4,"ranPFsumEt_ring4[nRandom]/F");
nt->Branch("ranNPFobjs_ring5",ranNPFobjs_ring5,"ranNPFobjs_ring5[nRandom]/I");
nt->Branch("ranPFsumEt_ring5",ranPFsumEt_ring5,"ranPFsumEt_ring5[nRandom]/F");
nt->Branch("ranNPFchObjs_ring0",ranNPFchObjs_ring0,"ranNPFchObjs_ring0[nRandom]/I");
nt->Branch("ranPFchSumEt_ring0",ranPFchSumEt_ring0,"ranPFchSumEt_ring0[nRandom]/F");
nt->Branch("ranNPFchObjs_ring1",ranNPFchObjs_ring1,"ranNPFchObjs_ring1[nRandom]/I");
nt->Branch("ranPFchSumEt_ring1",ranPFchSumEt_ring1,"ranPFchSumEt_ring1[nRandom]/F");
nt->Branch("ranNPFchObjs_ring2",ranNPFchObjs_ring2,"ranNPFchObjs_ring2[nRandom]/I");
nt->Branch("ranPFchSumEt_ring2",ranPFchSumEt_ring2,"ranPFchSumEt_ring2[nRandom]/F");
nt->Branch("ranNPFchObjs_ring3",ranNPFchObjs_ring3,"ranNPFchObjs_ring3[nRandom]/I");
nt->Branch("ranPFchSumEt_ring3",ranPFchSumEt_ring3,"ranPFchSumEt_ring3[nRandom]/F");
nt->Branch("ranNPFchObjs_ring4",ranNPFchObjs_ring4,"ranNPFchObjs_ring4[nRandom]/I");
nt->Branch("ranPFchSumEt_ring4",ranPFchSumEt_ring4,"ranPFchSumEt_ring4[nRandom]/F");
nt->Branch("ranNPFchObjs_ring5",ranNPFchObjs_ring5,"ranNPFchObjs_ring5[nRandom]/I");
nt->Branch("ranPFchSumEt_ring5",ranPFchSumEt_ring5,"ranPFchSumEt_ring5[nRandom]/F");
}
// Int_t ranNPFchObjs_ring0[1000];
// Float_t ranPFchSumEt_ring0[1000];
TRandom3 myDice(314);
cout<<"Right before the loop"<<endl;
//int Nevents = ak->GetEntries();
for(int iev = 0; iev < Nevents; ++iev)
{
if (iev%nMarks==0)
{
cout<<"event: "<<iev<<" / "<<Nevents<<endl;
}
//----------------------------------------------------------------------
//Initialize some stuff and get the actual event
//----------------------------------------------------------------------
nJets = 0;
hlt->GetEntry(iev);
ak->GetEntry(iev);
// ic->GetEntry(iev);
skim->GetEntry(iev);
hiEv->GetEntry(iev);
// rhHBHE->GetEntry(iev);
// rhEE->GetEntry(iev);
// rhEB->GetEntry(iev);
// hcal->GetEntry(iev);
// ttrack->GetEntry(iev);
rhtower->GetEntry(iev);
pflow->GetEntry(iev);
//----------------------------------------------------------------------
// Event variables, and HCAL noise cleaning
//----------------------------------------------------------------------
CES = pCES;
//if (CES==0 || pHBHENoiseFilter==0 || fabs(vz)>15) continue; // since this is only for PbPb
if (CES==0 || fabs(vz)>15) continue; // since this is only for PbPb
//if ( (COLLTYPE=="PbPb") && (CES==0) ) continue;
//if ( (COLLTYPE=="pA") && (pHBHENoiseFilter==0 || phltPixelClusterShapeFilter==0 || pprimaryvertexFilter == 0|| pHBHENoiseFilter==0 || phfPosFilter1==0 || phfNegFilter1==0)) continue;
/*
if (COLLTYPE=="pA"){
if (fabs(vz) > 15)continue;
if (TYPE=="DATA"){
if (runN!=202792) continue;
if (lumiS<317 || lumiS>1014) continue;
}
}
*/
run = runN;
event = eventN;
lumi = lumiS;
bin = cBin;
//cout<<"run = "<<run<<endl;
//cout<<"event = "<<event<<endl;
// maxHPDhits = HCALmaxhpdhits;
// maxRBXhits = HCALmaxrbxhits;
// ntrianglenoise = HCALntrianglenoise;
// nspikenoise = HCALnspikenoise;
// hasBadRBXTS4TS5 = HCALhasBadRBXTS4TS5;
nJets = nAKJets;
// nTracks = nTrk;
//nJets = 1; //for dijet studies
for (int t=0; t<=nJets; t++){//Initialize and clear arrays
jpt[t] = -99;
jeta[t] = -99;
jphi[t] = -99;
jpu[t] = -99;
jrawpt[t] = -99;
//nTrInJet[t] = 0;
//trkSumPtInJet[t] = -99;
// HBHEsumEt[t] = -99;
// nHBHErhits[t] = 0;
// EBsumEt[t] = -99;
// nEBrhits[t] = 0;
// EEsumEt[t] = -99;
// nEErhits[t] = 0;
nTower_objs[t] = 0;
Tower_sumEt[t] =-99;
Tower_sumEt_ring0[t] = -99;
nTower_objs_ring0[t] = 0;
Tower_sumEt_ring1[t] = -99;
nTower_objs_ring1[t] = 0;
Tower_sumEt_ring2[t] = -99;
nTower_objs_ring2[t] = 0;
Tower_sumEt_ring3[t] = -99;
nTower_objs_ring3[t] = 0;
Tower_sumEt_ring4[t] = -99;
nTower_objs_ring4[t] = 0;
Tower_sumEt_ring5[t] = -99;
nTower_objs_ring5[t] = 0;
nPFobjs[t] = 0;
PFsumEt[t] =-99;
PFsumEt_ring0[t] = -99;
nPFobjs_ring0[t] = 0;
PFsumEt_ring1[t] = -99;
nPFobjs_ring1[t] = 0;
PFsumEt_ring2[t] = -99;
nPFobjs_ring2[t] = 0;
PFsumEt_ring3[t] = -99;
nPFobjs_ring3[t] = 0;
PFsumEt_ring4[t] = -99;
nPFobjs_ring4[t] = 0;
PFsumEt_ring5[t] = -99;
nPFobjs_ring5[t] = 0;
PFchSumEt_ring0[t] = -99;
nPFchObjs_ring0[t] = 0;
PFchSumEt_ring1[t] = -99;
nPFchObjs_ring1[t] = 0;
PFchSumEt_ring2[t] = -99;
nPFchObjs_ring2[t] = 0;
PFchSumEt_ring3[t] = -99;
nPFchObjs_ring3[t] = 0;
PFchSumEt_ring4[t] = -99;
nPFchObjs_ring4[t] = 0;
PFchSumEt_ring5[t] = -99;
nPFchObjs_ring5[t] = 0;
// TkSumEt_ring0[t] = -99;
// nTks_ring0[t] = 0;
// TkSumEt_ring1[t] = -99;
// nTks_ring1[t] = 0;
// TkSumEt_ring2[t] = -99;
// nTks_ring2[t] = 0;
// TkSumEt_ring3[t] = -99;
// nTks_ring3[t] = 0;
// TkSumEt_ring4[t] = -99;
// nTks_ring4[t] = 0;
// TkSumEt_ring5[t] = -99;
// nTks_ring5[t] = 0;
}
for (int qq =0; qq<nRandom; qq++){
ranConeEta[qq] =-99;
ranConePhi[qq] =-99;
// ranTrkSumPt[qq] =-99;
// ranNtracks[qq] =0;
// ranHBHEsumEt[qq] =-99;
// ranNHBHErhits[qq] =0;
// ranEBsumEt[qq] =-99;
// ranNEBrhits[qq] =0;
// ranEEsumEt[qq] =-99;
// ranNEErhits[qq] =0;
ranNTower_objs[qq] = 0;
ranTower_sumEt[qq] =-99;
ranTower_sumEt_ring0[qq] = -99;
ranNTower_objs_ring0[qq] = 0;
ranTower_sumEt_ring1[qq] = -99;
ranNTower_objs_ring1[qq] = 0;
ranTower_sumEt_ring2[qq] = -99;
ranNTower_objs_ring2[qq] = 0;
ranTower_sumEt_ring3[qq] = -99;
ranNTower_objs_ring3[qq] = 0;
ranTower_sumEt_ring4[qq] = -99;
ranNTower_objs_ring4[qq] = 0;
ranTower_sumEt_ring5[qq] = -99;
ranNTower_objs_ring5[qq] = 0;
ranNPFobjs[qq] = 0;
ranPFsumEt[qq] =-99;
ranPFsumEt_ring0[qq] = -99;
ranNPFobjs_ring0[qq] = 0;
ranPFsumEt_ring1[qq] = -99;
ranNPFobjs_ring1[qq] = 0;
ranPFsumEt_ring2[qq] = -99;
ranNPFobjs_ring2[qq] = 0;
ranPFsumEt_ring3[qq] = -99;
ranNPFobjs_ring3[qq] = 0;
ranPFsumEt_ring4[qq] = -99;
ranNPFobjs_ring4[qq] = 0;
ranPFsumEt_ring5[qq] = -99;
ranNPFobjs_ring5[qq] = 0;
ranPFchSumEt_ring0[qq] = -99;
ranNPFchObjs_ring0[qq] = 0;
ranPFchSumEt_ring1[qq] = -99;
ranNPFchObjs_ring1[qq] = 0;
ranPFchSumEt_ring2[qq] = -99;
ranNPFchObjs_ring2[qq] = 0;
ranPFchSumEt_ring3[qq] = -99;
ranNPFchObjs_ring3[qq] = 0;
ranPFchSumEt_ring4[qq] = -99;
ranNPFchObjs_ring4[qq] = 0;
ranPFchSumEt_ring5[qq] = -99;
ranNPFchObjs_ring5[qq] = 0;
// ranTkSumEt_ring0[qq] = -99;
// nRanTks_ring0[qq] = 0;
// ranTkSumEt_ring1[qq] = -99;
// nRanTks_ring1[qq] = 0;
// ranTkSumEt_ring2[qq] = -99;
// nRanTks_ring2[qq] = 0;
// ranTkSumEt_ring3[qq] = -99;
// nRanTks_ring3[qq] = 0;
// ranTkSumEt_ring4[qq] = -99;
// nRanTks_ring4[qq] = 0;
// ranTkSumEt_ring5[qq] = -99;
// nRanTks_ring5[qq] = 0;
}
//----------------------------------------------------------------------
// Now loop over the Jets
//----------------------------------------------------------------------
for (int iJet=0; iJet<nJets; iJet++)
{
jeta[iJet] = jteta[iJet];
jpt[iJet] = jtpt[iJet];
jphi[iJet] = jtphi[iJet];
jpu[iJet] = jtpu[iJet];
jrawpt[iJet] = rawpt[iJet];
//cout<<"HBEH eta: "<<HBHEeta[iJet]<<"EEeta: "<<EEeta[iJet]<<endl;
//----------------------------------------------------------------------
// Use kinematic cuts
//----------------------------------------------------------------------
if ( jteta[iJet] > fabs(ETACUT) ) continue;
if ( jtpt[iJet] < PTCUT3 ) continue;
//cout<<"jet pt = "<<jpt[iJet]<<endl;
//cout<<"jet pu = "<<jpu[iJet]<<endl;
//cout<<"raw pt = "<<jrawpt[iJet]<<endl;
//cout<<"eta: "<<jeta[iJet]<<", phi: "<<jphi[iJet]<<endl;
/*
//----------------------------------------------------------------------
// Now loop over the tracks, and get the ones inside the jet
//----------------------------------------------------------------------
Int_t nTrkInJetCounter=0;
Float_t trkSumPt = 0;
double maxPtIn = 0; //to identify the track with the largest pT, inside the cone
double maxPtOut = 0;//to identify the track with the largest pT, outside the cone
int iOut = 0;
int iIn = 0;
vector<int> iInTracks;
vector<int> iOutTracks;
double ringSumEtTk[nRings] ={0,0,0,0,0,0};
Int_t ringCounterTk[nRings] = {0,0,0,0,0,0};
for (int iTrk = 0; iTrk<nTracks ; iTrk++)
{
if (trkPt[iTrk] < TRACKPTCUT) continue;
//float iieta = trkEta[iTrk];
if (fabs(trkEta[iTrk]) > TRACKETACUT ) continue;
double dr_tj = sqrt(((trkEta[iTrk]-jteta[iJet])*(trkEta[iTrk]-jteta[iJet])) + (((trkPhi[iTrk]-jtphi[iJet])*(trkPhi[iTrk]-jtphi[iJet]))));
//cout<<"the radius of theis track to the center of teh jet is :"<<dr_tj1<<endl;
//dr_TrJet[iJet][iTrk] = dr_tj;
if (dr_tj <= JETRADIUS )
{
nTrkInJetCounter +=1;
trkSumPt += trkPt[iTrk];
//if(iJet==0)cout<<"tracks around(in) this jeta have pt: "<<trkPt[iTrk]<<endl;
}
dRinCone[iJet][iTrk] = dr_tj;
//For the JetShapes analysis get the energy in each ring in dR(\eta,\phi)
for (int iRing = 0; iRing<=nRings; iRing++)
{
if (dr_tj> LOW_dR[iRing] && dr_tj<= HI_dR[iRing])
{
ringSumEtTk[iRing] += trkPt[iTrk];
ringCounterTk[iRing] +=1;
}
}
//Now gather up the sums for each jet
TkSumEt_ring0[iTrk] = ringSumEtTk[0];
TkSumEt_ring1[iTrk] = ringSumEtTk[1];
TkSumEt_ring2[iTrk] = ringSumEtTk[2];
TkSumEt_ring3[iTrk] = ringSumEtTk[3];
TkSumEt_ring4[iTrk] = ringSumEtTk[4];
TkSumEt_ring5[iTrk] = ringSumEtTk[5];
nTks_ring0[iTrk] = ringCounterTk[0];
nTks_ring1[iTrk] = ringCounterTk[1];
nTks_ring2[iTrk] = ringCounterTk[2];
nTks_ring3[iTrk] = ringCounterTk[3];
nTks_ring4[iTrk] = ringCounterTk[4];
nTks_ring5[iTrk] = ringCounterTk[5];
//----------------------------------------------------------------------
// Now, some correlations:: leadingJet-subLeadingJet,
// leadingJet-leadingAwayTrack, leadingInsideJetTrack-leadingAwayTrack
//----------------------------------------------------------------------
if (trkPt[iTrk] > maxPtOut && dr_tj > JETRADIUS ) {
//if current track has a gretaer pT that previous and is inside the
//jet-cone radius re-value the maxpT and keep the iterator value
maxPtOut = trkPt[iTrk];
iOut = iTrk;
}
if (trkPt[iTrk] > maxPtIn && dr_tj <= JETRADIUS ) {
maxPtIn = trkPt[iTrk];
iIn =iTrk;
}
}
if (iJet==0){// catch only the correlations to the leading jet
//cout<<"**** and i kept the pt : "<<trkPt[iIn]<<" element: "<<iIn<<endl;
inTreta = trkEta[iIn];
inTrphi = trkPhi[iIn];
inTrpt = trkPt[iIn];
outTreta = trkEta[iOut];
outTrphi = trkPhi[iOut];
outTrpt = trkPt[iOut];
}
nTrInJet[iJet] = nTrkInJetCounter;
trkSumPtInJet[iJet] = trkSumPt;
//cout<<"event: "<<iev<<" Jet: "<<iJet<<" with eta: "<<jteta[iJet]<<" and "<<nTrkInJetCounter<<" tracks"<<endl;
if (nTrkInJetCounter>2500) cout<<"Alert: event: "<<iev<<" Jet: "<<iJet<<" with eta: "<<jteta[iJet]<<" and "<<nTrkInJetCounter<<" tracks"<<endl;
//
*/
if(jet_type=="PF"){
//----------------------------------------------------------------------
// Now loop over the Pflow candidates, and get the ones inside the jet
//----------------------------------------------------------------------
double sumEtPF=0;
Int_t PFCounter = 0;
double ringSumEt[nRings]={0,0,0,0,0,0};
Int_t ringCounter[nRings] ={0,0,0,0,0,0};
double ringSumEtCh[nRings]={0,0,0,0,0,0};
Int_t ringCounterCh[nRings] ={0,0,0,0,0,0};
//cout<<"no of PF candidates = "<<PF_n<<endl;
for(int iPF = 0; iPF<PF_n; iPF++)
{
if (PF_pt[iPF] < PF_TRACKPTCUT) continue;
if ( fabs(PF_eta[iPF] ) >= PF_TRACKETACUT ) continue;
double dRhitJetPF = Calc_deltaR(PF_eta[iPF], PF_phi[iPF], jteta[iJet], jtphi[iJet]);
// double dRhitJetPF = sqrt(((PF_eta[iPF]-jteta[iJet])*(PF_eta[iPF]-jteta[iJet])) + ((PF_phi[iPF]-jtphi[iJet])*(PF_phi[iPF]-jtphi[iJet])));
if (dRhitJetPF<=JETRADIUS)
{
sumEtPF += PF_pt[iPF];
PFCounter +=1;
//cout<<"PF pt ["<<iPF<<"] = "<<PF_pt[iPF]<<" with current sum: "<<sumEtPF<<endl;
//cout<<"PF eta["<<iPF<<"] = "<<PF_eta[iPF]<<", PF phi["<<iPF<<"] = "<<PF_phi[iPF]<<endl;
//cout<<"delta R = "<<dRhitJetPF<<endl;
}
//For the JetShapes analysis get the energy in each ring in dR(\eta,\phi)
for (int iRing = 0; iRing<=nRings; iRing++)
{
if (dRhitJetPF> LOW_dR[iRing] && dRhitJetPF<= HI_dR[iRing])
{
ringSumEt[iRing] += PF_pt[iPF];
ringCounter[iRing] +=1;
//these are the charged tracks
if ( PF_id[iPF] ==1 || PF_id[iPF]==2 || PF_id[iPF]==3 )
{
ringSumEtCh[iRing]+= PF_pt[iPF];
ringCounterCh[iRing]+=1;
}
}
}
}
//Now gather up the sums for each jet
PFsumEt_ring0[iJet] = ringSumEt[0];
PFsumEt_ring1[iJet] = ringSumEt[1];
PFsumEt_ring2[iJet] = ringSumEt[2];
PFsumEt_ring3[iJet] = ringSumEt[3];
PFsumEt_ring4[iJet] = ringSumEt[4];
PFsumEt_ring5[iJet] = ringSumEt[5];
nPFobjs_ring0[iJet] = ringCounter[0];
nPFobjs_ring1[iJet] = ringCounter[1];
nPFobjs_ring2[iJet] = ringCounter[2];
nPFobjs_ring3[iJet] = ringCounter[3];
nPFobjs_ring4[iJet] = ringCounter[4];
nPFobjs_ring5[iJet] = ringCounter[5];
PFchSumEt_ring0[iJet] = ringSumEtCh[0];
PFchSumEt_ring1[iJet] = ringSumEtCh[1];
PFchSumEt_ring2[iJet] = ringSumEtCh[2];
PFchSumEt_ring3[iJet] = ringSumEtCh[3];
PFchSumEt_ring4[iJet] = ringSumEtCh[4];
PFchSumEt_ring5[iJet] = ringSumEtCh[5];
nPFchObjs_ring0[iJet] = ringCounterCh[0];
nPFchObjs_ring1[iJet] = ringCounterCh[1];
nPFchObjs_ring2[iJet] = ringCounterCh[2];
nPFchObjs_ring3[iJet] = ringCounterCh[3];
nPFchObjs_ring4[iJet] = ringCounterCh[4];
nPFchObjs_ring5[iJet] = ringCounterCh[5];
PFsumEt[iJet] = sumEtPF;
//cout<<"Event no = "<<iJet<<", sumEtPF = "<<sumEtPF<<endl;
nPFobjs[iJet] = PFCounter;
}else if(jet_type=="Calo"){
// //----------------------------------------------------------------------
// // Now loop over the recHits(Towers ), and get the ones inside the jet
// //----------------------------------------------------------------------
double sumEtTower=0;
Int_t TowerCounter = 0;
double ringTowerSumEt[nRings]={0,0,0,0,0,0};
Int_t ringTowerCounter[nRings] ={0,0,0,0,0,0};
for(int iTower = 0; iTower<Tower_n; iTower++)
{
if (Tower_pt[iTower] < Tower_TRACKPTCUT) continue;
if ( fabs(Tower_eta[iTower] ) >= Tower_TRACKETACUT ) continue;
double dRhitJetTower = sqrt(((Tower_eta[iTower]-jteta[iJet])*(Tower_eta[iTower]-jteta[iJet])) + ((Tower_phi[iTower]-jtphi[iJet])*(Tower_phi[iTower]-jtphi[iJet])));
if (dRhitJetTower<=JETRADIUS)