IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antonio Augusto Alves Junior
corsika
Commits
007fbbb3
Commit
007fbbb3
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
rotation in COMBoost for (0,0,-z) case
parent
1c5c2a4a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Utilities/COMBoost.cc
+12
-6
12 additions, 6 deletions
Framework/Utilities/COMBoost.cc
Framework/Utilities/testCOMBoost.cc
+42
-37
42 additions, 37 deletions
Framework/Utilities/testCOMBoost.cc
with
54 additions
and
43 deletions
Framework/Utilities/COMBoost.cc
+
12
−
6
View file @
007fbbb3
...
@@ -18,17 +18,23 @@ COMBoost::COMBoost(EnergyType eProjectile, COMBoost::MomentumVector const& pProj
...
@@ -18,17 +18,23 @@ COMBoost::COMBoost(EnergyType eProjectile, COMBoost::MomentumVector const& pProj
:
fRotation
(
Eigen
::
Matrix3d
::
Identity
())
:
fRotation
(
Eigen
::
Matrix3d
::
Identity
())
,
fCS
(
pProjectile
.
GetCoordinateSystem
())
{
,
fCS
(
pProjectile
.
GetCoordinateSystem
())
{
// calculate matrix for rotating pProjectile to z-axis first
// calculate matrix for rotating pProjectile to z-axis first
// TODO: handle the case when pProjectile ~ (0, 0, -1)
auto
const
pProjNorm
=
pProjectile
.
norm
();
auto
const
pProjNorm
=
pProjectile
.
norm
();
auto
const
a
=
(
pProjectile
/
pProjNorm
).
GetComponents
().
eVector
;
auto
const
a
=
(
pProjectile
/
pProjNorm
).
GetComponents
().
eVector
;
Eigen
::
Vector3d
const
b
{
0
,
0
,
1
};
if
(
a
(
0
)
==
0
&&
a
(
1
)
==
0
)
{
auto
const
v
=
a
.
cross
(
b
);
// if pProjectile ~ (0, 0, -1), the standard formula for the rotation matrix breaks
// down but we can easily define a suitable rotation manually. We just need some SO(3)
// matrix that reverses the z-axis and I like this one:
fRotation
<<
1
,
0
,
0
,
0
,
-
1
,
0
,
0
,
0
,
-
1
;
}
else
{
Eigen
::
Vector3d
const
b
{
0
,
0
,
1
};
auto
const
v
=
a
.
cross
(
b
);
Eigen
::
Matrix3d
vHat
;
Eigen
::
Matrix3d
vHat
;
vHat
<<
0
,
-
v
(
2
),
v
(
1
),
v
(
2
),
0
,
-
v
(
0
),
-
v
(
1
),
v
(
0
),
0
;
vHat
<<
0
,
-
v
(
2
),
v
(
1
),
v
(
2
),
0
,
-
v
(
0
),
-
v
(
1
),
v
(
0
),
0
;
fRotation
+=
vHat
+
vHat
*
vHat
/
(
1
+
a
.
dot
(
b
));
fRotation
+=
vHat
+
vHat
*
vHat
/
(
1
+
a
.
dot
(
b
));
}
// calculate boost
// calculate boost
double
const
x
=
pProjNorm
*
units
::
constants
::
c
/
double
const
x
=
pProjNorm
*
units
::
constants
::
c
/
...
...
This diff is collapsed.
Click to expand it.
Framework/Utilities/testCOMBoost.cc
+
42
−
37
View file @
007fbbb3
...
@@ -41,41 +41,46 @@ TEST_CASE("boosts") {
...
@@ -41,41 +41,46 @@ TEST_CASE("boosts") {
// define projectile kinematics in lab frame
// define projectile kinematics in lab frame
MassType
const
projectileMass
=
1.
_GeV
/
cSquared
;
MassType
const
projectileMass
=
1.
_GeV
/
cSquared
;
Vector
<
momentum_d
>
pProjectileLab
{
rootCS
,
{
0
_GeV
/
c
,
1
_PeV
/
c
,
0
_GeV
/
c
}};
std
::
vector
<
Vector
<
momentum_d
>>
labProjectiles
{
EnergyType
const
eProjectileLab
=
energy
(
projectileMass
,
pProjectileLab
);
{
rootCS
,
{
0
_GeV
/
c
,
1
_PeV
/
c
,
0
_GeV
/
c
}},
// standard case
{
rootCS
,
{
0
_GeV
/
c
,
0
_GeV
/
c
,
-
1
_GeV
/
c
}}};
// "special" case
// define target kinematics in lab frame
MassType
const
targetMass
=
1
_GeV
/
cSquared
;
for
(
auto
const
&
pProjectileLab
:
labProjectiles
)
{
Vector
<
momentum_d
>
pTargetLab
{
rootCS
,
{
0
_Ns
,
0
_Ns
,
0
_Ns
}};
EnergyType
const
eProjectileLab
=
energy
(
projectileMass
,
pProjectileLab
);
EnergyType
const
eTargetLab
=
energy
(
targetMass
,
pTargetLab
);
// define target kinematics in lab frame
// define boost to com frame
MassType
const
targetMass
=
1
_GeV
/
cSquared
;
COMBoost
boost
(
eProjectileLab
,
pProjectileLab
,
targetMass
);
Vector
<
momentum_d
>
pTargetLab
{
rootCS
,
{
0
_Ns
,
0
_Ns
,
0
_Ns
}};
EnergyType
const
eTargetLab
=
energy
(
targetMass
,
pTargetLab
);
// boost projecticle
auto
const
[
eProjectileCoM
,
pProjectileCoM
]
=
// define boost to com frame
boost
.
toCoM
(
eProjectileLab
,
pProjectileLab
);
COMBoost
boost
(
eProjectileLab
,
pProjectileLab
,
targetMass
);
// boost target
// boost projecticle
auto
const
[
eTargetCoM
,
pTargetCoM
]
=
boost
.
toCoM
(
eTargetLab
,
pTargetLab
);
auto
const
[
eProjectileCoM
,
pProjectileCoM
]
=
boost
.
toCoM
(
eProjectileLab
,
pProjectileLab
);
// sum of momenta in CoM, should be 0
auto
const
sumPCoM
=
pProjectileCoM
+
pTargetCoM
;
// boost target
CHECK
(
sumPCoM
[
2
]
/
(
1
_GeV
/
c
)
==
Approx
(
0
).
margin
(
absMargin
));
auto
const
[
eTargetCoM
,
pTargetCoM
]
=
boost
.
toCoM
(
eTargetLab
,
pTargetLab
);
// mandelstam-s should be invariant under transformation
// sum of momenta in CoM, should be 0
CHECK
(
s
(
eProjectileLab
+
eTargetLab
,
auto
const
sumPCoM
=
pProjectileCoM
+
pTargetCoM
;
pProjectileLab
.
GetComponents
()
+
pTargetLab
.
GetComponents
())
/
CHECK
(
sumPCoM
[
2
]
/
(
1
_GeV
/
c
)
==
Approx
(
0
).
margin
(
absMargin
));
(
1
_GeV
/
c
)
/
(
1
_GeV
/
c
)
==
Approx
(
s
(
eProjectileCoM
+
eTargetCoM
,
pProjectileCoM
+
pTargetCoM
)
/
(
1
_GeV
/
c
)
/
// mandelstam-s should be invariant under transformation
(
1
_GeV
/
c
)));
CHECK
(
s
(
eProjectileLab
+
eTargetLab
,
pProjectileLab
.
GetComponents
()
+
pTargetLab
.
GetComponents
())
/
// boost back...
(
1
_GeV
/
c
)
/
(
1
_GeV
/
c
)
==
auto
const
[
eProjectileBack
,
pProjectileBack
]
=
Approx
(
s
(
eProjectileCoM
+
eTargetCoM
,
pProjectileCoM
+
pTargetCoM
)
/
boost
.
fromCoM
(
eProjectileCoM
,
pProjectileCoM
);
(
1
_GeV
/
c
)
/
(
1
_GeV
/
c
)));
// ...should yield original values before the boosts
// boost back...
CHECK
(
eProjectileBack
/
eProjectileLab
==
Approx
(
1
));
auto
const
[
eProjectileBack
,
pProjectileBack
]
=
CHECK
((
pProjectileBack
-
pProjectileLab
).
norm
()
/
pProjectileLab
.
norm
()
==
boost
.
fromCoM
(
eProjectileCoM
,
pProjectileCoM
);
Approx
(
0
).
margin
(
absMargin
));
// ...should yield original values before the boosts
CHECK
(
eProjectileBack
/
eProjectileLab
==
Approx
(
1
));
CHECK
((
pProjectileBack
-
pProjectileLab
).
norm
()
/
pProjectileLab
.
norm
()
==
Approx
(
0
).
margin
(
absMargin
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment