-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLoopRandomCone_v5rev_akX_TYPE.C
1020 lines (950 loc) · 38.8 KB
/
LoopRandomCone_v5rev_akX_TYPE.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
#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.14159;
//#define nRan 100;
void LoopRandomCone_v5rev_akX_TYPE(double rad=3, int nMaxEv=10000, const char* TYPE="test", const char* COLLTYPE, const char* inFile="you_messed_up.root", const char* outFile="dontTrustMe.root"){
TFile *FileA = TFile::Open(Form("%s",inFile));
TFile* outf = new TFile(Form("%s",outFile),"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<<"Incomming file : "<<inFile<<endl;
cout<<"The radius is : "<<rad<<endl;
cout<<"TYPE : "<<TYPE<<" COLLTYPE : "<<COLLTYPE<<endl;
//****** Analysis knobs *****************
Float_t JETRADIUS = rad;
//Float_t PTCUT1 = 120; //leading jet
//Float_t PTCUT2 = 50; //away jet
Float_t PTCUT3 = 20; //perp jets
Float_t ETACUT = 2.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 = 2.0; //eta acceptance
//bool debug = 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 = 50;
int nRan= 50;
int Nevents = nMaxEv;
int nMarks = 200;
//****************************************
TTree* ak = (TTree*)FileA->Get("akPu3PFJetAnalyzer/t");
//TTree* ak3 = (TTree*)FileA->Get("akPu3PFJetAnalyzer/t");
//TTree* ak4 = (TTree*)FileA->Get("akPu4PFJetAnalyzer/t");
//TTree* ak5 = (TTree*)FileA->Get("akPu5PFJetAnalyzer/t");
TTree* ic = (TTree*)FileA->Get("icPu5JetAnalyzer/t");
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");
if(COLLTYPE=="pA") TTree* ttrack = (TTree*)FileA->Get("ppTrack/trackTree");
if(COLLTYPE=="PbPb") TTree* ttrack = (TTree*)FileA->Get("mergedTrack/trackTree");
TTree* pflow = (TTree*)FileA->Get("pfcandAnalyzer/pfTree");
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 PFn;
Float_t PFeta[10000000];
Float_t PFphi[10000000];
Float_t PFpt[10000000];
Int_t PFid[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",&PFn);
pflow->SetBranchAddress("pfEta",&PFeta);
pflow->SetBranchAddress("pfPhi",&PFphi);
pflow->SetBranchAddress("pfPt",&PFpt);
pflow->SetBranchAddress("pfId",&PFid);
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 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];
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 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("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");
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");
nt->Branch("ranPFsumEt",ranPFsumEt,"ranPFsumEt[200]/F");
nt->Branch("ranNPFobjs",ranNPFobjs,"ranNPFobjs[200]/I");
nt->Branch("ranNPFobjs_ring0",ranNPFobjs_ring0,"ranNPFobjs_ring0[200]/I");
nt->Branch("ranPFsumEt_ring0",ranPFsumEt_ring0,"ranPFsumEt_ring0[200]/F");
nt->Branch("ranNPFobjs_ring1",ranNPFobjs_ring1,"ranNPFobjs_ring1[200]/I");
nt->Branch("ranPFsumEt_ring1",ranPFsumEt_ring1,"ranPFsumEt_ring1[200]/F");
nt->Branch("ranNPFobjs_ring2",ranNPFobjs_ring2,"ranNPFobjs_ring2[200]/I");
nt->Branch("ranPFsumEt_ring2",ranPFsumEt_ring2,"ranPFsumEt_ring2[200]/F");
nt->Branch("ranNPFobjs_ring3",ranNPFobjs_ring3,"ranNPFobjs_ring3[200]/I");
nt->Branch("ranPFsumEt_ring3",ranPFsumEt_ring3,"ranPFsumEt_ring3[200]/F");
nt->Branch("ranNPFobjs_ring4",ranNPFobjs_ring4,"ranNPFobjs_ring4[200]/I");
nt->Branch("ranPFsumEt_ring4",ranPFsumEt_ring4,"ranPFsumEt_ring4[200]/F");
nt->Branch("ranNPFobjs_ring5",ranNPFobjs_ring5,"ranNPFobjs_ring5[200]/I");
nt->Branch("ranPFsumEt_ring5",ranPFsumEt_ring5,"ranPFsumEt_ring5[200]/F");
nt->Branch("ranNPFchObjs_ring0",ranNPFchObjs_ring0,"ranNPFchObjs_ring0[200]/I");
nt->Branch("ranPFchSumEt_ring0",ranPFchSumEt_ring0,"ranPFchSumEt_ring0[200]/F");
nt->Branch("ranNPFchObjs_ring1",ranNPFchObjs_ring1,"ranNPFchObjs_ring1[200]/I");
nt->Branch("ranPFchSumEt_ring1",ranPFchSumEt_ring1,"ranPFchSumEt_ring1[200]/F");
nt->Branch("ranNPFchObjs_ring2",ranNPFchObjs_ring2,"ranNPFchObjs_ring2[200]/I");
nt->Branch("ranPFchSumEt_ring2",ranPFchSumEt_ring2,"ranPFchSumEt_ring2[200]/F");
nt->Branch("ranNPFchObjs_ring3",ranNPFchObjs_ring3,"ranNPFchObjs_ring3[200]/I");
nt->Branch("ranPFchSumEt_ring3",ranPFchSumEt_ring3,"ranPFchSumEt_ring3[200]/F");
nt->Branch("ranNPFchObjs_ring4",ranNPFchObjs_ring4,"ranNPFchObjs_ring4[200]/I");
nt->Branch("ranPFchSumEt_ring4",ranPFchSumEt_ring4,"ranPFchSumEt_ring4[200]/F");
nt->Branch("ranNPFchObjs_ring5",ranNPFchObjs_ring5,"ranNPFchObjs_ring5[200]/I");
nt->Branch("ranPFchSumEt_ring5",ranPFchSumEt_ring5,"ranPFchSumEt_ring5[200]/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)//loop over all the entries (events)
{
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);
pflow->GetEntry(iev);
//----------------------------------------------------------------------
// Event variables, and HCAL noise cleaning
//----------------------------------------------------------------------
CES = pCES;
//if (CES==0) continue;
///*
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;
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;
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;
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;
//----------------------------------------------------------------------
// 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;
//
//----------------------------------------------------------------------
// Now loop over the Pflow tracks, 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};
for(int iPF = 0; iPF<PFn; iPF++)
{
if (PFpt[iPF] < PF_TRACKPTCUT) continue;
if ( fabs(PFeta[iPF] ) >= PF_TRACKETACUT ) continue;
double dRhitJetPF = sqrt(((PFeta[iPF]-jteta[iJet])*(PFeta[iPF]-jteta[iJet])) + (((PFphi[iPF]-jtphi[iJet])*(PFphi[iPF]-jtphi[iJet]))));
if (dRhitJetPF<=JETRADIUS)
{
sumEtPF += PFpt[iPF];
PFCounter +=1;
//cout<<"PFet ["<<iPF<<"] = "<<PFet[iPF]<<" with current sum: "<<sumEtPF<<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] += PFpt[iPF];
ringCounter[iRing] +=1;
//these are the charged tracks
if ( PFid[iPF] ==1 || PFid[iPF]==2 || PFid[iPF]==3 )
{
ringSumEtCh[iRing]+= PFpt[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;
nPFobjs[iJet] = PFCounter;
// //----------------------------------------------------------------------
// // Now loop over the recHits(HBHE), and get the ones inside the jet
// //----------------------------------------------------------------------
// double sumEtHBHE=0;
// Int_t recHitHBHECounter = 0;
// for(int iHBHE = 0; iHBHE<HBHEn; iHBHE++)
// {
// double dRhitJetHBHE = sqrt(((HBHEeta[iHBHE]-jteta[iJet])*(HBHEeta[iHBHE]-jteta[iJet])) + (((HBHEphi[iHBHE]-jtphi[iJet])*(HBHEphi[iHBHE]-jtphi[iJet]))));
// if (dRhitJetHBHE<=JETRADIUS)
// {
// sumEtHBHE += HBHEet[iHBHE];
// recHitHBHECounter +=1;
// //cout<<"HBHEet ["<<iHBHE<<"] = "<<HBHEet[iHBHE]<<" with current sum: "<<sumEtHBHE<<endl;
// }
// }
// HBHEsumEt[iJet] = sumEtHBHE;
// nHBHErhits[iJet] = recHitHBHECounter;
// //----------------------------------------------------------------------
// // Now loop over the recHits(EE), and get the ones inside the jet
// //----------------------------------------------------------------------
// double sumEtEE=0;
// Int_t recHitEECounter = 0;
// for(int iEE = 0; iEE<EEn; iEE++)
// {
// double dRhitJetEE = sqrt(((EEeta[iEE]-jteta[iJet])*(EEeta[iEE]-jteta[iJet])) + (((EEphi[iEE]-jtphi[iJet])*(EEphi[iEE]-jtphi[iJet]))));
// if (dRhitJetEE<=JETRADIUS)
// {
// sumEtEE += EEet[iEE];
// //cout<<"EEet ["<<iEE<<"] = "<<EEet[iEE]<<" with current sum: "<<sumEtEE<<endl;
// recHitEECounter +=1;
// }
// }
// EEsumEt[iJet] = sumEtEE;
// nEErhits[iJet] = recHitEECounter;
// //----------------------------------------------------------------------
// // Now loop over the recHits(EB), and get the ones inside the jet
// //----------------------------------------------------------------------
// double sumEtEB=0;
// Int_t recHitEBCounter = 0;
// for(int iEB = 0; iEB<EBn; iEB++)
// {
// double dRhitJetEB = sqrt(((EBeta[iEB]-jteta[iJet])*(EBeta[iEB]-jteta[iJet])) + (((EBphi[iEB]-jtphi[iJet])*(EBphi[iEB]-jtphi[iJet]))));
// if (dRhitJetEB<=JETRADIUS)
// {
// sumEtEB += EBet[iEB];
// recHitEBCounter +=1;
// }
// }
// EBsumEt[iJet] = sumEtEB;
// nEBrhits[iJet] = recHitEBCounter;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Get random distribution in eta and phi
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
for (int iRan =0 ; iRan<nRandom; iRan++ )
{
float ranEta = myDice.Uniform(-2,2);
float ranPhi = myDice.Uniform(-3.14159,3.13159);
//----------------------------------------------------------------------
// Now loop over the tracks, and get the ones inside random cones
//----------------------------------------------------------------------
int ranConeTrkCounter = 0;
double ranConeTrkSumPt = 0;
double ranRingSumEtTk[nRings]={0,0,0,0,0,0};
Int_t ranRingCounterTk[nRings] ={0,0,0,0,0,0};
for (int jTrk = 0; jTrk<nTracks ; jTrk++)
{
if (trkPt[jTrk] < TRACKPTCUT) continue;
//float iiieta = trkEta[iTrk];
if (fabs(trkEta[jTrk]) > TRACKETACUT ) continue;
double dr1 = sqrt(((trkEta[jTrk]-ranEta)*(trkEta[jTrk]-ranEta)) + (((trkPhi[jTrk]-ranPhi)*(trkPhi[jTrk]-ranPhi))));
if (dr1 <= JETRADIUS )
{
ranConeTrkCounter +=1;
ranConeTrkSumPt += trkPt[jTrk];
}
ranNtracks[iRan] = ranConeTrkCounter;
ranTrkSumPt[iRan] = ranConeTrkSumPt;
ranConeEta[iRan] = ranEta;
ranConePhi[iRan] = ranPhi;
//For the JetShapes analysis get the energy in each ring in dR(\eta,\phi)
for (int iRing = 0; iRing<=nRings; iRing++)
{
if (dr1> LOW_dR[iRing] && dr1<= HI_dR[iRing])
{
ranRingSumEtTk[iRing] += trkPt[jTrk];
ranRingCounterTk[iRing] +=1;
}
}
}
//Now gather up the sums for each jet
ranTkSumEt_ring0[iRan] = ranRingSumEtTk[0];
ranTkSumEt_ring1[iRan] = ranRingSumEtTk[1];
ranTkSumEt_ring2[iRan] = ranRingSumEtTk[2];
ranTkSumEt_ring3[iRan] = ranRingSumEtTk[3];
ranTkSumEt_ring4[iRan] = ranRingSumEtTk[4];
ranTkSumEt_ring5[iRan] = ranRingSumEtTk[5];
nRanTks_ring0[iRan] = ranRingCounterTk[0];
nRanTks_ring1[iRan] = ranRingCounterTk[1];
nRanTks_ring2[iRan] = ranRingCounterTk[2];
nRanTks_ring3[iRan] = ranRingCounterTk[3];
nRanTks_ring4[iRan] = ranRingCounterTk[4];
nRanTks_ring5[iRan] = ranRingCounterTk[5];
//----------------------------------------------------------------------
// Now loop over the PFlow object, and get the ones inside the random cone
//----------------------------------------------------------------------
double ranSumEtPF=0;
Int_t ranPFCounter = 0;
double ranRingSumEt[nRings] ={0,0,0,0,0,0};
Int_t ranRingCounter[nRings] ={0,0,0,0,0,0};
double ranRingSumEtCh[nRings] ={0,0,0,0,0,0};
Int_t ranRingCounterCh[nRings] ={0,0,0,0,0,0};
for(int iPF = 0; iPF<PFn; iPF++)
{
if (PFpt[iPF] < PF_TRACKPTCUT) continue;
if (fabs(PFeta[iPF]) > PF_TRACKETACUT ) continue;
double dR12 = sqrt(((PFeta[iPF]-ranEta)*(PFeta[iPF]-ranEta)) + (((PFphi[iPF]-ranPhi)*(PFphi[iPF]-ranPhi))));
if (dR12<=JETRADIUS)
{
ranSumEtPF += PFpt[iPF];
ranPFCounter +=1;
//cout<<"PFet ["<<iPF<<"] = "<<PFet[iPF]<<" with current sum: "<<sumEtPF<<endl;
}
//For the JetShapes analysis get the energy in each ring in dR(\eta,\phi)
for (int iRing = 0; iRing<=nRings; iRing++)
{
if (dR12> LOW_dR[iRing] && dR12<= HI_dR[iRing])
{
ranRingSumEt[iRing] += PFpt[iPF];
ranRingCounter[iRing] +=1;
if (PFid[iPF] ==1 || PFid[iPF]==2 || PFid[iPF]==3)//these are the charged tracks
{
ranRingSumEtCh[iRing]+= PFpt[iPF];
ranRingCounterCh[iRing]+=1;
}
}
}
}
//Now gather up the sums for each jet
ranPFsumEt_ring0[iRan] = ranRingSumEt[0];
ranPFsumEt_ring1[iRan] = ranRingSumEt[1];
ranPFsumEt_ring2[iRan] = ranRingSumEt[2];
ranPFsumEt_ring3[iRan] = ranRingSumEt[3];
ranPFsumEt_ring4[iRan] = ranRingSumEt[4];
ranPFsumEt_ring5[iRan] = ranRingSumEt[5];
ranNPFobjs_ring0[iRan] = ranRingCounter[0];
ranNPFobjs_ring1[iRan] = ranRingCounter[1];
ranNPFobjs_ring2[iRan] = ranRingCounter[2];
ranNPFobjs_ring3[iRan] = ranRingCounter[3];
ranNPFobjs_ring4[iRan] = ranRingCounter[4];
ranNPFobjs_ring5[iRan] = ranRingCounter[5];
ranPFsumEt[iRan] = ranSumEtPF;
ranNPFobjs[iRan] = ranPFCounter;
ranPFchSumEt_ring0[iRan] = ranRingSumEtCh[0];
ranPFchSumEt_ring1[iRan] = ranRingSumEtCh[1];
ranPFchSumEt_ring2[iRan] = ranRingSumEtCh[2];
ranPFchSumEt_ring3[iRan] = ranRingSumEtCh[3];
ranPFchSumEt_ring4[iRan] = ranRingSumEtCh[4];
ranPFchSumEt_ring5[iRan] = ranRingSumEtCh[5];
ranNPFchObjs_ring0[iRan] = ranRingCounterCh[0];
ranNPFchObjs_ring1[iRan] = ranRingCounterCh[1];
ranNPFchObjs_ring2[iRan] = ranRingCounterCh[2];
ranNPFchObjs_ring3[iRan] = ranRingCounterCh[3];
ranNPFchObjs_ring4[iRan] = ranRingCounterCh[4];
ranNPFchObjs_ring5[iRan] = ranRingCounterCh[5];
// //----------------------------------------------------------------------
// // Now loop over the recHits(HBHE), and get the ones inside the random cone
// //----------------------------------------------------------------------
// double ranSumEtHBHE=0;
// Int_t ranRecHitHBHECounter = 0;
// for(int kHBHE = 0; kHBHE<HBHEn; kHBHE++)
// {
// double dr2 = sqrt(((HBHEeta[kHBHE]-ranEta)*(HBHEeta[kHBHE]-ranEta)) + (((HBHEphi[kHBHE]-ranPhi)*(HBHEphi[kHBHE]-ranPhi))));
// if (dr2<=JETRADIUS)
// {
// ranSumEtHBHE += HBHEet[kHBHE];
// ranRecHitHBHECounter +=1;
// }
// }
// ranHBHEsumEt[iRan] = ranSumEtHBHE;
// ranNHBHErhits[iRan] = ranRecHitHBHECounter;
// //----------------------------------------------------------------------
// // Now loop over the recHits(EB), and get the ones inside the random cone
// //----------------------------------------------------------------------
// double ranSumEtEB=0;
// Int_t ranRecHitEBCounter = 0;
// for(int kEB = 0; kEB<EBn; kEB++)
// {
// double dr2 = sqrt(((EBeta[kEB]-ranEta)*(EBeta[kEB]-ranEta)) + (((EBphi[kEB]-ranPhi)*(EBphi[kEB]-ranPhi))));
// if (dr2<=JETRADIUS)
// {
// ranSumEtEB += EBet[kEB];
// ranRecHitEBCounter +=1;
// }
// }
// ranEBsumEt[iRan] = ranSumEtEB;
// ranNEBrhits[iRan] = ranRecHitEBCounter;
// //----------------------------------------------------------------------
// // Now loop over the recHits(EE), and get the ones inside the random cone
// //----------------------------------------------------------------------
// double ranSumEtEE=0;
// Int_t ranRecHitEECounter = 0;
// for(int kEE = 0; kEE<EEn; kEE++)
// {