1 //FJSTARTHEADER
2 // $Id: Transformer.hh 4442 2020-05-05 07:50:11Z soyez $
3 //
4 // Copyright (c) 2005-2020, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5 //
6 //----------------------------------------------------------------------
7 // This file is part of FastJet.
8 //
9 //  FastJet is free software; you can redistribute it and/or modify
10 //  it under the terms of the GNU General Public License as published by
11 //  the Free Software Foundation; either version 2 of the License, or
12 //  (at your option) any later version.
13 //
14 //  The algorithms that underlie FastJet have required considerable
15 //  development. They are described in the original FastJet paper,
16 //  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17 //  FastJet as part of work towards a scientific publication, please
18 //  quote the version you use and include a citation to the manual and
19 //  optionally also to hep-ph/0512210.
20 //
21 //  FastJet is distributed in the hope that it will be useful,
22 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
23 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 //  GNU General Public License for more details.
25 //
26 //  You should have received a copy of the GNU General Public License
27 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28 //----------------------------------------------------------------------
29 //FJENDHEADER
30 
31 #ifndef __FASTJET_TRANSFORMER_HH__
32 #define __FASTJET_TRANSFORMER_HH__
33 
34 #include <fastjet/PseudoJet.hh>
35 #include <fastjet/FunctionOfPseudoJet.hh>
36 #include <fastjet/PseudoJetStructureBase.hh>
37 
38 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
39 
40 // forward declarations of what we will have down here
41 class Transformer;
42 
43 /// @ingroup tools_generic
44 /// \class Transformer
45 ///
46 /// Base (abstract) class for a jet transformer.
47 ///
48 /// A transformer, when it acts on a jet, returns a modified version
49 /// of that jet, one that may have a different momentum and/or
50 /// different internal structure.
51 ///
52 /// The typical usage of a class derived from Transformer is
53 /// \code
54 ///   SomeTransformer transformer(...);
55 ///   PseudoJet transformed_jet = transformer(original_jet);
56 ///   // or
57 ///   vector<PseudoJet> transformed_jets = transformer(original_jets);
58 /// \endcode
59 ///
60 /// For many transformers, the transformed jets have
61 /// transformer-specific information that can be accessed through the
62 ///
63 /// \code
64 ///   transformed_jet.structure_of<SomeTransformer>().transformer_specific_info();
65 /// \endcode
66 ///
67 /// See the description of the Filter class for a more detailed usage
68 /// example. See the FastJet manual to find out how to implement
69 /// new transformers.
70 ///
71 class Transformer : public FunctionOfPseudoJet<PseudoJet>{
72 public:
73   /// default ctor
Transformer()74   Transformer(){}
75 
76   /// default dtor
~Transformer()77   virtual ~Transformer(){}
78 
79   /// the result of the Transformer acting on the PseudoJet.
80   /// this _has_ to be overloaded in derived classes
81   /// \param original   the PseudoJet input to the Transformer
82   virtual PseudoJet result(const PseudoJet & original) const = 0;
83 
84   /// This should be overloaded to return a description of the
85   /// Transformer
86   virtual std::string description() const = 0;
87 
88   /// A typedef that is needed to ensure that the
89   /// PseudoJet::structure_of() template function works
90   //
91   // Make sure you reimplement this appropriately in any
92   // derived classes
93   typedef PseudoJetStructureBase StructureType;
94 };
95 
96 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
97 
98 #endif // __FASTJET_TRANSFORMER_HH__
99