3#include "fastjet/ClusterSequence.hh"
4#include "fastjet/SISConeSphericalPlugin.hh"
7#include "siscone/spherical/momentum.h"
8#include "siscone/spherical/siscone.h"
13FASTJET_BEGIN_NAMESPACE
16using namespace siscone_spherical;
20 (*this) =
PseudoJet(four_vector.px,four_vector.py,four_vector.pz,
27namespace siscone_plugin_internal{
34 class SISConeSphericalUserScale :
public siscone_spherical::CSphsplit_merge::Cuser_scale_base{
41 : _user_scale(user_scale), _cs(cs){}
44 virtual double operator()(
const siscone_spherical::CSphjet &jet)
const{
45 return _user_scale->result(_build_PJ_from_Cjet(jet));
50 virtual bool is_larger(
const siscone_spherical::CSphjet &a,
const siscone_spherical::CSphjet &b)
const{
51 return _user_scale->is_larger(_build_PJ_from_Cjet(a), _build_PJ_from_Cjet(b));
62 PseudoJet _build_PJ_from_Cjet(
const siscone_spherical::CSphjet &jet)
const{
63 PseudoJet j(jet.v.px, jet.v.py, jet.v.pz, jet.v.E);
64 j.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(
65 new SISConeSphericalPlugin::UserScaleBaseStructureType<siscone_spherical::CSphjet>(jet,_cs)));
69 const SISConeSphericalPlugin::UserScaleBase *_user_scale;
70 const ClusterSequence & _cs;
81SharedPtr<SISConeSphericalPlugin> SISConeSphericalPlugin::stored_plugin;
82SharedPtr<std::vector<PseudoJet> > SISConeSphericalPlugin::stored_particles;
83SharedPtr<CSphsiscone> SISConeSphericalPlugin::stored_siscone;
92 const string on =
"on";
93 const string off =
"off";
95 string sm_scale_string =
"split-merge uses " +
98 desc <<
"Spherical SISCone jet algorithm with " ;
100 if (_progressive_removal)
101 desc <<
"progressive-removal mode, ";
104 desc <<
"n_pass_max = " <<
n_pass_max () <<
", ";
106 if (_progressive_removal && _user_scale) {
107 desc <<
"using a user-defined scale for ordering of stable cones";
108 string user_scale_desc = _user_scale->description();
109 if (user_scale_desc !=
"") desc <<
" (" << user_scale_desc <<
")";
111 desc << sm_scale_string;
113 if (!_progressive_removal){
114 desc <<
"caching turned " << (
caching() ? on : off);
115 desc <<
", SM stop scale = " << _split_merge_stopping_scale;
119 if (_use_E_weighted_splitting){
120 desc <<
", using E-weighted splitting";
123 if (_use_jet_def_recombiner){
124 desc <<
", using jet-definition's own recombiner";
129 if (siscone.merge_identical_protocones) {
130 desc <<
", and (IR unsafe) merge_indentical_protocones=true" ;
133 desc <<
", SISCone code v" << siscone_version();
144 CSphsiscone local_siscone;
145 CSphsiscone * siscone;
147 unsigned n = clust_seq.
jets().size();
149 bool new_siscone =
true;
151 if (
caching() && !_progressive_removal) {
157 if (stored_siscone.get() != 0) {
158 new_siscone = !(stored_plugin->cone_radius() ==
cone_radius()
159 && stored_plugin->n_pass_max() ==
n_pass_max()
160 && stored_particles->size() == n);
162 for(
unsigned i = 0; i < n; i++) {
166 (*stored_particles)[i]);
173 stored_siscone .reset(
new CSphsiscone );
174 stored_particles.reset(
new std::vector<PseudoJet>(clust_seq.
jets()));
178 siscone = stored_siscone.get();
180 siscone = &local_siscone;
184 siscone->SM_var2_hardest_cut_off = _split_merge_stopping_scale*_split_merge_stopping_scale;
189 siscone->stable_cone_soft_E2_cutoff = ghost_separation_scale()
190 * ghost_separation_scale();
192 siscone->set_E_weighted_splitting(_use_E_weighted_splitting);
197 std::vector<CSphmomentum> siscone_momenta(n);
198 for(
unsigned i = 0; i < n; i++) {
200 siscone_momenta[i] = CSphmomentum(p.px(), p.py(), p.pz(), p.E());
205 if (_progressive_removal){
209 internal_scale.
reset(
new siscone_plugin_internal::SISConeSphericalUserScale(_user_scale, clust_seq));
210 siscone->set_user_scale(internal_scale.
get());
212 siscone->compute_jets_progressive_removal(siscone_momenta,
cone_radius(),
229 int njet = siscone->jets.size();
238 for (
int ijet = njet-1; ijet >= 0; ijet--) {
239 const CSphjet & jet = siscone->jets[ijet];
244 int jet_k = jet.contents[0];
245 for (
unsigned ipart = 1; ipart < jet.contents.size(); ipart++) {
249 int jet_j = jet.contents[ipart];
253 if (_use_jet_def_recombiner) {
269 double d_iB = clust_seq.
jets()[jet_k].perp2();
273 extras->_pass[clust_seq.
jets()[jet_k].cluster_hist_index()] = jet.pass;
277 for (
unsigned ipass = 0; ipass < siscone->protocones_list.size(); ipass++) {
278 for (
unsigned ipc = 0; ipc < siscone->protocones_list[ipass].size(); ipc++) {
279 PseudoJet protocone(siscone->protocones_list[ipass][ipc]);
281 extras->_protocones.push_back(protocone);
284 extras->_most_ambiguous_split = siscone->most_ambiguous_split;
287 extras->_jet_def_plugin =
this;
void plugin_record_iB_recombination(int jet_i, double diB)
record the fact that there has been a recombination between jets()[jet_i] and the beam,...
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
void plugin_associate_extras(Extras *extras_in)
the plugin can associate some extra information with the ClusterSequence object by calling this funct...
static std::ostream * fastjet_banner_stream()
returns a pointer to the stream to be used to print banners (cout by default).
void plugin_record_ij_recombination(int jet_i, int jet_j, double dij, int &newjet_k)
record the fact that there has been a recombination between jets()[jet_i] and jets()[jet_k],...
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
PseudoJet()
default constructor, which as of FJ3.0 provides an object for which all operations are now valid and ...
void set_user_index(const int index)
set the user_index, intended to allow the user to add simple identifying information to a particle/je...
base class for user-defined ordering of stable cones (used for prorgessive removal)
double cone_radius() const
the cone radius
bool caching() const
indicates whether caching is turned on or not.
double overlap_threshold() const
Fraction of overlap energy in a jet above which jets are merged and below which jets are split.
int n_pass_max() const
the maximum number of passes of stable-cone searching (<=0 is same as infinity).
double protojet_Emin() const
minimum energy for a protojet to be considered in the split-merge step of the algorithm
double protojet_or_ghost_Emin() const
return the scale to be passed to SISCone as the protojet_Emin – if we have a ghost separation scale t...
SplitMergeScale split_merge_scale() const
indicates scale used in split-merge
virtual void reset_stored_plugin() const
call the re-clustering itself
virtual std::string description() const
plugin description
SISConeSphericalPlugin(double cone_radius_in, double overlap_threshold_in, int n_pass_max_in=0, double protojet_Emin_in=0.0, bool caching_in=false, SplitMergeScale split_merge_scale_in=SM_Etilde, double split_merge_stopping_scale_in=0.0)
Main constructor for the SISConeSpherical Plugin class.
virtual void run_clustering(ClusterSequence &) const
really do the clustering work
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....
T * get() const
get the stored pointer
void reset()
reset the pointer to default value (NULL)
bool have_same_momentum(const PseudoJet &jeta, const PseudoJet &jetb)
returns true if the momenta of the two input jets are identical