a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
FourMomentum.cpp
Go to the documentation of this file.
1/*
2 * FourMomentum.cpp
3 *
4 * Created on: Jul 26, 2012
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#include "LHCO.hpp"
15
16namespace LHPC
17{
19 momentumComponents( 4,
20 BOL::UsefulStuff::notANumber )
21 {
22 // just an initialization list.
23 }
24
25 FourMomentum::FourMomentum( double const initialEnergy,
26 double const initialXMomentum,
27 double const initialYMomentum,
28 double const initialZMomentum ) :
29 momentumComponents( 4,
30 initialEnergy )
31 {
32 momentumComponents[ (int)xComponent ] = initialXMomentum;
33 momentumComponents[ (int)yComponent ] = initialYMomentum;
34 momentumComponents[ (int)zComponent ] = initialZMomentum;
35 }
36
38 momentumComponents( copySource.momentumComponents )
39 {
40 // just an initialization list.
41 }
42
44 momentumComponents( 4,
45 BOL::UsefulStuff::notANumber )
46 {
47 assignFrom( copySource );
48 }
49
51 momentumComponents( 4,
52 BOL::UsefulStuff::notANumber )
53 {
54 assignFrom( copySource );
55 }
56
58 std::pair< LhefPointer, LhefPointer > const& copySource ) :
59 momentumComponents( 4,
60 0.0 )
61 {
62 assignFrom( *(copySource.first) );
63 momentumComponents[ (int)tComponent ] += copySource.second->getEnergy();
64 momentumComponents[ (int)xComponent ] += copySource.second->getXMomentum();
65 momentumComponents[ (int)yComponent ] += copySource.second->getYMomentum();
66 momentumComponents[ (int)zComponent ] += copySource.second->getZMomentum();
67 }
68
69 FourMomentum::FourMomentum( std::vector< LhefPointer > const& copySource ) :
70 momentumComponents( 4,
71 0.0 )
72 {
73 for( int whichElement( copySource.size() - 1 );
74 0 <= whichElement;
75 --whichElement )
76 {
78 += copySource[ whichElement ]->getEnergy();
80 += copySource[ whichElement ]->getXMomentum();
82 += copySource[ whichElement ]->getYMomentum();
84 += copySource[ whichElement ]->getZMomentum();
85 }
86 }
87
88 FourMomentum::FourMomentum( std::list< LhefPointer > const& copySource ) :
89 momentumComponents( 4,
90 0.0 )
91 {
92 for( std::list< LhefPointer >::const_iterator
93 whichLine( copySource.begin() );
94 copySource.end() != whichLine;
95 ++whichLine )
96 {
97 momentumComponents[ (int)tComponent ] += (*whichLine)->getEnergy();
98 momentumComponents[ (int)xComponent ] += (*whichLine)->getXMomentum();
99 momentumComponents[ (int)yComponent ] += (*whichLine)->getYMomentum();
100 momentumComponents[ (int)zComponent ] += (*whichLine)->getZMomentum();
101 }
102 }
103
105 std::pair< LhcoPointer, LhcoPointer > const& copySource ) :
106 momentumComponents( 4,
107 0.0 )
108 {
109 assignFrom( *(copySource.first) );
110 FourMomentum copyMomentum( *(copySource.second) );
111 momentumComponents[ (int)tComponent ] += copyMomentum.getT();
112 momentumComponents[ (int)xComponent ] += copyMomentum.getX();
113 momentumComponents[ (int)yComponent ] += copyMomentum.getY();
114 momentumComponents[ (int)zComponent ] += copyMomentum.getZ();
115 }
116
117 FourMomentum::FourMomentum( std::vector< LhcoPointer > const& copySource ) :
118 momentumComponents( 4,
119 0.0 )
120 {
121 FourMomentum copyMomentum;
122 for( int whichElement( copySource.size() - 1 );
123 0 <= whichElement;
124 --whichElement )
125 {
126 copyMomentum = *(copySource[ whichElement ]);
127 momentumComponents[ (int)tComponent ] += copyMomentum.getT();
128 momentumComponents[ (int)xComponent ] += copyMomentum.getX();
129 momentumComponents[ (int)yComponent ] += copyMomentum.getY();
130 momentumComponents[ (int)zComponent ] += copyMomentum.getZ();
131 }
132 }
133
134 FourMomentum::FourMomentum( std::list< LhcoPointer > const& copySource ) :
135 momentumComponents( 4,
136 0.0 )
137 {
138 FourMomentum copyMomentum;
139 for( std::list< LhcoPointer >::const_iterator
140 whichLine( copySource.begin() );
141 copySource.end() != whichLine;
142 ++whichLine )
143 {
144 copyMomentum = *(*whichLine);
145 momentumComponents[ (int)tComponent ] += copyMomentum.getT();
146 momentumComponents[ (int)xComponent ] += copyMomentum.getX();
147 momentumComponents[ (int)yComponent ] += copyMomentum.getY();
148 momentumComponents[ (int)zComponent ] += copyMomentum.getZ();
149 }
150 }
151
153 {
154 // does nothing.
155 }
156
157} /* namespace LHPC */
double getZ() const
double getY() const
double getX() const
double getT() const
void assignFrom(FourMomentum const &copySource)
std::vector< double > momentumComponents