Page MenuHomeHEPForge

No OneTemporary

Index: contrib/contribs/JetCleanser/tags/1.0.0/ChangeLog
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/ChangeLog (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/ChangeLog (revision 333)
@@ -0,0 +1,3 @@
+2013-08-28 <mattlow@localhost>
+
+ Initial creation
Index: contrib/contribs/JetCleanser/tags/1.0.0/COPYING
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/COPYING (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/COPYING (revision 333)
@@ -0,0 +1,358 @@
+The JetCleanser contrib to FastJet is released
+under the terms of the GNU General Public License v2 (GPLv2).
+
+A copy of the GPLv2 is to be found at the end of this file.
+
+While the GPL license grants you considerable freedom, please bear in
+mind that this code's use falls under guidelines similar to those that
+are standard for Monte Carlo event generators
+(http://www.montecarlonet.org/GUIDELINES). In particular, if you use
+this code as part of work towards a scientific publication, whether
+directly or contained within another program you should include a citation
+to
+
+ arXiv:1309.4777
+
+======================================================================
+======================================================================
+======================================================================
+ 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/JetCleanser/tags/1.0.0/NEWS
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/NEWS (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/NEWS (revision 333)
@@ -0,0 +1 @@
+2013/08/28: Initial creation
Index: contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.hh
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.hh (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.hh (revision 333)
@@ -0,0 +1,168 @@
+// JetCleanser Package
+// Questions/Comments? dkrohn@physics.harvard.edu mattlow@uchicago.edu schwartz@physics.harvard.edu liantaow@uchicago.edu
+//
+// Copyright (c) 2013
+// David Krohn, Matthew Low, Matthew Schwartz, and Lian-Tao Wang
+//
+// $Id$
+//
+//----------------------------------------------------------------------
+// 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_JETCLEANSER_HH__
+#define __FASTJET_CONTRIB_JETCLEANSER_HH__
+
+#include <fastjet/internal/base.hh>
+
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/Error.hh"
+#include "fastjet/JetDefinition.hh"
+//#include "fastjet/FunctionOfPseudoJet.hh"
+
+#include <map>
+#include <sstream>
+#include <string>
+
+FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+//------------------------------------------------------------------------
+/// \class JetCleanser
+/// This class implements jet cleansing which is a substructure technique
+/// designed to correct for the effects of pileup.
+///
+/// Jet cleansing takes as input either:
+/// (A) "calorimeter" or "particle" four-vectors which are charged and neutral
+/// particles all grouped together, charged tracks coming from the primary
+/// interaction, and charged tracks coming from pileup.
+/// (B) neutral particles, charged tracks coming from the primary
+/// interaction, and charged tracks coming from pileup.
+///
+/// The output is a jet for which the constituents themselves have been
+/// corrected so that the output can be used to calculate both
+/// kinematic quantities and shape variables. The rescale subjets are also
+/// available via the pieces() function.
+///
+class JetCleanser {
+
+public:
+ enum cleansing_mode {
+ jvf_cleansing, /// gamma0 = gamma1
+ linear_cleansing, /// approximate gamma0 as constant
+ gaussian_cleansing /// approximate gamma's as truncated gaussians and maximize likelihood
+ };
+
+ enum input_mode {
+ input_nc_together, /// input is all charged and neutrals together (as particles or calo cells),
+ /// charged primary interaction particles, and charged pileup particles
+ input_nc_separate /// input is all neutral particles, charged primary interaction particles,
+ /// and charged pileup particles
+ };
+
+public:
+ // constructors
+ JetCleanser(JetDefinition subjet_def, cleansing_mode cmode, input_mode imode);
+ JetCleanser(double rsub, cleansing_mode cmode, input_mode imode);
+
+ // destructor
+ ~JetCleanser(){}
+
+ // settings
+ void SetGroomingParameters(double fcut, int nsjmin);
+ inline void SetTrimming(double fcut) { SetGroomingParameters(fcut,0); }
+ inline void SetFiltering(int nsj) { SetGroomingParameters(1.0,nsj); }
+ void SetLinearParameters(double g0_mean=0.67);
+ void SetGaussianParameters(double g0_mean=0.67, double g1_mean=0.67, double g0_width=0.15, double g1_width=0.25);
+
+ // standard usage
+ std::string description() const;
+ PseudoJet operator()(const PseudoJet & jet, // For use with input_nc_together mode,
+ const std::vector<PseudoJet> & tracks_lv, // it takes a plain jet, charged tracks from
+ const std::vector<PseudoJet> & tracks_pu) const; // the leading vertex, and charged tracks
+ // from pileup.
+ PseudoJet operator()(const std::vector<PseudoJet> & neutrals_all, // For use with input_nc_separate mode,
+ const std::vector<PseudoJet> & tracks_lv, // it takes all neutral particles, charged
+ const std::vector<PseudoJet> & tracks_pu) const; // tracks from the leading vertex, and charged
+ // tracks from pileup.
+ void _RunTests();
+
+
+private:
+ static const double jc_zero = 1.0e-6;
+
+ double _rsub;
+ double _fcut;
+ double _nsjmin;
+ JetDefinition _subjet_def;
+
+ cleansing_mode _cleansing_mode;
+ input_mode _input_mode;
+
+ double _linear_gamma0_mean;
+ double _gaussian_gamma0_mean;
+ double _gaussian_gamma0_width;
+ double _gaussian_gamma1_mean;
+ double _gaussian_gamma1_width;
+
+ // helper functions
+ void _SetDefaults();
+ void _CheckRescalingValues(double & pt_all, const double & ptc_lv, const double & ptc_pu) const;
+ double _GetSubjetRescaling_nctogether(double pt_all, double ptc_lv, double ptc_pu) const;
+ double _GetSubjetRescaling_ncseparate(double ptn_all, double ptc_lv, double ptc_pu) const;
+ double _GaussianGetMinimizedGamma0(double pt_all, double ptc_lv, double ptc_pu) const;
+ double _GaussianGetGamma1(double gamma0, double pt_all, double ptc_lv, double ptc_pu) const;
+ double _GaussianFunction(double x, void * params) const;
+ void _RunTestRescaling(double pt_all, double ptc_lv, double ptc_pu) const;
+};
+
+
+// helper function
+std::vector<PseudoJet> RescalePseudoJetVector(const std::vector<PseudoJet> & jets, const double s_factor);
+
+// helper function
+PseudoJet RescalePseudoJetConstituents(const PseudoJet & jet, const double s_factor);
+
+// helper function
+std::vector< std::vector<PseudoJet> > ClusterSets(const JetDefinition & jet_def,
+ const std::vector<PseudoJet> & cluster_set,
+ const std::vector< std::vector<PseudoJet> > & follow_sets,
+ const double &ptmin=0.0);
+
+
+
+//------------------------------------------------------------------------
+/// \class FollowSetGhostInfo
+/// This class keeps tracks of which set of PseudoJets and the index where
+/// the associated ghost PseudoJet came from.
+///
+class FollowSetGhostInfo : public PseudoJet::UserInfoBase {
+ public:
+ inline FollowSetGhostInfo(int set_id, int ind_id) { _set_id = set_id; _ind_id = ind_id; }
+ inline int GetSetId() { return _set_id; }
+ inline int GetIndId() { return _ind_id; }
+
+ private:
+ int _set_id;
+ int _ind_id;
+};
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif // __FASTJET_CONTRIB_JETCLEANSER_HH__
Index: contrib/contribs/JetCleanser/tags/1.0.0/Makefile
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/Makefile (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/Makefile (revision 333)
@@ -0,0 +1,77 @@
+# 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=JetCleanser
+SRCS=JetCleanser.cc
+EXAMPLES=example
+INSTALLED_HEADERS=JetCleanser.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) -o $@ $< -L. -l$(NAME) $(LDFLAGS)
+
+# check that everything went fine
+check: examples
+ @for prog in $(EXAMPLES); do\
+ $(check_script) $${prog} ../data/Pythia-Zp2jets-lhc-pileup-1ev.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)
Index: contrib/contribs/JetCleanser/tags/1.0.0/README
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/README (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/README (revision 333)
@@ -0,0 +1,22 @@
+JetCleanser is part of the fastjet-contrib project.
+
+The JetCleanser class allows one to cleanse a jet as described in
+
+ Jet Cleansing: Pileup Removal at High Luminosity
+ David Krohn, Matthew Low, Matthew D. Schwartz, and Lian-Tao Wang.
+ arXiv:1309.4777
+
+The code example.cc illustrates how to use the class in a simple case.
+
+ make example
+
+example.cc makes use of an input datafile which is provided in the
+/data directory, and it should be run with
+
+ ./example < ../data/Pythia-Zp2jets-lhc-pileup-1ev.dat
+
+The expected output can be found in example.ref
+
+Not currently supported (but may be added in the future):
+ - areas after cleansing
+ - information whether linear defaulted to JVF or not
Index: contrib/contribs/JetCleanser/tags/1.0.0/example.cc
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/example.cc (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/example.cc (revision 333)
@@ -0,0 +1,301 @@
+// JetCleanser Package
+// Questions/Comments? dkrohn@physics.harvard.edu mattlow@uchicago.edu schwartz@physics.harvard.edu liantaow@uchicago.edu
+//
+// Copyright (c) 2013
+// David Krohn, Matthew Low, Matthew Schwartz, and Lian-Tao Wang
+//
+// Compile it with "make example" and run it with
+//
+// ./example < ../data/Pythia-Zp2jets-lhc-pileup-1ev.dat
+//
+// $Id$
+//
+//----------------------------------------------------------------------
+// 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 <sstream>
+#include <cstdlib>
+
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/FunctionOfPseudoJet.hh"
+#include "JetCleanser.hh" // In external code, this should be fastjet/contrib/JetCleanser.hh
+
+using namespace std;
+using namespace fastjet;
+using namespace fastjet::contrib;
+
+// forward declaration to make things clearer
+void read_event(vector<PseudoJet> &hard_event_charged, vector<PseudoJet> &hard_event_neutral,
+ vector<PseudoJet> &pileup_charged, vector<PseudoJet> &pileup_neutral);
+
+//----------------------------------------------------------------------
+int main(){
+
+ //----------------------------------------------------------
+ // read in input particles
+ vector<PseudoJet> hard_event_charged, hard_event_neutral, pileup_charged, pileup_neutral;
+ read_event(hard_event_charged, hard_event_neutral, pileup_charged, pileup_neutral);
+
+ //----------------------------------------------------------
+ // construct measureable quantities
+ vector<PseudoJet> hard_event, full_event; // via "calo cells"
+ vector<PseudoJet> full_event_neutral; // via "particle flow"
+
+ for (unsigned i=0; i<hard_event_charged.size(); i++) {
+ hard_event.push_back( hard_event_charged[i] );
+ full_event.push_back( hard_event_charged[i] ); }
+
+ for (unsigned i=0; i<hard_event_neutral.size(); i++) {
+ hard_event.push_back( hard_event_neutral[i] );
+ full_event.push_back( hard_event_neutral[i] );
+ full_event_neutral.push_back( hard_event_neutral[i] ); }
+
+ for (unsigned i=0; i<pileup_charged.size(); i++) {
+ full_event.push_back( pileup_charged[i] ); }
+
+ for (unsigned i=0; i<pileup_neutral.size(); i++) {
+ full_event.push_back( pileup_neutral[i] );
+ full_event_neutral.push_back( pileup_neutral[i] ); }
+
+ //----------------------------------------------------------
+ // illustrate how this JetCleanser contrib works
+
+ // find jets
+ JetDefinition jet_def( antikt_algorithm, 1.0 );
+ vector< vector<PseudoJet> > sets;
+ sets.push_back( full_event ); // calorimeter cells
+ sets.push_back( hard_event_charged ); // tracks from primary interaction
+ sets.push_back( pileup_charged ); // tracks from pileup
+ sets.push_back( full_event_neutral ); // neutral particles
+ sets.push_back( hard_event ); // for truth comparison
+
+ // collect jets
+ vector< vector<PseudoJet> > jet_sets = ClusterSets(jet_def, full_event, sets, 25.0);
+ vector<PseudoJet> jets_plain = jet_sets[0];
+ vector<PseudoJet> jets_tracks_LV = jet_sets[1];
+ vector<PseudoJet> jets_tracks_PU = jet_sets[2];
+ vector<PseudoJet> jets_neutrals = jet_sets[3];
+ vector<PseudoJet> jets_truth = jet_sets[4];
+
+ PseudoJet plain_dijet, truth_dijet, jvf_cleansed_dijet, lin_cleansed_dijet, gau_cleansed_dijet;
+ unsigned n_jets;
+
+ //----------------------------------------------------------
+ // ATLAS-like: cleansers
+ cout << "ATLAS-like cleansing:" << endl << endl;
+
+ JetDefinition subjet_def_A(kt_algorithm, 0.3);
+ JetCleanser jvf_cleanser_A(subjet_def_A, JetCleanser::jvf_cleansing, JetCleanser::input_nc_together);
+ jvf_cleanser_A.SetTrimming(0.01);
+
+ JetCleanser linear_cleanser_A(0.25, JetCleanser::linear_cleansing, JetCleanser::input_nc_together);
+ linear_cleanser_A.SetLinearParameters(0.65);
+
+ JetCleanser gaussian_cleanser_A(0.3, JetCleanser::gaussian_cleansing, JetCleanser::input_nc_together);
+ gaussian_cleanser_A.SetGaussianParameters(0.67,0.62,0.20,0.25);
+
+ // print info about cleansers
+ cout << jvf_cleanser_A.description() << endl;
+ cout << linear_cleanser_A.description() << endl;
+ cout << gaussian_cleanser_A.description() << endl;
+
+ // ATLAS-like: cleanse jets
+ n_jets = min((int) jets_plain.size(),3);
+ for (unsigned i=0; i<n_jets; i++){
+ PseudoJet plain_jet = jets_plain[i];
+ PseudoJet truth_jet = jets_truth[i];
+ PseudoJet jvf_cleansed_jet = jvf_cleanser_A( jets_plain[i], jets_tracks_LV[i].constituents(), jets_tracks_PU[i].constituents() );
+ PseudoJet lin_cleansed_jet = linear_cleanser_A( jets_plain[i], jets_tracks_LV[i].constituents(), jets_tracks_PU[i].constituents() );
+ PseudoJet gau_cleansed_jet = gaussian_cleanser_A( jets_plain[i], jets_tracks_LV[i].constituents(), jets_tracks_PU[i].constituents() );
+
+ cout << " no pileup: pt = " << truth_jet.pt()
+ << " eta = " << truth_jet.eta()
+ << " phi = " << truth_jet.phi()
+ << " m = " << truth_jet.m()
+ << endl;
+
+ cout << " with pileup: pt = " << plain_jet.pt()
+ << " eta = " << plain_jet.eta()
+ << " phi = " << plain_jet.phi()
+ << " m = " << plain_jet.m()
+ << endl;
+
+ cout << " with pileup + jvf cleansed: pt = " << jvf_cleansed_jet.pt()
+ << " eta = " << jvf_cleansed_jet.eta()
+ << " phi = " << jvf_cleansed_jet.phi()
+ << " m = " << jvf_cleansed_jet.m()
+ << endl;
+
+ cout << " with pileup + lin cleansed: pt = " << lin_cleansed_jet.pt()
+ << " eta = " << lin_cleansed_jet.eta()
+ << " phi = " << lin_cleansed_jet.phi()
+ << " m = " << lin_cleansed_jet.m()
+ << endl;
+
+ cout << " with pileup + gau cleansed: pt = " << gau_cleansed_jet.pt()
+ << " eta = " << gau_cleansed_jet.eta()
+ << " phi = " << gau_cleansed_jet.phi()
+ << " m = " << gau_cleansed_jet.m()
+ << endl
+ << endl;
+
+ if ( i<2 ) {
+ plain_dijet = plain_dijet + plain_jet;
+ truth_dijet = truth_dijet + truth_jet;
+ jvf_cleansed_dijet = jvf_cleansed_dijet + jvf_cleansed_jet;
+ lin_cleansed_dijet = lin_cleansed_dijet + lin_cleansed_jet;
+ gau_cleansed_dijet = gau_cleansed_dijet + gau_cleansed_jet;
+ }
+ }
+
+ cout << "Dijet Masses: " << endl
+ << " plain = " << plain_dijet.m() << endl
+ << " truth = " << truth_dijet.m() << endl
+ << " jvf = " << jvf_cleansed_dijet.m() << endl
+ << " lin = " << lin_cleansed_dijet.m() << endl
+ << " gau = " << gau_cleansed_dijet.m() << endl << endl;
+
+ plain_dijet = PseudoJet();
+ truth_dijet = PseudoJet();
+ jvf_cleansed_dijet = PseudoJet();
+ lin_cleansed_dijet = PseudoJet();
+ gau_cleansed_dijet = PseudoJet();
+
+ //----------------------------------------------------------
+ // CMS-like: cleansers
+ cout << "CMS-like cleansing:" << endl << endl;
+
+ JetDefinition subjet_def_B(kt_algorithm, 0.3);
+ JetCleanser jvf_cleanser_B(subjet_def_B, JetCleanser::jvf_cleansing, JetCleanser::input_nc_separate);
+ jvf_cleanser_B.SetTrimming(0.01);
+
+ JetCleanser linear_cleanser_B(0.25, JetCleanser::linear_cleansing, JetCleanser::input_nc_separate);
+ linear_cleanser_B.SetLinearParameters(0.65);
+
+ JetCleanser gaussian_cleanser_B(0.3, JetCleanser::gaussian_cleansing, JetCleanser::input_nc_separate);
+ gaussian_cleanser_B.SetGaussianParameters(0.67,0.62,0.20,0.25);
+
+ // print info about cleansers
+ cout << jvf_cleanser_B.description() << endl;
+ cout << linear_cleanser_B.description() << endl;
+ cout << gaussian_cleanser_B.description() << endl;
+
+ // CMS-like: cleanse jets
+ n_jets = min((int) jets_plain.size(),3);
+ for (unsigned i=0; i<n_jets; i++){
+ PseudoJet plain_jet = jets_plain[i];
+ PseudoJet truth_jet = jets_truth[i];
+ PseudoJet jvf_cleansed_jet = jvf_cleanser_B( jets_neutrals[i].constituents(), jets_tracks_LV[i].constituents(),
+ jets_tracks_PU[i].constituents() );
+ PseudoJet lin_cleansed_jet = linear_cleanser_B( jets_neutrals[i].constituents(), jets_tracks_LV[i].constituents(),
+ jets_tracks_PU[i].constituents() );
+ PseudoJet gau_cleansed_jet = gaussian_cleanser_B( jets_neutrals[i].constituents(), jets_tracks_LV[i].constituents(),
+ jets_tracks_PU[i].constituents() );
+
+ cout << " no pileup: pt = " << truth_jet.pt()
+ << " eta = " << truth_jet.eta()
+ << " phi = " << truth_jet.phi()
+ << " m = " << truth_jet.m()
+ << endl;
+
+ cout << " with pileup: pt = " << plain_jet.pt()
+ << " eta = " << plain_jet.eta()
+ << " phi = " << plain_jet.phi()
+ << " m = " << plain_jet.m()
+ << endl;
+
+ cout << " with pileup + jvf cleansed: pt = " << jvf_cleansed_jet.pt()
+ << " eta = " << jvf_cleansed_jet.eta()
+ << " phi = " << jvf_cleansed_jet.phi()
+ << " m = " << jvf_cleansed_jet.m()
+ << endl;
+
+ cout << " with pileup + lin cleansed: pt = " << lin_cleansed_jet.pt()
+ << " eta = " << lin_cleansed_jet.eta()
+ << " phi = " << lin_cleansed_jet.phi()
+ << " m = " << lin_cleansed_jet.m()
+ << endl;
+
+ cout << " with pileup + gau cleansed: pt = " << gau_cleansed_jet.pt()
+ << " eta = " << gau_cleansed_jet.eta()
+ << " phi = " << gau_cleansed_jet.phi()
+ << " m = " << gau_cleansed_jet.m()
+ << endl
+ << endl;
+
+ if ( i<2 ) {
+ plain_dijet = plain_dijet + plain_jet;
+ truth_dijet = truth_dijet + truth_jet;
+ jvf_cleansed_dijet = jvf_cleansed_dijet + jvf_cleansed_jet;
+ lin_cleansed_dijet = lin_cleansed_dijet + lin_cleansed_jet;
+ gau_cleansed_dijet = gau_cleansed_dijet + gau_cleansed_jet;
+ }
+ }
+
+ cout << "Dijet Masses: " << endl
+ << " plain = " << plain_dijet.m() << endl
+ << " truth = " << truth_dijet.m() << endl
+ << " jvf = " << jvf_cleansed_dijet.m() << endl
+ << " lin = " << lin_cleansed_dijet.m() << endl
+ << " gau = " << gau_cleansed_dijet.m() << endl << endl;
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+// read the event with and without pileup
+void read_event(vector<PseudoJet> &hard_event_charged,
+ vector<PseudoJet> &hard_event_neutral,
+ vector<PseudoJet> &pileup_charged,
+ vector<PseudoJet> &pileup_neutral){
+ string line;
+ int nsub = 0; // counter to keep track of which sub-event we're reading
+ while (getline(cin, line)) {
+ istringstream linestream(line);
+ // take substrings to avoid problems when there are extra "pollution"
+ // characters (e.g. line-feed).
+ if (line.substr(0,4) == "#END") {break;}
+ if (line.substr(0,9) == "#SUBSTART") {
+ // if more sub events follow, make copy of first one (the hard one) here
+ //if (nsub == 1) {hard_event_charged = full_event_charged; hard_event_neutral = full_event_neutral;}
+ nsub += 1;
+ }
+ if (line.substr(0,1) == "#") {continue;}
+ double px,py,pz,E;
+ int pid,charge;
+ linestream >> px >> py >> pz >> E >> pid >> charge;
+ PseudoJet particle(px,py,pz,E);
+
+ if ( nsub <= 1 ) {
+ if ( charge != 0 ) hard_event_charged.push_back(particle);
+ else hard_event_neutral.push_back(particle);
+ } else {
+ if ( charge != 0 ) pileup_charged.push_back(particle);
+ else pileup_neutral.push_back(particle);
+ }
+ }
+
+ // if there was nothing in the event
+ if (nsub == 0) {
+ cerr << "Error: read empty event\n";
+ exit(-1);
+ }
+
+ cout << "# " << nsub-1 << " pileup events on top of the hard event" << endl;
+}
Index: contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.cc
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.cc (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/JetCleanser.cc (revision 333)
@@ -0,0 +1,634 @@
+// JetCleanser Package
+// Questions/Comments? dkrohn@physics.harvard.edu mattlow@uchicago.edu schwartz@physics.harvard.edu liantaow@uchicago.edu
+//
+// Copyright (c) 2013
+// David Krohn, Matthew Low, Matthew Schwartz, and Lian-Tao Wang
+//
+// $Id$
+//
+//----------------------------------------------------------------------
+// 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 "JetCleanser.hh"
+
+FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+ /////////////////////////////
+ // constructor
+ JetCleanser::JetCleanser(JetDefinition subjet_def, cleansing_mode cmode, input_mode imode) {
+ _subjet_def = subjet_def;
+ _rsub = subjet_def.R();
+ _cleansing_mode = cmode;
+ _input_mode = imode;
+ _SetDefaults();
+ }
+
+ /////////////////////////////
+ // constructor
+ JetCleanser::JetCleanser(double rsub, cleansing_mode cmode, input_mode imode) {
+ JetDefinition subjet_def(kt_algorithm, rsub);
+ _subjet_def = subjet_def;
+ _rsub = rsub;
+ _cleansing_mode = cmode;
+ _input_mode = imode;
+ _SetDefaults();
+ }
+
+ /////////////////////////////
+ // _SetDefaults
+ void JetCleanser::_SetDefaults(){
+
+ // defaults
+ _fcut = 0.0;
+ _nsjmin = -1;
+
+ // "undefined" values
+ _linear_gamma0_mean = -1;
+ _gaussian_gamma0_mean = -1;
+ _gaussian_gamma1_mean = -1;
+ _gaussian_gamma0_width = -1;
+ _gaussian_gamma1_width = -1;
+ }
+
+ /////////////////////////////
+ // SetGroomingParameters
+ void JetCleanser::SetGroomingParameters(double fcut, int nsjmin) {
+ if ( fcut < 0 || fcut > 1 ) throw Error("SetGroomingParameters(): fcut must be >= 0 and <= 1");
+ _fcut = fcut;
+ _nsjmin = nsjmin;
+ }
+
+ /////////////////////////////
+ // SetLinearParameters
+ void JetCleanser::SetLinearParameters(double g0_mean) {
+ if ( g0_mean < 0 || g0_mean > 1 ) throw Error("SetLinearParameters(): g0_mean must be >= 0 and <= 1");
+ _linear_gamma0_mean = g0_mean;
+ }
+
+ /////////////////////////////
+ // SetGaussianParameters
+ void JetCleanser::SetGaussianParameters(double g0_mean, double g1_mean, double g0_width, double g1_width) {
+ if ( g0_mean < 0 || g0_mean > 1 ) throw Error("SetGaussianParameters(): g0_mean must be >= 0 and <= 1");
+ if ( g1_mean < 0 || g1_mean > 1 ) throw Error("SetGaussianParameters(): g1_mean must be >= 0 and <= 1");
+ if ( g0_width < 0 || g0_width > 1 ) throw Error("SetGaussianParameters(): g0_width must be >= 0 and <= 1");
+ if ( g1_width < 0 || g1_width > 1 ) throw Error("SetGaussianParameters(): g1_width must be >= 0 and <= 1");
+ _gaussian_gamma0_mean = g0_mean;
+ _gaussian_gamma1_mean = g1_mean;
+ _gaussian_gamma0_width = g0_width;
+ _gaussian_gamma1_width = g1_width;
+ }
+
+ /////////////////////////////
+ // description
+ std::string JetCleanser::description() const {
+ std::ostringstream oss;
+ oss << "JetCleanser [";
+ if ( _cleansing_mode == jvf_cleansing ) oss << "JVF mode, ";
+ else if ( _cleansing_mode == linear_cleansing ) oss << "Linear mode, ";
+ else if ( _cleansing_mode == gaussian_cleansing ) oss << "Gaussian mode, ";
+ if ( _input_mode == input_nc_together ) oss << "input = neutral and charged together]" << std::endl;
+ else if ( _input_mode == input_nc_separate ) oss << "input = neutral and charged separate]" << std::endl;
+
+ if ( _nsjmin <= 0 ) oss << " Trimming: fcut = " << _fcut << std::endl;
+ else if ( _fcut >= 1.0 ) oss << " Filtering: nsj = " << _nsjmin << std::endl;
+ else oss << " Trimming + Filtering: fcut = " << _fcut << ", nsj = " << _nsjmin << std::endl;
+
+ if ( _cleansing_mode == linear_cleansing ) oss << " g0_mean = " << _linear_gamma0_mean << std::endl;
+ else if ( _cleansing_mode == gaussian_cleansing ) oss << " g0_mean = " << _gaussian_gamma0_mean
+ << ", g0_width = " << _gaussian_gamma0_width
+ << ", g1_mean = " << _gaussian_gamma1_mean
+ << ", g1_width = " << _gaussian_gamma1_width << std::endl;
+ return oss.str();
+ }
+
+
+ /////////////////////////////
+ // cleanse
+ PseudoJet JetCleanser::operator()(const PseudoJet & jet,
+ const std::vector<PseudoJet> & tracks_lv,
+ const std::vector<PseudoJet> & tracks_pu) const {
+
+ if ( _input_mode != input_nc_together ) throw Error("result(): This operator is only defined for input_nc_together mode");
+
+ // get constituents
+ if ( !(jet.has_constituents()) ) return PseudoJet();
+ std::vector<PseudoJet> constituents_all = jet.constituents();
+
+ // prepare for clustering
+ std::vector< std::vector<PseudoJet> > follow_sets;
+ follow_sets.push_back( constituents_all );
+ follow_sets.push_back( tracks_lv );
+ follow_sets.push_back( tracks_pu );
+
+ // get subjets
+ std::vector< std::vector<PseudoJet> > sets = ClusterSets(_subjet_def, constituents_all, follow_sets);
+ std::vector<PseudoJet> subjets_all, subjets_tracks_lv, subjets_tracks_pu;
+ subjets_all = sets[0];
+ subjets_tracks_lv = sets[1];
+ subjets_tracks_pu = sets[2];
+
+ // rescale subjets
+ std::vector<PseudoJet> rescaled_subjets_all;
+ for (unsigned i=0; i<subjets_all.size(); i++){
+ double s_factor = _GetSubjetRescaling_nctogether(subjets_all[i].pt(), subjets_tracks_lv[i].pt(), subjets_tracks_pu[i].pt());
+ PseudoJet rescaled_subjet_all = RescalePseudoJetConstituents( subjets_all[i], s_factor );
+ if ( rescaled_subjet_all != 0.0 ) rescaled_subjets_all.push_back( rescaled_subjet_all );
+ }
+
+ // trim/filter subjets
+ rescaled_subjets_all = sorted_by_pt( rescaled_subjets_all );
+ std::vector<PseudoJet> trimmed_subjets_all;
+ for (unsigned i=0; i<rescaled_subjets_all.size(); i++){
+ bool pass_filtering = _nsjmin > 0 ? i < _nsjmin : false;
+ bool pass_trimming = rescaled_subjets_all[i].pt() > _fcut*jet.pt();
+ if ( pass_trimming || pass_filtering ) { trimmed_subjets_all.push_back( rescaled_subjets_all[i] ); }
+ }
+
+ return join( trimmed_subjets_all );
+ }
+
+ /////////////////////////////
+ // cleanse
+ PseudoJet JetCleanser::operator()(const std::vector<PseudoJet> & neutrals_all,
+ const std::vector<PseudoJet> & tracks_lv,
+ const std::vector<PseudoJet> & tracks_pu) const {
+
+ if ( _input_mode != input_nc_separate ) throw Error("result(): This operator is only defined for input_nc_separate mode");
+
+ // assemble jet collections
+ std::vector<PseudoJet> particles_all;
+ for (unsigned i=0; i<neutrals_all.size(); i++){ particles_all.push_back(neutrals_all[i]); }
+ for (unsigned i=0; i<tracks_lv.size(); i++){ particles_all.push_back(tracks_lv[i]); }
+ for (unsigned i=0; i<tracks_pu.size(); i++){ particles_all.push_back(tracks_pu[i]); }
+ PseudoJet jet = join(particles_all);
+
+ // prepare for clustering
+ std::vector< std::vector<PseudoJet> > follow_sets;
+ follow_sets.push_back( particles_all );
+ follow_sets.push_back( neutrals_all );
+ follow_sets.push_back( tracks_lv );
+ follow_sets.push_back( tracks_pu );
+
+ // get subjets
+ std::vector< std::vector<PseudoJet> > sets = ClusterSets(_subjet_def, particles_all, follow_sets);
+ std::vector<PseudoJet> subjets_all, subjets_neutrals_all, subjets_tracks_lv, subjets_tracks_pu;
+ subjets_all = sets[0];
+ subjets_neutrals_all = sets[1];
+ subjets_tracks_lv = sets[2];
+ subjets_tracks_pu = sets[3];
+
+ // rescale neutral subjets and add to charged LV subjets
+ std::vector<PseudoJet> rescaled_subjets_all;
+ for (unsigned i=0; i<subjets_all.size(); i++){
+ double s_factor = _GetSubjetRescaling_ncseparate(subjets_neutrals_all[i].pt(), subjets_tracks_lv[i].pt(), subjets_tracks_pu[i].pt());
+ PseudoJet rescaled_subjet_ntrl = RescalePseudoJetConstituents( subjets_neutrals_all[i], s_factor );
+ PseudoJet rescaled_subjet_all = join( rescaled_subjet_ntrl, subjets_tracks_lv[i] );
+ if ( rescaled_subjet_all != 0.0 ) rescaled_subjets_all.push_back( rescaled_subjet_all );
+ }
+
+ // trim/filter subjets
+ rescaled_subjets_all = sorted_by_pt( rescaled_subjets_all );
+ std::vector<PseudoJet> trimmed_subjets_all;
+ for (unsigned i=0; i<rescaled_subjets_all.size(); i++){
+ bool pass_filtering = _nsjmin > 0 ? i < _nsjmin : false;
+ bool pass_trimming = rescaled_subjets_all[i].pt() > _fcut*jet.pt();
+ if ( pass_trimming || pass_filtering ) { trimmed_subjets_all.push_back( rescaled_subjets_all[i] ); }
+ }
+
+ return join( trimmed_subjets_all );
+ }
+
+
+ /////////////////////////////
+ // helper: _CheckRescalingValues
+ // allow some leeway for detector effects
+ void JetCleanser::_CheckRescalingValues(double & pt_all, const double & ptc_lv, const double & ptc_pu) const {
+ double ratio = (ptc_lv + ptc_pu)/pt_all;
+ if ( ratio > 1.05 ) throw Error("_CheckRescalingValues: ptc_lv + ptc_pu is more than 5\% larger than pt_all");
+ else if ( ratio > 1.0 ){ pt_all = pt_all * ratio; }
+ }
+
+
+ /////////////////////////////
+ // helper: _GetSubjetRescaling_nctogether
+ double JetCleanser::_GetSubjetRescaling_nctogether(double pt_all, double ptc_lv, double ptc_pu) const {
+ double scale;
+
+ // jvf mode
+ if ( _cleansing_mode == jvf_cleansing ) {
+ scale = ptc_lv > jc_zero ? ptc_lv / ( ptc_lv + ptc_pu ) : 0.0;
+ }
+
+ // linear mode
+ else if ( _cleansing_mode == linear_cleansing ) {
+ if ( _linear_gamma0_mean < 0 ) throw Error("Linear cleansing parameters have not been set yet.");
+ _CheckRescalingValues(pt_all,ptc_lv,ptc_pu);
+
+ if ( ptc_pu > jc_zero && ptc_pu / ( pt_all - ptc_lv ) > _linear_gamma0_mean )
+ scale = ptc_lv > jc_zero ? ptc_lv / ( ptc_lv + ptc_pu ) : 0.0;
+ else scale = ptc_lv > jc_zero ? 1.0 - (1.0/_linear_gamma0_mean)*ptc_pu/pt_all : 0.0;
+ //double linear_gamma1 = ptc_lv >= jc_zero ? ptc_lv / ( pt_all - (1.0/_linear_gamma0_mean)*ptc_pu ) : 0.0;
+ }
+
+ // gaussian mode
+ else if ( _cleansing_mode == gaussian_cleansing ) {
+ if ( _gaussian_gamma0_mean < 0 || _gaussian_gamma1_mean < 0 || _gaussian_gamma0_width < 0 || _gaussian_gamma1_width < 0 )
+ throw Error("Gaussian cleansing parameters have not been set yet.");
+ _CheckRescalingValues(pt_all,ptc_lv,ptc_pu);
+
+ double _gaussian_gamma0 = _GaussianGetMinimizedGamma0(pt_all, ptc_lv, ptc_pu);
+ //double _gaussian_gamma1 = _GaussianGetGamma1(_gaussian_gamma0, pt_all, ptc_lv, ptc_pu);
+ scale = ptc_lv > jc_zero ? 1.0 - (1.0/_gaussian_gamma0)*ptc_pu/pt_all : 0.0;
+ }
+ else throw Error("_GetSubjetRescaling: Current cleansing mode is not recognized.");
+
+ return scale > jc_zero? scale : 0.0;
+ }
+
+ /////////////////////////////
+ // helper: _GetSubjetRescaling_ncseparate
+ double JetCleanser::_GetSubjetRescaling_ncseparate(double ptn_all, double ptc_lv, double ptc_pu) const {
+ double scale;
+
+ // jvf mode
+ if ( _cleansing_mode == jvf_cleansing ) {
+ scale = ptc_lv > jc_zero && ptn_all > jc_zero ? ptc_lv / ( ptc_lv + ptc_pu ) : 0.0;
+ }
+
+ // linear mode
+ else if ( _cleansing_mode == linear_cleansing ) {
+ if ( _linear_gamma0_mean < 0 ) throw Error("Linear cleansing parameters have not been set yet.");
+ double pt_all = ptn_all + ptc_lv + ptc_pu;
+ _CheckRescalingValues(pt_all,ptc_lv,ptc_pu);
+
+ if ( (ptc_pu > jc_zero && ptc_pu / ( pt_all - ptc_lv ) > _linear_gamma0_mean) || ptn_all < jc_zero )
+ scale = ptc_lv > jc_zero && ptn_all > jc_zero? ptc_lv / ( ptc_lv + ptc_pu ) : 0.0;
+ else scale = ptc_lv > jc_zero && ptn_all > jc_zero? 1.0 - (1.0/_linear_gamma0_mean-1.0)*ptc_pu/ptn_all : 0.0;
+ //double linear_gamma1 = ptc_lv > jc_zero ? ptc_lv / ( pt_all - (1.0/_linear_gamma0_mean)*ptc_pu ) : 0.0;
+ }
+
+ // gaussian mode
+ else if ( _cleansing_mode == gaussian_cleansing ) {
+ if ( _gaussian_gamma0_mean < 0 || _gaussian_gamma1_mean < 0 || _gaussian_gamma0_width < 0 || _gaussian_gamma1_width < 0 )
+ throw Error("Gaussian cleansing parameters have not been set yet.");
+ double pt_all = ptn_all + ptc_lv + ptc_pu;
+ _CheckRescalingValues(pt_all,ptc_lv,ptc_pu);
+
+ double _gaussian_gamma0 = _GaussianGetMinimizedGamma0(pt_all, ptc_lv, ptc_pu);
+ //double _gaussian_gamma1 = _GaussianGetGamma1(_gaussian_gamma0, pt_all, ptc_lv, ptc_pu);
+ scale = ptc_lv > jc_zero && ptn_all > jc_zero ? 1.0 - (1.0/_gaussian_gamma0-1.0)*ptc_pu/ptn_all : 0.0;
+ }
+ else throw Error("_GetSubjetRescaling: Current cleansing mode is not recognized.");
+
+ return scale > jc_zero? scale : 0.0;
+ }
+
+
+ /////////////////////////////
+ // helper: _GaussianGetMinimizedGamma0
+ double JetCleanser::_GaussianGetMinimizedGamma0(double pt_all, double ptc_lv, double ptc_pu) const {
+ if ( pt_all == 0.0 && ptc_lv == 0.0 && ptc_pu == 0.0 ) return 0.0;
+ if ( ptc_lv == 0.0 ) return ptc_pu / pt_all;
+
+ double params[3] = {ptc_lv, ptc_pu, pt_all};
+ std::map<double,double> map_fcn_to_x;
+
+ for(double x0 = 0.0; x0 <= 1.0 + jc_zero; x0+=0.01) {
+ map_fcn_to_x[_GaussianFunction(x0,params)] = x0;
+ }
+
+ return map_fcn_to_x.begin()->second;
+ }
+
+ /////////////////////////////
+ // helper: _GaussianGetGamma1
+ double JetCleanser::_GaussianGetGamma1(double gamma0, double pt_all, double ptc_lv, double ptc_pu) const {
+ if ( pt_all == 0.0 && ptc_lv == 0.0 && ptc_pu == 0.0 ) return 0.0;
+ if ( gamma0 == 0.0 || fabs(pt_all - ptc_pu/gamma0) < jc_zero ) return 0.0;
+ return ptc_lv / (pt_all - ptc_pu/gamma0);
+ }
+
+ /////////////////////////////
+ // helper: _GaussianFunction
+ double JetCleanser::_GaussianFunction(double x, void * params) const {
+ double ptc_lv = ((double*)params)[0];
+ double ptc_pu = ((double*)params)[1];
+ double pt_all = ((double*)params)[2];
+ double g1 = _GaussianGetGamma1(x, pt_all, ptc_lv, ptc_pu);
+
+ if(g1 >= 1. || g1 <= 0. || x <= 0. || x >= 1.)
+ return (x-1.)*(x-1.)+10.;
+
+ return -exp(-(g1-_gaussian_gamma1_mean)*(g1-_gaussian_gamma1_mean)/2./_gaussian_gamma1_width/_gaussian_gamma1_width
+ -(x-_gaussian_gamma0_mean)*(x-_gaussian_gamma0_mean)/2./_gaussian_gamma0_width/_gaussian_gamma0_width);
+ }
+ /////////////////////////////
+ // helper: ClusterSets
+ std::vector< std::vector<PseudoJet> > ClusterSets(const JetDefinition & jet_def,
+ const std::vector<PseudoJet> & cluster_set,
+ const std::vector< std::vector<PseudoJet> > & follow_sets,
+ const double &ptmin) {
+ // start set
+ std::vector<PseudoJet> full_set;
+ for (unsigned i=0; i<cluster_set.size(); i++){ full_set.push_back( cluster_set[i] ); }
+
+ // convert to ghosts and add
+ for (unsigned i=0; i<follow_sets.size(); i++){
+ std::vector<PseudoJet> current_set = follow_sets[i];
+ for (unsigned j=0; j<current_set.size(); j++){
+ FollowSetGhostInfo* ghost_info = new FollowSetGhostInfo(i,j);
+ PseudoJet ghost_pseudojet = 1.0e-60 * current_set[j];
+ ghost_pseudojet.set_user_info( ghost_info );
+ full_set.push_back( ghost_pseudojet );
+ }
+ }
+
+ // cluster
+ ClusterSequence *cs = new ClusterSequence( full_set, jet_def );
+ std::vector<PseudoJet> jets = sorted_by_pt( cs->inclusive_jets(ptmin) );
+ cs->delete_self_when_unused();
+
+ // construct sets
+ std::vector< std::vector<PseudoJet> > follow_jets;
+ for (unsigned i=0; i<follow_sets.size(); i++){
+ std::vector<PseudoJet> current_set;
+ for (unsigned j=0; j<jets.size(); j++){ current_set.push_back( join( PseudoJet() ) ); }
+ follow_jets.push_back( current_set );
+ }
+
+ // construct jet sets
+ for (unsigned i=0; i<jets.size(); i++){
+ std::vector<PseudoJet> constituents = jets[i].constituents();
+ for (unsigned j=0; j<constituents.size(); j++){
+ if ( constituents[j].has_user_info<FollowSetGhostInfo>() ){
+ FollowSetGhostInfo ghost_info = constituents[j].user_info<FollowSetGhostInfo>();
+ int set_id = ghost_info.GetSetId();
+ int ind_id = ghost_info.GetIndId();
+
+ std::vector<PseudoJet> current_set = follow_sets[set_id];
+ if ( follow_jets[set_id][i] == 0.0 ) follow_jets[set_id][i] = join( current_set[ind_id] );
+ else follow_jets[set_id][i] = join( follow_jets[set_id][i], current_set[ind_id] );
+ }
+ }
+ }
+
+ return follow_jets;
+ }
+
+ /////////////////////////////
+ // helper: RescalePseudoJetVector
+ std::vector<PseudoJet> RescalePseudoJetVector(const std::vector<PseudoJet> & jets, const double s_factor) {
+ std::vector<PseudoJet> rescaled_jets;
+ if ( s_factor == 0.0 ) return rescaled_jets;
+ for (unsigned i=0; i<jets.size(); i++){ rescaled_jets.push_back( s_factor*jets[i] ); }
+ return rescaled_jets;
+ }
+
+ /////////////////////////////
+ // helper: RescalePseudoJetConstituents
+ PseudoJet RescalePseudoJetConstituents(const PseudoJet & jet, const double s_factor) {
+ if ( !(jet.has_constituents()) )
+ return PseudoJet();
+ std::vector<PseudoJet> constituents = jet.constituents();
+ std::vector<PseudoJet> rconstituents = RescalePseudoJetVector( constituents, s_factor );
+ return join( rconstituents );
+ }
+
+ /////////////////////////////
+ // helper: _RunTests
+ void JetCleanser::_RunTests() {
+ std::cout << "----- Testing contrib::JetCleanser -----" << std::endl;
+ std::cout << "Warning: All cleansing settings will be changed during the test." << std::endl;
+
+ // INPUT MODE = input_nc_together
+ _input_mode = input_nc_together;
+ _cleansing_mode = jvf_cleansing;
+ std::cout << "Mode = [nc_together,jvf]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ _cleansing_mode = linear_cleansing;
+ _linear_gamma0_mean = 0.67;
+ std::cout << std::endl << "Mode = [nc_together,linear]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ _cleansing_mode = gaussian_cleansing;
+ _gaussian_gamma0_mean = 0.67;
+ _gaussian_gamma0_width = 0.15;
+ _gaussian_gamma1_mean = 0.67;
+ _gaussian_gamma1_width = 0.25;
+ std::cout << std::endl << "Mode = [nc_together,gaussian]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ // INPUT MODE = input_nc_together
+ _input_mode = input_nc_separate;
+ _cleansing_mode = jvf_cleansing;
+ std::cout << std::endl << "Mode = [nc_separate,jvf]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ _input_mode = input_nc_separate;
+ _cleansing_mode = linear_cleansing;
+ _linear_gamma0_mean = 0.67;
+ std::cout << std::endl << "Mode = [nc_separate,linear]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ _cleansing_mode = gaussian_cleansing;
+ _gaussian_gamma0_mean = 0.67;
+ _gaussian_gamma0_width = 0.15;
+ _gaussian_gamma1_mean = 0.67;
+ _gaussian_gamma1_width = 0.25;
+ std::cout << std::endl << "Mode = [nc_separate,gaussian]" << std::endl;
+ _RunTestRescaling(1.0 , 0.0 ,-0.5 );
+ _RunTestRescaling(1.0 , 0.0 ,-0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.0 );
+ _RunTestRescaling(1.0 , 0.0 , 0.01);
+ _RunTestRescaling(1.0 , 0.0 , 0.50);
+ _RunTestRescaling(1.0 , 0.0 , 0.99);
+ _RunTestRescaling(1.0 , 0.0 , 1.0 );
+ _RunTestRescaling(1.0 , 0.0 , 1.01);
+ _RunTestRescaling(1.0 , 0.0 , 1.5 );
+
+ _RunTestRescaling(1.0 , 0.01, 1.0 );
+ _RunTestRescaling(1.0 , 0.5 , 0.3 );
+ _RunTestRescaling(1.0 , 0.5 , 0.49);
+ _RunTestRescaling(1.0 , 0.5 , 0.5 );
+ _RunTestRescaling(1.0 , 0.5 , 0.51);
+ _RunTestRescaling(1.0 , 0.5 , 0.7 );
+ _RunTestRescaling(1.0 , 0.5 , 1.0 );
+
+ _RunTestRescaling(1.0 ,-0.5 , 0.0 );
+ _RunTestRescaling(1.0 ,-0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.01, 0.0 );
+ _RunTestRescaling(1.0 , 0.50, 0.0 );
+ _RunTestRescaling(1.0 , 0.99, 0.0 );
+ _RunTestRescaling(1.0 , 1.0 , 0.0 );
+ _RunTestRescaling(1.0 , 1.01, 0.0 );
+ _RunTestRescaling(1.0 , 1.5 , 0.0 );
+
+ }
+
+ /////////////////////////////
+ // helper: _RunTestRescaling
+ void JetCleanser::_RunTestRescaling(double pt_all, double ptc_lv, double ptc_pu) const {
+ double s_factor, ptn_all=0;
+
+ if ( _input_mode == input_nc_separate ) ptn_all = pt_all - ptc_lv - ptc_pu;
+
+ try { s_factor = _input_mode == input_nc_together?
+ _GetSubjetRescaling_nctogether(pt_all, ptc_lv, ptc_pu) :
+ _GetSubjetRescaling_ncseparate(ptn_all, ptc_lv, ptc_pu); }
+ catch(Error e) { s_factor = -1.0; }
+
+ std::cout << " pt_all = " << pt_all
+ << " ptc_lv = " << ptc_lv
+ << " ptc_pu = " << ptc_pu;
+
+ if ( _input_mode == input_nc_separate ) std::cout << " ptn_all = " << ptn_all;
+ if (s_factor<0.0) { std::cout << " scale = error" << std::endl; }
+ else std::cout << " scale = " << s_factor << std::endl;
+
+ }
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: contrib/contribs/JetCleanser/tags/1.0.0/AUTHORS
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/AUTHORS (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/AUTHORS (revision 333)
@@ -0,0 +1,14 @@
+The JetCleanser FastJet contrib was written and is maintained and developed by:
+
+ David Krohn <dkrohn@physics.harvard.edu>
+ Matthew Low <mattlow@uchicago.edu>
+ Matthew Schwartz <schwartz@physics.harvard.edu>
+ Lian-Tao Wang <liantaow@uchicago.edu>
+
+For physics details, see:
+
+ Jet Cleansing: Pileup Removal at High Luminosity
+ David Krohn, Matthew Low, Matthew D. Schwartz, and Lian-Tao Wang.
+ arXiv:1309.4777
+
+----------------------------------------------------------------------
Index: contrib/contribs/JetCleanser/tags/1.0.0/VERSION
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/VERSION (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/VERSION (revision 333)
@@ -0,0 +1 @@
+1.0.0
Index: contrib/contribs/JetCleanser/tags/1.0.0/example.ref
===================================================================
--- contrib/contribs/JetCleanser/tags/1.0.0/example.ref (revision 0)
+++ contrib/contribs/JetCleanser/tags/1.0.0/example.ref (revision 333)
@@ -0,0 +1,90 @@
+# 20 pileup events on top of the hard event
+#--------------------------------------------------------------------------
+# FastJet release 3.0.3
+# 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.
+#--------------------------------------------------------------------------
+ATLAS-like cleansing:
+
+JetCleanser [JVF mode, input = neutral and charged together]
+ Trimming: fcut = 0.01
+
+JetCleanser [Linear mode, input = neutral and charged together]
+ Trimming: fcut = 0
+ g0_mean = 0.65
+
+JetCleanser [Gaussian mode, input = neutral and charged together]
+ Trimming: fcut = 0
+ g0_mean = 0.67, g0_width = 0.2, g1_mean = 0.62, g1_width = 0.25
+
+ no pileup: pt = 220.906 eta = -1.06907 phi = 0.0717256 m = 22.7227
+ with pileup: pt = 247.759 eta = -1.08698 phi = 0.0806401 m = 87.203
+ with pileup + jvf cleansed: pt = 217.734 eta = -1.07237 phi = 0.0688758 m = 15.2394
+ with pileup + lin cleansed: pt = 221.792 eta = -1.07142 phi = 0.0721328 m = 35.0329
+ with pileup + gau cleansed: pt = 220.658 eta = -1.07264 phi = 0.0687144 m = 31.6946
+
+ no pileup: pt = 146.072 eta = 0.67842 phi = 3.45297 m = 24.9521
+ with pileup: pt = 187.895 eta = 0.730275 phi = 3.43113 m = 93.0914
+ with pileup + jvf cleansed: pt = 144.257 eta = 0.677429 phi = 3.45474 m = 27.1299
+ with pileup + lin cleansed: pt = 148.369 eta = 0.702338 phi = 3.46144 m = 38.0922
+ with pileup + gau cleansed: pt = 148.66 eta = 0.700801 phi = 3.46025 m = 39.7723
+
+ no pileup: pt = 91.4158 eta = 2.12005 phi = 2.86325 m = 26.4442
+ with pileup: pt = 126.371 eta = 2.20036 phi = 2.82385 m = 66.2302
+ with pileup + jvf cleansed: pt = 85.4452 eta = 2.13727 phi = 2.84508 m = 27.0736
+ with pileup + lin cleansed: pt = 88.5949 eta = 2.15194 phi = 2.86396 m = 29.4166
+ with pileup + gau cleansed: pt = 87.7365 eta = 2.15711 phi = 2.8524 m = 30.0241
+
+Dijet Masses:
+ plain = 648.398
+ truth = 506.133
+ jvf = 499.67
+ lin = 519.053
+ gau = 518.186
+
+CMS-like cleansing:
+
+JetCleanser [JVF mode, input = neutral and charged separate]
+ Trimming: fcut = 0.01
+
+JetCleanser [Linear mode, input = neutral and charged separate]
+ Trimming: fcut = 0
+ g0_mean = 0.65
+
+JetCleanser [Gaussian mode, input = neutral and charged separate]
+ Trimming: fcut = 0
+ g0_mean = 0.67, g0_width = 0.2, g1_mean = 0.62, g1_width = 0.25
+
+ no pileup: pt = 220.906 eta = -1.06907 phi = 0.0717256 m = 22.7227
+ with pileup: pt = 247.759 eta = -1.08698 phi = 0.0806401 m = 87.203
+ with pileup + jvf cleansed: pt = 217.734 eta = -1.07241 phi = 0.0688002 m = 14.1166
+ with pileup + lin cleansed: pt = 221.792 eta = -1.07107 phi = 0.0721269 m = 33.7469
+ with pileup + gau cleansed: pt = 220.65 eta = -1.07197 phi = 0.0687981 m = 30.0674
+
+ no pileup: pt = 146.072 eta = 0.67842 phi = 3.45297 m = 24.9521
+ with pileup: pt = 187.895 eta = 0.730275 phi = 3.43113 m = 93.0914
+ with pileup + jvf cleansed: pt = 144.308 eta = 0.673998 phi = 3.4519 m = 23.2852
+ with pileup + lin cleansed: pt = 148.406 eta = 0.696304 phi = 3.45868 m = 34.4735
+ with pileup + gau cleansed: pt = 148.68 eta = 0.694878 phi = 3.45782 m = 36.6283
+
+ no pileup: pt = 91.4158 eta = 2.12005 phi = 2.86325 m = 26.4442
+ with pileup: pt = 126.371 eta = 2.20036 phi = 2.82385 m = 66.2302
+ with pileup + jvf cleansed: pt = 85.4201 eta = 2.12132 phi = 2.85548 m = 22.7869
+ with pileup + lin cleansed: pt = 88.6254 eta = 2.14135 phi = 2.86573 m = 25.8387
+ with pileup + gau cleansed: pt = 87.7388 eta = 2.14129 phi = 2.86286 m = 25.8998
+
+Dijet Masses:
+ plain = 648.398
+ truth = 506.133
+ jvf = 498.58
+ lin = 517.141
+ gau = 516.243
+

File Metadata

Mime Type
text/x-diff
Expires
Wed, May 14, 11:40 AM (10 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5111480
Default Alt Text
(76 KB)

Event Timeline