29 #include "fastjet/JetDefinition.hh"
30 #include "fastjet/Error.hh"
31 #include "fastjet/CompositeJetStructure.hh"
34 FASTJET_BEGIN_NAMESPACE
38 const double JetDefinition::max_allowable_R = 1000.0;
48 _jet_algorithm(jet_algorithm_in), _Rparam(R_in), _strategy(strategy_in) {
63 oss <<
"Requested R = " << R_in <<
" for jet definition is larger than max_allowable_R = " <<
max_allowable_R;
64 throw Error(oss.str());
70 switch (jet_algorithm_in) {
72 if (nparameters != 0) {
74 oss <<
"ee_kt_algorithm should be constructed with 0 parameters but was called with "
75 << nparameters <<
" parameter(s)\n";
76 throw Error(oss.str());
81 if (nparameters != 2) {
83 oss <<
"(ee_)genkt_algorithm should be constructed with 2 parameters but was called with "
84 << nparameters <<
" parameter(s)\n";
85 throw Error(oss.str());
89 if (nparameters != 1) {
91 oss <<
"The jet algorithm you requested ("
92 << jet_algorithm_in <<
") should be constructed with 1 parameter but was called with "
93 << nparameters <<
" parameter(s)\n";
94 throw Error(oss.str());
113 name <<
"Longitudinally invariant kt algorithm with R = " << R();
116 name <<
"Longitudinally invariant Cambridge/Aachen algorithm with R = "
120 name <<
"Longitudinally invariant anti-kt algorithm with R = "
124 name <<
"Longitudinally invariant generalised kt algorithm with R = "
125 << R() <<
", p = " << extra_param();
128 name <<
"Longitudinally invariant Cambridge/Aachen algorithm with R = "
129 << R() <<
"and a special hack whereby particles with kt < "
130 << extra_param() <<
"are treated as passive ghosts";
132 name <<
"e+e- kt (Durham) algorithm (NB: no R)";
135 name <<
"e+e- generalised kt algorithm with R = "
136 << R() <<
", p = " << extra_param();
139 name <<
"uninitialised JetDefinition (jet_algorithm=undefined_jet_algorithm)" ;
141 throw Error(
"JetDefinition::description(): unrecognized jet_algorithm");
152 if (_recombiner_shared()) _recombiner_shared.
reset();
163 if (other_jd.recombination_scheme() != scheme)
return false;
174 if (_recombiner == 0){
175 throw Error(
"tried to call JetDefinition::delete_recombiner_when_unused() for a JetDefinition without a user-defined recombination scheme");
178 _recombiner_shared.
reset(_recombiner);
185 throw Error(
"tried to call JetDefinition::delete_plugin_when_unused() for a JetDefinition without a plugin");
188 _plugin_shared.
reset(_plugin);
194 switch(_recomb_scheme) {
196 return "E scheme recombination";
198 return "pt scheme recombination";
200 return "pt2 scheme recombination";
202 return "Et scheme recombination";
204 return "Et2 scheme recombination";
206 return "boost-invariant pt scheme recombination";
208 return "boost-invariant pt2 scheme recombination";
211 err <<
"DefaultRecombiner: unrecognized recombination scheme "
213 throw Error(err.str());
222 double weighta, weightb;
224 switch(_recomb_scheme) {
229 pab.
reset(pa.px()+pb.px(),
245 weighta = pa.
perp2();
246 weightb = pb.
perp2();
250 err <<
"DefaultRecombiner: unrecognized recombination scheme "
252 throw Error(err.str());
255 double perp_ab = pa.
perp() + pb.
perp();
256 if (perp_ab != 0.0) {
257 double y_ab = (weighta * pa.
rap() + weightb * pb.
rap())/(weighta+weightb);
260 double phi_a = pa.
phi(), phi_b = pb.
phi();
261 if (phi_a - phi_b > pi) phi_b += twopi;
262 if (phi_a - phi_b < -pi) phi_b -= twopi;
263 double phi_ab = (weighta * phi_a + weightb * phi_b)/(weighta+weightb);
273 pab.
reset(0.0, 0.0, 0.0, 0.0);
279 switch(_recomb_scheme) {
289 double newE = sqrt(p.
perp2()+p.pz()*p.pz());
302 double rescale = p.E()/sqrt(p.
perp2()+p.pz()*p.pz());
303 p.
reset_momentum(rescale*p.px(), rescale*p.py(), rescale*p.pz(), p.E());
312 err <<
"DefaultRecombiner: unrecognized recombination scheme "
314 throw Error(err.str());
319 throw Error(
"set_ghost_separation_scale not supported");
338 if (pieces.size()>0){
340 for (
unsigned int i=1; i<pieces.size(); i++)
356 return join(vector<PseudoJet>(1,j1), recombiner);
362 vector<PseudoJet> pieces;
363 pieces.push_back(j1);
364 pieces.push_back(j2);
365 return join(pieces, recombiner);
371 vector<PseudoJet> pieces;
372 pieces.push_back(j1);
373 pieces.push_back(j2);
374 pieces.push_back(j3);
375 return join(pieces, recombiner);
381 vector<PseudoJet> pieces;
382 pieces.push_back(j1);
383 pieces.push_back(j2);
384 pieces.push_back(j3);
385 pieces.push_back(j4);
386 return join(pieces, recombiner);
392 FASTJET_END_NAMESPACE