Fork me on GitHub

source: svn/trunk/Utilities/Fastjet/plugins/CDFCones/CDFJetCluPlugin.cc@ 467

Last change on this file since 467 was 105, checked in by severine ovyn, 16 years ago

remove comments

File size: 6.4 KB
Line 
1//STARTHEADER
2// $Id: CDFJetCluPlugin.cc,v 1.3 2008-12-18 14:24:12 ovyn Exp $
3//
4// Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development and are described in hep-ph/0512210. If you use
16// FastJet as part of work towards a scientific publication, please
17// include a citation to the FastJet paper.
18//
19// FastJet is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with FastJet; if not, write to the Free Software
26// Foundation, Inc.:
27// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28//----------------------------------------------------------------------
29//ENDHEADER
30
31#include "CDFJetCluPlugin.hh"
32#include "Utilities/Fastjet/include/fastjet/ClusterSequence.hh"
33#include <sstream>
34#include <cassert>
35
36// CDF stuff
37#include "interface/JetCluAlgorithm.hh"
38#include "interface/PhysicsTower.hh"
39#include "interface/Cluster.hh"
40
41FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
42
43using namespace std;
44
45string CDFJetCluPlugin::description () const {
46 ostringstream desc;
47
48 desc << "CDF JetClu jet algorithm with "
49 << "seed_threshold = " << seed_threshold () << ", "
50 << "cone_radius = " << cone_radius () << ", "
51 << "adjacency_cut = " << adjacency_cut () << ", "
52 << "max_iterations = " << max_iterations () << ", "
53 << "iratch = " << iratch () << ", "
54 << "overlap_threshold = " << overlap_threshold () ;
55
56 return desc.str();
57}
58
59
60void CDFJetCluPlugin::run_clustering(ClusterSequence & clust_seq) const {
61
62 // create the physics towers needed by the CDF code
63 vector<PhysicsTower> towers;
64 towers.reserve(clust_seq.jets().size());
65
66 // create a map to identify jets (actually just the input particles)...
67 //map<double,int> jetmap;
68
69 for (unsigned i = 0; i < clust_seq.jets().size(); i++) {
70 PseudoJet particle(clust_seq.jets()[i]);
71 //_insert_unique(particle, jetmap);
72 LorentzVector fourvect(particle.px(), particle.py(),
73 particle.pz(), particle.E());
74 //PhysicsTower tower(fourvect);
75 PhysicsTower tower(fourvect);
76
77 // add tracking information for later
78 tower.fjindex = i;
79 towers.push_back(tower);
80 }
81
82 // prepare the CDF algorithm
83 JetCluAlgorithm j(seed_threshold(), cone_radius(), adjacency_cut(),
84 max_iterations(), iratch(), overlap_threshold());
85
86 // run the CDF algorithm
87 std::vector<Cluster> jets;
88 j.run(towers,jets);
89
90
91 // now transfer the jets back into our own structure -- we will
92 // mimic the cone code with a sequential recombination sequence in
93 // which the jets are built up by adding one particle at a time
94
95 // NB: with g++-4.0, the reverse iterator code gave problems, so switch
96 // to indices instead
97 //for(vector<Cluster>::const_reverse_iterator jetIter = jets.rbegin();
98 // jetIter != jets.rend(); jetIter++) {
99 // const vector<PhysicsTower> & tower_list = jetIter->towerList;
100 // int jet_k = jetmap[tower_list[0].fourVector.E];
101 //
102 // int ntow = int(jetIter->towerList.size());
103
104 for(int iCDFjets = jets.size()-1; iCDFjets >= 0; iCDFjets--) {
105 const vector<PhysicsTower> & tower_list = jets[iCDFjets].towerList;
106 //int jet_k = jetmap[tower_list[0].fourVector.E];
107 int jet_k = tower_list[0].fjindex;
108
109 int ntow = int(tower_list.size());
110 for (int itow = 1; itow < ntow; itow++) {
111 int jet_i = jet_k;
112 // retrieve our misappropriated index for the jet
113 int jet_j;
114 jet_j = tower_list[itow].fjindex;
115 //int alt_jet_j = jetmap[tower_list[itow].fourVector.E];
116 //assert(jet_j == alt_jet_j);
117 //cout << jet_j << endl;
118 // safety check
119 assert (jet_j >= 0 && jet_j < int(towers.size()));
120 // do a fake recombination step with dij=0
121 double dij = 0.0;
122 // JetClu does E-scheme recombination so we can stick with the
123 // simple option
124 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k);
125 //if (itow != ntow) {
126 // clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k);
127 //} else {
128 // clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij,
129 // PseudoJet(jetIter->fourVector.px,jetIter->fourVector.py,
130 // jetIter->fourVector.pz,jetIter->fourVector.E),
131 // jet_k);
132 //}
133 }
134
135 // NB: put a sensible looking d_iB just to be nice...
136 double d_iB = clust_seq.jets()[jet_k].perp2();
137 clust_seq.plugin_record_iB_recombination(jet_k, d_iB);
138 }
139
140
141 // following code is for testing only
142 //cout << endl;
143 //for(vector<Cluster>::const_iterator jetIter = jets.begin();
144 // jetIter != jets.end(); jetIter++) {
145 // cout << jetIter->fourVector.pt() << " " << jetIter->fourVector.y() << endl;
146 //}
147 //cout << "-----------------------------------------------------\n";
148 //vector<PseudoJet> ourjets(clust_seq.inclusive_jets());
149 //for (vector<PseudoJet>::const_iterator ourjet = ourjets.begin();
150 // ourjet != ourjets.end(); ourjet++) {
151 // cout << ourjet->perp() << " " << ourjet->rap() << endl;
152 //}
153 //cout << endl;
154}
155
156
157//// following code should now be obsolete since addition of
158//// index to the physics tower in the CDF code
159// void CDFJetCluPlugin::_insert_unique(PseudoJet & jet,
160// map<double,int> & jetmap) const {
161// while (jetmap.find(jet.E()) != jetmap.end()) {
162// // deal with cases where something else has the same energy, and
163// // also with situation where that energy is zero.
164// if (jet.E() != 0.0) {
165// jet *= 1.0+1e-12;
166// } else {
167// jet += PseudoJet(0.0,0.0,0.0,1e-300);
168// }
169// }
170// jetmap[jet.E()] = jet.cluster_hist_index();
171// }
172
173
174FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
Note: See TracBrowser for help on using the repository browser.