1 | #ifndef __CMS_ITERATIVE_CONE__SORT_BY_ET_H__
|
---|
2 | #define __CMS_ITERATIVE_CONE__SORT_BY_ET_H__
|
---|
3 |
|
---|
4 | //STARTHEADER
|
---|
5 | // $Id$
|
---|
6 | //
|
---|
7 | // Copyright (c) ????-????, CMS collaboration
|
---|
8 | // Copyright (c) 2009-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez [for the changes listed below]
|
---|
9 | //
|
---|
10 | //----------------------------------------------------------------------
|
---|
11 | // This file distributed with FastJet has been obtained from the CMS
|
---|
12 | // collaboration, revision 1.2 of the EtComparator.h file in CMSSW,
|
---|
13 | // see
|
---|
14 | // http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/PhysicsTools/Utilities/interface/EtComparator.h?hideattic=0&revision=1.2&view=markup
|
---|
15 | //
|
---|
16 | // Permission has been granted by the CMS collaboration to release it
|
---|
17 | // in FastJet under the terms of the GNU Public License(v2) (see the
|
---|
18 | // COPYING file in the main FastJet directory for details).
|
---|
19 | // Changes from the original file are listed below.
|
---|
20 | //
|
---|
21 | // FastJet is free software; you can redistribute it and/or modify
|
---|
22 | // it under the terms of the GNU General Public License as published by
|
---|
23 | // the Free Software Foundation; either version 2 of the License, or
|
---|
24 | // (at your option) any later version.
|
---|
25 | //
|
---|
26 | // The algorithms that underlie FastJet have required considerable
|
---|
27 | // development and are described in hep-ph/0512210. If you use
|
---|
28 | // FastJet as part of work towards a scientific publication, please
|
---|
29 | // include a citation to the FastJet paper.
|
---|
30 | //
|
---|
31 | // FastJet is distributed in the hope that it will be useful,
|
---|
32 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
33 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
34 | // GNU General Public License for more details.
|
---|
35 | //
|
---|
36 | // You should have received a copy of the GNU General Public License
|
---|
37 | // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
|
---|
38 | //----------------------------------------------------------------------
|
---|
39 | //ENDHEADER
|
---|
40 |
|
---|
41 | // List of changes compared to the original CMS code (revision 1.2 of
|
---|
42 | // EtComparator.h)
|
---|
43 | //
|
---|
44 | // 2009-01-06 Gregory Soyez <soyez@fastjet.fr>
|
---|
45 | //
|
---|
46 | // * Extracted (only) NumericSafeGreaterByEt from the CMS code
|
---|
47 | // and adapted it to act on PseudoJet rather than CMS types
|
---|
48 | // for 4-momenta
|
---|
49 | // * Put the code in a fastjet::cms namespace
|
---|
50 |
|
---|
51 | #include <limits>
|
---|
52 | #include <fastjet/internal/base.hh>
|
---|
53 |
|
---|
54 | FASTJET_BEGIN_NAMESPACE
|
---|
55 |
|
---|
56 | namespace cms{
|
---|
57 |
|
---|
58 | template <class T>
|
---|
59 | struct NumericSafeGreaterByEt {
|
---|
60 | typedef T first_argument_type;
|
---|
61 | typedef T second_argument_type;
|
---|
62 | bool operator()(const T& a1, const T& a2) {
|
---|
63 | // FastJet::PseudoJet does not provide a direct access to Et2
|
---|
64 | // Plus, we want it to be computed in the same way as in the CMS
|
---|
65 | // code (actually the Root code that is used by CMS)
|
---|
66 | double et1 = a1.Et();
|
---|
67 | double et2 = a2.Et();
|
---|
68 |
|
---|
69 | // now we can come back to the CMS code
|
---|
70 | return
|
---|
71 | fabs (et1-et2) > std::numeric_limits<double>::epsilon() ? et1 > et2 :
|
---|
72 | fabs (a1.px()-a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() > a2.px() :
|
---|
73 | a1.pz() > a2.pz();
|
---|
74 | }
|
---|
75 | };
|
---|
76 |
|
---|
77 | } // namespace cms
|
---|
78 |
|
---|
79 | FASTJET_END_NAMESPACE
|
---|
80 |
|
---|
81 |
|
---|
82 | #endif // __CMS_ITERATIVE_CONE__SORT_BY_ET_H__
|
---|