8 #include "RecoJets/JetAlgorithms/interface/FastPrunePlugin.hh" 18 FastPrunePlugin::FastPrunePlugin (
const JetDefinition & find_definition,
19 const JetDefinition & prune_definition,
21 const double & Rcut_factor) :
22 _find_definition(find_definition),
23 _prune_definition(prune_definition),
26 _pruned_recombiner(0),
27 _cut_setter(new DefaultCutSetter(zcut, Rcut_factor))
37 RecombinationScheme scheme = _prune_definition.recombination_scheme();
38 if (scheme == external_scheme)
39 _pruned_recombiner =
new PrunedRecombiner(_prune_definition.recombiner(),
zcut, 0.0);
41 _pruned_recombiner =
new PrunedRecombiner(scheme, zcut, 0.0);
44 FastPrunePlugin::FastPrunePlugin (
const JetDefinition & find_definition,
45 const JetDefinition & prune_definition,
46 const JetDefinition::Recombiner* recomb,
48 const double & Rcut_factor) :
49 _find_definition(find_definition),
50 _prune_definition(prune_definition),
53 _pruned_recombiner(new PrunedRecombiner(recomb, zcut, 0.0)),
54 _cut_setter(new DefaultCutSetter(zcut, Rcut_factor))
57 FastPrunePlugin::FastPrunePlugin (
const JetDefinition & find_definition,
58 const JetDefinition & prune_definition,
59 CutSetter*
const cut_setter) :
60 _find_definition(find_definition),
61 _prune_definition(prune_definition),
64 _pruned_recombiner(0),
65 _cut_setter(cut_setter)
68 RecombinationScheme scheme = _prune_definition.recombination_scheme();
69 if (scheme == external_scheme)
70 _pruned_recombiner =
new PrunedRecombiner(_prune_definition.recombiner());
72 _pruned_recombiner =
new PrunedRecombiner(scheme);
75 FastPrunePlugin::FastPrunePlugin (
const JetDefinition & find_definition,
76 const JetDefinition & prune_definition,
77 CutSetter*
const cut_setter,
78 const JetDefinition::Recombiner* recomb) :
79 _find_definition(find_definition),
80 _prune_definition(prune_definition),
83 _pruned_recombiner(new PrunedRecombiner(recomb)),
84 _cut_setter(cut_setter)
90 desc <<
"Pruned jet algorithm \n" 91 <<
"----------------------- \n" 92 <<
"Jet finder: " << _find_definition.description()
93 <<
"\n----------------------- \n" 94 <<
"Prune jets with: " << _prune_definition.description()
95 <<
"\n----------------------- \n" 96 <<
"Pruning parameters: " 97 <<
"zcut = " << _cut_setter->zcut <<
", " 99 if (DefaultCutSetter *
cs = dynamic_cast<DefaultCutSetter*>(_cut_setter))
100 desc <<
cs->Rcut_factor;
104 <<
"----------------------- \n" ;
121 void FastPrunePlugin::run_clustering(ClusterSequence & input_seq)
const {
124 _pruned_subjets.clear();
126 vector<PseudoJet>
inputs = input_seq.jets();
133 for (
unsigned int i = 0;
i < inputs.size();
i++)
134 inputs[
i].set_user_index(
i+1);
137 if(_unpruned_seq)
delete _unpruned_seq;
138 _unpruned_seq =
new ClusterSequence(inputs, _find_definition);
141 vector<PseudoJet> unpruned_jets =
142 sorted_by_pt(_unpruned_seq->inclusive_jets(_minpT));
144 for (
unsigned int i = 0;
i < unpruned_jets.size();
i++) {
145 _cut_setter->SetCuts(unpruned_jets[
i], *_unpruned_seq);
146 _pruned_recombiner->reset(_cut_setter->zcut, _cut_setter->Rcut);
147 _prune_definition.set_recombiner(_pruned_recombiner);
150 vector<PseudoJet> constituents;
151 for (
size_t j = 0; j < inputs.size(); ++j)
152 if (_unpruned_seq->object_in_jet(inputs[j], unpruned_jets[i])) {
153 constituents.push_back(inputs[j]);
155 ClusterSequence pruned_seq(constituents, _prune_definition);
157 vector<int> pruned_PJs = _pruned_recombiner->pruned_pseudojets();
158 _output_mergings(pruned_seq, pruned_PJs, input_seq);
170 void FastPrunePlugin::_output_mergings(ClusterSequence & in_seq,
171 vector<int> & pruned_pseudojets,
172 ClusterSequence & out_seq)
const {
174 vector<PseudoJet> temp_pruned_subjets;
176 vector<PseudoJet>
p = in_seq.jets();
179 sort(pruned_pseudojets.begin(), pruned_pseudojets.end());
182 const vector<ClusterSequence::history_element> &
hist = in_seq.history();
183 vector<ClusterSequence::history_element>::const_iterator
187 while (iter->parent1 == ClusterSequence::InexistentParent)
193 for (; iter != hist.end(); iter++) {
194 int new_jet_index = -1;
195 int jet_index = iter->jetp_index;
196 int parent1 = iter->parent1;
197 int parent2 = iter->parent2;
198 int parent1_index = p[hist[iter->parent1].jetp_index].user_index() - 1;
200 if (parent2 == ClusterSequence::BeamJet) {
201 out_seq.plugin_record_iB_recombination(parent1_index, iter->dij);
203 int parent2_index = p[hist[parent2].jetp_index].user_index() - 1;
207 if (binary_search(pruned_pseudojets.begin(), pruned_pseudojets.end(),
210 p[jet_index].set_user_index(p[hist[parent1].jetp_index].user_index());
211 temp_pruned_subjets.push_back(out_seq.jets()[parent2_index]);
212 }
else if (binary_search(pruned_pseudojets.begin(), pruned_pseudojets.end(),
215 p[jet_index].set_user_index(p[hist[parent2].jetp_index].user_index());
216 temp_pruned_subjets.push_back(out_seq.jets()[parent1_index]);
219 out_seq.plugin_record_ij_recombination(parent1_index, parent2_index,
220 iter->dij, new_jet_index);
221 p[jet_index].set_user_index(new_jet_index + 1);
226 _pruned_subjets.push_back(temp_pruned_subjets);
auto_ptr< ClusterSequence > cs