56 float cone_boundaries[] = { 0.05, 0.1, 0.2, 0.3,0.4 };
57 size_t ncone_boundaries =
sizeof(cone_boundaries)/
sizeof(
float);
58 unsigned int nJet = srcJet->size();
59 unsigned int ncand = 0;
60 std::vector<float> numdaughterspt03;
61 std::vector<std::vector<float>> EmFractionEnergyRings(ncone_boundaries+1,std::vector<float>(nJet, 0.));
62 std::vector<std::vector<float>> ChFractionEnergyRings(ncone_boundaries+1,std::vector<float>(nJet, 0.));
63 std::vector<std::vector<float>> NeFractionEnergyRings(ncone_boundaries+1,std::vector<float>(nJet, 0.));
64 std::vector<std::vector<float>> MuFractionEnergyRings(ncone_boundaries+1,std::vector<float>(nJet, 0.));
66 for (
unsigned int ij = 0; ij<nJet; ij++){
68 auto jet = srcJet->ptrAt(ij);
69 int numDaughtersPt03=0;
70 for (
unsigned int ijcone = 0; ijcone<ncone_boundaries; ijcone++){
71 EmFractionEnergyRings[ijcone][ij] = 0;
72 MuFractionEnergyRings[ijcone][ij] = 0;
73 ChFractionEnergyRings[ijcone][ij] = 0;
74 NeFractionEnergyRings[ijcone][ij] = 0;
76 for(
const auto &
d :
jet->daughterPtrVector()){
78 size_t icone = std::lower_bound(&cone_boundaries[0],&cone_boundaries[ncone_boundaries],candDr) - &cone_boundaries[0];
79 float candEnergy =
d->energy();
81 if( pdgid == 22 || pdgid == 11 ) {
82 EmFractionEnergyRings[icone][ij] += candEnergy;
83 }
else if ( pdgid == 13 ) {
84 MuFractionEnergyRings[icone][ij] += candEnergy;
85 }
else if (
d->charge() != 0 ) {
86 ChFractionEnergyRings[icone][ij] += candEnergy;
88 NeFractionEnergyRings[icone][ij] += candEnergy;
90 if(
d->pt()>0.3) numDaughtersPt03+=1;
92 numdaughterspt03.push_back(numDaughtersPt03);
94 auto tab = std::make_unique<nanoaod::FlatTable>(ncand,
name_,
false,
true);
102 tab->addColumn<
float>(
"EmFractionEnergyRing5", EmFractionEnergyRings[5],
"Em energy fraction in ring in dR 0.4 overflow",
nanoaod::FlatTable::FloatColumn);
105 tab->addColumn<
float>(
"ChFractionEnergyRing1", ChFractionEnergyRings[1],
"Ch energy fraction in ring in dR 0.05-0.1",
nanoaod::FlatTable::FloatColumn);
109 tab->addColumn<
float>(
"ChFractionEnergyRing5", ChFractionEnergyRings[5],
"Ch energy fraction in ring in dR 0.4 overflow",
nanoaod::FlatTable::FloatColumn);
112 tab->addColumn<
float>(
"MuFractionEnergyRing1", MuFractionEnergyRings[1],
"Mu energy fraction in ring in dR 0.05-0.1",
nanoaod::FlatTable::FloatColumn);
116 tab->addColumn<
float>(
"MuFractionEnergyRing5", MuFractionEnergyRings[5],
"Mu energy fraction in ring in dR 0.4 overflow",
nanoaod::FlatTable::FloatColumn);
119 tab->addColumn<
float>(
"NeFractionEnergyRing1", NeFractionEnergyRings[1],
"Ne energy fraction in ring in dR 0.05-0.1",
nanoaod::FlatTable::FloatColumn);
123 tab->addColumn<
float>(
"NeFractionEnergyRing5", NeFractionEnergyRings[5],
"Ne energy fraction in ring in dR 0.4 overflow",
nanoaod::FlatTable::FloatColumn);
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
Abs< T >::type abs(const T &t)
double deltaR(double eta1, double eta2, double phi1, double phi2)