25 FASTJET_BEGIN_NAMESPACE
33 double iminMassDrop,
double imaxMassDrop,
34 double iminY,
double imaxY,
35 double iminDeltaR,
double imaxDeltaR,
39 muMin_(iminMassDrop), muMax_(imaxMassDrop),
40 yMin_(iminY), yMax_(imaxY),
41 dRMin_(iminDeltaR), dRMax_(imaxDeltaR),
49 std::ostringstream oss;
50 oss <<
"CMSBoostedTauSeedingAlgorithm algorithm";
58 if ( maxDepth != -1 && depth > maxDepth )
return;
59 fastjet::PseudoJet subjet1, subjet2;
60 bool hasSubjets = jet.has_parents(subjet1, subjet2);
61 if ( !hasSubjets )
return;
62 std::string depth_and_idx_string_subjet1 = depth_and_idx_string;
63 if ( depth_and_idx_string_subjet1.length() > 0 ) depth_and_idx_string_subjet1.append(
".");
64 depth_and_idx_string_subjet1.append(
"0");
65 for (
int iSpace = 0; iSpace <
depth; ++iSpace ) {
68 std::cout <<
" jetConstituent #" << depth_and_idx_string_subjet1 <<
" (depth = " << depth <<
"): Pt = " << subjet1.pt() <<
"," 69 <<
" eta = " << subjet1.eta() <<
", phi = " << subjet1.phi() <<
", mass = " << subjet1.m()
70 <<
" (constituents = " << subjet1.constituents().size() <<
")" << std::endl;
72 std::string depth_and_idx_string_subjet2 = depth_and_idx_string;
73 if ( depth_and_idx_string_subjet2.length() > 0 ) depth_and_idx_string_subjet2.append(
".");
74 depth_and_idx_string_subjet2.append(
"1");
75 for (
int iSpace = 0; iSpace <
depth; ++iSpace ) {
78 std::cout <<
" jetConstituent #" << depth_and_idx_string_subjet2 <<
" (depth = " << depth <<
"): Pt = " << subjet2.pt() <<
"," 79 <<
" eta = " << subjet2.eta() <<
", phi = " << subjet2.phi() <<
", mass = " << subjet2.m()
80 <<
" (constituents = " << subjet2.constituents().size() <<
")" << std::endl;
82 for (
int iSpace = 0; iSpace <
depth; ++iSpace ) {
85 double dR = subjet1.delta_R(subjet2);
86 std::cout <<
" (mass-drop @ " << depth_and_idx_string <<
" = " <<
std::max(subjet1.m(), subjet2.m())/jet.m() <<
", dR = " << dR <<
")" << std::endl;
91 const float etaMax_ = 3.0;
93 std::cout <<
"<CMSBoostedTauSeedingAlgorithm::findSubjets>:" << std::endl;
94 std::cout <<
" jet: Pt = " << jet.pt() <<
", eta = " << jet.eta() <<
", phi = " << jet.phi() <<
", mass = " << jet.m() << std::endl;
97 PseudoJet subjet1, subjet2;
98 bool hasSubjets = jet.has_parents(subjet1, subjet2);
101 if ( subjet1.m2() < subjet2.m2() ) {
104 double dR = subjet1.delta_R(subjet2);
105 double kT = subjet1.kt_distance(subjet2);
106 double mu = ( jet.m() > 0. ) ?
107 sqrt(
std::max(subjet1.m2(), subjet2.m2())/jet.m2()) : -1.;
109 if ( subjet1.pt() >
ptMin_ && fabs(subjet1.eta()) < etaMax_ && subjet2.pt() >
ptMin_ && fabs(subjet2.eta()) < etaMax_ && dR >
dRMin_ && dR < dRMax_ && mu >
muMin_ && mu <
muMax_ && kT < (
yMax_*jet.m2()) && kT > (
yMin_*jet.m2()) ) {
111 return std::make_pair(subjet1, subjet2);
112 }
else if ( subjet1.pt() >
ptMin_ ) {
113 return findSubjets(subjet1, depth + 1, subjetsFound);
114 }
else if ( subjet2.pt() >
ptMin_ ) {
115 return findSubjets(subjet2, depth + 1, subjetsFound);
118 subjetsFound =
false;
119 PseudoJet dummy_subjet1, dummy_subjet2;
120 return std::make_pair(dummy_subjet1, dummy_subjet2);
126 std::cout <<
"<CMSBoostedTauSeedingAlgorithm::findSubjets>:" << std::endl;
127 std::cout <<
" jet: Pt = " << jet.pt() <<
", eta = " << jet.eta() <<
", phi = " << jet.phi() <<
", mass = " << jet.m() << std::endl;
134 bool subjetsFound =
false;
135 std::pair<PseudoJet, PseudoJet> subjets =
findSubjets(jet, 0, subjetsFound);
136 if ( subjetsFound ) {
138 PseudoJet subjet1 = subjets.first;
139 PseudoJet subjet2 = subjets.second;
141 std::cout <<
"before recombination:" << std::endl;
142 std::cout <<
" subjet #1: Pt = " << subjet1.pt() <<
", eta = " << subjet1.eta() <<
", phi = " << subjet1.phi() <<
", mass = " << subjet1.m() << std::endl;
143 std::cout <<
" subjet #2: Pt = " << subjet2.pt() <<
", eta = " << subjet2.eta() <<
", phi = " << subjet2.phi() <<
", mass = " << subjet2.m() << std::endl;
146 const JetDefinition::Recombiner* rec = jet.associated_cluster_sequence()->jet_def().recombiner();
147 PseudoJet result_local =
join(subjet1, subjet2, *rec);
149 std::cout <<
"after recombination:" << std::endl;
150 std::vector<fastjet::PseudoJet> subjets = result_local.pieces();
152 for ( std::vector<fastjet::PseudoJet>::const_iterator subjet = subjets.begin();
153 subjet != subjets.end(); ++subjet ) {
154 std::cout <<
" subjet #" << idx_subjet <<
": Pt = " << subjet->pt() <<
", eta = " << subjet->eta() <<
", phi = " << subjet->phi() <<
", mass = " << subjet->m()
155 <<
" (#constituents = " << subjet->constituents().size() <<
")" << std::endl;
156 std::vector<fastjet::PseudoJet> constituents = subjet->constituents();
157 int idx_constituent = 0;
158 for ( std::vector<fastjet::PseudoJet>::const_iterator constituent = constituents.begin();
159 constituent != constituents.end(); ++constituent ) {
160 if ( constituent->pt() < 1.e-3 )
continue;
161 std::cout <<
" constituent #" << idx_constituent <<
": Pt = " << constituent->pt() <<
", eta = " << constituent->eta() <<
", phi = " << constituent->phi() <<
"," 162 <<
" mass = " << constituent->m() << std::endl;
171 s->
_mu = ( jet.m2() > 0. ) ?
sqrt(
std::max(subjet1.m2(), subjet2.m2())/jet.m2()) : 0.;
172 s->
_y = ( jet.m2() > 0. ) ? subjet1.kt_distance(subjet2)/jet.m2() : 0.;
173 s->
_dR = subjet1.delta_R(subjet2);
174 s->
_pt = subjet2.pt();
176 result_local.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(s));
182 std::cout <<
"No subjets found." << std::endl;
191 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
double yMax_
the max value of the asymmetry parameter
virtual PseudoJet result(const PseudoJet &jet) const
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::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
virtual std::string description() const