1 | //STARTHEADER
|
---|
2 | // $Id$
|
---|
3 | //
|
---|
4 | // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
|
---|
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, see <http://www.gnu.org/licenses/>.
|
---|
26 | //----------------------------------------------------------------------
|
---|
27 | //ENDHEADER
|
---|
28 |
|
---|
29 | #include "fastjet/D0RunIIConePlugin.hh"
|
---|
30 | #include "fastjet/ClusterSequence.hh"
|
---|
31 | #include "fastjet/Error.hh"
|
---|
32 | #include <sstream>
|
---|
33 |
|
---|
34 | // D0 stuff
|
---|
35 | #include <list>
|
---|
36 | #include "ILConeAlgorithm.hpp"
|
---|
37 | #include "HepEntity.h"
|
---|
38 |
|
---|
39 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
40 |
|
---|
41 | using namespace std;
|
---|
42 | using namespace d0;
|
---|
43 |
|
---|
44 | const double D0RunIIConePlugin::_DEFAULT_split_ratio = 0.5 ; // overlap threshold
|
---|
45 | const double D0RunIIConePlugin::_DEFAULT_far_ratio = 0.5 ;
|
---|
46 | const double D0RunIIConePlugin::_DEFAULT_Et_min_ratio = 0.5 ;
|
---|
47 | const bool D0RunIIConePlugin::_DEFAULT_kill_duplicate = true ;
|
---|
48 | const double D0RunIIConePlugin::_DEFAULT_duplicate_dR = 0.005;
|
---|
49 | const double D0RunIIConePlugin::_DEFAULT_duplicate_dPT = 0.01 ;
|
---|
50 | const double D0RunIIConePlugin::_DEFAULT_search_factor = 1.0 ;
|
---|
51 | const double D0RunIIConePlugin::_DEFAULT_pT_min_leading_protojet = 0. ;
|
---|
52 | const double D0RunIIConePlugin::_DEFAULT_pT_min_second_protojet = 0. ;
|
---|
53 | const int D0RunIIConePlugin::_DEFAULT_merge_max = 10000;
|
---|
54 | const double D0RunIIConePlugin::_DEFAULT_pT_min_nomerge = 0. ;
|
---|
55 |
|
---|
56 | bool D0RunIIConePlugin::_first_time = true;
|
---|
57 |
|
---|
58 | string D0RunIIConePlugin::description () const {
|
---|
59 | ostringstream desc;
|
---|
60 |
|
---|
61 | desc << "D0 Run II Improved Legacy (midpoint) cone jet algorithm, with ";
|
---|
62 | desc << "cone_radius = " << cone_radius () << ", "
|
---|
63 | << "min_jet_Et = " << min_jet_Et () << ", "
|
---|
64 | << "split_ratio = " << split_ratio ();
|
---|
65 |
|
---|
66 | return desc.str();
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | void D0RunIIConePlugin::run_clustering(ClusterSequence & clust_seq) const {
|
---|
71 | // print a banner if we run this for the first time
|
---|
72 | _print_banner(clust_seq.fastjet_banner_stream());
|
---|
73 |
|
---|
74 | // create the entities needed by the D0 code
|
---|
75 | vector<HepEntity> entities(clust_seq.jets().size());
|
---|
76 | list<const HepEntity * > ensemble;
|
---|
77 | for (unsigned i = 0; i < clust_seq.jets().size(); i++) {
|
---|
78 | entities[i].Fill(clust_seq.jets()[i].E(),
|
---|
79 | clust_seq.jets()[i].px(),
|
---|
80 | clust_seq.jets()[i].py(),
|
---|
81 | clust_seq.jets()[i].pz(),
|
---|
82 | i);
|
---|
83 | // use only the particles that do not have infinite rapidity
|
---|
84 | if (abs(entities[i].pz) < entities[i].E) {
|
---|
85 | ensemble.push_back(& (entities[i]));
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | // prepare the D0 algorithm
|
---|
90 | ILConeAlgorithm<HepEntity>
|
---|
91 | ilegac(cone_radius(),
|
---|
92 | min_jet_Et(),
|
---|
93 | split_ratio(),
|
---|
94 | far_ratio(),
|
---|
95 | Et_min_ratio(),
|
---|
96 | kill_duplicate(),
|
---|
97 | duplicate_dR(),
|
---|
98 | duplicate_dPT(),
|
---|
99 | search_factor(),
|
---|
100 | pT_min_leading_protojet(),
|
---|
101 | pT_min_second_protojet(),
|
---|
102 | merge_max(),
|
---|
103 | pT_min_nomerge());
|
---|
104 |
|
---|
105 | // run the algorithm
|
---|
106 | float Item_ET_Threshold = 0.;
|
---|
107 | list<HepEntity> jets;
|
---|
108 | ilegac.makeClusters(jets, ensemble, Item_ET_Threshold);
|
---|
109 |
|
---|
110 | // now transfer the information about the jets into the
|
---|
111 | // FastJet structure
|
---|
112 | for(int i = ilegac.ilcv.size()-1; i >= 0; i--) {
|
---|
113 |
|
---|
114 | std::list<const HepEntity*> tlist = ilegac.ilcv[i].LItems();
|
---|
115 | std::list<const HepEntity*>::iterator tk;
|
---|
116 |
|
---|
117 | // get first particle in list
|
---|
118 | tk = tlist.begin();
|
---|
119 |
|
---|
120 | // if there is no particle, just discard it
|
---|
121 | // Note: this unexpected behaviour has been observed when the
|
---|
122 | // min_jet_Et parameter was set to 0
|
---|
123 | if (tk==tlist.end())
|
---|
124 | continue;
|
---|
125 |
|
---|
126 | int jet_k = (*tk)->index;
|
---|
127 | // now merge with remaining particles in list
|
---|
128 | tk++;
|
---|
129 | for (; tk != tlist.end(); tk++) {
|
---|
130 | int jet_i = jet_k;
|
---|
131 | int jet_j = (*tk)->index;
|
---|
132 | // do a fake recombination step with dij=0
|
---|
133 | double dij = 0.0;
|
---|
134 | clust_seq.plugin_record_ij_recombination(jet_i, jet_j, dij, jet_k);
|
---|
135 | }
|
---|
136 |
|
---|
137 | // NB: put a sensible looking d_iB just to be nice...
|
---|
138 | double d_iB = clust_seq.jets()[jet_k].perp2();
|
---|
139 | clust_seq.plugin_record_iB_recombination(jet_k, d_iB);
|
---|
140 |
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | // print a banner for reference to the 3rd-party code
|
---|
145 | void D0RunIIConePlugin::_print_banner(ostream *ostr) const{
|
---|
146 | if (! _first_time) return;
|
---|
147 | _first_time=false;
|
---|
148 |
|
---|
149 | // make sure the user has not set the banner stream to NULL
|
---|
150 | if (!ostr) return;
|
---|
151 |
|
---|
152 | (*ostr) << "#--------------------------------------------------------------------------" << endl;
|
---|
153 | (*ostr) << "# You are running the D0 Run II Cone plugin for FastJet " << endl;
|
---|
154 | (*ostr) << "# Original code by the D0 collaboration, provided by Lars Sonnenschein; " << endl;
|
---|
155 | (*ostr) << "# interface by FastJet authors " << endl;
|
---|
156 | (*ostr) << "# If you use this plugin, please cite " << endl;
|
---|
157 | (*ostr) << "# G. C. Blazey et al., hep-ex/0005012 " << endl;
|
---|
158 | (*ostr) << "# V. M. Abazov et al. [D0 Collaboration], arXiv:1110.3771 [hep-ex] " << endl;
|
---|
159 | (*ostr) << "# in addition to the usual FastJet reference. " << endl;
|
---|
160 | (*ostr) << "#--------------------------------------------------------------------------" << endl;
|
---|
161 |
|
---|
162 | // make sure we really have the output done.
|
---|
163 | ostr->flush();
|
---|
164 | }
|
---|
165 |
|
---|
166 | FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
|
---|