25 FASTJET_BEGIN_NAMESPACE
47 verbosity_(verbosity) {}
52 std::ostringstream oss;
53 oss <<
"CMSBoostedTauSeedingAlgorithm algorithm";
60 if (maxDepth != -1 && depth > maxDepth)
62 fastjet::PseudoJet subjet1, subjet2;
63 bool hasSubjets = jet.has_parents(subjet1, subjet2);
66 std::string depth_and_idx_string_subjet1 = depth_and_idx_string;
67 if (depth_and_idx_string_subjet1.length() > 0)
68 depth_and_idx_string_subjet1.append(
".");
69 depth_and_idx_string_subjet1.append(
"0");
70 for (
int iSpace = 0; iSpace <
depth; ++iSpace) {
73 std::cout <<
" jetConstituent #" << depth_and_idx_string_subjet1 <<
" (depth = " << depth
74 <<
"): Pt = " << subjet1.pt() <<
","
75 <<
" eta = " << subjet1.eta() <<
", phi = " << subjet1.phi() <<
", mass = " << subjet1.m()
76 <<
" (constituents = " << subjet1.constituents().size() <<
")" << std::endl;
78 std::string depth_and_idx_string_subjet2 = depth_and_idx_string;
79 if (depth_and_idx_string_subjet2.length() > 0)
80 depth_and_idx_string_subjet2.append(
".");
81 depth_and_idx_string_subjet2.append(
"1");
82 for (
int iSpace = 0; iSpace <
depth; ++iSpace) {
85 std::cout <<
" jetConstituent #" << depth_and_idx_string_subjet2 <<
" (depth = " << depth
86 <<
"): Pt = " << subjet2.pt() <<
","
87 <<
" eta = " << subjet2.eta() <<
", phi = " << subjet2.phi() <<
", mass = " << subjet2.m()
88 <<
" (constituents = " << subjet2.constituents().size() <<
")" << std::endl;
90 for (
int iSpace = 0; iSpace <
depth; ++iSpace) {
93 double dR = subjet1.delta_R(subjet2);
94 std::cout <<
" (mass-drop @ " << depth_and_idx_string <<
" = " <<
std::max(subjet1.m(), subjet2.m()) / jet.m()
95 <<
", dR = " << dR <<
")" << std::endl;
99 const PseudoJet&
jet,
int depth,
bool& subjetsFound)
const {
102 std::cout <<
"<CMSBoostedTauSeedingAlgorithm::findSubjets>:" << std::endl;
103 std::cout <<
" jet: Pt = " << jet.pt() <<
", eta = " << jet.eta() <<
", phi = " << jet.phi()
104 <<
", mass = " << jet.m() << std::endl;
107 PseudoJet subjet1, subjet2;
108 bool hasSubjets = jet.has_parents(subjet1, subjet2);
111 if (subjet1.m2() < subjet2.m2()) {
114 double dR = subjet1.delta_R(subjet2);
115 double kT = subjet1.kt_distance(subjet2);
116 double mu = (jet.m() > 0.) ?
sqrt(
std::max(subjet1.m2(), subjet2.m2()) / jet.m2()) : -1.;
118 if (subjet1.pt() >
ptMin_ && fabs(subjet1.eta()) < etaMax_ && subjet2.pt() >
ptMin_ &&
119 fabs(subjet2.eta()) < etaMax_ && dR >
dRMin_ && dR < dRMax_ && mu >
muMin_ && mu <
muMax_ &&
120 kT < (
yMax_ * jet.m2()) && kT > (
yMin_ * jet.m2())) {
122 return std::make_pair(subjet1, subjet2);
123 }
else if (subjet1.pt() >
ptMin_) {
124 return findSubjets(subjet1, depth + 1, subjetsFound);
125 }
else if (subjet2.pt() >
ptMin_) {
126 return findSubjets(subjet2, depth + 1, subjetsFound);
129 subjetsFound =
false;
130 PseudoJet dummy_subjet1, dummy_subjet2;
131 return std::make_pair(dummy_subjet1, dummy_subjet2);
136 std::cout <<
"<CMSBoostedTauSeedingAlgorithm::findSubjets>:" << std::endl;
137 std::cout <<
" jet: Pt = " << jet.pt() <<
", eta = " << jet.eta() <<
", phi = " << jet.phi()
138 <<
", mass = " << jet.m() << std::endl;
145 bool subjetsFound =
false;
146 std::pair<PseudoJet, PseudoJet> subjets =
findSubjets(jet, 0, subjetsFound);
149 PseudoJet subjet1 = subjets.first;
150 PseudoJet subjet2 = subjets.second;
152 std::cout <<
"before recombination:" << std::endl;
153 std::cout <<
" subjet #1: Pt = " << subjet1.pt() <<
", eta = " << subjet1.eta() <<
", phi = " << subjet1.phi()
154 <<
", mass = " << subjet1.m() << std::endl;
155 std::cout <<
" subjet #2: Pt = " << subjet2.pt() <<
", eta = " << subjet2.eta() <<
", phi = " << subjet2.phi()
156 <<
", mass = " << subjet2.m() << std::endl;
159 const JetDefinition::Recombiner* rec = jet.associated_cluster_sequence()->jet_def().recombiner();
160 PseudoJet result_local =
join(subjet1, subjet2, *rec);
162 std::cout <<
"after recombination:" << std::endl;
163 std::vector<fastjet::PseudoJet> subjets = result_local.pieces();
165 for (std::vector<fastjet::PseudoJet>::const_iterator subjet = subjets.begin(); subjet != subjets.end();
167 std::cout <<
" subjet #" << idx_subjet <<
": Pt = " << subjet->pt() <<
", eta = " << subjet->eta()
168 <<
", phi = " << subjet->phi() <<
", mass = " << subjet->m()
169 <<
" (#constituents = " << subjet->constituents().size() <<
")" << std::endl;
170 std::vector<fastjet::PseudoJet> constituents = subjet->constituents();
171 int idx_constituent = 0;
172 for (std::vector<fastjet::PseudoJet>::const_iterator constituent = constituents.begin();
173 constituent != constituents.end();
175 if (constituent->pt() < 1.e-3)
177 std::cout <<
" constituent #" << idx_constituent <<
": Pt = " << constituent->pt()
178 <<
", eta = " << constituent->eta() <<
", phi = " << constituent->phi() <<
","
179 <<
" mass = " << constituent->m() << std::endl;
188 s->
_mu = (jet.m2() > 0.) ?
sqrt(
std::max(subjet1.m2(), subjet2.m2()) / jet.m2()) : 0.;
189 s->
_y = (jet.m2() > 0.) ? subjet1.kt_distance(subjet2) / jet.m2() : 0.;
190 s->
_dR = subjet1.delta_R(subjet2);
191 s->
_pt = subjet2.pt();
193 result_local.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(s));
199 std::cout <<
"No subjets found." << std::endl;
207 FASTJET_END_NAMESPACE
void dumpSubJetStructure(const fastjet::PseudoJet &jet, int depth, int maxDepth, const std::string &depth_and_idx_string) const
double ptMin_
minimum sub-jet pt
double _pt
the value of the pt parameter
int maxDepth_
the max depth for descending into clustering sequence
double _mu
the value of the mass-drop parameter
etaMax_(conf.getParameter< double >("etaMax"))
double yMax_
the max value of the asymmetry parameter
ptMin_(conf.getParameter< double >("ptMin"))
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
double yMin_
the min value of the asymmetry parameter
CMSBoostedTauSeedingAlgorithm(double ptMin, double muMin, double muMax, double yMin, double yMax, double dRMin, double dRMax, int maxDepth, int verbosity=0)
double muMax_
the max value of the mass-drop parameter
double _y
the value of the asymmetry parameter
std::string description() const override
std::pair< PseudoJet, PseudoJet > findSubjets(const PseudoJet &jet, int depth, bool &subjetsFound) const
int verbosity_
flag to enable/disable debug output
static std::string join(char **cmd)
double _dR
the value of the dR parameter
double dRMin_
the min value of the dR parameter
double muMin_
the min value of the mass-drop parameter
PseudoJet result(const PseudoJet &jet) const override