2 #include "fastjet/PseudoJet.hh"
3 #include "fastjet/ClusterSequence.hh"
12 Njets_(iConfig.getParameter<
std::
vector<unsigned>>(
"Njets")),
14 ecftype_(iConfig.getParameter<
std::
string>(
"ecftype")),
15 alpha_(iConfig.getParameter<double>(
"alpha")),
16 beta_(iConfig.getParameter<double>(
"beta")) {
18 throw cms::Exception(
"ConfigurationError") <<
"cuts and Njets must be the same size in ECFAdder" << std::endl;
25 for (std::vector<unsigned>::const_iterator
n =
Njets_.begin();
n !=
Njets_.end(); ++
n) {
26 std::ostringstream ecfN_str;
27 std::shared_ptr<fastjet::FunctionOfPseudoJet<double>> pfunc;
30 ecfN_str <<
"ecf" << *
n;
31 pfunc.reset(
new fastjet::contrib::EnergyCorrelator(*
n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
33 ecfN_str <<
"ecfC" << *
n;
34 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorCseries(*
n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
36 ecfN_str <<
"ecfD" << *
n;
38 new fastjet::contrib::EnergyCorrelatorGeneralizedD2(
alpha_,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
40 ecfN_str <<
"ecfN" << *
n;
41 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorNseries(*
n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
43 ecfN_str <<
"ecfM" << *
n;
44 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorMseries(*
n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
46 ecfN_str <<
"ecfU" << *
n;
47 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorUseries(*
n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R));
50 produces<edm::ValueMap<float>>(ecfN_str.str());
67 for (std::vector<unsigned>::const_iterator
n =
Njets_.begin();
n !=
Njets_.end(); ++
n) {
69 std::vector<float> ecfN;
70 ecfN.reserve(
jets->size());
82 auto outT = std::make_unique<edm::ValueMap<float>>();
84 fillerT.insert(
jets, ecfN.begin(), ecfN.end());
93 std::vector<fastjet::PseudoJet> fjParticles;
94 for (
unsigned k = 0;
k <
object->numberOfDaughters(); ++
k) {
96 if (
dp.isNonnull() &&
dp.isAvailable()) {
98 if (
dp->numberOfDaughters() == 0) {
99 if (
object->isWeighted()) {
102 <<
"ECFAdder: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
103 float w = (*weightsHandle_)[
dp];
104 fjParticles.push_back(fastjet::PseudoJet(
dp->px() *
w,
dp->py() *
w,
dp->pz() *
w,
dp->energy() *
w));
106 fjParticles.push_back(fastjet::PseudoJet(
dp->px(),
dp->py(),
dp->pz(),
dp->energy()));
108 auto subjet = dynamic_cast<reco::Jet const*>(
dp.get());
109 for (
unsigned l = 0;
l < subjet->numberOfDaughters(); ++
l) {
110 if (subjet !=
nullptr) {
112 if (subjet->isWeighted()) {
115 <<
"ECFAdder: No weights (e.g. PUPPI) given for weighted jet collection" << std::endl;
116 float w = (*weightsHandle_)[ddp];
117 fjParticles.push_back(fastjet::PseudoJet(ddp->px() *
w, ddp->py() *
w, ddp->pz() *
w, ddp->energy() *
w));
119 fjParticles.push_back(fastjet::PseudoJet(ddp->px(), ddp->py(), ddp->pz(), ddp->energy()));
121 edm::LogWarning(
"MissingJetConstituent") <<
"BasicJet constituent required for ECF computation is missing!";
127 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for ECF computation is missing!";
139 iDesc.
setComment(
"Energy Correlation Functions adder");
142 iDesc.
add<std::vector<unsigned>>(
"Njets", {1, 2, 3})->setComment(
"Number of jets to emulate");
143 iDesc.
add<std::vector<std::string>>(
"cuts", {
"",
"",
""})
144 ->setComment(
"Jet selections for each N value. Size must match Njets.");
145 iDesc.
add<
double>(
"alpha", 1.0)->
setComment(
"alpha factor, only valid for N2");
146 iDesc.
add<
double>(
"beta", 1.0)->
setComment(
"angularity factor");
147 iDesc.
add<
std::string>(
"ecftype",
"")->setComment(
"ECF type: ECF or empty; C; D; N; M; U;");
149 descriptions.
add(
"ECFAdder", iDesc);