ROOTPWA
NParticleEvent.h
Go to the documentation of this file.
1 
2 //
3 // Copyright 2009 Sebastian Neubert
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 // Description:
23 // Utitlity class providing access to substates of an
24 // N-particle final state and GJ frames
25 //
26 // Author List:
27 // Sebastian Neubert TUM (original author)
28 //
29 //-----------------------------------------------------------
30 #ifndef NPARTICLEEVENT_H
31 #define NPARTICLEEVENT_H
32 
33 #include "TLorentzVector.h"
34 #include "NParticleState.h"
35 #include "TClonesArray.h"
36 #include <vector>
37 #include "FSParticle.h"
38 
39 class TVector3;
40 
42 public:
43  NParticleEvent(TClonesArray* fs_momenta,
44  std::vector<int>* fs_charges,
45  TLorentzVector* beam,
46  int* beam_charge,
47  TVector3* vertex);
48 
50 
51 
52 
53  /*** @brief Refresh event
54  * clears all data and builds particles new from
55  * Input arrays (can be used together with a root tree)
56  * Calls build() to create substates if needed (doBuild)
57  * doBuild=false only refreshes the momenta
58  */
59  void refresh(bool doBuild=true);
60 
61 
62  /*** @brief Create all possible substates
63  */
64  unsigned int build();
65 
66  TLorentzVector p(); //< returns total momentum of final state
67  double tprime(); //< returns effective momentum transfer
68 
69 
70  /*** @brief transform into Gottfried Jackson frame
71  */
72  void toGJ();
73 
74  /*** @brief get vector of a decay product p1
75  * in the helicity frame of pX
76  * which itself has been produced from pMother
77  */
78  TLorentzVector getHelicityFrame(TLorentzVector pMother, TLorentzVector pX, TLorentzVector p1);
79 
80  /*** @brief Dump evt format */
81  void writeGAMP(std::ostream& out); //< dump event to PWA200 input format (txt file)
82  unsigned int nStates() const {return _NPStates.size();} //< returns number of states
83  unsigned int nParticles() const {return _fsparticles.size();} //< returns number of final state particles
84 
85 
86  /*** @brief returns NParticle(Sub)State
87  */
88  const NParticleState& getState(unsigned int i) const {return _NPStates[i];}
89  FSParticle& getParticle(unsigned int i) //< returns final state particle
90  { return _fsparticles[i];}
91 
92  const TLorentzVector& getBeam() const {return *_beam;}
93 
94 private:
95  /*** @brief Final state particle momenta
96  */
97  TClonesArray* _fsmomenta;
98  std::vector<int>* _fs_charges;
99  TLorentzVector* _beam; // original pointer to beam
100  TLorentzVector _pbeam; // beam momentum (possibly in a different frame)
101  int* _qbeam;
102  TVector3* _vertex;
103 
104  /*** @brief vector to hold all the substates
105  *
106  * Substates are built in the refresh method and stored in this vector.
107  */
108  std::vector<NParticleState> _NPStates;
109  std::vector<FSParticle> _fsparticles;
110 
111  /*** @brief method to create all permutations of fs particles
112  * this is a magic recursive method!
113  */
114  void permute(int n, int k, int* permu, int x=-1, int i=1);
115 
116 };
117 
118 
119 #endif