forked from miquork/jetphys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfillHistos.C
executable file
·3081 lines (2694 loc) · 112 KB
/
fillHistos.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
// Purpose: Fill jet physics analysis histograms
// Author: [email protected]
// Created: April 19, 2010
// Updated: June 2, 2015
#define fillHistos_cxx
#include "fillHistos.h"
#include "TH2.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TDirectory.h"
#include "TRandom3.h"
#include "TStopwatch.h"
#include "TLorentzVector.h"
#include "TSystem.h"
#include <iostream>
#include <fstream>
using namespace std;
void fillHistos::Loop()
{
// In a ROOT session, you can do:
// Root > .L fillHistos.C
// Root > fillHistos t
// Root > t.GetEntry(12); // Fill t data members with entry number 12
// Root > t.Show(); // Show values of entry 12
// Root > t.Show(16); // Read and show values of entry 16
// Root > t.Loop(); // Loop on all entries
//
// This is the loop skeleton where:
// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
// Note that the argument to GetEntry must be:
// jentry for TChain::GetEntry
// ientry for TTree::GetEntry and TBranch::GetEntry
//
// To read only selected branches, Insert statements like:
// METHOD1:
// fChain->SetBranchStatus("*",0); // disable all branches
// fChain->SetBranchStatus("branchname",1); // activate branchname
// METHOD2: replace line
// fChain->GetEntry(jentry); //read all branches
//by b_branchname->GetEntry(ientry); //read only this branch
if (fChain == 0) return;
Long64_t nentries = fChain->GetEntriesFast();
Long64_t ntot = fChain->GetEntries();
Long64_t nskip = _jp_nskip;//0;
nentries = (_jp_nentries==-1 ? ntot-nskip : min(ntot-nskip, _jp_nentries));
assert(nskip+nentries);
//
//nentries = 10; // debug
//nentries = 1000;//very short test runs
//nentries = 100000;//short test runs
//nentries = 1000000;//medium test runs
//nentries = 5000000; // lunch-break run for MC (with trigsim off)
map<string, int> cnt; // efficiency counters
ferr = new ofstream("fillHistos.log",ios::out);
// Report memory usage to avoid malloc problems when writing file
*ferr << endl << "Starting Loop() initialization:" << endl << flush;
cout << endl << "Starting Loop() initialization:" << endl << flush;
MemInfo_t info;
gSystem->GetMemInfo(&info);
*ferr <<Form("MemInfo(Tot:%d, Used:%d, Free:%d, Stot:%d, SUsed:%d, SFree:%d",
info.fMemTotal, info.fMemUsed, info.fMemFree,
info.fSwapTotal, info.fSwapUsed, info.fSwapFree) << endl<<flush;
cout << Form("MemInfo(Tot:%d, Used:%d, Free:%d, Stot:%d, SUsed:%d, SFree:%d",
info.fMemTotal, info.fMemUsed, info.fMemFree,
info.fSwapTotal, info.fSwapUsed, info.fSwapFree) << endl<<flush;
_entries = ntot;//(_mc ? fChain->GetEntries() : ntot);
_nbadevts_dup = _nbadevts_run = _nbadevts_ls = _nbadevts_lum = 0;
_nbadevts_veto = _nbadevts_stream = 0;
_bscounter_bad = _bscounter_good = _halocounter_bad = _halocounter_good = 0;
_ecalcounter_good = _ecalcounter_bad = 0;
_rhocounter_good = _rhocounter_bad = 0;
_trgcounter = _evtcounter = _totcounter = 0;
ecalveto = 0;
// Set cross section weights for pThat bins
hmcweight = 0;
if (_jp_pthatbins) {
double bins[]={5,15,30,50,80,120,170,300,470,600,800,1000,1400,1800,3500};
const int nbins = sizeof(bins)/sizeof(bins[0])-1;
double lums[] = {4.49e-5,1.32e-2,1.22e-1,1.04,8.40,5.32e+1,2.57e+2,5.51e+3,
5.68e+4,2.73e+5,2.20e+6,6.30e+6,2.02e+8,8.20e+8};
const int nlums = sizeof(lums)/sizeof(lums[0]);
assert(nbins==nlums);
hmcweight = new TH1D("hmcweight",";#hat{p}_{T} (GeV)",nbins,bins);
for (int i = 0; i != nbins; ++i) {
hmcweight->SetBinContent(i+1, 1./lums[i]);
} // for i
}
// map AK4 events to AK8 events
map<Int_t, map<Int_t, map<UInt_t, Long64_t> > > ak4entry;
if (_jp_ak4ak8 && _dt) {
assert(fChain2);
fChain2->SetBranchStatus("*",0);
fChain2->SetBranchStatus("EvtHdr_.mRun",1);
fChain2->SetBranchStatus("EvtHdr_.mLumi",1);
fChain2->SetBranchStatus("EvtHdr_.mEvent",1);
cout << "Mapping AK4 to AK8 events for data" << endl;
Long64_t nentries5 = fChain2->GetEntriesFast();
for (Long64_t jentry5=0; jentry5<nentries5;jentry5++) {
fChain2->GetEntry(jentry5);
// Check for duplicate entries
assert(ak4entry[t4_EvtHdr__mRun][t4_EvtHdr__mLumi][t4_EvtHdr__mEvent]==0);
ak4entry[t4_EvtHdr__mRun][t4_EvtHdr__mLumi][t4_EvtHdr__mEvent] = jentry5;
} // for jentry
cout << "Found mapping for " << ak4entry.size() << " runs" <<endl<<flush;
} // _jp_ak4ak8
map<Double_t, map<Int_t, Long64_t> > ak4entrymc;
if (_jp_ak4ak8 && _mc) {
assert(fChain2);
fChain2->SetBranchStatus("*",0);
fChain2->SetBranchStatus("EvtHdr_.mPthat",1);
fChain2->SetBranchStatus("EvtHdr_.mINTPU",1);
fChain2->SetBranchStatus("EvtHdr_.mOOTPUEarly",1);
fChain2->SetBranchStatus("EvtHdr_.mOOTPULate",1);
cout << "Mapping AK4 to AK8 events for MC" << endl;
Long64_t nentries5 = fChain2->GetEntriesFast();
int ndup(0);
for (Long64_t jentry5=0; jentry5<nentries5;jentry5++) {
fChain2->GetEntry(jentry5);
Int_t npu = t4_EvtHdr__mINTPU + 500*t4_EvtHdr__mOOTPUEarly
+ 250000*t4_EvtHdr__mOOTPULate;
// Check for duplicate entries
if (!(ak4entrymc[t4_EvtHdr__mPthat][npu]==0)) {
cout << "Error: Duplicates in entries "
<< ak4entrymc[t4_EvtHdr__mPthat][npu]
<< " and " << jentry5 << ": "
<< " pThat="<<t4_EvtHdr__mPthat
<< " INTPU="<<t4_EvtHdr__mINTPU
<< " Early="<<t4_EvtHdr__mOOTPUEarly
<< " Late="<<t4_EvtHdr__mOOTPULate
<< endl << flush;
//assert(ak4entrymc[t4_EvtHdr__mPthat][npu]==0);
++ndup;
}
else
ak4entrymc[t4_EvtHdr__mPthat][npu] = jentry5;
} // for jentry
cout << "Found mapping for "<<ak4entrymc.size()<<" pThats"<<endl<<flush;
if (ndup!=0) {
cout << "Found "<<ndup<<" duplicates, first ones kept"<<endl<<flush;
}
} // _jp_ak4ak8
//if (_jp_ak4ak8 || _jp_algo=="AK4") {
if (_jp_ak4ak8) {
cout << "/nCreating a shuffled list of jackknife removals based on AK4/n";
// Modification pre-CWR, Sep 27, 2013
// Randomly remove event from one of the histograms that was not
// yet left out in the latest cycle (these are tracked in jkmore)
// ...but how to make sure same event is removed from AK4 and AK8?
// => Create list here at the beginning together with ak4entry mappin
TRandom3 *rnd = new TRandom3();
Long64_t nentries5 = (fChain2 ? fChain2->GetEntriesFast()
: fChain->GetEntriesFast());
for (Long64_t jentry5=0; jentry5<nentries5; jentry5++) {
int n = 10;//h->hpt_jk.size();
if (_jkmore.size()==0) { // if jkmore is empty, reset it first
for (int ijk = 0; ijk != n; ++ijk) _jkmore.push_back(ijk);
}
int m = _jkmore.size(); assert(m!=0);
int mout = rnd->Integer(m);
int iout = _jkmore[mout];
_outlist[jentry5] = iout;
_jkmore.erase(_jkmore.begin()+mout);
if (jentry5<300) {
cout << " " << iout;
if (jentry5%10==9) cout << ", ";
if (jentry5%20==19) cout << endl;
}
}
cout << endl;
} // _jp_ak4ak8
if (_jp_quick) {
fChain->SetBranchStatus("*",0);
if (fChain2) fChain2->SetBranchStatus("*",0);
// Luminosity calculation
if (_mc) fChain->SetBranchStatus("EvtHdr_.mPthat",1); // pthat
if (_mc) fChain->SetBranchStatus("EvtHdr_.mWeight",1); // weight
if (_dt) fChain->SetBranchStatus("EvtHdr_.mRun",1); // run
if (_dt) fChain->SetBranchStatus("EvtHdr_.mEvent",1); // evt
if (_dt) fChain->SetBranchStatus("EvtHdr_.mLumi",1); // lbn
// Event properties
fChain->SetBranchStatus("EvtHdr_.mNVtx",1); // npv
fChain->SetBranchStatus("EvtHdr_.mNVtxGood",1); // npvgood
fChain->SetBranchStatus("EvtHdr_.mPFRho",1); // rho
// Jet properties (jtpt, jte, jteta, jty, jtphi etc.)
fChain->SetBranchStatus("PFJets_",1); // njt
fChain->SetBranchStatus("PFJets_.P4_.fCoordinates.fX",1); // jtp4x
fChain->SetBranchStatus("PFJets_.P4_.fCoordinates.fY",1); // jtp4y
fChain->SetBranchStatus("PFJets_.P4_.fCoordinates.fZ",1); // jtp4z
fChain->SetBranchStatus("PFJets_.P4_.fCoordinates.fT",1); // jtp4t
fChain->SetBranchStatus("PFJets_.cor_",1); // jtjes
fChain->SetBranchStatus("PFJets_.area_",1); // jta
if (_mc) {
fChain->SetBranchStatus("PFJets_.genP4_.fCoordinates.fX",1); // jtgenp4x
fChain->SetBranchStatus("PFJets_.genP4_.fCoordinates.fY",1); // jtgenp4y
fChain->SetBranchStatus("PFJets_.genP4_.fCoordinates.fZ",1); // jtgenp4z
fChain->SetBranchStatus("PFJets_.genP4_.fCoordinates.fT",1); // jtgenp4t
fChain->SetBranchStatus("PFJets_.genR_",1); // jtgenr
}
// Component fractions
fChain->SetBranchStatus("PFJets_.chf_",1); // jtchf
//fChain->SetBranchStatus("PFJets_.phf_",1); // jtnef
fChain->SetBranchStatus("PFJets_.nemf_",1); // jtnef
fChain->SetBranchStatus("PFJets_.nhf_",1); // jtnhf
//fChain->SetBranchStatus("PFJets_.elf_",1); // jtcef !!
fChain->SetBranchStatus("PFJets_.cemf_",1); // jtcef !!
fChain->SetBranchStatus("PFJets_.muf_",1); // jtmuf !!
fChain->SetBranchStatus("PFJets_.ncand_",1); // jtn
fChain->SetBranchStatus("PFJets_.beta_",1); // jtbeta
fChain->SetBranchStatus("PFJets_.betaStar_",1); // jtbetastar
fChain->SetBranchStatus("PFJets_.chm_",1); // jtnch
fChain->SetBranchStatus("PFJets_.phm_",1); // jtnne
fChain->SetBranchStatus("PFJets_.nhm_",1); // jtnnh
fChain->SetBranchStatus("PFJets_.elm_",1); // jtnce !!
fChain->SetBranchStatus("PFJets_.mum_",1); // jtnmu !!
fChain->SetBranchStatus("PFJets_.tightID_",1); // jtidtight
fChain->SetBranchStatus("PFJets_.looseID_",1); // jtidloose
//fChain->SetBranchStatus("rho",1);
fChain->SetBranchStatus("PFMet_.et_",1); // met
fChain->SetBranchStatus("PFMet_.phi_",1); // metphi
fChain->SetBranchStatus("PFMet_.sumEt_",1); // metsumet
fChain->SetBranchStatus("TriggerDecision_",1);
fChain->SetBranchStatus("L1Prescale_",1);
fChain->SetBranchStatus("HLTPrescale_",1);
// Event cleaning
//fChain->SetBranchStatus("pvrho",1);
fChain->SetBranchStatus("EvtHdr_.mPVx",1); // pvx
fChain->SetBranchStatus("EvtHdr_.mPVy",1); // pvy
fChain->SetBranchStatus("EvtHdr_.mPVz",1); // pvz
fChain->SetBranchStatus("EvtHdr_.mPVndof",1); // pvndof
fChain->SetBranchStatus("EvtHdr_.mBSx",1); // bsx
fChain->SetBranchStatus("EvtHdr_.mBSy",1); // bsy
//
if (_mc) fChain->SetBranchStatus("EvtHdr_.mTrPu",1); // trpu
if (_mc) fChain->SetBranchStatus("EvtHdr_.mINTPU",1); // itpu
if (_mc) fChain->SetBranchStatus("EvtHdr_.mOOTPULate",1); // ootpulate
if (_mc) fChain->SetBranchStatus("EvtHdr_.mOOTPUEarly",1); // ootpuearly
if (_mc) {
fChain->SetBranchStatus("GenJets_",1); // gen_njt
fChain->SetBranchStatus("GenJets_.fCoordinates.fX",1); // gen_jtp4x
fChain->SetBranchStatus("GenJets_.fCoordinates.fY",1); // gen_jtp4y
fChain->SetBranchStatus("GenJets_.fCoordinates.fZ",1); // gen_jtp4z
fChain->SetBranchStatus("GenJets_.fCoordinates.fT",1); // gen_jtp4t
}
if (_jp_ak4ak8) {
cout << "Activating friend branches" << endl;
if (_dt) fChain2->SetBranchStatus("EvtHdr_.mRun",1); // run
if (_dt) fChain2->SetBranchStatus("EvtHdr_.mEvent",1); // evt
if (_dt) fChain2->SetBranchStatus("EvtHdr_.mLumi",1); // lbn
if (_mc) fChain2->SetBranchStatus("EvtHdr_.mPthat",1);
if (_mc) fChain2->SetBranchStatus("EvtHdr_.mOOTPUEarly",1);
if (_mc) fChain2->SetBranchStatus("EvtHdr_.mOOTPULate",1);
if (_mc) fChain2->SetBranchStatus("EvtHdr_.mINTPU",1);
fChain2->SetBranchStatus("PFJets_",1); // njt
fChain2->SetBranchStatus("PFJets_.P4_.fCoordinates.fX",1); // jtp4x
fChain2->SetBranchStatus("PFJets_.P4_.fCoordinates.fY",1); // jtp4y
fChain2->SetBranchStatus("PFJets_.P4_.fCoordinates.fZ",1); // jtp4z
fChain2->SetBranchStatus("PFJets_.P4_.fCoordinates.fT",1); // jtp4t
fChain2->SetBranchStatus("PFJets_.cor_",1); // jtjes
fChain2->SetBranchStatus("PFJets_.area_",1); // jta
fChain2->SetBranchStatus("PFJets_.tightID_",1); // jtidtight
fChain2->SetBranchStatus("PFJets_.looseID_",1); // jtidloose
if (_mc) fChain2->SetBranchStatus("GenJets_",1); // njt
if (_mc) fChain2->SetBranchStatus("GenJets_.fCoordinates.fX",1);
if (_mc) fChain2->SetBranchStatus("GenJets_.fCoordinates.fY",1);
if (_mc) fChain2->SetBranchStatus("GenJets_.fCoordinates.fZ",1);
if (_mc) fChain2->SetBranchStatus("GenJets_.fCoordinates.fT",1);
}
} // _quick
else {
fChain->SetBranchStatus("*",1);
if (fChain2) fChain2->SetBranchStatus("*",1);
}
// Set pointers to branches
jtp4x = &PFJets__P4__fCoordinates_fX[0];
jtp4y = &PFJets__P4__fCoordinates_fY[0];
jtp4z = &PFJets__P4__fCoordinates_fZ[0];
jtp4t = &PFJets__P4__fCoordinates_fT[0];
jta = &PFJets__area_[0];
jtjes = &PFJets__cor_[0];
jtbeta = &PFJets__beta_[0];
jtbetastar = &PFJets__betaStar_[0];
jtidloose = &PFJets__looseID_[0];
jtidtight = &PFJets__tightID_[0];
//
jtgenr = &PFJets__genR_[0];
jtgenp4x = &PFJets__genP4__fCoordinates_fX[0];
jtgenp4y = &PFJets__genP4__fCoordinates_fY[0];
jtgenp4z = &PFJets__genP4__fCoordinates_fZ[0];
jtgenp4t = &PFJets__genP4__fCoordinates_fT[0];
//
jtn = &PFJets__ncand_[0];
jtnch = &PFJets__chm_[0];
jtnnh = &PFJets__nhm_[0];
jtnne = &PFJets__phm_[0];
jtnce = &PFJets__elm_[0];
jtnmu = &PFJets__mum_[0];
jtchf = &PFJets__chf_[0];
jtnhf = &PFJets__nhf_[0];
//jtnef = &PFJets__phf_[0];
jtnef = &PFJets__nemf_[0];
//jtcef = &PFJets__elf_[0];
jtcef = &PFJets__cemf_[0];
jtmuf = &PFJets__muf_[0];
//
gen_jtp4x = &GenJets__fCoordinates_fX[0];
gen_jtp4y = &GenJets__fCoordinates_fY[0];
gen_jtp4z = &GenJets__fCoordinates_fZ[0];
gen_jtp4t = &GenJets__fCoordinates_fT[0];
if (_jp_ak4ak8) {
t4_jtp4x = &t4_PFJets__P4__fCoordinates_fX[0];
t4_jtp4y = &t4_PFJets__P4__fCoordinates_fY[0];
t4_jtp4z = &t4_PFJets__P4__fCoordinates_fZ[0];
t4_jtp4t = &t4_PFJets__P4__fCoordinates_fT[0];
t4_jta = &t4_PFJets__area_[0];
t4_jtjes = &t4_PFJets__cor_[0];
t4_jtidloose = &t4_PFJets__looseID_[0];
t4_jtidtight = &t4_PFJets__tightID_[0];
if (_mc) {
t4gen_jtp4x = &t4_GenJets__fCoordinates_fX[0];
t4gen_jtp4y = &t4_GenJets__fCoordinates_fY[0];
t4gen_jtp4z = &t4_GenJets__fCoordinates_fZ[0];
t4gen_jtp4t = &t4_GenJets__fCoordinates_fT[0];
}
}
//assert(_jp_algo=="AK4" || _jp_algo=="AK8");
const char *a = _jp_algo.c_str();
cout << "\nCONFIGURATION DUMP:" << endl;
cout << "-------------------" << endl;
cout << Form("Running over %sPF",a) << endl;
if(_mc) cout << "Running over MC" << endl;
if(_dt) cout << "Running over data" << endl;
cout << (_jp_redoJEC ? "Re-calculating JEC on the fly" :
"Using stored JEC in the root tuple") << endl;
cout << (_jp_useIOV ? "Applying" : "Not applying")
<< " time-dependent JEC (IOV)" << endl;
cout << (_jp_doEras ? "Storing all " : "Not storing")
<< " eras separately" << endl;
cout << (_jp_doECALveto ? "Vetoing" : "Not vetoing")
<< " jets in bad ECAL towers" << endl;
cout << (_jp_doCHS ? "Applying" : "Not applying")
<< " CHS through betaStar" << endl;
cout << endl;
if (_dt) {
cout << (_jp_dojson ? "Applying" : "Not applying")
<< " additional JSON selection" << endl;
cout << (_jp_doRunHistos ? "Storing" : "Not storing")
<< " additional run-level histograms" << endl;
cout << (_jp_doBasicHistos ? "Storing" : "Not storing")
<< " basic set of histograms" << endl;
}
if (_mc) {
cout << (_jp_reweighPU ? "Reweighing" : "Not reweighing")
<< " pileup profile in MC to data" << endl;
cout << (_jp_pthatbins ? "Processing pThat binned samples"
: "Processing \"flat\" samples") << endl;
}
if (_jp_ak4ak8) {
cout << "Adding extra information for AK4/AK8 ratio" << endl;
}
cout << endl;
// Time dependent JEC
if (_jp_useIOV) {
bool isdata = _dt;
iov = new jec::IOV(Form("%sPF",a));
iov->add("RunA",160431,163869,isdata);
iov->add("RunB",165088,167913,isdata);
}
// Full redoing of JEC
const char *s;
const char *p = "CondFormats/JetMETObjects/data/";
//const char *t = "GR_R_42_V23_";
string jecgt = _jp_jecgt + "_" + (_dt ? "DATA" : "MC") + "_";
const char *t = jecgt.c_str();
_JEC = 0;
_L1RC = 0;
{
cout << "Loading "<<a<<"PF JEC" << endl;
s = Form("%s%sL1FastJet_%sPF.txt",p,t,a); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l1 = new JetCorrectorParameters(s);
s = Form("%s%sL2Relative_%sPF.txt",p,t,a); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l2 = new JetCorrectorParameters(s);
s = Form("%s%sL3Absolute_%sPF.txt",p,t,a); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l3 = new JetCorrectorParameters(s);
s = Form("%s%sL2L3Residual_%sPF.txt",p,t,a); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l2l3res = new JetCorrectorParameters(s);
vector<JetCorrectorParameters> vpar;
vpar.push_back(*par_l1);
vpar.push_back(*par_l2);
vpar.push_back(*par_l3);
if (_dt) vpar.push_back(*par_l2l3res);
_JEC = new FactorizedJetCorrector(vpar);
// For type-I MET
s = Form("%s%sL1FastJet_%sPF.txt",p,t,a); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l1rc = new JetCorrectorParameters(s);
vector<JetCorrectorParameters> vrc;
vrc.push_back(*par_l1rc);
_L1RC = new FactorizedJetCorrector(vrc);
} // JEC redone
assert(_JEC);
assert(_L1RC);
// Full redoing of JEC
_JEC_ak4pf = 0;
if (_jp_ak4ak8) {
cout << "Loading "<<a<<"PF JEC" << endl;
s = Form("%s%sL1FastJet_%sPF.txt",p,t,"AK4"); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l1 = new JetCorrectorParameters(s);
s = Form("%s%sL2Relative_%sPF.txt",p,t,"AK4"); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l2 = new JetCorrectorParameters(s);
s = Form("%s%sL3Absolute_%sPF.txt",p,t,"AK4"); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l3 = new JetCorrectorParameters(s);
s = Form("%s%sL2L3Residual_%sPF.txt",p,t,"AK4"); cout<<s<<endl<<flush;
JetCorrectorParameters *par_l2l3res = new JetCorrectorParameters(s);
vector<JetCorrectorParameters> vpar;
vpar.push_back(*par_l1);
vpar.push_back(*par_l2);
vpar.push_back(*par_l3);
if (_dt) vpar.push_back(*par_l2l3res);
_JEC_ak4pf = new FactorizedJetCorrector(vpar);
assert(_JEC_ak4pf);
} // JEC redone
_jecUnc = 0;
if (_dt) {
s = Form("%s%sUncertainty_%sPFchs.txt",p,t,a);
cout<<"**"<<s<<endl<<flush;
_jecUnc = new JetCorrectionUncertainty(s);
}
// Set list of triggers
for (int itrg = 0; itrg != _jp_ntrigger; ++itrg) {
_triggers.push_back(_jp_triggers[itrg]);
}
// Load latest JSON selection
if (_dt && _jp_dojson) loadJSON(_jp_json.c_str());
// Load PU profiles for MC reweighing
if (_mc && _jp_reweighPU) loadPUProfiles(_jp_pudata.c_str(),
_jp_pumc.c_str());
// load ECAL veto file for cleaning data
if (_jp_doECALveto) loadECALveto(_jp_ecalveto.c_str());
// Add these runs to the manual veto list
if (_dt) {
// Veto list for 38X 36/pb
//_runveto.insert(142418);
// _runveto.insert(162765); // rate 30% in all triggers for 1.1/fb
}
// load luminosity tables (prescales now stored in event)
if (_dt && _jp_dolumi) loadLumi(_jp_lumifile.c_str());
if (_mc) cout << Form("Running on MC produced with %1.3g nb-1 (%ld evts)",
1000. * _entries / _jp_xsecMinBias,
(long int)_entries) << endl;
if (_dt) cout << Form("Running on %ld events of data",
(long int)_entries) << endl;
// Initialize histograms for different epochs and DQM selections
if (_jp_doBasicHistos) {
initBasics("Standard");
if (_dt && _jp_doEras) {
initBasics("RunA");
initBasics("RunB");
}
}
if (_dt && _jp_doRunHistos) {
initRunHistos("Runs",0.,3.);
initRunHistos("RunsBarrel",0.,1.);
initRunHistos("RunsTransition",1.,2.);
initRunHistos("RunsEndcap",2.,3.);
}
// Report memory usage to avoid malloc problems when writing file
*ferr << "Beginning Loop() proper:" << endl << flush;
cout << "Beginning Loop() proper:" << endl << flush;
gSystem->GetMemInfo(&info);
*ferr <<Form("MemInfo(Tot:%d, Used:%d, Free:%d, Stot:%d, SUsed:%d, SFree:%d",
info.fMemTotal, info.fMemUsed, info.fMemFree,
info.fSwapTotal, info.fSwapUsed, info.fSwapFree) << endl<<flush;
cout << Form("MemInfo(Tot:%d, Used:%d, Free:%d, Stot:%d, SUsed:%d, SFree:%d",
info.fMemTotal, info.fMemUsed, info.fMemFree,
info.fSwapTotal, info.fSwapUsed, info.fSwapFree) << endl<<flush;
TStopwatch stop;
stop.Start();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=nskip; jentry<nentries+nskip;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
Long64_t jentry5 = jentry;
if (_jp_ak4ak8 && _dt) {
jentry5 = ak4entry[EvtHdr__mRun][EvtHdr__mLumi][EvtHdr__mEvent];
if (jentry5==0 && jentry!=0) continue;
}
if (_jp_ak4ak8 && _mc) {
Int_t npu = EvtHdr__mINTPU + 500*EvtHdr__mOOTPUEarly
+ 250000*EvtHdr__mOOTPULate;
jentry5 = ak4entrymc[EvtHdr__mPthat][npu];
if (jentry5==0 && jentry!=0) continue;
}
if (fChain2) fChain2->GetEntry(jentry5);
// For jackknife in MC (and now data as well)
_entry = jentry5;
if (jentry%50000==0) cout << "." << flush;
if (jentry==10000 || jentry==100000 || jentry==1000000 || jentry==5000000){
cout << endl
<< Form("Processed %ld events (%1.1f%%) in %1.0f sec. ETA:",
(long int)jentry, 100.*jentry/ntot,
stop.RealTime()) << endl;
TDatime now; now.Set(now.Convert()+stop.RealTime()*ntot/jentry);
now.Print();
stop.Continue();
}
// Set auxiliary event variables (jets, triggers later)
assert(!_jp_pthatbins || hmcweight);
pthat = EvtHdr__mPthat;
weight = (_jp_pthatbins ?
hmcweight->GetBinContent(hmcweight->FindBin(pthat)) :
EvtHdr__mWeight);
// START TEMP PATCH ///
//if (_mc && !_jp_pthatbins && fabs(weight-1)<1e-4) {
//weight = pow(pthat,-4.5);
//}
// END TEMP PATCH //
run = EvtHdr__mRun;
evt = EvtHdr__mEvent;
lbn = EvtHdr__mLumi;
trpu = EvtHdr__mTrPu;
itpu = EvtHdr__mINTPU;
//itpu = EvtHdr__mINTPU / 6.; // TEMP PATCH
ootpulate = EvtHdr__mOOTPULate;
ootpuearly = EvtHdr__mOOTPUEarly;
if (_dt) {
//trpu = getTruePU(run, lbn);
}
npv = EvtHdr__mNVtx;
npvgood = EvtHdr__mNVtxGood;
pvx = EvtHdr__mPVx;
pvy = EvtHdr__mPVy;
pvz = EvtHdr__mPVz;
pvndof = EvtHdr__mPVndof;
bsx = EvtHdr__mBSx;
bsy = EvtHdr__mBSy;
rho = EvtHdr__mPFRho;
met = PFMet__et_;
metphi = PFMet__phi_;
metsumet = PFMet__sumEt_;
njt = PFJets__; //assert(njt < kMaxPFJets_);
t4_njt = t4_PFJets__;
t4gen_njt = t4_GenJets__;
assert(njt<_njt);
if (!(njt < _njt)) {
*ferr << "Array overflow: njt = " << njt
<< " > njtmax=" << _njt << endl;
cout << "Array overflow: njt = "<< njt
<< " > njtmax=" << _njt << endl;
cout << flush;
assert(njt<_njt);
}
/*
if (!(njt <= kMaxPFJets_ //&& c_njt <= kMaxCaloJets_
//&& t4c_njt <= kMaxCaloJets_
&& (!_jp_ak4ak8 || t4_njt <= kMaxPFJets_)
&& (!_jp_ak4ak8 || t4gen_njt <= kMaxGenJets_) )) {
*ferr << "Array overflow: njt = "<<njt//<<", c_njt = "<<c_njt
<<", t4_njt = "<<t4_njt//<<", t4c_njt = "<<t4c_njt
<<", t4gen_njt = "<<t4gen_njt<<endl;
cout << "Array overflow: njt = "<<njt//<<", c_njt = "<<c_njt
<<", t4_njt = "<<t4_njt//<<", t4c_njt = "<<t4c_njt
<<", t4gen_njt = "<<t4gen_njt<<endl;
njt = min(njt, kMaxPFJets_);//PFJets__);
//c_njt = min(c_njt, kMaxCaloJets_);//CaloJets__);
t4_njt = min(t4_njt, kMaxPFJets_);//PFJets__);
t4c_njt = min(t4c_njt, kMaxCaloJets_);//PFJets__);
t4gen_njt = min(t4gen_njt, kMaxGenJets_);//PFJets__);
}
*/
gen_njt = GenJets__;
if (_debug) {
cout << endl << flush;
Show(jentry, jentry5);
cout << endl << flush;
if (_jp_ak4ak8) {
cout << "AK4AK8PF: t4_njt="<<t4_njt<<"("<<t4_PFJets__<<")"<<endl;
cout << "EVENT: " << jentry << ", " << jentry5 << endl;
cout << "mRun: "<<EvtHdr__mRun<<" vs "<<t4_EvtHdr__mRun << endl;
cout << "mLumi: "<<EvtHdr__mLumi<<" vs "<<t4_EvtHdr__mLumi << endl;
cout << "mEvent: "<<EvtHdr__mEvent<<" vs "<<t4_EvtHdr__mEvent << endl;
cout << endl << flush;
assert(EvtHdr__mRun == t4_EvtHdr__mRun);
assert(EvtHdr__mEvent == t4_EvtHdr__mEvent);
}
}
// Check if duplicate
if (_dt && _jp_checkduplicates) {
set<int>& events = _duplicates[run][lbn];
if (events.find(evt)!=events.end()) {
++_nbadevts_dup;
continue;
}
events.insert(evt);
}
++cnt["01all"];
// Check if good run/LS, including JSON selection
if (_dt && _jp_dojson) {
// Does the run/LS pass the latest JSON selection?
if (_json[run][lbn]==0) {
_badjson.insert(pair<int, int>(run, lbn));
++_nbadevts_json;
continue;
}
} // _dt && _jp_dojson
if (_dt && _jp_dolumi) {
// Do we have the run listed in the .csv file?
map<int, map<int, float> >::const_iterator irun = _lums.find(run);
if (irun==_lums.end()) {
_badruns.insert(run);
++_nbadevts_run;
continue;
}
// Do we have the LS listed in the .csv file?
map<int, float>::const_iterator ils = irun->second.find(lbn);
if (ils==irun->second.end()) {
_badlums.insert(pair<int, int>(run,lbn));
++_nbadevts_ls;
continue;
}
// Does the .csv file list a non-zero luminosity?
if (ils->second==0) {
_nolums.insert(pair<int, int>(run, lbn));
++_nbadevts_lum;
//continue; // Could be Poisson fluctuation to zero
}
} // _dt && _jp_dolumi
// Do we exercise run veto based on cross section stability?
if (_runveto.find(run)!=_runveto.end()) {
++_nbadevts_veto;
continue;
}
// Keep track of LBNs
_jt15lums.insert(pair<int, int>(run, lbn));
// Reset event ID
_pass = true;
if (_pass) ++cnt["02ls"];
// Reject events with no vertex
pvrho = tools::oplus(pvx, pvy);
_pass = (_pass && npvgood>0 && pvrho<2.);
if (_pass) ++cnt["03vtx"];
// Event cuts against beam backgrounds
if (_pass && (tools::oplus(pvx-bsx, pvy-bsy)>0.15 ||
pvndof<=4 || fabs(pvz) >= 24.)) {
++_bscounter_bad;
_pass = false;
}
if (_pass) ++_bscounter_good;
if (_pass) ++cnt["04bsc"];
// Event cuts against beam backgrounds
/* // Commented out on Aug 4 for testing
if (_pass && ecalveto &&
((njt>=1 &&
ecalveto->GetBinContent(ecalveto->FindBin(jteta[0],jtphi[0]))!=0) ||
(njt>=2 &&
ecalveto->GetBinContent(ecalveto->FindBin(jteta[1],jtphi[1]))!=0))){
++_ecalcounter_bad;
_pass = false;
} // ecal veto
*/
if (_pass) ++_ecalcounter_good;
if (_pass) ++cnt["05ecal"];
// Check rho
if (_pass && rho>40.) {
++_rhocounter_bad;
_pass = false;
if (_debug)
cout << Form("\nrun:ev:ls %d:%d:%d : rho=%1.1f njt=%d npv=%d"
" jtpt0=%1.1f sumet=%1.1f met=%1.1f\n",
run, lbn, evt, rho, njt, npv,
(njt>0 ? jtpt[0] :0.), metsumet, met) << flush;
}
if (_pass) ++_rhocounter_good;
if (_pass) ++cnt["06rho"];
// Reset prescales (dynamic can change within run)
for (map<std::string, std::map<int, int> >::iterator it
= _prescales.begin(); it != _prescales.end(); ++it) {
it->second[run] = 0;
}
// Fill trigger information
_trigs.clear();
// Add special "mc" trigger
if (_mc) _trigs.insert("mc");
// Simulate other triggers for MC, if so wished
// (this is slow, though)
if (_mc && _jp_domctrigsim) {
for (int itrg = 0; itrg != _jp_ntrigger; ++itrg) {
if (njt>0 && jtpt[0]>_jp_trigthr[itrg]) {
_trigs.insert(_jp_triggers[itrg]);
}
}
} // _jp_domctrigsim
// For data, check trigger bits
if (_debug) cout << "TriggerDecision_.size()=="<<TriggerDecision_.size()<<endl<<flush;
//assert(_mc || TriggerDecision_.size()==10); // 50 ns, only v2
assert(_mc || TriggerDecision_.size()==30); // 23 ns, v2-v4
for (unsigned int itrg = 0; itrg != TriggerDecision_.size(); ++itrg) {
bool pass = (TriggerDecision_[itrg]==1); // -1, 0, 1
string strg = "";
if ( itrg%10 == 0 ) strg = "jt40";
if ( itrg%10 == 1 ) strg = "jt60";
if ( itrg%10 == 2 ) strg = "jt80";
if ( itrg%10 == 3 ) strg = "jt140";
if ( itrg%10 == 4 ) strg = "jt200";
if ( itrg%10 == 5 ) strg = "jt260";
if ( itrg%10 == 6 ) strg = "jt320";
if ( itrg%10 == 7 ) strg = "jt400";
if ( itrg%10 == 8 ) strg = "jt450";
if ( itrg%10 == 9 ) strg = "jt500";
if (itrg>=30) assert(false);
/* // 50 ns
if ( itrg<=0) strg = "jt40";//30";
if (itrg>= 1 && itrg<=1) strg = "jt60";
if (itrg>= 2 && itrg<=2) strg = "jt80";
if (itrg>= 3 && itrg<=3) strg = "jt140";//110";
if (itrg>= 4 && itrg<=4) strg = "jt200";//190";
if (itrg>= 5 && itrg<=5) strg = "jt260";//240";
if (itrg>= 6 && itrg<=6) strg = "jt320";//300";
if (itrg>= 7 && itrg<=7) strg = "jt400";//370"; // up to v10
if (itrg>= 8 && itrg<=8) strg = "jt450"; // prescale=1
if (itrg>= 9 && itrg<=9) strg = "jt500"; // prescale=1
if (itrg>=10) assert(false);
*/
if (pass && strg!="") _trigs.insert(strg);
// Set prescale from event for now
if (L1Prescale_[itrg]>0 && HLTPrescale_[itrg]>0)
_prescales[strg][run] = max(L1Prescale_[itrg] * HLTPrescale_[itrg],
_prescales[strg][run]);
// check prescale
if (pass) {
double prescale = _prescales[strg][run];
if (L1Prescale_[itrg]*HLTPrescale_[itrg]!=prescale) {
cout << "Trigger " << strg << ", "
<< "Prescale(txt file) = " << prescale << endl;
cout << "L1 = " << L1Prescale_[itrg] << ", "
<< "HLT = " << HLTPrescale_[itrg] << endl;
assert(false);
}
} // if pass
} // for itrg
++_totcounter;
if (_pass) ++_evtcounter;
if (_trigs.size()!=0 && _pass) ++_trgcounter;
if (_trigs.size()!=0 && _pass) ++cnt["07trg"];
// Retrieve event weight
_w0 = (_mc ? weight : 1);
_w = _w0;
// Calculate trigger PU weight
for (unsigned int itrg = 0; itrg != _triggers.size(); ++itrg) {
const char *t = _triggers[itrg].c_str();
_wt[t] = 1.;
// Reweigh in-time pile-up
if (_mc && _jp_reweighPU) {
int k = pudist[t]->FindBin(trpu);
double w1 = pudist[t]->GetBinContent(k);
double w2 = pumc->GetBinContent(k);
Double_t wtrue = (w1==0 || w2==0 ? 1. : w1 / w2);
_wt[t] *= wtrue;
}
} // for itrg
_wt["mc"] = _wt[_jp_mctrig];
// To-do: implement reweighing for k-factor (NLO*NP/LOMC)
// load correct IOV for JEC
if (_dt && _jp_useIOV) {
_JEC = iov->get(run); assert(_JEC);
}
// Calculate pT, eta, phi, y, E and uncorrected pT
// oversmear jets and MET in MC
double mex = met * cos(metphi);
double mey = met * sin(metphi);
for (int i = 0; i != njt; ++i) {
// Kostas stores UNCORRECTED four-vector
p4.SetPxPyPzE(jtp4x[i],jtp4y[i],jtp4z[i],jtp4t[i]);
jtptu[i] = p4.Pt();
jteu[i] = p4.E();
// Recalculate JEC
_JEC->setRho(rho);
_JEC->setNPV(npvgood);
_JEC->setJetA(jta[i]);
_JEC->setJetPt(jtptu[i]);
_JEC->setJetE(jteu[i]);
_JEC->setJetEta(p4.Eta());
jtjesnew[i] = _JEC->getCorrection();
// Recalculate JEC (again to get subcorrections)
_JEC->setRho(rho);
_JEC->setNPV(npvgood);
_JEC->setJetA(jta[i]);
_JEC->setJetPt(jtptu[i]);
_JEC->setJetE(jteu[i]);
_JEC->setJetEta(p4.Eta());
//
vector<float> v = _JEC->getSubCorrections();
assert((_dt && v.size()==4) || (_mc && v.size()==3));
double jec_l1 = v[0];
double jec_l2l3 = v[2]/v[0];
double jec_res = (_dt ? v[3]/v[2] : 1.);
jtjes_l1[i] = jec_l1;
jtjes_l2l3[i] = jec_l2l3;
jtjes_res[i] = jec_res;
assert(jtjesnew[i] = v[v.size()-1]);
// Correct jets
p4 *= jtjesnew[i];
jte[i] = p4.E();
jtpt[i] = p4.Pt();
jteta[i] = p4.Eta();
jtphi[i] = p4.Phi();
jty[i] = p4.Rapidity();
// Calculate gen level info
if (_mc) {
gp4.SetPxPyPzE(jtgenp4x[i],jtgenp4y[i],jtgenp4z[i],jtgenp4t[i]);
jtgenpt[i] = gp4.Pt();
jtgeny[i] = gp4.Rapidity();
}
// Oversmear MC to match data
// Results from Matthias Schroeder, JA July 21, 2011:
// https://indico.cern.ch/getFile.py/access?contribId=2&resId=0&materialId=slides&confId=148123
/* // Turned off on Oct 4 for testing
if (_mc && jtgenr[i] < 0.25 && jtgenpt[i] > 0. &&
jtpt[i] > 0.5*jtgenpt[i] && jtpt[i] < 2.0*jtgenpt[i]) {
double kover = 1.00;
double x = fabs(jteta[i]);
// updated to noResJEC on Aug29 (for |eta|>2.3 in particular)
if (x < 0.5) kover = 1.062;//1.052;
if (x >= 0.5 && x < 1.1) kover = 1.057;//1.057;
if (x >= 1.1 && x < 1.7) kover = 1.089;//1.096;
if (x >= 1.7 && x < 2.3) kover = 1.127;//1.134;
if (x >= 2.3 && x < 5.0) kover = 1.158;//1.288;
double dpt = (kover - 1) * (jtpt[i] - jtgenpt[i]);
double kf = 1 + dpt / jtpt[i];
jte[i] *= kf;
jtpt[i] *= kf;
jtptu[i] *= kf;
// To-do: propagate this to MET also
mex -= dpt * cos(jtphi[i]) / jtjesnew[i];
//mey -= dpt * cos(jtphi[i]) / jtjesnew[i]; // BUG!!!
mey -= dpt * sin(jtphi[i]) / jtjesnew[i]; // BUG!!!
}
*/
met = tools::oplus(mex, mey);
metphi = atan2(mey, mex);
} // for i
if (_mc) {
for (int i = 0; i != gen_njt; ++i) {
genp4.SetPxPyPzE(gen_jtp4x[i],gen_jtp4y[i],gen_jtp4z[i],gen_jtp4t[i]);
gen_jtpt[i] = genp4.Pt();
gen_jteta[i] = genp4.Eta(); // for matching
gen_jtphi[i] = genp4.Phi(); // for matching
gen_jty[i] = genp4.Rapidity();
// for matching
} // for i
if (_jp_ak4ak8) {
for (int i = 0; i != t4gen_njt; ++i) {
genp4.SetPxPyPzE(t4gen_jtp4x[i],t4gen_jtp4y[i],
t4gen_jtp4z[i],t4gen_jtp4t[i]);
t4gen_jtpt[i] = genp4.Pt();
t4gen_jteta[i] = genp4.Eta(); // for matching
t4gen_jtphi[i] = genp4.Phi(); // for matching
t4gen_jty[i] = genp4.Rapidity();
// for matching
} // for i
} // _jp_ak4ak8
} // _mc
// Propagate jec to MET
double ucx = -mex;
double ucy = -mey;
for (int i = 0; i != njt; ++i) {
// Only use jets with corr. pT>25 GeV to equalize data and MC thresholds
if (jtpt[i] > _jp_recopt && fabs(jteta[i])<4.7) {
// Subtract uncorrected jet pT from met, put back corrected
// Also add RC offset to keep PU isotropic
// Remember that MET is negative vector sum
_L1RC->setRho(rho);
_L1RC->setJetA(jta[i]);
_L1RC->setJetPt(jtptu[i]);
_L1RC->setJetE(jteu[i]);
_L1RC->setJetEta(jteta[i]);