ROOTPWA
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
tools
NParticleState.cc
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
// File and Version Information:
22
// $Id$
23
//
24
// Description:
25
// Implementation of class NParticleState
26
// see NParticleState.hh for details
27
//
28
// Environment:
29
// Software developed for the COMPASS Experiment at CERN
30
//
31
// Author List:
32
// Sebastian Neubert TUM (original author)
33
//
34
//
35
//-----------------------------------------------------------
36
37
// This Class' Header ------------------
38
#include "
NParticleState.h
"
39
40
// C/C++ Headers ----------------------
41
#include <iostream>
42
#include <cmath>
43
44
// Collaborating Class Headers --------
45
#include "
FSParticle.h
"
46
47
48
// Class Member definitions -----------
49
50
51
NParticleState::NParticleState
()
52
: _n(0), _q(0), _p(0,0,0,0), _beam(0,0,0,0)
53
{}
54
55
NParticleState::~NParticleState
()
56
{}
57
58
bool
59
NParticleState::addParticle
(
FSParticle
*
pi
)
60
{
61
_fspart
.push_back(pi);
62
_n
=
_fspart
.size();
63
_q
+=pi->
q
();
64
_p
+=pi->
p
();
65
return
true
;
66
}
67
68
69
void
NParticleState::setBeam
(
const
TLorentzVector& beam){
70
_beam
=
beam
;
71
}
72
73
74
TLorentzVector
75
NParticleState::p
()
const
76
{
77
TLorentzVector result;
78
//std::cout<<_fspart.GetEntriesFast()<<" "<<_n<<std::endl;
79
for
(
unsigned
int
i
=0;
i
<
_n
;++
i
){
80
FSParticle
* pa=
_fspart
.at(
i
);
81
if
(pa!=NULL)result+=pa->
p
();
82
else
std::cout<<
"pion not found!"
<<std::endl;
83
}
84
return
result;
85
}
86
87
double
88
NParticleState::Q2
()
const
89
{
90
TLorentzVector
beam
=
_beam
;
91
// recalibrate beam -- assumes exclusivity!
92
TVector3 dir=beam.Vect();
93
double
const
mpi
=0.13957;
94
double
k=sqrt(
_p
.E()*
_p
.E()-mpi*
mpi
)/dir.Mag();
95
dir*=k;
96
beam.SetVectM(dir,mpi);
97
return
(beam-
_p
).M2();
98
}
99
100
101
double
102
NParticleState::rapidity
()
const
103
{
104
return
0.5*TMath::Log((
_p
.E()+
_p
.Vect().Z())/(
_p
.E()-
_p
.Vect().Z()));
105
}
106
107
TLorentzVector
108
NParticleState::pfs
(
unsigned
int
i
)
const
109
{
110
if
(i<
_n
)
return
_fspart
.at(i)->p();
111
else
return
TLorentzVector();
112
}
113
114
int
115
NParticleState::qabs
()
const
116
{
117
int
result=0;
118
for
(
unsigned
int
i
=0;
i
<
_n
;++
i
){
119
FSParticle
* pa=
_fspart
.at(
i
);
120
if
(pa!=NULL)result+=abs(pa->
q
());
121
else
std::cout<<
"pion not found!"
<<std::endl;
122
}
123
return
result;
124
}
125
126
TVector3
127
NParticleState::vertex
()
const
128
{
129
TVector3 result;
130
for
(
unsigned
int
i
=0;
i
<
_n
;++
i
){
131
FSParticle
* pa=
_fspart
.at(
i
);
132
if
(pa!=NULL)result+=pa->
v
();
133
}
134
if
(_n!=0)result*=1./
_n
;
135
return
result;
136
}
137
138
bool
139
NParticleState::Exclusive
(
double
d
){
140
if
(fabs(
_p
.E()-
_beam
.E())<d)
return
true
;
141
else
return
false
;
142
}
143
144
145
146
bool
147
NParticleState::isSubstate
(
const
NParticleState
* motherstate)
const
{
148
// check if all fspart in this state are also part of the mother
149
for
(
unsigned
int
i
=0;
i
<
_n
;++
i
){
//loop over fspart
150
FSParticle
* myp=
getParticle
(
i
);
151
//loop over fspart in mother
152
unsigned
int
nm=motherstate->
n
();
153
bool
found=
false
;
154
for
(
unsigned
int
j=0;j<nm;++j){
// loop mother fspart
155
if
(myp->
IsEqual
(motherstate->
getParticle
(j))){
156
found=
true
;
157
//std::cout<<"found pion "<<i<<" as pion "<<j<<" in mother"<<std::endl;
158
break
;
159
}
160
}
// end loop over mother-fspart
161
if
(!found){
162
//std::cout<<"did not find pion number "<<i<<std::endl;
163
return
false
;
164
}
165
166
}
// end loop over my fspart
167
// if we survive here we found all fspart in mother
168
return
true
;
169
}
170
171
bool
172
NParticleState::isDisjunctFrom
(
const
NParticleState
* isobar)
const
{
173
// check if all fspart in this state are not equal from partner
174
for
(
unsigned
int
i
=0;
i
<
_n
;++
i
){
//loop over fspart
175
FSParticle
* myp=
getParticle
(
i
);
176
//loop over fspart in mother
177
unsigned
int
nm=isobar->
n
();
178
for
(
unsigned
int
j=0;j<nm;++j){
// loop mother fspart
179
if
(myp->
IsEqual
(isobar->
getParticle
(j))){
180
return
false
;
181
}
182
}
// end loop over isobar fspart
183
}
// end loop over my fspart
184
return
true
;
185
}
186
Generated by
1.8.1.2