3#include "fastjet/ClusterSequence.hh"
4#include "fastjet/SISConePlugin.hh"
7#include "siscone/momentum.h"
8#include "siscone/siscone.h"
13FASTJET_BEGIN_NAMESPACE
16using namespace siscone;
19template<> PseudoJet::PseudoJet(
const siscone::Cmomentum & four_vector) {
20 (*this) =
PseudoJet(four_vector.px,four_vector.py,four_vector.pz,
26namespace siscone_plugin_internal{
33 class SISConeUserScale :
public siscone::Csplit_merge::Cuser_scale_base{
40 : _user_scale(user_scale), _cs(cs){}
43 virtual double operator()(
const siscone::Cjet &jet)
const{
44 return _user_scale->result(_build_PJ_from_Cjet(jet));
49 virtual bool is_larger(
const siscone::Cjet &a,
const siscone::Cjet &b)
const{
50 return _user_scale->is_larger(_build_PJ_from_Cjet(a), _build_PJ_from_Cjet(b));
61 PseudoJet _build_PJ_from_Cjet(
const siscone::Cjet &jet)
const{
62 PseudoJet j(jet.v.px, jet.v.py, jet.v.pz, jet.v.E);
63 j.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(
64 new SISConePlugin::UserScaleBaseStructureType<siscone::Cjet>(jet,_cs)));
68 const SISConePlugin::UserScaleBase *_user_scale;
69 const ClusterSequence & _cs;
80SharedPtr<SISConePlugin> SISConePlugin::stored_plugin;
81SharedPtr<std::vector<PseudoJet> > SISConePlugin::stored_particles;
82SharedPtr<Csiscone> SISConePlugin::stored_siscone;
88string SISConePlugin::description ()
const {
91 const string on =
"on";
92 const string off =
"off";
94 string sm_scale_string =
"split-merge uses " +
95 split_merge_scale_name(Esplit_merge_scale(split_merge_scale()));
97 desc <<
"SISCone jet algorithm with " ;
98 desc <<
"cone_radius = " << cone_radius () <<
", ";
99 if (_progressive_removal)
100 desc <<
"progressive-removal mode, ";
102 desc <<
"overlap_threshold = " << overlap_threshold () <<
", ";
103 desc <<
"n_pass_max = " << n_pass_max () <<
", ";
104 desc <<
"protojet_ptmin = " << protojet_ptmin() <<
", ";
105 if (_progressive_removal && _user_scale) {
106 desc <<
"using a user-defined scale for ordering of stable cones";
107 string user_scale_desc = _user_scale->description();
108 if (user_scale_desc !=
"") desc <<
" (" << user_scale_desc <<
")";
110 desc << sm_scale_string;
112 if (!_progressive_removal){
113 desc <<
", caching turned " << (caching() ? on : off);
114 desc <<
", SM stop scale = " << _split_merge_stopping_scale;
118 if (_use_pt_weighted_splitting){
119 desc <<
", using pt-weighted splitting";
122 if (_use_jet_def_recombiner){
123 desc <<
", using jet-definition's own recombiner";
128 if (siscone.merge_identical_protocones) {
129 desc <<
", and (IR unsafe) merge_indentical_protocones=true" ;
132 desc <<
", SISCone code v" << siscone_version();
143 Csiscone local_siscone;
146 unsigned n = clust_seq.
jets().size();
148 bool new_siscone =
true;
150 if (caching() && !_progressive_removal) {
156 if (stored_siscone.get() != 0) {
157 new_siscone = !(stored_plugin->cone_radius() == cone_radius()
158 && stored_plugin->n_pass_max() == n_pass_max()
159 && stored_particles->size() == n);
161 for(
unsigned i = 0; i < n; i++) {
165 (*stored_particles)[i]);
172 stored_siscone .reset(
new Csiscone );
173 stored_particles.reset(
new std::vector<PseudoJet>(clust_seq.
jets()));
174 reset_stored_plugin();
177 siscone = stored_siscone.get();
179 siscone = &local_siscone;
183 siscone->SM_var2_hardest_cut_off = _split_merge_stopping_scale*_split_merge_stopping_scale;
188 siscone->stable_cone_soft_pt2_cutoff = ghost_separation_scale()
189 * ghost_separation_scale();
191 siscone->set_pt_weighted_splitting(_use_pt_weighted_splitting);
195 std::vector<Cmomentum> siscone_momenta(n);
196 for(
unsigned i = 0; i < n; i++) {
198 siscone_momenta[i] = Cmomentum(p.px(), p.py(), p.pz(), p.E());
203 if (_progressive_removal){
207 internal_scale.
reset(
new siscone_plugin_internal::SISConeUserScale(_user_scale, clust_seq));
208 siscone->set_user_scale(internal_scale.
get());
210 siscone->compute_jets_progressive_removal(siscone_momenta, cone_radius(),
211 n_pass_max(), protojet_or_ghost_ptmin(),
212 Esplit_merge_scale(split_merge_scale()));
214 siscone->compute_jets(siscone_momenta, cone_radius(), overlap_threshold(),
215 n_pass_max(), protojet_or_ghost_ptmin(),
216 Esplit_merge_scale(split_merge_scale()));
222 siscone->recompute_jets(overlap_threshold(), protojet_or_ghost_ptmin(),
223 Esplit_merge_scale(split_merge_scale()));
227 int njet = siscone->jets.size();
236 for (
int ijet = njet-1; ijet >= 0; ijet--) {
237 const Cjet & jet = siscone->jets[ijet];
242 int jet_k = jet.contents[0];
243 for (
unsigned ipart = 1; ipart < jet.contents.size(); ipart++) {
247 int jet_j = jet.contents[ipart];
251 if (_use_jet_def_recombiner) {
267 double d_iB = clust_seq.
jets()[jet_k].perp2();
271 extras->_pass[clust_seq.
jets()[jet_k].cluster_hist_index()] = jet.pass;
275 for (
unsigned ipass = 0; ipass < siscone->protocones_list.size(); ipass++) {
276 for (
unsigned ipc = 0; ipc < siscone->protocones_list[ipass].size(); ipc++) {
277 PseudoJet protocone(siscone->protocones_list[ipass][ipc]);
279 extras->_protocones.push_back(protocone);
282 extras->_most_ambiguous_split = siscone->most_ambiguous_split;
285 extras->_jet_def_plugin =
this;
297void SISConePlugin::reset_stored_plugin()
const{
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.
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)
Implementation of the SISCone algorithm (plugin for fastjet v2.1 upwards)
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