Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013 #include "PrunedRecombPlugin.h"
00014
00015 #include <sstream>
00016 #include <cmath>
00017 using namespace std;
00018
00019 FASTJET_BEGIN_NAMESPACE
00020
00021 string PrunedRecombPlugin::description () const {
00022 ostringstream desc;
00023
00024 desc << "Pruned jet algorithm \n"
00025 << "----------------------- \n"
00026 << "Jet finder: " << _find_definition.description()
00027 << "\n----------------------- \n"
00028 << "Prune jets with: " << _prune_definition.description()
00029 << "\n----------------------- \n"
00030 << "Pruning parameters: "
00031 << "zcut = " << _zcut << ", "
00032 << "Rcut_factor = " << _Rcut_factor << "\n"
00033 << "----------------------- \n" ;
00034
00035 return desc.str();
00036 }
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 void PrunedRecombPlugin::run_clustering(ClusterSequence & input_seq) const {
00051
00052 vector<PseudoJet> inputs = input_seq.jets();
00053
00054
00055
00056
00057 for (unsigned int i = 0; i < inputs.size(); i++)
00058 inputs[i].set_user_index(i+1);
00059
00060
00061 ClusterSequence unpruned_seq(inputs, _find_definition);
00062
00063
00064 vector<PseudoJet> unpruned_jets
00065 = sorted_by_pt(unpruned_seq.inclusive_jets(0.0));
00066 for (unsigned int i = 0; i < unpruned_jets.size(); i++) {
00067 double angle = _characteristic_angle(unpruned_jets[i], unpruned_seq);
00068
00069
00070
00071 JetDefinition::Recombiner *pruned_recombiner =
00072 new PrunedRecombiner(_zcut, _Rcut_factor*angle);
00073 _prune_definition.set_recombiner(pruned_recombiner);
00074 ClusterSequence pruned_seq
00075 (unpruned_seq.constituents(unpruned_jets[i]),
00076 _prune_definition);
00077 delete pruned_recombiner;
00078
00079
00080
00081
00082
00083 vector<PseudoJet> pruned_jets = pruned_seq.inclusive_jets(0.0);
00084 PseudoJet pruned_jet = sorted_by_pt(pruned_jets)[0];
00085
00086 _output_mergings(pruned_seq, input_seq);
00087 }
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 void PrunedRecombPlugin::_output_mergings(ClusterSequence & in_seq,
00099 ClusterSequence & out_seq) const
00100 {
00101 vector<PseudoJet> p = in_seq.jets();
00102
00103
00104 const vector<ClusterSequence::history_element> & hist = in_seq.history();
00105 vector<ClusterSequence::history_element>::const_iterator
00106 iter = hist.begin();
00107
00108
00109 while (iter->parent1 == ClusterSequence::InexistentParent)
00110 iter++;
00111
00112
00113
00114
00115 for (; iter != hist.end(); iter++) {
00116 int new_jet_index = -1;
00117 int i1 = p[hist[iter->parent1].jetp_index].user_index() - 1;
00118 if (iter->parent2 == ClusterSequence::BeamJet) {
00119 out_seq.plugin_record_iB_recombination(i1, iter->dij);
00120 } else {
00121 int i2 = p[hist[iter->parent2].jetp_index].user_index() - 1;
00122
00123
00124
00125 if (p[iter->jetp_index].e() - p[hist[iter->parent1].jetp_index].e() == 0)
00126
00127 p[iter->jetp_index].set_user_index(p[hist[iter->parent1].jetp_index].user_index());
00128 else if (p[iter->jetp_index].e() - p[hist[iter->parent2].jetp_index].e() == 0)
00129
00130 p[iter->jetp_index].set_user_index(p[hist[iter->parent2].jetp_index].user_index());
00131 else {
00132
00133 out_seq.plugin_record_ij_recombination(i1, i2, iter->dij,
00134 new_jet_index);
00135 p[iter->jetp_index].set_user_index(new_jet_index + 1);
00136 }
00137 }
00138 }
00139 }
00140
00141
00142
00143
00144
00145
00146 double PrunedRecombPlugin::_characteristic_angle (const PseudoJet & jet,
00147 const ClusterSequence & seq) const
00148 {
00149 PseudoJet p1, p2;
00150 if (! seq.has_parents(jet, p1, p2))
00151 return -1.0;
00152 else
00153
00154 return 2.0*jet.m()/jet.perp();
00155 }
00156
00157
00158 FASTJET_END_NAMESPACE