NestedDefsPlugin.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "fastjet/ClusterSequence.hh"
00036 #include "fastjet/NestedDefsPlugin.hh"
00037
00038
00039 #include <vector>
00040 #include <sstream>
00041
00042 FASTJET_BEGIN_NAMESPACE
00043
00044 using namespace std;
00045
00046 string NestedDefsPlugin::description () const {
00047 ostringstream desc;
00048
00049 desc << "NestedDefs: successive application of " ;
00050 unsigned int i=1;
00051 for (list<JetDefinition>::const_iterator it=_defs.begin();it!=_defs.end();it++){
00052 desc << "Definition " << i++ << " [" << it->description() << "] - ";
00053 }
00054
00055 return desc.str();
00056 }
00057
00058 void NestedDefsPlugin::run_clustering(ClusterSequence & clust_seq) const {
00059 vector<PseudoJet> momenta;
00060
00061
00062 momenta = clust_seq.jets();
00063 unsigned int step_n = momenta.size();
00064
00065
00066
00067 vector<unsigned int> conversion_table(2*step_n);
00068 vector<unsigned int> new_conversion_table;
00069 for (unsigned int i=0;i<step_n;i++)
00070 conversion_table[i]=i;
00071
00072
00073
00074
00075
00076
00077 list<JetDefinition>::const_iterator def_iterator = _defs.begin();
00078 unsigned int def_index=0;
00079 bool last_def=false;
00080
00081 while (def_iterator!=_defs.end()){
00082 last_def = (def_index == (_defs.size()-1));
00083
00084
00085 ClusterSequence step_cs(momenta, *def_iterator);
00086
00087
00088 momenta.clear();
00089 new_conversion_table.clear();
00090
00091
00092 const vector<ClusterSequence::history_element> & step_history = step_cs.history();
00093
00094
00095
00096
00097 vector<ClusterSequence::history_element>::const_iterator
00098 hist_iterator = step_history.begin();
00099
00100 for (unsigned int i=step_n;i!=0;i--)
00101 hist_iterator++;
00102
00103 while (hist_iterator != step_history.end()){
00104
00105 if (hist_iterator->parent2 == ClusterSequence::BeamJet){
00106
00107
00108 unsigned int step_jet_index = step_cs.history()[hist_iterator->parent1].jetp_index;
00109 if (last_def){
00110 clust_seq.plugin_record_iB_recombination(conversion_table[step_jet_index],
00111 hist_iterator->dij);
00112 } else {
00113 momenta.push_back(step_cs.jets()[step_jet_index]);
00114 new_conversion_table.push_back(conversion_table[step_jet_index]);
00115 }
00116 } else {
00117
00118
00119 unsigned int step_jet1_index = step_cs.history()[hist_iterator->parent1].jetp_index;
00120 unsigned int step_jet2_index = step_cs.history()[hist_iterator->parent2].jetp_index;
00121 PseudoJet newjet = step_cs.jets()[hist_iterator->jetp_index];
00122 int jet_k;
00123 clust_seq.plugin_record_ij_recombination(conversion_table[step_jet1_index],
00124 conversion_table[step_jet2_index],
00125 last_def ? hist_iterator->dij : 0.0,
00126 newjet, jet_k);
00127
00128
00129 conversion_table[hist_iterator->jetp_index]=jet_k;
00130 }
00131
00132
00133 hist_iterator++;
00134 }
00135
00136
00137
00138
00139 step_n = momenta.size();
00140 for (unsigned int i=0;i<step_n;i++)
00141 conversion_table[i] = new_conversion_table[i];
00142
00143
00144 def_index++;
00145 def_iterator++;
00146 }
00147
00148 }
00149
00150 FASTJET_END_NAMESPACE