FastJet  3.0.6
ClusterSequence1GhostPassiveArea.cc
1 //STARTHEADER
2 // $Id: ClusterSequence1GhostPassiveArea.cc 2687 2011-11-14 11:17:51Z soyez $
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/ClusterSequence1GhostPassiveArea.hh"
30 
31 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
32 
33 
34 using namespace std;
35 
36 //----------------------------------------------------------------------
37 /// global routine for initialising and running a general passive area
38 void ClusterSequence1GhostPassiveArea::_initialise_and_run_1GPA (
39  const JetDefinition & jet_def_in,
40  const GhostedAreaSpec & area_spec,
41  const bool & writeout_combinations) {
42 
43  bool continue_running;
44  _initialise_AA(jet_def_in, area_spec, writeout_combinations, continue_running);
45  if (continue_running) {
46  _run_1GPA(area_spec);
47  _postprocess_AA(area_spec);
48  }
49 }
50 
51 
52 //----------------------------------------------------------------------
53 /// routine for running a passive area one ghost at a time.
54 void ClusterSequence1GhostPassiveArea::_run_1GPA (const GhostedAreaSpec & area_spec) {
55  // record the input jets as they are currently
56  vector<PseudoJet> input_jets(_jets);
57 
58  // code for testing the unique tree
59  vector<int> unique_tree;
60 
61  // initialise our temporary average area^2
62  valarray<double> lcl_average_area2(0.0, _average_area.size());
63  valarray<double> last_average_area(0.0, _average_area.size());
64 
65  // run the clustering multiple times so as to get areas of all the jets
66  for (int irepeat = 0; irepeat < area_spec.repeat(); irepeat++) {
67 
68  // first establish list of all ghosts
69  vector<PseudoJet> all_ghosts;
70  area_spec.add_ghosts(all_ghosts);
71 
72  // then run many subsets of ghosts (actually each subset contains just one ghost)
73  for (unsigned ig = 0; ig < all_ghosts.size(); ig++) {
74  vector<PseudoJet> some_ghosts;
75  some_ghosts.push_back(all_ghosts[ig]);
76  ClusterSequenceActiveAreaExplicitGhosts clust_seq(input_jets, jet_def(),
77  some_ghosts, area_spec.actual_ghost_area());
78 
79  if (irepeat == 0 && ig == 0) {
80  // take the non-ghost part of the history and put into our own
81  // history.
82  _transfer_ghost_free_history(clust_seq);
83  // get the "unique" order that will be used for transferring all areas.
84  unique_tree = unique_history_order();
85  }
86 
87  // transfer areas from clust_seq into our object
88  _transfer_areas(unique_tree, clust_seq);
89  }
90  // keep track of fluctuations in area
91  lcl_average_area2 += (_average_area - last_average_area)*
92  (_average_area - last_average_area);
93  last_average_area = _average_area;
94  }
95  _average_area2 = lcl_average_area2;
96 }
97 
98 
99 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
100 
void add_ghosts(std::vector< PseudoJet > &) const
push a set of ghost 4-momenta onto the back of the vector of PseudoJets
Like ClusterSequence with computation of the active jet area with the addition of explicit ghosts...
Parameters to configure the computation of jet areas using ghosts.
class that is intended to hold a full definition of the jet clusterer