Fork me on GitHub

source: svn/trunk/Utilities/Fastjet/plugins/CDFCones/CDFMidPointPlugin.cc@ 961

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

Fastjet added; CDFCones directory has been changed

File size: 5.4 KB
RevLine 
[11]1//STARTHEADER
2// $Id: CDFMidPointPlugin.cc,v 1.1 2008-11-06 14:32:10 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 "CDFMidPointPlugin.hh"
32#include "Utilities/Fastjet/include/fastjet/ClusterSequence.hh"
33#include "Utilities/Fastjet/include/fastjet/Error.hh"
34#include <sstream>
35
36// CDF stuff
37#include "interface/MidPointAlgorithm.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 CDFMidPointPlugin::description () const {
46 ostringstream desc;
47
48 string sm_scale_string = "split-merge uses ";
49 switch(_sm_scale) {
50 case SM_pt:
51 sm_scale_string += "pt";
52 break;
53 case SM_Et:
54 sm_scale_string += "Et";
55 break;
56 case SM_mt:
57 sm_scale_string += "mt";
58 break;
59 case SM_pttilde:
60 sm_scale_string += "pttilde (scalar sum of pts)";
61 break;
62 default:
63 ostringstream err;
64 err << "Unrecognized split-merge scale choice = " << _sm_scale;
65 throw Error(err.str());
66 }
67
68
69 if (cone_area_fraction() == 1) {
70 desc << "CDF MidPoint jet algorithm, with " ;
71 } else {
72 desc << "CDF MidPoint+Searchcone jet algorithm, with ";
73 }
74 desc << "seed_threshold = " << seed_threshold () << ", "
75 << "cone_radius = " << cone_radius () << ", "
76 << "cone_area_fraction = " << cone_area_fraction () << ", "
77 << "max_pair_size = " << max_pair_size () << ", "
78 << "max_iterations = " << max_iterations () << ", "
79 << "overlap_threshold = " << overlap_threshold () << ", "
80 << sm_scale_string ;
81
82 return desc.str();
83}
84
85
86void CDFMidPointPlugin::run_clustering(ClusterSequence & clust_seq) const {
87
88 // create the physics towers needed by the CDF code
89 vector<PhysicsTower> towers;
90 towers.reserve(clust_seq.jets().size());
91 for (unsigned i = 0; i < clust_seq.jets().size(); i++) {
92 LorentzVector fourvect(clust_seq.jets()[i].px(),
93 clust_seq.jets()[i].py(),
94 clust_seq.jets()[i].pz(),
95 clust_seq.jets()[i].E());
96 PhysicsTower tower(fourvect);
97 // misuse one of the indices for tracking, since the MidPoint
98 // implementation doesn't seem to make use of these indices
99 tower.calTower.iEta = i;
100 towers.push_back(tower);
101 }
102
103 // prepare the CDF algorithm
104 MidPointAlgorithm m(_seed_threshold,_cone_radius,_cone_area_fraction,
105 _max_pair_size,_max_iterations,_overlap_threshold,
106 MidPointAlgorithm::SplitMergeScale(_sm_scale));
107
108 // run the CDF algorithm
109 std::vector<Cluster> jets;
110 m.run(towers,jets);
111
112
113 // now transfer the jets back into our own structure -- we will
114 // mimic the cone code with a sequential recombination sequence in
115 // which the jets are built up by adding one particle at a time
116 for(vector<Cluster>::const_iterator jetIter = jets.begin();
117 jetIter != jets.end(); jetIter++) {
118 const vector<PhysicsTower> & tower_list = jetIter->towerList;
119 int jet_k = tower_list[0].calTower.iEta;
120
121 int ntow = int(jetIter->towerList.size());
122 for (int itow = 1; itow < ntow; itow++) {
123 int jet_i = jet_k;
124 // retrieve our misappropriated index for the jet
125 int jet_j = tower_list[itow].calTower.iEta;
126 // do a fake recombination step with dij=0
127 double dij = 0.0;
128 clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k);
129 }
130
131 // NB: put a sensible looking d_iB just to be nice...
132 double d_iB = clust_seq.jets()[jet_k].perp2();
133 clust_seq.plugin_record_iB_recombination(jet_k, d_iB);
134 }
135
136
137 // following code is for testing only
138 //cout << endl;
139 //for(vector<Cluster>::const_iterator jetIter = jets.begin();
140 // jetIter != jets.end(); jetIter++) {
141 // cout << jetIter->fourVector.pt() << " " << jetIter->fourVector.y() << endl;
142 //}
143 //cout << "-----------------------------------------------------\n";
144 //vector<PseudoJet> ourjets(clust_seq.inclusive_jets());
145 //for (vector<PseudoJet>::const_reverse_iterator ourjet = ourjets.rbegin();
146 // ourjet != ourjets.rend(); ourjet++) {
147 // cout << ourjet->perp() << " " << ourjet->rap() << endl;
148 //}
149 //cout << endl;
150}
151
152FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
Note: See TracBrowser for help on using the repository browser.