FastJet  3.1.0-beta.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ClusterSequence1GhostPassiveArea.cc
1 //FJSTARTHEADER
2 // $Id: ClusterSequence1GhostPassiveArea.cc 3433 2014-07-23 08:17:03Z salam $
3 //
4 // Copyright (c) 2005-2014, 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. They are described in the original FastJet paper,
16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17 // FastJet as part of work towards a scientific publication, please
18 // quote the version you use and include a citation to the manual and
19 // optionally also to hep-ph/0512210.
20 //
21 // FastJet is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28 //----------------------------------------------------------------------
29 //FJENDHEADER
30 
31 #include "fastjet/ClusterSequence1GhostPassiveArea.hh"
32 
33 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
34 
35 
36 using namespace std;
37 
38 //----------------------------------------------------------------------
39 /// global routine for initialising and running a general passive area
40 void ClusterSequence1GhostPassiveArea::_initialise_and_run_1GPA (
41  const JetDefinition & jet_def_in,
42  const GhostedAreaSpec & area_spec,
43  const bool & writeout_combinations) {
44 
45  bool continue_running;
46  _initialise_AA(jet_def_in, area_spec, writeout_combinations, continue_running);
47  if (continue_running) {
48  _run_1GPA(area_spec);
49  _postprocess_AA(area_spec);
50  }
51 }
52 
53 
54 //----------------------------------------------------------------------
55 /// routine for running a passive area one ghost at a time.
56 void ClusterSequence1GhostPassiveArea::_run_1GPA (const GhostedAreaSpec & area_spec) {
57  // record the input jets as they are currently
58  vector<PseudoJet> input_jets(_jets);
59 
60  // code for testing the unique tree
61  vector<int> unique_tree;
62 
63  // initialise our temporary average area^2
64  valarray<double> lcl_average_area2(0.0, _average_area.size());
65  valarray<double> last_average_area(0.0, _average_area.size());
66 
67  // run the clustering multiple times so as to get areas of all the jets
68  for (int irepeat = 0; irepeat < area_spec.repeat(); irepeat++) {
69 
70  // first establish list of all ghosts
71  vector<PseudoJet> all_ghosts;
72  area_spec.add_ghosts(all_ghosts);
73 
74  // then run many subsets of ghosts (actually each subset contains just one ghost)
75  for (unsigned ig = 0; ig < all_ghosts.size(); ig++) {
76  vector<PseudoJet> some_ghosts;
77  some_ghosts.push_back(all_ghosts[ig]);
78  ClusterSequenceActiveAreaExplicitGhosts clust_seq(input_jets, jet_def(),
79  some_ghosts, area_spec.actual_ghost_area());
80 
81  if (irepeat == 0 && ig == 0) {
82  // take the non-ghost part of the history and put into our own
83  // history.
84  _transfer_ghost_free_history(clust_seq);
85  // get the "unique" order that will be used for transferring all areas.
86  unique_tree = unique_history_order();
87  }
88 
89  // transfer areas from clust_seq into our object
90  _transfer_areas(unique_tree, clust_seq);
91  }
92  // keep track of fluctuations in area
93  lcl_average_area2 += (_average_area - last_average_area)*
94  (_average_area - last_average_area);
95  last_average_area = _average_area;
96  }
97  _average_area2 = lcl_average_area2;
98 }
99 
100 
101 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
102