Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
darkHiggs
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Luigi Corona
darkHiggs
Commits
447cbf97
Commit
447cbf97
authored
1 year ago
by
Luigi Corona
Browse files
Options
Downloads
Patches
Plain Diff
ptmax-ptmin module
parent
96d409e0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpp/src/AnalysisVariables.cc
+104
-0
104 additions, 0 deletions
cpp/src/AnalysisVariables.cc
with
104 additions
and
0 deletions
cpp/src/AnalysisVariables.cc
0 → 100644
+
104
−
0
View file @
447cbf97
/* Belle2 headers. */
#include
<analysis/dataobjects/Particle.h>
#include
<analysis/utility/PCmsLabTransform.h>
#include
<analysis/utility/ReferenceFrame.h>
#include
<analysis/VariableManager/Manager.h>
#include
<framework/core/Module.h>
/* ROOT headers. */
#include
<Math/Vector4D.h>
#include
<TMath.h>
/* C++ headers. */
#include
<algorithm>
#include
<cmath>
namespace
Belle2
{
namespace
Variable
{
double
ptmax
(
const
Particle
*
particle
)
{
if
(
!
particle
)
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
const
auto
&
frame
{
ReferenceFrame
::
GetCurrent
()};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu0
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
0
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu1
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
1
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_rec
{
frame
.
getMomentum
(
particle
)};
const
double
plong_max
{
p4_mu0
.
P
()
>
p4_mu1
.
P
()
?
(
p4_mu0
.
X
()
*
p4_rec
.
X
()
+
p4_mu0
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu0
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu0
.
P
()
:
(
p4_mu1
.
X
()
*
p4_rec
.
X
()
+
p4_mu1
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu1
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu1
.
P
()
};
return
std
::
sqrt
(
p4_rec
.
P
()
*
p4_rec
.
P
()
-
plong_max
*
plong_max
);
}
double
plongmax
(
const
Particle
*
particle
)
{
if
(
!
particle
)
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
const
auto
&
frame
{
ReferenceFrame
::
GetCurrent
()};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu0
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
0
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu1
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
1
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_rec
{
frame
.
getMomentum
(
particle
)};
return
p4_mu0
.
P
()
>
p4_mu1
.
P
()
?
(
p4_mu0
.
X
()
*
p4_rec
.
X
()
+
p4_mu0
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu0
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu0
.
P
()
:
(
p4_mu1
.
X
()
*
p4_rec
.
X
()
+
p4_mu1
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu1
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu1
.
P
();
}
double
ptmin
(
const
Particle
*
particle
)
{
if
(
!
particle
)
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
const
auto
&
frame
{
ReferenceFrame
::
GetCurrent
()};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu0
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
0
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu1
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
1
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_rec
{
frame
.
getMomentum
(
particle
)};
const
double
plong_min
{
p4_mu0
.
P
()
<
p4_mu1
.
P
()
?
(
p4_mu0
.
X
()
*
p4_rec
.
X
()
+
p4_mu0
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu0
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu0
.
P
()
:
(
p4_mu1
.
X
()
*
p4_rec
.
X
()
+
p4_mu1
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu1
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu1
.
P
()
};
return
std
::
sqrt
(
p4_rec
.
P
()
*
p4_rec
.
P
()
-
plong_min
*
plong_min
);
}
double
plongmin
(
const
Particle
*
particle
)
{
if
(
!
particle
)
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
const
auto
&
frame
{
ReferenceFrame
::
GetCurrent
()};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu0
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
0
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_mu1
{
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
1
))};
const
ROOT
::
Math
::
PxPyPzEVector
p4_rec
{
frame
.
getMomentum
(
particle
)};
return
p4_mu0
.
P
()
<
p4_mu1
.
P
()
?
(
p4_mu0
.
X
()
*
p4_rec
.
X
()
+
p4_mu0
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu0
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu0
.
P
()
:
(
p4_mu1
.
X
()
*
p4_rec
.
X
()
+
p4_mu1
.
Y
()
*
p4_rec
.
Y
()
+
p4_mu1
.
Z
()
*
p4_rec
.
Z
())
/
p4_mu1
.
P
();
}
double
deltaPhiL1
(
const
Particle
*
particle
)
{
if
(
!
particle
)
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
const
auto
&
frame
{
ReferenceFrame
::
GetCurrent
()};
const
double
phi_mu0
{(
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
0
))).
Phi
()};
const
double
phi_mu1
{(
frame
.
getMomentum
(
particle
->
getDaughter
(
0
)
->
getDaughter
(
1
))).
Phi
()};
return
std
::
min
(
std
::
max
(
phi_mu0
,
phi_mu1
)
-
std
::
min
(
phi_mu0
,
phi_mu1
),
std
::
min
(
phi_mu0
,
phi_mu1
)
-
std
::
max
(
phi_mu0
,
phi_mu1
)
+
2
*
TMath
::
Pi
());
}
VARIABLE_GROUP
(
"Analysis-specific variables"
);
REGISTER_VARIABLE
(
"ptmax"
,
ptmax
,
"This is ptmax."
);
REGISTER_VARIABLE
(
"ptmin"
,
ptmin
,
"This is ptmin."
);
REGISTER_VARIABLE
(
"plong_min"
,
plongmin
,
"This is plong_min."
);
REGISTER_VARIABLE
(
"plong_max"
,
plongmax
,
"This is plot_max."
);
REGISTER_VARIABLE
(
"deltaPhiL1"
,
deltaPhiL1
,
"This is deltaPhiL1."
);
}
class
CustomVariablesModule
:
public
Module
{};
REG_MODULE
(
CustomVariables
);
}
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