Page MenuHomeHEPForge

No OneTemporary

Index: contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.cc
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.cc (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.cc (revision 1159)
@@ -0,0 +1,65 @@
+// $Id$
+//
+// Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "LundWithSecondary.hh"
+#include <sstream>
+
+FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+/// return LundDeclustering sequence of primary plane
+std::vector<LundDeclustering> LundWithSecondary::primary(const PseudoJet& jet) const {
+ return lund_gen_(jet);
+}
+
+//----------------------------------------------------------------------
+/// return LundDeclustering sequence of secondary plane (slow version)
+std::vector<LundDeclustering> LundWithSecondary::secondary(const PseudoJet& jet) const {
+ // this is not optimal as one is computing the primary plane twice.
+ std::vector<LundDeclustering> declusts = lund_gen_(jet);
+ return secondary(jet, declusts);
+}
+//----------------------------------------------------------------------
+/// return LundDeclustering sequence of secondary plane with primary sequence as input
+std::vector<LundDeclustering> LundWithSecondary::secondary(const PseudoJet& jet,
+ const std::vector<LundDeclustering> & declusts) const {
+ assert(secondary_def_);
+ int secondary_index = (*secondary_def_)(declusts);
+ // if we found the index of secondary emission, return its declustering sequence
+ if (secondary_index >= 0)
+ return lund_gen_(declusts[secondary_index].softer());
+ return std::vector<LundDeclustering>();
+}
+
+//----------------------------------------------------------------------
+/// description
+std::string LundWithSecondary::description() const {
+ std::ostringstream oss;
+ oss << "LundWithSecondary using " << secondary_def_->description()
+ << " and " << lund_gen_.description();
+ return oss.str();
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.cc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/LundJSON.hh
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/LundJSON.hh (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/LundJSON.hh (revision 1159)
@@ -0,0 +1,78 @@
+#ifndef __FASTJET_CONTRIB_LUNDJSON_HH__
+#define __FASTJET_CONTRIB_LUNDJSON_HH__
+
+#include "LundGenerator.hh"
+
+FASTJET_BEGIN_NAMESPACE
+
+namespace contrib{
+
+// declaration of helper function
+void lund_elements_to_json(std::ostream & ostr, const LundDeclustering & d);
+
+/// writes json to ostr for an individual declustering
+inline std::ostream & lund_to_json(std::ostream & ostr, const LundDeclustering & d) {
+ // /// we hardcode 6 digits of precision -- is this the right way to do things?
+ // int prec_store = ostr.precision();
+ // ostr.precision(6);
+
+ ostr << "{";
+ lund_elements_to_json(ostr, d);
+ ostr << "}";
+
+ return ostr;
+}
+
+
+/// writes json to ostr for a vector of declusterings
+inline std::ostream & lund_to_json(std::ostream & ostr, const std::vector<LundDeclustering> & d) {
+ ostr << "[";
+ for (std::size_t i = 0; i < d.size(); i++) {
+ if (i != 0) ostr << ",";
+ lund_to_json(ostr, d[i]);
+ }
+ ostr << "]";
+ return ostr;
+}
+
+// /// writes a full Lund tree recursively to JSON
+// inline std::ostream & lund_to_json(std::ostream & ostr, const LundGenerator & generator, const PseudoJet & jet) {
+// // we will use these below in the loop; declare them here to avoid
+// // repeated creation/destruction
+// PseudoJet p1,p2;
+// std::vector<LundDeclustering> d = generator(jet);
+// ostr << "[";
+// for (std::size_t i = 0; i < d.size(); i++) {
+// if (i != 0) ostr << ",";
+// ostr << "{";
+// lund_elements_to_json(ostr, d[i]);
+// // add in information on the leaf if it exists
+// if (d[i].softer().has_parents(p1,p2)) {
+// ostr << ",";
+// ostr << "\"leaf\":";
+// lund_to_json(ostr, generator, d[i].softer());
+// }
+// ostr << "}";
+// }
+// ostr << "]";
+// return ostr;
+// }
+
+// helper function to write individual elements to json
+inline void lund_elements_to_json(std::ostream & ostr, const LundDeclustering & d) {
+ ostr << "\"p_pt\":" << d.pair() .pt() << ",";
+ ostr << "\"p_m\":" << d.pair() .m () << ",";
+ ostr << "\"h_pt\":" << d.harder().pt() << ",";
+ ostr << "\"s_pt\":" << d.softer().pt() << ",";
+ ostr << "\"z\":" << d.z() << ",";
+ ostr << "\"Delta\":" << d.Delta() << ",";
+ ostr << "\"kt\":" << d.kt() << ",";
+ ostr << "\"psi\":" << d.psi() ;
+}
+
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif // __FASTJET_CONTRIB_LUNDJSON_HH__
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/LundJSON.hh
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.cc
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.cc (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.cc (revision 1159)
@@ -0,0 +1,75 @@
+// $Id$
+//
+// Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include <sstream>
+#include "LundGenerator.hh"
+
+FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+LundDeclustering::LundDeclustering(const PseudoJet& pair,
+ const PseudoJet& j1, const PseudoJet& j2)
+ : m_(pair.m()), Delta_(j1.delta_R(j2)), pair_(pair) {
+
+ // establish which of j1 and j2 is softer
+ if (j1.pt2() > j2.pt2()) {
+ harder_ = j1;
+ softer_ = j2;
+ } else {
+ harder_ = j2;
+ softer_ = j1;
+ }
+
+ // now work out the various Lund declustering variables
+ double softer_pt = softer_.pt();
+ z_ = softer_pt / (softer_pt + harder_.pt());
+ kt_ = softer_pt * Delta_;
+ psi_ = atan2(softer_.rap()-harder_.rap(), harder_.delta_phi_to(softer_));
+ kappa_ = z_ * Delta_;
+}
+
+//----------------------------------------------------------------------
+/// retrieve the vector of declusterings of the primary plane of a jet
+std::vector<LundDeclustering> LundGenerator::result(const PseudoJet& jet) const {
+ std::vector<LundDeclustering> result;
+ PseudoJet j = recluster_(jet);
+ PseudoJet pair, j1, j2;
+ pair = j;
+ while (pair.has_parents(j1, j2)) {
+ if (j1.pt2() < j2.pt2()) std::swap(j1,j2);
+ result.push_back(LundDeclustering(pair, j1, j2));
+ pair = j1;
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------
+/// description
+std::string LundGenerator::description() const {
+ std::ostringstream oss;
+ oss << "LundGenerator with " << recluster_.description();
+ return oss.str();
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.cc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/README
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/README (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/README (revision 1159)
@@ -0,0 +1,46 @@
+------------------------------------------------------------------------
+LundPlane FastJet contrib
+------------------------------------------------------------------------
+
+The LundPlane FastJet contrib provides tools necessary to construct
+the Lund Plane of a jet.
+
+It is based on arXiv:1807.04758 by Frederic Dreyer, Gavin Salam, and
+Gregory Soyez.
+
+It provides the following C++ classes:
+
+- LundDeclustering
+ Contains the declustering variables associated with a node on
+ the Lund plane.
+
+- LundGenerator
+ A tool to generate a vector of LundDeclustering for a given jet
+ corresponding to its primary Lund plane.
+
+- LundWithSecondary
+ A tool to generate primary, and secondary, lund planes of a jet
+ according to the definition given as input.
+
+- SecondaryLund, SecondaryLund_{mMDT|dotmMDT|Mass}
+ Provides a definition for the leading emission.
+
+There are two C++ examples which can be compiled with
+
+> make example example_secondary
+
+The example program can be run using
+> ./example < ../data/single-event.dat
+
+and will output the primary lund plane declusterings as well as
+generating a jets.json file, which can be read by a python script:
+
+> python3 ./example.py
+
+Some python classes to assist with reading and processing the json file
+are provided in the read_lund_json.py module.
+
+The example_secondary program outputs both the primary and secondary
+Lund plane declusterings to screen, and can be run with:
+
+> ./example_secondary < ../data/single-event.dat
\ No newline at end of file
Index: contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.cc
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.cc (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.cc (revision 1159)
@@ -0,0 +1,123 @@
+// $Id$
+//
+// Copyright (c) 2018-, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "SecondaryLund.hh"
+#include <math.h>
+#include <sstream>
+#include <limits>
+
+
+FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+/// retrieve the vector of declusterings of the secondary plane of a jet
+int SecondaryLund_mMDT::result(const std::vector<LundDeclustering>& declusts) const {
+ // iterate through primary branchings
+ for (int i=0; i < declusts.size(); ++i) {
+ // mMDTZ: find the first emission passing z>zcut
+ if (declusts[i].z() > zcut_) return i;
+ }
+ return -1;
+}
+
+int SecondaryLund_dotmMDT::result(const std::vector<LundDeclustering>& declusts) const {
+ // set up leading emission pointer and bookkeeping variables
+ int secondary_index = -1;
+ double dot_prod_max = 0.0;
+
+ // iterate through primary branchings
+ for (int i=0; i < declusts.size(); ++i) {
+ // dotmMDTZ: find emission passing z>zcut with largest dot product
+ if (declusts[i].z() > zcut_) {
+ double dot_prod = declusts[i].harder().pt()*declusts[i].softer().pt()
+ *declusts[i].Delta()*declusts[i].Delta();
+ if (dot_prod > dot_prod_max) {
+ dot_prod_max = dot_prod;
+ secondary_index = i;
+ }
+ }
+ }
+
+ // return index of secondary emission
+ return secondary_index;
+}
+
+
+int SecondaryLund_Mass::result(const std::vector<LundDeclustering>& declusts) const {
+ // set up leading emission pointer and bookkeeping variables
+ int secondary_index = -1;
+ double mass_diff = std::numeric_limits<double>::max();
+
+ // iterate through primary branchings
+ for (int i=0; i < declusts.size(); ++i) {
+ // Mass: find emission that minimises the distance to reference mass
+ double dist =
+ std::abs(log(declusts[i].harder().pt()*declusts[i].softer().pt()
+ * declusts[i].Delta()*declusts[i].Delta() / mref2_)
+ * log(1.0/declusts[i].z()));
+ if (dist < mass_diff) {
+ mass_diff = dist;
+ secondary_index = i;
+ }
+ }
+
+ // return index of secondary emission
+ return secondary_index;
+}
+
+
+//----------------------------------------------------------------------
+/// description
+std::string SecondaryLund::description() const {
+ std::ostringstream oss;
+ oss << "SecondaryLund";
+ return oss.str();
+}
+
+//----------------------------------------------------------------------
+/// description
+std::string SecondaryLund_mMDT::description() const {
+ std::ostringstream oss;
+ oss << "SecondaryLund (mMDT selection of leading emission, zcut=" << zcut_<<")";
+ return oss.str();
+}
+
+//----------------------------------------------------------------------
+/// description
+std::string SecondaryLund_dotmMDT::description() const {
+ std::ostringstream oss;
+ oss << "SecondaryLund (dotmMDT selection of leading emission, zcut=" << zcut_<<")";
+ return oss.str();
+}
+
+//----------------------------------------------------------------------
+/// description
+std::string SecondaryLund_Mass::description() const {
+ std::ostringstream oss;
+ oss << " (Mass selection of leading emission, m="<<sqrt(mref2_)<<")";
+ return oss.str();
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.cc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.hh
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.hh (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.hh (revision 1159)
@@ -0,0 +1,121 @@
+// $Id$
+//
+// Copyright (c) 2018-, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_LUNDWITHSECONDARY_HH__
+#define __FASTJET_CONTRIB_LUNDWITHSECONDARY_HH__
+
+#include "LundGenerator.hh"
+#include "SecondaryLund.hh"
+
+FASTJET_BEGIN_NAMESPACE
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+/// \class LundWithSecondary
+/// Define a primary and secondary Lund plane
+///
+/// \param secondary_def definition used for the leading emission.
+//
+class LundWithSecondary {
+public:
+ /// LundWithSecondary constructor
+ LundWithSecondary(SecondaryLund * secondary_def = 0)
+ : secondary_def_(secondary_def) {}
+
+ /// LundWithSecondary constructor with jet alg
+ LundWithSecondary(JetAlgorithm jet_alg,
+ SecondaryLund * secondary_def = 0)
+ : lund_gen_(jet_alg), secondary_def_(secondary_def) {}
+
+ /// LundWithSecondary constructor with jet def
+ LundWithSecondary(const JetDefinition & jet_def,
+ SecondaryLund * secondary_def = 0)
+ : lund_gen_(jet_def), secondary_def_(secondary_def) {}
+
+ /// destructor
+ virtual ~LundWithSecondary() {}
+
+ /// primary Lund declustering
+ virtual std::vector<LundDeclustering> primary(const PseudoJet& jet) const;
+
+ /// secondary Lund declustering (slow)
+ virtual std::vector<LundDeclustering> secondary(const PseudoJet& jet) const;
+
+ /// secondary Lund declustering with primary sequence as input
+ virtual std::vector<LundDeclustering> secondary(const PseudoJet& jet,
+ const std::vector<LundDeclustering> & declusts) const;
+
+ /// description of the class
+ virtual std::string description() const;
+
+private:
+ /// lund generator
+ LundGenerator lund_gen_;
+
+ /// secondary definition
+ SecondaryLund * secondary_def_;
+};
+
+
+// //----------------------------------------------------------------------
+// /// \class LundWithSecondaryAndTertiary
+// /// Define a primary, secondary and tertiary Lund plane
+// class LundWithSecondaryAndTertiary : public LundWithSecondary {
+// public:
+// /// LundWithSecondaryAndTertiary constructor
+// LundWithSecondaryAndTertiary(SecondaryLund * secondary_def = 0,
+// SecondaryLund * tertiary_def = 0)
+// : LundWithSecondary(secondary_def), tertiary_def_(tertiary_def) {}
+
+// /// LundWithSecondaryAndTertiary constructor with jet alg
+// LundWithSecondaryAndTertiary(JetAlgorithm jet_alg,
+// SecondaryLund * secondary_def = 0,
+// SecondaryLund * tertiary_def = 0)
+// : LundWithSecondary(jet_alg, secondary_def), tertiary_def_(tertiary_def) {}
+
+// /// LundWithSecondaryAndTertiary constructor with jet def
+// LundWithSecondaryAndTertiary(const JetDefinition & jet_def,
+// SecondaryLund * secondary_def = 0,
+// SecondaryLund * tertiary_def = 0)
+// : LundWithSecondary(jet_def, secondary_def), tertiary_def_(tertiary_def) {}
+
+// /// destructor
+// virtual ~LundWithSecondaryAndTertiary() {}
+
+// /// tertiary Lund declustering
+// virtual std::vector<LundDeclustering> tertiary(const PseudoJet& jet) const;
+
+// /// description of the class
+// virtual std::string description() const;
+
+// private:
+// /// tertiary definition
+// SecondaryLund * tertiary_def_;
+// };
+
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif // __FASTJET_CONTRIB_LUNDWITHSECONDARY_HH__
+
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/LundWithSecondary.hh
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/example.ref
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/example.ref (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/example.ref (revision 1159)
@@ -0,0 +1,24 @@
+# read an event with 354 particles
+# writing declusterings of primary and secondary plane to file jets.json
+#--------------------------------------------------------------------------
+# FastJet release 3.3.0
+# M. Cacciari, G.P. Salam and G. Soyez
+# A software package for jet finding and analysis at colliders
+# http://fastjet.fr
+#
+# Please cite EPJC72(2012)1896 [arXiv:1111.6097] if you use this package
+# for scientific work and optionally PLB641(2006)57 [hep-ph/0512210].
+#
+# FastJet is provided without warranty under the terms of the GNU GPLv2.
+# It uses T. Chan's closest pair algorithm, S. Fortune's Voronoi code
+# and 3rd party plugin jet algorithms. See COPYING file for details.
+#--------------------------------------------------------------------------
+LundGenerator with R=1 and Recluster with new_jet_def = Longitudinally invariant Cambridge/Aachen algorithm with R = 1000 and E scheme recombination and keeping the hardest inclusive jet
+
+Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet 0 are:
+(0.381818, -1.41338); (0.640225, -1.41382); (0.815003, -0.521976); (1.11695, -2.1319); (1.33942, -3.472); (1.52885, -2.46979); (1.56466, -0.0358016); (2.02807, -0.558102); (2.34917, 1.00406); (2.51877, -1.94794); (2.95973, -1.06118); (3.36119, -3.71927); (3.83009, -1.04409); (3.91026, 1.04294); (4.25234, -0.800966); (4.77749, -0.461738); (5.43338, -0.520936); (5.54091, -1.07405); (5.81939, -0.573153)
+
+Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet 1 are:
+(0.108166, 0.409011); (0.478032, -0.762435); (0.5522, 1.69309); (0.814643, -0.89172); (0.87725, 0.291102); (1.17301, 0.430816); (1.46257, -2.02855); (2.04689, -3.19764); (2.19256, -0.828099); (2.86474, -1.09304); (2.98768, -1.21793); (3.3634, -0.355632); (4.17428, -0.227052); (4.59144, 0.645512); (4.86343, -2.29314); (5.8172, -2.47791)
+
+File jets.json written.
Index: contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.hh
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.hh (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.hh (revision 1159)
@@ -0,0 +1,137 @@
+// $Id$
+//
+// Copyright (c) 2018-, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_LUNDGENERATOR_HH__
+#define __FASTJET_CONTRIB_LUNDGENERATOR_HH__
+
+#include <fastjet/internal/base.hh>
+#include "fastjet/tools/Recluster.hh"
+#include "fastjet/JetDefinition.hh"
+#include "fastjet/PseudoJet.hh"
+#include <string>
+#include <vector>
+#include <utility>
+
+// TODO:
+// - add interface to write declusterings to json files
+// [gps, possibly as a separate header, in order to factorise the json.hh dependence]
+// - something for pileup subtraction?
+// - do we want to update json.hh to latest? And handle
+// the precision issue more elegantly than the current
+// hack of editing json.hh
+// - what do we do about the fact that json.hh is c++11?
+
+FASTJET_BEGIN_NAMESPACE
+
+namespace contrib{
+
+class LundGenerator;
+
+//----------------------------------------------------------------------
+/// \class LundDeclustering
+/// Contains the declustering variables associated with a single qnode
+/// on the Lund plane
+class LundDeclustering {
+public:
+
+ /// return the pair PseudoJet, i.e. sum of the two subjets
+ const PseudoJet & pair() const {return pair_;}
+ /// returns the subjet with larger transverse momentum
+ const PseudoJet & harder() const {return harder_;}
+ /// returns the subjet with smaller transverse momentum
+ const PseudoJet & softer() const {return softer_;}
+
+
+ /// returns pair().m() [cached]
+ double m() const {return m_;}
+
+ /// returns the rapidity-azimuth separation of the pair of subjets [cached]
+ double Delta() const {return Delta_;}
+
+ /// returns softer().pt() / (softer().pt() + harder().pt()) [cached]
+ double z() const {return z_;}
+
+ /// returns softer().pt() * Delta() [cached]
+ double kt() const {return kt_;}
+
+ /// returns z() * Delta() [cached]
+ double kappa() const {return kappa_;}
+
+ /// returns an azimuthal type angle of softer() around harder()
+ double psi() const {return psi_;}
+
+ /// returns the x,y coordinates that are used in the Lund-plane plots
+ /// of arXiv:1807.04758: ln(1/Delta()), and ln(kt()) respectively
+ std::pair<double,double> const lund_coordinates() const {
+ return std::pair<double,double>(std::log(1.0/Delta()),std::log(kt()));
+ }
+
+ virtual ~LundDeclustering() {}
+
+private:
+ double m_, Delta_, z_, kt_, kappa_, psi_;
+ PseudoJet pair_, harder_, softer_;
+
+protected:
+ /// the constructor is private, because users will not generally be
+ /// constructing a LundDeclustering element themselves.
+ LundDeclustering(const PseudoJet& pair,
+ const PseudoJet& j1, const PseudoJet& j2);
+
+ friend class LundGenerator;
+
+};
+
+
+//----------------------------------------------------------------------
+/// \class LundGenerator
+/// Generates vector of LundDeclustering for a given jet
+/// corresponding to its Lund plane.
+class LundGenerator : public FunctionOfPseudoJet< std::vector<LundDeclustering> > {
+public:
+ /// LundGenerator constructor
+ LundGenerator(JetAlgorithm jet_alg = cambridge_algorithm)
+ : recluster_(JetDefinition(jet_alg, JetDefinition::max_allowable_R)){}
+
+ /// LundGenerator constructor with jet definition
+ LundGenerator(const JetDefinition & jet_def) : recluster_(jet_def){}
+
+ /// destructor
+ virtual ~LundGenerator() {}
+
+ /// obtain the declusterings of the primary plane of the jet
+ virtual std::vector<LundDeclustering> result(const PseudoJet& jet) const;
+
+ /// description of the class
+ virtual std::string description() const;
+
+private:
+ /// recluster definition
+ Recluster recluster_;
+};
+
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif // __FASTJET_CONTRIB_LUNDGENERATOR_HH__
+
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/LundGenerator.hh
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/COPYING
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/COPYING (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/COPYING (revision 1159)
@@ -0,0 +1,343 @@
+======================================================================
+======================================================================
+======================================================================
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.hh
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.hh (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.hh (revision 1159)
@@ -0,0 +1,121 @@
+// $Id$
+//
+// Copyright (c) 2018-, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_SECONDARYLUND_HH__
+#define __FASTJET_CONTRIB_SECONDARYLUND_HH__
+
+#include "LundGenerator.hh"
+
+FASTJET_BEGIN_NAMESPACE
+
+namespace contrib{
+
+//----------------------------------------------------------------------
+/// \class SecondaryLund
+/// Base class for definitions of the leading emission
+class SecondaryLund {
+public:
+ /// SecondaryLund constructor
+ SecondaryLund() {}
+
+ /// destructor
+ virtual ~SecondaryLund() {}
+
+ /// returns the index of branch corresponding to the root of the secondary plane
+ virtual int result(const std::vector<LundDeclustering> & declusts) const = 0;
+
+ int operator()(const std::vector<LundDeclustering> & declusts) const {
+ return result(declusts);
+ }
+
+ /// description of the class
+ virtual std::string description() const;
+};
+
+//----------------------------------------------------------------------
+/// \class SecondaryLund_mMDT
+/// Contains a definition for the leading emission using mMDTZ
+class SecondaryLund_mMDT : public SecondaryLund {
+public:
+ /// SecondaryLund_mMDT constructor
+ SecondaryLund_mMDT(double zcut = 0.025) : zcut_(zcut) {}
+
+ /// destructor
+ virtual ~SecondaryLund_mMDT() {}
+
+ /// returns the index of branch corresponding to the root of the secondary plane
+ virtual int result(const std::vector<LundDeclustering> & declusts) const;
+
+ /// description of the class
+ virtual std::string description() const;
+private:
+ /// zcut parameter
+ double zcut_;
+};
+
+//----------------------------------------------------------------------
+/// \class SecondaryLund_dotmMDT
+/// Contains a definition for the leading emission using dotmMDT
+class SecondaryLund_dotmMDT : public SecondaryLund {
+public:
+ /// SecondaryLund_dotmMDT constructor
+ SecondaryLund_dotmMDT(double zcut = 0.025) : zcut_(zcut) {}
+
+ /// destructor
+ virtual ~SecondaryLund_dotmMDT() {}
+
+ /// returns the index of branch corresponding to the root of the secondary plane
+ virtual int result(const std::vector<LundDeclustering> & declusts) const;
+
+ /// description of the class
+ virtual std::string description() const;
+
+private:
+ /// zcut parameter
+ double zcut_;
+};
+
+//----------------------------------------------------------------------
+/// \class SecondaryLund_Mass
+/// Contains a definition for the leading emission using mass
+class SecondaryLund_Mass : public SecondaryLund {
+public:
+ /// SecondaryLund_Mass constructor (default mass reference is W mass)
+ SecondaryLund_Mass(double ref_mass = 80.4) : mref2_(ref_mass*ref_mass) {}
+
+ /// destructor
+ virtual ~SecondaryLund_Mass() {}
+
+ /// returns the index of branch corresponding to the root of the secondary plane
+ virtual int result(const std::vector<LundDeclustering> & declusts) const;
+
+ /// description of the class
+ virtual std::string description() const;
+private:
+ double mref2_;
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif // __FASTJET_CONTRIB_SECONDARYLUND_HH__
+
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/SecondaryLund.hh
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/NEWS
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/NEWS (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/NEWS (revision 1159)
@@ -0,0 +1 @@
+2018/08/22: release of version 1.0.0
\ No newline at end of file
Index: contrib/contribs/LundPlane/tags/1.0.0/read_lund_json.py
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/read_lund_json.py (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/read_lund_json.py (revision 1159)
@@ -0,0 +1,198 @@
+#----------------------------------------------------------------------
+# $Id$
+#
+# Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+#
+#----------------------------------------------------------------------
+# This file is part of FastJet contrib.
+#
+# It is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# It is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this code. If not, see <http://www.gnu.org/licenses/>.
+#----------------------------------------------------------------------
+
+from abc import ABC, abstractmethod
+import numpy as np
+from math import log, ceil, cos, sin
+import json, gzip, sys
+
+#----------------------------------------------------------------------
+class Reader(object):
+ """
+ Reader for files consisting of a sequence of json objects, one per line
+ Any pure string object is considered to be part of a header (even if it appears at the end!)
+ """
+ def __init__(self, infile, nmax = -1):
+ self.infile = infile
+ self.nmax = nmax
+ self.reset()
+
+ def set_nmax(self, nmax):
+ self.nmax = nmax
+
+ def reset(self):
+ """
+ Reset the reader to the start of the file, clear the header and event count.
+ """
+ if self.infile.endswith('.gz'):
+ self.stream = gzip.open(self.infile,'r')
+ else:
+ self.stream = open(self.infile,'r')
+ self.n = 0
+ self.header = []
+
+
+ #----------------------------------------------------------------------
+ def __iter__(self):
+ # needed for iteration to work
+ return self
+
+ def __next__(self):
+ ev = self.next_event()
+ if (ev is None): raise StopIteration
+ else : return ev
+
+ def next(self): return self.__next__()
+
+ def next_event(self):
+
+ # we have hit the maximum number of events
+ if (self.n == self.nmax):
+ #print ("# Exiting after having read nmax jet declusterings")
+ return None
+
+ try:
+ line = self.stream.readline()
+ if self.infile.endswith('.gz'):
+ j = json.loads(line.decode('utf-8'))
+ else:
+ j = json.loads(line)
+ except IOError:
+ print("# got to end with IOError (maybe gzip structure broken?) around event", self.n, file=sys.stderr)
+ return None
+ except EOFError:
+ print("# got to end with EOFError (maybe gzip structure broken?) around event", self.n, file=sys.stderr)
+ return None
+ except ValueError:
+ print("# got to end with ValueError (empty json entry?) around event", self.n, file=sys.stderr)
+ return None
+
+ # skip this
+ if (type(j) is str):
+ self.header.append(j)
+ return self.next_event()
+ self.n += 1
+ return j
+
+#------------------------------------------------------------------
+class Image(ABC):
+ """Image which transforms point-like information into pixelated 2D
+ images which can be processed by convolutional neural networks."""
+ def __init__(self, infile, nmax=-1):
+ if (type(infile) is Reader):
+ self.reader = infile
+ self.reader.set_nmax(nmax)
+ else:
+ self.reader = Reader(infile, nmax)
+
+ @abstractmethod
+ def process(self, event):
+ pass
+
+ def values(self):
+ res = []
+ while True:
+ event = self.reader.next_event()
+ if event!=None:
+ res.append(self.process(event))
+ else:
+ break
+ self.reader.reset()
+ return res
+
+
+
+class LundImage(Image):
+ """
+ Take input file and transforms it into parsable lund image.
+ """
+ def __init__(self, infile, nmax, npxl, xval = [0.0, 7.0], yval = [-3.0, 7.0]):
+ Image.__init__(self, infile, nmax)
+ self.npxl = npxl
+ self.xmin = xval[0]
+ self.ymin = yval[0]
+ self.x_pxl_wdth = (xval[1] - xval[0])/npxl
+ self.y_pxl_wdth = (yval[1] - yval[0])/npxl
+
+ def process(self, event):
+ res = np.zeros((self.npxl,self.npxl))
+ L1norm = 0.0
+
+ for declust in event:
+ x = log(1.0/declust['Delta'])
+ y = self.ptcoord(declust)
+ psi = declust['psi']
+ xind = ceil((x - self.xmin)/self.x_pxl_wdth - 1.0)
+ yind = ceil((y - self.ymin)/self.y_pxl_wdth - 1.0)
+ # print((x - self.xmin)/self.x_pxl_wdth,xind,
+ # (y - self.ymin)/self.y_pxl_wdth,yind,':',
+ # declust['delta_R'],declust['pt2'])
+ if (max(xind,yind) < self.npxl and min(xind, yind) >= 0):
+ res[xind,yind] += 1
+ L1norm += 1.0
+ if L1norm > 0.0:
+ res[0] = res[0]/L1norm
+ return res
+
+ def ptcoord(self, declust):
+ val = declust['kt']
+ return log(val)
+
+
+class LundDense(Image):
+ """
+ Take input file and transforms it into parsable lund sequence.
+ """
+ def __init__(self,infile, nmax, nlen, secondary=False):
+ Image.__init__(self, infile, nmax)
+ self.nlen = nlen
+ self.secondary = secondary
+
+ def process(self, event):
+ res = np.zeros((self.nlen if not self.secondary else self.nlen*2, 2))
+
+ if self.secondary:
+ event_secondary = event[1]
+ event = event[0]
+ for i in range(self.nlen):
+ if (i>= len(event_secondary)):
+ break
+ dec=self.fill_declust(event_secondary[i])
+ res[self.nlen+i,:] = dec
+
+ for i in range(self.nlen):
+ if (i >= len(event)):
+ break
+ res[i,:] = self.fill_declust(event[i])
+
+ return res
+
+ def fill_declust(self,declust):
+ res = np.zeros(2)
+ res[0] = log(1.0/declust['Delta'])
+ res[1] = self.ptcoord(declust)
+ return res
+
+ def ptcoord(self, declust):
+ val = declust['kt']
+ return log(val)
+
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/read_lund_json.py
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/jets.json
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/jets.json (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/jets.json (revision 1159)
@@ -0,0 +1,2 @@
+[{"p_pt":983.387,"p_m":39.9912,"h_pt":983.065,"s_pt":0.356448,"z":0.000362457,"Delta":0.68262,"kt":0.243318,"psi":-2.27417},{"p_pt":983.065,"p_m":35.4172,"h_pt":982.621,"s_pt":0.461349,"z":0.000469289,"Delta":0.527174,"kt":0.243211,"psi":-1.02664},{"p_pt":982.621,"p_m":32.8883,"h_pt":981.294,"s_pt":1.34048,"z":0.00136417,"Delta":0.442638,"kt":0.593347,"psi":1.90151},{"p_pt":981.294,"p_m":28.3702,"h_pt":980.937,"s_pt":0.362421,"z":0.000369328,"Delta":0.327275,"kt":0.118611,"psi":0.992173},{"p_pt":980.937,"p_m":27.6178,"h_pt":980.823,"s_pt":0.118531,"z":0.000120834,"Delta":0.261998,"kt":0.0310549,"psi":-0.211632},{"p_pt":980.823,"p_m":27.4721,"h_pt":980.44,"s_pt":0.39026,"z":0.000397887,"Delta":0.216785,"kt":0.0846025,"psi":-2.67709},{"p_pt":980.44,"p_m":27.1382,"h_pt":975.839,"s_pt":4.61293,"z":0.0047049,"Delta":0.209158,"kt":0.964832,"psi":1.92125},{"p_pt":975.839,"p_m":22.6675,"h_pt":971.523,"s_pt":4.34909,"z":0.00445662,"Delta":0.131589,"kt":0.572294,"psi":0.338527},{"p_pt":971.523,"p_m":20.8426,"h_pt":943.03,"s_pt":28.5948,"z":0.0294298,"Delta":0.0954486,"kt":2.72933,"psi":2.68233},{"p_pt":943.03,"p_m":11.414,"h_pt":941.26,"s_pt":1.76973,"z":0.00187664,"Delta":0.0805586,"kt":0.142567,"psi":1.69815},{"p_pt":941.26,"p_m":10.9196,"h_pt":934.585,"s_pt":6.67619,"z":0.00709282,"Delta":0.0518329,"kt":0.346046,"psi":-1.28412},{"p_pt":934.585,"p_m":9.95054,"h_pt":933.886,"s_pt":0.699017,"z":0.000747944,"Delta":0.0346941,"kt":0.0242518,"psi":-0.167118},{"p_pt":933.886,"p_m":9.90727,"h_pt":917.674,"s_pt":16.2161,"z":0.017364,"Delta":0.0217076,"kt":0.352012,"psi":-2.98636},{"p_pt":917.674,"p_m":8.70484,"h_pt":776.048,"s_pt":141.627,"z":0.154333,"Delta":0.0200353,"kt":2.83755,"psi":-1.32753},{"p_pt":776.048,"p_m":4.85364,"h_pt":744.504,"s_pt":31.5438,"z":0.0406467,"Delta":0.0142308,"kt":0.448895,"psi":1.2169},{"p_pt":744.504,"p_m":3.50525,"h_pt":669.635,"s_pt":74.87,"z":0.100563,"Delta":0.00841709,"kt":0.630187,"psi":2.33366},{"p_pt":669.635,"p_m":1.98393,"h_pt":533.665,"s_pt":135.971,"z":0.203052,"Delta":0.00436831,"kt":0.593964,"psi":-0.741957},{"p_pt":533.665,"p_m":1.39886,"h_pt":446.581,"s_pt":87.0835,"z":0.16318,"Delta":0.00392294,"kt":0.341623,"psi":1.56933},{"p_pt":446.581,"p_m":1.01822,"h_pt":256.731,"s_pt":189.851,"z":0.42512,"Delta":0.00296941,"kt":0.563745,"psi":0.535213}]
+[{"p_pt":908.098,"p_m":87.7124,"h_pt":906.441,"s_pt":1.67729,"z":0.00184699,"Delta":0.897478,"kt":1.50533,"psi":-1.74757},{"p_pt":906.441,"p_m":79.121,"h_pt":905.698,"s_pt":0.752464,"z":0.000830121,"Delta":0.620002,"kt":0.466529,"psi":1.82802},{"p_pt":905.698,"p_m":76.7744,"h_pt":897.753,"s_pt":9.44311,"z":0.0104091,"Delta":0.575682,"kt":5.43623,"psi":0.0793599},{"p_pt":897.753,"p_m":41.7543,"h_pt":896.907,"s_pt":0.925819,"z":0.00103117,"Delta":0.442797,"kt":0.40995,"psi":2.81067},{"p_pt":896.907,"p_m":38.1389,"h_pt":893.73,"s_pt":3.21669,"z":0.00358627,"Delta":0.415925,"kt":1.3379,"psi":-1.18555},{"p_pt":893.73,"p_m":26.2828,"h_pt":888.803,"s_pt":4.97201,"z":0.00556294,"Delta":0.309435,"kt":1.53851,"psi":-2.02065},{"p_pt":888.803,"p_m":12.7422,"h_pt":888.25,"s_pt":0.567807,"z":0.000638834,"Delta":0.23164,"kt":0.131527,"psi":-3.02721},{"p_pt":888.25,"p_m":11.5241,"h_pt":887.935,"s_pt":0.3164,"z":0.000356205,"Delta":0.129135,"kt":0.0408584,"psi":-0.509985},{"p_pt":887.935,"p_m":11.3171,"h_pt":884.026,"s_pt":3.91361,"z":0.00440752,"Delta":0.111631,"kt":0.436879,"psi":2.01504},{"p_pt":884.026,"p_m":8.95196,"h_pt":878.154,"s_pt":5.88085,"z":0.00665227,"Delta":0.0569981,"kt":0.335197,"psi":2.92986},{"p_pt":878.154,"p_m":7.93364,"h_pt":872.286,"s_pt":5.86934,"z":0.00668371,"Delta":0.0504045,"kt":0.295841,"psi":-1.28543},{"p_pt":872.286,"p_m":7.04265,"h_pt":852.055,"s_pt":20.2422,"z":0.0232056,"Delta":0.0346173,"kt":0.700731,"psi":0.0528261},{"p_pt":852.055,"p_m":5.24347,"h_pt":800.269,"s_pt":51.7916,"z":0.060784,"Delta":0.0153863,"kt":0.79688,"psi":-3.13262},{"p_pt":800.269,"p_m":4.03811,"h_pt":612.176,"s_pt":188.097,"z":0.235041,"Delta":0.0101382,"kt":1.90696,"psi":0.854257},{"p_pt":612.176,"p_m":0.796087,"h_pt":599.106,"s_pt":13.0696,"z":0.0213494,"Delta":0.00772393,"kt":0.100949,"psi":-1.93659},{"p_pt":599.106,"p_m":0.403809,"h_pt":570.907,"s_pt":28.199,"z":0.0470685,"Delta":0.00297593,"kt":0.0839182,"psi":0.118626}]
Index: contrib/contribs/LundPlane/tags/1.0.0/example_secondary.ref
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/example_secondary.ref (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/example_secondary.ref (revision 1159)
@@ -0,0 +1,27 @@
+# read an event with 354 particles
+#--------------------------------------------------------------------------
+# FastJet release 3.3.0
+# M. Cacciari, G.P. Salam and G. Soyez
+# A software package for jet finding and analysis at colliders
+# http://fastjet.fr
+#
+# Please cite EPJC72(2012)1896 [arXiv:1111.6097] if you use this package
+# for scientific work and optionally PLB641(2006)57 [hep-ph/0512210].
+#
+# FastJet is provided without warranty under the terms of the GNU GPLv2.
+# It uses T. Chan's closest pair algorithm, S. Fortune's Voronoi code
+# and 3rd party plugin jet algorithms. See COPYING file for details.
+#--------------------------------------------------------------------------
+LundWithSecondary using SecondaryLund (mMDT selection of leading emission, zcut=0.025) and LundGenerator with R=1 and Recluster with new_jet_def = Longitudinally invariant Cambridge/Aachen algorithm with R = 1000 and E scheme recombination and keeping the hardest inclusive jet
+
+Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet 0 are:
+(0.381818, -1.41338); (0.640225, -1.41382); (0.815003, -0.521976); (1.11695, -2.1319); (1.33942, -3.472); (1.52885, -2.46979); (1.56466, -0.0358016); (2.02807, -0.558102); (2.34917, 1.00406); (2.51877, -1.94794); (2.95973, -1.06118); (3.36119, -3.71927); (3.83009, -1.04409); (3.91026, 1.04294); (4.25234, -0.800966); (4.77749, -0.461738); (5.43338, -0.520936); (5.54091, -1.07405); (5.81939, -0.573153)
+
+with Lund coordinates for the secondary plane:
+(2.95691, -1.89881); (3.39155, -1.95856); (3.87725, -1.79439)
+
+Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet 1 are:
+(0.108166, 0.409011); (0.478032, -0.762435); (0.5522, 1.69309); (0.814643, -0.89172); (0.87725, 0.291102); (1.17301, 0.430816); (1.46257, -2.02855); (2.04689, -3.19764); (2.19256, -0.828099); (2.86474, -1.09304); (2.98768, -1.21793); (3.3634, -0.355632); (4.17428, -0.227052); (4.59144, 0.645512); (4.86343, -2.29314); (5.8172, -2.47791)
+
+with Lund coordinates for the secondary plane:
+
Index: contrib/contribs/LundPlane/tags/1.0.0/Makefile
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/Makefile (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/Makefile (revision 1159)
@@ -0,0 +1,84 @@
+# If you are using this Makefile standalone and fastjet-config is not
+# in your path, edit this line to specify the full path
+FASTJETCONFIG=fastjet-config
+PREFIX=`$(FASTJETCONFIG) --prefix`
+CXX=g++
+CXXFLAGS= -O3 -Wall -g
+install_script = $(SHELL) ../utils/install-sh
+check_script = ../utils/check.sh
+
+# global contrib-wide Makefile include may override some of the above
+# variables (leading "-" means don't give an error if you can't find
+# the file)
+-include ../.Makefile.inc
+
+#------------------------------------------------------------------------
+# things that are specific to this contrib
+NAME=LundPlane
+SRCS=LundGenerator.cc LundWithSecondary.cc SecondaryLund.cc
+EXAMPLES=example example_secondary
+INSTALLED_HEADERS=LundGenerator.hh LundWithSecondary.hh SecondaryLund.hh LundJSON.hh
+#------------------------------------------------------------------------
+
+CXXFLAGS+= $(shell $(FASTJETCONFIG) --cxxflags)
+LDFLAGS += -lm $(shell $(FASTJETCONFIG) --libs)
+
+OBJS = $(SRCS:.cc=.o)
+EXAMPLES_SRCS = $(EXAMPLES:=.cc)
+
+install_HEADER = $(install_script) -c -m 644
+install_LIB = $(install_script) -c -m 644
+install_DIR = $(install_script) -d
+install_DATA = $(install_script) -c -m 644
+install_PROGRAM = $(install_script) -c -s
+install_SCRIPT = $(install_script) -c
+
+.PHONY: clean distclean examples check install
+
+# compilation of the code (default target)
+all: lib$(NAME).a
+
+lib$(NAME).a: $(OBJS)
+ ar cru lib$(NAME).a $(OBJS)
+ ranlib lib$(NAME).a
+
+# building the examples
+examples: $(EXAMPLES)
+
+# the following construct makes it possible to automatically build
+# each of the examples listed in $EXAMPLES
+$(EXAMPLES): % : %.o all
+ $(CXX) $(CXXFLAGS) -o $@ $< -L. -l$(NAME) $(LDFLAGS)
+
+# check that everything went fine
+check: examples
+ @for prog in $(EXAMPLES); do\
+ $(check_script) $${prog} ../data/single-event.dat || exit 1; \
+ done
+ @echo "All tests successful"
+
+# cleaning the directory
+clean:
+ rm -f *~ *.o
+
+distclean: clean
+ rm -f lib$(NAME).a $(EXAMPLES)
+
+# install things in PREFIX/...
+install: all
+ $(install_DIR) $(PREFIX)/include/fastjet/contrib
+ for header in $(INSTALLED_HEADERS); do\
+ $(install_HEADER) $$header $(PREFIX)/include/fastjet/contrib/;\
+ done
+ $(install_DIR) $(PREFIX)/lib
+ $(install_LIB) lib$(NAME).a $(PREFIX)/lib
+
+depend:
+ makedepend -Y -- -- $(SRCS) $(EXAMPLES_SRCS)
+# DO NOT DELETE
+
+LundGenerator.o: LundGenerator.hh
+LundWithSecondary.o: LundWithSecondary.hh LundGenerator.hh SecondaryLund.hh
+SecondaryLund.o: SecondaryLund.hh LundGenerator.hh
+example.o: LundGenerator.hh SecondaryLund.hh LundJSON.hh
+example_secondary.o: LundWithSecondary.hh LundGenerator.hh SecondaryLund.hh
Index: contrib/contribs/LundPlane/tags/1.0.0/example.cc
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/example.cc (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/example.cc (revision 1159)
@@ -0,0 +1,118 @@
+//----------------------------------------------------------------------
+/// \file example.cc
+///
+/// This example program is meant to illustrate how the
+/// fastjet::contrib::LundGenerator class is used.
+///
+/// Run this example with
+///
+/// \verbatim
+/// ./example < ../data/single-event.dat
+/// \endverbatim
+
+//----------------------------------------------------------------------
+// $Id$
+//
+// Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+#include "fastjet/PseudoJet.hh"
+#include <string>
+#include "LundGenerator.hh" // In external code, this should be fastjet/contrib/LundGenerator.hh
+#include "LundJSON.hh" // In external code, this should be fastjet/contrib/LundJSON.hh
+using namespace std;
+using namespace fastjet;
+
+// forward declaration to make things clearer
+void read_event(vector<PseudoJet> &event);
+
+//----------------------------------------------------------------------
+int main(){
+
+ //----------------------------------------------------------
+ // read in input particles
+ vector<PseudoJet> event;
+ read_event(event);
+ string filename = "jets.json";
+ cout << "# read an event with " << event.size() << " particles" << endl;
+ cout << "# writing declusterings of primary and secondary plane to file "
+ << filename << endl;
+
+ ofstream outfile;
+ outfile.open(filename);
+
+ // first get some anti-kt jets
+ double R = 1.0, ptmin = 100.0;
+ JetDefinition jet_def(antikt_algorithm, R);
+ ClusterSequence cs(event, jet_def);
+ vector<PseudoJet> jets = sorted_by_pt(cs.inclusive_jets(ptmin));
+
+ //----------------------------------------------------------
+ // create an instance of LundGenerator, with default options
+ contrib::LundGenerator lund;
+
+ cout << lund.description() << endl;
+
+ for (unsigned ijet = 0; ijet < jets.size(); ijet++) {
+ cout << endl << "Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet "
+ << ijet << " are:" << endl;
+ vector<contrib::LundDeclustering> declusts = lund(jets[ijet]);
+
+ for (int idecl = 0; idecl < declusts.size(); idecl++) {
+ pair<double,double> coords = declusts[idecl].lund_coordinates();
+ cout << "(" << coords.first << ", " << coords.second << ")";
+ if (idecl < declusts.size() - 1) cout << "; ";
+ }
+
+ cout << endl;
+
+ // outputs the primary Lund plane
+ lund_to_json(outfile, declusts); outfile << endl;
+ // outputs the full Lund tree
+ //to_json(cout, lund_gen, jets[ijet]); cout << endl;
+ }
+
+ cout << endl << "File " << filename << " written." << endl;
+
+
+
+ return 0;
+}
+
+// read in input particles
+void read_event(vector<PseudoJet> &event){
+ string line;
+ while (getline(cin, line)) {
+ istringstream linestream(line);
+ // take substrings to avoid problems when there is extra "pollution"
+ // characters (e.g. line-feed).
+ if (line.substr(0,4) == "#END") {return;}
+ if (line.substr(0,1) == "#") {continue;}
+ double px,py,pz,E;
+ linestream >> px >> py >> pz >> E;
+ PseudoJet particle(px,py,pz,E);
+
+ // push event onto back of full_event vector
+ event.push_back(particle);
+ }
+}
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/example.cc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/example.py
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/example.py (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/example.py (revision 1159)
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+#
+#----------------------------------------------------------------------
+# $Id$
+#
+# Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+#
+#----------------------------------------------------------------------
+# This file is part of FastJet contrib.
+#
+# It is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# It is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this code. If not, see <http://www.gnu.org/licenses/>.
+#----------------------------------------------------------------------
+#
+# Load a sample file and plot it.
+#
+# Usage:
+# python3 plot_lund.py [--file filename] [--bkg file_bkg]
+# [--njet njet] [--npxl npixels]
+#
+
+import read_lund_json as lund
+#from import LundImage
+from matplotlib.colors import LogNorm
+import numpy as np
+import matplotlib.pyplot as plt
+import argparse
+
+parser = argparse.ArgumentParser(description='Plot lund images')
+parser.add_argument('--file', action = 'store', default = 'jets.json')
+parser.add_argument('--njet', type = int, default = 2, help='Maximum number of jets to analyse')
+parser.add_argument('--npxl', type = int, default = 25, help="Number of pixels in each dimension of the image")
+
+args = parser.parse_args()
+
+# set up the reader and get array from file
+xval = [0.0, 3.0]
+yval = [-3.0, 5.0]
+
+# start by creating a reader for the json file produced by example.cc
+# (one json entry per line, correspond to one jet per json entry)
+reader = lund.Reader(args.file, args.njet)
+
+# Then examine the jets it contains
+print ("Contents of the file", args.file)
+for jet in reader:
+ # jet is an array of declusterings.
+ # The jet's pt can be obtained by looking at the first declustering (jet[0])
+ # and extracting the subjet-pair pt ("p_pt")
+ print(" Jet with pt = {:6.1f} GeV with {:3d} primary Lund-plane declusterings".format(jet[0]["p_pt"], len(jet)))
+print()
+
+# Reset the reader to the start and use it with a helper
+# class to extract an image for each jet
+reader.reset()
+image_generator = lund.LundImage(reader, args.njet, args.npxl, xval, yval)
+images = image_generator.values()
+
+# Get the average of the images
+print("Now creating average lund image from the {} jets".format(len(images)))
+avg_img = np.average(images,axis=0)
+
+# Plot the result
+fig=plt.figure(figsize=(6, 4.5))
+plt.title('Averaged Lund image')
+plt.xlabel('$\ln(R / \Delta)$')
+plt.ylabel('$\ln(k_t / \mathrm{GeV})$')
+plt.imshow(avg_img.transpose(), origin='lower', aspect='auto',
+ extent=xval+yval, cmap=plt.get_cmap('BuPu'))
+plt.colorbar()
+
+print("Close the viewer window to exit")
+plt.show()
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/example.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/VERSION
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/VERSION (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/VERSION (revision 1159)
@@ -0,0 +1 @@
+1.0.0
Index: contrib/contribs/LundPlane/tags/1.0.0/AUTHORS
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/AUTHORS (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/AUTHORS (revision 1159)
@@ -0,0 +1,12 @@
+The LundPlane FastJet contrib is developed and maintained by:
+
+ Frederic Dreyer <frederic.dreyer@physics.ox.ac.uk>
+ Gavin P. Salam <gavin.salam@cern.ch>
+ Gregory Soyez <soyez@fastjet.fr>
+
+The physics is based on:
+
+ The Lund Jet Plane.
+ Frederic A. Dreyer, Gavin P. Salam, and Gregory Soyez
+ arXiv:1807.04758
+
Index: contrib/contribs/LundPlane/tags/1.0.0/example_secondary.cc
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/example_secondary.cc (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/example_secondary.cc (revision 1159)
@@ -0,0 +1,115 @@
+//----------------------------------------------------------------------
+/// \file example_secondary.cc
+///
+/// This example program is meant to illustrate how the
+/// fastjet::contrib::LundWithSecondary class is used.
+///
+/// Run this example with
+///
+/// \verbatim
+/// ./example_secondary < ../data/single-event.dat
+/// \endverbatim
+
+//----------------------------------------------------------------------
+// $Id$
+//
+// Copyright (c) -, Frederic A. Dreyer, Gavin P. Salam, Gregory Soyez
+//
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+#include "fastjet/PseudoJet.hh"
+#include <string>
+#include "LundWithSecondary.hh" // In external code, this should be fastjet/contrib/LundWithSecondary.hh
+using namespace std;
+using namespace fastjet;
+
+// forward declaration to make things clearer
+void read_event(vector<PseudoJet> &event);
+
+//----------------------------------------------------------------------
+int main(){
+
+ //----------------------------------------------------------
+ // read in input particles
+ vector<PseudoJet> event;
+ read_event(event);
+ cout << "# read an event with " << event.size() << " particles" << endl;
+
+ // first get some anti-kt jets
+ double R = 1.0, ptmin = 100.0;
+ JetDefinition jet_def(antikt_algorithm, R);
+ ClusterSequence cs(event, jet_def);
+ vector<PseudoJet> jets = sorted_by_pt(cs.inclusive_jets(ptmin));
+
+ //----------------------------------------------------------
+ // create an instance of LundWithSecondary, with default options
+ contrib::SecondaryLund_mMDT secondary;
+ contrib::LundWithSecondary lund(&secondary);
+
+ cout << lund.description() << endl;
+
+ for (unsigned ijet = 0; ijet < jets.size(); ijet++) {
+ cout << endl << "Lund coordinates ( ln 1/Delta, ln kt ) of declusterings of jet "
+ << ijet << " are:" << endl;
+ vector<contrib::LundDeclustering> declusts = lund.primary(jets[ijet]);
+
+ for (int idecl = 0; idecl < declusts.size(); idecl++) {
+ pair<double,double> coords = declusts[idecl].lund_coordinates();
+ cout << "(" << coords.first << ", " << coords.second << ")";
+ if (idecl < declusts.size() - 1) cout << "; ";
+ }
+
+ cout << endl;
+
+ vector<contrib::LundDeclustering> sec_declusts = lund.secondary(jets[ijet]);
+ cout << endl << "with Lund coordinates for the secondary plane:" << endl;
+ for (int idecl = 0; idecl < sec_declusts.size(); ++idecl) {
+ pair<double,double> coords = sec_declusts[idecl].lund_coordinates();
+ cout << "(" << coords.first << ", " << coords.second << ")";
+ if (idecl < sec_declusts.size() - 1) cout << "; ";
+ }
+
+ cout << endl;
+ }
+
+
+
+ return 0;
+}
+
+// read in input particles
+void read_event(vector<PseudoJet> &event){
+ string line;
+ while (getline(cin, line)) {
+ istringstream linestream(line);
+ // take substrings to avoid problems when there is extra "pollution"
+ // characters (e.g. line-feed).
+ if (line.substr(0,4) == "#END") {return;}
+ if (line.substr(0,1) == "#") {continue;}
+ double px,py,pz,E;
+ linestream >> px >> py >> pz >> E;
+ PseudoJet particle(px,py,pz,E);
+
+ // push event onto back of full_event vector
+ event.push_back(particle);
+ }
+}
Property changes on: contrib/contribs/LundPlane/tags/1.0.0/example_secondary.cc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: contrib/contribs/LundPlane/tags/1.0.0/ChangeLog
===================================================================
--- contrib/contribs/LundPlane/tags/1.0.0/ChangeLog (revision 0)
+++ contrib/contribs/LundPlane/tags/1.0.0/ChangeLog (revision 1159)
@@ -0,0 +1,4 @@
+2018-08-09 Frédéric Dreyer <fdreyer@mit.edu>
+
+ First version of LundPlane.
+

File Metadata

Mime Type
text/x-diff
Expires
Sat, Dec 21, 2:03 PM (11 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4023056
Default Alt Text
(81 KB)

Event Timeline