ROOTPWA
decayTopology.h
Go to the documentation of this file.
1 
2 //
3 // Copyright 2010
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // rootpwa is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 //-------------------------------------------------------------------------
22 // File and Version Information:
23 // $Rev:: $: revision of last commit
24 // $Author:: $: author of last commit
25 // $Date:: $: date of last commit
26 //
27 // Description:
28 // container class that holds all external information for
29 // amplitude calculation
30 // internally the decay process is represented as a graph
31 // the graph is constraint to contain exactly one production
32 // vertex and at least one interaction vertex; in addtion for
33 // each final-state particle a corresponding final-state vertex
34 // is created for internal use
35 //
36 // "final-state" particles are the measured decay daughters;
37 // additional final-state particles that belong to the production
38 // process are handled by the production vertex
39 //
40 //
41 // Author List:
42 // Boris Grube TUM (original author)
43 //
44 //
45 //-------------------------------------------------------------------------
46 
47 
48 #ifndef DECAYTOPOLOGY_H
49 #define DECAYTOPOLOGY_H
50 
51 
52 #include <vector>
53 #include <map>
54 
55 #include "TLorentzRotation.h"
56 
57 #include "particle.h"
58 #include "productionVertex.h"
59 #include "interactionVertex.h"
60 #include "fsVertex.h"
61 #include "decayGraph.hpp"
62 
63 
64 class TClonesArray;
65 class TVector3;
66 
67 
68 namespace rpwa {
69 
70 
72  typedef boost::shared_ptr<decayTopology> decayTopologyPtr;
73  typedef decayGraph<interactionVertex, particle> decayTopologyGraphType;
74 
75 
77 
78  public:
79 
80  decayTopology();
82  const std::vector<interactionVertexPtr>& decayVertices,
83  const std::vector<particlePtr>& fsParticles,
84  const bool performTopologyCheck = true);
85  decayTopology(const decayTopology& topo);
87  virtual ~decayTopology();
88 
91  decayTopologyPtr clone(const bool cloneFsParticles = false,
92  const bool cloneProdKinematics = false) const
93  { return decayTopologyPtr(doClone(cloneFsParticles, cloneProdKinematics)); }
94 
95  virtual void clear();
96 
97  unsigned int nmbDecayVertices() const { return _decayVertices.size(); }
98  unsigned int nmbFsParticles () const { return _fsParticles.size(); }
99  std::map<std::string, unsigned int> nmbIndistFsParticles() const;
100 
101  int fsParticlesIntrinsicParity() const;
102  int spaceInvEigenValue() const;
103  int reflectionEigenValue() const;
104 
105  const std::vector<particlePtr>& fsParticles () const { return _fsParticles; }
106  const std::vector<interactionVertexPtr>& decayVertices() const { return _decayVertices; }
107 
108  const particlePtr& XParticle () const { return productionVertex()->XParticle(); }
110  const interactionVertexPtr& XDecayVertex () const { return _decayVertices[0]; }
111 
112  void transformFsParticles(const TLorentzRotation& L);
113 
114  bool isVertex (const interactionVertexPtr& vert) const;
115  bool isParticle (const particlePtr& part) const;
116  bool isProductionVertex(const interactionVertexPtr& vert) const;
117  bool isDecayVertex (const interactionVertexPtr& vert) const;
118  int decayVertexIndex (const interactionVertexPtr& vert) const;
119  bool isFsVertex (const interactionVertexPtr& vert) const;
120  bool isFsParticle (const particlePtr& part) const;
121  int fsParticlesIndex (const particlePtr& part) const;
122 
123  bool checkTopology () const;
124  bool checkConsistency() const { return true; }
125 
126  decayTopology subDecay(const nodeDesc& startNd,
127  const bool linkToMotherTopo = false);
129  const bool linkToParentTopo = false)
130  { return subDecay(node(startVert), linkToParentTopo); }
131 
132  void addDecay(const decayTopology& topo);
133 
134  void setProductionVertex(const productionVertexPtr& productionVertex);
135 
136  bool initKinematicsData(const TClonesArray& prodKinParticles,
137  const TClonesArray& decayKinParticles);
138 
139  bool readKinematicsData(const TClonesArray& prodKinMomenta,
140  const TClonesArray& decayKinMomenta);
141 
142  void fillKinematicsDataCache();
143 
144  bool revertMomenta();
145  bool revertMomenta(const std::vector<unsigned int>& fsPartPermMap);
146 
147 
148  virtual std::ostream& print(std::ostream& out) const;
149  virtual std::ostream& printProdKinParticles (std::ostream& out) const;
150  virtual std::ostream& printDecayKinParticles(std::ostream& out) const;
151 
152  static bool debug() { return _debug; }
153  static void setDebug(const bool debug = true) { _debug = debug; }
154 
155 
156  protected:
157 
158  virtual decayTopology* doClone(const bool cloneFsParticles,
159  const bool cloneProdKinematics) const;
160 
161  decayTopology& constructDecay(const productionVertexPtr& productionVertex,
162  const std::vector<interactionVertexPtr>& decayVertices,
163  const std::vector<particlePtr>& fsParticles,
164  const bool performTopologyCheck = true);
165 
166  void buildInternalData();
167 
168  virtual interactionVertexPtr cloneNode(const nodeDesc& nd,
169  const bool cloneInParticles = false,
170  const bool cloneOutParticles = false);
171  virtual particlePtr cloneEdge(const edgeDesc& ed);
172 
173  private:
174 
176  std::vector<interactionVertexPtr> _decayVertices;
177  std::vector<particlePtr> _fsParticles;
178 
179  std::map<unsigned int, unsigned int> _fsDataPartIndexMap;
180  std::vector<TVector3> _fsDataPartMomCache;
181 
182  static bool _debug;
183 
184  };
185 
186 
187  inline
190  const std::vector<interactionVertexPtr>& decayVertices,
191  const std::vector<particlePtr>& fsParticles,
192  const bool performTopologyCheck = true)
193  {
194  decayTopologyPtr topo(new decayTopology(productionVertex, decayVertices,
195  fsParticles, performTopologyCheck));
196  return topo;
197  }
198 
199 
200  inline
203  {
204  decayTopologyPtr topoCopy(new decayTopology(topo));
205  return topoCopy;
206  }
207 
208 
209  inline
212  {
213  decayTopologyPtr topoCopy(new decayTopology(graph));
214  return topoCopy;
215  }
216 
217 
218  inline
219  std::ostream&
220  operator <<(std::ostream& out,
221  const decayTopology& topo)
222  {
223  return topo.print(out);
224  }
225 
226 
227 } // namespace rpwa
228 
229 
230 #endif // DECAYTOPOLOGY_H