first commit
This commit is contained in:
commit
18f451f378
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# backup files
|
||||
*~
|
||||
.*.swp
|
||||
|
||||
# common byproducts
|
||||
*.pyc
|
||||
*.pyo
|
||||
.vscode
|
||||
.ipynb_checkpoints
|
||||
__pycache__
|
||||
|
||||
# data files
|
||||
*.root
|
||||
*.xml
|
||||
*.class.C
|
||||
|
||||
# plots
|
||||
*.pdf
|
||||
*.png
|
||||
|
||||
# downloads and envs
|
||||
tuner_env
|
||||
miniconda.sh
|
15
.gitlab-ci.yml
Normal file
15
.gitlab-ci.yml
Normal file
@ -0,0 +1,15 @@
|
||||
stages:
|
||||
- check
|
||||
|
||||
check:
|
||||
stage: check
|
||||
image: registry.cern.ch/docker.io/library/python:3.10
|
||||
before_script:
|
||||
- pip install pre-commit
|
||||
script:
|
||||
- pre-commit run --all-files
|
||||
variables:
|
||||
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
||||
cache:
|
||||
paths:
|
||||
- ${PRE_COMMIT_HOME}
|
23
.pre-commit-config.yaml
Normal file
23
.pre-commit-config.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: '5.0.4'
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ["--ignore=E203,W503,E501,E722"]
|
||||
|
||||
- repo: https://github.com/asottile/add-trailing-comma
|
||||
rev: v2.2.3
|
||||
hooks:
|
||||
- id: add-trailing-comma
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: '22.8.0'
|
||||
hooks:
|
||||
- id: black
|
674
LICENSE
Normal file
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 2022 Andre Gunther
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) 2022 Andre Gunther
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Parameterisation Tuner
|
||||
|
||||
This project provides utils for producing magic parameters used by the pattern recognition algorithms in the Rec project. Typical parameters are coefficients for extrapolation polynomials and weights for TMVA methods.
|
||||
|
||||
## Setup
|
||||
There's a bash script for setting up the necessary (python) environment. Simply do:
|
||||
```
|
||||
chmod +x setup.sh
|
||||
./setup.sh
|
||||
```
|
||||
This will install dependencies like ROOT and Jupyter. To enter the environment do:
|
||||
```
|
||||
source env/tuner_env/bin/activate
|
||||
conda activate tuner
|
||||
```
|
204
electron_main.py
Normal file
204
electron_main.py
Normal file
@ -0,0 +1,204 @@
|
||||
# flake8: noqaq
|
||||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
from parameterisations.parameterise_magnet_kink import parameterise_magnet_kink
|
||||
from parameterisations.parameterise_track_model import parameterise_track_model
|
||||
from parameterisations.parameterise_search_window import parameterise_search_window
|
||||
from parameterisations.parameterise_field_integral import parameterise_field_integral
|
||||
from parameterisations.parameterise_hough_histogram import parameterise_hough_histogram
|
||||
from parameterisations.utils.preselection import preselection
|
||||
from parameterisations.train_forward_ghost_mlps import (
|
||||
train_default_forward_ghost_mlp,
|
||||
train_veloUT_forward_ghost_mlp,
|
||||
)
|
||||
from parameterisations.residual_train_matching_ghost_mlps_electron import (
|
||||
res_train_matching_ghost_mlp,
|
||||
)
|
||||
from parameterisations.train_matching_ghost_mlps_electron import (
|
||||
train_matching_ghost_mlp,
|
||||
)
|
||||
|
||||
from parameterisations.utils.parse_tmva_matrix_to_array_electron import (
|
||||
parse_tmva_matrix_to_array,
|
||||
)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--field-params",
|
||||
action="store_true",
|
||||
help="Enables determination of magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--forward-weights",
|
||||
action="store_true",
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--matching-weights",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r",
|
||||
"--residuals",
|
||||
action="store_true",
|
||||
help="Trains neural network with residual tracks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--prepare",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="Enables preparation of data for matching.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-params-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-weights-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for NN weight determination.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
selected = "nn_electron_training/data/param_data_selected.root"
|
||||
if args.prepare_params_data:
|
||||
selection = "chi2_comb < 5 && pt > 10 && p > 1500 && p < 100000 && pid != 11"
|
||||
print("Run selection cuts =", selection)
|
||||
selected_md = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected, selected_md, selected_mu]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
cpp_files = []
|
||||
if args.field_params:
|
||||
print("Parameterise magnet kink position ...")
|
||||
cpp_files.append(parameterise_magnet_kink(input_file=selected))
|
||||
print("Parameterise track model ...")
|
||||
cpp_files.append(parameterise_track_model(input_file=selected))
|
||||
|
||||
selected_all_p = "nn_electron_training/data/param_data_selected_all_p.root"
|
||||
if args.prepare_params_data:
|
||||
selection_all_momenta = "chi2_comb < 5 && pid != 11"
|
||||
print()
|
||||
print("Run selection cuts =", selection_all_momenta)
|
||||
selected_md_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected_all_p, selected_md_all_p, selected_mu_all_p]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
if args.field_params:
|
||||
print("Parameterise search window ...")
|
||||
cpp_files.append(parameterise_search_window(input_file=selected_all_p))
|
||||
print("Parameterise magnetic field integral ...")
|
||||
cpp_files.append(parameterise_field_integral(input_file=selected_all_p))
|
||||
print("Parameterise Hough histogram binning ...")
|
||||
cpp_files.append(parameterise_hough_histogram(input_file=selected_all_p))
|
||||
|
||||
###>>>
|
||||
ghost_data = "data/ghost_data.root"
|
||||
if args.prepare_weights_data:
|
||||
merge_cmd = [
|
||||
"hadd",
|
||||
"-fk",
|
||||
ghost_data,
|
||||
"data/ghost_data_B.root",
|
||||
"data/ghost_data_D.root",
|
||||
]
|
||||
print("Concatenate decays for neural network training ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
###<<<
|
||||
if args.forward_weights:
|
||||
train_default_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# FIXME: use env variable instead
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_veloUT_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_electron_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"nn_electron_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
###
|
||||
###>>>
|
||||
###
|
||||
if args.matching_weights and args.residuals:
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
res_train_matching_ghost_mlp(
|
||||
prepare_data=args.prepare,
|
||||
input_file="data/ghost_data_B.root",
|
||||
tree_name="PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput", # e6feac0d, B: 3e224c41, B res: 1e13cc7e, D: 8cb154ca
|
||||
exclude_electrons=False,
|
||||
only_electrons=True,
|
||||
residuals="PrMatchNN_1e13cc7e.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
outdir="nn_electron_training",
|
||||
n_train_signal=0,
|
||||
n_train_bkg=20e3,
|
||||
n_test_signal=1e3,
|
||||
n_test_bkg=5e3,
|
||||
)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C",
|
||||
],
|
||||
simd_type=True,
|
||||
)
|
||||
|
||||
if args.matching_weights and not args.residuals:
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_matching_ghost_mlp(
|
||||
prepare_data=args.prepare,
|
||||
input_file="data/ghost_data_B_new_vars_default_weights.root",
|
||||
tree_name="PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput", # e6feac0d, B: 3e224c41, B res: 1e13cc7e, D: 8cb154ca
|
||||
exclude_electrons=False,
|
||||
only_electrons=True,
|
||||
outdir="nn_electron_training",
|
||||
n_train_signal=100e3,
|
||||
n_train_bkg=200e3,
|
||||
n_test_signal=20e3,
|
||||
n_test_bkg=40e3,
|
||||
)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C",
|
||||
],
|
||||
simd_type=True,
|
||||
)
|
||||
###
|
||||
###<<<
|
||||
###
|
||||
for file in cpp_files:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{file}",
|
||||
],
|
||||
)
|
29
electron_training/result_1_B/matching.hpp
Normal file
29
electron_training/result_1_B/matching.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{5.23340640939e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
|
||||
4.71249222755e-07, 1.02445483208e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.423314958811,
|
||||
499.603149414, 499.198486328,
|
||||
1.36927723885, 0.149392709136}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.929669659785881, -9.48043077362455, 10.1715051193127, 2.47667373712576,
|
||||
-3.58083018257721, 6.45095796912324, 8.45870339869703},
|
||||
{-0.296042356038334, -9.1896008367615, 5.56711502257143, 17.4486821475108,
|
||||
-6.40008536792669, -6.6713822283154, 1.07455239812445},
|
||||
{0.420413986806413, -1.15751488304315, 3.30243747788701, -1.36392382054269,
|
||||
-0.847138226467055, 4.98479154537921, 4.24441164005755},
|
||||
{1.5738915069293, -4.98081352303952, 5.8421155864956, -1.57711106103044,
|
||||
-0.189458896895154, -3.65417561650535, -4.22419444699164},
|
||||
{-6.66276674820396, 5.45480166931729, -8.03806088012418,
|
||||
-0.789852234746539, -1.43435711944003, -4.01961155923308,
|
||||
-14.0834092140066},
|
||||
{0.817584255737394, 9.67890702465868, -1.76653199291165, -2.6610635109901,
|
||||
2.51931906192722, -6.76406907184251, 0.968242938156462},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.88483370881801, 0.775741479584514, 0.214825824623319, 1.61128446188167,
|
||||
1.00658692249476, 0.0826679173714486, -1.12220164589225}}};
|
||||
const auto fWeightMatrix1to2 = std::array<simd::float_v, 9>{
|
||||
{-1.73457594569937, -1.67600294506992, 1.88966364345853, 1.18946138791835,
|
||||
2.47648351789816, -1.24466771533151, -0.315569517202675, 0.530105674163753,
|
||||
3.05297057699491}};
|
64
electron_training/result_6_B/matching.hpp
Normal file
64
electron_training/result_6_B/matching.hpp
Normal file
@ -0,0 +1,64 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{5.23340640939e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
|
||||
4.71249222755e-07, 1.02445483208e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.423314958811,
|
||||
499.603149414, 499.198486328,
|
||||
1.36927723885, 0.149392709136}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 12>{
|
||||
{{1.10989365682333, -0.400262341428031, 0.703648655520529,
|
||||
-10.0488008412327, 2.24766437644792, -1.51561555364132,
|
||||
-8.19659986380238},
|
||||
{0.168629698489816, -0.235222573459749, -2.76479490713939,
|
||||
4.70755796881564, 0.422213317504099, -2.15975111024372,
|
||||
-0.0413862540873273},
|
||||
{-1.20008716401126, 5.98181458205593, 1.97530107863487, 0.951399694875291,
|
||||
3.21037292600378, -1.88398815839093, 6.00348890738369},
|
||||
{1.59529309197505, 1.03059763992094, -1.28481350389235, 1.77750648317864,
|
||||
1.66698562433363, 0.560549629043751, -0.646784291824832},
|
||||
{-10.5582477166915, 1.83421764351223, -4.28308784555713, 2.73941897264262,
|
||||
-1.09755306824252, -2.76940523423182, -13.1324718956297},
|
||||
{-1.37726196850241, 1.6684137449588, 0.234563275112263, 0.889405325109031,
|
||||
1.24137671714337, -0.240977390196439, -2.00650503697469},
|
||||
{-0.0917280130282914, -6.60741151288151, 4.280141752342, 15.8869539382336,
|
||||
-4.40078451860264, -11.63552941888, -2.23848664347195},
|
||||
{1.72810153197739, 1.81133984072885, 1.53310134343984, 1.53430340675608,
|
||||
-0.880657747996044, -1.01002428097867, 0.327772484279249},
|
||||
{0.450749853210101, -10.427522498238, 10.1106981167422, 2.50275117049706,
|
||||
-3.96268925724634, 7.80062171624392, 8.13617432588314},
|
||||
{-0.899044020226273, 4.04967555584356, -0.184515937391125,
|
||||
0.605936074234893, 2.11314319461295, 1.08529920345605, 5.198893026323},
|
||||
{-4.62555398916988, 2.56629651777862, -5.19280819069721, 0.979353155613104,
|
||||
0.362510005701342, -0.387373325452426, -4.51347844411621},
|
||||
{0.43181068852013, -1.12870359395317, -5.59123177894442, -2.78683035529746,
|
||||
-0.119944490657953, -4.22887938179223, -12.1803091805475}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 13>, 6>{
|
||||
{{-1.67244648790854, 2.58776560386115, 1.05350530586878, 1.12701723441192,
|
||||
0.309436118156294, -1.41275414644542, -2.14966008423622,
|
||||
-0.311448006165657, 0.485736777594352, -2.55661662619223,
|
||||
0.96538530983999, -3.26795296807062, 0.988977174263089},
|
||||
{-0.381498099253961, -0.549200770730038, -0.893363207717135,
|
||||
0.119028293459292, 5.13224785809454, 1.77747846865563, -1.7072596641081,
|
||||
0.0171890434060519, -0.612613204335275, 1.49948177816202,
|
||||
0.230169849172349, -0.177176079772119, 3.44507835207359},
|
||||
{-1.20063578327457, 1.63342807940049, -2.53476436290309, -1.5305832886762,
|
||||
-3.05946450928802, 0.360300407115462, 0.625027143539907,
|
||||
-1.77680947527138, -0.585041547463601, -2.08759735767147,
|
||||
0.925138221824412, -1.24854533226616, 2.0502994330023},
|
||||
{-1.36610982082625, -1.68603095079278, 1.93369535731656, 2.38299921699452,
|
||||
0.133785811268423, -0.941203171967918, 2.97186174778511, 1.15122509873234,
|
||||
0.135596009829977, -0.62708569660126, -0.024554433907907,
|
||||
-0.555962579400608, 0.581541394004209},
|
||||
{0.349027399089585, 0.0804040832557828, -0.454499280002817,
|
||||
-1.17318303808809, 0.292596492448844, 0.801032353759436,
|
||||
0.760037949875418, 0.22815167017283, 0.315794043406641,
|
||||
-0.969493545848479, -1.03825660899029, 1.94713626859943,
|
||||
-2.1389717446658},
|
||||
{-1.88715819596171, 0.277545438410592, -1.68976255449697,
|
||||
-1.02675310905861, 0.226775035076775, -1.07682401936394,
|
||||
-0.52218117899507, -1.8253408434363, -1.94344181953331,
|
||||
-0.444301427484403, -0.343612121595328, -0.177028285618245,
|
||||
-0.648349320508864}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.844891680754208, 0.967426474103726, 0.960945561425279,
|
||||
-0.80019723500702, -0.545585546409515, 0.3310030293198,
|
||||
-2.29115821922715}};
|
46
electron_training/result_B/matching.hpp
Normal file
46
electron_training/result_B/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{5.23340640939e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
|
||||
4.71249222755e-07, 1.02445483208e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.423314958811,
|
||||
499.603149414, 499.198486328,
|
||||
1.36927723885, 0.149392709136}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{2.57491955820114, -0.0666351688682796, -3.61648923844569,
|
||||
-8.75747553035328, 0.639385257730277, 10.5129455348455, 1.22080436670381},
|
||||
{-0.839608322851951, -11.7978768103865, 7.24641653369801, 6.63011679030303,
|
||||
-5.38496571510758, 8.30851076817151, 6.69929919816849},
|
||||
{-0.17630967374162, -3.75940580347415, 2.79889282638498, 16.7594894489781,
|
||||
-3.10824840396248, -8.80345141844331, 3.9130937162361},
|
||||
{0.19092161829683, -3.60963385297311, 11.9569759734039, 2.10283509156704,
|
||||
-2.39101707207304, -1.89478969715624, 7.1165950679585},
|
||||
{-3.02014034882022, 2.24487587036827, -8.90770349935038, -4.05040202238185,
|
||||
-1.36813505779681, 9.14630004607903, -3.34618937758505},
|
||||
{0.459674275912345, 8.12262886393506, 0.45018729587823, -1.11787227534737,
|
||||
2.8096254085019, -0.481877520480143, 7.78611195142966},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.8337752666274, 0.841018614520629, 0.272259015077869, 1.63031107650108,
|
||||
0.987469718084883, 0.0999586200250234, -1.13752770875358}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.0482883134570299, 0.46403980819019, 2.73665245864103,
|
||||
0.245936163361116, -0.472281505442891, 0.307317690224363,
|
||||
1.63438201788813, -1.44341215808597, -0.706584289774802},
|
||||
{-3.91297125261727, 0.681495111998297, -3.37155822025346,
|
||||
-0.966831590652637, 2.65933759421044, -0.661174079209186,
|
||||
-1.61531096417457, 0.0991696473049824, -4.51523108840722},
|
||||
{0.273186686950073, 1.14087516410812, 0.653137998266985,
|
||||
-0.158819017566112, 0.692268877136322, -8.04912219449925,
|
||||
-0.825543426908553, -1.92132463640843, -2.47870678055356},
|
||||
{0.180394111293318, -0.414717927339332, -1.44129610325848,
|
||||
-1.86532392228702, -0.806791495297171, -1.73521704274739,
|
||||
1.61348068527877, -1.66550797875971, -0.927403017991324},
|
||||
{-0.790929106392951, -0.0886126272927867, 0.035682993929273,
|
||||
-0.602424006939674, 0.334723143379322, 2.22416454606917,
|
||||
-0.848898627795279, 0.743857937018801, -0.291005217785123},
|
||||
{-0.681492967014666, -0.368602644948209, 1.52403393057559,
|
||||
-1.06212309361209, 0.881062654352226, 0.690165878288055,
|
||||
-1.52203810494393, 1.63217238068739, 2.76628946224152}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.692725959420674, 1.18375950895893, -1.13672009847538, 0.407788542121486,
|
||||
-0.606866044733726, 0.927912329413981, -0.887231003739174}};
|
46
electron_training/result_B_new/matching.hpp
Normal file
46
electron_training/result_B_new/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{5.23340640939e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
|
||||
4.71249222755e-07, 1.02445483208e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.423314958811,
|
||||
499.603149414, 499.198486328,
|
||||
1.36927723885, 0.149392709136}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{1.10509804069795, -1.06659111536073, -1.23304417235305, -9.91292225685574,
|
||||
1.00704133279785, 9.53100159268659, -0.793174916006915},
|
||||
{-0.776689382841375, -10.4158785961964, 8.69653776953056, 6.84445159227452,
|
||||
-6.97657257253127, 6.63766574651487, 7.11596889066532},
|
||||
{-0.381785768656306, -5.11642852466812, 3.59950933567307, 16.792587073888,
|
||||
-3.83635033235741, -7.72761443893271, 3.58572441569503},
|
||||
{1.04413334688141, -3.78312149763691, 9.83287128246016, 1.4778662654192,
|
||||
-2.0766161850877, 1.08288357164774, 8.02887163423859},
|
||||
{-3.94899781448378, 1.94391204753919, -8.65991195739853, -2.00834934461626,
|
||||
-3.50457026010403, 4.99589301163709, -6.89137092011374},
|
||||
{-1.29549202700169, 7.66739081183929, 0.281901363288286, -1.19821907042793,
|
||||
2.92107740687058, 1.14948481762706, 7.31015879384667},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.76053743491788, 0.909858152169371, 0.323489900540112, 1.61941068281945,
|
||||
0.92342774005317, 0.0522421825019989, -1.23071245493981}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.12420793824361, 0.0833900748795987, 3.10092151009265,
|
||||
0.320087923870887, -0.582151496774453, 0.029470772407136,
|
||||
1.63438201788813, -1.43480874379498, 1.55528937765131},
|
||||
{-2.8947400885087, 0.336449303963403, -2.30774902952597, -2.03456375507124,
|
||||
2.29485822558142, 0.145499754959071, -1.61531096417457,
|
||||
0.0991522125616504, -6.41616204842718},
|
||||
{1.75720706890165, 1.241283421626, 0.607968086927335, -0.816112122281315,
|
||||
0.0294391273974063, -7.94349478092389, -0.825543426908553,
|
||||
-1.917979348207, -2.03720925778068},
|
||||
{0.276286323447054, -0.393087539092168, -1.44329478350452,
|
||||
-1.86277301712902, -0.807222527397035, -1.7239133524486, 1.61348068527877,
|
||||
-1.66550797875971, -0.966703432130041},
|
||||
{-1.20952640410995, -1.34067444254507, 0.079870798547199,
|
||||
-0.0280804827435552, 0.15103668191983, 2.28974121850533,
|
||||
-0.848898627795279, 0.747603604163112, 0.000485431747120298},
|
||||
{-0.806478361586365, -0.902043622848205, 2.75668355569402,
|
||||
-0.636341321727925, 0.189229471295501, 1.41597159860703,
|
||||
-1.52203810494393, 1.62460924160209, 1.94946724799691}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-1.05665248808677, 1.16854173340171, -0.924262662063758, 0.441514927697916,
|
||||
-0.908730180794495, 1.02616776486021, 1.26618724664255}};
|
46
electron_training/result_B_old/matching.hpp
Normal file
46
electron_training/result_B_old/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{2.32376150961e-05, 1.07555320028e-06, 1.33514404297e-05, 3.0517578125e-05,
|
||||
3.99723649025e-06, 4.65661287308e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9999885559, 0.509573578835,
|
||||
498.591552734, 499.918823242,
|
||||
1.35891008377, 0.149692088366}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{1.09689919364338, -2.36337032185014, -3.02921316084911, -8.60965194111848,
|
||||
1.07308849187722, 11.2080534568785, -0.962205787111116},
|
||||
{0.742505004354826, -11.5991419169641, 4.4706991652213, 12.0524034815861,
|
||||
-7.39781510361567, -0.213355059289303, 2.43301548168847},
|
||||
{-0.725034235213988, -4.7645569874331, 3.41021029475148, 18.2505819659489,
|
||||
-2.28931892322383, -6.70009514891697, 7.19788851418639},
|
||||
{-0.43322070581816, -6.76514244197456, 13.847487618501, 5.02461005105822,
|
||||
-3.37683447138325, 0.858009838318498, 10.273453699814},
|
||||
{-5.70448188875026, 5.26491831063117, -11.5555643412233, 3.1883356042284,
|
||||
-2.133677285889, -2.24006224305986, -8.63987163868301},
|
||||
{-1.06391634270892, 9.01667090199045, -1.28516566899228, -3.82841187857546,
|
||||
3.18471029451158, 3.67902076971672, 7.29632098310751},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.68628281779244, 0.945006908224918, 0.536427352104393, 1.40667951887796,
|
||||
0.832049300778026, -0.1089543073399, -1.43675125780786}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{1.21826975700184, 0.363147471400374, 2.05773388885566, 0.540313557549193,
|
||||
0.420913357653504, -2.44884689863901, 1.63438201788813, -1.40944934303207,
|
||||
-2.32871515871553},
|
||||
{-2.90439321892223, 0.719436509209912, -3.93523150198893,
|
||||
-1.07342541319164, 2.07689989754924, -2.39788444100381, -1.61531096417457,
|
||||
0.0991887634515266, -8.04764734753152},
|
||||
{-2.98923948872248, 2.26253234310036, -0.220642963100105,
|
||||
-0.279316661053141, 0.0331794243552215, -5.88142829451649,
|
||||
-0.825543426908553, -1.92002983781799, -8.21361341703474},
|
||||
{0.662904361912077, -0.885584946591213, -1.45517778095535,
|
||||
-1.89901295762029, -0.806428733926438, -1.81021900435817,
|
||||
1.61348068527877, -1.66550797875971, -1.51013848461449},
|
||||
{-1.37437469030598, -2.21755157129085, 1.33360411388341,
|
||||
-0.0320979297776227, 0.290980167206705, 2.38901360605064,
|
||||
-0.848898627795279, 0.766669058008792, 0.257937241570605},
|
||||
{-1.09504185612819, -0.458703315043996, 1.03883522785983,
|
||||
-1.05014637612802, 0.806301762243297, 2.21317466894066, -1.52203810494393,
|
||||
1.5559212254549, 3.4514658408796}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.533136674890316, 1.09880505630834, -0.802064163473207, 1.60699693080913,
|
||||
-0.951610170601364, 0.802378806704215, -1.20342886768673}};
|
@ -0,0 +1,48 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{0.000315562472679, 1.14277577268e-06, 0.000274658203125, 0.000102996826172,
|
||||
1.25970691442e-05, 4.93600964546e-08}};
|
||||
const auto fMax =
|
||||
std::array<simd::float_v, 6>{{29.9998435974, 0.431377887726, 490.802429199,
|
||||
497.135681152, 1.3582059145, 0.147097736597}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.925466511495192, -3.04696651693941, 1.48703910101059, -2.74358886415853,
|
||||
-1.54108875912546, 5.95181992279351, 1.09520524639045},
|
||||
{0.225076264550494, -5.30106552386163, 6.29832156309508, 7.0574368868963,
|
||||
-3.96436697758889, -0.110687606346842, 4.65556823990769},
|
||||
{0.859449093477803, -1.42364618189426, 1.52973494084549, 1.63204418679045,
|
||||
0.402800627021359, 2.02973355392681, 1.61963813362595},
|
||||
{0.797017653476011, 1.80207629996926, 1.98407671947614, -4.84738045778757,
|
||||
-0.237330392456841, 0.555272132234374, -0.334695720441674},
|
||||
{-0.0089249002524941, -0.0721593078491391, -4.03962401066098,
|
||||
-0.741196499782838, -0.520561836165389, -2.43469377130746,
|
||||
-5.05370729239864},
|
||||
{-0.324849815552061, 0.571642144152413, -2.26163157259376,
|
||||
-3.96363877139044, 3.80954499156217, 0.812071601189534,
|
||||
-0.388923872459538},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.90248604788051, 0.75183501464588, 0.163545686727045, 1.62950884794052,
|
||||
1.04315466999792, 0.0204618414445436, -1.06300958722802}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-3.75265433194304, -4.03077590921609, 0.560952725012946, 1.59903822739795,
|
||||
2.24144673906438, 0.377410282165578, 1.63438201788813, -1.47007146768882,
|
||||
-2.58605490949786},
|
||||
{-2.60068359938433, -0.0309587124576335, -0.841839408810281,
|
||||
-0.377592041175285, 0.266402105492061, -1.93675266037507,
|
||||
-1.61531096417457, 0.0988426038328682, 1.51287715061537},
|
||||
{-0.257103489627825, 2.38563057831866, -2.06682010253696,
|
||||
-1.50490219717468, 0.990281758525445, -2.89728072212192,
|
||||
-0.825543426908553, -1.91692155046286, -0.469424293810405},
|
||||
{0.680066470317009, -0.353277604226862, -1.4315209802379,
|
||||
-1.86345277642716, -0.806051898385157, -1.70690619012381,
|
||||
1.61348068527877, -1.66550797875971, -0.804637203024864},
|
||||
{0.292121929684041, 1.67922513643505, -0.2207750830665, -1.85432148737195,
|
||||
-0.761761120528791, 0.148603794427115, -0.848898627795279,
|
||||
0.776926680814688, 0.515413675465116},
|
||||
{0.436091761386387, -1.32454758986161, 1.0014013582506, -0.251981066947133,
|
||||
-0.176482975086784, -0.862489698728272, -1.52203810494393,
|
||||
1.59929932442845, 0.257302379473767}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-3.33863999066044, 1.86100137130551, -0.825426355935299, 0.455646208323886,
|
||||
-0.730374866334297, 1.65923402820956, 1.60305190554767}};
|
@ -0,0 +1,2 @@
|
||||
signal: only electrons that are true match but mlp response "no match"
|
||||
background: all ghost tracks
|
47
electron_training/result_D/matching.hpp
Normal file
47
electron_training/result_D/matching.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{1.4334048501e-05, 1.21005723486e-06, 0.0001220703125, 4.57763671875e-05,
|
||||
6.51180744171e-06, 5.58793544769e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9999580383, 0.388462841511,
|
||||
497.0078125, 499.509338379,
|
||||
1.34583222866, 0.148980647326}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{1.80376907529412, -3.94522006510378, 0.731592325680377, -11.2008566094574,
|
||||
0.679894249961926, 3.84839657473663, -8.07142111719402},
|
||||
{-2.07030049796095, 3.26515474867444, 0.320697671285593,
|
||||
-0.564334829758113, 3.06552235842096, 2.6605948885273, 4.6955026167446},
|
||||
{0.896838903613344, -1.89786210758941, 6.19791014227951, 13.9534201571522,
|
||||
-9.67617750026742, -5.13735275462149, 5.25604022070252},
|
||||
{0.350723542258884, -5.46236108010248, 11.3961275449655, 6.86860356458193,
|
||||
-4.10979098519269, 7.40355727094559, 17.4195097954786},
|
||||
{-4.98089321802183, -3.06924425120168, -4.16533013325382,
|
||||
-1.76525268144874, -0.574266009689755, 1.38792795938214,
|
||||
-11.9738574538811},
|
||||
{-1.3792553381734, 6.6360108241851, 1.58470490969407, 1.2116201192747,
|
||||
3.35950082512036, -2.69400720014141, 5.78773380456927},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.89618444435453, 0.756762886971226, 0.224607628956107, 1.58224418687104,
|
||||
1.01198188838621, 0.0609287072816972, -1.10149714422957}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-1.95030391768864, -2.57241200745428, 2.22513961422549, 1.09636924630915,
|
||||
-1.41670442059213, 0.268826912887813, 1.63438201788813, -1.41788409846508,
|
||||
-0.529591299831198},
|
||||
{-1.7671292981577, -0.123369349217712, -0.866977288876212,
|
||||
-0.90631173560288, 2.47901931013162, -2.21695976800688, -1.61531096417457,
|
||||
0.0991885303988918, 1.28955047096799},
|
||||
{-0.534089470091784, 1.26461913447419, -0.403013723511741,
|
||||
-0.758910423086654, -0.92644473334079, -1.52818746990179,
|
||||
-0.825543426908553, -1.92721239362346, 3.26105888866326},
|
||||
{0.198023173442802, -0.564145037694825, -1.43289188975828,
|
||||
-1.86352960767302, -0.808447979295006, -1.71330811211152,
|
||||
1.61348068527877, -1.66550797875971, -0.910801619527772},
|
||||
{-1.8227621068219, -0.698025453596766, 0.233245541019916,
|
||||
-0.387306932182454, -1.05004029412037, -0.333220104163044,
|
||||
-0.848898627795279, 0.782822716993409, -0.262552968051654},
|
||||
{-0.314822731076892, -1.50428335429844, 0.179689344301775,
|
||||
-0.325249075131384, -0.635962383213103, -0.491817587388958,
|
||||
-1.52203810494393, 1.59283237353393, -0.153430533462156}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.572477318545036, 1.12222369845671, 0.962011482756679, 0.427739156517669,
|
||||
-1.31864386562843, 1.61500835143017, -1.96827876292426}};
|
47
electron_training/result_D_old/matching.hpp
Normal file
47
electron_training/result_D_old/matching.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{1.4334048501e-05, 1.20995343877e-06, 0.000255584716797, 7.62939453125e-05,
|
||||
1.95447355509e-05, 9.31322574615e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9999771118, 0.480875372887,
|
||||
497.208251953, 499.789672852,
|
||||
1.33854484558, 0.149920448661}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-2.53490305244316, -3.87226566727903, -4.46377668521249, 3.76593347190621,
|
||||
-0.736147925273483, 9.02585614570327, 3.6237871734026},
|
||||
{0.549076542016505, -6.76487588278314, 12.7146884747338, 6.35190577761167,
|
||||
-4.4556955709276, 8.26540577622736, 18.015709088484},
|
||||
{-0.456124601513526, -3.87828385698417, 6.13829079533624, 20.024096872054,
|
||||
-10.2437102287476, -13.5453994008865, 1.47951238998312},
|
||||
{0.81464719007702, -5.60573514166659, 7.32263078411251, -5.0446935011349,
|
||||
-0.701597395356833, 6.4873077480756, 1.05029191775837},
|
||||
{-5.20529068292815, -1.29341688678248, -12.9211101623102, 4.06192896781978,
|
||||
-2.24819687530499, -4.47649653096685, -18.7962996196447},
|
||||
{-1.92319074705205, 9.13989051160526, 1.4372857889395, 3.71255897752862,
|
||||
2.12080932540223, 0.775519813919651, 13.1780255071529},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{2.48032981707208, 1.99122468030675, 0.147128688791476, 3.20653226030149,
|
||||
-1.59262641780577, 1.63473498915926, -0.983318163281607}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-1.23665952123739, 1.12167249551526, 0.882383882593374,
|
||||
-0.923566479348657, 0.0338835472680554, 1.00667491483647,
|
||||
1.63438201788813, -4.23394622989637, -0.990743251230407},
|
||||
{-1.17099975681859, -0.0097715608108182, -0.404796049870115,
|
||||
0.85424890495973, 3.98024762276004, -0.145761966096377, -1.61531096417457,
|
||||
0.0969352107124514, -5.51833020463238},
|
||||
{2.4380083430657, 2.00418225228056, -0.792776990439125, -2.80847623446533,
|
||||
-0.137631196353825, -7.80633161173606, -0.825543426908553,
|
||||
-2.37988842437401, -6.27310694945946},
|
||||
{0.225004410426863, -0.39049833080813, -1.43244348842572,
|
||||
-1.86390252348813, -0.816126277640337, -1.7092593780967, 1.61348068527877,
|
||||
-1.66550797875971, -0.984918093686436},
|
||||
{-0.238610540704029, -0.352025987714205, 1.91071878135911,
|
||||
1.06903719015662, -0.0879085084653824, -5.01732651510019,
|
||||
-0.848898627795279, 0.301171033553613, -3.31246000228067},
|
||||
{1.06098527822605, -1.02241211107063, -0.727572693909408,
|
||||
-0.164960522101848, 0.834295993060446, -0.816864575663688,
|
||||
-1.52203810494393, 1.63565593112606, 0.829470327557413}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.547016315428893, 0.794153417512957, -0.534810951888594,
|
||||
0.411807752872488, -1.06003774378693, 0.679060736847631,
|
||||
0.119300486730084}};
|
46
electron_training/result_reg_B/matching.hpp
Normal file
46
electron_training/result_reg_B/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{5.23340640939e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
|
||||
4.71249222755e-07, 1.02445483208e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.423314958811,
|
||||
499.603149414, 499.198486328,
|
||||
1.36927723885, 0.149392709136}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{2.57491955820114, -0.0666351688682796, -3.61648923844569,
|
||||
-8.75747553035328, 0.639385257730277, 10.5129455348455, 1.22080436670381},
|
||||
{-0.839608322851951, -11.7978768103865, 7.24641653369801, 6.63011679030303,
|
||||
-5.38496571510758, 8.30851076817151, 6.69929919816849},
|
||||
{-0.17630967374162, -3.75940580347415, 2.79889282638498, 16.7594894489781,
|
||||
-3.10824840396248, -8.80345141844331, 3.9130937162361},
|
||||
{0.19092161829683, -3.60963385297311, 11.9569759734039, 2.10283509156704,
|
||||
-2.39101707207304, -1.89478969715624, 7.1165950679585},
|
||||
{-3.02014034882022, 2.24487587036827, -8.90770349935038, -4.05040202238185,
|
||||
-1.36813505779681, 9.14630004607903, -3.34618937758505},
|
||||
{0.459674275912345, 8.12262886393506, 0.45018729587823, -1.11787227534737,
|
||||
2.8096254085019, -0.481877520480143, 7.78611195142966},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.8337752666274, 0.841018614520629, 0.272259015077869, 1.63031107650108,
|
||||
0.987469718084883, 0.0999586200250234, -1.13752770875358}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.0482883134570299, 0.46403980819019, 2.73665245864103,
|
||||
0.245936163361116, -0.472281505442891, 0.307317690224363,
|
||||
1.63438201788813, -1.44341215808597, -0.706584289774802},
|
||||
{-3.91297125261727, 0.681495111998297, -3.37155822025346,
|
||||
-0.966831590652637, 2.65933759421044, -0.661174079209186,
|
||||
-1.61531096417457, 0.0991696473049824, -4.51523108840722},
|
||||
{0.273186686950073, 1.14087516410812, 0.653137998266985,
|
||||
-0.158819017566112, 0.692268877136322, -8.04912219449925,
|
||||
-0.825543426908553, -1.92132463640843, -2.47870678055356},
|
||||
{0.180394111293318, -0.414717927339332, -1.44129610325848,
|
||||
-1.86532392228702, -0.806791495297171, -1.73521704274739,
|
||||
1.61348068527877, -1.66550797875971, -0.927403017991324},
|
||||
{-0.790929106392951, -0.0886126272927867, 0.035682993929273,
|
||||
-0.602424006939674, 0.334723143379322, 2.22416454606917,
|
||||
-0.848898627795279, 0.743857937018801, -0.291005217785123},
|
||||
{-0.681492967014666, -0.368602644948209, 1.52403393057559,
|
||||
-1.06212309361209, 0.881062654352226, 0.690165878288055,
|
||||
-1.52203810494393, 1.63217238068739, 2.76628946224152}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.692725959420674, 1.18375950895893, -1.13672009847538, 0.407788542121486,
|
||||
-0.606866044733726, 0.927912329413981, -0.887231003739174}};
|
20
env/environment.yaml
vendored
Normal file
20
env/environment.yaml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: tuner
|
||||
channels:
|
||||
- conda-forge
|
||||
- defaults
|
||||
dependencies:
|
||||
- python=3.10
|
||||
- root
|
||||
- pre-commit
|
||||
- jupyter
|
||||
- black=22.8.0
|
||||
- flake8=5.0.4
|
||||
- clang-format
|
||||
- matplotlib
|
||||
- uproot
|
||||
- awkward
|
||||
- pandas
|
||||
- numpy
|
||||
- scikit-learn
|
||||
- mplhep
|
||||
- seaborn
|
151
main.py
Normal file
151
main.py
Normal file
@ -0,0 +1,151 @@
|
||||
# flake8: noqaq
|
||||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
from parameterisations.parameterise_magnet_kink import parameterise_magnet_kink
|
||||
from parameterisations.parameterise_track_model import parameterise_track_model
|
||||
from parameterisations.parameterise_search_window import parameterise_search_window
|
||||
from parameterisations.parameterise_field_integral import parameterise_field_integral
|
||||
from parameterisations.parameterise_hough_histogram import parameterise_hough_histogram
|
||||
from parameterisations.utils.preselection import preselection
|
||||
from parameterisations.train_forward_ghost_mlps import (
|
||||
train_default_forward_ghost_mlp,
|
||||
train_veloUT_forward_ghost_mlp,
|
||||
)
|
||||
from parameterisations.train_matching_ghost_mlps import train_matching_ghost_mlp
|
||||
from parameterisations.utils.parse_tmva_matrix_to_array import (
|
||||
parse_tmva_matrix_to_array,
|
||||
)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--field-params",
|
||||
action="store_true",
|
||||
help="Enables determination of magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--forward-weights",
|
||||
action="store_true",
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--matching-weights",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-params-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-weights-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for NN weight determination.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
selected = "neural_net_training/data/param_data_selected.root"
|
||||
if args.prepare_params_data:
|
||||
selection = "chi2_comb < 5 && pt > 10 && p > 1500 && p < 100000 && pid != 11"
|
||||
print("Run selection cuts =", selection)
|
||||
selected_md = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected, selected_md, selected_mu]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
cpp_files = []
|
||||
if args.field_params:
|
||||
print("Parameterise magnet kink position ...")
|
||||
cpp_files.append(parameterise_magnet_kink(input_file=selected))
|
||||
print("Parameterise track model ...")
|
||||
cpp_files.append(parameterise_track_model(input_file=selected))
|
||||
|
||||
selected_all_p = "neural_net_training/data/param_data_selected_all_p.root"
|
||||
if args.prepare_params_data:
|
||||
selection_all_momenta = "chi2_comb < 5 && pid != 11"
|
||||
print()
|
||||
print("Run selection cuts =", selection_all_momenta)
|
||||
selected_md_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected_all_p, selected_md_all_p, selected_mu_all_p]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
if args.field_params:
|
||||
print("Parameterise search window ...")
|
||||
cpp_files.append(parameterise_search_window(input_file=selected_all_p))
|
||||
print("Parameterise magnetic field integral ...")
|
||||
cpp_files.append(parameterise_field_integral(input_file=selected_all_p))
|
||||
print("Parameterise Hough histogram binning ...")
|
||||
cpp_files.append(parameterise_hough_histogram(input_file=selected_all_p))
|
||||
|
||||
###>>>
|
||||
ghost_data = "neural_net_training/data/ghost_data.root"
|
||||
if args.prepare_weights_data:
|
||||
merge_cmd = [
|
||||
"hadd",
|
||||
"-fk",
|
||||
ghost_data,
|
||||
"data/ghost_data_MD.root",
|
||||
"data/ghost_data_MU.root",
|
||||
]
|
||||
print("Concatenate polarities for neural network training ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
###<<<
|
||||
if args.forward_weights:
|
||||
train_default_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# FIXME: use env variable instead
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_veloUT_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"neural_net_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"neural_net_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
###>>>
|
||||
if args.matching_weights:
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_matching_ghost_mlp(
|
||||
prepare_data=True, # args.prepare_weights_data,
|
||||
input_file="data/ghost_data_B.root",
|
||||
tree_name="PrMatchNN_e6feac0d.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
outdir="neural_net_training",
|
||||
)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"neural_net_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C",
|
||||
],
|
||||
simd_type=True,
|
||||
)
|
||||
###<<<
|
||||
for file in cpp_files:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{file}",
|
||||
],
|
||||
)
|
171
main_tracking_losses.py
Normal file
171
main_tracking_losses.py
Normal file
@ -0,0 +1,171 @@
|
||||
# flake8: noqaq
|
||||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
from parameterisations.parameterise_magnet_kink import parameterise_magnet_kink
|
||||
from parameterisations.parameterise_track_model import parameterise_track_model
|
||||
from parameterisations.parameterise_search_window import parameterise_search_window
|
||||
from parameterisations.parameterise_field_integral import parameterise_field_integral
|
||||
from parameterisations.parameterise_hough_histogram import parameterise_hough_histogram
|
||||
from parameterisations.utils.preselection import preselection
|
||||
from parameterisations.train_forward_ghost_mlps import (
|
||||
train_default_forward_ghost_mlp,
|
||||
train_veloUT_forward_ghost_mlp,
|
||||
)
|
||||
from parameterisations.losses_train_matching_ghost_mlps import (
|
||||
train_matching_ghost_mlp,
|
||||
)
|
||||
from parameterisations.utils.parse_tmva_matrix_to_array_TrLo import (
|
||||
parse_tmva_matrix_to_array,
|
||||
)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--field-params",
|
||||
action="store_true",
|
||||
help="Enables determination of magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--forward-weights",
|
||||
action="store_true",
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--matching-weights",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="Enables determination of weights used by neural networks.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--prepare",
|
||||
action="store_true",
|
||||
# default=True,
|
||||
help="Enables preparation of data for matching.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-params-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for magnetic field parameterisations.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--prepare-weights-data",
|
||||
action="store_true",
|
||||
help="Enables preparation of data for NN weight determination.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
selected = "nn_electron_training/data/param_data_selected.root"
|
||||
if args.prepare_params_data:
|
||||
selection = "chi2_comb < 5 && pt > 10 && p > 1500 && p < 100000 && pid != 11"
|
||||
print("Run selection cuts =", selection)
|
||||
selected_md = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu = preselection(
|
||||
cuts=selection,
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected, selected_md, selected_mu]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
cpp_files = []
|
||||
if args.field_params:
|
||||
print("Parameterise magnet kink position ...")
|
||||
cpp_files.append(parameterise_magnet_kink(input_file=selected))
|
||||
print("Parameterise track model ...")
|
||||
cpp_files.append(parameterise_track_model(input_file=selected))
|
||||
|
||||
selected_all_p = "nn_electron_training/data/param_data_selected_all_p.root"
|
||||
if args.prepare_params_data:
|
||||
selection_all_momenta = "chi2_comb < 5 && pid != 11"
|
||||
print()
|
||||
print("Run selection cuts =", selection_all_momenta)
|
||||
selected_md_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MD.root",
|
||||
)
|
||||
selected_mu_all_p = preselection(
|
||||
cuts=selection_all_momenta,
|
||||
outfile_postfix="selected_all_p",
|
||||
input_file="data/param_data_MU.root",
|
||||
)
|
||||
merge_cmd = ["hadd", "-fk", selected_all_p, selected_md_all_p, selected_mu_all_p]
|
||||
print("Concatenate polarities ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
|
||||
if args.field_params:
|
||||
print("Parameterise search window ...")
|
||||
cpp_files.append(parameterise_search_window(input_file=selected_all_p))
|
||||
print("Parameterise magnetic field integral ...")
|
||||
cpp_files.append(parameterise_field_integral(input_file=selected_all_p))
|
||||
print("Parameterise Hough histogram binning ...")
|
||||
cpp_files.append(parameterise_hough_histogram(input_file=selected_all_p))
|
||||
|
||||
###>>>
|
||||
ghost_data = "data/ghost_data.root"
|
||||
if args.prepare_weights_data:
|
||||
merge_cmd = [
|
||||
"hadd",
|
||||
"-fk",
|
||||
ghost_data,
|
||||
"data/ghost_data_B.root",
|
||||
"data/ghost_data_D.root",
|
||||
]
|
||||
print("Concatenate decays for neural network training ...")
|
||||
subprocess.run(merge_cmd, check=True)
|
||||
###<<<
|
||||
if args.forward_weights:
|
||||
train_default_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# FIXME: use env variable instead
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_veloUT_forward_ghost_mlp(prepare_data=args.prepare_weights_data)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_trackinglosses_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"nn_trackinglosses_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
###
|
||||
###>>>
|
||||
###
|
||||
if args.matching_weights:
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
train_matching_ghost_mlp(
|
||||
prepare_data=args.prepare,
|
||||
input_file="data/tracking_losses_ntuple_B.root",
|
||||
tree_name="PrDebugTrackingLosses.PrDebugTrackingTool/Tuple", # e6feac0d, B: 3e224c41, B res: 1e13cc7e, D: 8cb154ca
|
||||
b_input_file="data/ghost_data_B.root",
|
||||
b_tree_name="PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
only_electrons=True,
|
||||
outdir="nn_trackinglosses_training",
|
||||
n_train_signal=20e3,
|
||||
n_train_bkg=40e3,
|
||||
n_test_signal=5e3,
|
||||
n_test_bkg=10e3,
|
||||
)
|
||||
# this ensures that the directory is correct
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
cpp_files += parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_trackinglosses_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C",
|
||||
],
|
||||
simd_type=True,
|
||||
)
|
||||
###
|
||||
###<<<
|
||||
###
|
||||
for file in cpp_files:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{file}",
|
||||
],
|
||||
)
|
128
moore_options/Bak_get_ghost_data.py
Normal file
128
moore_options/Bak_get_ghost_data.py
Normal file
@ -0,0 +1,128 @@
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from PRConfig.TestFileDB import test_file_db
|
||||
from PyConf.Algorithms import (
|
||||
PrForwardTrackingVelo,
|
||||
PrForwardTracking,
|
||||
PrTrackAssociator,
|
||||
PrMatchNN,
|
||||
)
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from RecoConf.hlt1_tracking import make_hlt1_tracks, make_PrStoreSciFiHits_hits
|
||||
from RecoConf.hlt2_tracking import get_global_ut_hits_tool, make_PrHybridSeeding_tracks
|
||||
from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
|
||||
|
||||
|
||||
options.evt_max = -1
|
||||
n_files_per_cat = 1
|
||||
polarity = "MU"
|
||||
options.ntuple_file = f"data/ghost_data_{polarity}.root"
|
||||
input_files = (
|
||||
(
|
||||
test_file_db["upgrade_DC19_01_Bs2JPsiPhi_MD"].filenames[:n_files_per_cat]
|
||||
if polarity == "MD"
|
||||
else test_file_db["upgrade_DC19_01_Bs2JpsiPhiMU"].filenames[:n_files_per_cat]
|
||||
)
|
||||
+ test_file_db[f"upgrade_DC19_01_Bs2PhiPhi{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Z2mumu{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Bd2Dstmumu{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Dst2D0pi{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Bd2Kstee{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Dp2KSPip_{polarity}"].filenames[:n_files_per_cat]
|
||||
)
|
||||
options.input_files = input_files
|
||||
options.input_type = "ROOT"
|
||||
options.set_conds_from_testfiledb(f"upgrade_DC19_01_Dst2D0pi{polarity}")
|
||||
|
||||
|
||||
def run_tracking_debug():
|
||||
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
||||
hlt1_tracks = make_hlt1_tracks()
|
||||
seed_tracks = make_PrHybridSeeding_tracks()
|
||||
|
||||
# add MCLinking to the (fitted) V1 tracks
|
||||
links_to_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Velo"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_upstream_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Upstream"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_seed_tracks = PrTrackAssociator(
|
||||
SingleContainer=seed_tracks["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
# be more robust against imperfect data
|
||||
loose_forward_params = dict(
|
||||
MaxChi2PerDoF=16,
|
||||
MaxChi2XProjection=30,
|
||||
MaxChi2PerDoFFinal=8,
|
||||
MaxChi2Stereo=8,
|
||||
MaxChi2StereoAdd=8,
|
||||
)
|
||||
|
||||
forward_debug = PrForwardTrackingVelo(
|
||||
InputTracks=hlt1_tracks["Velo"]["Pr"],
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Velo"]["v1"],
|
||||
InputTrackLinks=links_to_velo_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
forward_ut_debug = PrForwardTracking(
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
InputTracks=hlt1_tracks["Upstream"]["Pr"],
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Upstream"]["v1"],
|
||||
InputTrackLinks=links_to_upstream_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
loose_matching_params = dict(MaxMatchChi2=30.0, MaxDistX=500, MaxDistY=500)
|
||||
|
||||
match_debug = PrMatchNN(
|
||||
VeloInput=hlt1_tracks["Velo"]["Pr"],
|
||||
SeedInput=seed_tracks["Pr"],
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=hlt1_tracks["Velo"]["v1"],
|
||||
SeedTracks=seed_tracks["v1"],
|
||||
VeloTrackLinks=links_to_velo_tracks,
|
||||
SeedTrackLinks=links_to_seed_tracks,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
**loose_matching_params,
|
||||
).MatchOutput
|
||||
|
||||
data = [forward_debug, forward_ut_debug, match_debug]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_debug)
|
44
moore_options/Bak_get_parameterisation_data.py
Normal file
44
moore_options/Bak_get_parameterisation_data.py
Normal file
@ -0,0 +1,44 @@
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from PRConfig.TestFileDB import test_file_db
|
||||
from PyConf.Algorithms import PrParameterisationData
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
|
||||
options.evt_max = -1
|
||||
n_files_per_cat = 1
|
||||
polarity = "MU"
|
||||
options.ntuple_file = f"data/param_data_{polarity}.root"
|
||||
input_files = (
|
||||
(
|
||||
test_file_db["upgrade_DC19_01_Bs2JPsiPhi_MD"].filenames[:n_files_per_cat]
|
||||
if polarity == "MD"
|
||||
else test_file_db["upgrade_DC19_01_Bs2JpsiPhiMU"].filenames[:n_files_per_cat]
|
||||
)
|
||||
+ test_file_db[f"upgrade_DC19_01_Bs2PhiPhi{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Z2mumu{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Bd2Dstmumu{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Dst2D0pi{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Bd2Kstee{polarity}"].filenames[:n_files_per_cat]
|
||||
+ test_file_db[f"upgrade_DC19_01_Dp2KSPip_{polarity}"].filenames[:n_files_per_cat]
|
||||
)
|
||||
options.input_files = input_files
|
||||
options.input_type = "ROOT"
|
||||
options.set_conds_from_testfiledb(f"upgrade_DC19_01_Dst2D0pi{polarity}")
|
||||
|
||||
|
||||
def run_tracking_param_debug():
|
||||
param_data = PrParameterisationData(
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
MCVPHits=mc_unpackers()["MCVPHits"],
|
||||
MCFTHits=mc_unpackers()["MCFTHits"],
|
||||
zRef=8520.0,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
)
|
||||
|
||||
data = [param_data]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_param_debug)
|
121
moore_options/Bak_get_resolution_and_eff_data.py
Normal file
121
moore_options/Bak_get_resolution_and_eff_data.py
Normal file
@ -0,0 +1,121 @@
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
"""
|
||||
# flake8: noqaq
|
||||
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrKalmanFilter
|
||||
from PyConf.Tools import TrackMasterExtrapolator
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
check_track_resolution,
|
||||
check_tracking_efficiency,
|
||||
get_mc_categories,
|
||||
get_hit_type_mask,
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
# sample = "Bd2KstEE_MD"
|
||||
# sample = "Bd2KstEE_MU"
|
||||
# sample = "Bs2JpsiPhi_MD"
|
||||
# sample = "Bs2JpsiPhi_MU"
|
||||
sample = "Bs2PhiPhi_MD"
|
||||
# sample = "Bs2PhiPhi_MU"
|
||||
|
||||
stack = ""
|
||||
|
||||
options.evt_max = 5000
|
||||
options.first_evt = 0 if stack else 5000
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{sample}{stack}.root"
|
||||
options.input_type = "ROOT"
|
||||
options.set_input_and_conds_from_testfiledb(f"upgrade_sim10_Up08_Digi15_{sample}")
|
||||
|
||||
|
||||
def run_tracking_resolution():
|
||||
tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
fitted_forward_tracks = PrKalmanFilter(
|
||||
Input=tracks["Forward"]["Pr"],
|
||||
MaxChi2=2.8,
|
||||
MaxChi2PreOutlierRemoval=20,
|
||||
HitsVP=make_VeloClusterTrackingSIMD_hits(),
|
||||
HitsUT=make_PrStorePrUTHits_hits(),
|
||||
HitsFT=make_PrStoreSciFiHits_hits(),
|
||||
ReferenceExtrapolator=TrackMasterExtrapolator(
|
||||
MaterialLocator=get_global_materiallocator(),
|
||||
),
|
||||
InputUniqueIDGenerator=make_unique_id_generator(),
|
||||
).OutputTracks
|
||||
|
||||
links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Match"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
|
||||
res_checker_best_long = check_track_resolution(
|
||||
tracks["BestLong"],
|
||||
suffix="BestLong",
|
||||
)
|
||||
res_checker_best_forward = check_track_resolution(
|
||||
dict(v1=fitted_forward_tracks),
|
||||
suffix="BestForward",
|
||||
)
|
||||
eff_checker_forward = check_tracking_efficiency(
|
||||
"Forward",
|
||||
tracks["Forward"],
|
||||
links_to_forward,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Forward"),
|
||||
get_hit_type_mask("Forward"),
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
tracks["Match"],
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
||||
get_hit_type_mask("Match"),
|
||||
)
|
||||
eff_checker_best_long = check_tracking_efficiency(
|
||||
"BestLong",
|
||||
tracks["BestLong"],
|
||||
links_to_best,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("BestLong"),
|
||||
get_hit_type_mask("BestLong"),
|
||||
)
|
||||
data = [
|
||||
res_checker_forward,
|
||||
res_checker_best_long,
|
||||
res_checker_best_forward,
|
||||
eff_checker_forward,
|
||||
eff_checker_match,
|
||||
eff_checker_best_long,
|
||||
]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_resolution)
|
122
moore_options/Bak_get_tracking_losses.py
Normal file
122
moore_options/Bak_get_tracking_losses.py
Normal file
@ -0,0 +1,122 @@
|
||||
###############################################################################
|
||||
# (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration #
|
||||
# #
|
||||
# This software is distributed under the terms of the GNU General Public #
|
||||
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
|
||||
# #
|
||||
# In applying this licence, CERN does not waive the privileges and immunities #
|
||||
# granted to it by virtue of its status as an Intergovernmental Organization #
|
||||
# or submit itself to any jurisdiction. #
|
||||
###############################################################################
|
||||
# flake8: noqa
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from RecoConf.hlt1_tracking import make_VeloClusterTrackingSIMD_hits
|
||||
from RecoConf.hlt2_tracking import (
|
||||
make_hlt2_tracks,
|
||||
make_PrKalmanFilter_tracks,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
)
|
||||
from RecoConf.mc_checking import (
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
make_default_IdealStateCreator,
|
||||
)
|
||||
|
||||
from PyConf.Algorithms import PrTrackAssociator, PrDebugTrackingLosses
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
import glob
|
||||
|
||||
decay = "B"
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
|
||||
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.simulation = True
|
||||
options.input_type = "ROOT"
|
||||
|
||||
options.ntuple_file = f"data/tracking_losses_ntuple_{decay}.root"
|
||||
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
# run with
|
||||
# ./Moore/run gaudirun.py Moore/Hlt/RecoConf/options/tracking_developments/run_pr_tracking_losses.py
|
||||
# tested by mc_matching_example.py
|
||||
|
||||
|
||||
def run_tracking_losses():
|
||||
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
||||
hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
vp_hits = make_VeloClusterTrackingSIMD_hits()
|
||||
ut_hits = make_PrStorePrUTHits_hits()
|
||||
ft_hits = make_PrStoreSciFiHits_hits()
|
||||
fitted_match_tracks = make_PrKalmanFilter_tracks( # fitted_forward_tracks
|
||||
input_tracks=hlt2_tracks["Match"]["Pr"], # Forward
|
||||
hits_vp=vp_hits,
|
||||
hits_ut=ut_hits,
|
||||
hits_ft=ft_hits,
|
||||
)
|
||||
|
||||
# add MCLinking to the (fitted) V1 tracks
|
||||
links_to_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Velo"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_long_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
with PrTrackAssociator.bind(FractionOK=0.5):
|
||||
loose_links_to_long_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_fitted_tracks = PrTrackAssociator(
|
||||
SingleContainer=fitted_match_tracks, # fitted_forward_tracks
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
tracking_losses = PrDebugTrackingLosses(
|
||||
name="PrDebugTrackingLosses",
|
||||
TrackType="Long",
|
||||
StudyTracks=hlt2_tracks["Match"]["v1"], # Forward
|
||||
VeloTracks=hlt2_tracks["Velo"]["v1"],
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
MCVPHits=mc_unpackers()["MCVPHits"],
|
||||
MCUTHits=mc_unpackers()["MCUTHits"],
|
||||
MCFTHits=mc_unpackers()["MCFTHits"],
|
||||
VeloTrackLinks=links_to_velo_tracks,
|
||||
TrackLinks=links_to_long_tracks,
|
||||
LooseTrackLinks=loose_links_to_long_tracks,
|
||||
FittedTrackLinks=links_to_fitted_tracks,
|
||||
# LHCbIDLinks=links_to_hits,
|
||||
IdealStateCreator=make_default_IdealStateCreator(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
)
|
||||
|
||||
data = [tracking_losses]
|
||||
return Reconstruction("run_tracking_losses", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_losses)
|
38
moore_options/Recent_get_parameterisation_data.py
Normal file
38
moore_options/Recent_get_parameterisation_data.py
Normal file
@ -0,0 +1,38 @@
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrParameterisationData
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
import glob
|
||||
|
||||
|
||||
options.evt_max = -1
|
||||
n_files_per_cat = 1
|
||||
decay = "B"
|
||||
options.ntuple_file = f"data/param_data_{decay}.root"
|
||||
options.input_type = "ROOT"
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.simulation = True
|
||||
|
||||
|
||||
def run_tracking_param_debug():
|
||||
param_data = PrParameterisationData(
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
MCVPHits=mc_unpackers()["MCVPHits"],
|
||||
MCFTHits=mc_unpackers()["MCFTHits"],
|
||||
zRef=8520.0,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
)
|
||||
|
||||
data = [param_data]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_param_debug)
|
221
moore_options/get_ghost_data.py
Normal file
221
moore_options/get_ghost_data.py
Normal file
@ -0,0 +1,221 @@
|
||||
# flake8: noqa
|
||||
|
||||
"""
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_ghost_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
|
||||
from PyConf.Algorithms import (
|
||||
PrForwardTrackingVelo,
|
||||
PrForwardTracking,
|
||||
PrTrackAssociator,
|
||||
PrMatchNN,
|
||||
PrResidualVeloTracks,
|
||||
PrResidualSeedingLong,
|
||||
fromPrMatchTracksV1Tracks,
|
||||
fromPrVeloTracksV1Tracks,
|
||||
fromPrSeedingTracksV1Tracks,
|
||||
)
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from RecoConf.hlt1_tracking import make_hlt1_tracks, make_PrStoreSciFiHits_hits
|
||||
from RecoConf.hlt2_tracking import (
|
||||
get_global_ut_hits_tool,
|
||||
make_PrHybridSeeding_tracks,
|
||||
make_PrMatchNN_tracks,
|
||||
get_fast_hlt2_tracks,
|
||||
)
|
||||
from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
|
||||
import glob
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
decay = "D" # D, B
|
||||
options.ntuple_file = f"data/ghost_data_{decay}_electron_weights.root"
|
||||
|
||||
options.input_type = "ROOT"
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
elif decay == "both":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi") + glob.glob(
|
||||
"/auto/data/guenther/Dst_D0ee/*.xdigi"
|
||||
)
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
|
||||
|
||||
# options.geometry_version = "run3/trunk" #"run3/before-rich1-geom-update-26052022"
|
||||
# options.conditions_version = "master"
|
||||
options.simulation = True
|
||||
|
||||
|
||||
def run_tracking_debug():
|
||||
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
||||
hlt1_tracks = make_hlt1_tracks()
|
||||
seed_tracks = make_PrHybridSeeding_tracks()
|
||||
|
||||
# add MCLinking to the (fitted) V1 tracks
|
||||
links_to_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Velo"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_upstream_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Upstream"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_seed_tracks = PrTrackAssociator(
|
||||
SingleContainer=seed_tracks["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
# be more robust against imperfect data
|
||||
loose_forward_params = dict(
|
||||
MaxChi2PerDoF=16,
|
||||
MaxChi2XProjection=30,
|
||||
MaxChi2PerDoFFinal=8,
|
||||
MaxChi2Stereo=8,
|
||||
MaxChi2StereoAdd=8,
|
||||
)
|
||||
|
||||
forward_debug = PrForwardTrackingVelo(
|
||||
InputTracks=hlt1_tracks["Velo"]["Pr"],
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Velo"]["v1"],
|
||||
InputTrackLinks=links_to_velo_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
forward_ut_debug = PrForwardTracking(
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
InputTracks=hlt1_tracks["Upstream"]["Pr"],
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Upstream"]["v1"],
|
||||
InputTrackLinks=links_to_upstream_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
loose_matching_params = dict(
|
||||
MaxMatchChi2=30.0, # 30.0,
|
||||
MaxDistX=500, # 500,
|
||||
MaxDistY=500, # 500,
|
||||
MaxDSlope=1.5,
|
||||
MinMatchNN=0.215, # NN response cut value
|
||||
)
|
||||
|
||||
match_debug = PrMatchNN(
|
||||
VeloInput=hlt1_tracks["Velo"]["Pr"],
|
||||
SeedInput=seed_tracks["Pr"],
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=hlt1_tracks["Velo"]["v1"],
|
||||
SeedTracks=seed_tracks["v1"],
|
||||
VeloTrackLinks=links_to_velo_tracks,
|
||||
SeedTrackLinks=links_to_seed_tracks,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
**loose_matching_params,
|
||||
).MatchOutput
|
||||
|
||||
"""
|
||||
v1_match_tracks = fromPrMatchTracksV1Tracks(
|
||||
InputTracksLocation=match_debug,
|
||||
VeloTracksLocation=hlt1_tracks["Velo"]["v1"],
|
||||
SeedTracksLocation=seed_tracks["v1"],
|
||||
).OutputTracksLocation
|
||||
|
||||
# run Matching on residual velo and seed track segments
|
||||
|
||||
pr_velo_residual = PrResidualVeloTracks(
|
||||
TracksLocation=match_debug,
|
||||
VeloTrackLocation=hlt1_tracks["Velo"]["Pr"],
|
||||
).VeloTrackOutput
|
||||
|
||||
v1_velo_residual = fromPrVeloTracksV1Tracks(
|
||||
InputTracksLocation=pr_velo_residual
|
||||
).OutputTracksLocation
|
||||
|
||||
pr_seed_residual = PrResidualSeedingLong(
|
||||
MatchTracksLocation=match_debug,
|
||||
SeedTracksLocation=seed_tracks["Pr"],
|
||||
).SeedTracksOutput
|
||||
|
||||
v1_seed_residual = fromPrSeedingTracksV1Tracks(
|
||||
InputTracksLocation=pr_seed_residual
|
||||
).OutputTracksLocation
|
||||
|
||||
# add MCLinking to the (fitted) residual V1 tracks
|
||||
links_to_res_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=v1_velo_residual,
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_res_seed_tracks = PrTrackAssociator(
|
||||
SingleContainer=v1_seed_residual,
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
loose_res_matching_params = dict(
|
||||
MaxMatchChi2=30.0, # 30.0,
|
||||
MaxDistX=500, # 500,
|
||||
MaxDistY=500, # 500,
|
||||
MaxDSlope=1.5,
|
||||
MinMatchNN=0.5, # NN response cut value
|
||||
FastYTol=2500.0,
|
||||
)
|
||||
|
||||
match_residual = PrMatchNN(
|
||||
VeloInput=pr_velo_residual,
|
||||
SeedInput=pr_seed_residual,
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=v1_velo_residual,
|
||||
SeedTracks=v1_seed_residual,
|
||||
VeloTrackLinks=links_to_res_velo_tracks,
|
||||
SeedTrackLinks=links_to_res_seed_tracks,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
**loose_res_matching_params,
|
||||
).MatchOutput
|
||||
"""
|
||||
|
||||
data = [forward_debug, forward_ut_debug, match_debug] # match_residual]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_debug)
|
153
moore_options/get_resolution_and_eff_data.py
Normal file
153
moore_options/get_resolution_and_eff_data.py
Normal file
@ -0,0 +1,153 @@
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrKalmanFilter
|
||||
from PyConf.Tools import TrackMasterExtrapolator
|
||||
import glob
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
check_track_resolution,
|
||||
check_tracking_efficiency,
|
||||
get_mc_categories,
|
||||
get_hit_type_mask,
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_hlt2_tracks
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
decay = "D"
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = f"data/resolutions_and_effs_{decay}_electron_weights.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.simulation = True
|
||||
|
||||
|
||||
def run_tracking_resolution():
|
||||
tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
fitted_forward_tracks = PrKalmanFilter(
|
||||
Input=tracks["Forward"]["Pr"],
|
||||
MaxChi2=2.8,
|
||||
MaxChi2PreOutlierRemoval=20,
|
||||
HitsVP=make_VeloClusterTrackingSIMD_hits(),
|
||||
HitsUT=make_PrStorePrUTHits_hits(),
|
||||
HitsFT=make_PrStoreSciFiHits_hits(),
|
||||
ReferenceExtrapolator=TrackMasterExtrapolator(
|
||||
MaterialLocator=get_global_materiallocator(),
|
||||
),
|
||||
InputUniqueIDGenerator=make_unique_id_generator(),
|
||||
).OutputTracks
|
||||
|
||||
links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Match"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_seed = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Seed"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
|
||||
res_checker_best_long = check_track_resolution(
|
||||
tracks["BestLong"],
|
||||
suffix="BestLong",
|
||||
)
|
||||
res_checker_best_forward = check_track_resolution(
|
||||
dict(v1=fitted_forward_tracks),
|
||||
suffix="BestForward",
|
||||
)
|
||||
res_checker_seed = check_track_resolution(
|
||||
tracks["Seed"],
|
||||
suffix="Seed",
|
||||
)
|
||||
|
||||
eff_checker_forward = check_tracking_efficiency(
|
||||
"Forward",
|
||||
tracks["Forward"],
|
||||
links_to_forward,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Forward"),
|
||||
get_hit_type_mask("Forward"),
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
tracks["Match"],
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
||||
get_hit_type_mask("Match"),
|
||||
)
|
||||
eff_checker_best_long = check_tracking_efficiency(
|
||||
"BestLong",
|
||||
tracks["BestLong"],
|
||||
links_to_best,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("BestLong"),
|
||||
get_hit_type_mask("BestLong"),
|
||||
)
|
||||
eff_checker_seed = check_tracking_efficiency(
|
||||
"Seed",
|
||||
tracks["Seed"],
|
||||
links_to_seed,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Seed"),
|
||||
get_hit_type_mask("Seed"),
|
||||
)
|
||||
|
||||
data = [
|
||||
res_checker_forward,
|
||||
res_checker_best_long,
|
||||
res_checker_best_forward,
|
||||
res_checker_seed,
|
||||
eff_checker_forward,
|
||||
eff_checker_match,
|
||||
eff_checker_best_long,
|
||||
eff_checker_seed,
|
||||
]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_resolution)
|
127
moore_options/get_tracking_losses.py
Normal file
127
moore_options/get_tracking_losses.py
Normal file
@ -0,0 +1,127 @@
|
||||
###############################################################################
|
||||
# (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration #
|
||||
# #
|
||||
# This software is distributed under the terms of the GNU General Public #
|
||||
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
|
||||
# #
|
||||
# In applying this licence, CERN does not waive the privileges and immunities #
|
||||
# granted to it by virtue of its status as an Intergovernmental Organization #
|
||||
# or submit itself to any jurisdiction. #
|
||||
###############################################################################
|
||||
# flake8: noqa
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from RecoConf.hlt1_tracking import make_VeloClusterTrackingSIMD_hits
|
||||
from RecoConf.hlt2_tracking import (
|
||||
make_hlt2_tracks,
|
||||
make_PrKalmanFilter_tracks,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
)
|
||||
from RecoConf.mc_checking import (
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
make_default_IdealStateCreator,
|
||||
)
|
||||
|
||||
from PyConf.Algorithms import PrTrackAssociator, PrDebugTrackingLosses
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
import glob
|
||||
|
||||
|
||||
"""
|
||||
|
||||
run with
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_tracking_losses.py
|
||||
tested by mc_matching_example.py
|
||||
|
||||
"""
|
||||
|
||||
decay = "D"
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
|
||||
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.simulation = True
|
||||
options.input_type = "ROOT"
|
||||
|
||||
options.ntuple_file = f"data/tracking_losses_ntuple_{decay}_match_electron_weights.root"
|
||||
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
|
||||
def run_tracking_losses():
|
||||
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
||||
hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
vp_hits = make_VeloClusterTrackingSIMD_hits()
|
||||
ut_hits = make_PrStorePrUTHits_hits()
|
||||
ft_hits = make_PrStoreSciFiHits_hits()
|
||||
fitted_match_tracks = make_PrKalmanFilter_tracks( # fitted_forward_tracks
|
||||
input_tracks=hlt2_tracks["Match"]["Pr"], # Forward
|
||||
hits_vp=vp_hits,
|
||||
hits_ut=ut_hits,
|
||||
hits_ft=ft_hits,
|
||||
)
|
||||
|
||||
# add MCLinking to the (fitted) V1 tracks
|
||||
links_to_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Velo"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_long_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
with PrTrackAssociator.bind(FractionOK=0.5):
|
||||
loose_links_to_long_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_fitted_tracks = PrTrackAssociator(
|
||||
SingleContainer=fitted_match_tracks, # fitted_forward_tracks
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
tracking_losses = PrDebugTrackingLosses(
|
||||
name="PrDebugTrackingLosses",
|
||||
TrackType="Long",
|
||||
StudyTracks=hlt2_tracks["Match"]["v1"], # Forward
|
||||
VeloTracks=hlt2_tracks["Velo"]["v1"],
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
MCVPHits=mc_unpackers()["MCVPHits"],
|
||||
MCUTHits=mc_unpackers()["MCUTHits"],
|
||||
MCFTHits=mc_unpackers()["MCFTHits"],
|
||||
VeloTrackLinks=links_to_velo_tracks,
|
||||
TrackLinks=links_to_long_tracks,
|
||||
LooseTrackLinks=loose_links_to_long_tracks,
|
||||
FittedTrackLinks=links_to_fitted_tracks,
|
||||
# LHCbIDLinks=links_to_hits,
|
||||
IdealStateCreator=make_default_IdealStateCreator(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
)
|
||||
|
||||
data = [tracking_losses]
|
||||
return Reconstruction("run_tracking_losses", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_losses)
|
142
moore_options/residual_get_ghost_data.py
Normal file
142
moore_options/residual_get_ghost_data.py
Normal file
@ -0,0 +1,142 @@
|
||||
# flake8: noqaq
|
||||
|
||||
"""
|
||||
NOT IMPLEMENTED YET
|
||||
|
||||
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/Recent_get_ghost_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import (
|
||||
PrForwardTrackingVelo,
|
||||
PrForwardTracking,
|
||||
PrTrackAssociator,
|
||||
PrMatchNN,
|
||||
)
|
||||
from PyConf.application import make_data_with_FetchDataFromFile
|
||||
from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
|
||||
from RecoConf.data_from_file import mc_unpackers
|
||||
from RecoConf.hlt1_tracking import make_hlt1_tracks, make_PrStoreSciFiHits_hits
|
||||
from RecoConf.hlt2_tracking import get_global_ut_hits_tool, make_PrHybridSeeding_tracks
|
||||
from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
|
||||
import glob
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
decay = "test" # D, B
|
||||
options.ntuple_file = f"data/ghost_data_{decay}.root"
|
||||
options.input_type = "ROOT"
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
elif decay == "both":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi") + glob.glob(
|
||||
"/auto/data/guenther/Dst_D0ee/*.xdigi"
|
||||
)
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
|
||||
options.simulation = True
|
||||
|
||||
|
||||
def run_tracking_debug():
|
||||
links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
|
||||
hlt1_tracks = make_hlt1_tracks()
|
||||
seed_tracks = make_PrHybridSeeding_tracks()
|
||||
|
||||
# add MCLinking to the (fitted) V1 tracks
|
||||
links_to_velo_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Velo"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_upstream_tracks = PrTrackAssociator(
|
||||
SingleContainer=hlt1_tracks["Upstream"]["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
links_to_seed_tracks = PrTrackAssociator(
|
||||
SingleContainer=seed_tracks["v1"],
|
||||
LinkerLocationID=links_to_hits,
|
||||
MCParticleLocation=mc_unpackers()["MCParticles"],
|
||||
MCVerticesInput=mc_unpackers()["MCVertices"],
|
||||
).OutputLocation
|
||||
|
||||
# be more robust against imperfect data
|
||||
loose_forward_params = dict(
|
||||
MaxChi2PerDoF=16,
|
||||
MaxChi2XProjection=30,
|
||||
MaxChi2PerDoFFinal=8,
|
||||
MaxChi2Stereo=8,
|
||||
MaxChi2StereoAdd=8,
|
||||
)
|
||||
|
||||
forward_debug = PrForwardTrackingVelo(
|
||||
InputTracks=hlt1_tracks["Velo"]["Pr"],
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Velo"]["v1"],
|
||||
InputTrackLinks=links_to_velo_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
forward_ut_debug = PrForwardTracking(
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
InputTracks=hlt1_tracks["Upstream"]["Pr"],
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
DebugTool=PrMCDebugForwardTool(
|
||||
InputTracks=hlt1_tracks["Upstream"]["v1"],
|
||||
InputTrackLinks=links_to_upstream_tracks,
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
SciFiHitLinks=links_to_hits,
|
||||
SciFiHits=make_PrStoreSciFiHits_hits(),
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
),
|
||||
**loose_forward_params,
|
||||
)
|
||||
|
||||
loose_matching_params = dict(
|
||||
MaxMatchChi2=30.0,
|
||||
MaxDistX=500,
|
||||
MaxDistY=500,
|
||||
MaxDSlope=1.5,
|
||||
)
|
||||
|
||||
match_debug = PrMatchNN(
|
||||
VeloInput=hlt1_tracks["Velo"]["Pr"],
|
||||
SeedInput=seed_tracks["Pr"],
|
||||
MatchDebugToolName=PrMCDebugMatchToolNN(
|
||||
VeloTracks=hlt1_tracks["Velo"]["v1"],
|
||||
SeedTracks=seed_tracks["v1"],
|
||||
VeloTrackLinks=links_to_velo_tracks,
|
||||
SeedTrackLinks=links_to_seed_tracks,
|
||||
TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
|
||||
MCParticles=mc_unpackers()["MCParticles"],
|
||||
),
|
||||
AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
|
||||
**loose_matching_params,
|
||||
).MatchOutput
|
||||
|
||||
data = [forward_debug, forward_ut_debug, match_debug]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_debug)
|
168
moore_options/residual_get_resolution_and_eff_data.py
Normal file
168
moore_options/residual_get_resolution_and_eff_data.py
Normal file
@ -0,0 +1,168 @@
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
"""
|
||||
This set of options is used for reconstruction development purposes,
|
||||
and assumes that the input contains MCHits (i.e. is of `Exended`
|
||||
DST/digi type).
|
||||
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
|
||||
Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/residual_get_resolution_and_eff_data.py
|
||||
"""
|
||||
|
||||
from Moore import options, run_reconstruction
|
||||
|
||||
from Moore.config import Reconstruction
|
||||
from PyConf.Algorithms import PrKalmanFilter
|
||||
from PyConf.Tools import TrackMasterExtrapolator
|
||||
import glob
|
||||
|
||||
from RecoConf.mc_checking import (
|
||||
check_track_resolution,
|
||||
check_tracking_efficiency,
|
||||
get_mc_categories,
|
||||
get_hit_type_mask,
|
||||
make_links_lhcbids_mcparticles_tracking_system,
|
||||
make_links_tracks_mcparticles,
|
||||
)
|
||||
from RecoConf.core_algorithms import make_unique_id_generator
|
||||
from RecoConf.hlt2_tracking import make_res_hlt2_tracks
|
||||
from RecoConf.hlt1_tracking import (
|
||||
make_VeloClusterTrackingSIMD_hits,
|
||||
make_PrStorePrUTHits_hits,
|
||||
make_PrStoreSciFiHits_hits,
|
||||
get_global_materiallocator,
|
||||
)
|
||||
|
||||
# sample = "DstD0EE_MD"
|
||||
# sample = "Bd2KstEE_MD"
|
||||
# sample = "Bd2KstEE_MU"
|
||||
# sample = "Bs2JpsiPhi_MD"
|
||||
# sample = "Bs2JpsiPhi_MU"
|
||||
# sample = "Bs2PhiPhi_MD"
|
||||
# sample = "Bs2PhiPhi_MU"
|
||||
|
||||
|
||||
decay = "D"
|
||||
|
||||
|
||||
options.evt_max = -1
|
||||
|
||||
options.ntuple_file = (
|
||||
f"data/resolutions_and_effs_{decay}_with_electron_weights_as_residual.root"
|
||||
)
|
||||
options.input_type = "ROOT"
|
||||
|
||||
|
||||
if decay == "B":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
||||
elif decay == "D":
|
||||
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
||||
elif decay == "test":
|
||||
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
||||
|
||||
options.dddb_tag = "dddb-20210617"
|
||||
options.conddb_tag = "sim-20210617-vc-md100"
|
||||
options.simulation = True
|
||||
|
||||
|
||||
def run_tracking_resolution():
|
||||
tracks = make_res_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
||||
fitted_forward_tracks = PrKalmanFilter(
|
||||
Input=tracks["Forward"]["Pr"],
|
||||
MaxChi2=2.8,
|
||||
MaxChi2PreOutlierRemoval=20,
|
||||
HitsVP=make_VeloClusterTrackingSIMD_hits(),
|
||||
HitsUT=make_PrStorePrUTHits_hits(),
|
||||
HitsFT=make_PrStoreSciFiHits_hits(),
|
||||
ReferenceExtrapolator=TrackMasterExtrapolator(
|
||||
MaterialLocator=get_global_materiallocator(),
|
||||
),
|
||||
InputUniqueIDGenerator=make_unique_id_generator(),
|
||||
).OutputTracks
|
||||
|
||||
links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
|
||||
links_to_forward = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Forward"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_match = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Match"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_best = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["BestLong"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
links_to_seed = make_links_tracks_mcparticles(
|
||||
InputTracks=tracks["Seed"],
|
||||
LinksToLHCbIDs=links_to_lhcbids,
|
||||
)
|
||||
|
||||
res_checker_forward = check_track_resolution(
|
||||
tracks["Forward"],
|
||||
suffix="Forward",
|
||||
)
|
||||
res_checker_best_long = check_track_resolution(
|
||||
tracks["BestLong"],
|
||||
suffix="BestLong",
|
||||
)
|
||||
res_checker_best_forward = check_track_resolution(
|
||||
dict(v1=fitted_forward_tracks),
|
||||
suffix="BestForward",
|
||||
)
|
||||
res_checker_seed = check_track_resolution(
|
||||
tracks["Seed"],
|
||||
suffix="Seed",
|
||||
)
|
||||
|
||||
eff_checker_forward = check_tracking_efficiency(
|
||||
"Forward",
|
||||
tracks["Forward"],
|
||||
links_to_forward,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Forward"),
|
||||
get_hit_type_mask("Forward"),
|
||||
)
|
||||
eff_checker_match = check_tracking_efficiency(
|
||||
"Match",
|
||||
tracks["Match"],
|
||||
links_to_match,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Match"),
|
||||
get_hit_type_mask("Match"),
|
||||
)
|
||||
eff_checker_best_long = check_tracking_efficiency(
|
||||
"BestLong",
|
||||
tracks["BestLong"],
|
||||
links_to_best,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("BestLong"),
|
||||
get_hit_type_mask("BestLong"),
|
||||
)
|
||||
eff_checker_seed = check_tracking_efficiency(
|
||||
"Seed",
|
||||
tracks["Seed"],
|
||||
links_to_seed,
|
||||
links_to_lhcbids,
|
||||
get_mc_categories("Seed"),
|
||||
get_hit_type_mask("Seed"),
|
||||
)
|
||||
|
||||
data = [
|
||||
res_checker_forward,
|
||||
res_checker_best_long,
|
||||
res_checker_best_forward,
|
||||
res_checker_seed,
|
||||
eff_checker_forward,
|
||||
eff_checker_match,
|
||||
eff_checker_best_long,
|
||||
eff_checker_seed,
|
||||
]
|
||||
|
||||
return Reconstruction("run_tracking_debug", data)
|
||||
|
||||
|
||||
run_reconstruction(options, run_tracking_resolution)
|
48
neural_net_training/result/matching.hpp
Normal file
48
neural_net_training/result/matching.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{1.32643926918e-05, 1.20999777664e-06, 3.81469726562e-06, 1.52587890625e-05,
|
||||
2.20164656639e-06, 1.86264514923e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{14.9999952316, 0.436187297106,
|
||||
249.999572754, 399.485595703,
|
||||
1.30260443687, 0.148344695568}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{2.32568146034949, -3.97864517484141, -0.976136452226726, 1.84234344676559,
|
||||
-3.10046463102268, 4.13961872392198, 1.32395215581256},
|
||||
{-0.246260592363558, -16.6289365646957, 15.8745926520597, 5.54227150397204,
|
||||
-3.52013322130382, 3.54800430147538, 4.65963029843042},
|
||||
{-0.0480865527472585, -0.629210074395733, 6.00348546361291,
|
||||
2.9051880336304, -0.14352194426084, 1.69533803008533, 8.43612131346998},
|
||||
{0.586453583994425, -2.56124202576808, 2.59227690708752,
|
||||
0.0874243316906918, -2.97381765628525, 5.49796401976845,
|
||||
3.23192359468339},
|
||||
{0.429663439996412, -22.1383805768484, -0.392774946210208,
|
||||
-3.3393241414433, -0.0183236766918373, 1.7443084621404,
|
||||
-23.1241106528584},
|
||||
{1.51561003857451, -0.252437187813493, 3.4382652179148, 1.64873635165153,
|
||||
1.3257641118939, -1.3769915299618, 6.284788658685},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.26283446391613, 1.060406101318, 0.30016156694275, 0.868137090713936,
|
||||
0.620452727287864, 0.654572151525178, -1.93868171775984}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.756398914721592, 1.43176897679079, -1.9761225512629,
|
||||
-0.252826703054453, 5.76338466721064, 0.853447490406625, 1.63438201788813,
|
||||
-1.30124222851611, -1.16516476663684},
|
||||
{1.33354118308893, 2.2779204457711, -2.4183940976708, -1.41409141050929,
|
||||
-3.03014280476042, -0.105294409656274, -1.61531096417457,
|
||||
0.0713464687805576, -4.46730787742624},
|
||||
{1.69117951310622, 0.478803367417533, -0.0952992998738417,
|
||||
-1.42291620159966, -5.3475695755735, -0.851706256912453,
|
||||
-0.825543426908553, -1.84634786630319, 1.10300947885605},
|
||||
{1.62294844942986, -1.4305887420849, 1.34690035656602, -1.75196364787073,
|
||||
-1.34911857298729, -1.19784919878849, 1.61348068527877, -1.6413641883722,
|
||||
-1.80987544922642},
|
||||
{-0.885340378859963, -1.27010625003553, 1.64729145944323,
|
||||
-1.93179670311711, -2.00487598846412, 0.858689001379895,
|
||||
-0.848898627795279, 0.783837335125351, -1.50563595386066},
|
||||
{-0.643070342091735, -1.362074820856, 3.23003893144526, -1.8069989021131,
|
||||
-1.52168986931666, -2.92720177768097, -1.52203810494393, 1.54153084775635,
|
||||
4.02998353429178}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-1.03488783417574, 0.540010884713827, -1.17870273673375, 1.01943381348885,
|
||||
-0.679190259548567, 1.25798110915057, 2.3197360649145}};
|
46
neural_net_training/result_B/matching.hpp
Normal file
46
neural_net_training/result_B/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{1.37092808927e-06, 1.07555365503e-06, 0, 1.90734863281e-06,
|
||||
1.73929147422e-05, 1.86264514923e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{14.9999952316, 0.456682443619,
|
||||
249.999572754, 399.509643555,
|
||||
1.33115208149, 0.149789437652}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-1.3734781925797, 13.4202721220084, -5.84482699847354, 0.208720202271194,
|
||||
3.52940201568696, -5.35007508017961, 6.10232623582908},
|
||||
{0.269463828190076, 12.2029002280153, 6.20803317501961, -9.43442815316897,
|
||||
2.5338939027162, 5.99544654330182, 16.266514230858},
|
||||
{-0.165852817298963, -12.5570036498389, 19.5108101030614, 10.1445756810778,
|
||||
-4.70591905221782, -9.82613113151628, 2.66946232799658},
|
||||
{0.280264112609391, -40.4573608414915, 4.50829859766595, -9.38270110978156,
|
||||
2.13898954875748, 4.73797410702965, -38.2552994749474},
|
||||
{-15.3913555770922, 1.18454625888548, 1.03308239102009, 2.80096921737441,
|
||||
-1.86435943580432, -5.12259817922783, -14.7182721956392},
|
||||
{-0.473433045504226, 14.9901069695702, -0.236384720797966,
|
||||
-2.83841297397374, 4.98474416815065, -6.59501221410077, 6.97717117093051},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{0.142197307909266, 4.84602282950846, -9.65725300640334, 5.68314089024306,
|
||||
0.631054662487241, 0.766483060165155, 2.3260315163825}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{0.647996552227704, -3.612673407752, 0.218049700051821, 4.89119034256858,
|
||||
-0.00710530398728626, -0.739119819896367, 1.63438201788813,
|
||||
0.7192739388343, -4.39806909742125},
|
||||
{-0.719597437431301, -3.27873531826254, -2.03233412174408,
|
||||
-3.60079441122056, 0.0930923625129556, -2.47473692076248,
|
||||
-1.61531096417457, -1.73667807655155, 3.65065717704823},
|
||||
{2.15115292231327, 0.537266754158749, -0.529575619029901,
|
||||
-0.840914255611436, 1.02786405393109, -2.2383981589872,
|
||||
-0.825543426908553, -0.685116658617715, -1.95672133400954},
|
||||
{0.164139216021613, -0.378666175423714, -1.43567813416239,
|
||||
-1.86509513117207, -0.825083002191541, -1.70460785835385,
|
||||
1.61348068527877, -1.66550797875971, -0.956253568725315},
|
||||
{-1.87493924816154, -0.453672605669931, 0.283493943583684,
|
||||
0.878365550455799, 0.284631862858431, 0.933935190438462,
|
||||
-0.848898627795279, 0.121615867119966, 2.40557433526087},
|
||||
{0.853517633026983, -0.322377109742158, 0.30359642229039,
|
||||
-2.70050427549895, 0.434398564771274, -1.07531792256432,
|
||||
-1.52203810494393, 0.471135339353818, -7.51274733403613}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.773202850704438, 0.952227138510482, 0.74769506152075, 0.306824902699197,
|
||||
-0.557424643818581, 1.36609661342348, -1.24818793392955}};
|
48
neural_net_training/result_B_old/matching.hpp
Normal file
48
neural_net_training/result_B_old/matching.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{1.37092808927e-06, 1.07555365503e-06, 0, 1.90734863281e-06,
|
||||
1.73929147422e-05, 1.86264514923e-09}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{14.9999952316, 0.456682443619,
|
||||
249.999572754, 399.509643555,
|
||||
1.33115208149, 0.149789437652}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.55218535628556, -9.3289553119363, -3.16480805777192, 9.21929582222451,
|
||||
-5.84675321729571, 4.37995011218691, -2.12651852927708},
|
||||
{2.19402229437066, -36.4572143799157, 4.72612050852174, 0.871774263011679,
|
||||
0.308249736812244, 5.59902946146285, -21.3121523564936},
|
||||
{0.326882064023056, 2.35866196875568, 9.48783066071353, 2.75913715527822,
|
||||
-3.60778259684168, 2.80447887380193, 12.22677213297},
|
||||
{0.555959841347612, -11.3379921223552, 24.99514413087, 4.38044026679039,
|
||||
-4.79766508655656, -5.51874542469878, 8.39926399588362},
|
||||
{-0.474573814356478, -45.048645069346, -1.91571008337192,
|
||||
-2.97043145049536, -0.791922976045819, 2.80933052961339,
|
||||
-45.2686657256446},
|
||||
{1.02111090620048, 0.942295739720341, 4.23884295504771, 3.69611210680021,
|
||||
3.06108184531354, -5.59083664638509, 5.48212218750871},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.25219270646431, 0.549228434890616, 0.470255515433846, 0.916142200504342,
|
||||
1.60846971174291, 0.516066034145183, -1.99907858325808}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-2.16740050633671, 1.64201098704318, -1.81457731661729, 0.276267162453127,
|
||||
4.41723045721244, 0.116946763347361, 1.63438201788813, -1.34454525041306,
|
||||
-11.6363132267585},
|
||||
{-0.975733315897721, -0.74456197080548, 1.37299729852781,
|
||||
-0.935058973429512, 0.0844226992748141, -0.132452262552727,
|
||||
-1.61531096417457, -0.186263378023113, 5.02662780750337},
|
||||
{1.04696354000933, 0.278924511733321, -1.35925413801625, 0.938772342837744,
|
||||
-0.549530917541879, -0.520171806146222, -0.825543426908553,
|
||||
-2.06608637235381, -0.791984902945839},
|
||||
{-1.2045961477844, -0.991003979261367, 1.09783625990238,
|
||||
-0.421872249827208, -0.889785288418292, 2.04952712400642,
|
||||
1.61348068527877, -1.7061481912452, -4.6379237728574},
|
||||
{-1.36108475234833, -0.998277929718627, 1.44485269371602,
|
||||
-0.712692589749601, 2.24954768341439, 2.14013866962467,
|
||||
-0.848898627795279, 0.868380765164237, -2.78040856790563},
|
||||
{-0.388348743847599, -3.23828818784509, -3.09515929145523,
|
||||
-1.60979064312646, 2.55518501696684, -2.40442392560053, -1.52203810494393,
|
||||
1.61704406536505, 1.28981466057697}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.662286199846436, 0.602757344813461, -0.498657128878293,
|
||||
0.682053959836921, -0.846606195204036, 0.885206167679193,
|
||||
-0.091536072257332}};
|
49
neural_net_training/result_D/matching.hpp
Normal file
49
neural_net_training/result_D/matching.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{8.165359759e-06, 1.20664617498e-06, 3.0517578125e-05, 0, 4.7143548727e-06,
|
||||
5.58793544769e-09}};
|
||||
const auto fMax =
|
||||
std::array<simd::float_v, 6>{{14.9999341965, 0.441820472479, 249.991241455,
|
||||
399.657226562, 1.31253051758, 0.1461160779}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-2.69517659211572, 11.8302794023495, -4.18951579686807, -3.98494892798567,
|
||||
2.81897548445767, 0.59383239448013, 8.23409922740496},
|
||||
{0.211366021230384, -17.963369064596, 15.9757126175754, 7.06797978526591,
|
||||
-4.70452883659984, -6.9670945574808, -6.09966951812501},
|
||||
{-0.671572194549583, 11.3044506689324, 0.41567016443692, -1.37717944379749,
|
||||
4.32454960210643, -2.81417446537734, 9.27800394526066},
|
||||
{-0.0170007006326477, -29.3978844207289, 1.21375106319138,
|
||||
-4.08361109078602, 1.26964946956945, 2.36059581879151, -28.6616649803861},
|
||||
{-11.5040478504233, 0.787126057627091, -1.9688816880041, 3.80563620582515,
|
||||
-1.24505398457039, -4.63206817893295, -13.6204407803068},
|
||||
{-0.338909805576579, 5.40829054574145, -5.80255047095045,
|
||||
-4.01690019633219, 1.01720190260241, -8.00726918670078,
|
||||
-9.13220942993612},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{-0.0200186919403349, 1.41949954504535, 1.49019129872922,
|
||||
0.288411192617344, -1.04637027529446, 0.461207091311545,
|
||||
2.34712624673865}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.742932789484951, 1.098742538125, -0.406409364576387, 3.47055509094897,
|
||||
0.0962780863393642, 1.41748292133237, 1.63438201788813, -1.44301381179313,
|
||||
-0.572613401802679},
|
||||
{-0.38589120983735, 1.59861062444015, -0.0248567208616739,
|
||||
0.671741015980856, -0.708380620370054, -1.03895600322296,
|
||||
-1.61531096417457, -0.148523097987218, -4.64632456422582},
|
||||
{0.79166633002489, -1.08475628425482, -4.28859285488566, 1.52323344063281,
|
||||
0.841577416846386, -2.87987947235168, -0.825543426908553,
|
||||
-1.68433960913801, 3.44474663480542},
|
||||
{0.0775004589408732, -0.262461293729405, -1.52083397977799,
|
||||
-1.8717755745741, -0.836405509817299, -1.7218693116007, 1.61348068527877,
|
||||
-1.66550797875971, -0.970612266783855},
|
||||
{-0.173976577204694, 0.622518962366594, 1.06846030554012,
|
||||
-1.98774771637332, 0.519455930696643, 0.29715629978414,
|
||||
-0.848898627795279, -0.571811756436865, -0.634485828880002},
|
||||
{1.01806297385566, -2.23322855713652, -0.6087066354355, -2.48675705217909,
|
||||
3.17812971554116, 0.101672334443862, -1.52203810494393, 2.31992216900119,
|
||||
-1.25181073559493}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.916964821952665, 0.719312774569769, -0.639131582384414,
|
||||
0.543723763328418, -0.519810071051254, 0.818949275577508,
|
||||
-0.217502220186121}};
|
47
neural_net_training/result_D_old/matching.hpp
Normal file
47
neural_net_training/result_D_old/matching.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{3.08839298668e-06, 1.0285064036e-06, 1.52587890625e-05, 0,
|
||||
5.87664544582e-07, 1.16415321827e-10}};
|
||||
const auto fMax =
|
||||
std::array<simd::float_v, 6>{{14.9999723434, 0.448565632105, 249.991241455,
|
||||
399.657226562, 1.32571601868, 0.1461160779}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-13.6018653076529, 11.5780217700141, -7.92762809494091, -2.3767990231665,
|
||||
2.10509041357149, 8.93423542038951, 0.697736541430846},
|
||||
{1.39148569147387, -18.5749654585149, 16.332262515645, 8.93683318362009,
|
||||
-5.31296543840869, -5.3403427435078, -2.19396356951465},
|
||||
{-1.01323411158617, 13.2753123794943, 0.728991860392637, -2.42297786296918,
|
||||
5.31377513515812, -3.50060317341991, 10.417424252956},
|
||||
{-0.248243535822069, 4.62216903283789, 7.02215266119243, 1.16722623835237,
|
||||
-4.02343144066426, 0.795833957766165, 8.68951250524976},
|
||||
{-0.238717750484162, 6.4095254209171, -7.18004762765776, -5.26488261250603,
|
||||
0.399079753011244, -13.2043917021304, -15.6484370000787},
|
||||
{0.28927080766293, -43.0775712799999, 1.66954473021466, -9.33896425089968,
|
||||
2.33665742943925, 3.79800824384931, -44.3378970188981},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.40243557561751, 0.527362898119982, 0.45726589950568, 1.14682278333905,
|
||||
1.07970493015474, -0.120090795589863, -1.93859670804163}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.799170659507791, 0.78794128149515, -0.763826599227941,
|
||||
-2.3771947370175, 1.02090569194105, 2.93661596670106, 1.63438201788813,
|
||||
-1.4315640726598, -1.65256239855233},
|
||||
{-0.0840828763430264, 1.63030483445294, 0.480480602063334,
|
||||
-2.6196066367932, -1.07206902633681, 1.70077768270329, -1.61531096417457,
|
||||
0.0827459973313509, -6.82577663153282},
|
||||
{0.549379141222342, -1.30994855822444, -3.47047538273556,
|
||||
0.416631880451092, -2.01641324755852, 0.534999953845232,
|
||||
-0.825543426908553, -1.89592023892521, 5.51877157805828},
|
||||
{0.0804714249535426, -0.5308079142129, -1.48689873935011,
|
||||
-1.86763554052357, -0.869089360209786, -1.67763600182079,
|
||||
1.61348068527877, -1.66550797875971, -0.925481963732789},
|
||||
{-0.686375033428724, 1.09398610198181, 0.699349709460149,
|
||||
-1.04209787556848, 0.0477294646540392, -0.311194459626976,
|
||||
-0.848898627795279, 1.21798575421877, -1.20136465619996},
|
||||
{0.65672978185887, -2.41522086895727, -0.906588505776888, 1.17488116346046,
|
||||
0.348225140957002, -1.76790548692959, -1.52203810494393, 1.20010038210504,
|
||||
2.16681827421459}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.711664725241253, 0.506164178116774, -0.741743336419543,
|
||||
0.501270635463003, -0.672368683770616, 0.747306441658917,
|
||||
0.789949973283111}};
|
58
nn_electron_training/result/matching.hpp
Normal file
58
nn_electron_training/result/matching.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
const auto fMin = std::array<simd::float_v, 7>{
|
||||
{2.32376150961e-05, 1.20999845876e-06, 3.0517578125e-05, 0.000152587890625,
|
||||
5.18634915352e-05, 3.16649675369e-08, 4964.515625}};
|
||||
const auto fMax = std::array<simd::float_v, 7>{
|
||||
{29.999835968, 0.448848098516, 490.75402832, 499.918823242, 1.29696559906,
|
||||
0.148829773068, 5764.58056641}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
|
||||
{{-13.8767665400575, 4.05734115522388, -3.01709661856028, 1.12334316344471,
|
||||
-1.95431900429486, -4.28496976296461, 2.12003203912787,
|
||||
-16.3247309911133},
|
||||
{0.212048009453922, -15.1738107548058, 16.7279720978323, 7.86809247963017,
|
||||
-2.44754013164889, 7.7765844954342, -7.1858320802125, 14.8502047053221},
|
||||
{1.03697617644536, -7.74330829725443, 6.56587047894099, 17.8488797860709,
|
||||
-6.58256061835055, -14.3326703613101, -4.21591741028686,
|
||||
-3.48521822531376},
|
||||
{1.07161857075862, -6.02457375820184, -2.95388380942296, -1.32423877366328,
|
||||
4.40729929976243, 4.47413261680277, -9.1510537721088, -3.00961301024585},
|
||||
{-0.483652311202822, 1.61937809966064, 3.0445519571216, 0.815891204469984,
|
||||
0.474869080905695, 3.43775266744451, -1.25098304071557, 7.12769003125851},
|
||||
{-8.4010714790805, 8.31810836442086, -3.26991947652379, 1.31844760189238,
|
||||
-0.316007929405036, -0.703746325371237, 4.74898967505285,
|
||||
-1.11739245753407},
|
||||
{-0.592761413330552, 4.04188612003611, -0.218806073885883,
|
||||
3.90563951642846, 7.09174466959683, -6.3569150742699, -5.14953269394216,
|
||||
2.75424697228316},
|
||||
{0.547164481580195, 1.70249203967427, 1.94714702524239, -13.7351709164445,
|
||||
1.80504850488469, -2.90102696607898, 0.572900917600169, -10.365898528612},
|
||||
{-1.41297642979771, 1.7421562904492, 1.51246974803507, -0.277205719612539,
|
||||
-0.746303261257708, 1.31841345876455, -0.315569517202675,
|
||||
-1.43151946831495}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
|
||||
{{-2.70914120357355, 0.519189852188428, 1.64293953499867, -1.42908155115225,
|
||||
-0.911252443482285, -3.62723599571144, -3.12039388485614,
|
||||
-2.24012508264097, -1.80018616467714, -0.387269363887802},
|
||||
{0.825289573993859, 0.977559873140871, -1.19932065232476,
|
||||
0.448270358180695, -1.01118687034592, -0.12068624133809, 1.92125679147867,
|
||||
-1.22870635454816, 1.06194042880088, -1.67985680933482},
|
||||
{0.117628014226149, -0.666150093594241, -1.96462719830508,
|
||||
-1.34621345717382, 2.69897179096947, 1.45683981784585, -0.280779666268364,
|
||||
-1.09056907866035, 0.143585634417832, -0.853077107436903},
|
||||
{0.343557768966074, -1.36884597467765, -0.978489408664556,
|
||||
1.04108942352196, 2.38422271469634, -1.42280162989848, -1.24692906453324,
|
||||
1.16005819097626, -1.81861709989607, 0.792826064358476},
|
||||
{-2.43543923840386, -0.790741678609659, -0.86057585327147,
|
||||
-0.560696061368329, -0.546486276970939, -1.10828693920102,
|
||||
-0.390844170382116, -0.191292459405275, 0.655178595334291,
|
||||
3.62562636803186},
|
||||
{-1.85600205994161, -0.851713021005162, -2.36960755021907,
|
||||
-2.65847940214873, 4.19992558926354, 0.482968294979867,
|
||||
-0.674617611858262, 0.537074281854966, -1.44013551902026,
|
||||
0.12897906197469},
|
||||
{3.05467659680961, -0.835919265923888, -1.97139370203255,
|
||||
-0.833191777667285, 3.1259995582494, 1.3049178372323, -0.601501165563516,
|
||||
-0.476449568704171, 0.0595564302057028, 1.86826919022162}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
|
||||
{-0.742315179835233, -0.384238828861699, -0.639019653069106,
|
||||
-0.469522590533314, 0.812934812918375, -0.548705434492968,
|
||||
1.10784727825793, -1.47828921845706}};
|
46
nn_electron_training/result_B_old/matching.hpp
Normal file
46
nn_electron_training/result_B_old/matching.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{2.32376150961e-05, 1.51249741975e-06, 3.0517578125e-05, 4.57763671875e-05,
|
||||
1.30217522383e-05, 9.31322574615e-10}};
|
||||
const auto fMax =
|
||||
std::array<simd::float_v, 6>{{29.9999866486, 0.402866601944, 497.675262451,
|
||||
499.88583374, 1.35172855854, 0.1488314569}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-0.716890254960393, 5.8069257184991, -1.74563699770656, -1.69375462311209,
|
||||
0.292600378995007, 4.27627333971203, 5.05829948252536},
|
||||
{1.39109753193721, -6.17525389654849, 7.57671398067678, -5.43048780303785,
|
||||
-1.09791116843721, 1.86130825538439, -3.82867359027486},
|
||||
{-0.463070234910456, -4.56547441068759, 5.40748303002796, 24.3147882327414,
|
||||
-6.31462696612228, -15.7641466083901, 3.16004633819498},
|
||||
{0.153443312046544, -13.7240931193717, 12.4658109156892, 3.93975979118258,
|
||||
-6.11948248810469, 12.0087465863604, 11.8434487900601},
|
||||
{-5.38333972443605, 7.08960513470396, -14.0225023836695, 1.62191385618879,
|
||||
-3.70995234249952, -6.21018449120275, -16.3820927289576},
|
||||
{1.28910616897801, 11.7392825108682, -0.745172957676181, -2.71535399916244,
|
||||
2.69193347520725, -7.76807154851574, 3.33706974699574},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.69376603852368, 0.713685235953229, 0.537330926797311, 1.24885881426728,
|
||||
0.849445456302149, 0.0549823762550653, -1.60838065333664}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-3.49743269512971, -1.59190099226759, 2.68952831238107, 1.47409713154181,
|
||||
-0.358823304868459, 1.51035818148923, 1.63438201788813, -1.37184378061365,
|
||||
-4.8236951156242},
|
||||
{-1.62443558899203, 0.637337506470021, -1.81394608796523,
|
||||
-0.39782822266736, 2.98247880411195, -3.00550692859844, -1.61531096417457,
|
||||
0.0991975320503116, -7.79260298177481},
|
||||
{2.63673645224951, 0.769840121669036, -1.81866900675112, -1.22134862739373,
|
||||
0.671174013434412, -1.47933584039013, -0.825543426908553,
|
||||
-1.92253219419135, 3.8017813083906},
|
||||
{0.205195965291138, -0.35698019904733, -1.43178372298118,
|
||||
-1.86979559465315, -0.819043768918633, -1.72129504552091,
|
||||
1.61348068527877, -1.66550797875971, -0.957274797031432},
|
||||
{3.39235161127949, 0.557496083138389, 0.358810791879255, -1.30084105984251,
|
||||
-0.542916984939091, -0.0267147558240502, -0.848898627795279,
|
||||
0.771556793635358, 0.0697782536980876},
|
||||
{0.481340186388348, 0.112198736662793, 2.17905577117167,
|
||||
-0.602783430688711, -0.0915323075405589, 0.497824854127751,
|
||||
-1.52203810494393, 1.50364257368639, -0.374485200843083}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.768478620967589, 0.945551538481868, 0.96174226855089, 0.370062157422418,
|
||||
-0.78327662856066, 0.822576347537717, -0.718860728264376}};
|
47
nn_electron_training/result_B_res/matching.hpp
Normal file
47
nn_electron_training/result_B_res/matching.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{0.354097932577, 5.52064511794e-06, 0.000244140625, 8.39233398438e-05,
|
||||
6.46021217108e-05, 3.98140400648e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9984798431, 0.343307316303,
|
||||
487.684082031, 497.415130615,
|
||||
1.28809189796, 0.148829773068}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.528613355828958, -3.98084730501778, -0.592082531501982,
|
||||
0.138947239841158, -0.778623431382993, -0.581951852087617,
|
||||
-3.3077751082926},
|
||||
{0.626191010935061, -6.59632782328807, 9.64286730275841, 9.55716888102903,
|
||||
-4.21769290858214, -0.877735461418827, 7.66427785912706},
|
||||
{0.589042763591211, 0.342730710819044, 2.15591537442552, 3.00613486546159,
|
||||
0.031406906405544, 0.245821626313224, 4.14102878259858},
|
||||
{0.331983030850774, 0.936730026632873, 5.0246621889186, -8.55182143000926,
|
||||
-1.36911477615904, -0.62033806094376, -4.12767358459756},
|
||||
{-1.83087334545531, 1.70659514344126, 1.64680904436349, -3.69383485282499,
|
||||
-1.60992615163927, -1.33158200933679, -3.68738551321132},
|
||||
{0.497605072926462, 3.10686068573917, -3.38889852931357, -2.83744183592321,
|
||||
5.8582848269084, -5.8114650940735, -2.19632367553395},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{2.34124335963039, 0.212194857163335, 0.442598967492635, 1.99142561696414,
|
||||
0.932043520652152, 0.0950084159057334, -0.343964005014347}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-3.9980933021236, -0.654530522369937, 1.38643691032487, 0.846962243830957,
|
||||
0.106764765445591, 0.432714049442539, 1.63438201788813, -1.09500118769163,
|
||||
-0.477330937420509},
|
||||
{-1.00177046130397, 0.910392283082755, -1.10524270003512,
|
||||
-0.863367119958066, 0.356000819965252, -1.36464636332376,
|
||||
-1.61531096417457, -1.07499530514837, 2.02772049025211},
|
||||
{1.06312654536343, 1.19247984844137, -2.56993344812772, -1.59660765668362,
|
||||
-1.43473393145022, -2.45597801241373, -0.825543426908553,
|
||||
-1.66068434492917, 1.54276462560785},
|
||||
{1.81681515757912, -1.04949680940877, -1.47464408054066, -2.35655553716087,
|
||||
-0.81674566968838, -2.03350840389647, 1.61348068527877, -1.66550797875971,
|
||||
-2.15831244577917},
|
||||
{-1.03932528137019, 1.40966162144001, -1.28446720148786, -1.3440214301115,
|
||||
-0.764149070532308, -0.346882028973845, -0.848898627795279,
|
||||
2.00051119462677, 3.35327375607444},
|
||||
{-1.86664223320468, -2.77494106516727, 0.280364440162091,
|
||||
-0.51153329496928, 0.099515543403597, -0.231471190430381,
|
||||
-1.52203810494393, 1.14272217943492, 0.830204232719646}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.707654910623957, 0.947610371696967, -0.734533082005471,
|
||||
2.92853232573231, -0.764897377620809, 2.76504552610281, 2.01235259703278}};
|
47
nn_electron_training/result_D_res/matching.hpp
Normal file
47
nn_electron_training/result_D_res/matching.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{0.257591664791, 1.18096104416e-05, 0.000593185424805, 0.00165557861328,
|
||||
0.00012809690088, 4.9639493227e-07}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.9983310699, 0.346089184284,
|
||||
494.445037842, 497.105712891,
|
||||
1.28034591675, 0.146788269281}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.238406879601667, -5.59592601269328, -1.48529518782053,
|
||||
-1.21815009023291, 1.34269102160607, 1.34969291565497, -4.51875687730105},
|
||||
{0.396886922398879, -1.55290356333354, 9.68785078213303, 8.92661791228501,
|
||||
-4.14921556686506, -4.79373464075343, 8.51558304693096},
|
||||
{-0.605978331887513, -2.01049013335995, 2.42576702923552, 1.52363979902223,
|
||||
-0.98764665307072, 5.47124537232274, 6.44617285846946},
|
||||
{0.194697743583909, 1.28944295625644, 7.01265960466827, -8.8098678043251,
|
||||
-1.29787641608371, -1.01125992648077, -2.62580313202802},
|
||||
{-0.149097384185005, 0.601644139549549, -3.20384472073729,
|
||||
-1.11764357962076, 0.661266078420317, -2.99007258105897,
|
||||
-4.75089443675904},
|
||||
{-0.0637125691675382, -0.031901246578545, -5.86825160360429,
|
||||
-6.08669255423129, 6.57894839440667, 1.56562582414305, -2.45567329718821},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{2.16691834156097, 1.28877310398459, -0.0182036429219536, 1.64574682748412,
|
||||
-1.776462177169, 1.02789865613476, -1.86072790490082}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-4.86220133984369, 0.118835729154668, -0.219969977992415,
|
||||
0.391324848601455, -1.52700917088122, 1.34069581551041, 1.63438201788813,
|
||||
-1.46686286855675, 0.828587551619351},
|
||||
{-2.34704356917816, 1.32098559104381, -0.35321222806336, -2.37018474851075,
|
||||
-0.428177327276122, -0.598193543229222, -1.61531096417457,
|
||||
0.788200423431897, 1.42375444061969},
|
||||
{-0.520599794082693, 1.88897717167843, -0.983200551417999,
|
||||
-2.10145861332195, 2.58359759649054, -1.9520611743449, -0.825543426908553,
|
||||
-2.21273436389439, 1.68368588984848},
|
||||
{0.687372876118682, -0.350871511760717, -1.43005506081713,
|
||||
-1.86332872620019, -0.805133918174304, -1.70605683547268,
|
||||
1.61348068527877, -1.66550797875971, -0.80539832878319},
|
||||
{0.641334100110318, 0.829686404507413, 1.12377545166463, -1.2786548533532,
|
||||
-2.2652307380297, -0.577326144935801, -0.848898627795279,
|
||||
-0.112416063323718, 3.09322414387249},
|
||||
{-2.10459256659739, -2.04968111694632, 0.989486352894292,
|
||||
-1.53078668929007, -0.90726448865931, 0.837532331802425,
|
||||
-1.52203810494393, 2.96223264118436, -2.25826102849139}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.632200441072234, 1.49561211302111, -1.13710464066982, 0.45277221100554,
|
||||
-0.690200710879259, 0.878498633554998, 2.07286062799155}};
|
48
nn_electron_training/result_electron_weights/matching.hpp
Normal file
48
nn_electron_training/result_electron_weights/matching.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{
|
||||
{2.32376150961e-05, 1.20999845876e-06, 3.0517578125e-05, 0.000152587890625,
|
||||
5.18634915352e-05, 3.16649675369e-08}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{{29.999835968, 0.448848098516,
|
||||
490.75402832, 499.918823242,
|
||||
1.29696559906, 0.148829773068}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{0.972643778287334, 0.945437530240695, -1.40069143935294,
|
||||
-15.6034120045671, 1.14493675557278, 6.76331107008671, -6.58864627844693},
|
||||
{1.99177578845469, -13.3678019612632, 8.38118795560118, 1.73988710441318,
|
||||
-4.61454323644065, 5.29554800958296, 1.796743670204},
|
||||
{0.154471209290507, -6.25196675947653, 5.03239643950246, 17.3659761341648,
|
||||
-6.54695139344376, -13.0321058473978, -2.79459536100855},
|
||||
{-1.91255962568079, -8.6500289238652, 11.3312847667967, 13.5402314908838,
|
||||
-2.61341614761575, 6.63476937311634, 18.5047027165893},
|
||||
{-13.4902851128642, 5.03927112314943, -7.35289370328568,
|
||||
0.0572131890099181, -1.6142848069816, -3.07255458814266,
|
||||
-18.9635216594601},
|
||||
{1.88222476973218, 6.53087839421258, 2.08080853139342, 0.816872513930955,
|
||||
1.76981234909237, -8.6501994076645, 3.81699174241397},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
|
||||
0.681870030239224, -1.20759406685829, 0.769290467724204,
|
||||
-1.8437808630988},
|
||||
{1.96787188749046, 0.680940366397391, 0.050263650384077, 1.68306844400001,
|
||||
1.12938262301514, 0.122157098634831, -0.887283402159991}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-2.73702380879827, 1.22468365009789, 2.40149928694528, 0.276654711632341,
|
||||
-0.947460759127638, -0.94795299724562, 1.63438201788813,
|
||||
-1.41515589667229, -0.708508928627869},
|
||||
{-0.408168817589508, -0.542699435360695, -0.336829708223667,
|
||||
-0.507220427829013, 0.533181686353704, -0.0512849135791123,
|
||||
-1.61531096417457, 0.0991539876010671, 4.00684418941464},
|
||||
{0.401110123287066, -0.82501422982477, -0.82214087163611,
|
||||
-2.13310745114762, 0.656608219190029, -1.54611499475089,
|
||||
-0.825543426908553, -1.92246825444023, -2.49920928064247},
|
||||
{0.743417630960188, -2.54297207137451, 0.868639896626588, 1.21759484724959,
|
||||
-0.432278512319556, -0.682439011110067, 1.61348068527877,
|
||||
-1.70813842427554, 0.191141321065651},
|
||||
{0.601790057732671, -2.70865568575877, -0.949516903771233,
|
||||
1.41807664967738, 0.0135866328882364, 1.63463920593405,
|
||||
-0.848898627795279, 0.794266404867267, -4.68030461730642},
|
||||
{-0.894524549453373, -0.413420422791491, -1.27841462173856,
|
||||
-0.921761527738667, 1.7613032977725, -1.20901458126865, -1.52203810494393,
|
||||
1.63899587513312, 3.18360564985773}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
|
||||
{-0.468166794846483, 0.905418443044577, 0.345720533590786,
|
||||
0.626519340549303, -0.564753919345451, 0.871170117133406,
|
||||
-2.29725166588317}};
|
62
nn_electron_training/result_new_var_dtxy/matching.hpp
Normal file
62
nn_electron_training/result_new_var_dtxy/matching.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
const auto fMin = std::array<simd::float_v, 7>{
|
||||
{2.32376150961e-05, 1.20999845876e-06, 3.0517578125e-05, 0.000152587890625,
|
||||
5.18634915352e-05, 3.16649675369e-08, 1.63267832249e-05}};
|
||||
const auto fMax = std::array<simd::float_v, 7>{
|
||||
{29.999835968, 0.448848098516, 490.75402832, 499.918823242, 1.29696559906,
|
||||
0.148829773068, 1.406919837}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
|
||||
{{-15.5425486721894, 4.46064219760936, -2.34623364306547, 0.673061906567754,
|
||||
-0.869156572627564, -3.91456514808376, -0.568696256770434,
|
||||
-16.6632172224501},
|
||||
{0.447767212299748, -12.0732988541946, 13.5397418382974, 6.88739679435815,
|
||||
-6.24126921111681, 10.2657097797903, 2.43233624582838, 16.3044055554715},
|
||||
{0.711332752822416, -7.17479141259481, 6.60735241080743, 17.1002661287198,
|
||||
-5.66447497808782, -13.5847364290022, -3.2812531600052,
|
||||
-4.16110866444881},
|
||||
{0.632252449853337, -0.994201889160893, 0.163028638247136,
|
||||
0.771845371822938, 1.96713990468425, 3.63340983309008, -1.20631209983256,
|
||||
-0.448420201049805},
|
||||
{-0.841164977118048, 9.93038462960693, 2.29748287289709,
|
||||
-0.0626255430240932, 3.26040532046237, -3.3032557034584,
|
||||
0.549324748173291, 8.63089145494412},
|
||||
{-4.64294924610689, -1.03961735354666, -5.94838304383518,
|
||||
-5.14494916413428, 0.865768755325211, 3.17305862226336, -0.17689672644592,
|
||||
-11.1702998443119},
|
||||
{-0.75257412651179, 7.45653016330318, 1.53531423087191, -0.944661904110734,
|
||||
2.27175825244693, 0.625586633690943, 0.556680865915938, 8.70515377733531},
|
||||
{1.48517605340595, -1.10139488332919, -1.20437312666678, -15.7567359489487,
|
||||
0.564551471160599, 0.343355103916556, 0.956188296533458,
|
||||
-14.4810699542064},
|
||||
{-1.41297642979771, 1.7421562904492, 1.51246974803507, -0.277205719612539,
|
||||
-0.746303261257708, 1.31841345876455, -0.315569517202675,
|
||||
-1.43151946831495}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
|
||||
{{0.249095596049212, 0.43896816611743, 2.51443611518656, -1.99550475508056,
|
||||
-3.01891555380374, -1.5384309247739, -1.10809432820241, -2.23884147411375,
|
||||
-1.80018616467714, 0.0926501061367807},
|
||||
{-0.79810107527313, -0.128565504120936, -1.47898746860618,
|
||||
-1.98749268865462, -4.1729473774923, -0.319376625137038, 2.68241976233123,
|
||||
-1.2438721745196, 1.06194042880088, -1.11115934197209},
|
||||
{-0.541616972751047, -0.883639706603654, -1.21647636736428,
|
||||
2.00429851976991, -0.333604676335978, -1.30666235698471,
|
||||
0.300409853048531, 1.71280717271126, 0.143585634417832,
|
||||
0.862440249952535},
|
||||
{-0.0738827412712401, 0.710660017309775, -1.81469923323104,
|
||||
-2.0032894120881, 0.0757757984176355, 0.946471866500602,
|
||||
-0.862679340246423, -0.336329345694109, -1.81861709989607,
|
||||
-1.65647777258377},
|
||||
{-2.46837296738587, -0.892461394707053, -0.164670653708065,
|
||||
-1.40986988591441, -1.29634197190675, -0.103818171050218,
|
||||
1.62473520412615, -0.10368342877725, 0.655178595334291, 3.10987357888943},
|
||||
{-3.51942943078094, 0.05403637176598, -0.112974678381018,
|
||||
-0.992599640919349, 2.32462754890465, 0.0152632384089371,
|
||||
-1.55107042088954, -2.78524739346744, -1.44013551902026,
|
||||
-0.069348300182213},
|
||||
{3.50273770909445, -0.563785026359985, -0.682273837786807,
|
||||
0.00116206143253937, 0.0443816144597161, 0.571844608360393,
|
||||
-1.17322063876001, -1.09420727621842, 0.0595564302057028,
|
||||
0.887055205865514}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
|
||||
{-0.527095695381938, 0.873978759522188, -0.505869602713493,
|
||||
-0.458736757125275, 1.00063852384923, -0.651233083081496, 1.09109419846381,
|
||||
-1.55585886153223}};
|
63
nn_electron_training/result_new_variable_dqop/matching.hpp
Normal file
63
nn_electron_training/result_new_variable_dqop/matching.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
const auto fMin = std::array<simd::float_v, 7>{
|
||||
{2.32376150961e-05, 1.20999845876e-06, 3.0517578125e-05, 0.000152587890625,
|
||||
5.18634915352e-05, 3.16649675369e-08, 2.91038304567e-11}};
|
||||
const auto fMax = std::array<simd::float_v, 7>{
|
||||
{29.999835968, 0.448848098516, 490.75402832, 499.918823242, 1.29696559906,
|
||||
0.148829773068, 0.000133186404128}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
|
||||
{{-1.92788180969447, 4.16064785412784, -2.11335551271703, 7.9294095607534,
|
||||
2.18170560740568, -8.44761548627774, -21.5047552584798,
|
||||
-16.0650884865238},
|
||||
{-1.61376550856811, -18.3767723062232, 6.29188806075221, 17.1629698975724,
|
||||
-4.06178649035417, 8.91994724771869, 0.945309347327087, 10.2364214261801},
|
||||
{0.260725207756956, -7.39063316113963, 5.85798680146154, 20.895198655668,
|
||||
-5.37769824548582, -14.2293948664243, 0.995342070597369,
|
||||
1.20800372506884},
|
||||
{0.953241806012774, 2.47323765132763, 2.08443843097691, -1.43196935568204,
|
||||
4.74700613459522, 0.189179081361804, -16.9045615453658,
|
||||
-6.43026395704888},
|
||||
{-1.92981663032188, -0.37230565268653, 0.814369803792726, 1.73699189907859,
|
||||
1.11733301402944, 1.46887116928329, 1.49186452419427, -1.29918641902703},
|
||||
{-16.8338849958765, 6.56643273179019, -3.48428147705122, 0.326903745037315,
|
||||
-2.06105265356339, -4.41540617406857, 5.02090403276349,
|
||||
-13.5579467656888},
|
||||
{-2.06856046873756, 1.37857017711159, -10.4255727807086, 5.40802232507597,
|
||||
6.86445294409404, 5.35440411482745, -6.85993978444102,
|
||||
-0.729076014469736},
|
||||
{-0.526653874830334, 8.98715315712336, -2.34742788084526,
|
||||
-1.27417058696474, 5.55759129208842, -3.2700796957674, -0.831113531084397,
|
||||
2.18499951551135},
|
||||
{-1.41297642979771, 1.7421562904492, 1.51246974803507, -0.277205719612539,
|
||||
-0.746303261257708, 1.31841345876455, -0.315569517202675,
|
||||
-1.43151946831495}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
|
||||
{{0.0324469931195793, -0.288230539372084, 1.64983047434275,
|
||||
-1.24756371282518, -1.94639586807131, -0.310928305245747,
|
||||
-4.99162520915551, 0.264942892832968, -1.80018616467714,
|
||||
2.77914512003005},
|
||||
{-0.0148602437129058, -1.2132748075938, -0.218359722842231,
|
||||
-0.633592266259126, -1.66464499515867, -2.55247320011507,
|
||||
0.942074824320476, -1.41987137293765, 1.06194042880088, 3.89059634854256},
|
||||
{-0.0974156676281787, 1.4515472939941, 1.12169407748122, 0.1569833587188,
|
||||
0.715433387778868, -2.40068948213013, -1.20271162851859, 1.58722622760245,
|
||||
0.143585634417832, -0.958611632301647},
|
||||
{-0.535241107505903, -0.222101479961216, -1.72874348280829,
|
||||
-1.09357655226657, 1.67832177468419, -1.85229898078416,
|
||||
-0.879756942942339, 0.0297380421842839, -1.81861709989607,
|
||||
-0.271711324852575},
|
||||
{-2.12445796868783, -0.913233265968283, -0.338898758417067,
|
||||
-1.65257155394075, -1.15348755568266, -0.571688294860023,
|
||||
-0.590397833605982, -0.152323738308279, 0.655178595334291,
|
||||
-6.84207556062884e-06},
|
||||
{-1.95868900053493, -0.605205894790946, -1.36009261632635,
|
||||
-2.34452772551367, 1.60461574133745, -0.00209217938454121,
|
||||
0.145219515490194, -3.24026630749251, -1.44013551902026,
|
||||
10.2107763198695},
|
||||
{0.384756246095988, -0.392456215033468, -2.59979095776574,
|
||||
-1.14968086393069, -0.936541749845882, 4.08852696879947,
|
||||
-0.0319867516820682, -1.98678786024887, 0.0595564302057028,
|
||||
3.2850148235822}}};
|
||||
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
|
||||
{-0.975457561894625, 0.722739660815715, -0.35623550622024, 1.13391106903613,
|
||||
0.663374242757088, -0.893283186205502, 0.795604576331046,
|
||||
-1.33372154704332}};
|
17
nn_trackinglosses_training/result/matching.hpp
Normal file
17
nn_trackinglosses_training/result/matching.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
const auto ResfMin = std::array<simd::float_v, 6>{
|
||||
{1.20620707094e-05, 2.0063980628e-06, 8.45295653562e-05, 0.000119162104966,
|
||||
4.75468114018e-05, 4.38088898491e-09}};
|
||||
const auto ResfMax =
|
||||
std::array<simd::float_v, 6>{{29.999212265, 0.29415422678, 486.515930176,
|
||||
499.948669434, 1.293815732, 0.145083397627}};
|
||||
const auto ResfWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan},
|
||||
{nan, nan, nan, nan, nan, nan, nan}}};
|
||||
const auto ResfWeightMatrix1to2 = std::array<simd::float_v, 9>{
|
||||
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan}};
|
268
outputs_nn/output_B.txt
Normal file
268
outputs_nn/output_B.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 187767 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 14040318 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=100000.0:nTrain_Background=200000.0:nTest_Signal=10000.0:nTest_Background=20000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "100000" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "10000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "200000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "20000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 100000
|
||||
: Signal -- testing events : 10000
|
||||
: Signal -- training and testing events: 110000
|
||||
: Background -- training events : 200000
|
||||
: Background -- testing events : 20000
|
||||
: Background -- training and testing events: 220000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.094 +0.508 +0.558 +0.393 +0.145
|
||||
: teta2: -0.094 +1.000 -0.010 +0.345 -0.010 +0.388
|
||||
: distX: +0.508 -0.010 +1.000 +0.202 +0.501 +0.230
|
||||
: distY: +0.558 +0.345 +0.202 +1.000 +0.507 +0.472
|
||||
: dSlope: +0.393 -0.010 +0.501 +0.507 +1.000 +0.497
|
||||
: dSlopeY: +0.145 +0.388 +0.230 +0.472 +0.497 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 +0.008 +0.363 +0.312 -0.001 +0.102
|
||||
: teta2: +0.008 +1.000 +0.217 +0.626 +0.297 +0.493
|
||||
: distX: +0.363 +0.217 +1.000 +0.062 +0.631 +0.203
|
||||
: distY: +0.312 +0.626 +0.062 +1.000 +0.250 +0.543
|
||||
: dSlope: -0.001 +0.297 +0.631 +0.250 +1.000 +0.361
|
||||
: dSlopeY: +0.102 +0.493 +0.203 +0.543 +0.361 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 8.4293 9.2426 [ 2.3238e-05 30.000 ]
|
||||
: teta2: 0.0057581 0.014094 [ 1.5125e-06 0.40287 ]
|
||||
: distX: 40.107 55.141 [ 3.0518e-05 497.68 ]
|
||||
: distY: 26.294 37.024 [ 4.5776e-05 499.89 ]
|
||||
: dSlope: 0.33133 0.23520 [ 1.3022e-05 1.3517 ]
|
||||
: dSlopeY: 0.0054522 0.0092106 [ 9.3132e-10 0.14883 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 5.690e-01
|
||||
: 2 : distX : 3.736e-01
|
||||
: 3 : distY : 2.091e-01
|
||||
: 4 : dSlopeY : 8.232e-02
|
||||
: 5 : dSlope : 8.601e-03
|
||||
: 6 : teta2 : 3.474e-03
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.43805 0.61618 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.97142 0.069969 [ -1.0000 1.0000 ]
|
||||
: distX: -0.83882 0.22159 [ -1.0000 1.0000 ]
|
||||
: distY: -0.89480 0.14813 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.50978 0.34801 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.92673 0.12377 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 300000 events: [1;31m853 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (300000 events)
|
||||
: Elapsed time for evaluation of 300000 events: [1;31m0.495 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 5.213e+02
|
||||
: 2 : teta2 : 4.435e+02
|
||||
: 3 : dSlopeY : 4.414e+02
|
||||
: 4 : distX : 3.118e+02
|
||||
: 5 : dSlope : 2.646e+01
|
||||
: 6 : chi2 : 7.066e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (30000 events)
|
||||
: Elapsed time for evaluation of 30000 events: [1;31m0.0597 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.29449 0.63524 [ -0.99999 0.99994 ]
|
||||
: teta2: -0.97212 0.070073 [ -1.0000 0.32779 ]
|
||||
: distX: -0.80346 0.24082 [ -1.0000 0.97553 ]
|
||||
: distY: -0.87751 0.16136 [ -1.0000 0.95680 ]
|
||||
: dSlope: -0.50293 0.35312 [ -0.99999 0.86422 ]
|
||||
: dSlopeY: -0.91903 0.13042 [ -1.0000 0.95486 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.29449 0.63524 [ -0.99999 0.99994 ]
|
||||
: teta2: -0.97212 0.070073 [ -1.0000 0.32779 ]
|
||||
: distX: -0.80346 0.24082 [ -1.0000 0.97553 ]
|
||||
: distY: -0.87751 0.16136 [ -1.0000 0.95680 ]
|
||||
: dSlope: -0.50293 0.35312 [ -0.99999 0.86422 ]
|
||||
: dSlopeY: -0.91903 0.13042 [ -1.0000 0.95486 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.958
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.450 (0.414) 0.886 (0.882) 0.980 (0.979)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 30000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 300000 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
268
outputs_nn/output_B_res.txt
Normal file
268
outputs_nn/output_B_res.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 7718 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 11895204 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=0:nTrain_Background=20000.0:nTest_Signal=1000.0:nTest_Background=5000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "0" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "1000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "20000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "5000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 6718
|
||||
: Signal -- testing events : 1000
|
||||
: Signal -- training and testing events: 7718
|
||||
: Background -- training events : 20000
|
||||
: Background -- testing events : 5000
|
||||
: Background -- training and testing events: 25000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.083 +0.248 +0.242 +0.206 +0.042
|
||||
: teta2: -0.083 +1.000 +0.038 +0.508 +0.191 +0.637
|
||||
: distX: +0.248 +0.038 +1.000 -0.175 +0.681 +0.107
|
||||
: distY: +0.242 +0.508 -0.175 +1.000 +0.349 +0.484
|
||||
: dSlope: +0.206 +0.191 +0.681 +0.349 +1.000 +0.349
|
||||
: dSlopeY: +0.042 +0.637 +0.107 +0.484 +0.349 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.024 +0.242 +0.209 +0.046 +0.055
|
||||
: teta2: -0.024 +1.000 +0.245 +0.652 +0.371 +0.483
|
||||
: distX: +0.242 +0.245 +1.000 +0.017 +0.776 +0.198
|
||||
: distY: +0.209 +0.652 +0.017 +1.000 +0.312 +0.554
|
||||
: dSlope: +0.046 +0.371 +0.776 +0.312 +1.000 +0.392
|
||||
: dSlopeY: +0.055 +0.483 +0.198 +0.554 +0.392 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 14.879 7.6783 [ 0.35410 29.998 ]
|
||||
: teta2: 0.0053594 0.015677 [ 5.5206e-06 0.34331 ]
|
||||
: distX: 74.975 63.347 [ 0.00024414 487.68 ]
|
||||
: distY: 35.490 43.750 [ 8.3923e-05 497.42 ]
|
||||
: dSlope: 0.35788 0.24459 [ 6.4602e-05 1.2881 ]
|
||||
: dSlopeY: 0.0073112 0.012369 [ 3.9814e-08 0.14883 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 9.921e-02
|
||||
: 2 : distY : 8.773e-02
|
||||
: 3 : dSlopeY : 2.784e-02
|
||||
: 4 : teta2 : 2.748e-02
|
||||
: 5 : dSlope : 2.662e-02
|
||||
: 6 : distX : 1.420e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.020078 0.51803 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.96881 0.091329 [ -1.0000 1.0000 ]
|
||||
: distX: -0.69253 0.25979 [ -1.0000 1.0000 ]
|
||||
: distY: -0.85730 0.17591 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.44439 0.37979 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.90175 0.16622 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 26718 events: [1;31m57.7 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (26718 events)
|
||||
: Elapsed time for evaluation of 26718 events: [1;31m0.0346 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 1.467e+02
|
||||
: 2 : teta2 : 6.884e+01
|
||||
: 3 : distX : 6.627e+01
|
||||
: 4 : dSlopeY : 3.066e+01
|
||||
: 5 : dSlope : 1.175e+01
|
||||
: 6 : chi2 : 2.632e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (6000 events)
|
||||
: Elapsed time for evaluation of 6000 events: [1;31m0.0118 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.10881 0.51711 [ -1.0020 0.99902 ]
|
||||
: teta2: -0.96093 0.10865 [ -0.99988 0.46950 ]
|
||||
: distX: -0.67673 0.27337 [ -0.99968 0.75285 ]
|
||||
: distY: -0.82663 0.20236 [ -0.99997 0.83868 ]
|
||||
: dSlope: -0.46394 0.38477 [ -0.99839 0.97924 ]
|
||||
: dSlopeY: -0.89235 0.16561 [ -1.0000 0.93883 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.10881 0.51711 [ -1.0020 0.99902 ]
|
||||
: teta2: -0.96093 0.10865 [ -0.99988 0.46950 ]
|
||||
: distX: -0.67673 0.27337 [ -0.99968 0.75285 ]
|
||||
: distY: -0.82663 0.20236 [ -0.99997 0.83868 ]
|
||||
: dSlope: -0.46394 0.38477 [ -0.99839 0.97924 ]
|
||||
: dSlopeY: -0.89235 0.16561 [ -1.0000 0.93883 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.842
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.075 (0.082) 0.476 (0.467) 0.841 (0.828)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 6000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 26718 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
0
outputs_nn/output_D.txt
Normal file
0
outputs_nn/output_D.txt
Normal file
268
outputs_nn/output_D_res.txt
Normal file
268
outputs_nn/output_D_res.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 8286 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 12762964 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=0:nTrain_Background=20000.0:nTest_Signal=1000.0:nTest_Background=5000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "0" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "1000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "20000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "5000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 7286
|
||||
: Signal -- testing events : 1000
|
||||
: Signal -- training and testing events: 8286
|
||||
: Background -- training events : 20000
|
||||
: Background -- testing events : 5000
|
||||
: Background -- training and testing events: 25000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.090 +0.190 +0.270 +0.150 +0.032
|
||||
: teta2: -0.090 +1.000 +0.022 +0.557 +0.231 +0.681
|
||||
: distX: +0.190 +0.022 +1.000 -0.243 +0.667 +0.066
|
||||
: distY: +0.270 +0.557 -0.243 +1.000 +0.299 +0.491
|
||||
: dSlope: +0.150 +0.231 +0.667 +0.299 +1.000 +0.343
|
||||
: dSlopeY: +0.032 +0.681 +0.066 +0.491 +0.343 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.032 +0.249 +0.208 +0.048 +0.047
|
||||
: teta2: -0.032 +1.000 +0.256 +0.643 +0.377 +0.464
|
||||
: distX: +0.249 +0.256 +1.000 +0.027 +0.771 +0.192
|
||||
: distY: +0.208 +0.643 +0.027 +1.000 +0.323 +0.556
|
||||
: dSlope: +0.048 +0.377 +0.771 +0.323 +1.000 +0.394
|
||||
: dSlopeY: +0.047 +0.464 +0.192 +0.556 +0.394 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 15.110 7.5957 [ 0.25759 29.998 ]
|
||||
: teta2: 0.0049007 0.015613 [ 1.1810e-05 0.34609 ]
|
||||
: distX: 77.540 64.030 [ 0.00059319 494.45 ]
|
||||
: distY: 35.596 43.128 [ 0.0016556 497.11 ]
|
||||
: dSlope: 0.37313 0.24282 [ 0.00012810 1.2803 ]
|
||||
: dSlopeY: 0.0071048 0.011434 [ 4.9639e-07 0.14679 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 8.701e-02
|
||||
: 2 : distY : 7.455e-02
|
||||
: 3 : dSlope : 6.957e-02
|
||||
: 4 : teta2 : 4.316e-02
|
||||
: 5 : dSlopeY : 2.562e-02
|
||||
: 6 : distX : 1.371e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.0011851 0.51079 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.97175 0.090226 [ -1.0000 1.0000 ]
|
||||
: distX: -0.68636 0.25900 [ -1.0000 1.0000 ]
|
||||
: distY: -0.85679 0.17352 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.41728 0.37935 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.90320 0.15579 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 27286 events: [1;31m59.2 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (27286 events)
|
||||
: Elapsed time for evaluation of 27286 events: [1;31m0.0331 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 1.487e+02
|
||||
: 2 : distX : 9.251e+01
|
||||
: 3 : dSlopeY : 5.612e+01
|
||||
: 4 : teta2 : 3.951e+01
|
||||
: 5 : dSlope : 1.219e+01
|
||||
: 6 : chi2 : 1.428e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (6000 events)
|
||||
: Elapsed time for evaluation of 6000 events: [1;31m0.0113 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.10129 0.51080 [ -0.98564 0.99991 ]
|
||||
: teta2: -0.96473 0.096760 [ -0.99997 0.43123 ]
|
||||
: distX: -0.68127 0.26859 [ -0.99983 0.92711 ]
|
||||
: distY: -0.83124 0.20417 [ -0.99994 1.0115 ]
|
||||
: dSlope: -0.45660 0.39080 [ -0.99695 0.96415 ]
|
||||
: dSlopeY: -0.89629 0.16201 [ -0.99999 1.0015 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.10129 0.51080 [ -0.98564 0.99991 ]
|
||||
: teta2: -0.96473 0.096760 [ -0.99997 0.43123 ]
|
||||
: distX: -0.68127 0.26859 [ -0.99983 0.92711 ]
|
||||
: distY: -0.83124 0.20417 [ -0.99994 1.0115 ]
|
||||
: dSlope: -0.45660 0.39080 [ -0.99695 0.96415 ]
|
||||
: dSlopeY: -0.89629 0.16201 [ -0.99999 1.0015 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.854
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.091 (0.089) 0.501 (0.494) 0.851 (0.854)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 6000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 27286 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
268
outputs_nn/output_both.txt
Normal file
268
outputs_nn/output_both.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 13829 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 29144752 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=0:nTrain_Background=20000.0:nTest_Signal=2000.0:nTest_Background=5000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "0" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "2000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "20000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "5000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 11829
|
||||
: Signal -- testing events : 2000
|
||||
: Signal -- training and testing events: 13829
|
||||
: Background -- training events : 20000
|
||||
: Background -- testing events : 5000
|
||||
: Background -- training and testing events: 25000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.082 +0.200 +0.302 +0.182 +0.049
|
||||
: teta2: -0.082 +1.000 +0.033 +0.461 +0.179 +0.632
|
||||
: distX: +0.200 +0.033 +1.000 -0.222 +0.685 +0.075
|
||||
: distY: +0.302 +0.461 -0.222 +1.000 +0.306 +0.463
|
||||
: dSlope: +0.182 +0.179 +0.685 +0.306 +1.000 +0.319
|
||||
: dSlopeY: +0.049 +0.632 +0.075 +0.463 +0.319 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.003 +0.368 +0.313 -0.005 +0.094
|
||||
: teta2: -0.003 +1.000 +0.215 +0.617 +0.302 +0.491
|
||||
: distX: +0.368 +0.215 +1.000 +0.065 +0.633 +0.203
|
||||
: distY: +0.313 +0.617 +0.065 +1.000 +0.246 +0.532
|
||||
: dSlope: -0.005 +0.302 +0.633 +0.246 +1.000 +0.356
|
||||
: dSlopeY: +0.094 +0.491 +0.203 +0.532 +0.356 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 13.817 7.9796 [ 0.0011579 29.997 ]
|
||||
: teta2: 0.0040130 0.012209 [ 1.9755e-06 0.23492 ]
|
||||
: distX: 71.018 61.492 [ 0.0031776 478.62 ]
|
||||
: distY: 31.234 37.327 [ 0.00019073 497.26 ]
|
||||
: dSlope: 0.37346 0.23976 [ 5.9959e-05 1.2822 ]
|
||||
: dSlopeY: 0.0063004 0.010258 [ 3.9814e-08 0.14883 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 9.147e-02
|
||||
: 2 : distY : 5.407e-02
|
||||
: 3 : teta2 : 4.044e-02
|
||||
: 4 : dSlope : 3.233e-02
|
||||
: 5 : distX : 2.801e-02
|
||||
: 6 : dSlopeY : 1.699e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.078822 0.53204 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.96585 0.10395 [ -1.0000 1.0000 ]
|
||||
: distX: -0.70325 0.25696 [ -1.0000 1.0000 ]
|
||||
: distY: -0.87438 0.15013 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.41755 0.37399 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.91533 0.13785 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 31829 events: [1;31m64.5 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (31829 events)
|
||||
: Elapsed time for evaluation of 31829 events: [1;31m0.0391 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 3.588e+02
|
||||
: 2 : dSlopeY : 2.134e+02
|
||||
: 3 : distX : 1.426e+02
|
||||
: 4 : teta2 : 7.020e+01
|
||||
: 5 : dSlope : 1.303e+01
|
||||
: 6 : chi2 : 3.098e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (7000 events)
|
||||
: Elapsed time for evaluation of 7000 events: [1;31m0.0138 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.055433 0.55630 [ -0.99875 1.0001 ]
|
||||
: teta2: -0.96118 0.10498 [ -0.99999 0.45981 ]
|
||||
: distX: -0.71039 0.26310 [ -0.99989 0.79697 ]
|
||||
: distY: -0.86095 0.16028 [ -1.0000 0.89878 ]
|
||||
: dSlope: -0.43538 0.38054 [ -0.99815 0.98969 ]
|
||||
: dSlopeY: -0.91076 0.14080 [ -1.0000 0.93883 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.055433 0.55630 [ -0.99875 1.0001 ]
|
||||
: teta2: -0.96118 0.10498 [ -0.99999 0.45981 ]
|
||||
: distX: -0.71039 0.26310 [ -0.99989 0.79697 ]
|
||||
: distY: -0.86095 0.16028 [ -1.0000 0.89878 ]
|
||||
: dSlope: -0.43538 0.38054 [ -0.99815 0.98969 ]
|
||||
: dSlopeY: -0.91076 0.14080 [ -1.0000 0.93883 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.853
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.000 (0.000) 0.470 (0.511) 0.877 (0.882)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 7000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 31829 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
268
outputs_nn/output_e_B.txt
Normal file
268
outputs_nn/output_e_B.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 187767 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 14040318 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=50000.0:nTrain_Background=500000.0:nTest_Signal=20000.0:nTest_Background=100000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "50000" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "20000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "500000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "100000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 50000
|
||||
: Signal -- testing events : 20000
|
||||
: Signal -- training and testing events: 70000
|
||||
: Background -- training events : 500000
|
||||
: Background -- testing events : 100000
|
||||
: Background -- training and testing events: 600000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.094 +0.511 +0.560 +0.392 +0.141
|
||||
: teta2: -0.094 +1.000 -0.010 +0.336 -0.009 +0.390
|
||||
: distX: +0.511 -0.010 +1.000 +0.200 +0.501 +0.229
|
||||
: distY: +0.560 +0.336 +0.200 +1.000 +0.505 +0.456
|
||||
: dSlope: +0.392 -0.009 +0.501 +0.505 +1.000 +0.494
|
||||
: dSlopeY: +0.141 +0.390 +0.229 +0.456 +0.494 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 +0.006 +0.360 +0.312 -0.004 +0.103
|
||||
: teta2: +0.006 +1.000 +0.218 +0.626 +0.297 +0.487
|
||||
: distX: +0.360 +0.218 +1.000 +0.065 +0.633 +0.205
|
||||
: distY: +0.312 +0.626 +0.065 +1.000 +0.250 +0.538
|
||||
: dSlope: -0.004 +0.297 +0.633 +0.250 +1.000 +0.358
|
||||
: dSlopeY: +0.103 +0.487 +0.205 +0.538 +0.358 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 8.4488 9.2446 [ 5.2334e-05 30.000 ]
|
||||
: teta2: 0.0057495 0.014113 [ 1.2564e-06 0.42331 ]
|
||||
: distX: 40.154 55.148 [ 4.3869e-05 499.60 ]
|
||||
: distY: 26.206 36.751 [ 1.9073e-06 499.20 ]
|
||||
: dSlope: 0.33045 0.23497 [ 4.7125e-07 1.3693 ]
|
||||
: dSlopeY: 0.0054210 0.0091700 [ 1.0245e-08 0.14939 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 5.701e-01
|
||||
: 2 : distX : 3.731e-01
|
||||
: 3 : distY : 2.108e-01
|
||||
: 4 : dSlopeY : 8.367e-02
|
||||
: 5 : dSlope : 8.157e-03
|
||||
: 6 : teta2 : 3.280e-03
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.43675 0.61631 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.97284 0.066677 [ -1.0000 1.0000 ]
|
||||
: distX: -0.83926 0.22077 [ -1.0000 1.0000 ]
|
||||
: distY: -0.89501 0.14724 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.51734 0.34321 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.92743 0.12276 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 550000 events: [1;31m1.28e+03 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (550000 events)
|
||||
: Elapsed time for evaluation of 550000 events: [1;31m0.743 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 3.418e+02
|
||||
: 2 : dSlopeY : 2.969e+02
|
||||
: 3 : teta2 : 2.257e+02
|
||||
: 4 : distX : 2.089e+02
|
||||
: 5 : dSlope : 1.525e+01
|
||||
: 6 : chi2 : 3.953e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (120000 events)
|
||||
: Elapsed time for evaluation of 120000 events: [1;31m0.165 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.15704 0.62353 [ -1.0000 0.99999 ]
|
||||
: teta2: -0.97379 0.069648 [ -0.99999 0.49021 ]
|
||||
: distX: -0.76831 0.25194 [ -1.0000 0.99861 ]
|
||||
: distY: -0.86100 0.17259 [ -1.0000 0.99055 ]
|
||||
: dSlope: -0.50135 0.35288 [ -1.0000 0.94915 ]
|
||||
: dSlopeY: -0.91297 0.13474 [ -1.0000 0.99972 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.15704 0.62353 [ -1.0000 0.99999 ]
|
||||
: teta2: -0.97379 0.069648 [ -0.99999 0.49021 ]
|
||||
: distX: -0.76831 0.25194 [ -1.0000 0.99861 ]
|
||||
: distY: -0.86100 0.17259 [ -1.0000 0.99055 ]
|
||||
: dSlope: -0.50135 0.35288 [ -1.0000 0.94915 ]
|
||||
: dSlopeY: -0.91297 0.13474 [ -1.0000 0.99972 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.958
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.434 (0.435) 0.889 (0.888) 0.982 (0.982)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 120000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 550000 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
280
outputs_nn/output_n_B.txt
Normal file
280
outputs_nn/output_n_B.txt
Normal file
@ -0,0 +1,280 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 2175608 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 14040318 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=50000.0:nTrain_Background=500000.0:nTest_Signal=20000.0:nTest_Background=100000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "50000" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "20000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "500000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "100000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
: Dataset[MatchNNDataSet] : Signal requirement: "chi2<15 && distX<250 && distY<400 && dSlope<1.5 && dSlopeY<0.15"
|
||||
: Dataset[MatchNNDataSet] : Signal -- number of events passed: 2151182 / sum of weights: 2.15118e+06
|
||||
: Dataset[MatchNNDataSet] : Signal -- efficiency : 0.988773
|
||||
: Dataset[MatchNNDataSet] : Background requirement: "chi2<15 && distX<250 && distY<400 && dSlope<1.5 && dSlopeY<0.15"
|
||||
: Dataset[MatchNNDataSet] : Background -- number of events passed: 7175761 / sum of weights: 7.17576e+06
|
||||
: Dataset[MatchNNDataSet] : Background -- efficiency : 0.511083
|
||||
: Dataset[MatchNNDataSet] : you have opted for interpreting the requested number of training/testing events
|
||||
: to be the number of events AFTER your preselection cuts
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : you have opted for interpreting the requested number of training/testing events
|
||||
: to be the number of events AFTER your preselection cuts
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 50000
|
||||
: Signal -- testing events : 20000
|
||||
: Signal -- training and testing events: 70000
|
||||
: Dataset[MatchNNDataSet] : Signal -- due to the preselection a scaling factor has been applied to the numbers of requested events: 0.988773
|
||||
: Background -- training events : 500000
|
||||
: Background -- testing events : 100000
|
||||
: Background -- training and testing events: 600000
|
||||
: Dataset[MatchNNDataSet] : Background -- due to the preselection a scaling factor has been applied to the numbers of requested events: 0.511083
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 +0.197 +0.512 +0.603 +0.392 +0.418
|
||||
: teta2: +0.197 +1.000 +0.456 +0.649 +0.399 +0.581
|
||||
: distX: +0.512 +0.456 +1.000 +0.445 +0.555 +0.606
|
||||
: distY: +0.603 +0.649 +0.445 +1.000 +0.529 +0.568
|
||||
: dSlope: +0.392 +0.399 +0.555 +0.529 +1.000 +0.647
|
||||
: dSlopeY: +0.418 +0.581 +0.606 +0.568 +0.647 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 +0.001 +0.370 +0.305 +0.002 +0.084
|
||||
: teta2: +0.001 +1.000 +0.173 +0.650 +0.280 +0.455
|
||||
: distX: +0.370 +0.173 +1.000 +0.043 +0.627 +0.195
|
||||
: distY: +0.305 +0.650 +0.043 +1.000 +0.240 +0.458
|
||||
: dSlope: +0.002 +0.280 +0.627 +0.240 +1.000 +0.362
|
||||
: dSlopeY: +0.084 +0.455 +0.195 +0.458 +0.362 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 4.1539 4.6460 [ 1.3264e-05 15.000 ]
|
||||
: teta2: 0.0079252 0.017224 [ 1.2100e-06 0.43619 ]
|
||||
: distX: 27.109 38.586 [ 3.8147e-06 250.00 ]
|
||||
: distY: 20.564 28.494 [ 1.5259e-05 399.49 ]
|
||||
: dSlope: 0.28782 0.22814 [ 2.2016e-06 1.3026 ]
|
||||
: dSlopeY: 0.0054782 0.0099926 [ 1.8626e-09 0.14834 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 6.095e-01
|
||||
: 2 : distX : 4.727e-01
|
||||
: 3 : distY : 1.428e-01
|
||||
: 4 : dSlope : 7.613e-02
|
||||
: 5 : dSlopeY : 5.967e-02
|
||||
: 6 : teta2 : 5.937e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.44615 0.61947 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.96367 0.078975 [ -1.0000 1.0000 ]
|
||||
: distX: -0.78313 0.30869 [ -1.0000 1.0000 ]
|
||||
: distY: -0.89705 0.14265 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.55809 0.35029 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.92614 0.13472 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 550000 events: [1;31m1.28e+03 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (550000 events)
|
||||
: Elapsed time for evaluation of 550000 events: [1;31m0.785 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : teta2 : 7.346e+02
|
||||
: 2 : distX : 1.891e+02
|
||||
: 3 : dSlopeY : 5.900e+01
|
||||
: 4 : distY : 4.639e+01
|
||||
: 5 : dSlope : 1.074e+01
|
||||
: 6 : chi2 : 2.093e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (120000 events)
|
||||
: Elapsed time for evaluation of 120000 events: [1;31m0.169 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.15813 0.62626 [ -1.0000 0.99995 ]
|
||||
: teta2: -0.97140 0.071651 [ -1.0000 0.85686 ]
|
||||
: distX: -0.67477 0.35263 [ -1.0000 0.99866 ]
|
||||
: distY: -0.87476 0.15583 [ -1.0000 0.99415 ]
|
||||
: dSlope: -0.49635 0.36886 [ -0.99993 0.97372 ]
|
||||
: dSlopeY: -0.91980 0.13029 [ -1.0000 1.0219 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.15813 0.62626 [ -1.0000 0.99995 ]
|
||||
: teta2: -0.97140 0.071651 [ -1.0000 0.85686 ]
|
||||
: distX: -0.67477 0.35263 [ -1.0000 0.99866 ]
|
||||
: distY: -0.87476 0.15583 [ -1.0000 0.99415 ]
|
||||
: dSlope: -0.49635 0.36886 [ -0.99993 0.97372 ]
|
||||
: dSlopeY: -0.91980 0.13029 [ -1.0000 1.0219 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.970
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.543 (0.551) 0.936 (0.936) 0.985 (0.985)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 120000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 550000 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming neural_net_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
268
outputs_nn/output_og_weights_B.txt
Normal file
268
outputs_nn/output_og_weights_B.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 6590 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 14040318 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=0:nTrain_Background=200000.0:nTest_Signal=1000.0:nTest_Background=50000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "0" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "1000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "200000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "50000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 5590
|
||||
: Signal -- testing events : 1000
|
||||
: Signal -- training and testing events: 6590
|
||||
: Background -- training events : 200000
|
||||
: Background -- testing events : 50000
|
||||
: Background -- training and testing events: 250000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.083 +0.225 +0.287 +0.211 +0.054
|
||||
: teta2: -0.083 +1.000 +0.035 +0.472 +0.174 +0.617
|
||||
: distX: +0.225 +0.035 +1.000 -0.194 +0.684 +0.087
|
||||
: distY: +0.287 +0.472 -0.194 +1.000 +0.330 +0.471
|
||||
: dSlope: +0.211 +0.174 +0.684 +0.330 +1.000 +0.325
|
||||
: dSlopeY: +0.054 +0.617 +0.087 +0.471 +0.325 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 +0.003 +0.359 +0.315 -0.004 +0.101
|
||||
: teta2: +0.003 +1.000 +0.212 +0.622 +0.296 +0.492
|
||||
: distX: +0.359 +0.212 +1.000 +0.060 +0.635 +0.204
|
||||
: distY: +0.315 +0.622 +0.060 +1.000 +0.246 +0.530
|
||||
: dSlope: -0.004 +0.296 +0.635 +0.246 +1.000 +0.360
|
||||
: dSlopeY: +0.101 +0.492 +0.204 +0.530 +0.360 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 13.730 8.0164 [ 0.00031556 30.000 ]
|
||||
: teta2: 0.0041449 0.012655 [ 1.1428e-06 0.43138 ]
|
||||
: distX: 69.832 60.841 [ 0.00027466 490.80 ]
|
||||
: distY: 31.145 37.661 [ 0.00010300 497.14 ]
|
||||
: dSlope: 0.36688 0.24104 [ 1.2597e-05 1.3582 ]
|
||||
: dSlopeY: 0.0063738 0.010662 [ 4.9360e-08 0.14883 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 8.858e-02
|
||||
: 2 : distY : 5.736e-02
|
||||
: 3 : teta2 : 3.110e-02
|
||||
: 4 : distX : 2.441e-02
|
||||
: 5 : dSlope : 2.026e-02
|
||||
: 6 : dSlopeY : 1.556e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.084705 0.53444 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.98079 0.058673 [ -1.0000 1.0000 ]
|
||||
: distX: -0.71544 0.24793 [ -1.0000 1.0000 ]
|
||||
: distY: -0.87470 0.15151 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.45977 0.35494 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.91435 0.14328 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 205590 events: [1;31m465 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (205590 events)
|
||||
: Elapsed time for evaluation of 205590 events: [1;31m0.252 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 2.139e+02
|
||||
: 2 : teta2 : 1.005e+02
|
||||
: 3 : dSlopeY : 9.191e+01
|
||||
: 4 : distX : 8.898e+01
|
||||
: 5 : dSlope : 1.082e+01
|
||||
: 6 : chi2 : 1.776e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (51000 events)
|
||||
: Elapsed time for evaluation of 51000 events: [1;31m0.0702 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.011828 0.57705 [ -0.99996 0.99998 ]
|
||||
: teta2: -0.97507 0.067138 [ -0.99998 0.27868 ]
|
||||
: distX: -0.72636 0.26123 [ -1.0000 0.90538 ]
|
||||
: distY: -0.84283 0.18429 [ -0.99999 1.0037 ]
|
||||
: dSlope: -0.48676 0.36013 [ -0.99980 0.87659 ]
|
||||
: dSlopeY: -0.90653 0.13847 [ -1.0000 1.0030 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.011828 0.57705 [ -0.99996 0.99998 ]
|
||||
: teta2: -0.97507 0.067138 [ -0.99998 0.27868 ]
|
||||
: distX: -0.72636 0.26123 [ -1.0000 0.90538 ]
|
||||
: distY: -0.84283 0.18429 [ -0.99999 1.0037 ]
|
||||
: dSlope: -0.48676 0.36013 [ -0.99980 0.87659 ]
|
||||
: dSlopeY: -0.90653 0.13847 [ -1.0000 1.0030 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.850
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.050 (0.050) 0.446 (0.447) 0.869 (0.869)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 51000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 205590 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
268
outputs_nn/output_og_weights_res_bkg_B.txt
Normal file
268
outputs_nn/output_og_weights_res_bkg_B.txt
Normal file
@ -0,0 +1,268 @@
|
||||
: Parsing option string:
|
||||
: ... "V:!Silent:Color:DrawProgressBar:AnalysisType=Classification"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: V: "True" [Verbose flag]
|
||||
: Color: "True" [Flag for coloured screen output (default: True, if in batch mode: False)]
|
||||
: Silent: "False" [Batch mode: boolean silent flag inhibiting any output from TMVA after the creation of the factory class object (default: False)]
|
||||
: DrawProgressBar: "True" [Draw progress bar to display training, testing and evaluation schedule (default: True)]
|
||||
: AnalysisType: "Classification" [Set the analysis type (Classification, Regression, Multiclass, Auto) (default: Auto)]
|
||||
: - Default:
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Transformations: "I" [List of transformations to test; formatting example: "Transformations=I;D;P;U;G,D", for identity, decorrelation, PCA, Uniform and Gaussianisation followed by decorrelation transformations]
|
||||
: Correlations: "False" [boolean to show correlation in output]
|
||||
: ROC: "True" [boolean to show ROC in output]
|
||||
: ModelPersistence: "True" [Option to save the trained model in xml file or using serialization]
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Signal"
|
||||
: Add Tree Signal of type Signal with 6590 events
|
||||
DataSetInfo : [MatchNNDataSet] : Added class "Background"
|
||||
: Add Tree Bkg of type Background with 10981310 events
|
||||
: Dataset[MatchNNDataSet] : Class index : 0 name : Signal
|
||||
: Dataset[MatchNNDataSet] : Class index : 1 name : Background
|
||||
Factory : Booking method: [1mmatching_mlp[0m
|
||||
:
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: <none>
|
||||
: - Default:
|
||||
: Boost_num: "0" [Number of times the classifier will be boosted]
|
||||
: Parsing option string:
|
||||
: ... "!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: NCycles: "700" [Number of training cycles]
|
||||
: HiddenLayers: "N+2,N" [Specification of hidden layer architecture]
|
||||
: NeuronType: "ReLU" [Neuron activation function type]
|
||||
: EstimatorType: "CE" [MSE (Mean Square Estimator) for Gaussian Likelihood or CE(Cross-Entropy) for Bernoulli Likelihood]
|
||||
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
|
||||
: VarTransform: "Norm" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"]
|
||||
: H: "False" [Print method-specific help message]
|
||||
: TrainingMethod: "BP" [Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)]
|
||||
: LearningRate: "2.000000e-02" [ANN learning rate parameter]
|
||||
: DecayRate: "1.000000e-02" [Decay rate for learning parameter]
|
||||
: TestRate: "50" [Test for overtraining performed at each #th epochs]
|
||||
: Sampling: "1.000000e+00" [Only 'Sampling' (randomly selected) events are trained each epoch]
|
||||
: SamplingImportance: "1.000000e+00" [ The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.]
|
||||
: UseRegulator: "False" [Use regulator to avoid over-training]
|
||||
: - Default:
|
||||
: RandomSeed: "1" [Random seed for initial synapse weights (0 means unique seed for each run; default value '1')]
|
||||
: NeuronInputType: "sum" [Neuron input function type]
|
||||
: VerbosityLevel: "Default" [Verbosity level]
|
||||
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
|
||||
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
|
||||
: EpochMonitoring: "False" [Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)]
|
||||
: SamplingEpoch: "1.000000e+00" [Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training]
|
||||
: SamplingTraining: "True" [The training sample is sampled]
|
||||
: SamplingTesting: "False" [The testing sample is sampled]
|
||||
: ResetStep: "50" [How often BFGS should reset history]
|
||||
: Tau: "3.000000e+00" [LineSearch "size step"]
|
||||
: BPMode: "sequential" [Back-propagation learning mode: sequential or batch]
|
||||
: BatchSize: "-1" [Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events]
|
||||
: ConvergenceImprove: "1.000000e-30" [Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)]
|
||||
: ConvergenceTests: "-1" [Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)]
|
||||
: UpdateLimit: "10000" [Maximum times of regulator update]
|
||||
: CalculateErrors: "False" [Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value]
|
||||
: WeightRange: "1.000000e+00" [Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range]
|
||||
matching_mlp : [MatchNNDataSet] : Create Transformation "Norm" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTrain all methods[0m
|
||||
: Rebuilding Dataset MatchNNDataSet
|
||||
: Parsing option string:
|
||||
: ... "SplitMode=random:V:nTrain_Signal=0:nTrain_Background=200000.0:nTest_Signal=5000.0:nTest_Background=50000.0"
|
||||
: The following options are set:
|
||||
: - By User:
|
||||
: SplitMode: "Random" [Method of picking training and testing events (default: random)]
|
||||
: nTrain_Signal: "0" [Number of training events of class Signal (default: 0 = all)]
|
||||
: nTest_Signal: "5000" [Number of test events of class Signal (default: 0 = all)]
|
||||
: nTrain_Background: "200000" [Number of training events of class Background (default: 0 = all)]
|
||||
: nTest_Background: "50000" [Number of test events of class Background (default: 0 = all)]
|
||||
: V: "True" [Verbosity (default: true)]
|
||||
: - Default:
|
||||
: MixMode: "SameAsSplitMode" [Method of mixing events of different classes into one dataset (default: SameAsSplitMode)]
|
||||
: SplitSeed: "100" [Seed for random event shuffling]
|
||||
: NormMode: "EqualNumEvents" [Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)]
|
||||
: ScaleWithPreselEff: "False" [Scale the number of requested events by the eff. of the preselection cuts (or not)]
|
||||
: TrainTestSplit_Signal: "0.000000e+00" [Number of test events of class Signal (default: 0 = all)]
|
||||
: TrainTestSplit_Background: "0.000000e+00" [Number of test events of class Background (default: 0 = all)]
|
||||
: VerboseLevel: "Info" [VerboseLevel (Debug/Verbose/Info)]
|
||||
: Correlations: "True" [Boolean to show correlation output (Default: true)]
|
||||
: CalcCorrelations: "True" [Compute correlations and also some variable statistics, e.g. min/max (Default: true )]
|
||||
: Building event vectors for type 2 Signal
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Signal
|
||||
: Building event vectors for type 2 Background
|
||||
: Dataset[MatchNNDataSet] : create input formulas for tree Bkg
|
||||
DataSetFactory : [MatchNNDataSet] : Number of events in input trees
|
||||
:
|
||||
:
|
||||
: Dataset[MatchNNDataSet] : Weight renormalisation mode: "EqualNumEvents": renormalises all event classes ...
|
||||
: Dataset[MatchNNDataSet] : such that the effective (weighted) number of events in each class is the same
|
||||
: Dataset[MatchNNDataSet] : (and equals the number of events (entries) given for class=0 )
|
||||
: Dataset[MatchNNDataSet] : ... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ...
|
||||
: Dataset[MatchNNDataSet] : ... (note that N_j is the sum of TRAINING events
|
||||
: Dataset[MatchNNDataSet] : ..... Testing events are not renormalised nor included in the renormalisation factor!)
|
||||
: Number of training and testing events
|
||||
: ---------------------------------------------------------------------------
|
||||
: Signal -- training events : 1590
|
||||
: Signal -- testing events : 5000
|
||||
: Signal -- training and testing events: 6590
|
||||
: Background -- training events : 200000
|
||||
: Background -- testing events : 50000
|
||||
: Background -- training and testing events: 250000
|
||||
:
|
||||
DataSetInfo : Correlation matrix (Signal):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.090 +0.192 +0.272 +0.184 +0.049
|
||||
: teta2: -0.090 +1.000 +0.041 +0.483 +0.208 +0.628
|
||||
: distX: +0.192 +0.041 +1.000 -0.179 +0.680 +0.101
|
||||
: distY: +0.272 +0.483 -0.179 +1.000 +0.363 +0.496
|
||||
: dSlope: +0.184 +0.208 +0.680 +0.363 +1.000 +0.350
|
||||
: dSlopeY: +0.049 +0.628 +0.101 +0.496 +0.350 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetInfo : Correlation matrix (Background):
|
||||
: --------------------------------------------------------
|
||||
: chi2 teta2 distX distY dSlope dSlopeY
|
||||
: chi2: +1.000 -0.018 +0.249 +0.222 +0.061 +0.061
|
||||
: teta2: -0.018 +1.000 +0.219 +0.658 +0.336 +0.485
|
||||
: distX: +0.249 +0.219 +1.000 -0.003 +0.782 +0.189
|
||||
: distY: +0.222 +0.658 -0.003 +1.000 +0.284 +0.551
|
||||
: dSlope: +0.061 +0.336 +0.782 +0.284 +1.000 +0.379
|
||||
: dSlopeY: +0.061 +0.485 +0.189 +0.551 +0.379 +1.000
|
||||
: --------------------------------------------------------
|
||||
DataSetFactory : [MatchNNDataSet] :
|
||||
:
|
||||
Factory : [MatchNNDataSet] : Create Transformation "I" with events from all classes.
|
||||
:
|
||||
: Transformation, Variable selection :
|
||||
: Input : variable 'chi2' <---> Output : variable 'chi2'
|
||||
: Input : variable 'teta2' <---> Output : variable 'teta2'
|
||||
: Input : variable 'distX' <---> Output : variable 'distX'
|
||||
: Input : variable 'distY' <---> Output : variable 'distY'
|
||||
: Input : variable 'dSlope' <---> Output : variable 'dSlope'
|
||||
: Input : variable 'dSlopeY' <---> Output : variable 'dSlopeY'
|
||||
TFHandler_Factory : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 14.983 7.6381 [ 0.13393 30.000 ]
|
||||
: teta2: 0.0045002 0.013698 [ 1.0756e-06 0.36197 ]
|
||||
: distX: 74.269 61.998 [ 0.00010681 495.87 ]
|
||||
: distY: 33.972 40.646 [ 0.00016022 498.46 ]
|
||||
: dSlope: 0.35639 0.24245 [ 9.2713e-06 1.3376 ]
|
||||
: dSlopeY: 0.0069454 0.011901 [ 8.8476e-08 0.14989 ]
|
||||
: -----------------------------------------------------------
|
||||
: Ranking input variables (method unspecific)...
|
||||
IdTransformation : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Separation
|
||||
: --------------------------------
|
||||
: 1 : chi2 : 9.899e-02
|
||||
: 2 : distY : 8.544e-02
|
||||
: 3 : teta2 : 4.508e-02
|
||||
: 4 : dSlope : 3.745e-02
|
||||
: 5 : dSlopeY : 2.733e-02
|
||||
: 6 : distX : 1.657e-02
|
||||
: --------------------------------
|
||||
Factory : Train method: matching_mlp for Classification
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: -0.0056167 0.51149 [ -1.0000 1.0000 ]
|
||||
: teta2: -0.97514 0.075684 [ -1.0000 1.0000 ]
|
||||
: distX: -0.70045 0.25006 [ -1.0000 1.0000 ]
|
||||
: distY: -0.86369 0.16308 [ -1.0000 1.0000 ]
|
||||
: dSlope: -0.46715 0.36251 [ -1.0000 1.0000 ]
|
||||
: dSlopeY: -0.90733 0.15880 [ -1.0000 1.0000 ]
|
||||
: -----------------------------------------------------------
|
||||
: Training Network
|
||||
:
|
||||
: Elapsed time for training with 201590 events: [1;31m424 sec[0m
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on training sample (201590 events)
|
||||
: Elapsed time for evaluation of 201590 events: [1;31m0.244 sec[0m
|
||||
: Creating xml weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
: Creating standalone class: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C[0m
|
||||
: Write special histos to file: matching_ghost_mlp_training.root:/MatchNNDataSet/Method_MLP/matching_mlp
|
||||
Factory : Training finished
|
||||
:
|
||||
: Ranking input variables (method specific)...
|
||||
matching_mlp : Ranking result (top variable is best ranked)
|
||||
: --------------------------------
|
||||
: Rank : Variable : Importance
|
||||
: --------------------------------
|
||||
: 1 : distY : 7.131e+01
|
||||
: 2 : teta2 : 3.522e+01
|
||||
: 3 : distX : 2.316e+01
|
||||
: 4 : dSlopeY : 1.020e+01
|
||||
: 5 : dSlope : 6.822e+00
|
||||
: 6 : chi2 : 2.546e+00
|
||||
: --------------------------------
|
||||
Factory : === Destroy and recreate all methods via weight files for testing ===
|
||||
:
|
||||
: Reading weight file: [0;36mMatchNNDataSet/weights/TMVAClassification_matching_mlp.weights.xml[0m
|
||||
matching_mlp : Building Network.
|
||||
: Initializing weights
|
||||
Factory : [1mTest all methods[0m
|
||||
Factory : Test method: matching_mlp for Classification performance
|
||||
:
|
||||
matching_mlp : [MatchNNDataSet] : Evaluation of matching_mlp on testing sample (55000 events)
|
||||
: Elapsed time for evaluation of 55000 events: [1;31m0.0744 sec[0m
|
||||
Factory : [1mEvaluate all methods[0m
|
||||
Factory : Evaluate classifier: matching_mlp
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.12456 0.50663 [ -0.99498 1.0000 ]
|
||||
: teta2: -0.96870 0.085208 [ -1.0000 0.96194 ]
|
||||
: distX: -0.68732 0.27168 [ -0.99998 0.99743 ]
|
||||
: distY: -0.83061 0.19253 [ -1.0000 1.0027 ]
|
||||
: dSlope: -0.50226 0.36648 [ -0.99996 0.94917 ]
|
||||
: dSlopeY: -0.90192 0.14156 [ -1.0000 0.98588 ]
|
||||
: -----------------------------------------------------------
|
||||
matching_mlp : [MatchNNDataSet] : Loop over test events and fill histograms with classifier response...
|
||||
:
|
||||
TFHandler_matching_mlp : Variable Mean RMS [ Min Max ]
|
||||
: -----------------------------------------------------------
|
||||
: chi2: 0.12456 0.50663 [ -0.99498 1.0000 ]
|
||||
: teta2: -0.96870 0.085208 [ -1.0000 0.96194 ]
|
||||
: distX: -0.68732 0.27168 [ -0.99998 0.99743 ]
|
||||
: distY: -0.83061 0.19253 [ -1.0000 1.0027 ]
|
||||
: dSlope: -0.50226 0.36648 [ -0.99996 0.94917 ]
|
||||
: dSlopeY: -0.90192 0.14156 [ -1.0000 0.98588 ]
|
||||
: -----------------------------------------------------------
|
||||
:
|
||||
: Evaluation results ranked by best signal efficiency and purity (area)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA
|
||||
: Name: Method: ROC-integ
|
||||
: MatchNNDataSet matching_mlp : 0.838
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
: Testing efficiency compared to training efficiency (overtraining check)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: DataSet MVA Signal efficiency: from test sample (from training sample)
|
||||
: Name: Method: @B=0.01 @B=0.10 @B=0.30
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
: MatchNNDataSet matching_mlp : 0.067 (0.067) 0.460 (0.458) 0.828 (0.824)
|
||||
: -------------------------------------------------------------------------------------------------------------------
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TestTree' with 55000 events
|
||||
:
|
||||
Dataset:MatchNNDataSet : Created tree 'TrainTree' with 201590 events
|
||||
:
|
||||
Factory : [1mThank you for using TMVA![0m
|
||||
: [1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html[0m
|
||||
Transforming nn_electron_training/result/MatchNNDataSet/weights/TMVAClassification_matching_mlp.class.C ...
|
||||
Found minimum and maximum values for 6 variables.
|
||||
Found 3 matrices:
|
||||
1. fWeightMatrix0to1 with 7 columns and 8 rows
|
||||
2. fWeightMatrix1to2 with 9 columns and 6 rows
|
||||
3. fWeightMatrix2to3 with 7 columns and 1 rows
|
189
parameterisations/losses_train_matching_ghost_mlps.py
Normal file
189
parameterisations/losses_train_matching_ghost_mlps.py
Normal file
@ -0,0 +1,189 @@
|
||||
# flake8: noqaq
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import ROOT
|
||||
from ROOT import TMVA, TList, TTree, TMath
|
||||
|
||||
|
||||
def train_matching_ghost_mlp(
|
||||
input_file: str = "data/tracking_losses_ntuple_B.root",
|
||||
tree_name: str = "PrDebugTrackingLosses.PrDebugTrackingTool/Tuple",
|
||||
b_input_file: str = "data/ghost_data_B.root",
|
||||
b_tree_name: str = "PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
only_electrons: bool = True,
|
||||
n_train_signal: int = 2e3, # 50e3
|
||||
n_train_bkg: int = 5e3, # 500e3
|
||||
n_test_signal: int = 1e3,
|
||||
n_test_bkg: int = 2e3,
|
||||
prepare_data: bool = True,
|
||||
outdir: str = "nn_trackinglosses_training",
|
||||
):
|
||||
"""Trains an MLP to classify the match between Velo and Seed track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data.root".
|
||||
tree_name (str, optional): Defaults to "PrMatchNN.PrMCDebugMatchToolNN/Tuple".
|
||||
exclude_electrons (bool, optional): Defaults to False.
|
||||
only_electrons (bool, optional): Signal only of electrons, but bkg of all particles. Defaults to True.
|
||||
residuals (bool, optional): Signal only of mlp<0.215. Defaults to False.
|
||||
n_train_signal (int, optional): Number of true matches to train on. Defaults to 200e3.
|
||||
n_train_bkg (int, optional): Number of fake matches to train on. Defaults to 200e3.
|
||||
n_test_signal (int, optional): Number of true matches to test on. Defaults to 75e3.
|
||||
n_test_bkg (int, optional): Number of fake matches to test on. Defaults to 75e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
# vec = ROOT.std.vector("string")(13)
|
||||
colList = [
|
||||
"mc_chi2",
|
||||
"mc_teta2",
|
||||
"mc_distX",
|
||||
"mc_distY",
|
||||
"mc_dSlope",
|
||||
"mc_dSlopeY",
|
||||
"mc_quality",
|
||||
"mc_end_velo_qop",
|
||||
"mc_end_velo_tx",
|
||||
"mc_end_velo_ty",
|
||||
"mc_end_t_qop",
|
||||
"mc_end_t_tx",
|
||||
"mc_end_t_ty",
|
||||
]
|
||||
# for i in range(13):
|
||||
# vec[i] = colList[i]
|
||||
|
||||
if prepare_data:
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
rdf_b = ROOT.RDataFrame(b_tree_name, b_input_file)
|
||||
if only_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"mc_quality == -1 && lost == 0 && fromSignal == 1", # electron that is true match but mlp said no match
|
||||
"Signal is defined as one label (only electrons)",
|
||||
)
|
||||
else:
|
||||
rdf_signal = rdf.Filter(
|
||||
"lost == 0 && fromSignal == 1",
|
||||
"Signal is defined as non-zero label",
|
||||
)
|
||||
rdf_bkg = rdf_b.Filter(
|
||||
"mc_quality == 0",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
colList,
|
||||
)
|
||||
rdf_bkg.Snapshot(
|
||||
"Bkg",
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_bkg.root",
|
||||
)
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
|
||||
bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_bkg.root"
|
||||
)
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
os.chdir(outdir + "/result")
|
||||
output = ROOT.TFile(
|
||||
"matching_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("MatchNNDataSet")
|
||||
|
||||
dataloader.AddVariable("mc_chi2", "F")
|
||||
dataloader.AddVariable("mc_teta2", "F")
|
||||
dataloader.AddVariable("mc_distX", "F")
|
||||
dataloader.AddVariable("mc_distY", "F")
|
||||
dataloader.AddVariable("mc_dSlope", "F")
|
||||
dataloader.AddVariable("mc_dSlopeY", "F")
|
||||
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
|
||||
# these cuts are also applied in the algorithm
|
||||
preselectionCuts = ROOT.TCut(
|
||||
"!TMath::IsNaN(mc_chi2) && !TMath::IsNaN(mc_distX) && !TMath::IsNaN(mc_distY) && !TMath::IsNaN(mc_dSlope) && !TMath::IsNaN(mc_dSlopeY) && !TMath::IsNaN(mc_teta2)",
|
||||
# "mc_chi2<30 && mc_distX<500 && mc_distY<500 && mc_dSlope<2.0 && mc_dSlopeY<0.15", #### ganz raus für elektronen
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
# normmode default is EqualNumEvents
|
||||
)
|
||||
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"matching_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude_electrons",
|
||||
action="store_true",
|
||||
help="Excludes electrons from training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--only_electrons",
|
||||
action="store_true",
|
||||
help="Only electrons for signal training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-signal",
|
||||
type=int,
|
||||
help="Number of training tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-bkg",
|
||||
type=int,
|
||||
help="Number of training tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-signal",
|
||||
type=int,
|
||||
help="Number of testing tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-bkg",
|
||||
type=int,
|
||||
help="Number of testing tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
|
||||
train_matching_ghost_mlp(**args_dict)
|
434
parameterisations/notebooks/HougHistogram_old.ipynb
Normal file
434
parameterisations/notebooks/HougHistogram_old.ipynb
Normal file
File diff suppressed because one or more lines are too long
173
parameterisations/notebooks/bend_y_params.ipynb
Normal file
173
parameterisations/notebooks/bend_y_params.ipynb
Normal file
@ -0,0 +1,173 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import uproot\n",
|
||||
"import awkward as ak\n",
|
||||
"import numpy as np\n",
|
||||
"input_tree = uproot.open({\"/work/guenther/reco_tuner/data/param_data_selected.root\": \"Selected\"})\n",
|
||||
"array = input_tree.arrays()\n",
|
||||
"array[\"dSlope_xEndT\"] = array[\"tx_l11\"] - array[\"tx\"]\n",
|
||||
"array[\"dSlope_yEndT\"] = array[\"ty_l11\"] - array[\"ty\"]\n",
|
||||
"array[\"dSlope_xEndT_abs\"] = abs(array[\"dSlope_xEndT\"])\n",
|
||||
"array[\"dSlope_yEndT_abs\"] = abs(array[\"dSlope_yEndT\"])\n",
|
||||
"array[\"yStraightEndT\"] = array[\"y\"] + array[\"ty\"] * ( 9410. - array[\"z\"])\n",
|
||||
"array[\"yDiffEndT\"] = (array[\"y_l11\"] + array[\"ty_l11\"] * ( 9410. - array[\"z_l11\"])) - array[\"yStraightEndT\"]\n",
|
||||
"\n",
|
||||
"def format_array(name, coef):\n",
|
||||
" coef = [str(c)+\"f\" for c in coef if c != 0.0]\n",
|
||||
" code = f\"constexpr std::array {name}\"\n",
|
||||
" code += \"{\" + \", \".join(list(coef)) +\"};\"\n",
|
||||
" return code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 89,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"['dSlope_yEndT' 'ty dSlope_yEndT_abs' 'ty tx dSlope_xEndT'\n",
|
||||
" 'ty dSlope_xEndT^2' 'ty dSlope_yEndT^2' 'tx^2 dSlope_yEndT'\n",
|
||||
" 'ty tx^2 dSlope_xEndT_abs' 'ty^3 tx dSlope_xEndT']\n",
|
||||
"intercept= 0.0\n",
|
||||
"coef= {}\n",
|
||||
"r2 score= 0.9971571295750978\n",
|
||||
"RMSE = 2.422206064647647\n",
|
||||
"straight RMSE = 45.67726454181064\n",
|
||||
"constexpr std::array y_xEndT_diff{4039.5218935644916f, 1463.501458069602f, 2210.102099471291f, 1537.0718454152473f, -411.54564619803864f, 2594.7244053238287f, -1030.7643414023526f, 14904.842115636024f};\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from sklearn.preprocessing import PolynomialFeatures\n",
|
||||
"from sklearn.linear_model import LinearRegression, Lasso, Ridge\n",
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
"from sklearn.pipeline import Pipeline\n",
|
||||
"from sklearn.metrics import mean_squared_error\n",
|
||||
"\n",
|
||||
"features = [\n",
|
||||
" \"ty\", \n",
|
||||
" \"tx\",\n",
|
||||
" \"dSlope_xEndT\",\n",
|
||||
" \"dSlope_yEndT\",\n",
|
||||
" \"dSlope_xEndT_abs\",\n",
|
||||
" \"dSlope_yEndT_abs\",\n",
|
||||
"]\n",
|
||||
"target_feat = \"yDiffEndT\"\n",
|
||||
"\n",
|
||||
"data = np.column_stack([ak.to_numpy(array[feat]) for feat in features])\n",
|
||||
"target = ak.to_numpy(array[target_feat])\n",
|
||||
"X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=42)\n",
|
||||
"\n",
|
||||
"poly = PolynomialFeatures(degree=6, include_bias=False)\n",
|
||||
"X_train_model = poly.fit_transform( X_train )\n",
|
||||
"X_test_model = poly.fit_transform( X_test )\n",
|
||||
"poly_features = poly.get_feature_names_out(input_features=features)\n",
|
||||
"keep = [\n",
|
||||
" #'dSlope_xEndT',\n",
|
||||
" 'dSlope_yEndT', # keep\n",
|
||||
" #'dSlope_yEndT_abs',\n",
|
||||
" #'ty dSlope_xEndT',\n",
|
||||
" #'ty dSlope_yEndT',\n",
|
||||
" 'ty dSlope_xEndT_abs', # keep\n",
|
||||
" 'ty dSlope_yEndT_abs', #keep\n",
|
||||
" 'ty dSlope_yEndT^2', # keep \n",
|
||||
" 'ty dSlope_xEndT^2', # keep\n",
|
||||
" #'tx dSlope_xEndT',\n",
|
||||
" #'tx dSlope_xEndT_abs',\n",
|
||||
" #'tx dSlope_yEndT',\n",
|
||||
" 'ty tx dSlope_xEndT', #keep\n",
|
||||
" 'tx^2 dSlope_yEndT', # keep\n",
|
||||
" #'ty^2 dSlope_xEndT',\n",
|
||||
" #'ty^2 dSlope_yEndT', \n",
|
||||
" #'ty^2 dSlope_xEndT_abs',\n",
|
||||
" #'ty^2 tx dSlope_xEndT',\n",
|
||||
" #'ty tx^2 dSlope_yEndT',\n",
|
||||
" 'ty tx^2 dSlope_xEndT_abs', # keep\n",
|
||||
" 'ty^3 tx dSlope_xEndT', #keep\n",
|
||||
" #'ty tx^3 dSlope_xEndT',\n",
|
||||
" #'ty^3 dSlope_yEndT_abs',\n",
|
||||
"]\n",
|
||||
"do_not_keep = [\n",
|
||||
" 'dSlope_xEndT',\n",
|
||||
" 'dSlope_yEndT_abs',\n",
|
||||
" 'ty dSlope_xEndT',\n",
|
||||
" 'tx dSlope_xEndT',\n",
|
||||
" 'tx dSlope_xEndT_abs',\n",
|
||||
" 'tx dSlope_yEndT',\n",
|
||||
" 'ty^2 dSlope_xEndT',\n",
|
||||
" 'ty^3 dSlope_yEndT_abs',\n",
|
||||
" 'ty tx dSlope_yEndT',\n",
|
||||
" 'ty tx^3 dSlope_xEndT',\n",
|
||||
" 'ty tx^2 dSlope_yEndT',\n",
|
||||
"]\n",
|
||||
"reduce = True\n",
|
||||
"if reduce:\n",
|
||||
" remove = [i for i, f in enumerate(poly_features) if (keep and f not in keep )]\n",
|
||||
" X_train_model = np.delete( X_train_model, remove, axis=1)\n",
|
||||
" X_test_model = np.delete( X_test_model, remove, axis=1)\n",
|
||||
" poly_features = np.delete(poly_features, remove )\n",
|
||||
" print(poly_features)\n",
|
||||
"if not reduce:\n",
|
||||
" remove = [i for i, f in enumerate(poly_features) if (\"dSlope_\" not in f) or (\"EndT^\" in f) or (\"abs^\" in f) or (\"EndT dSlope\" in f) or (\"abs dSlope\" in f)]\n",
|
||||
" X_train_model = np.delete( X_train_model, remove, axis=1)\n",
|
||||
" X_test_model = np.delete( X_test_model, remove, axis=1)\n",
|
||||
" poly_features = np.delete(poly_features, remove )\n",
|
||||
" #print(poly_features)\n",
|
||||
" lin_reg = Lasso(fit_intercept=False, alpha=0.000001)\n",
|
||||
"else:\n",
|
||||
" lin_reg = LinearRegression(fit_intercept=False)\n",
|
||||
"lin_reg.fit( X_train_model, y_train)\n",
|
||||
"y_pred_test = lin_reg.predict( X_test_model )\n",
|
||||
"print(\"intercept=\", lin_reg.intercept_)\n",
|
||||
"print(\"coef=\", {k: v for k, v in zip(poly_features, lin_reg.coef_) if abs(v) > 1.0 and k not in keep and k not in do_not_keep})\n",
|
||||
"print(\"r2 score=\", lin_reg.score(X_test_model, y_test))\n",
|
||||
"print(\"RMSE =\", mean_squared_error(y_test, y_pred_test, squared=False))\n",
|
||||
"print(\"straight RMSE =\", mean_squared_error(array[\"y_l11\"], array[\"y\"] + array[\"ty\"] * ( array[\"z_l11\"] - array[\"z\"] ), squared=False))\n",
|
||||
"print(format_array(\"y_xEndT_diff\", lin_reg.coef_))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.10.6 (conda)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
},
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "a2eff8b4da8b8eebf5ee2e5f811f31a557e0a202b4d2f04f849b065340a6eda6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
242
parameterisations/notebooks/hough_histogram.ipynb
Normal file
242
parameterisations/notebooks/hough_histogram.ipynb
Normal file
File diff suppressed because one or more lines are too long
933
parameterisations/notebooks/magnet_kink_position.ipynb
Normal file
933
parameterisations/notebooks/magnet_kink_position.ipynb
Normal file
File diff suppressed because one or more lines are too long
212
parameterisations/notebooks/momentum.ipynb
Normal file
212
parameterisations/notebooks/momentum.ipynb
Normal file
File diff suppressed because one or more lines are too long
244
parameterisations/notebooks/polarity_check.ipynb
Normal file
244
parameterisations/notebooks/polarity_check.ipynb
Normal file
File diff suppressed because one or more lines are too long
308
parameterisations/notebooks/search_window.ipynb
Normal file
308
parameterisations/notebooks/search_window.ipynb
Normal file
File diff suppressed because one or more lines are too long
234
parameterisations/notebooks/study_z_ref.ipynb
Normal file
234
parameterisations/notebooks/study_z_ref.ipynb
Normal file
File diff suppressed because one or more lines are too long
366
parameterisations/notebooks/x_curvature.ipynb
Normal file
366
parameterisations/notebooks/x_curvature.ipynb
Normal file
File diff suppressed because one or more lines are too long
717
parameterisations/notebooks/y_curvature.ipynb
Normal file
717
parameterisations/notebooks/y_curvature.ipynb
Normal file
File diff suppressed because one or more lines are too long
99
parameterisations/parameterise_field_integral.py
Normal file
99
parameterisations/parameterise_field_integral.py
Normal file
@ -0,0 +1,99 @@
|
||||
from parameterisations.utils.fit_linear_regression_model import (
|
||||
fit_linear_regression_model,
|
||||
)
|
||||
from parameterisations.utils.parse_regression_coef_to_array import (
|
||||
parse_regression_coef_to_array,
|
||||
)
|
||||
import uproot
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parameterise_field_integral(
|
||||
input_file: str = "data/param_data_selected_all_p.root",
|
||||
tree_name: str = "Selected",
|
||||
) -> Path:
|
||||
"""Function to estimate parameters describing the magnetic field integral.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/param_data_selected_all_p.root".
|
||||
tree_name (str, optional): Defaults to "Selected".
|
||||
|
||||
Returns:
|
||||
Path: Path to the parameters in cpp format.
|
||||
"""
|
||||
input_tree = uproot.open({input_file: tree_name})
|
||||
# this is an event list of dictionaries containing awkward arrays
|
||||
array = input_tree.arrays()
|
||||
array["dSlope_fringe"] = array["tx_ref"] - array["tx"]
|
||||
array["poqmag_gev"] = 1.0 / (array["signed_rel_current"] * array["qop"] * 1000.0)
|
||||
array["B_integral"] = array["poqmag_gev"] * array["dSlope_fringe"]
|
||||
|
||||
model_ref, poly_features_ref = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="B_integral",
|
||||
features=[
|
||||
"ty",
|
||||
"tx",
|
||||
"tx_ref",
|
||||
],
|
||||
keep=[
|
||||
"ty^2",
|
||||
"tx^2",
|
||||
"tx tx_ref",
|
||||
"tx_ref^2",
|
||||
"ty^2 tx tx_ref",
|
||||
"ty^2 tx^2",
|
||||
"ty^2 tx_ref^2",
|
||||
"tx^4",
|
||||
"ty^4",
|
||||
"tx_ref^4",
|
||||
"tx^3 tx_ref",
|
||||
],
|
||||
degree=5,
|
||||
fit_intercept=True,
|
||||
)
|
||||
cpp_ref = parse_regression_coef_to_array(
|
||||
model_ref,
|
||||
poly_features_ref,
|
||||
"fieldIntegralParamsRef",
|
||||
)
|
||||
outpath = Path("parameterisations/result/field_integral_params.hpp")
|
||||
outpath.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(outpath, "w") as result:
|
||||
result.writelines(cpp_ref)
|
||||
return outpath
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tree-name",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
outfile = parameterise_field_integral(**args_dict)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
94
parameterisations/parameterise_hough_histogram.py
Normal file
94
parameterisations/parameterise_hough_histogram.py
Normal file
@ -0,0 +1,94 @@
|
||||
import uproot
|
||||
import awkward as ak
|
||||
from pathlib import Path
|
||||
from scipy.optimize import curve_fit
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from math import ceil
|
||||
import argparse
|
||||
|
||||
|
||||
def fastSigmoid(x, p0, p1, p2):
|
||||
return p0 + p1 * x / (1 + abs(p2 * x))
|
||||
|
||||
|
||||
def parameterise_hough_histogram(
|
||||
input_file: str = "data/param_data_selected_all_p.root",
|
||||
tree_name: str = "Selected",
|
||||
n_bins_start: int = 900,
|
||||
hist_range: tuple[float, float] = (-3000.0, 3000.0),
|
||||
first_bin_center: float = 2.5,
|
||||
) -> Path:
|
||||
"""Function to parameterise the binning of the Hough histogram using the occupancy on the reference plane.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/param_data_selected_all_p.root".
|
||||
tree_name (str, optional): Defaults to "Selected".
|
||||
n_bins_start (int, optional): Starting (minimal) number of bins in histogram. Defaults to 900.
|
||||
hist_range (tuple[float, float], optional): Range in mm the histogram covers. Defaults to (-3000.0, 3000.0).
|
||||
first_bin_center (float, optional): Calculated bin center at lower range. Defaults to 2.5.
|
||||
|
||||
Returns:
|
||||
Path: Path to cpp code file.
|
||||
"""
|
||||
input_tree = uproot.open({input_file: tree_name})
|
||||
# this is an event list of dictionaries containing awkward arrays
|
||||
array = input_tree.arrays()
|
||||
array = array[[field for field in ak.fields(array) if "scifi_hit" not in field]]
|
||||
df = ak.to_pandas(array)
|
||||
selection = (df["x_ref"] > hist_range[0]) & (df["x_ref"] < hist_range[1])
|
||||
data = df.loc[selection, "x_ref"]
|
||||
_, equal_bins = pd.qcut(data, q=n_bins_start, retbins=True)
|
||||
bin_numbering = np.arange(0, n_bins_start + 1)
|
||||
equalbins_center = equal_bins[int(n_bins_start / 10) : int(9 * n_bins_start / 10)]
|
||||
bin_numbering_center = bin_numbering[
|
||||
int(n_bins_start / 10) : int(9 * n_bins_start / 10)
|
||||
]
|
||||
func = fastSigmoid
|
||||
popt, _ = curve_fit(func, xdata=equalbins_center, ydata=bin_numbering_center)
|
||||
print("Parameterisation for central occupancy:")
|
||||
print("fastSigmoid(x,", *popt, ")")
|
||||
print("Scan shift to match first bin center ...")
|
||||
shift = 0.0
|
||||
while func(hist_range[0], popt[0] + shift, *popt[1:]) < first_bin_center:
|
||||
shift += 0.1
|
||||
popt[0] += shift - 0.1
|
||||
popt[2] = abs(popt[2])
|
||||
print("shifted: fastSigmoid(x,", *popt, ")")
|
||||
n_bins_final = ceil(func(hist_range[1], *popt))
|
||||
print(
|
||||
"Final number of bins:",
|
||||
n_bins_final,
|
||||
"including offset of",
|
||||
int(first_bin_center),
|
||||
)
|
||||
comment = f"// p[0] + p[1] * x / (1 + p[2] * abs(x)) for nBins = {n_bins_final}\n"
|
||||
cpp = (
|
||||
"constexpr auto p = std::array{"
|
||||
+ ", ".join([str(p) + "f" for p in popt])
|
||||
+ "};"
|
||||
)
|
||||
outpath = Path("parameterisations/result/hough_histogram_binning_params.hpp")
|
||||
outpath.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(outpath, "w") as result:
|
||||
result.writelines([comment, cpp])
|
||||
return outpath
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tree-name",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
outfile = parameterise_hough_histogram(**args_dict)
|
162
parameterisations/parameterise_magnet_kink.py
Normal file
162
parameterisations/parameterise_magnet_kink.py
Normal file
@ -0,0 +1,162 @@
|
||||
from parameterisations.utils.parse_regression_coef_to_array import (
|
||||
parse_regression_coef_to_array,
|
||||
)
|
||||
from parameterisations.utils.fit_linear_regression_model import (
|
||||
fit_linear_regression_model,
|
||||
)
|
||||
import uproot
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parameterise_magnet_kink(
|
||||
input_file: str = "data/param_data_selected.root",
|
||||
tree_name: str = "Selected",
|
||||
per_layer=False,
|
||||
) -> Path:
|
||||
"""Function that calculates parameters for estimating the magnet kink z position.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/param_data_selected.root".
|
||||
tree_name (str, optional): Defaults to "Selected".
|
||||
per_layer (bool, optional): If true also calculates parameters per SciFi layer. Defaults to False.
|
||||
|
||||
Returns:
|
||||
Path: Path to cpp code file.
|
||||
"""
|
||||
input_tree = uproot.open({input_file: tree_name})
|
||||
# this is an event list of dictionaries containing awkward arrays
|
||||
array = input_tree.arrays()
|
||||
array["dSlope_fringe"] = array["tx_ref"] - array["tx"]
|
||||
# the magnet kink position is the point of intersection of the track tagents
|
||||
array["z_mag_x_fringe"] = (
|
||||
array["x"]
|
||||
- array["x_ref"]
|
||||
- array["tx"] * array["z"]
|
||||
+ array["tx_ref"] * array["z_ref"]
|
||||
) / array["dSlope_fringe"]
|
||||
array["dSlope_xEndT"] = array["tx_l11"] - array["tx"]
|
||||
array["dSlope_xEndT_abs"] = abs(array["dSlope_xEndT"])
|
||||
array["x_EndT_abs"] = abs(
|
||||
array["x_l11"] + array["tx_l11"] * (9410.0 - array["z_l11"]),
|
||||
)
|
||||
# the magnet kink position is the point of intersection of the track tagents
|
||||
array["z_mag_xEndT"] = (
|
||||
array["x"]
|
||||
- array["x_l11"]
|
||||
- array["tx"] * array["z"]
|
||||
+ array["tx_l11"] * array["z_l11"]
|
||||
) / array["dSlope_xEndT"]
|
||||
|
||||
if per_layer:
|
||||
layered_features = [f"x_diff_straight_l{layer}" for layer in range(12)]
|
||||
rows = []
|
||||
for i, feat in enumerate(layered_features):
|
||||
scale = 3000
|
||||
if "dSlope" not in feat:
|
||||
array[f"x_l{i}_rel"] = array[f"x_l{i}"] / scale
|
||||
array[f"x_diff_straight_l{i}"] = (
|
||||
array[f"x_l{i}"]
|
||||
- array["x"]
|
||||
- array["tx"] * (array[f"z_l{i}"] - array["z"])
|
||||
)
|
||||
|
||||
model, poly_features = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="z_mag_x_fringe",
|
||||
features=[
|
||||
"tx",
|
||||
"ty",
|
||||
feat,
|
||||
],
|
||||
keep=[
|
||||
"tx^2",
|
||||
f"tx x_diff_straight_l{i}",
|
||||
"ty^2",
|
||||
f"x_diff_straight_l{i}^2",
|
||||
],
|
||||
degree=2,
|
||||
fit_intercept=True,
|
||||
)
|
||||
rows.append(
|
||||
"{"
|
||||
+ str(model.intercept_)
|
||||
+ "f,"
|
||||
+ ",".join([str(coef) + "f" for coef in model.coef_ if coef != 0.0])
|
||||
+ "}",
|
||||
)
|
||||
|
||||
cpp_decl = parse_regression_coef_to_array(
|
||||
model,
|
||||
poly_features,
|
||||
"zMagnetParamsLayers",
|
||||
rows=rows,
|
||||
)
|
||||
# now fit model for the reference plane
|
||||
model_ref, poly_features_ref = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="z_mag_x_fringe",
|
||||
features=["tx", "ty", "dSlope_fringe"],
|
||||
keep=["tx^2", "tx dSlope_fringe", "ty^2", "dSlope_fringe^2"],
|
||||
degree=2,
|
||||
fit_intercept=True,
|
||||
)
|
||||
cpp_ref = parse_regression_coef_to_array(
|
||||
model_ref,
|
||||
poly_features_ref,
|
||||
"zMagnetParamsRef",
|
||||
)
|
||||
|
||||
model_endt, poly_features_endt = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="z_mag_xEndT",
|
||||
features=["tx", "dSlope_xEndT", "dSlope_xEndT_abs", "x_EndT_abs"],
|
||||
keep=["tx^2", "dSlope_xEndT^2", "dSlope_xEndT_abs", "x_EndT_abs"],
|
||||
degree=2,
|
||||
fit_intercept=True,
|
||||
)
|
||||
cpp_ref += parse_regression_coef_to_array(
|
||||
model_endt,
|
||||
poly_features_endt,
|
||||
"zMagnetParamsEndT",
|
||||
)
|
||||
|
||||
outpath = Path("parameterisations/result/z_mag_kink_params.hpp")
|
||||
outpath.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(outpath, "w") as result:
|
||||
result.writelines(cpp_decl + cpp_ref if per_layer else cpp_ref)
|
||||
return outpath
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tree-name",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
outfile = parameterise_magnet_kink(**args_dict)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
101
parameterisations/parameterise_search_window.py
Normal file
101
parameterisations/parameterise_search_window.py
Normal file
@ -0,0 +1,101 @@
|
||||
from parameterisations.utils.parse_regression_coef_to_array import (
|
||||
parse_regression_coef_to_array,
|
||||
)
|
||||
from parameterisations.utils.fit_linear_regression_model import (
|
||||
fit_linear_regression_model,
|
||||
)
|
||||
import uproot
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parameterise_search_window(
|
||||
input_file: str = "data/param_data_selected_all_p.root",
|
||||
tree_name: str = "Selected",
|
||||
) -> Path:
|
||||
"""Function that calculates parameters for estimating the hit search window border.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/param_data_selected.root".
|
||||
tree_name (str, optional): Defaults to "Selected".
|
||||
|
||||
Returns:
|
||||
Path: Path to cpp code file.
|
||||
"""
|
||||
input_tree = uproot.open({input_file: tree_name})
|
||||
# this is an event list of dictionaries containing awkward arrays
|
||||
array = input_tree.arrays()
|
||||
array["x_straight_diff_ref"] = (
|
||||
array["x"] + array["tx"] * (array["z_ref"] - array["z"]) - array["x_ref"]
|
||||
)
|
||||
array["x_straight_diff_ref_abs"] = abs(array["x_straight_diff_ref"])
|
||||
array["inv_p_gev"] = 1000.0 / array["p"]
|
||||
array["pol_qop_gev"] = array["signed_rel_current"] * array["qop"] * 1000.0
|
||||
|
||||
# now fit model for the reference plane
|
||||
model_ref, poly_features_ref = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="x_straight_diff_ref_abs",
|
||||
features=["ty", "tx", "inv_p_gev", "pol_qop_gev"],
|
||||
keep=[
|
||||
"inv_p_gev",
|
||||
"ty^2 inv_p_gev",
|
||||
"tx^2 inv_p_gev",
|
||||
"tx inv_p_gev pol_qop_gev",
|
||||
"inv_p_gev^3",
|
||||
"tx^3 pol_qop_gev",
|
||||
"tx^2 inv_p_gev^2",
|
||||
"tx inv_p_gev^2 pol_qop_gev",
|
||||
"inv_p_gev^4",
|
||||
"ty^2 tx^2 inv_p_gev",
|
||||
"ty^2 tx inv_p_gev pol_qop_gev",
|
||||
"ty^2 inv_p_gev^3",
|
||||
"tx^4 inv_p_gev",
|
||||
],
|
||||
degree=5,
|
||||
fit_intercept=False,
|
||||
)
|
||||
cpp_ref = parse_regression_coef_to_array(
|
||||
model_ref,
|
||||
poly_features_ref,
|
||||
"momentumWindowParamsRef",
|
||||
)
|
||||
outpath = Path("parameterisations/result/search_window_params.hpp")
|
||||
outpath.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(outpath, "w") as result:
|
||||
result.writelines(cpp_ref)
|
||||
return outpath
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tree-name",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
outfile = parameterise_search_window(**args_dict)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
256
parameterisations/parameterise_track_model.py
Normal file
256
parameterisations/parameterise_track_model.py
Normal file
@ -0,0 +1,256 @@
|
||||
from parameterisations.utils.parse_regression_coef_to_array import (
|
||||
parse_regression_coef_to_array,
|
||||
)
|
||||
from parameterisations.utils.fit_linear_regression_model import (
|
||||
fit_linear_regression_model,
|
||||
)
|
||||
import uproot
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parameterise_track_model(
|
||||
input_file: str = "data/param_data_selected.root",
|
||||
tree_name: str = "Selected",
|
||||
) -> Path:
|
||||
"""Function that calculates the parameterisations to estimate track model coefficients.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/param_data_selected.root".
|
||||
tree_name (str, optional): Defaults to "Selected".
|
||||
|
||||
Returns:
|
||||
Path: Path to cpp code files containing the found parameters.
|
||||
"""
|
||||
input_tree = uproot.open({input_file: tree_name})
|
||||
# this is an event list of dictionaries containing awkward arrays
|
||||
array = input_tree.arrays()
|
||||
array["dSlope_fringe"] = array["tx_ref"] - array["tx"]
|
||||
array["dSlope_fringe_abs"] = abs(array["dSlope_fringe"])
|
||||
array["yStraightRef"] = array["y"] + array["ty"] * (array["z_ref"] - array["z"])
|
||||
array["y_ref_straight_diff"] = array["y_ref"] - array["yStraightRef"]
|
||||
array["ty_ref_straight_diff"] = array["ty_ref"] - array["ty"]
|
||||
array["dSlope_xEndT"] = array["tx_l11"] - array["tx"]
|
||||
array["dSlope_yEndT"] = array["ty_l11"] - array["ty"]
|
||||
array["dSlope_xEndT_abs"] = abs(array["dSlope_xEndT"])
|
||||
array["dSlope_yEndT_abs"] = abs(array["dSlope_yEndT"])
|
||||
array["yStraightOut"] = array["y"] + array["ty"] * (array["z_out"] - array["z"])
|
||||
array["yDiffOut"] = array["y_out"] - array["yStraightOut"]
|
||||
array["yStraightEndT"] = array["y"] + array["ty"] * (9410.0 - array["z"])
|
||||
array["yDiffEndT"] = (
|
||||
array["y_l11"] + array["ty_l11"] * (9410.0 - array["z_l11"])
|
||||
) - array["yStraightEndT"]
|
||||
|
||||
stereo_layers = [1, 2, 5, 6, 9, 10]
|
||||
for layer in stereo_layers:
|
||||
array[f"y_straight_diff_l{layer}"] = (
|
||||
array[f"y_l{layer}"]
|
||||
- array["y"]
|
||||
- array["ty"] * (array[f"z_l{layer}"] - array["z"])
|
||||
)
|
||||
|
||||
model_cx, poly_features_cx = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="CX_ex",
|
||||
features=["tx", "ty", "dSlope_fringe"],
|
||||
degree=3,
|
||||
keep_only_linear_in="dSlope_fringe",
|
||||
fit_intercept=False,
|
||||
)
|
||||
model_dx, poly_features_dx = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="DX_ex",
|
||||
features=["tx", "ty", "dSlope_fringe"],
|
||||
degree=3,
|
||||
keep_only_linear_in="dSlope_fringe",
|
||||
fit_intercept=False,
|
||||
)
|
||||
# this list has been found empirically by C.Hasse
|
||||
keep_y_corr = [
|
||||
"ty dSlope_fringe_abs",
|
||||
"ty tx^2 dSlope_fringe_abs",
|
||||
"ty^3 dSlope_fringe_abs",
|
||||
"ty^3 tx^2 dSlope_fringe_abs",
|
||||
"dSlope_fringe",
|
||||
"ty tx dSlope_fringe",
|
||||
"ty tx^3 dSlope_fringe",
|
||||
"ty^3 tx dSlope_fringe",
|
||||
]
|
||||
model_y_corr_ref, poly_features_y_corr_ref = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="y_ref_straight_diff",
|
||||
features=["ty", "tx", "dSlope_fringe", "dSlope_fringe_abs"],
|
||||
keep=keep_y_corr,
|
||||
degree=6,
|
||||
fit_intercept=False,
|
||||
)
|
||||
rows = []
|
||||
for layer in stereo_layers:
|
||||
model_y_corr_l, poly_features_y_corr_l = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat=f"y_straight_diff_l{layer}",
|
||||
features=["ty", "tx", "dSlope_fringe", "dSlope_fringe_abs"],
|
||||
keep=keep_y_corr,
|
||||
degree=6,
|
||||
fit_intercept=False,
|
||||
)
|
||||
rows.append(
|
||||
"{"
|
||||
+ ",".join(
|
||||
[str(coef) + "f" for coef in model_y_corr_l.coef_ if coef != 0.0],
|
||||
)
|
||||
+ "}",
|
||||
)
|
||||
|
||||
model_ty_corr_ref, poly_features_ty_corr_ref = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="ty_ref_straight_diff",
|
||||
features=["ty", "tx", "dSlope_fringe", "dSlope_fringe_abs"],
|
||||
# this list was found by using Lasso regularisation to drop useless features
|
||||
keep=[
|
||||
"ty dSlope_fringe^2",
|
||||
"ty tx^2 dSlope_fringe_abs",
|
||||
"ty^3 dSlope_fringe_abs",
|
||||
"ty^3 tx^2 dSlope_fringe_abs",
|
||||
"ty tx dSlope_fringe",
|
||||
"ty tx^3 dSlope_fringe",
|
||||
],
|
||||
degree=6,
|
||||
fit_intercept=False,
|
||||
)
|
||||
|
||||
model_cy, poly_features_cy = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="CY_ex",
|
||||
features=["ty", "tx", "dSlope_fringe", "dSlope_fringe_abs"],
|
||||
# this list was found by using Lasso regularisation to drop useless features
|
||||
keep=[
|
||||
"ty dSlope_fringe^2",
|
||||
"ty dSlope_fringe_abs",
|
||||
"ty tx^2 dSlope_fringe_abs",
|
||||
"ty^3 dSlope_fringe_abs",
|
||||
"ty tx dSlope_fringe",
|
||||
],
|
||||
degree=4,
|
||||
fit_intercept=False,
|
||||
)
|
||||
|
||||
model_y_match, poly_features_y_match = fit_linear_regression_model(
|
||||
array,
|
||||
target_feat="yDiffOut",
|
||||
features=[
|
||||
"ty",
|
||||
"dSlope_xEndT",
|
||||
"dSlope_yEndT",
|
||||
],
|
||||
keep=[
|
||||
"ty dSlope_yEndT^2",
|
||||
"ty dSlope_xEndT^2",
|
||||
],
|
||||
degree=3,
|
||||
fit_intercept=False,
|
||||
)
|
||||
keep_y_match_precise = [
|
||||
"dSlope_yEndT",
|
||||
"ty dSlope_xEndT_abs",
|
||||
"ty dSlope_yEndT_abs",
|
||||
"ty dSlope_yEndT^2",
|
||||
"ty dSlope_xEndT^2",
|
||||
"ty tx dSlope_xEndT",
|
||||
"tx^2 dSlope_yEndT",
|
||||
"ty tx^2 dSlope_xEndT_abs",
|
||||
"ty^3 tx dSlope_xEndT",
|
||||
]
|
||||
model_y_match_precise, poly_features_y_match_precise = fit_linear_regression_model(
|
||||
array,
|
||||
"yDiffEndT",
|
||||
[
|
||||
"ty",
|
||||
"tx",
|
||||
"dSlope_xEndT",
|
||||
"dSlope_yEndT",
|
||||
"dSlope_xEndT_abs",
|
||||
"dSlope_yEndT_abs",
|
||||
],
|
||||
keep=keep_y_match_precise,
|
||||
degree=5,
|
||||
)
|
||||
|
||||
cpp_cx = parse_regression_coef_to_array(model_cx, poly_features_cx, "cxParams")
|
||||
cpp_dx = parse_regression_coef_to_array(model_dx, poly_features_dx, "dxParams")
|
||||
cpp_y_corr_layers = parse_regression_coef_to_array(
|
||||
model_y_corr_l,
|
||||
poly_features_y_corr_l,
|
||||
"yCorrParamsLayers",
|
||||
rows=rows,
|
||||
)
|
||||
cpp_y_corr_ref = parse_regression_coef_to_array(
|
||||
model_y_corr_ref,
|
||||
poly_features_y_corr_ref,
|
||||
"yCorrParamsRef",
|
||||
)
|
||||
cpp_ty_corr_ref = parse_regression_coef_to_array(
|
||||
model_ty_corr_ref,
|
||||
poly_features_ty_corr_ref,
|
||||
"tyCorrParamsRef",
|
||||
)
|
||||
cpp_cy = parse_regression_coef_to_array(model_cy, poly_features_cy, "cyParams")
|
||||
cpp_y_match = parse_regression_coef_to_array(
|
||||
model_y_match,
|
||||
poly_features_y_match,
|
||||
"bendYParamsMatch",
|
||||
)
|
||||
cpp_y_match_precise = parse_regression_coef_to_array(
|
||||
model_y_match_precise,
|
||||
poly_features_y_match_precise,
|
||||
"bendYParams",
|
||||
)
|
||||
|
||||
outpath = Path("parameterisations/result/track_model_params.hpp")
|
||||
outpath.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(outpath, "w") as result:
|
||||
result.writelines(
|
||||
cpp_cx
|
||||
+ cpp_dx
|
||||
+ cpp_y_corr_layers
|
||||
+ cpp_y_corr_ref
|
||||
+ cpp_ty_corr_ref
|
||||
+ cpp_cy
|
||||
+ cpp_y_match
|
||||
+ cpp_y_match_precise,
|
||||
)
|
||||
return outpath
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--tree-name",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
outfile = parameterise_track_model(**args_dict)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
262
parameterisations/residual_train_matching_ghost_mlps_electron.py
Normal file
262
parameterisations/residual_train_matching_ghost_mlps_electron.py
Normal file
@ -0,0 +1,262 @@
|
||||
# flake8: noqaq
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import ROOT
|
||||
from ROOT import TMVA, TList, TTree
|
||||
|
||||
|
||||
def res_train_matching_ghost_mlp(
|
||||
input_file: str = "data/ghost_data_B.root",
|
||||
tree_name: str = "PrMatchNN.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
exclude_electrons: bool = False,
|
||||
only_electrons: bool = True,
|
||||
residuals: str = "None",
|
||||
n_train_signal: int = 2e3, # 50e3
|
||||
n_train_bkg: int = 5e3, # 500e3
|
||||
n_test_signal: int = 1e3,
|
||||
n_test_bkg: int = 2e3,
|
||||
prepare_data: bool = True,
|
||||
outdir: str = "nn_electron_training",
|
||||
):
|
||||
"""Trains an MLP to classify the match between Velo and Seed track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data.root".
|
||||
tree_name (str, optional): Defaults to "PrMatchNN.PrMCDebugMatchToolNN/Tuple".
|
||||
exclude_electrons (bool, optional): Defaults to False.
|
||||
only_electrons (bool, optional): Signal only of electrons, but bkg of all particles. Defaults to True.
|
||||
residuals (bool, optional): Signal only of mlp<0.215. Defaults to False.
|
||||
n_train_signal (int, optional): Number of true matches to train on. Defaults to 200e3.
|
||||
n_train_bkg (int, optional): Number of fake matches to train on. Defaults to 200e3.
|
||||
n_test_signal (int, optional): Number of true matches to test on. Defaults to 75e3.
|
||||
n_test_bkg (int, optional): Number of fake matches to test on. Defaults to 75e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
|
||||
if prepare_data and not residuals == "None":
|
||||
resrdf = ROOT.RDataFrame(residuals, input_file)
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
if exclude_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"quality == 1 && mlp<0.215", # -1 elec, 0 ghost, 1 all part wo elec
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
rdf_bkg = rdf.Filter(
|
||||
"quality == 0 && mlp<0.215",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
resrdf_signal = resrdf.Filter(
|
||||
"quality == 1", # -1 elec, 0 ghost, 1 all part wo elec
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
resrdf_bkg = resrdf.Filter(
|
||||
"quality == 0",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
else:
|
||||
if only_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"quality == -1 && mlp<0.215", # electron that is true match but mlp said no match
|
||||
"Signal is defined as one label (only electrons)",
|
||||
)
|
||||
resrdf_signal = resrdf.Filter(
|
||||
"quality == -1", # electron that is true match but mlp said no match
|
||||
"Signal is defined as one label (only electrons)",
|
||||
)
|
||||
else:
|
||||
rdf_signal = rdf.Filter(
|
||||
"abs(quality) > 0 && mlp<0.215",
|
||||
"Signal is defined as non-zero label",
|
||||
)
|
||||
resrdf_signal = resrdf.Filter(
|
||||
"abs(quality) > 0",
|
||||
"Signal is defined as non-zero label",
|
||||
)
|
||||
rdf_bkg = rdf.Filter(
|
||||
"quality == 0 && mlp<0.215",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
resrdf_bkg = resrdf.Filter(
|
||||
"quality == 0",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
outdir + "/" + input_file.strip(".root") + "_mlp_matching_signal.root",
|
||||
)
|
||||
rdf_bkg.Snapshot(
|
||||
"Bkg",
|
||||
outdir + "/" + input_file.strip(".root") + "_mlp_matching_bkg.root",
|
||||
)
|
||||
resrdf_signal.Snapshot(
|
||||
"Signal",
|
||||
outdir + "/" + input_file.strip(".root") + "_res_matching_signal.root",
|
||||
)
|
||||
resrdf_bkg.Snapshot(
|
||||
"Bkg",
|
||||
outdir + "/" + input_file.strip(".root") + "_res_matching_bkg.root",
|
||||
)
|
||||
|
||||
mlp_signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_mlp_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
mlp_signal_tree = mlp_signal_file.Get("Signal")
|
||||
|
||||
mlp_bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_mlp_matching_bkg.root",
|
||||
"READ",
|
||||
)
|
||||
mlp_bkg_tree = mlp_bkg_file.Get("Bkg")
|
||||
####
|
||||
|
||||
res_signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_res_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
res_signal_tree = res_signal_file.Get("Signal")
|
||||
|
||||
outputsignalFile = ROOT.TFile(
|
||||
outdir + "/" + input_file.strip(".root") + "_merged_matching_signal.root",
|
||||
"RECREATE",
|
||||
)
|
||||
signaltreeList = TList()
|
||||
|
||||
signaltreeList.Add(mlp_signal_tree)
|
||||
signaltreeList.Add(res_signal_tree)
|
||||
|
||||
mergedsignalTree = TTree.MergeTrees(signaltreeList)
|
||||
mergedsignalTree.Write()
|
||||
outputsignalFile.Close()
|
||||
|
||||
res_bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_res_matching_bkg.root",
|
||||
"READ",
|
||||
)
|
||||
res_bkg_tree = res_bkg_file.Get("Bkg")
|
||||
|
||||
outputbkgFile = ROOT.TFile(
|
||||
outdir + "/" + input_file.strip(".root") + "_merged_matching_bkg.root",
|
||||
"RECREATE",
|
||||
)
|
||||
bkgtreeList = TList()
|
||||
|
||||
bkgtreeList.Add(mlp_bkg_tree)
|
||||
bkgtreeList.Add(res_bkg_tree)
|
||||
|
||||
mergedbkgTree = TTree.MergeTrees(bkgtreeList)
|
||||
mergedbkgTree.Write()
|
||||
outputbkgFile.Close()
|
||||
|
||||
#####
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_merged_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
|
||||
bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_merged_matching_bkg.root"
|
||||
)
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
###
|
||||
|
||||
os.chdir(outdir + "/result")
|
||||
output = ROOT.TFile(
|
||||
"matching_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("MatchNNDataSet")
|
||||
|
||||
dataloader.AddVariable("chi2", "F")
|
||||
dataloader.AddVariable("teta2", "F")
|
||||
dataloader.AddVariable("distX", "F")
|
||||
dataloader.AddVariable("distY", "F")
|
||||
dataloader.AddVariable("dSlope", "F")
|
||||
dataloader.AddVariable("dSlopeY", "F")
|
||||
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
|
||||
# these cuts are also applied in the algorithm
|
||||
preselectionCuts = ROOT.TCut(
|
||||
# "chi2<30 && distX<500 && distY<500 && dSlope<2.0 && dSlopeY<0.15", #### ganz raus für elektronen
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
# normmode default is EqualNumEvents
|
||||
)
|
||||
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"matching_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude_electrons",
|
||||
action="store_true",
|
||||
help="Excludes electrons from training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--only_electrons",
|
||||
action="store_true",
|
||||
help="Only electrons for signal training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-signal",
|
||||
type=int,
|
||||
help="Number of training tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-bkg",
|
||||
type=int,
|
||||
help="Number of training tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-signal",
|
||||
type=int,
|
||||
help="Number of testing tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-bkg",
|
||||
type=int,
|
||||
help="Number of testing tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
|
||||
res_train_matching_ghost_mlp(**args_dict)
|
108
parameterisations/result/default_forward_ghost.hpp
Normal file
108
parameterisations/result/default_forward_ghost.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
constexpr auto fMin = std::array<float, 9>{
|
||||
{0.00086611090228, 0.000137108087074, 9.1552734375e-05, 1.52587890625e-05,
|
||||
1.49011611938e-08, 0, 3.38108901987e-10, 0, 0}};
|
||||
constexpr auto fMax =
|
||||
std::array<float, 9>{{7.99757671356, 139.755401611, 499.902832031,
|
||||
139.934204102, 0.0548411794007, 0.33653563261,
|
||||
0.0011771483114, 0.614122271538, 0.0932129621506}};
|
||||
constexpr auto fWeightMatrix0to1 = std::array<std::array<float, 10>, 13>{
|
||||
{{0.272388837195353, 1.04297766281443, 7.10858971290199, 8.20176699323914,
|
||||
-17.4998198279343, -0.903938445734019, -4.45523353351358,
|
||||
0.202604346228416, -0.343763626116408, -6.0398577123475},
|
||||
{1.17259942394887, -0.372252986403353, -0.172055869721126,
|
||||
4.32425941771619, 0.980522044689679, -0.486163242078544, 4.89499262471543,
|
||||
-2.19861130758734, -9.43992619200679, -2.37510165732473},
|
||||
{-0.312463651685767, -0.114031703331406, -0.643524084362763,
|
||||
-0.130218804467335, 0.0672200809874041, 0.492579418283905,
|
||||
10.0423165027703, -9.1229718440813, -3.21081732473868, -3.78681415782996},
|
||||
{0.285964399088691, 3.50382532157828, 0.202967804648741, -2.34731912244972,
|
||||
-1.01724465412901, 6.94879051931226, 1.42757737963066, -0.414886005380144,
|
||||
-5.12456720768917, -5.42877386327517},
|
||||
{-1.17951731489478, -0.786765172581322, -4.2989135483231, 4.05294030963229,
|
||||
-0.127313249850962, -4.14839099916227, 3.23904819574731,
|
||||
-13.6552536266634, 20.5968822768501, 6.85315498878814},
|
||||
{0.103392918358953, 1.44880697882548, 0.577811396176936, 1.10045098601948,
|
||||
-0.178340433397024, -17.8770425761109, 3.7017773013521, -23.3892167651105,
|
||||
15.0495143106538, -17.4605298799865},
|
||||
{-1.64979711432504, 0.774908843327995, 3.31059510110807, -3.1819692768259,
|
||||
7.12231795634781, -0.241753227182394, -0.977884374115893,
|
||||
0.952532388892299, 0.723099651883065, 6.54591062809547},
|
||||
{-0.0534432249645241, 3.9887257817946, -1.49200429968719, 11.8855727958475,
|
||||
1.04666107895933, 0.238167385927067, -17.6503013604389, -0.6355065389129,
|
||||
34.3524751991456, 32.5893217368421},
|
||||
{0.386236757608688, -3.68207271228384, -1.59827939590235,
|
||||
-5.63561468820375, -2.05612305429069, -0.414007692878055,
|
||||
-2.30218891934988, -1.45254018219727, -41.888511388421,
|
||||
-55.4154956571825},
|
||||
{-0.33882942035142, 0.828500879691617, -1.11913145963814, 5.44432070997378,
|
||||
0.593216106072808, -0.335356938266522, -4.29488215708929,
|
||||
-0.45349431026542, 12.6168245530257, 11.203180125896},
|
||||
{-5.06732270572528, -0.747932010258911, -1.32944569630483,
|
||||
0.399754582341283, -1.22419379102021, -0.0632059754142294,
|
||||
-3.9176205612916, 4.95338770012354, -10.0874931996749, -13.4899867496953},
|
||||
{-0.652708751114843, 0.153993426617753, 0.507696533435112,
|
||||
-0.0829575859982346, -1.26075671332944, -1.72921422048723,
|
||||
0.436623404900834, 1.2481716555653, 4.75489497214422, 0.917647460712304},
|
||||
{-0.337064695166363, 1.6829713570542, -1.24667087979073, 4.38935163725774,
|
||||
0.546771935887102, 0.380216805759757, -4.27094569696754, 1.60030195739679,
|
||||
21.1019766790379, 22.9277879180437}}};
|
||||
constexpr auto fWeightMatrix1to2 = std::array<std::array<float, 14>, 11>{
|
||||
{{0.942639197400156, -0.0931922637028017, 1.16131136847027,
|
||||
-0.463586546886379, -0.00734730684531865, 0.659865738065189,
|
||||
-0.0819640968388477, 0.716168152659691, 0.0594465496519534,
|
||||
-3.09809338025968, -0.993314598112327, -0.626796644903994,
|
||||
1.18112507293241, -7.53912207323744},
|
||||
{-0.290157117133191, -1.44319213353958, 0.976801127908426,
|
||||
1.83059667355593, -0.579127895773621, -0.959358564216034,
|
||||
-0.200943614057267, 2.26102190218572, 0.680574054232225,
|
||||
0.512044291258324, 0.441279132836691, 0.195148753454237,
|
||||
-4.40558418761793, -2.59697427283538},
|
||||
{0.231019193167673, -0.33534671921076, -4.02952877004057,
|
||||
0.328301743837591, -0.935217897351683, 0.656308147872124,
|
||||
0.148770195853327, -1.02822979925373, -1.15074999231744, 1.25931257478392,
|
||||
-5.51506732446672, 2.76878002159781, 1.15670995216412, -1.81920686548505},
|
||||
{-1.4433538095335, -1.39651294706804, -0.0384612540687588,
|
||||
-0.643375798593072, -0.125102719515762, -0.654090297545811,
|
||||
-1.64699393573932, -0.508246308405062, -0.781867310732538,
|
||||
1.0126843726006, -1.62926724862902, 1.36812357325107, -0.529386420395731,
|
||||
-0.0138925908234309},
|
||||
{-1.41898718038457, 0.477953102899375, -0.322619989760896,
|
||||
1.09732380296345, -0.782655793929218, 0.462713092659323,
|
||||
-2.94842712863178, -0.132292667509809, 0.0769059927035169,
|
||||
1.19584278425479, -1.05534832662164, -0.531211272706436,
|
||||
-0.611338365394562, 3.05377051979242},
|
||||
{-1.24565900961033, -0.803882286327658, 0.779616435095014,
|
||||
-0.149080238970127, -1.12090436198206, -0.881759817062632,
|
||||
-2.29233937767415, -1.47774128243345, 1.08239889708401, 2.24462771397501,
|
||||
0.485265744305715, -1.48553084966211, -0.0143728439705144,
|
||||
3.27583681932498},
|
||||
{-0.28996288685836, 0.780550033512762, -2.15121583289839, 1.20922563714172,
|
||||
-0.644843512306469, -0.234457523529768, -0.231658959155198,
|
||||
0.218579418768696, -0.395509623165805, -0.411218621945028,
|
||||
-1.02932631809835, -0.376223727062923, -0.340041262998441,
|
||||
3.63881067894002},
|
||||
{1.44978573970303, -2.18583173535086, -0.846483915375948,
|
||||
0.105328656470861, 1.87072932363927, -0.00190765575147529,
|
||||
0.584012973055999, -1.39776672542255, -0.180232469445207,
|
||||
-1.98952098967519, -1.37262959684684, -0.90548142705001,
|
||||
-0.920429811986854, -2.99277232574331},
|
||||
{0.921784086695698, 0.803938386481379, -0.793436984418934,
|
||||
-0.198036997127606, 0.88955947123962, 0.62100428659737, 1.37636249959335,
|
||||
0.820454358047461, -0.632502523362294, -2.07934437515782,
|
||||
-0.181199371886594, -3.08568993123453, -0.36401687310168,
|
||||
-2.43212452146954},
|
||||
{0.699249590603178, 0.278024565615921, -0.198350259368371,
|
||||
-0.783418866551348, 0.118700073145684, 0.21833431656626, 1.65512324292893,
|
||||
-0.111147682703641, 1.3283515189562, -0.246599469063488,
|
||||
0.754508475403135, 0.00506528019287302, 0.166494023039331,
|
||||
-4.84019659854236},
|
||||
{0.298019259877464, 0.00346409235528412, 1.35256951642456,
|
||||
0.869362943235745, -1.52238605698392, 1.83110259539772,
|
||||
-0.878203306047072, -0.0145711167869491, -2.02333355061148,
|
||||
0.870770188694429, 0.379444379601702, 0.418591035142932, 0.19006790384741,
|
||||
-4.59660818674123}}};
|
||||
constexpr auto fWeightMatrix2to3 = std::array<float, 12>{
|
||||
{0.283357190373951, -0.505821393459412, -0.992928878077031,
|
||||
1.46980063870956, -0.393221447900897, 0.68377817358151, -0.516508953958371,
|
||||
-0.282023879956352, -0.65334083539925, 0.526593979331363,
|
||||
-0.157977106282126, 1.39115062576625}};
|
9
parameterisations/result/field_integral_params.hpp
Normal file
9
parameterisations/result/field_integral_params.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
// param[0] + param[1]*ty^2 + param[2]*tx^2 + param[3]*tx tx_ref +
|
||||
// param[4]*tx_ref^2 + param[5]*ty^4 + param[6]*ty^2 tx^2 + param[7]*ty^2 tx
|
||||
// tx_ref + param[8]*ty^2 tx_ref^2 + param[9]*tx^4 + param[10]*tx^3 tx_ref +
|
||||
// param[11]*tx_ref^4
|
||||
static constexpr std::array<float, 12> fieldIntegralParamsRef{
|
||||
-1.2094486121528516f, -2.7897043324822492f, -0.35976930628193077f,
|
||||
-0.47138558705675454f, -0.5600847231491961f, 14.009315350693472f,
|
||||
-16.162818973243674f, -8.807994419844437f, -0.8753190393972976f,
|
||||
2.98254201374128f, 0.9625408279466898f, 0.10200564097830103f};
|
@ -0,0 +1,3 @@
|
||||
// p[0] + p[1] * x / (1 + p[2] * abs(x)) for nBins = 1152
|
||||
constexpr auto p =
|
||||
std::array{576.9713937732083f, 0.5780266207743059f, 0.0006728484590464921f};
|
36
parameterisations/result/matching.hpp
Normal file
36
parameterisations/result/matching.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
const auto fMin = std::array<simd::float_v, 6>{{6.2234539655e-06, 1.07554035367e-06, 0, 0, 1.38022005558e-06, 0}};
|
||||
const auto fMax = std::array<simd::float_v, 6>{
|
||||
{14.9999675751, 0.414966464043, 249.946044922, 399.411682129, 1.32134592533, 0.148659110069}};
|
||||
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
|
||||
{{-1.81318680192985, 11.5306183035191, -1.52244588205196, -2.18285669265567, 5.01352644485465,
|
||||
-5.51296033910149, 5.73927468893956},
|
||||
{-0.672534709795381, -3.00002957605882, 6.88356805276872, -6.22160659721202, 6.77446979297102,
|
||||
3.22745998562836, 2.16560576533548},
|
||||
{0.671467962865227, -5.25794414846222, 19.3828230421486, 11.0803546893003, -6.38234816567783,
|
||||
-8.90286557784295, 10.7684525390767},
|
||||
{-0.2692056487945, -45.0124720478328, 3.02956760827695, -5.39985352881923, 2.33235637852444, 3.67377088731803,
|
||||
-41.6892338123688},
|
||||
{-1.7097866252219, -2.44815463022872, -6.25060061923427, -2.9527155271918, -2.82646287573035,
|
||||
-2.57930159017213, -15.3820440704287},
|
||||
{-1.05477315994645, 10.922735030486, 3.15543979640938, -1.83775727341147, 7.65261550754585, -6.94317448033313,
|
||||
6.86131922732798},
|
||||
{-0.79066972900182, -0.617757099680603, 0.740878002718091, 0.681870030239224, -1.20759406685829,
|
||||
0.769290467724204, -1.8437808630988},
|
||||
{-0.184133955272691, 1.92932229057759, 10.2040343486098, 4.08783185462586, -2.02695228923391,
|
||||
-3.00792235466827, 10.2821397360227}}};
|
||||
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
|
||||
{{-0.529669554811976, -2.45282233466048, 1.45989990967879, 3.56480948423982, 0.687553026936273,
|
||||
1.78027012856298, 1.63438201788813, -2.94255147008571, -2.10797233521637},
|
||||
{1.36475059953963, 0.542190986793164, -0.135276688209357, -0.761685823733301, 0.679401991574712,
|
||||
-1.40198671179551, -1.61531096417457, -0.791464040720268, 0.852677079400607},
|
||||
{0.767942415115046, -2.97714597002192, -3.5629451506092, -2.69040161409325, 3.21229316674369,
|
||||
0.688654835034672, -0.825543426908553, -1.84996857815595, -7.69537697905136},
|
||||
{0.114639040310829, -0.37219550277267, -1.42908394861416, -1.86752756108709, -0.839837159377482,
|
||||
-1.70735346337309, 1.61348068527877, -1.66550797875971, -0.949665027488677},
|
||||
{-0.0439008856537062, 0.14714685191285, -0.900218617709006, 0.734110875341394, -3.26381964641836,
|
||||
-0.903556360012639, -0.848898627795279, 2.4264150318668, 0.290359165274663},
|
||||
{0.404515384352441, -0.158287682443141, -1.5660040193724, -1.64457334373498, 0.883554107720622,
|
||||
-1.48730815915072, -1.52203810494393, 3.67527716420631, -0.393484682839}}};
|
||||
const auto fWeightMatrix2to3 =
|
||||
std::array<simd::float_v, 7>{{-0.776910463978178, 0.811895970822024, 0.775804138783722, 0.282335113136984,
|
||||
-0.612856158181358, 0.786801771324536, -2.16123706007375}};
|
11
parameterisations/result/search_window_params.hpp
Normal file
11
parameterisations/result/search_window_params.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
// param[0]*inv_p_gev + param[1]*ty^2 inv_p_gev + param[2]*tx^2 inv_p_gev +
|
||||
// param[3]*tx inv_p_gev pol_qop_gev + param[4]*inv_p_gev^3 + param[5]*tx^3
|
||||
// pol_qop_gev + param[6]*tx^2 inv_p_gev^2 + param[7]*tx inv_p_gev^2 pol_qop_gev
|
||||
// + param[8]*inv_p_gev^4 + param[9]*ty^2 tx^2 inv_p_gev + param[10]*ty^2 tx
|
||||
// inv_p_gev pol_qop_gev + param[11]*ty^2 inv_p_gev^3 + param[12]*tx^4 inv_p_gev
|
||||
static constexpr std::array<float, 13> momentumWindowParamsRef{
|
||||
4018.896625676043f, 6724.789549369031f, 3970.9093976497766f,
|
||||
-4363.5807241252905f, 1421.1056758688073f, 4934.07761471779f,
|
||||
6985.252911263751f, -5538.28013195104f, 1642.8616070452542f,
|
||||
106068.96918885755f, -94446.81037767915f, 26489.793756692892f,
|
||||
-23936.54391006025f};
|
58
parameterisations/result/track_model_params.hpp
Normal file
58
parameterisations/result/track_model_params.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
// param[0]*dSlope_fringe + param[1]*tx dSlope_fringe + param[2]*ty
|
||||
// dSlope_fringe + param[3]*tx^2 dSlope_fringe + param[4]*tx ty dSlope_fringe +
|
||||
// param[5]*ty^2 dSlope_fringe
|
||||
static constexpr std::array<float, 6> cxParams{
|
||||
2.335283084724005e-05f, -5.394341220986507e-08f, -1.1353152524130453e-06f,
|
||||
9.213281616649267e-06f, -6.76457896718169e-07f, -0.0003740758569392804f};
|
||||
// param[0]*dSlope_fringe + param[1]*tx dSlope_fringe + param[2]*ty
|
||||
// dSlope_fringe + param[3]*tx^2 dSlope_fringe + param[4]*tx ty dSlope_fringe +
|
||||
// param[5]*ty^2 dSlope_fringe
|
||||
static constexpr std::array<float, 6> dxParams{
|
||||
-7.057523874477465e-09f, 1.0524178059699073e-11f, 6.46124765440666e-10f,
|
||||
2.595690034874298e-09f, 8.044356540608104e-11f, 9.933758467661586e-08f};
|
||||
// param[0]*dSlope_fringe + param[1]*ty dSlope_fringe_abs + param[2]*ty tx
|
||||
// dSlope_fringe + param[3]*ty^3 dSlope_fringe_abs + param[4]*ty tx^2
|
||||
// dSlope_fringe_abs + param[5]*ty^3 tx dSlope_fringe + param[6]*ty tx^3
|
||||
// dSlope_fringe + param[7]*ty^3 tx^2 dSlope_fringe_abs
|
||||
static constexpr std::array<std::array<float, 8>, 6> yCorrParamsLayers{
|
||||
{{1.9141402652138315f, 154.61935746400832f, 3719.298754021463f,
|
||||
-6981.575944838166f, -67.7612042340458f, 41484.88865215446f,
|
||||
30544.717526101966f, 211219.00520598015f},
|
||||
{1.9802106454737567f, 146.34197177414035f, 3766.9995843145575f,
|
||||
-7381.001822418669f, 18.407833054380728f, 42635.398541425144f,
|
||||
31434.95400997568f, 218404.36150766257f},
|
||||
{2.6036680178541256f, 53.231282135657125f, 4236.335446831202f,
|
||||
-10844.798302911375f, 986.1498917330866f, 52670.269097485856f,
|
||||
39380.4857744525f, 281250.90766092145f},
|
||||
{2.6802443731107797f, 40.75834605688442f, 4296.645356936966f,
|
||||
-11234.776424245354f, 1115.363228090216f, 53813.817216417505f,
|
||||
40299.07624778942f, 288431.507847565f},
|
||||
{3.3827128857688793f, -76.61325300322648f, 4875.424130053332f,
|
||||
-14585.199358667853f, 2322.162251501158f, 63618.048819648175f,
|
||||
48278.83901554796f, 350657.56046107266f},
|
||||
{3.4657288815375846f, -90.58976402034898f, 4946.538479838353f,
|
||||
-14962.319670402725f, 2464.758450826609f, 64707.51942328425f,
|
||||
49179.43246319585f, 357681.17176708044f}}};
|
||||
// param[0]*dSlope_fringe + param[1]*ty dSlope_fringe_abs + param[2]*ty tx
|
||||
// dSlope_fringe + param[3]*ty^3 dSlope_fringe_abs + param[4]*ty tx^2
|
||||
// dSlope_fringe_abs + param[5]*ty^3 tx dSlope_fringe + param[6]*ty tx^3
|
||||
// dSlope_fringe + param[7]*ty^3 tx^2 dSlope_fringe_abs
|
||||
static constexpr std::array<float, 8> yCorrParamsRef{
|
||||
2.5415524238347658f, 63.25841388467006f, 4187.534822693825f,
|
||||
-10520.25391602297f, 881.6859925052617f, 51730.04107647908f,
|
||||
38622.50428524951f, 275325.5721020971f};
|
||||
// param[0]*ty tx dSlope_fringe + param[1]*ty dSlope_fringe^2 + param[2]*ty^3
|
||||
// dSlope_fringe_abs + param[3]*ty tx^2 dSlope_fringe_abs + param[4]*ty tx^3
|
||||
// dSlope_fringe + param[5]*ty^3 tx^2 dSlope_fringe_abs
|
||||
static constexpr std::array<float, 6> tyCorrParamsRef{
|
||||
0.9346197967408639f, -0.4658007458482092f, -4.119808929050499f,
|
||||
2.9514781492224613f, 12.5961355543964f, 39.98472114588754f};
|
||||
// param[0]*ty dSlope_fringe_abs + param[1]*ty tx dSlope_fringe + param[2]*ty
|
||||
// dSlope_fringe^2 + param[3]*ty^3 dSlope_fringe_abs + param[4]*ty tx^2
|
||||
// dSlope_fringe_abs
|
||||
static constexpr std::array<float, 5> cyParams{
|
||||
-1.2034772990836242e-05f, 8.344645618037317e-05f, -3.924972865228243e-05f,
|
||||
0.00024639290417116324f, 0.0001867723161873795f};
|
||||
// param[0]*ty dSlope_xEndT^2 + param[1]*ty dSlope_yEndT^2
|
||||
static constexpr std::array<float, 2> bendYParams{-1974.6355416889746f,
|
||||
-35933.837494833504f};
|
57
parameterisations/result/veloUT_forward_ghost.hpp
Normal file
57
parameterisations/result/veloUT_forward_ghost.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
constexpr auto fMin =
|
||||
std::array<float, 10>{{-5.79507064819, 0.000539337401278, 6.44962929073e-05,
|
||||
9.1552734375e-05, 0, 0, 0, 1.27572263864e-09, 0, 0}};
|
||||
constexpr auto fMax = std::array<float, 10>{
|
||||
{21.3727073669, 7.9990901947, 139.93737793, 499.828094482, 139.837768555,
|
||||
0.0549617446959, 0.281096696854, 0.00079078116687, 0.349586248398,
|
||||
0.0576412677765}};
|
||||
constexpr auto fWeightMatrix0to1 = std::array<std::array<float, 11>, 12>{
|
||||
{{-5.19794815568925, 1.87197537853549, -1.10717797757926, -2.86970252748238,
|
||||
-6.34055081230473, -5.00759687179371, 0.31193986693587, -8.01387747621716,
|
||||
-0.120803639675188, -22.2071141316253, -38.8490339403707},
|
||||
{20.4100238181115, 0.792781537499611, -2.30137034971144, 1.16999587784412,
|
||||
0.889469621266034, 0.239667010403193, -0.969309214660315,
|
||||
5.21461903375948, 0.348799845137009, -3.7347620794893, 0.25771517766665},
|
||||
{-2.13629241669652, -0.353986293257471, 9.61086066828255,
|
||||
-2.33661235049463, 1.93528728163342, -0.843722079096251,
|
||||
0.999688424438972, -8.55711877917878, 1.02394998490757, -15.267288590286,
|
||||
-13.235596389738},
|
||||
{23.4650215184851, -0.726082462224456, 0.941255141296868,
|
||||
-1.25219178023961, 1.87830610438659, -0.0626703177011942,
|
||||
0.798264835732211, 2.24872165119832, 0.499173544293671, -1.38568068487979,
|
||||
-2.73161981770289},
|
||||
{2.57560609203081, 0.129379326313481, -4.39493675912134, 0.755378151374909,
|
||||
-4.00108724778843, 0.203477875797884, -1.08477900245397,
|
||||
-7.03054484748858, -1.09623688169448, -26.3844077677349,
|
||||
-41.2491346895123},
|
||||
{-0.768854476049515, 0.0931802742811194, 0.0821972098693852,
|
||||
-3.89193022157862, 14.9873083975585, 1.28580626432386, -0.181845844796471,
|
||||
-8.47241051331203, -0.943962517139566, 6.01103622570362,
|
||||
9.48437982003848},
|
||||
{0.178040151771032, 0.136134754761245, -0.787571684703651,
|
||||
2.32182273660402, 7.30437794491034, -16.4278614062814, -0.113422629084682,
|
||||
-1.0680200019718, -0.568606303594401, 1.0249516698155, -7.95920000382392},
|
||||
{0.675546296267863, -0.385104312033727, -0.205638813395668,
|
||||
-3.31653776098415, 10.5616483640347, 0.218068680685705, 0.605728183391577,
|
||||
-4.63802179325434, -0.254055135097754, 5.28618861484003,
|
||||
6.64663231117868},
|
||||
{-4.21416802017974, -1.23106312717449, -1.75652044911551,
|
||||
-1.53276007675347, -1.36027716886005, -1.6755055391045, 0.843394761591634,
|
||||
6.71332112562865, -3.21984188557587, -2.49871614350354,
|
||||
-5.16629424142249},
|
||||
{-3.17947657486281, -2.70445335081074, 1.17896471286998, -1.88889268162012,
|
||||
0.115966139146512, -1.69860246319196, -0.329404631248515,
|
||||
-6.09206258757561, 3.39801515225553, -3.44730923665625,
|
||||
-7.36048093738012},
|
||||
{-12.1422669814385, -0.937172442798055, 2.04047673532808, -0.2149743778283,
|
||||
-2.6487701795534, -2.62694503937013, -0.530083657842696, -14.923114328578,
|
||||
-0.317336092090262, 23.1177068701846, 6.21557901179705},
|
||||
{2.9112902347786, -4.39915513290615, -6.29077091232232, -3.50206937799633,
|
||||
-0.367072002518522, 0.145186305220916, -6.21085587377794,
|
||||
11.6250310635655, -7.43312502309394, 3.26005495282282,
|
||||
-11.6647818884921}}};
|
||||
constexpr auto fWeightMatrix1to2 = std::array<float, 13>{
|
||||
{0.737121712699059, -1.04254794966614, -0.789570860582197, 1.11549851568754,
|
||||
1.5426749194788, -1.2610505044793, -0.630483186934049, 1.57472828085649,
|
||||
0.790891919516845, 0.937883258898894, -0.781778561713509,
|
||||
-0.610089040707349, -0.385566736632017}};
|
10
parameterisations/result/z_mag_kink_params.hpp
Normal file
10
parameterisations/result/z_mag_kink_params.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
// param[0] + param[1]*tx^2 + param[2]*tx dSlope_fringe + param[3]*ty^2 +
|
||||
// param[4]*dSlope_fringe^2
|
||||
static constexpr std::array<float, 5> zMagnetParamsRef{
|
||||
5205.144186525624f, -320.7206595710594f, 702.1384894815535f,
|
||||
-316.36350963107543f, 441.59909857558097f};
|
||||
// param[0] + param[1]*dSlope_xEndT_abs + param[2]*x_EndT_abs + param[3]*tx^2 +
|
||||
// param[4]*dSlope_xEndT^2
|
||||
static constexpr std::array<float, 5> zMagnetParamsEndT{
|
||||
5286.687877988849f, -3.259689996453795f, 0.015615778872337033f,
|
||||
-1377.3175211789967f, 282.9821232487341f};
|
261
parameterisations/train_forward_ghost_mlps.py
Normal file
261
parameterisations/train_forward_ghost_mlps.py
Normal file
@ -0,0 +1,261 @@
|
||||
import os
|
||||
import argparse
|
||||
import ROOT
|
||||
from ROOT import TMVA
|
||||
|
||||
|
||||
def train_default_forward_ghost_mlp(
|
||||
input_file: str = "data/ghost_data.root",
|
||||
tree_name: str = "PrForwardTrackingVelo.PrMCDebugForwardTool/MVAInput",
|
||||
exclude_electrons: bool = False,
|
||||
n_train_signal: int = 300e3,
|
||||
n_train_bkg: int = 300e3,
|
||||
n_test_signal: int = 50e3,
|
||||
n_test_bkg: int = 50e3,
|
||||
prepare_data: bool = False,
|
||||
):
|
||||
"""Trains an MLP to classify track candidates from PrForwardTrackingVelo as ghost or Long Track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data.root".
|
||||
tree_name (str, optional): Defaults to "PrForwardTrackingVelo.PrMCDebugForwardTool/MVAInput".
|
||||
exclude_electrons (bool, optional): Defaults to False.
|
||||
n_train_signal (int, optional): Number of true tracks to train on. Defaults to 750e3.
|
||||
n_train_bkg (int, optional): Number of fake tracks to train on. Defaults to 750e3.
|
||||
n_test_signal (int, optional): Number of true tracks to test on. Defaults to 50e3.
|
||||
n_test_bkg (int, optional): umber of fake tracks to test on. Defaults to 50e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
if prepare_data:
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
if exclude_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"label == 1",
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
rdf_bkg = rdf.Filter("label == 0", "Ghosts are defined as zero label")
|
||||
else:
|
||||
rdf_signal = rdf.Filter("label > 0", "Signal is defined as non-zero label")
|
||||
rdf_bkg = rdf.Filter("label == 0", "Ghosts are defined as zero label")
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
input_file.strip(".root") + "_forward_signal.root",
|
||||
)
|
||||
rdf_bkg.Snapshot("Bkg", input_file.strip(".root") + "_forward_bkg.root")
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
input_file.strip(".root") + "_forward_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
bkg_file = ROOT.TFile.Open(input_file.strip(".root") + "_forward_bkg.root")
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
os.chdir("neural_net_training/result")
|
||||
output = ROOT.TFile(
|
||||
"default_forward_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("GhostNNDataSet")
|
||||
dataloader.AddVariable("redChi2", "F")
|
||||
dataloader.AddVariable(
|
||||
"distXMatch := abs((x + ( zMagMatch - 770.0 ) * tx) - (xEndT + ( zMagMatch - 9410.0 ) * txEndT))",
|
||||
"F",
|
||||
)
|
||||
dataloader.AddVariable(
|
||||
"distY := abs(ySeedMatch - yEndT)",
|
||||
"F",
|
||||
)
|
||||
dataloader.AddVariable("abs(yParam0Final-yParam0Init)", "F")
|
||||
dataloader.AddVariable("abs(yParam1Final-yParam1Init)", "F")
|
||||
dataloader.AddVariable("abs(ty)", "F")
|
||||
dataloader.AddVariable("abs(qop)", "F")
|
||||
dataloader.AddVariable("abs(tx)", "F")
|
||||
dataloader.AddVariable("abs(xParam1Final-xParam1Init)", "F")
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
preselectionCuts = ROOT.TCut(
|
||||
"redChi2 < 8 && abs((x + ( zMagMatch - 770.0 ) * tx) - (xEndT + ( zMagMatch - 9410.0 ) * txEndT)) < 140 && abs(ySeedMatch - yEndT) < 500 && abs(yParam0Final-yParam0Init) < 140 && abs(yParam1Final-yParam1Init) < 0.055",
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"NormMode=NumEvents:SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
)
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"default_forward_ghost_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=750:HiddenLayers=N+4,N+2:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.005:!UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
def train_veloUT_forward_ghost_mlp(
|
||||
input_file: str = "data/ghost_data.root",
|
||||
tree_name: str = "PrForwardTracking.PrMCDebugForwardTool/MVAInput",
|
||||
exclude_electrons: bool = False,
|
||||
n_train_signal: int = 300e3,
|
||||
n_train_bkg: int = 300e3,
|
||||
n_test_signal: int = 50e3,
|
||||
n_test_bkg: int = 50e3,
|
||||
prepare_data: bool = False,
|
||||
):
|
||||
"""Trains an MLP to classify track candidates from PrForwardTracking as ghost or Long Track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data.root".
|
||||
tree_name (str, optional): Defaults to "PrForwardTracking.PrMCDebugForwardTool/MVAInput".
|
||||
exclude_electrons (bool, optional): Defaults to False.
|
||||
n_train_signal (int, optional): Number of true tracks to train on. Defaults to 750e3.
|
||||
n_train_bkg (int, optional): Number of fake tracks to train on. Defaults to 750e3.
|
||||
n_test_signal (int, optional): Number of true tracks to test on. Defaults to 50e3.
|
||||
n_test_bkg (int, optional): umber of fake tracks to test on. Defaults to 50e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
if prepare_data:
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
if exclude_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"label == 1",
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
rdf_bkg = rdf.Filter("label == 0", "Ghosts are defined as zero label")
|
||||
else:
|
||||
rdf_signal = rdf.Filter("label > 0", "Signal is defined as non-zero label")
|
||||
rdf_bkg = rdf.Filter("label == 0", "Ghosts are defined as zero label")
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
input_file.strip(".root") + "_forward_velout_signal.root",
|
||||
)
|
||||
rdf_bkg.Snapshot("Bkg", input_file.strip(".root") + "_forward_velout_bkg.root")
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
input_file.strip(".root") + "_forward_velout_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
bkg_file = ROOT.TFile.Open(input_file.strip(".root") + "_forward_velout_bkg.root")
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
os.chdir("neural_net_training/result")
|
||||
output = ROOT.TFile(
|
||||
"veloUT_forward_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("GhostNNDataSet")
|
||||
dataloader.AddVariable("dMom := log(abs((1.0/qop) - (1.0/qopUT) ))", "F")
|
||||
dataloader.AddVariable("redChi2", "F")
|
||||
dataloader.AddVariable(
|
||||
"distXMatch := abs((x + ( zMagMatch - 770.0 ) * tx) - (xEndT + ( zMagMatch - 9410.0 ) * txEndT))",
|
||||
"F",
|
||||
)
|
||||
dataloader.AddVariable(
|
||||
"distY := abs(ySeedMatch - yEndT)",
|
||||
"F",
|
||||
)
|
||||
dataloader.AddVariable("abs(yParam0Final-yParam0Init)", "F")
|
||||
dataloader.AddVariable("abs(yParam1Final-yParam1Init)", "F")
|
||||
dataloader.AddVariable("abs(ty)", "F")
|
||||
dataloader.AddVariable("abs(qop)", "F")
|
||||
dataloader.AddVariable("abs(tx)", "F")
|
||||
dataloader.AddVariable("abs(xParam1Final-xParam1Init)", "F")
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
preselectionCuts = ROOT.TCut(
|
||||
"redChi2 < 8 && abs((x + ( zMagMatch - 770.0 ) * tx) - (xEndT + ( zMagMatch - 9410.0 ) * txEndT)) < 140 && abs(ySeedMatch - yEndT) < 500 && abs(yParam0Final-yParam0Init) < 140 && abs(yParam1Final-yParam1Init) < 0.055",
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"NormMode=NumEvents:SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
)
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"veloUT_forward_ghost_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=550:HiddenLayers=N+2:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.005:!UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude_electrons",
|
||||
action="store_true",
|
||||
help="Excludes electrons from training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-signal",
|
||||
type=int,
|
||||
help="Number of training tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-bkg",
|
||||
type=int,
|
||||
help="Number of training tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-signal",
|
||||
type=int,
|
||||
help="Number of testing tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-bkg",
|
||||
type=int,
|
||||
help="Number of testing tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--veloUT",
|
||||
action="store_true",
|
||||
help="Toggle whether the NN for upstream tracks input is trained.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--all",
|
||||
action="store_true",
|
||||
help="Toggle whether both NNs are trained, for VELO and VeloUT input.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args_dict = {
|
||||
arg: val
|
||||
for arg, val in vars(args).items()
|
||||
if val is not None and arg not in ["veloUT", "all"]
|
||||
}
|
||||
|
||||
if args.all:
|
||||
train_default_forward_ghost_mlp(**args_dict)
|
||||
train_veloUT_forward_ghost_mlp(**args_dict)
|
||||
elif args.veloUT:
|
||||
train_veloUT_forward_ghost_mlp(**args_dict)
|
||||
else:
|
||||
train_default_forward_ghost_mlp(**args_dict)
|
154
parameterisations/train_matching_ghost_mlps.py
Normal file
154
parameterisations/train_matching_ghost_mlps.py
Normal file
@ -0,0 +1,154 @@
|
||||
# flake8: noqaq
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import ROOT
|
||||
from ROOT import TMVA
|
||||
|
||||
|
||||
def train_matching_ghost_mlp(
|
||||
input_file: str = "data/ghost_data_B.root",
|
||||
tree_name: str = "PrMatchNN.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
exclude_electrons: bool = True,
|
||||
n_train_signal: int = 50e3,
|
||||
n_train_bkg: int = 500e3,
|
||||
n_test_signal: int = 10e3,
|
||||
n_test_bkg: int = 100e3,
|
||||
prepare_data: bool = True,
|
||||
outdir: str = "neural_net_training",
|
||||
):
|
||||
"""Trains an MLP to classify the match between Velo and Seed track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data_B.root".
|
||||
tree_name (str, optional): Defaults to "PrMatchNN.PrMCDebugMatchToolNN/Tuple".
|
||||
exclude_electrons (bool, optional): Defaults to True.
|
||||
n_train_signal (int, optional): Number of true matches to train on. Defaults to 200e3.
|
||||
n_train_bkg (int, optional): Number of fake matches to train on. Defaults to 200e3.
|
||||
n_test_signal (int, optional): Number of true matches to test on. Defaults to 75e3.
|
||||
n_test_bkg (int, optional): Number of fake matches to test on. Defaults to 75e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
if prepare_data:
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
if exclude_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"quality == 1", # -1 elec, 0 ghost, 1 all part wo elec
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
rdf_bkg = rdf.Filter("quality == 0", "Ghosts are defined as zero label")
|
||||
else:
|
||||
rdf_signal = rdf.Filter(
|
||||
"abs(quality) > 0",
|
||||
"Signal is defined as non-zero label",
|
||||
)
|
||||
rdf_bkg = rdf.Filter("quality == 0", "Ghosts are defined as zero label")
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
)
|
||||
rdf_bkg.Snapshot(
|
||||
"Bkg", outdir + "/" + input_file.strip(".root") + "_matching_bkg.root"
|
||||
)
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_bkg.root"
|
||||
)
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
os.chdir(outdir + "/result")
|
||||
output = ROOT.TFile(
|
||||
"matching_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("MatchNNDataSet")
|
||||
|
||||
dataloader.AddVariable("chi2", "F")
|
||||
dataloader.AddVariable("teta2", "F")
|
||||
dataloader.AddVariable("distX", "F")
|
||||
dataloader.AddVariable("distY", "F")
|
||||
dataloader.AddVariable("dSlope", "F")
|
||||
dataloader.AddVariable("dSlopeY", "F")
|
||||
# dataloader.AddVariable("tx", "F")
|
||||
# dataloader.AddVariable("ty", "F")
|
||||
# dataloader.AddVariable("tx_scifi", "F")
|
||||
# dataloader.AddVariable("ty_scifi", "F")
|
||||
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
|
||||
# these cuts are also applied in the algorithm
|
||||
preselectionCuts = ROOT.TCut(
|
||||
"chi2<15 && distX<250 && distY<400 && dSlope<1.5 && dSlopeY<0.15", #### ganz raus für elektronen
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
)
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"matching_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude_electrons",
|
||||
action="store_true",
|
||||
help="Excludes electrons from training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-signal",
|
||||
type=int,
|
||||
help="Number of training tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-bkg",
|
||||
type=int,
|
||||
help="Number of training tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-signal",
|
||||
type=int,
|
||||
help="Number of testing tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-bkg",
|
||||
type=int,
|
||||
help="Number of testing tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
|
||||
train_matching_ghost_mlp(**args_dict)
|
177
parameterisations/train_matching_ghost_mlps_electron.py
Normal file
177
parameterisations/train_matching_ghost_mlps_electron.py
Normal file
@ -0,0 +1,177 @@
|
||||
# flake8: noqaq
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import ROOT
|
||||
from ROOT import TMVA, TList, TTree
|
||||
|
||||
|
||||
def train_matching_ghost_mlp(
|
||||
input_file: str = "data/ghost_data_B.root",
|
||||
tree_name: str = "PrMatchNN.PrMCDebugMatchToolNN/MVAInputAndOutput",
|
||||
exclude_electrons: bool = False,
|
||||
only_electrons: bool = True,
|
||||
n_train_signal: int = 20e3, # 50e3
|
||||
n_train_bkg: int = 50e3, # 500e3
|
||||
n_test_signal: int = 10e3,
|
||||
n_test_bkg: int = 20e3,
|
||||
prepare_data: bool = True,
|
||||
outdir: str = "nn_electron_training",
|
||||
):
|
||||
"""Trains an MLP to classify the match between Velo and Seed track.
|
||||
|
||||
Args:
|
||||
input_file (str, optional): Defaults to "data/ghost_data.root".
|
||||
tree_name (str, optional): Defaults to "PrMatchNN.PrMCDebugMatchToolNN/Tuple".
|
||||
exclude_electrons (bool, optional): Defaults to False.
|
||||
only_electrons (bool, optional): Signal only of electrons, but bkg of all particles. Defaults to True.
|
||||
n_train_signal (int, optional): Number of true matches to train on. Defaults to 200e3.
|
||||
n_train_bkg (int, optional): Number of fake matches to train on. Defaults to 200e3.
|
||||
n_test_signal (int, optional): Number of true matches to test on. Defaults to 75e3.
|
||||
n_test_bkg (int, optional): Number of fake matches to test on. Defaults to 75e3.
|
||||
prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
|
||||
"""
|
||||
|
||||
if prepare_data:
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
if exclude_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"mc_quality == 1", # -1 elec, 0 ghost, 1 all part wo elec
|
||||
"Signal is defined as one label (excluding electrons)",
|
||||
)
|
||||
rdf_bkg = rdf.Filter(
|
||||
"mc_quality == 0",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
else:
|
||||
if only_electrons:
|
||||
rdf_signal = rdf.Filter(
|
||||
"mc_quality == -1", # electron that is true match but mlp said no match
|
||||
"Signal is defined as negative one label (only electrons)",
|
||||
)
|
||||
else:
|
||||
rdf_signal = rdf.Filter(
|
||||
"abs(mc_quality) > 0",
|
||||
"Signal is defined as non-zero label",
|
||||
)
|
||||
rdf_bkg = rdf.Filter(
|
||||
"mc_quality == 0",
|
||||
"Ghosts are defined as zero label",
|
||||
)
|
||||
|
||||
rdf_signal.Snapshot(
|
||||
"Signal",
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
)
|
||||
rdf_bkg.Snapshot(
|
||||
"Bkg",
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_bkg.root",
|
||||
)
|
||||
|
||||
signal_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
|
||||
"READ",
|
||||
)
|
||||
signal_tree = signal_file.Get("Signal")
|
||||
|
||||
bkg_file = ROOT.TFile.Open(
|
||||
outdir + "/" + input_file.strip(".root") + "_matching_bkg.root"
|
||||
)
|
||||
bkg_tree = bkg_file.Get("Bkg")
|
||||
|
||||
os.chdir(outdir + "/result")
|
||||
output = ROOT.TFile(
|
||||
"matching_ghost_mlp_training.root",
|
||||
"RECREATE",
|
||||
)
|
||||
|
||||
factory = TMVA.Factory(
|
||||
"TMVAClassification",
|
||||
output,
|
||||
"V:!Silent:Color:DrawProgressBar:AnalysisType=Classification",
|
||||
)
|
||||
factory.SetVerbose(True)
|
||||
dataloader = TMVA.DataLoader("MatchNNDataSet")
|
||||
|
||||
dataloader.AddVariable("mc_chi2", "F")
|
||||
dataloader.AddVariable("mc_teta2", "F")
|
||||
dataloader.AddVariable("mc_distX", "F")
|
||||
dataloader.AddVariable("mc_distY", "F")
|
||||
dataloader.AddVariable("mc_dSlope", "F")
|
||||
dataloader.AddVariable("mc_dSlopeY", "F")
|
||||
dataloader.AddVariable("mc_zMag", "F")
|
||||
|
||||
dataloader.AddSignalTree(signal_tree, 1.0)
|
||||
dataloader.AddBackgroundTree(bkg_tree, 1.0)
|
||||
|
||||
# these cuts are also applied in the algorithm
|
||||
preselectionCuts = ROOT.TCut(
|
||||
# "chi2<30 && distX<500 && distY<500 && dSlope<2.0 && dSlopeY<0.15", #### ganz raus für elektronen
|
||||
)
|
||||
dataloader.PrepareTrainingAndTestTree(
|
||||
preselectionCuts,
|
||||
f"SplitMode=random:V:nTrain_Signal={n_train_signal}:nTrain_Background={n_train_bkg}:nTest_Signal={n_test_signal}:nTest_Background={n_test_bkg}",
|
||||
# normmode default is EqualNumEvents
|
||||
)
|
||||
|
||||
factory.BookMethod(
|
||||
dataloader,
|
||||
TMVA.Types.kMLP,
|
||||
"matching_mlp",
|
||||
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator",
|
||||
)
|
||||
factory.TrainAllMethods()
|
||||
factory.TestAllMethods()
|
||||
factory.EvaluateAllMethods()
|
||||
output.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude_electrons",
|
||||
action="store_true",
|
||||
help="Excludes electrons from training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--only_electrons",
|
||||
action="store_true",
|
||||
help="Only electrons for signal training.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-signal",
|
||||
type=int,
|
||||
help="Number of training tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-train-bkg",
|
||||
type=int,
|
||||
help="Number of training tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-signal",
|
||||
type=int,
|
||||
help="Number of testing tracks for signal.",
|
||||
required=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--n-test-bkg",
|
||||
type=int,
|
||||
help="Number of testing tracks for bkg.",
|
||||
required=False,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
args_dict = {arg: val for arg, val in vars(args).items() if val is not None}
|
||||
|
||||
train_matching_ghost_mlp(**args_dict)
|
91
parameterisations/utils/fit_linear_regression_model.py
Normal file
91
parameterisations/utils/fit_linear_regression_model.py
Normal file
@ -0,0 +1,91 @@
|
||||
import awkward as ak
|
||||
from sklearn.preprocessing import PolynomialFeatures
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.metrics import mean_squared_error
|
||||
import numpy as np
|
||||
|
||||
|
||||
def fit_linear_regression_model(
|
||||
array: ak.Array,
|
||||
target_feat: str,
|
||||
features: list[str],
|
||||
degree: int,
|
||||
keep: list[str] = None,
|
||||
keep_only_linear_in: str = "",
|
||||
remove: list[str] = None,
|
||||
include_bias: bool = False,
|
||||
fit_intercept: bool = False,
|
||||
test_size=0.2,
|
||||
random_state=42,
|
||||
) -> tuple[LinearRegression, list[str]]:
|
||||
"""Wrapper around sklearn's LinearRegression with PolynomialFeatures.
|
||||
|
||||
Args:
|
||||
array (ak.Array): The data.
|
||||
target_feat (str): Target feature to be fitted.
|
||||
features (list[str]): Features the target depends on.
|
||||
degree (int): Highest order of the polynomial.
|
||||
keep (list[str], optional): Monomials to keep. Defaults to None.
|
||||
keep_only_linear_in (str, optional): Keep only terms that are linear in this feature. Defaults to "".
|
||||
remove (list[str], optional): Monomials to remove. Defaults to None.
|
||||
include_bias (bool, optional): Inlcude bias term in polynomial. Defaults to False.
|
||||
fit_intercept (bool, optional): Fit zeroth order. Defaults to False.
|
||||
test_size (float, optional): Fraction of data used for testing. Defaults to 0.2.
|
||||
random_state (int, optional): Defaults to 42.
|
||||
|
||||
Raises:
|
||||
NotImplementedError: Simultaneous removing and keeping is not implemented.
|
||||
|
||||
Returns:
|
||||
tuple[LinearRegression, list[str]]: The linear regression object and the kept features.
|
||||
"""
|
||||
data = np.column_stack([ak.to_numpy(array[feat]) for feat in features])
|
||||
target = ak.to_numpy(array[target_feat])
|
||||
X_train, X_test, y_train, y_test = train_test_split(
|
||||
data,
|
||||
target,
|
||||
test_size=test_size,
|
||||
random_state=random_state,
|
||||
)
|
||||
poly = PolynomialFeatures(degree=degree, include_bias=include_bias)
|
||||
X_train_model = poly.fit_transform(X_train)
|
||||
X_test_model = poly.fit_transform(X_test)
|
||||
poly_features = poly.get_feature_names_out(input_features=features)
|
||||
if not remove:
|
||||
if keep:
|
||||
remove = [i for i, f in enumerate(poly_features) if f not in keep]
|
||||
elif keep_only_linear_in:
|
||||
# remove everything that's not linear in variable
|
||||
# the corrections should vanish
|
||||
remove = [
|
||||
i
|
||||
for i, f in enumerate(poly_features)
|
||||
if (keep_only_linear_in not in f) or (keep_only_linear_in + "^" in f)
|
||||
]
|
||||
else:
|
||||
remove = []
|
||||
elif remove and keep:
|
||||
raise NotImplementedError
|
||||
X_train_model = np.delete(X_train_model, remove, axis=1)
|
||||
X_test_model = np.delete(X_test_model, remove, axis=1)
|
||||
poly_features = np.delete(poly_features, remove)
|
||||
|
||||
lin_reg = LinearRegression(fit_intercept=fit_intercept)
|
||||
lin_reg.fit(X_train_model, y_train)
|
||||
y_pred_test = lin_reg.predict(X_test_model)
|
||||
print(f"Parameterisation for {target_feat}:")
|
||||
print("intercept=", lin_reg.intercept_)
|
||||
print(
|
||||
"coef=",
|
||||
dict(
|
||||
zip(
|
||||
poly_features,
|
||||
lin_reg.coef_,
|
||||
),
|
||||
),
|
||||
)
|
||||
print("r2 score=", lin_reg.score(X_test_model, y_test))
|
||||
print("RMSE =", mean_squared_error(y_test, y_pred_test, squared=False))
|
||||
print()
|
||||
return (lin_reg, poly_features)
|
51
parameterisations/utils/parse_regression_coef_to_array.py
Normal file
51
parameterisations/utils/parse_regression_coef_to_array.py
Normal file
@ -0,0 +1,51 @@
|
||||
from sklearn.linear_model import LinearRegression
|
||||
|
||||
|
||||
def parse_regression_coef_to_array(
|
||||
model: LinearRegression,
|
||||
poly_features: list[str],
|
||||
array_name: str,
|
||||
rows: list[str] = [],
|
||||
) -> list[str]:
|
||||
"""Convenient function to parse the model coefficients into a cpp code string.
|
||||
|
||||
Args:
|
||||
model (LinearRegression): A fitted linear regression model.
|
||||
poly_features (list[str]): A list with the names of the polynomial features.
|
||||
array_name (str): The name of the created cpp array.
|
||||
rows (list[str], optional): In case of a matrix, list of rows. Defaults to [].
|
||||
|
||||
Returns:
|
||||
list[str]: List of strings, first entry is the comment, second the cpp code.
|
||||
"""
|
||||
intercept = model.intercept_ != 0.0
|
||||
indices = [i for i in range(len(poly_features)) if model.coef_[i] != 0.0]
|
||||
feature_comment = (
|
||||
("// param[0] + " if intercept else "// ")
|
||||
+ " + ".join(
|
||||
[
|
||||
f"param[{idx}]*{poly_features[param_index]}"
|
||||
for idx, param_index in enumerate(indices, start=intercept)
|
||||
],
|
||||
)
|
||||
+ "\n"
|
||||
)
|
||||
n_col = sum(model.coef_ != 0.0) + model.fit_intercept
|
||||
if not rows:
|
||||
cpp_decl = f"static constexpr std::array<float, {n_col}> {array_name}"
|
||||
cpp_decl += (
|
||||
"{"
|
||||
+ (str(model.intercept_) + "f," if intercept else "")
|
||||
+ ",".join([str(coef) + "f" for coef in model.coef_ if coef != 0.0])
|
||||
+ "};\n"
|
||||
)
|
||||
return [feature_comment, cpp_decl]
|
||||
else:
|
||||
n_row = len(rows)
|
||||
cpp_decl = (
|
||||
f"static constexpr std::array<std::array<float, {n_col}>, {n_row}> {array_name}"
|
||||
+ "{{"
|
||||
)
|
||||
cpp_decl += ",".join(rows)
|
||||
cpp_decl += "}};\n"
|
||||
return [feature_comment, cpp_decl]
|
140
parameterisations/utils/parse_tmva_matrix_to_array.py
Normal file
140
parameterisations/utils/parse_tmva_matrix_to_array.py
Normal file
@ -0,0 +1,140 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def parse_tmva_matrix_to_array(
|
||||
input_class_files: list[str],
|
||||
simd_type: bool = False,
|
||||
outdir: str = "neural_net_training",
|
||||
) -> list[str]:
|
||||
"""Function to transform the TMVA output MLP C++ class into a more modern form.
|
||||
|
||||
Args:
|
||||
input_class_file (str): Path to the .C MLP class created by TMVA.
|
||||
simd_type (bool, optional): If true, type in array is set to simd::float_v. Defaults to False.
|
||||
|
||||
Returns:
|
||||
(str) : Path to the resulting C++ file containing the matrices.
|
||||
|
||||
Note:
|
||||
The created C++ code is written to a `hpp` file in `neural_net_training/result`.
|
||||
|
||||
"""
|
||||
data_type = "float" if not simd_type else "simd::float_v"
|
||||
# TODO: as of writing this code, constexpr is not supported for the SIMD types
|
||||
constness = "constexpr" if not simd_type else "const"
|
||||
outfiles = []
|
||||
for input_class_file in input_class_files:
|
||||
print(f"Transforming {input_class_file} ...")
|
||||
input_class_file = Path(input_class_file)
|
||||
with open(input_class_file) as f:
|
||||
lines = f.readlines()
|
||||
# the name of the outputfile is the middle part of the input class file name
|
||||
outfile = (
|
||||
outdir
|
||||
+ "/result/"
|
||||
+ "_".join(str(input_class_file.stem).split("_")[1:-1])
|
||||
+ ".hpp"
|
||||
)
|
||||
# this only supports category 2 for the transformation, which is the largest/smallest for fMax_1/fMin_1
|
||||
min_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMin_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
max_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMax_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
minima_cpp_decl = (
|
||||
f"{constness} auto fMin = std::array<{data_type}, {len(min_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(min_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
maxima_cpp_decl = (
|
||||
f"{constness} auto fMax = std::array<{data_type}, {len(max_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(max_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
print(f"Found minimum and maximum values for {len(min_lines)} variables.")
|
||||
with open(outfile, "w") as out:
|
||||
out.writelines([minima_cpp_decl, maxima_cpp_decl])
|
||||
|
||||
# this list contains all lines that define a matrix element
|
||||
matrix_lines = [
|
||||
line.replace(";", "").strip()
|
||||
for line in lines
|
||||
if "fWeightMatrix" in line
|
||||
and "double" not in line
|
||||
and "*" not in line
|
||||
and "= fWeightMatrix" not in line
|
||||
]
|
||||
|
||||
# there are several matrices, figure out how many and loop accordingly
|
||||
n_matrices = int(re.findall(re.compile(r"(\d+)\["), matrix_lines[-1])[0])
|
||||
print(f"Found {n_matrices} matrices: ")
|
||||
for matrix in range(n_matrices):
|
||||
# get only entries for corresponding matrix
|
||||
matrix_entries = [m for m in matrix_lines if f"{matrix}to{(matrix+1)}" in m]
|
||||
# figure out the dimensions of the matrix, by checking largest index at the end
|
||||
dim_string = re.findall(re.compile(r"\[(\d+)\]"), matrix_entries[-1])
|
||||
# actual size is last index + 1
|
||||
n_rows = int(dim_string[0]) + 1
|
||||
n_cols = int(dim_string[1]) + 1
|
||||
# get the name of the matrix
|
||||
matrix_string = matrix_entries[matrix * n_rows].split("=")[0].split("[")[0]
|
||||
if n_rows > 1:
|
||||
cpp_decl = (
|
||||
f"{constness} auto {matrix_string} = std::array<std::array<{data_type}, {n_cols}>, {n_rows}>"
|
||||
+ "{{"
|
||||
)
|
||||
else:
|
||||
cpp_decl = (
|
||||
f"{constness} auto {matrix_string} = std::array<{data_type}, {n_cols}>"
|
||||
+ "{"
|
||||
)
|
||||
rows = [[] for _ in range(n_rows)]
|
||||
for i_col in range(n_cols):
|
||||
for i_row, row in enumerate(rows):
|
||||
# only keep number (right side of the equality sign)
|
||||
entry = (
|
||||
matrix_entries[i_col * n_rows + i_row].split("=")[-1].strip()
|
||||
)
|
||||
row.append(entry)
|
||||
array_strings = ["{" + ", ".join(row) + "}" for row in rows]
|
||||
cpp_decl += ", ".join(array_strings) + ("}};\n" if n_rows > 1 else "};\n")
|
||||
print(
|
||||
f" {matrix+1}. {matrix_string} with {n_cols} columns and {n_rows} rows",
|
||||
)
|
||||
with open(outfile, "a") as out:
|
||||
out.write(cpp_decl)
|
||||
outfiles.append(outfile)
|
||||
return outfiles
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
outfiles = parse_tmva_matrix_to_array(
|
||||
[
|
||||
"neural_net_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"neural_net_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
for outfile in outfiles:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
142
parameterisations/utils/parse_tmva_matrix_to_array_TrLo.py
Normal file
142
parameterisations/utils/parse_tmva_matrix_to_array_TrLo.py
Normal file
@ -0,0 +1,142 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# flake8: noqaq
|
||||
|
||||
|
||||
def parse_tmva_matrix_to_array(
|
||||
input_class_files: list[str],
|
||||
simd_type: bool = False,
|
||||
outdir: str = "nn_trackinglosses_training",
|
||||
) -> list[str]:
|
||||
"""Function to transform the TMVA output MLP C++ class into a more modern form.
|
||||
|
||||
Args:
|
||||
input_class_file (str): Path to the .C MLP class created by TMVA.
|
||||
simd_type (bool, optional): If true, type in array is set to simd::float_v. Defaults to False.
|
||||
|
||||
Returns:
|
||||
(str) : Path to the resulting C++ file containing the matrices.
|
||||
|
||||
Note:
|
||||
The created C++ code is written to a `hpp` file in `neural_net_training/result`.
|
||||
|
||||
"""
|
||||
data_type = "float" if not simd_type else "simd::float_v"
|
||||
# TODO: as of writing this code, constexpr is not supported for the SIMD types
|
||||
constness = "constexpr" if not simd_type else "const"
|
||||
outfiles = []
|
||||
for input_class_file in input_class_files:
|
||||
print(f"Transforming {input_class_file} ...")
|
||||
input_class_file = Path(input_class_file)
|
||||
with open(input_class_file) as f:
|
||||
lines = f.readlines()
|
||||
# the name of the outputfile is the middle part of the input class file name
|
||||
outfile = (
|
||||
outdir
|
||||
+ "/result/"
|
||||
+ "_".join(str(input_class_file.stem).split("_")[1:-1])
|
||||
+ ".hpp"
|
||||
)
|
||||
# this only supports category 2 for the transformation, which is the largest/smallest for fMax_1/fMin_1
|
||||
min_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMin_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
max_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMax_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
minima_cpp_decl = (
|
||||
f"{constness} auto ResfMin = std::array<{data_type}, {len(min_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(min_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
maxima_cpp_decl = (
|
||||
f"{constness} auto ResfMax = std::array<{data_type}, {len(max_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(max_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
print(f"Found minimum and maximum values for {len(min_lines)} variables.")
|
||||
with open(outfile, "w") as out:
|
||||
out.writelines([minima_cpp_decl, maxima_cpp_decl])
|
||||
|
||||
# this list contains all lines that define a matrix element
|
||||
matrix_lines = [
|
||||
line.replace(";", "").strip()
|
||||
for line in lines
|
||||
if "fWeightMatrix" in line
|
||||
and "double" not in line
|
||||
and "*" not in line
|
||||
and "= fWeightMatrix" not in line
|
||||
]
|
||||
|
||||
# there are several matrices, figure out how many and loop accordingly
|
||||
n_matrices = int(re.findall(re.compile(r"(\d+)\["), matrix_lines[-1])[0])
|
||||
print(f"Found {n_matrices} matrices: ")
|
||||
for matrix in range(n_matrices):
|
||||
# get only entries for corresponding matrix
|
||||
matrix_entries = [m for m in matrix_lines if f"{matrix}to{(matrix+1)}" in m]
|
||||
# figure out the dimensions of the matrix, by checking largest index at the end
|
||||
dim_string = re.findall(re.compile(r"\[(\d+)\]"), matrix_entries[-1])
|
||||
# actual size is last index + 1
|
||||
n_rows = int(dim_string[0]) + 1
|
||||
n_cols = int(dim_string[1]) + 1
|
||||
# get the name of the matrix
|
||||
matrix_string = matrix_entries[matrix * n_rows].split("=")[0].split("[")[0]
|
||||
if n_rows > 1:
|
||||
cpp_decl = (
|
||||
f"{constness} auto Res{matrix_string} = std::array<std::array<{data_type}, {n_cols}>, {n_rows}>"
|
||||
+ "{{"
|
||||
)
|
||||
else:
|
||||
cpp_decl = (
|
||||
f"{constness} auto Res{matrix_string} = std::array<{data_type}, {n_cols}>"
|
||||
+ "{"
|
||||
)
|
||||
rows = [[] for _ in range(n_rows)]
|
||||
for i_col in range(n_cols):
|
||||
for i_row, row in enumerate(rows):
|
||||
# only keep number (right side of the equality sign)
|
||||
entry = (
|
||||
matrix_entries[i_col * n_rows + i_row].split("=")[-1].strip()
|
||||
)
|
||||
row.append(entry)
|
||||
array_strings = ["{" + ", ".join(row) + "}" for row in rows]
|
||||
cpp_decl += ", ".join(array_strings) + ("}};\n" if n_rows > 1 else "};\n")
|
||||
print(
|
||||
f" {matrix+1}. {matrix_string} with {n_cols} columns and {n_rows} rows",
|
||||
)
|
||||
with open(outfile, "a") as out:
|
||||
out.write(cpp_decl)
|
||||
outfiles.append(outfile)
|
||||
return outfiles
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
outfiles = parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_trackinglosses_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"nn_trackinglosses_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
for outfile in outfiles:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
142
parameterisations/utils/parse_tmva_matrix_to_array_electron.py
Normal file
142
parameterisations/utils/parse_tmva_matrix_to_array_electron.py
Normal file
@ -0,0 +1,142 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# flake8: noqaq
|
||||
|
||||
|
||||
def parse_tmva_matrix_to_array(
|
||||
input_class_files: list[str],
|
||||
simd_type: bool = False,
|
||||
outdir: str = "nn_electron_training",
|
||||
) -> list[str]:
|
||||
"""Function to transform the TMVA output MLP C++ class into a more modern form.
|
||||
|
||||
Args:
|
||||
input_class_file (str): Path to the .C MLP class created by TMVA.
|
||||
simd_type (bool, optional): If true, type in array is set to simd::float_v. Defaults to False.
|
||||
|
||||
Returns:
|
||||
(str) : Path to the resulting C++ file containing the matrices.
|
||||
|
||||
Note:
|
||||
The created C++ code is written to a `hpp` file in `nn_electron_training/result`.
|
||||
|
||||
"""
|
||||
data_type = "float" if not simd_type else "simd::float_v"
|
||||
# TODO: as of writing this code, constexpr is not supported for the SIMD types
|
||||
constness = "constexpr" if not simd_type else "const"
|
||||
outfiles = []
|
||||
for input_class_file in input_class_files:
|
||||
print(f"Transforming {input_class_file} ...")
|
||||
input_class_file = Path(input_class_file)
|
||||
with open(input_class_file) as f:
|
||||
lines = f.readlines()
|
||||
# the name of the outputfile is the middle part of the input class file name
|
||||
outfile = (
|
||||
outdir
|
||||
+ "/result/"
|
||||
+ "_".join(str(input_class_file.stem).split("_")[1:-1])
|
||||
+ ".hpp"
|
||||
)
|
||||
# this only supports category 2 for the transformation, which is the largest/smallest for fMax_1/fMin_1
|
||||
min_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMin_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
max_lines = [
|
||||
line.replace(";", "").split("=")[-1].strip()
|
||||
for line in lines
|
||||
if "fMax_1[2]" in line and "Scal" not in line and "double" not in line
|
||||
]
|
||||
minima_cpp_decl = (
|
||||
f"{constness} auto fMin = std::array<{data_type}, {len(min_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(min_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
maxima_cpp_decl = (
|
||||
f"{constness} auto fMax = std::array<{data_type}, {len(max_lines)}>"
|
||||
+ "{{"
|
||||
+ ", ".join(max_lines)
|
||||
+ "}};\n"
|
||||
)
|
||||
print(f"Found minimum and maximum values for {len(min_lines)} variables.")
|
||||
with open(outfile, "w") as out:
|
||||
out.writelines([minima_cpp_decl, maxima_cpp_decl])
|
||||
|
||||
# this list contains all lines that define a matrix element
|
||||
matrix_lines = [
|
||||
line.replace(";", "").strip()
|
||||
for line in lines
|
||||
if "fWeightMatrix" in line
|
||||
and "double" not in line
|
||||
and "*" not in line
|
||||
and "= fWeightMatrix" not in line
|
||||
]
|
||||
|
||||
# there are several matrices, figure out how many and loop accordingly
|
||||
n_matrices = int(re.findall(re.compile(r"(\d+)\["), matrix_lines[-1])[0])
|
||||
print(f"Found {n_matrices} matrices: ")
|
||||
for matrix in range(n_matrices):
|
||||
# get only entries for corresponding matrix
|
||||
matrix_entries = [m for m in matrix_lines if f"{matrix}to{(matrix+1)}" in m]
|
||||
# figure out the dimensions of the matrix, by checking largest index at the end
|
||||
dim_string = re.findall(re.compile(r"\[(\d+)\]"), matrix_entries[-1])
|
||||
# actual size is last index + 1
|
||||
n_rows = int(dim_string[0]) + 1
|
||||
n_cols = int(dim_string[1]) + 1
|
||||
# get the name of the matrix
|
||||
matrix_string = matrix_entries[matrix * n_rows].split("=")[0].split("[")[0]
|
||||
if n_rows > 1:
|
||||
cpp_decl = (
|
||||
f"{constness} auto {matrix_string} = std::array<std::array<{data_type}, {n_cols}>, {n_rows}>"
|
||||
+ "{{"
|
||||
)
|
||||
else:
|
||||
cpp_decl = (
|
||||
f"{constness} auto {matrix_string} = std::array<{data_type}, {n_cols}>"
|
||||
+ "{"
|
||||
)
|
||||
rows = [[] for _ in range(n_rows)]
|
||||
for i_col in range(n_cols):
|
||||
for i_row, row in enumerate(rows):
|
||||
# only keep number (right side of the equality sign)
|
||||
entry = (
|
||||
matrix_entries[i_col * n_rows + i_row].split("=")[-1].strip()
|
||||
)
|
||||
row.append(entry)
|
||||
array_strings = ["{" + ", ".join(row) + "}" for row in rows]
|
||||
cpp_decl += ", ".join(array_strings) + ("}};\n" if n_rows > 1 else "};\n")
|
||||
print(
|
||||
f" {matrix+1}. {matrix_string} with {n_cols} columns and {n_rows} rows",
|
||||
)
|
||||
with open(outfile, "a") as out:
|
||||
out.write(cpp_decl)
|
||||
outfiles.append(outfile)
|
||||
return outfiles
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
outfiles = parse_tmva_matrix_to_array(
|
||||
[
|
||||
"nn_electron_training/result/GhostNNDataSet/weights/TMVAClassification_default_forward_ghost_mlp.class.C",
|
||||
"nn_electron_training/result/GhostNNDataSet/weights/TMVAClassification_veloUT_forward_ghost_mlp.class.C",
|
||||
],
|
||||
)
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# run clang-format for nicer looking result
|
||||
for outfile in outfiles:
|
||||
subprocess.run(
|
||||
[
|
||||
"clang-format",
|
||||
"-i",
|
||||
f"{outfile}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except:
|
||||
pass
|
44
parameterisations/utils/preselection.py
Normal file
44
parameterisations/utils/preselection.py
Normal file
@ -0,0 +1,44 @@
|
||||
import ROOT
|
||||
|
||||
|
||||
def preselection(
|
||||
cuts: str = "",
|
||||
input_file: str = None,
|
||||
outfile_postfix: str = "selected",
|
||||
tree_name: str = "PrParameterisationData.PrMCDebugReconstructibleLong/Tuple",
|
||||
) -> str:
|
||||
"""Function that apply a selection to given data.
|
||||
|
||||
Args:
|
||||
cuts (str, optional): String specifying the selection. Defaults to "".
|
||||
input_file (str, optional): Defaults to None.
|
||||
outfile_postfix (str, optional): Defaults to "selected".
|
||||
tree_name (str, optional): Defaults to "PrParameterisationData.PrMCDebugReconstructibleLong/Tuple".
|
||||
|
||||
Returns:
|
||||
str: Path to the output file.
|
||||
"""
|
||||
rdf = ROOT.RDataFrame(tree_name, input_file)
|
||||
rdf = rdf.Filter(cuts, "Selection")
|
||||
out_file = input_file.strip(".root") + f"_{outfile_postfix}.root"
|
||||
rdf.Snapshot("Selected", out_file)
|
||||
return out_file
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--input-file",
|
||||
type=str,
|
||||
help="Path to the input file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--cuts",
|
||||
type=str,
|
||||
default="chi2_comb < 5 && pt > 10 && p > 1500 && p < 100000 && pid != 11",
|
||||
help="Cuts of the preselection",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
preselection(**vars(args))
|
464
scripts/BakPrCheckerEfficiency.py
Normal file
464
scripts/BakPrCheckerEfficiency.py
Normal file
@ -0,0 +1,464 @@
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
import argparse
|
||||
from ROOT import TMultiGraph, TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import kGreen, kBlue, kBlack, kAzure, kOrange, kMagenta, kCyan
|
||||
from ROOT import gROOT, gStyle, gPad
|
||||
from ROOT import TEfficiency
|
||||
from array import array
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
|
||||
def getEfficiencyHistoNames():
|
||||
return ["p", "pt", "phi", "eta", "nPV"]
|
||||
|
||||
|
||||
def getTrackers(trackers):
|
||||
return trackers
|
||||
|
||||
|
||||
def getOriginFolders():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
}
|
||||
|
||||
basedict["Velo"]["folder"] = "VeloTrackChecker/"
|
||||
basedict["Upstream"]["folder"] = "UpstreamTrackChecker/"
|
||||
basedict["Forward"]["folder"] = "ForwardTrackChecker/"
|
||||
basedict["Match"]["folder"] = "MatchTrackChecker/"
|
||||
basedict["BestLong"]["folder"] = "BestLongTrackChecker/"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getTrackNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = "Velo"
|
||||
basedict["Upstream"] = "VeloUT"
|
||||
basedict["Forward"] = "Forward"
|
||||
basedict["Match"] = "Match"
|
||||
basedict["BestLong"] = "BestLong"
|
||||
return basedict
|
||||
|
||||
|
||||
def get_colors():
|
||||
return [kBlack, kAzure, kGreen + 3, kMagenta + 2, kOrange, kCyan + 2]
|
||||
|
||||
|
||||
def get_markers():
|
||||
return [20, 24, 21, 22, 23, 25]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [1003, 1002, 3002, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def getGhostHistoNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = ["eta", "nPV"]
|
||||
basedict["Upstream"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Forward"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Match"] = basedict["Forward"]
|
||||
basedict["BestLong"] = basedict["Forward"]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the tuple file")
|
||||
parser.add_argument(
|
||||
"--filename",
|
||||
type=str,
|
||||
default=["data/resolutions_and_effs_Bs2PhiPhi_MD_default.root"],
|
||||
nargs="+",
|
||||
help="input files, including path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="data/efficiency_plots.root",
|
||||
help="output file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "Match", "BestLong"],
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["EffChecker"],
|
||||
help="label for files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons",
|
||||
action="store_true",
|
||||
help="plot electrons")
|
||||
parser.add_argument(
|
||||
"--plot-electrons-only",
|
||||
action="store_true",
|
||||
help="plot only electrons",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def get_nicer_var_string(var: str):
|
||||
nice_vars = dict(pt="p_{T}", eta="#eta", phi="#phi")
|
||||
try:
|
||||
return nice_vars[var]
|
||||
except KeyError:
|
||||
return var
|
||||
|
||||
|
||||
def get_eff(eff, hist, tf, histoName, label, var):
|
||||
eff = {}
|
||||
hist = {}
|
||||
var = get_nicer_var_string(var)
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_reconstructed"
|
||||
numerator = tf[lab].Get(numeratorName)
|
||||
denominatorName = histoName + "_reconstructible"
|
||||
denominator = tf[lab].Get(denominatorName)
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
eff[lab] = teff.CreateGraph()
|
||||
eff[lab].SetName(lab)
|
||||
eff[lab].SetTitle(lab + " not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
eff[lab].SetTitle(lab + " from stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " e^{-}")
|
||||
|
||||
hist[lab] = denominator.Clone()
|
||||
hist[lab].SetName("h_numerator_notElectrons")
|
||||
hist[lab].SetTitle(var + " distribution, not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, e^{-}")
|
||||
|
||||
return eff, hist
|
||||
|
||||
|
||||
def get_ghost(eff, hist, tf, histoName, label):
|
||||
ghost = {}
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_Ghosts"
|
||||
denominatorName = histoName + "_Total"
|
||||
numerator = tf[lab].Get(numeratorName)
|
||||
denominator = tf[lab].Get(denominatorName)
|
||||
print("Numerator = " + numeratorName)
|
||||
print("Denominator = " + denominatorName)
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
ghost[lab] = teff.CreateGraph()
|
||||
print(lab)
|
||||
ghost[lab].SetName(lab)
|
||||
|
||||
return ghost
|
||||
|
||||
|
||||
def PrCheckerEfficiency(
|
||||
filename,
|
||||
outfile,
|
||||
label,
|
||||
trackers,
|
||||
savepdf,
|
||||
plot_electrons,
|
||||
plot_electrons_only,
|
||||
):
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.ConfigHistos import (
|
||||
efficiencyHistoDict,
|
||||
ghostHistoDict,
|
||||
categoriesDict,
|
||||
getCuts,
|
||||
)
|
||||
from utils.Legend import place_legend
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
styles = get_fillstyles()
|
||||
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
efficiencyHistoDict = efficiencyHistoDict()
|
||||
efficiencyHistos = getEfficiencyHistoNames()
|
||||
ghostHistos = getGhostHistoNames()
|
||||
ghostHistoDict = ghostHistoDict()
|
||||
categories = categoriesDict()
|
||||
cuts = getCuts()
|
||||
trackers = getTrackers(trackers)
|
||||
folders = getOriginFolders()
|
||||
# names = getTrackNames()
|
||||
|
||||
for tracker in trackers:
|
||||
outputfile.cd()
|
||||
trackerDir = outputfile.mkdir(tracker)
|
||||
trackerDir.cd()
|
||||
|
||||
for cut in cuts[tracker]:
|
||||
cutDir = trackerDir.mkdir(cut)
|
||||
cutDir.cd()
|
||||
folder = folders[tracker]["folder"]
|
||||
print(folder)
|
||||
histoBaseName = "Track/" + folder + tracker + "/" + cut + "_"
|
||||
|
||||
# calculate efficiency
|
||||
for histo in efficiencyHistos:
|
||||
canvastitle = (
|
||||
"efficiency_" + histo + ", " + categories[tracker][cut]["title"]
|
||||
)
|
||||
# get efficiency for not electrons category
|
||||
histoName = histoBaseName + "" + efficiencyHistoDict[histo]["variable"]
|
||||
print("not electrons: " + histoName)
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e)
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
name = "efficiency_" + histo
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(eff_elec[lab], kBlue - 7, markers[i + 1], styles[i])
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = ""
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 18
|
||||
myblue = kBlue - 9
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_den[lab].Scale(scale)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
rightmax = 1.05 * hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_elec[lab].Scale(scale)
|
||||
if i == 0:
|
||||
if not plot_electrons_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
set_style(hist_elec[lab], myblue, markers[i], styles[i])
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.35)
|
||||
hist_elec[lab].Draw("HIST PLC SAME")
|
||||
else:
|
||||
print(
|
||||
"No distribution plotted for other labels.",
|
||||
"Can be added by uncommenting the code below this print statement.",
|
||||
)
|
||||
# set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.88, 0.68]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.045)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = tracker + "_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
tracker + "Electrons_" + cut + "_" + histo + "." + ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# calculate ghost rate
|
||||
histoBaseName = "Track/" + folder + tracker + "/"
|
||||
for histo in ghostHistos[tracker]:
|
||||
trackerDir.cd()
|
||||
title = "ghost_rate_vs_" + histo
|
||||
|
||||
gPad.SetTicks()
|
||||
histoName = histoBaseName + ghostHistoDict[histo]["variable"]
|
||||
|
||||
ghost = {}
|
||||
hist_den = {}
|
||||
ghost = get_ghost(ghost, hist_den, tf, histoName, label)
|
||||
canvas = TCanvas(title, title)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
mg.Add(ghost[lab])
|
||||
set_style(ghost[lab], colors[i], markers[i], styles[i])
|
||||
|
||||
xtitle = ghostHistoDict[histo]["xTitle"]
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetYaxis().SetTitle("Fraction of fake tracks")
|
||||
mg.Draw("ap")
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
# for lab in label:
|
||||
# ghost[lab].Draw("P SAME")
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "eta":
|
||||
pos = [0.35, 0.6, 0.85, 0.9]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.88, 0.68]
|
||||
legend = place_legend(canvas, *pos, header="LHCb Simulation", option="LPE")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.045)
|
||||
legend.Draw()
|
||||
# if histo != "nPV":
|
||||
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
|
||||
# else:
|
||||
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
|
||||
# mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
if histo == "eta":
|
||||
mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
# track_name = names[tracker] + " tracks"
|
||||
# latex.DrawLatex(0.7, 0.75, track_name)
|
||||
# canvas.PlaceLegend()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas.SaveAs(
|
||||
"checks/" + tracker + "ghost_rate_" + histo + "." + ftype,
|
||||
)
|
||||
canvas.Write()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerEfficiency(**vars(args))
|
309
scripts/BakPrCheckerTrackResolution.py
Normal file
309
scripts/BakPrCheckerTrackResolution.py
Normal file
@ -0,0 +1,309 @@
|
||||
import argparse
|
||||
from ROOT import TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import kOrange, kGray, kMagenta, kCyan, kGreen, kBlue, kBlack, gPad, TF1
|
||||
from ROOT import gROOT
|
||||
from ROOT import TObjArray
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
|
||||
def get_colors():
|
||||
return [kBlack, kBlue, kGreen + 3, kMagenta + 2, kOrange, kCyan + 2]
|
||||
|
||||
|
||||
def get_markers():
|
||||
return [20, 24, 21, 22, 23, 25]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [3004, 3003, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the histogram file")
|
||||
parser.add_argument("--filename", nargs="+", default=[], help="name of input files")
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["TrackRes"],
|
||||
help="name of input tuple files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "BestLong", "BestForward"],
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="checks/TrackResolution_plots.root",
|
||||
help="name of output files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def PrCheckerTrackResolution(filename, label, trackers, outfile, savepdf):
|
||||
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.Legend import place_legend
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
styles = get_fillstyles()
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
outputfile.cd()
|
||||
|
||||
for tracker in trackers:
|
||||
hres_p = {}
|
||||
hres_eta = {}
|
||||
canvas1 = TCanvas("res_p", "res v.s. p")
|
||||
canvas1.cd()
|
||||
|
||||
arrp = TObjArray()
|
||||
gaus = TF1("gaus", "gaus", -1, 1)
|
||||
for idx, lab in enumerate(label):
|
||||
hdp_p = tf[lab].Get(
|
||||
f"Track/TrackResChecker{tracker}/ALL/vertex/dpoverp_vs_p",
|
||||
)
|
||||
hdp_p.SetName("dpoverp_p_" + lab)
|
||||
hmom = hdp_p.ProjectionX()
|
||||
hmom.SetTitle("p distribution Long Tracks")
|
||||
hdp_p.FitSlicesY(gaus, 0, -1, 0, "Q", arrp)
|
||||
|
||||
hres_p[lab] = arrp[2]
|
||||
hres_p[lab].GetYaxis().SetTitle("dp/p [%]")
|
||||
hres_p[lab].GetXaxis().SetTitle("p [GeV]")
|
||||
hres_p[lab].GetYaxis().SetRangeUser(0, 1.2)
|
||||
hres_p[lab].SetTitle(lab)
|
||||
set_style(hres_p[lab], colors[idx], markers[idx], 0)
|
||||
|
||||
if idx == 0:
|
||||
hres_p[lab].Draw("E1 p1")
|
||||
set_style(hmom, kGray + 1, markers[idx], styles[idx])
|
||||
hmom.Scale(gPad.GetUymax() / hmom.GetMaximum())
|
||||
hmom.Draw("hist same")
|
||||
else:
|
||||
hres_p[lab].Draw("E1 p1 same")
|
||||
set_style(hmom, colors[idx] - 10, markers[idx], styles[idx])
|
||||
# hmom.Scale(gPad.GetUymax() / hmom.GetMaximum())
|
||||
# hmom.Draw("hist same")
|
||||
|
||||
for i in range(1, hres_p[lab].GetNbinsX() + 1):
|
||||
hres_p[lab].SetBinContent(i, hres_p[lab].GetBinContent(i) * 100)
|
||||
hres_p[lab].SetBinError(i, hres_p[lab].GetBinError(i) * 100)
|
||||
|
||||
print(
|
||||
lab
|
||||
+ ": Track resolution (dp/p) in p region: ("
|
||||
+ format(hres_p[lab].GetBinLowEdge(i), ".2f")
|
||||
+ ", "
|
||||
+ format(
|
||||
hres_p[lab].GetBinLowEdge(i) + hres_p[lab].GetBinWidth(i),
|
||||
".2f",
|
||||
)
|
||||
+ ") [GeV/c]"
|
||||
+ " --- ("
|
||||
+ format(hres_p[lab].GetBinContent(i), ".2f")
|
||||
+ "+-"
|
||||
+ format(hres_p[lab].GetBinError(i), ".2f")
|
||||
+ ")%",
|
||||
)
|
||||
print("-----------------------------------------------------")
|
||||
|
||||
if "Best" not in tracker:
|
||||
legend = place_legend(
|
||||
canvas1,
|
||||
0.45,
|
||||
0.33,
|
||||
0.93,
|
||||
0.63,
|
||||
header="LHCb Simulation",
|
||||
option="LPE",
|
||||
)
|
||||
else:
|
||||
legend = place_legend(
|
||||
canvas1,
|
||||
0.45,
|
||||
0.53,
|
||||
0.93,
|
||||
0.83,
|
||||
header="LHCb Simulation",
|
||||
option="LPE",
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
hres_p[lab].Draw("E1 p1 same")
|
||||
canvas1.SetRightMargin(0.1)
|
||||
if "Best" not in tracker:
|
||||
latex.DrawLatex(
|
||||
legend.GetX1() + 0.01,
|
||||
legend.GetY1() - 0.05,
|
||||
"without Kalman Filter",
|
||||
)
|
||||
low = 0
|
||||
high = 1.2
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle("# Tracks p distribution [a.u.]")
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas1.Write()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas1.SaveAs(f"checks/{tracker}_trackres_p." + ftype)
|
||||
|
||||
gaus.Delete()
|
||||
arrp.Delete()
|
||||
|
||||
canvas2 = TCanvas("res_eta", "res v.s. eta")
|
||||
canvas2.cd()
|
||||
|
||||
arreta = TObjArray()
|
||||
gaus = TF1("gaus", "gaus", -1, 1)
|
||||
for idx, lab in enumerate(label):
|
||||
hdp_eta = tf[lab].Get(
|
||||
f"Track/TrackResChecker{tracker}/ALL/vertex/dpoverp_vs_eta",
|
||||
)
|
||||
hdp_eta.SetName("dpoverp_eta_" + lab)
|
||||
hdp_eta.FitSlicesY(gaus, 0, -1, 0, "Q", arreta)
|
||||
heta = hdp_eta.ProjectionX()
|
||||
heta.SetTitle("#eta distribution Long Tracks")
|
||||
|
||||
hres_eta[lab] = arreta[2]
|
||||
hres_eta[lab].GetYaxis().SetTitle("dp/p [%]")
|
||||
hres_eta[lab].GetXaxis().SetTitle("#eta")
|
||||
hres_eta[lab].GetYaxis().SetRangeUser(0, 1.2)
|
||||
hres_eta[lab].SetTitle(lab)
|
||||
set_style(hres_eta[lab], colors[idx], markers[idx], 0)
|
||||
|
||||
if idx == 0:
|
||||
hres_eta[lab].Draw("E1 p1")
|
||||
set_style(heta, kGray + 1, markers[idx], styles[idx])
|
||||
heta.Scale(gPad.GetUymax() / heta.GetMaximum())
|
||||
heta.Draw("hist same")
|
||||
else:
|
||||
hres_eta[lab].Draw("E1 p1 same")
|
||||
set_style(heta, colors[idx] - 10, markers[idx], styles[idx])
|
||||
|
||||
# heta.Scale(gPad.GetUymax() / heta.GetMaximum())
|
||||
# heta.Draw("hist same")
|
||||
|
||||
for i in range(1, hres_eta[lab].GetNbinsX() + 1):
|
||||
hres_eta[lab].SetBinContent(i, hres_eta[lab].GetBinContent(i) * 100)
|
||||
hres_eta[lab].SetBinError(i, hres_eta[lab].GetBinError(i) * 100)
|
||||
|
||||
print(
|
||||
lab
|
||||
+ ": Track resolution (dp/p) in eta region: ("
|
||||
+ format(hres_eta[lab].GetBinLowEdge(i), ".2f")
|
||||
+ ", "
|
||||
+ format(
|
||||
hres_eta[lab].GetBinLowEdge(i) + hres_eta[lab].GetBinWidth(i),
|
||||
".2f",
|
||||
)
|
||||
+ ")"
|
||||
+ " --- ("
|
||||
+ format(hres_eta[lab].GetBinContent(i), ".2f")
|
||||
+ "+-"
|
||||
+ format(hres_eta[lab].GetBinError(i), ".2f")
|
||||
+ ")%",
|
||||
)
|
||||
print("-----------------------------------------------------")
|
||||
|
||||
legend = place_legend(
|
||||
canvas2,
|
||||
0.41,
|
||||
0.27,
|
||||
0.89,
|
||||
0.57,
|
||||
header="LHCb Simulation",
|
||||
option="LPE",
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.045)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
hres_eta[lab].Draw("E1 p1 same")
|
||||
canvas2.SetRightMargin(0.1)
|
||||
if "Best" not in tracker:
|
||||
latex.DrawLatex(
|
||||
legend.GetX1() + 0.01,
|
||||
legend.GetY1() - 0.05,
|
||||
"without Kalman Filter",
|
||||
)
|
||||
low = 0
|
||||
high = 1.2
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle("# Tracks #eta distribution [a.u.]")
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas2.Write()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas2.SaveAs(f"checks/{tracker}_trackres_eta." + ftype)
|
||||
gaus.Delete()
|
||||
arreta.Delete()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerTrackResolution(**vars(args))
|
839
scripts/CompareEfficiency.py
Normal file
839
scripts/CompareEfficiency.py
Normal file
@ -0,0 +1,839 @@
|
||||
# flake8: noqa
|
||||
|
||||
"""
|
||||
Script for accessing histograms of reconstructible and
|
||||
reconstructed tracks for different tracking categories
|
||||
and trackers.
|
||||
|
||||
The efficency is calculated usig TGraphAsymmErrors
|
||||
and Bayesian error bars
|
||||
|
||||
author: Furkan Cetin
|
||||
date: 10/2023
|
||||
|
||||
|
||||
|
||||
Takes data from Recent_get_resolution_and_eff_data.py and calculates efficiencies
|
||||
|
||||
python scripts/CompareEfficiency.py
|
||||
--filename data/res_and_effs_B.root data/resolutions_and_effs_Bd2KstEE_MDmaster.root
|
||||
--trackers Match --label new old --outfile data/compare_effs.root
|
||||
|
||||
python scripts/CompareEfficiency.py --filename data/resolutions_and_effs_D_default_weights.root data/resolutions_and_effs_D_with_electron_weights_as_residual.root --trackers BestLong Seed --label default new --outfile data_results/CompareEfficiencyDDefaultResidual.root
|
||||
"""
|
||||
|
||||
import os, sys
|
||||
import argparse
|
||||
from ROOT import TMultiGraph, TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import (
|
||||
kGreen,
|
||||
kBlue,
|
||||
kBlack,
|
||||
kAzure,
|
||||
kGray,
|
||||
kOrange,
|
||||
kMagenta,
|
||||
kCyan,
|
||||
kViolet,
|
||||
kTeal,
|
||||
kRed,
|
||||
)
|
||||
from ROOT import gROOT, gStyle, gPad
|
||||
from ROOT import TEfficiency
|
||||
from array import array
|
||||
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
from utils.components import unique_name_ext_re, findRootObjByName
|
||||
|
||||
|
||||
def getEfficiencyHistoNames():
|
||||
return ["p", "pt", "phi", "eta", "nPV"]
|
||||
|
||||
|
||||
def getTrackers(trackers):
|
||||
return trackers
|
||||
|
||||
|
||||
def getCompCuts(compare_cuts):
|
||||
return compare_cuts
|
||||
|
||||
|
||||
# data/resolutions_and_effs_Bd2KstEE_MDmaster.root:Track/...
|
||||
def getOriginFolders():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
# evtl anpassen wenn die folders anders heissen
|
||||
basedict["Velo"]["folder"] = "VeloTrackChecker/"
|
||||
basedict["Upstream"]["folder"] = "UpstreamTrackChecker/"
|
||||
basedict["Forward"]["folder"] = "ForwardTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Match"]["folder"] = "MatchTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["BestLong"]["folder"] = "BestLongTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Seed"]["folder"] = "SeedTrackChecker" + unique_name_ext_re() + "/"
|
||||
|
||||
# basedict["Forward"]["folder"] = "ForwardTrackChecker_7a0dbfa7/"
|
||||
# basedict["Match"]["folder"] = "MatchTrackChecker_29e3152a/"
|
||||
# basedict["BestLong"]["folder"] = "BestLongTrackChecker_4ddacce1/"
|
||||
# basedict["Seed"]["folder"] = "SeedTrackChecker_1b1d5575/"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getTrackNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = "Velo"
|
||||
basedict["Upstream"] = "VeloUT"
|
||||
basedict["Forward"] = "Forward"
|
||||
basedict["Match"] = "Match"
|
||||
basedict["BestLong"] = "BestLong"
|
||||
basedict["Seed"] = "Seed"
|
||||
return basedict
|
||||
|
||||
|
||||
def get_colors():
|
||||
return [kBlack, kAzure, kGreen + 2, kMagenta + 2, kRed, kCyan + 2, kGray + 1]
|
||||
|
||||
|
||||
def get_elec_colors():
|
||||
return [
|
||||
kGray + 2,
|
||||
kBlue - 4,
|
||||
kRed + 1,
|
||||
kGreen + 1,
|
||||
kViolet,
|
||||
kOrange - 3,
|
||||
kTeal - 1,
|
||||
kGray + 1,
|
||||
]
|
||||
|
||||
|
||||
def get_markers():
|
||||
return [20, 21, 24, 25, 22, 23, 26, 32]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [1003, 3001, 3002, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def getGhostHistoNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = ["eta", "nPV"]
|
||||
basedict["Upstream"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Forward"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Match"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["BestLong"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Seed"] = ["eta", "p", "pt", "nPV"]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the tuple file")
|
||||
parser.add_argument(
|
||||
"--filename",
|
||||
type=str,
|
||||
default=["data/resolutions_and_effs_B.root"],
|
||||
nargs="+",
|
||||
help="input files, including path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="data_results/compare_efficiency.root",
|
||||
help="output file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "Match", "BestLong", "Seed"], # ---
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["Eff"],
|
||||
help="label for files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compare",
|
||||
default=True,
|
||||
action="store_true",
|
||||
help="compare efficiencies",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compare-cuts",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["long", "long_fromB", "long_fromB_P>5GeV"],
|
||||
help="which cuts get compared",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons",
|
||||
default=True,
|
||||
action="store_true",
|
||||
help="plot electrons",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons-only",
|
||||
action="store_true",
|
||||
help="plot only electrons",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def get_nicer_var_string(var: str):
|
||||
nice_vars = dict(pt="p_{T}", eta="#eta", phi="#phi")
|
||||
try:
|
||||
return nice_vars[var]
|
||||
except KeyError:
|
||||
return var
|
||||
|
||||
|
||||
def get_eff(eff, hist, tf, histoName, label, var):
|
||||
eff = {}
|
||||
hist = {}
|
||||
var = get_nicer_var_string(var)
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_reconstructed"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominatorName = histoName + "_reconstructible"
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
eff[lab] = teff.CreateGraph()
|
||||
eff[lab].SetName(lab)
|
||||
eff[lab].SetTitle(lab)
|
||||
if histoName.find("Forward") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Forward, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Forward")
|
||||
if histoName.find("Match") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Match, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Match")
|
||||
if histoName.find("Seed") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Seed, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Seed")
|
||||
if histoName.find("BestLong") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " BestLong, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " BestLong")
|
||||
|
||||
# eff[lab].SetTitle(lab + " not e^{-}")
|
||||
# if histoName.find("strange") != -1:
|
||||
# eff[lab].SetTitle(lab + " from stranges")
|
||||
# if histoName.find("electron") != -1:
|
||||
# eff[lab].SetTitle(lab + " e^{-}")
|
||||
|
||||
hist[lab] = denominator.Clone()
|
||||
hist[lab].SetName("h_numerator_notElectrons")
|
||||
hist[lab].SetTitle(var + " distribution, not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, e^{-}")
|
||||
|
||||
return eff, hist
|
||||
|
||||
|
||||
def get_ghost(eff, hist, tf, histoName, label):
|
||||
ghost = {}
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_Ghosts"
|
||||
denominatorName = histoName + "_Total"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
print("Numerator = " + numeratorName.replace(unique_name_ext_re(), ""))
|
||||
print("Denominator = " + denominatorName.replace(unique_name_ext_re(), ""))
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
ghost[lab] = teff.CreateGraph()
|
||||
print(lab)
|
||||
ghost[lab].SetName(lab)
|
||||
|
||||
return ghost
|
||||
|
||||
|
||||
def PrCheckerEfficiency(
|
||||
filename,
|
||||
outfile,
|
||||
label,
|
||||
trackers,
|
||||
savepdf,
|
||||
compare,
|
||||
compare_cuts,
|
||||
plot_electrons,
|
||||
plot_electrons_only,
|
||||
):
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.ConfigHistos import (
|
||||
efficiencyHistoDict,
|
||||
ghostHistoDict,
|
||||
categoriesDict,
|
||||
getCuts,
|
||||
)
|
||||
from utils.CompareConfigHistos import getCompare, getCompColors
|
||||
from utils.Legend import place_legend
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
elec_colors = get_elec_colors()
|
||||
styles = get_fillstyles()
|
||||
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
efficiencyHistoDict = efficiencyHistoDict()
|
||||
efficiencyHistos = getEfficiencyHistoNames()
|
||||
ghostHistos = getGhostHistoNames()
|
||||
ghostHistoDict = ghostHistoDict()
|
||||
categories = categoriesDict()
|
||||
cuts = getCuts()
|
||||
compareDict = getCompare()
|
||||
compareCuts = getCompCuts(compare_cuts)
|
||||
compareColors = getCompColors()
|
||||
trackers = getTrackers(trackers)
|
||||
folders = getOriginFolders()
|
||||
|
||||
for tracker in trackers:
|
||||
outputfile.cd()
|
||||
trackerDir = outputfile.mkdir(tracker)
|
||||
trackerDir.cd()
|
||||
|
||||
for cut in cuts[tracker]:
|
||||
cutDir = trackerDir.mkdir(cut)
|
||||
cutDir.cd()
|
||||
folder = folders[tracker]["folder"]
|
||||
print("folder: " + folder.replace(unique_name_ext_re(), ""))
|
||||
histoBaseName = "Track/" + folder + tracker + "/" + cut + "_"
|
||||
|
||||
# calculate efficiency
|
||||
for histo in efficiencyHistos:
|
||||
canvastitle = (
|
||||
"efficiency_" + histo + ", " + categories[tracker][cut]["title"]
|
||||
)
|
||||
# get efficiency for not electrons category
|
||||
histoName = histoBaseName + "" + efficiencyHistoDict[histo]["variable"]
|
||||
print("not electrons: " + histoName.replace(unique_name_ext_re(), ""))
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e.replace(unique_name_ext_re(), ""))
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
name = "efficiency_" + histo
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(eff_elec[lab], elec_colors[i], markers[i], styles[i])
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = "a.u."
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 18
|
||||
myblue = kBlue - 9
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_den[lab].Scale(scale)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
rightmax = 1.05 * hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_elec[lab].Scale(scale)
|
||||
if i == 0:
|
||||
if not plot_electrons_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
set_style(hist_elec[lab], myblue, markers[i], styles[i])
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.35)
|
||||
hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# # set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
# # gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# # hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
# if histo == "p":
|
||||
# pos = [0.5, 0.3, 1.0, 0.6]
|
||||
# elif histo == "pt":
|
||||
# pos = [0.5, 0.3, 0.99, 0.6]
|
||||
# elif histo == "phi":
|
||||
# pos = [0.3, 0.25, 0.8, 0.55]
|
||||
# else:
|
||||
# pos = [0.3, 0.25, 0.8, 0.55]
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.5, 0.3, 1.0, 0.5] # [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.3, 0.99, 0.5] # [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.4, 0.3, 0.9, 0.5]
|
||||
elif histo == "eta":
|
||||
pos = [0.5, 0.25, 1.0, 0.45]
|
||||
else:
|
||||
pos = [0.35, 0.25, 0.85, 0.45]
|
||||
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = tracker + "_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
tracker
|
||||
+ "_Electrons_"
|
||||
+ cut
|
||||
+ "_"
|
||||
+ histo
|
||||
+ "."
|
||||
+ ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# calculate ghost rate
|
||||
print("\ncalculate ghost rate: ")
|
||||
histoBaseName = "Track/" + folder + tracker + "/"
|
||||
for histo in ghostHistos[tracker]:
|
||||
trackerDir.cd()
|
||||
title = "ghost_rate_vs_" + histo
|
||||
|
||||
gPad.SetTicks()
|
||||
histoName = histoBaseName + ghostHistoDict[histo]["variable"]
|
||||
|
||||
ghost = {}
|
||||
hist_den = {}
|
||||
ghost = get_ghost(ghost, hist_den, tf, histoName, label)
|
||||
canvas = TCanvas(title, title)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
mg.Add(ghost[lab])
|
||||
set_style(ghost[lab], colors[i], markers[2 * i], styles[i])
|
||||
|
||||
xtitle = ghostHistoDict[histo]["xTitle"]
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetYaxis().SetTitle("Fraction of fake tracks")
|
||||
mg.Draw("ap")
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
# for lab in label:
|
||||
# ghost[lab].Draw("P SAME")
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.00, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "eta":
|
||||
pos = [0.35, 0.6, 0.85, 0.9]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.80, 0.68]
|
||||
legend = place_legend(canvas, *pos, header="LHCb Simulation", option="LPE")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
# if histo != "nPV":
|
||||
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
|
||||
# else:
|
||||
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
|
||||
# mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
if histo == "eta":
|
||||
mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
# track_name = names[tracker] + " tracks"
|
||||
# latex.DrawLatex(0.7, 0.75, track_name)
|
||||
# canvas.PlaceLegend()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas.SaveAs(
|
||||
"checks/" + tracker + "_ghost_rate_" + histo + "." + ftype,
|
||||
)
|
||||
canvas.Write()
|
||||
|
||||
#
|
||||
# Compare electron efficiencies of different trackers
|
||||
#
|
||||
|
||||
plot_electrons_only = True
|
||||
if compare:
|
||||
print("\nCompare Efficiencies: ")
|
||||
outputfile.cd()
|
||||
|
||||
for jcut in compareCuts: # [long, long_fromB, long_fromB_P>5GeV]
|
||||
compareDir = outputfile.mkdir("compare_" + jcut)
|
||||
compareDir.cd()
|
||||
for histo in efficiencyHistos: # [p, pt, phi, eta, nPV]
|
||||
canvastitle = "efficiency_" + histo + "_" + jcut
|
||||
name = "efficiency_" + histo + "_" + jcut
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
dist_eff = {}
|
||||
dist_hist_den = {}
|
||||
dist_eff_elec = {}
|
||||
dist_hist_elec = {}
|
||||
First = True
|
||||
dist_tracker = ""
|
||||
markeritr = 0
|
||||
|
||||
for tracker in trackers: # [BestLong, Forward, Match, Seed]
|
||||
cut = compareDict[jcut][tracker]
|
||||
folder = folders[tracker]["folder"]
|
||||
print("folder: " + folder.replace(unique_name_ext_re(), ""))
|
||||
|
||||
jcolor = compareColors[tracker]
|
||||
|
||||
histoName = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ cut
|
||||
+ "_"
|
||||
+ ""
|
||||
+ efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print(
|
||||
"not electrons: " + histoName.replace(unique_name_ext_re(), "")
|
||||
)
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print(
|
||||
"electrons: "
|
||||
+ histoName_e.replace(unique_name_ext_re(), "")
|
||||
)
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
if First:
|
||||
dist_eff_elec = eff_elec
|
||||
dist_hist_elec = hist_elec
|
||||
|
||||
if First:
|
||||
dist_tracker = tracker
|
||||
dist_eff = eff
|
||||
dist_hist_den = hist_den
|
||||
First = False
|
||||
|
||||
seeditr = 0
|
||||
for i, lab in enumerate(label):
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
if (tracker == "Seed") and (seeditr != 0):
|
||||
continue
|
||||
if tracker == "Seed":
|
||||
seeditr += 1
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(
|
||||
eff_elec[lab],
|
||||
colors[jcolor],
|
||||
markers[i + markeritr],
|
||||
styles[i],
|
||||
)
|
||||
else:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(
|
||||
eff_elec[lab],
|
||||
elec_colors[jcolor + markeritr],
|
||||
markers[i + markeritr],
|
||||
styles[i],
|
||||
)
|
||||
markeritr = markeritr + 1
|
||||
# set_style(
|
||||
# eff_elec[lab], colors[jcolor], markers[i], styles[i]
|
||||
# )
|
||||
markeritr = 0
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = "a.u."
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 16
|
||||
myblue = kBlue - 7
|
||||
|
||||
dist_cut = compareDict[jcut][dist_tracker]
|
||||
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * dist_hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
dist_hist_den[lab].Scale(scale)
|
||||
if (
|
||||
categories[dist_tracker][dist_cut]["plotElectrons"]
|
||||
and plot_electrons
|
||||
):
|
||||
rightmax = 1.05 * dist_hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
dist_hist_elec[lab].Scale(scale)
|
||||
if i == len(label) - 1:
|
||||
if not plot_electrons_only:
|
||||
set_style(dist_hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
dist_hist_den[lab].SetFillColorAlpha(mygray, 0.5)
|
||||
dist_hist_den[lab].Draw("HIST PLC SAME")
|
||||
if (
|
||||
categories[dist_tracker][dist_cut]["plotElectrons"]
|
||||
and plot_electrons
|
||||
):
|
||||
set_style(
|
||||
dist_hist_elec[lab], mygray, markers[i], styles[i]
|
||||
)
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# dist_hist_elec[lab].SetFillColor(myblue)
|
||||
dist_hist_elec[lab].SetFillColorAlpha(myblue, 0.5)
|
||||
dist_hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# set_style(dist_hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# dist_hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.5, 0.3, 1.0, 0.5] # [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.3, 0.99, 0.5] # [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.4, 0.3, 0.9, 0.5]
|
||||
elif histo == "eta":
|
||||
pos = [0.5, 0.25, 1.0, 0.45]
|
||||
else:
|
||||
pos = [0.35, 0.25, 0.85, 0.45]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
dist_eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
dist_eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = "Compare_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
"Compare_Electrons_" + cut + "_" + histo + "." + ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# # calculate ghost rate
|
||||
# for histo in ghostHistos: # [p, pt, eta, nPV]
|
||||
# canvastitle = "ghost_rate_vs_" + histo + "_" + jcut
|
||||
# name = "ghost_rate_vs_" + histo + "_" + jcut
|
||||
# canvas = TCanvas(name, canvastitle)
|
||||
# canvas.SetRightMargin(0.1)
|
||||
# mg = TMultiGraph()
|
||||
outputfile.cd()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerEfficiency(**vars(args))
|
787
scripts/CompareResidualEfficiency.py
Normal file
787
scripts/CompareResidualEfficiency.py
Normal file
@ -0,0 +1,787 @@
|
||||
# Script for accessing histograms of reconstructible and
|
||||
# reconstructed tracks for different tracking categories
|
||||
# created by hlt1_reco_baseline_with_mcchecking
|
||||
#
|
||||
# The efficency is calculated usig TGraphAsymmErrors
|
||||
# and Bayesian error bars
|
||||
#
|
||||
# author: Furkan Cetin
|
||||
# date: 10/2023
|
||||
#
|
||||
# flake8: noqa
|
||||
#
|
||||
# Takes data from Recent_get_resolution_and_eff_data.py and calculates efficiencies
|
||||
# python scripts/CompareResidualEfficiency.py --filename data/resolutions_and_effs_B_residual.root data/resolutions_and_effs_B.root
|
||||
# --trackers BestLong --label Residual Normal --outfile data/compare_effs_B_residual.root
|
||||
#
|
||||
|
||||
import os, sys
|
||||
import argparse
|
||||
from ROOT import TMultiGraph, TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import kGreen, kBlue, kBlack, kAzure, kGray, kOrange, kMagenta, kCyan
|
||||
from ROOT import gROOT, gStyle, gPad
|
||||
from ROOT import TEfficiency
|
||||
from array import array
|
||||
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
from utils.components import unique_name_ext_re, findRootObjByName
|
||||
|
||||
|
||||
def getEfficiencyHistoNames():
|
||||
return ["p", "pt", "phi", "eta", "nPV"]
|
||||
|
||||
|
||||
def getTrackers(trackers):
|
||||
return trackers
|
||||
|
||||
|
||||
def getCompCuts(compare_cuts):
|
||||
return compare_cuts
|
||||
|
||||
|
||||
# data/resolutions_and_effs_Bd2KstEE_MDmaster.root:Track/...
|
||||
def getOriginFolders():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
# evtl anpassen wenn die folders anders heissen
|
||||
basedict["Velo"]["folder"] = "VeloTrackChecker/"
|
||||
basedict["Upstream"]["folder"] = "UpstreamTrackChecker/"
|
||||
basedict["Forward"]["folder"] = "ForwardTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Match"]["folder"] = "MatchTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["BestLong"]["folder"] = "BestLongTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Seed"]["folder"] = "SeedTrackChecker" + unique_name_ext_re() + "/"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getTrackNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = "Velo"
|
||||
basedict["Upstream"] = "VeloUT"
|
||||
basedict["Forward"] = "Forward"
|
||||
basedict["Match"] = "Match"
|
||||
basedict["BestLong"] = "BestLong"
|
||||
basedict["Seed"] = "Seed"
|
||||
return basedict
|
||||
|
||||
|
||||
def get_colors():
|
||||
return [
|
||||
kBlack,
|
||||
kAzure,
|
||||
kGreen + 2,
|
||||
kMagenta + 1,
|
||||
kOrange,
|
||||
kCyan + 2,
|
||||
kBlack,
|
||||
kAzure,
|
||||
kGreen + 3,
|
||||
kMagenta + 2,
|
||||
kOrange,
|
||||
kCyan + 2,
|
||||
]
|
||||
|
||||
|
||||
def get_markers():
|
||||
return [20, 21, 24, 25, 22, 23, 26, 32]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [1003, 3001, 3002, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def getGhostHistoNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = ["eta", "nPV"]
|
||||
basedict["Upstream"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Forward"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Match"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["BestLong"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Seed"] = ["eta", "p", "pt", "nPV"]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the tuple file")
|
||||
parser.add_argument(
|
||||
"--filename",
|
||||
type=str,
|
||||
default=["data/resolutions_and_effs_B.root"],
|
||||
nargs="+",
|
||||
help="input files, including path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="data/compare_efficiency.root",
|
||||
help="output file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "Match", "BestLong", "Seed"], # ---
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["Eff"],
|
||||
help="label for files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compare",
|
||||
default=True,
|
||||
action="store_true",
|
||||
help="compare efficiencies",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compare-cuts",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["long", "long_fromB", "long_fromB_P>5GeV"],
|
||||
help="which cuts get compared",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons",
|
||||
default=True,
|
||||
action="store_true",
|
||||
help="plot electrons",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons-only",
|
||||
action="store_true",
|
||||
help="plot only electrons",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def get_nicer_var_string(var: str):
|
||||
nice_vars = dict(pt="p_{T}", eta="#eta", phi="#phi")
|
||||
try:
|
||||
return nice_vars[var]
|
||||
except KeyError:
|
||||
return var
|
||||
|
||||
|
||||
def get_eff(eff, hist, tf, histoName, label, var):
|
||||
eff = {}
|
||||
hist = {}
|
||||
var = get_nicer_var_string(var)
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_reconstructed"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
# numerator = tf[lab].Get(numeratorName)
|
||||
denominatorName = histoName + "_reconstructible"
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
# denominator = tf[lab].Get(denominatorName)
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
# print("TBetaAlpha: "+ str(teff.GetBetaAlpha()))
|
||||
# print("TBetaBeta: "+ str(teff.GetBetaBeta()))
|
||||
eff[lab] = teff.CreateGraph()
|
||||
eff[lab].SetName(lab)
|
||||
eff[lab].SetTitle(lab)
|
||||
if histoName.find("Forward") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Forward, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Forward")
|
||||
elif histoName.find("Match") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Match, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Match")
|
||||
elif histoName.find("Seed") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " Seed, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " Seed")
|
||||
elif histoName.find("BestLong") != -1:
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " BestLong, e^{-}")
|
||||
else:
|
||||
eff[lab].SetTitle(lab + " BestLong")
|
||||
|
||||
# eff[lab].SetTitle(lab + " not e^{-}")
|
||||
# if histoName.find("strange") != -1:
|
||||
# eff[lab].SetTitle(lab + " from stranges")
|
||||
# if histoName.find("electron") != -1:
|
||||
# eff[lab].SetTitle(lab + " e^{-}")
|
||||
|
||||
hist[lab] = denominator.Clone()
|
||||
hist[lab].SetName("h_numerator_notElectrons")
|
||||
hist[lab].SetTitle(var + " distribution, not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, e^{-}")
|
||||
|
||||
return eff, hist
|
||||
|
||||
|
||||
def get_ghost(eff, hist, tf, histoName, label):
|
||||
ghost = {}
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_Ghosts"
|
||||
denominatorName = histoName + "_Total"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
# numerator = tf[lab].Get(numeratorName)
|
||||
# denominator = tf[lab].Get(denominatorName)
|
||||
print("Numerator = " + numeratorName)
|
||||
print("Denominator = " + denominatorName)
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
ghost[lab] = teff.CreateGraph()
|
||||
print(lab)
|
||||
ghost[lab].SetName(lab)
|
||||
|
||||
return ghost
|
||||
|
||||
|
||||
def PrCheckerEfficiency(
|
||||
filename,
|
||||
outfile,
|
||||
label,
|
||||
trackers,
|
||||
savepdf,
|
||||
compare,
|
||||
compare_cuts,
|
||||
plot_electrons,
|
||||
plot_electrons_only,
|
||||
):
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.ConfigHistos import (
|
||||
efficiencyHistoDict,
|
||||
ghostHistoDict,
|
||||
categoriesDict,
|
||||
getCuts,
|
||||
)
|
||||
from utils.CompareConfigHistos import getCompare, getCompColors
|
||||
from utils.Legend import place_legend
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
styles = get_fillstyles()
|
||||
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
efficiencyHistoDict = efficiencyHistoDict()
|
||||
efficiencyHistos = getEfficiencyHistoNames()
|
||||
ghostHistos = getGhostHistoNames()
|
||||
ghostHistoDict = ghostHistoDict()
|
||||
categories = categoriesDict()
|
||||
cuts = getCuts()
|
||||
compareDict = getCompare()
|
||||
compareCuts = getCompCuts(compare_cuts)
|
||||
compareColors = getCompColors()
|
||||
trackers = getTrackers(trackers)
|
||||
folders = getOriginFolders()
|
||||
|
||||
for tracker in trackers:
|
||||
outputfile.cd()
|
||||
trackerDir = outputfile.mkdir(tracker)
|
||||
trackerDir.cd()
|
||||
|
||||
for cut in cuts[tracker]:
|
||||
cutDir = trackerDir.mkdir(cut)
|
||||
cutDir.cd()
|
||||
folder = folders[tracker]["folder"]
|
||||
print(folder)
|
||||
histoBaseName = "Track/" + folder + tracker + "/" + cut + "_"
|
||||
|
||||
# calculate efficiency
|
||||
for histo in efficiencyHistos:
|
||||
canvastitle = (
|
||||
"efficiency_" + histo + ", " + categories[tracker][cut]["title"]
|
||||
)
|
||||
# get efficiency for not electrons category
|
||||
histoName = histoBaseName + "" + efficiencyHistoDict[histo]["variable"]
|
||||
print("not electrons: " + histoName)
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e)
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
name = "efficiency_" + histo
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(eff_elec[lab], colors[i], markers[i + 2], styles[i])
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = ""
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 18
|
||||
myblue = kBlue - 9
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_den[lab].Scale(scale)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
rightmax = 1.05 * hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_elec[lab].Scale(scale)
|
||||
if i == 0:
|
||||
if not plot_electrons_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
set_style(hist_elec[lab], myblue, markers[i], styles[i])
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.35)
|
||||
hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.88, 0.68]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = tracker + "_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
tracker + "Electrons_" + cut + "_" + histo + "." + ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# calculate ghost rate
|
||||
histoBaseName = "Track/" + folder + tracker + "/"
|
||||
for histo in ghostHistos[tracker]:
|
||||
trackerDir.cd()
|
||||
title = "ghost_rate_vs_" + histo
|
||||
|
||||
gPad.SetTicks()
|
||||
histoName = histoBaseName + ghostHistoDict[histo]["variable"]
|
||||
|
||||
ghost = {}
|
||||
hist_den = {}
|
||||
ghost = get_ghost(ghost, hist_den, tf, histoName, label)
|
||||
canvas = TCanvas(title, title)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
mg.Add(ghost[lab])
|
||||
set_style(ghost[lab], colors[i], markers[i], styles[i])
|
||||
|
||||
xtitle = ghostHistoDict[histo]["xTitle"]
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetYaxis().SetTitle("Fraction of fake tracks")
|
||||
mg.Draw("ap")
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
# for lab in label:
|
||||
# ghost[lab].Draw("P SAME")
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.00, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "eta":
|
||||
pos = [0.35, 0.6, 0.85, 0.9]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.80, 0.68]
|
||||
legend = place_legend(canvas, *pos, header="LHCb Simulation", option="LPE")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
# if histo != "nPV":
|
||||
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
|
||||
# else:
|
||||
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
|
||||
# mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
if histo == "eta":
|
||||
mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
# track_name = names[tracker] + " tracks"
|
||||
# latex.DrawLatex(0.7, 0.75, track_name)
|
||||
# canvas.PlaceLegend()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas.SaveAs(
|
||||
"checks/" + tracker + "ghost_rate_" + histo + "." + ftype,
|
||||
)
|
||||
canvas.Write()
|
||||
|
||||
#
|
||||
# Compare electron efficiencies of different trackers
|
||||
#
|
||||
|
||||
plot_electrons_only = True
|
||||
if compare:
|
||||
print("\nCompare Efficiencies: ")
|
||||
outputfile.cd()
|
||||
compareDir = outputfile.mkdir("CompareEff")
|
||||
compareDir.cd()
|
||||
for jcut in compareCuts: # [long, long_fromB, long_fromB_P>5GeV]
|
||||
for histo in efficiencyHistos: # [p, pt, phi, eta, nPV]
|
||||
canvastitle = "efficiency_" + histo + "_" + jcut
|
||||
name = "efficiency_" + histo + "_" + jcut
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
dist_eff = {}
|
||||
dist_hist_den = {}
|
||||
dist_eff_elec = {}
|
||||
dist_hist_elec = {}
|
||||
First = True
|
||||
dist_tracker = ""
|
||||
markeritr = 0
|
||||
|
||||
for tracker in trackers: # [BestLong, Forward, Match, Seed]
|
||||
cut = compareDict[jcut][tracker]
|
||||
folder = folders[tracker]["folder"]
|
||||
print(folder)
|
||||
|
||||
jcolor = compareColors[tracker]
|
||||
|
||||
histoName = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ cut
|
||||
+ "_"
|
||||
+ ""
|
||||
+ efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("not electrons: " + histoName)
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e)
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
if First:
|
||||
dist_eff_elec = eff_elec
|
||||
dist_hist_elec = hist_elec
|
||||
|
||||
if First:
|
||||
dist_tracker = tracker
|
||||
dist_eff = eff
|
||||
dist_hist_den = hist_den
|
||||
First = False
|
||||
|
||||
for i, lab in enumerate(label):
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(
|
||||
eff_elec[lab],
|
||||
colors[jcolor + i],
|
||||
markers[i + markeritr],
|
||||
styles[i],
|
||||
)
|
||||
markeritr = markeritr + 1
|
||||
# set_style(
|
||||
# eff_elec[lab], colors[jcolor], markers[i], styles[i]
|
||||
# )
|
||||
markeritr = 0
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = ""
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 16
|
||||
myblue = kBlue - 7
|
||||
|
||||
dist_cut = compareDict[jcut][dist_tracker]
|
||||
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * dist_hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
dist_hist_den[lab].Scale(scale)
|
||||
if (
|
||||
categories[dist_tracker][dist_cut]["plotElectrons"]
|
||||
and plot_electrons
|
||||
):
|
||||
rightmax = 1.05 * dist_hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
dist_hist_elec[lab].Scale(scale)
|
||||
if i == len(label) - 1:
|
||||
if not plot_electrons_only:
|
||||
set_style(dist_hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
dist_hist_den[lab].SetFillColorAlpha(mygray, 0.5)
|
||||
dist_hist_den[lab].Draw("HIST PLC SAME")
|
||||
if (
|
||||
categories[dist_tracker][dist_cut]["plotElectrons"]
|
||||
and plot_electrons
|
||||
):
|
||||
set_style(
|
||||
dist_hist_elec[lab], mygray, markers[i], styles[i]
|
||||
)
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# dist_hist_elec[lab].SetFillColor(myblue)
|
||||
dist_hist_elec[lab].SetFillColorAlpha(myblue, 0.5)
|
||||
dist_hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# set_style(dist_hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# dist_hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.88, 0.68]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
dist_eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
dist_eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = (
|
||||
"Compare_"
|
||||
+ tracker
|
||||
+ "_"
|
||||
+ cut
|
||||
+ "_"
|
||||
+ histo
|
||||
+ "."
|
||||
+ ftype
|
||||
)
|
||||
else:
|
||||
canvasName = (
|
||||
"Compare_"
|
||||
+ tracker
|
||||
+ "Electrons_"
|
||||
+ cut
|
||||
+ "_"
|
||||
+ histo
|
||||
+ "."
|
||||
+ ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerEfficiency(**vars(args))
|
520
scripts/MyPrCheckerEfficiency.py
Normal file
520
scripts/MyPrCheckerEfficiency.py
Normal file
@ -0,0 +1,520 @@
|
||||
# flake8: noqa
|
||||
|
||||
"""
|
||||
Takes data from Recent_get_resolution_and_eff_data.py and calculates efficiencies
|
||||
|
||||
|
||||
python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_B_normal_weights.root data/resolutions_and_effs_B_electron_weights.root
|
||||
--outfile data_results/PrCheckerNormalElectron.root --label normal electron --trackers Match BestLong
|
||||
|
||||
python scripts/MyPrCheckerEfficiency.py --filename data/resolutions_and_effs_D_electron_weights.root --outfile data_results/PrCheckerDElectron.root
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from ROOT import TMultiGraph, TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import (
|
||||
kGreen,
|
||||
kBlue,
|
||||
kBlack,
|
||||
kAzure,
|
||||
kOrange,
|
||||
kMagenta,
|
||||
kCyan,
|
||||
kGray,
|
||||
kViolet,
|
||||
kTeal,
|
||||
)
|
||||
from ROOT import gROOT, gStyle, gPad
|
||||
from ROOT import TEfficiency
|
||||
from array import array
|
||||
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
from utils.components import unique_name_ext_re, findRootObjByName
|
||||
|
||||
|
||||
def getEfficiencyHistoNames():
|
||||
return ["p", "pt", "phi", "eta", "nPV"]
|
||||
|
||||
|
||||
def getTrackers(trackers):
|
||||
return trackers
|
||||
|
||||
|
||||
# data/resolutions_and_effs_Bd2KstEE_MDmaster.root:Track/...
|
||||
def getOriginFolders():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
# evtl anpassen wenn die folders anders heissen
|
||||
basedict["Velo"]["folder"] = "VeloTrackChecker/"
|
||||
basedict["Upstream"]["folder"] = "UpstreamTrackChecker/"
|
||||
basedict["Forward"]["folder"] = "ForwardTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Match"]["folder"] = "MatchTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["BestLong"]["folder"] = "BestLongTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Seed"]["folder"] = "SeedTrackChecker" + unique_name_ext_re() + "/"
|
||||
|
||||
# basedict["Forward"]["folder"] = "ForwardTrackChecker_7a0dbfa7/"
|
||||
# basedict["Match"]["folder"] = "MatchTrackChecker_29e3152a/"
|
||||
# basedict["BestLong"]["folder"] = "BestLongTrackChecker_4ddacce1/"
|
||||
# basedict["Seed"]["folder"] = "SeedTrackChecker_1b1d5575/"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getTrackNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = "Velo"
|
||||
basedict["Upstream"] = "VeloUT"
|
||||
basedict["Forward"] = "Forward"
|
||||
basedict["Match"] = "Match"
|
||||
basedict["BestLong"] = "BestLong"
|
||||
basedict["Seed"] = "Seed"
|
||||
return basedict
|
||||
|
||||
|
||||
def get_colors():
|
||||
# [kBlack, kGreen + 3, kAzure, kMagenta + 2, kOrange, kCyan + 2]
|
||||
return [kBlack, kAzure, kGreen + 3, kMagenta + 2, kOrange, kCyan + 2]
|
||||
|
||||
|
||||
def get_elec_colors():
|
||||
# [kBlack, kGreen + 3, kAzure, kMagenta + 2, kOrange, kCyan + 2]
|
||||
return [kGray + 2, kBlue - 7, kGreen + 1, kViolet, kOrange - 3, kTeal - 1]
|
||||
|
||||
|
||||
def get_markers():
|
||||
# [20, 24, 21, 22, 23, 25]
|
||||
return [20, 21, 24, 25, 22, 23, 26, 32]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [1003, 3001, 3002, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def getGhostHistoNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = ["eta", "nPV"]
|
||||
basedict["Upstream"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Forward"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Match"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["BestLong"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Seed"] = ["eta", "p", "pt", "nPV"]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the tuple file")
|
||||
parser.add_argument(
|
||||
"--filename",
|
||||
type=str,
|
||||
default=["data/resolutions_and_effs_B.root"],
|
||||
nargs="+",
|
||||
help="input files, including path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="data_results/efficiency_plots.root",
|
||||
help="output file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "Match", "BestLong", "Seed"], # ---
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["EffChecker"],
|
||||
help="label for files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="plot electrons",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons-only",
|
||||
action="store_true",
|
||||
help="plot only electrons",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def get_nicer_var_string(var: str):
|
||||
nice_vars = dict(pt="p_{T}", eta="#eta", phi="#phi")
|
||||
try:
|
||||
return nice_vars[var]
|
||||
except KeyError:
|
||||
return var
|
||||
|
||||
|
||||
def get_eff(eff, hist, tf, histoName, label, var):
|
||||
eff = {}
|
||||
hist = {}
|
||||
var = get_nicer_var_string(var)
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_reconstructed"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominatorName = histoName + "_reconstructible"
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
eff[lab] = teff.CreateGraph()
|
||||
eff[lab].SetName(lab)
|
||||
eff[lab].SetTitle(lab + " not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
eff[lab].SetTitle(lab + " from stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " e^{-}")
|
||||
|
||||
hist[lab] = denominator.Clone()
|
||||
hist[lab].SetName("h_numerator_notElectrons")
|
||||
hist[lab].SetTitle(var + " distribution, not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, e^{-}")
|
||||
|
||||
return eff, hist
|
||||
|
||||
|
||||
def get_ghost(eff, hist, tf, histoName, label):
|
||||
ghost = {}
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_Ghosts"
|
||||
denominatorName = histoName + "_Total"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
print("Numerator = " + numeratorName.replace(unique_name_ext_re(), ""))
|
||||
print("Denominator = " + denominatorName.replace(unique_name_ext_re(), ""))
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
ghost[lab] = teff.CreateGraph()
|
||||
print(lab)
|
||||
ghost[lab].SetName(lab)
|
||||
|
||||
return ghost
|
||||
|
||||
|
||||
def PrCheckerEfficiency(
|
||||
filename,
|
||||
outfile,
|
||||
label,
|
||||
trackers,
|
||||
savepdf,
|
||||
plot_electrons,
|
||||
plot_electrons_only,
|
||||
):
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.ConfigHistos import (
|
||||
efficiencyHistoDict,
|
||||
ghostHistoDict,
|
||||
categoriesDict,
|
||||
getCuts,
|
||||
)
|
||||
from utils.Legend import place_legend
|
||||
|
||||
# from utils.components import unique_name_ext_re, findRootObjByName
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
elec_colors = get_elec_colors()
|
||||
styles = get_fillstyles()
|
||||
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
efficiencyHistoDict = efficiencyHistoDict()
|
||||
efficiencyHistos = getEfficiencyHistoNames()
|
||||
ghostHistos = getGhostHistoNames()
|
||||
ghostHistoDict = ghostHistoDict()
|
||||
categories = categoriesDict()
|
||||
cuts = getCuts()
|
||||
trackers = getTrackers(trackers)
|
||||
folders = getOriginFolders()
|
||||
# names = getTrackNames()
|
||||
|
||||
for tracker in trackers:
|
||||
outputfile.cd()
|
||||
trackerDir = outputfile.mkdir(tracker)
|
||||
trackerDir.cd()
|
||||
|
||||
for cut in cuts[tracker]:
|
||||
cutDir = trackerDir.mkdir(cut)
|
||||
cutDir.cd()
|
||||
folder = folders[tracker]["folder"]
|
||||
print("folder: " + folder.replace(unique_name_ext_re(), ""))
|
||||
histoBaseName = "Track/" + folder + tracker + "/" + cut + "_"
|
||||
|
||||
# calculate efficiency
|
||||
for histo in efficiencyHistos:
|
||||
canvastitle = (
|
||||
"efficiency_" + histo + ", " + categories[tracker][cut]["title"]
|
||||
)
|
||||
# get efficiency for not electrons category
|
||||
histoName = histoBaseName + "" + efficiencyHistoDict[histo]["variable"]
|
||||
print("not electrons: " + histoName.replace(unique_name_ext_re(), ""))
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e.replace(unique_name_ext_re(), ""))
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
name = "efficiency_" + histo
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(eff_elec[lab], elec_colors[i], markers[i], styles[i])
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = "a.u."
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 18
|
||||
myblue = kBlue - 9
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_den[lab].Scale(scale)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
rightmax = 1.05 * hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_elec[lab].Scale(scale)
|
||||
if i == 0:
|
||||
if not plot_electrons_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
set_style(hist_elec[lab], myblue, markers[i], styles[i])
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.35)
|
||||
hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.5, 0.3, 1.0, 0.5] # [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.3, 0.99, 0.5] # [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.4, 0.3, 0.9, 0.5]
|
||||
elif histo == "eta":
|
||||
pos = [0.5, 0.25, 1.0, 0.45]
|
||||
else:
|
||||
pos = [0.35, 0.25, 0.85, 0.45]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = tracker + "_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
tracker + "Electrons_" + cut + "_" + histo + "." + ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# calculate ghost rate
|
||||
print("\ncalculate ghost rate: ")
|
||||
histoBaseName = "Track/" + folder + tracker + "/"
|
||||
for histo in ghostHistos[tracker]:
|
||||
trackerDir.cd()
|
||||
title = "ghost_rate_vs_" + histo
|
||||
|
||||
gPad.SetTicks()
|
||||
histoName = histoBaseName + ghostHistoDict[histo]["variable"]
|
||||
|
||||
ghost = {}
|
||||
hist_den = {}
|
||||
ghost = get_ghost(ghost, hist_den, tf, histoName, label)
|
||||
canvas = TCanvas(title, title)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
mg.Add(ghost[lab])
|
||||
set_style(ghost[lab], colors[i], markers[2 * i], styles[i])
|
||||
|
||||
xtitle = ghostHistoDict[histo]["xTitle"]
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetYaxis().SetTitle("Fraction of fake tracks")
|
||||
mg.Draw("ap")
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
# for lab in label:
|
||||
# ghost[lab].Draw("P SAME")
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.00, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "eta":
|
||||
pos = [0.35, 0.6, 0.85, 0.9]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.80, 0.68]
|
||||
legend = place_legend(canvas, *pos, header="LHCb Simulation", option="LPE")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
# if histo != "nPV":
|
||||
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
|
||||
# else:
|
||||
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
|
||||
# mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
if histo == "eta":
|
||||
mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
# track_name = names[tracker] + " tracks"
|
||||
# latex.DrawLatex(0.7, 0.75, track_name)
|
||||
# canvas.PlaceLegend()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas.SaveAs(
|
||||
"checks/" + tracker + "ghost_rate_" + histo + "." + ftype,
|
||||
)
|
||||
canvas.Write()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerEfficiency(**vars(args))
|
500
scripts/ResidualPrCheckerEfficiency.py
Normal file
500
scripts/ResidualPrCheckerEfficiency.py
Normal file
@ -0,0 +1,500 @@
|
||||
# flake8: noqa
|
||||
#
|
||||
# Takes data from Recent_get_resolution_and_eff_data.py and calculates efficiencies
|
||||
#
|
||||
# python scripts/ResidualPrCheckerEfficiency.py
|
||||
# --filename data/resolutions_and_effs_B.root
|
||||
# --trackers Match --outfile data/compare_effs.root
|
||||
#
|
||||
|
||||
|
||||
import argparse
|
||||
from ROOT import TMultiGraph, TLatex, TCanvas, TFile, TGaxis
|
||||
from ROOT import kGreen, kBlue, kBlack, kAzure, kOrange, kMagenta, kCyan
|
||||
from ROOT import gROOT, gStyle, gPad
|
||||
from ROOT import TEfficiency
|
||||
from array import array
|
||||
|
||||
|
||||
gROOT.SetBatch(True)
|
||||
|
||||
from utils.components import unique_name_ext_re, findRootObjByName
|
||||
|
||||
|
||||
def getEfficiencyHistoNames():
|
||||
return ["p", "pt", "phi", "eta", "nPV"]
|
||||
|
||||
|
||||
def getTrackers(trackers):
|
||||
return trackers
|
||||
|
||||
|
||||
# data/resolutions_and_effs_B.root:Track/...
|
||||
def getOriginFolders():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"]["folder"] = "VeloTrackChecker/"
|
||||
basedict["Upstream"]["folder"] = "UpstreamTrackChecker/"
|
||||
basedict["Forward"]["folder"] = "ForwardTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Match"]["folder"] = "MatchTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["BestLong"]["folder"] = "BestLongTrackChecker" + unique_name_ext_re() + "/"
|
||||
basedict["Seed"]["folder"] = "SeedTrackChecker" + unique_name_ext_re() + "/"
|
||||
|
||||
# basedict["Forward"]["folder"] = "ForwardTrackChecker_7a0dbfa7/"
|
||||
# basedict["Match"]["folder"] = "MatchTrackChecker_29e3152a/"
|
||||
# basedict["ResidualMatch"]["folder"] = "ResidualMatchTrackChecker_955c7a21/"
|
||||
# basedict["BestLong"]["folder"] = "BestLongTrackChecker_c163325d/"
|
||||
# basedict["Seed"]["folder"] = "SeedTrackChecker_1b1d5575/"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getTrackNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = "Velo"
|
||||
basedict["Upstream"] = "VeloUT"
|
||||
basedict["Forward"] = "Forward"
|
||||
basedict["Match"] = "Match"
|
||||
basedict["BestLong"] = "BestLong"
|
||||
basedict["Seed"] = "Seed"
|
||||
return basedict
|
||||
|
||||
|
||||
def get_colors():
|
||||
return [kBlack, kGreen + 3, kAzure, kMagenta + 2, kOrange, kCyan + 2]
|
||||
|
||||
|
||||
def get_markers():
|
||||
return [20, 24, 21, 22, 23, 25]
|
||||
|
||||
|
||||
def get_fillstyles():
|
||||
return [1003, 3001, 3002, 3325, 3144, 3244, 3444]
|
||||
|
||||
|
||||
def getGhostHistoNames():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"BestLong": {},
|
||||
"Seed": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = ["eta", "nPV"]
|
||||
basedict["Upstream"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Forward"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Match"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["BestLong"] = ["eta", "p", "pt", "nPV"]
|
||||
basedict["Seed"] = ["eta", "p", "pt", "nPV"]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def argument_parser():
|
||||
parser = argparse.ArgumentParser(description="location of the tuple file")
|
||||
parser.add_argument(
|
||||
"--filename",
|
||||
type=str,
|
||||
default=["data/resolutions_and_effs_Bd2KstEE_MDmaster.root"],
|
||||
nargs="+",
|
||||
help="input files, including path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--outfile",
|
||||
type=str,
|
||||
default="data/efficiency_plots.root",
|
||||
help="output file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trackers",
|
||||
type=str,
|
||||
nargs="+",
|
||||
default=["Forward", "Match", "BestLong", "Seed"], # ---
|
||||
help="Trackers to plot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--label",
|
||||
nargs="+",
|
||||
default=["EffChecker"],
|
||||
help="label for files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--savepdf",
|
||||
action="store_true",
|
||||
help="save plots in pdf format",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons",
|
||||
action="store_true",
|
||||
default=True,
|
||||
help="plot electrons",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--plot-electrons-only",
|
||||
action="store_true",
|
||||
help="plot only electrons",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def get_files(tf, filename, label):
|
||||
for i, f in enumerate(filename):
|
||||
tf[label[i]] = TFile(f, "read")
|
||||
return tf
|
||||
|
||||
|
||||
def get_nicer_var_string(var: str):
|
||||
nice_vars = dict(pt="p_{T}", eta="#eta", phi="#phi")
|
||||
try:
|
||||
return nice_vars[var]
|
||||
except KeyError:
|
||||
return var
|
||||
|
||||
|
||||
def get_eff(eff, hist, tf, histoName, label, var):
|
||||
eff = {}
|
||||
hist = {}
|
||||
var = get_nicer_var_string(var)
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_reconstructed"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
# numerator = tf[lab].Get(numeratorName)
|
||||
denominatorName = histoName + "_reconstructible"
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
# denominator = tf[lab].Get(denominatorName)
|
||||
if numerator.GetEntries() == 0 or denominator.GetEntries() == 0:
|
||||
continue
|
||||
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
eff[lab] = teff.CreateGraph()
|
||||
eff[lab].SetName(lab)
|
||||
eff[lab].SetTitle(lab + " not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
eff[lab].SetTitle(lab + " from stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
eff[lab].SetTitle(lab + " e^{-}")
|
||||
|
||||
hist[lab] = denominator.Clone()
|
||||
hist[lab].SetName("h_numerator_notElectrons")
|
||||
hist[lab].SetTitle(var + " distribution, not e^{-}")
|
||||
if histoName.find("strange") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, stranges")
|
||||
if histoName.find("electron") != -1:
|
||||
hist[lab].SetTitle(var + " distribution, e^{-}")
|
||||
|
||||
return eff, hist
|
||||
|
||||
|
||||
def get_ghost(eff, hist, tf, histoName, label):
|
||||
ghost = {}
|
||||
for i, lab in enumerate(label):
|
||||
numeratorName = histoName + "_Ghosts"
|
||||
denominatorName = histoName + "_Total"
|
||||
numerator = findRootObjByName(tf[lab], numeratorName)
|
||||
denominator = findRootObjByName(tf[lab], denominatorName)
|
||||
# numerator = tf[lab].Get(numeratorName)
|
||||
# denominator = tf[lab].Get(denominatorName)
|
||||
print("Numerator = " + numeratorName)
|
||||
print("Denominator = " + denominatorName)
|
||||
teff = TEfficiency(numerator, denominator)
|
||||
teff.SetStatisticOption(7)
|
||||
ghost[lab] = teff.CreateGraph()
|
||||
print(lab)
|
||||
ghost[lab].SetName(lab)
|
||||
|
||||
return ghost
|
||||
|
||||
|
||||
def PrCheckerEfficiency(
|
||||
filename,
|
||||
outfile,
|
||||
label,
|
||||
trackers,
|
||||
savepdf,
|
||||
plot_electrons,
|
||||
plot_electrons_only,
|
||||
):
|
||||
from utils.LHCbStyle import setLHCbStyle, set_style
|
||||
from utils.ConfigHistos import (
|
||||
efficiencyHistoDict,
|
||||
ghostHistoDict,
|
||||
categoriesDict,
|
||||
getCuts,
|
||||
)
|
||||
from utils.Legend import place_legend
|
||||
|
||||
setLHCbStyle()
|
||||
|
||||
markers = get_markers()
|
||||
colors = get_colors()
|
||||
styles = get_fillstyles()
|
||||
|
||||
tf = {}
|
||||
tf = get_files(tf, filename, label)
|
||||
outputfile = TFile(outfile, "recreate")
|
||||
|
||||
latex = TLatex()
|
||||
latex.SetNDC()
|
||||
latex.SetTextSize(0.05)
|
||||
|
||||
efficiencyHistoDict = efficiencyHistoDict()
|
||||
efficiencyHistos = getEfficiencyHistoNames()
|
||||
ghostHistos = getGhostHistoNames()
|
||||
ghostHistoDict = ghostHistoDict()
|
||||
categories = categoriesDict()
|
||||
cuts = getCuts()
|
||||
trackers = getTrackers(trackers)
|
||||
folders = getOriginFolders()
|
||||
# names = getTrackNames()
|
||||
|
||||
for tracker in trackers:
|
||||
outputfile.cd()
|
||||
trackerDir = outputfile.mkdir(tracker)
|
||||
trackerDir.cd()
|
||||
|
||||
for cut in cuts[tracker]:
|
||||
cutDir = trackerDir.mkdir(cut)
|
||||
cutDir.cd()
|
||||
folder = folders[tracker]["folder"]
|
||||
print(folder)
|
||||
histoBaseName = "Track/" + folder + tracker + "/" + cut + "_"
|
||||
|
||||
# calculate efficiency
|
||||
for histo in efficiencyHistos:
|
||||
canvastitle = (
|
||||
"efficiency_" + histo + ", " + categories[tracker][cut]["title"]
|
||||
)
|
||||
# get efficiency for not electrons category
|
||||
histoName = histoBaseName + "" + efficiencyHistoDict[histo]["variable"]
|
||||
print("not electrons: " + histoName)
|
||||
eff = {}
|
||||
hist_den = {}
|
||||
eff, hist_den = get_eff(eff, hist_den, tf, histoName, label, histo)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
histoNameElec = (
|
||||
"Track/"
|
||||
+ folder
|
||||
+ tracker
|
||||
+ "/"
|
||||
+ categories[tracker][cut]["Electrons"]
|
||||
)
|
||||
histoName_e = (
|
||||
histoNameElec + "_" + efficiencyHistoDict[histo]["variable"]
|
||||
)
|
||||
print("electrons: " + histoName_e)
|
||||
eff_elec = {}
|
||||
hist_elec = {}
|
||||
eff_elec, hist_elec = get_eff(
|
||||
eff_elec,
|
||||
hist_elec,
|
||||
tf,
|
||||
histoName_e,
|
||||
label,
|
||||
histo,
|
||||
)
|
||||
name = "efficiency_" + histo
|
||||
canvas = TCanvas(name, canvastitle)
|
||||
canvas.SetRightMargin(0.1)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
if not plot_electrons_only:
|
||||
mg.Add(eff[lab])
|
||||
set_style(eff[lab], colors[i], markers[i], styles[i])
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
mg.Add(eff_elec[lab])
|
||||
set_style(
|
||||
eff_elec[lab], colors[i + 2], markers[i + 1], styles[i]
|
||||
)
|
||||
|
||||
mg.Draw("AP")
|
||||
mg.GetYaxis().SetRangeUser(0, 1.05)
|
||||
xtitle = efficiencyHistoDict[histo]["xTitle"]
|
||||
unit_l = xtitle.split("[")
|
||||
if "]" in unit_l[-1]:
|
||||
unit = unit_l[-1].replace("]", "")
|
||||
else:
|
||||
unit = ""
|
||||
print(unit)
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitle(
|
||||
"Efficiency of Long Tracks",
|
||||
) # (" + str(round(hist_den[label[0]].GetBinWidth(1), 2)) + f"{unit})"+"^{-1}")
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
mygray = 18
|
||||
myblue = kBlue - 9
|
||||
for i, lab in enumerate(label):
|
||||
rightmax = 1.05 * hist_den[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_den[lab].Scale(scale)
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
rightmax = 1.05 * hist_elec[lab].GetMaximum()
|
||||
scale = gPad.GetUymax() / rightmax
|
||||
hist_elec[lab].Scale(scale)
|
||||
if i == 0:
|
||||
if not plot_electrons_only:
|
||||
set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
hist_den[lab].Draw("HIST PLC SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
set_style(hist_elec[lab], myblue, markers[i], styles[i])
|
||||
hist_elec[lab].SetFillColorAlpha(myblue, 0.35)
|
||||
hist_elec[lab].Draw("HIST PLC SAME")
|
||||
# else:
|
||||
# print(
|
||||
# "No distribution plotted for other labels.",
|
||||
# "Can be added by uncommenting the code below this print statement.",
|
||||
# )
|
||||
# set_style(hist_den[lab], mygray, markers[i], styles[i])
|
||||
# gStyle.SetPalette(2, array("i", [mygray - 1, myblue + 1]))
|
||||
# hist_den[lab].Draw("HIST PLC SAME")
|
||||
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.01, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.88, 0.68]
|
||||
legend = place_legend(
|
||||
canvas, *pos, header="LHCb Simulation", option="LPE"
|
||||
)
|
||||
for le in legend.GetListOfPrimitives():
|
||||
if "distribution" in le.GetLabel():
|
||||
le.SetOption("LF")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
for lab in label:
|
||||
if not plot_electrons_only:
|
||||
eff[lab].Draw("P SAME")
|
||||
if categories[tracker][cut]["plotElectrons"] and plot_electrons:
|
||||
eff_elec[lab].Draw("P SAME")
|
||||
cutName = categories[tracker][cut]["title"]
|
||||
latex.DrawLatex(legend.GetX1() + 0.01, legend.GetY1() - 0.05, cutName)
|
||||
low = 0
|
||||
high = 1.05
|
||||
gPad.Update()
|
||||
axis = TGaxis(
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymin(),
|
||||
gPad.GetUxmax(),
|
||||
gPad.GetUymax(),
|
||||
low,
|
||||
high,
|
||||
510,
|
||||
"+U",
|
||||
)
|
||||
axis.SetTitleFont(132)
|
||||
axis.SetTitleSize(0.06)
|
||||
axis.SetTitleOffset(0.55)
|
||||
axis.SetTitle(
|
||||
"# Tracks " + get_nicer_var_string(histo) + " distribution [a.u.]",
|
||||
)
|
||||
axis.SetLabelSize(0)
|
||||
axis.Draw()
|
||||
canvas.RedrawAxis()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
if not plot_electrons_only:
|
||||
canvasName = tracker + "_" + cut + "_" + histo + "." + ftype
|
||||
else:
|
||||
canvasName = (
|
||||
tracker + "Electrons_" + cut + "_" + histo + "." + ftype
|
||||
)
|
||||
canvas.SaveAs("checks/" + canvasName)
|
||||
# canvas.SetRightMargin(0.05)
|
||||
canvas.Write()
|
||||
|
||||
# calculate ghost rate
|
||||
histoBaseName = "Track/" + folder + tracker + "/"
|
||||
for histo in ghostHistos[tracker]:
|
||||
trackerDir.cd()
|
||||
title = "ghost_rate_vs_" + histo
|
||||
|
||||
gPad.SetTicks()
|
||||
histoName = histoBaseName + ghostHistoDict[histo]["variable"]
|
||||
|
||||
ghost = {}
|
||||
hist_den = {}
|
||||
ghost = get_ghost(ghost, hist_den, tf, histoName, label)
|
||||
canvas = TCanvas(title, title)
|
||||
mg = TMultiGraph()
|
||||
for i, lab in enumerate(label):
|
||||
mg.Add(ghost[lab])
|
||||
set_style(ghost[lab], colors[i], markers[i], styles[i])
|
||||
|
||||
xtitle = ghostHistoDict[histo]["xTitle"]
|
||||
mg.GetXaxis().SetTitle(xtitle)
|
||||
mg.GetYaxis().SetTitle("Fraction of fake tracks")
|
||||
mg.Draw("ap")
|
||||
mg.GetXaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleSize(0.06)
|
||||
mg.GetYaxis().SetTitleOffset(1.1)
|
||||
mg.GetXaxis().SetRangeUser(*efficiencyHistoDict[histo]["range"])
|
||||
mg.GetXaxis().SetNdivisions(10, 5, 0)
|
||||
# for lab in label:
|
||||
# ghost[lab].Draw("P SAME")
|
||||
if histo == "p":
|
||||
pos = [0.53, 0.4, 1.00, 0.71]
|
||||
elif histo == "pt":
|
||||
pos = [0.5, 0.4, 0.98, 0.71]
|
||||
elif histo == "eta":
|
||||
pos = [0.35, 0.6, 0.85, 0.9]
|
||||
elif histo == "phi":
|
||||
pos = [0.3, 0.3, 0.9, 0.6]
|
||||
else:
|
||||
pos = [0.4, 0.37, 0.80, 0.68]
|
||||
legend = place_legend(canvas, *pos, header="LHCb Simulation", option="LPE")
|
||||
legend.SetTextFont(132)
|
||||
legend.SetTextSize(0.04)
|
||||
legend.Draw()
|
||||
# if histo != "nPV":
|
||||
# latex.DrawLatex(0.7, 0.85, "LHCb simulation")
|
||||
# else:
|
||||
# latex.DrawLatex(0.2, 0.85, "LHCb simulation")
|
||||
# mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
if histo == "eta":
|
||||
mg.GetYaxis().SetRangeUser(0, 0.4)
|
||||
# track_name = names[tracker] + " tracks"
|
||||
# latex.DrawLatex(0.7, 0.75, track_name)
|
||||
# canvas.PlaceLegend()
|
||||
if savepdf:
|
||||
filestypes = ["pdf"] # , "png", "eps", "C", "ps", "tex"]
|
||||
for ftype in filestypes:
|
||||
canvas.SaveAs(
|
||||
"checks/" + tracker + "ghost_rate_" + histo + "." + ftype,
|
||||
)
|
||||
canvas.Write()
|
||||
|
||||
outputfile.Write()
|
||||
outputfile.Close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argument_parser()
|
||||
args = parser.parse_args()
|
||||
PrCheckerEfficiency(**vars(args))
|
1532
scripts/notebooks/Test.ipynb
Normal file
1532
scripts/notebooks/Test.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
59
scripts/utils/CompareConfigHistos.py
Normal file
59
scripts/utils/CompareConfigHistos.py
Normal file
@ -0,0 +1,59 @@
|
||||
###############################################################################
|
||||
# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration #
|
||||
# #
|
||||
# This software is distributed under the terms of the GNU General Public #
|
||||
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
|
||||
# #
|
||||
# In applying this licence, CERN does not waive the privileges and immunities #
|
||||
# granted to it by virtue of its status as an Intergovernmental Organization #
|
||||
# or submit itself to any jurisdiction. #
|
||||
###############################################################################
|
||||
#
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
def getCompare():
|
||||
basedict = {
|
||||
"long": {},
|
||||
"long_fromB": {},
|
||||
"long_fromB_P>5GeV": {},
|
||||
}
|
||||
|
||||
basedict["long"]["BestLong"] = "01_long"
|
||||
basedict["long"]["Seed"] = "02_long"
|
||||
basedict["long"]["Match"] = "01_long"
|
||||
basedict["long"]["ResidualMatch"] = "01_long"
|
||||
basedict["long"]["Forward"] = "01_long"
|
||||
|
||||
basedict["long_fromB"]["BestLong"] = "05_long_fromB"
|
||||
basedict["long_fromB"]["Seed"] = "04_long_fromB"
|
||||
basedict["long_fromB"]["Match"] = "05_long_fromB"
|
||||
basedict["long_fromB"]["ResidualMatch"] = "05_long_fromB"
|
||||
basedict["long_fromB"]["Forward"] = "05_long_fromB"
|
||||
|
||||
basedict["long_fromB_P>5GeV"]["BestLong"] = "06_long_fromB_P>5GeV"
|
||||
basedict["long_fromB_P>5GeV"]["Seed"] = "05_long_fromB_P>5GeV"
|
||||
basedict["long_fromB_P>5GeV"]["Match"] = "06_long_fromB_P>5GeV"
|
||||
basedict["long_fromB_P>5GeV"]["ResidualMatch"] = "06_long_fromB_P>5GeV"
|
||||
basedict["long_fromB_P>5GeV"]["Forward"] = "06_long_fromB_P>5GeV"
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getCompColors():
|
||||
basedict = {
|
||||
"Forward": {},
|
||||
"Match": {},
|
||||
"Seed": {},
|
||||
"BestLong": {},
|
||||
}
|
||||
|
||||
basedict["Forward"] = 0
|
||||
basedict["Match"] = 4
|
||||
basedict["Seed"] = 6
|
||||
basedict["BestLong"] = 1
|
||||
|
||||
return basedict
|
599
scripts/utils/ConfigHistos.py
Normal file
599
scripts/utils/ConfigHistos.py
Normal file
@ -0,0 +1,599 @@
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
def efficiencyHistoDict():
|
||||
basedict = {
|
||||
"eta": {},
|
||||
"p": {},
|
||||
"pt": {},
|
||||
"phi": {},
|
||||
"nPV": {},
|
||||
"docaz": {},
|
||||
"z": {},
|
||||
}
|
||||
|
||||
basedict["eta"]["xTitle"] = "#eta"
|
||||
basedict["eta"]["variable"] = "Eta"
|
||||
basedict["eta"]["range"] = [2, 5]
|
||||
|
||||
basedict["p"]["xTitle"] = "p [MeV]"
|
||||
basedict["p"]["variable"] = "P"
|
||||
basedict["p"]["range"] = [0, 50001]
|
||||
|
||||
basedict["pt"]["xTitle"] = "p_{T} [MeV]"
|
||||
basedict["pt"]["variable"] = "Pt"
|
||||
basedict["pt"]["range"] = [0, 5001]
|
||||
|
||||
basedict["phi"]["xTitle"] = "#phi [rad]"
|
||||
basedict["phi"]["variable"] = "Phi"
|
||||
basedict["phi"]["range"] = [-3.15, 3.15]
|
||||
|
||||
basedict["nPV"]["xTitle"] = "# of PVs"
|
||||
basedict["nPV"]["variable"] = "nPV"
|
||||
basedict["nPV"]["range"] = [0, 15]
|
||||
|
||||
basedict["docaz"]["xTitle"] = "docaz [mm]"
|
||||
basedict["docaz"]["variable"] = "docaz"
|
||||
basedict["docaz"]["range"] = [0, 10]
|
||||
|
||||
basedict["z"]["xTitle"] = "PV z coordinate [mm]"
|
||||
basedict["z"]["variable"] = "z"
|
||||
basedict["z"]["range"] = [-200, 200]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def ghostHistoDict():
|
||||
basedict = {
|
||||
"eta": {},
|
||||
"nPV": {},
|
||||
"pt": {},
|
||||
"p": {},
|
||||
}
|
||||
|
||||
basedict["eta"]["xTitle"] = "#eta"
|
||||
basedict["eta"]["variable"] = "Eta"
|
||||
basedict["eta"]["range"] = [1.9, 5.1]
|
||||
|
||||
basedict["nPV"]["xTitle"] = "# of PVs"
|
||||
basedict["nPV"]["variable"] = "nPV"
|
||||
basedict["nPV"]["range"] = [0, 16.5]
|
||||
|
||||
basedict["pt"]["xTitle"] = "p_{T} [MeV]"
|
||||
basedict["pt"]["variable"] = "Pt"
|
||||
basedict["pt"]["range"] = [0, 5000]
|
||||
|
||||
basedict["p"]["xTitle"] = "p [MeV]"
|
||||
basedict["p"]["variable"] = "P"
|
||||
basedict["p"]["range"] = [0, 50000]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def getCuts():
|
||||
basedict = {
|
||||
"Velo": {},
|
||||
"Upstream": {},
|
||||
"Forward": {},
|
||||
"MuonMatch": {},
|
||||
"Match": {},
|
||||
"ResidualMatch": {},
|
||||
"Seed": {},
|
||||
"Downstream": {},
|
||||
"BestLong": {},
|
||||
"BestDownstream": {},
|
||||
"LongGhostFiltered": {},
|
||||
"DownstreamGhostFiltered": {},
|
||||
}
|
||||
|
||||
basedict["Velo"] = [
|
||||
"01_velo",
|
||||
"02_long",
|
||||
"03_long_P>5GeV",
|
||||
"04_long_strange",
|
||||
"05_long_strange_P>5GeV",
|
||||
"06_long_fromB",
|
||||
"07_long_fromB_P>5GeV",
|
||||
"11_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
"12_UT_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
basedict["Upstream"] = [
|
||||
"01_velo",
|
||||
"02_velo+UT",
|
||||
"03_velo+UT_P>5GeV",
|
||||
"07_long",
|
||||
"08_long_P>5GeV",
|
||||
"09_long_fromB",
|
||||
"10_long_fromB_P>5GeV",
|
||||
"14_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
"15_UT_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
basedict["Forward"] = [
|
||||
"01_long",
|
||||
"02_long_P>5GeV",
|
||||
"03_long_strange",
|
||||
"04_long_strange_P>5GeV",
|
||||
"05_long_fromB",
|
||||
"06_long_fromB_P>5GeV",
|
||||
"10_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
"11_UT_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
basedict["MuonMatch"] = ["01_long", "02_long_muon", "04_long_pion"]
|
||||
|
||||
basedict["Match"] = [
|
||||
"01_long",
|
||||
"02_long_P>5GeV",
|
||||
"03_long_strange",
|
||||
"04_long_strange_P>5GeV",
|
||||
"05_long_fromB",
|
||||
"06_long_fromB_P>5GeV",
|
||||
"10_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
"11_UT_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
|
||||
basedict["ResidualMatch"] = basedict["Match"]
|
||||
|
||||
basedict["Seed"] = [
|
||||
"01_hasT",
|
||||
"02_long",
|
||||
"03_long_P>5GeV",
|
||||
"04_long_fromB",
|
||||
"05_long_fromB_P>5GeV",
|
||||
# "08_noVelo+UT+T_strange",
|
||||
# "09_noVelo+UT+T_strange_P>5GeV",
|
||||
# "12_noVelo+UT+T_SfromDB_P>5GeV",
|
||||
]
|
||||
|
||||
basedict["Downstream"] = [
|
||||
"01_UT+T",
|
||||
"05_noVelo+UT+T_strange",
|
||||
"06_noVelo+UT+T_strange_P>5GeV",
|
||||
"13_noVelo+UT+T_SfromDB",
|
||||
"14_noVelo+UT+T_SfromDB_P>5GeV",
|
||||
]
|
||||
|
||||
basedict["BestLong"] = [
|
||||
"01_long",
|
||||
"02_long_P>5GeV",
|
||||
"03_long_strange",
|
||||
"04_long_strange_P>5GeV",
|
||||
"05_long_fromB",
|
||||
"06_long_fromB_P>5GeV",
|
||||
"10_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
|
||||
basedict["BestDownstream"] = [
|
||||
"01_UT+T",
|
||||
"05_noVelo+UT+T_strange",
|
||||
"06_noVelo+UT+T_strange_P>5GeV",
|
||||
"13_noVelo+UT+T_SfromDB",
|
||||
"14_noVelo+UT+T_SfromDB_P>5GeV",
|
||||
]
|
||||
|
||||
basedict["LongGhostFiltered"] = [
|
||||
"01_long",
|
||||
"02_long_P>5GeV",
|
||||
"03_long_strange",
|
||||
"04_long_strange_P>5GeV",
|
||||
"05_long_fromB",
|
||||
"06_long_fromB_P>5GeV",
|
||||
"10_long_fromB_P>3GeV_Pt>0.5GeV",
|
||||
]
|
||||
|
||||
basedict["DownstreamGhostFiltered"] = [
|
||||
"01_UT+T",
|
||||
"05_noVelo+UT+T_strange",
|
||||
"06_noVelo+UT+T_strange_P>5GeV",
|
||||
"13_noVelo+UT+T_SfromDB",
|
||||
"14_noVelo+UT+T_SfromDB_P>5GeV",
|
||||
]
|
||||
|
||||
return basedict
|
||||
|
||||
|
||||
def categoriesDict():
|
||||
basedict = defaultdict(lambda: defaultdict(dict))
|
||||
# VELO
|
||||
basedict["Velo"]["01_velo"]["title"] = "Velo, 2 <#eta< 5"
|
||||
basedict["Velo"]["02_long"]["title"] = "Long, 2 <#eta< 5"
|
||||
basedict["Velo"]["03_long_P>5GeV"]["title"] = "Long, p>5GeV, 2<#eta< 5"
|
||||
basedict["Velo"]["04_long_strange"]["title"] = "Long, from Strange, 2 <#eta < 5"
|
||||
basedict["Velo"]["05_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from Strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Velo"]["06_long_fromB"]["title"] = "Long from B, 2<#eta<5"
|
||||
basedict["Velo"]["07_long_fromB_P>5GeV"]["title"] = "Long from B, p>5GeV, 2<#eta<5"
|
||||
basedict["Velo"]["11_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2<#eta<5"
|
||||
basedict["Velo"]["11_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2<#eta<5"
|
||||
basedict["Velo"]["12_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "UT Long, from B, p>3GeV, pt>0.5GeV, 2<#eta<5"
|
||||
basedict["Velo"]["01_velo"]["plotElectrons"] = False
|
||||
basedict["Velo"]["02_long"]["plotElectrons"] = True
|
||||
basedict["Velo"]["03_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Velo"]["04_long_strange"]["plotElectrons"] = False
|
||||
basedict["Velo"]["05_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Velo"]["06_long_fromB"]["plotElectrons"] = True
|
||||
basedict["Velo"]["07_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["Velo"]["11_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Velo"]["11_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Velo"]["12_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
|
||||
basedict["Velo"]["02_long"]["Electrons"] = "08_long_electrons"
|
||||
basedict["Velo"]["06_long_fromB"]["Electrons"] = "09_long_fromB_electrons"
|
||||
basedict["Velo"]["07_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>5GeV"
|
||||
basedict["Velo"]["11_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "11_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
# UPSTREAM
|
||||
basedict["Upstream"]["01_velo"]["title"] = "Velo, 2 <#eta < 5"
|
||||
basedict["Upstream"]["02_velo+UT"]["title"] = "VeloUT, 2 <#eta < 5"
|
||||
basedict["Upstream"]["03_velo+UT_P>5GeV"]["title"] = "VeloUT, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Upstream"]["07_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["Upstream"]["08_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Upstream"]["09_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["Upstream"]["10_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Upstream"]["14_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long, from B, p>3GeV, pt>0.5GeV"
|
||||
basedict["Upstream"]["14_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>3GeV, pt>0.5GeV"
|
||||
basedict["Upstream"]["15_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long, from B, p>3GeV, pt>0.5GeV"
|
||||
|
||||
basedict["Upstream"]["01_velo"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["02_velo+UT"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["03_velo+UT_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["07_long"]["plotElectrons"] = True
|
||||
basedict["Upstream"]["08_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["09_long_fromB"]["plotElectrons"] = True
|
||||
basedict["Upstream"]["10_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["Upstream"]["14_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["14_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["15_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Upstream"]["07_long"]["Electrons"] = "11_long_electrons"
|
||||
basedict["Upstream"]["09_long_fromB"]["Electrons"] = "12_long_fromB_electrons"
|
||||
basedict["Upstream"]["10_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "13_long_fromB_electrons_P>5GeV"
|
||||
basedict["Upstream"]["14_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "14_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
# FORwARD
|
||||
basedict["Forward"]["01_long"]["Electrons"] = "07_long_electrons"
|
||||
basedict["Forward"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons"
|
||||
basedict["Forward"]["06_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "09_long_fromB_electrons_P>5GeV"
|
||||
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
basedict["Forward"]["01_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["Forward"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Forward"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5"
|
||||
basedict["Forward"]["04_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Forward"]["05_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["Forward"]["06_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV 2 <#eta < 5"
|
||||
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["Forward"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["Forward"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "UT Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["Forward"]["01_long"]["plotElectrons"] = True
|
||||
basedict["Forward"]["02_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Forward"]["03_long_strange"]["plotElectrons"] = False
|
||||
basedict["Forward"]["04_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Forward"]["05_long_fromB"]["plotElectrons"] = True
|
||||
basedict["Forward"]["06_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["Forward"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Forward"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
|
||||
# MUONMATCH
|
||||
basedict["MuonMatch"]["01_long"]["title"] = "Long, forward track, 2 <#eta< 5"
|
||||
basedict["MuonMatch"]["02_long_muon"][
|
||||
"title"
|
||||
] = "Long, #mu, forward track, 2 <#eta< 5"
|
||||
basedict["MuonMatch"]["04_long_pion"][
|
||||
"title"
|
||||
] = "Long, #pi, forward track, 2 <#eta< 5"
|
||||
|
||||
# MATCH
|
||||
basedict["Match"]["01_long"]["Electrons"] = "07_long_electrons"
|
||||
basedict["Match"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons"
|
||||
basedict["Match"]["06_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "09_long_fromB_electrons_P>5GeV"
|
||||
basedict["Match"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
basedict["Match"]["01_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["Match"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Match"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5"
|
||||
basedict["Match"]["04_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Match"]["05_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["Match"]["06_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV 2 <#eta < 5"
|
||||
basedict["Match"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["Match"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["Match"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "UT Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["Match"]["01_long"]["plotElectrons"] = True
|
||||
basedict["Match"]["02_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Match"]["03_long_strange"]["plotElectrons"] = False
|
||||
basedict["Match"]["04_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Match"]["05_long_fromB"]["plotElectrons"] = True
|
||||
basedict["Match"]["06_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["Match"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Match"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["Match"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
|
||||
# ResidualMATCH
|
||||
basedict["ResidualMatch"]["01_long"]["Electrons"] = "07_long_electrons"
|
||||
basedict["ResidualMatch"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons"
|
||||
basedict["ResidualMatch"]["06_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "09_long_fromB_electrons_P>5GeV"
|
||||
basedict["ResidualMatch"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
basedict["ResidualMatch"]["01_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["03_long_strange"][
|
||||
"title"
|
||||
] = "Long, from strange, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["04_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["05_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["06_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["ResidualMatch"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "UT Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["ResidualMatch"]["01_long"]["plotElectrons"] = True
|
||||
basedict["ResidualMatch"]["02_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["ResidualMatch"]["03_long_strange"]["plotElectrons"] = False
|
||||
basedict["ResidualMatch"]["04_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["ResidualMatch"]["05_long_fromB"]["plotElectrons"] = True
|
||||
basedict["ResidualMatch"]["06_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["ResidualMatch"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["ResidualMatch"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
basedict["ResidualMatch"]["11_UT_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
|
||||
# SEED
|
||||
basedict["Seed"]["01_hasT"]["Electrons"] = "13_hasT_electrons"
|
||||
basedict["Seed"]["02_long"]["Electrons"] = "14_long_electrons"
|
||||
basedict["Seed"]["03_long_P>5GeV"]["Electrons"] = "16_long_electrons_P>5GeV"
|
||||
basedict["Seed"]["04_long_fromB"]["Electrons"] = "15_long_fromB_electrons"
|
||||
basedict["Seed"]["05_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "17_long_fromB_electrons_P>5GeV"
|
||||
|
||||
basedict["Seed"]["01_hasT"]["title"] = "T, 2 <#eta < 5"
|
||||
basedict["Seed"]["02_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["Seed"]["03_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Seed"]["04_long_fromB"]["title"] = "Long, from B, 2 <#eta < 5"
|
||||
basedict["Seed"]["05_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Seed"]["08_noVelo+UT+T_strange"][
|
||||
"title"
|
||||
] = "Down from strange, 2 <#eta < 5"
|
||||
basedict["Seed"]["09_noVelo+UT+T_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Seed"]["12_noVelo+UT+T_SfromDB_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, p>5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["Seed"]["01_hasT"]["plotElectrons"] = False
|
||||
basedict["Seed"]["02_long"]["plotElectrons"] = True
|
||||
basedict["Seed"]["03_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Seed"]["04_long_fromB"]["plotElectrons"] = True
|
||||
basedict["Seed"]["05_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
##################################
|
||||
basedict["Seed"]["08_noVelo+UT+T_strange"]["plotElectrons"] = False
|
||||
basedict["Seed"]["09_noVelo+UT+T_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Seed"]["12_noVelo+UT+T_SfromDB_P>5GeV"]["plotElectrons"] = False
|
||||
|
||||
# DOWNSTREAM
|
||||
basedict["Downstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5"
|
||||
basedict["Downstream"]["05_noVelo+UT+T_strange"][
|
||||
"title"
|
||||
] = "Down from strange, 2 <#eta < 5"
|
||||
basedict["Downstream"]["06_noVelo+UT+T_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["Downstream"]["13_noVelo+UT+T_SfromDB"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, 2 <#eta < 5"
|
||||
basedict["Downstream"]["14_noVelo+UT+T_SfromDB_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, p>5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["Downstream"]["01_UT+T"]["plotElectrons"] = False
|
||||
basedict["Downstream"]["05_noVelo+UT+T_strange"]["plotElectrons"] = False
|
||||
basedict["Downstream"]["06_noVelo+UT+T_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["Downstream"]["13_noVelo+UT+T_SfromDB"]["plotElectrons"] = False
|
||||
basedict["Downstream"]["14_noVelo+UT+T_SfromDB_P>5GeV"]["plotElectrons"] = False
|
||||
|
||||
# BESTLONG
|
||||
basedict["BestLong"]["01_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["BestLong"]["02_long_P>5GeV"]["title"] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["BestLong"]["03_long_strange"]["title"] = "Long, from strange, 2 <#eta < 5"
|
||||
basedict["BestLong"]["04_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["BestLong"]["05_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["BestLong"]["06_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV 2 <#eta < 5"
|
||||
basedict["BestLong"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["BestLong"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["BestLong"]["01_long"]["plotElectrons"] = True
|
||||
basedict["BestLong"]["02_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["BestLong"]["03_long_strange"]["plotElectrons"] = False
|
||||
basedict["BestLong"]["04_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["BestLong"]["05_long_fromB"]["plotElectrons"] = True
|
||||
basedict["BestLong"]["06_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["BestLong"]["10_long_fromB_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
basedict["BestLong"]["10_long_strange_P>3GeV_Pt>0.5GeV"]["plotElectrons"] = False
|
||||
|
||||
basedict["BestLong"]["01_long"]["Electrons"] = "07_long_electrons"
|
||||
basedict["BestLong"]["05_long_fromB"]["Electrons"] = "08_long_fromB_electrons"
|
||||
basedict["BestLong"]["06_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "09_long_fromB_electrons_P>5GeV"
|
||||
basedict["BestLong"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
#
|
||||
# BESTDOWNSTREAM
|
||||
basedict["BestDownstream"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5"
|
||||
basedict["BestDownstream"]["05_noVelo+UT+T_strange"][
|
||||
"title"
|
||||
] = "Down from strange, 2 <#eta < 5"
|
||||
basedict["BestDownstream"]["06_noVelo+UT+T_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["BestDownstream"]["13_noVelo+UT+T_SfromDB"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, 2 <#eta < 5"
|
||||
basedict["BestDownstream"]["14_noVelo+UT+T_SfromDB_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, p>5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["BestDownstream"]["01_UT+T"]["plotElectrons"] = False
|
||||
basedict["BestDownstream"]["05_noVelo+UT+T_strange"]["plotElectrons"] = False
|
||||
basedict["BestDownstream"]["06_noVelo+UT+T_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["BestDownstream"]["13_noVelo+UT+T_SfromDB"]["plotElectrons"] = False
|
||||
basedict["BestDownstream"]["14_noVelo+UT+T_SfromDB_P>5GeV"]["plotElectrons"] = False
|
||||
|
||||
#
|
||||
# LONGGHOSTFILTERED
|
||||
basedict["LongGhostFiltered"]["01_long"]["title"] = "Long, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["02_long_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, p>5GeV, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["03_long_strange"][
|
||||
"title"
|
||||
] = "Long, from strange, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["04_long_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Long, from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["05_long_fromB"]["title"] = "Long from B, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["06_long_fromB_P>5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>5GeV 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from B, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
basedict["LongGhostFiltered"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"title"
|
||||
] = "Long from strange, p>3GeV, pt>0.5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["LongGhostFiltered"]["01_long"]["plotElectrons"] = True
|
||||
basedict["LongGhostFiltered"]["02_long_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["LongGhostFiltered"]["03_long_strange"]["plotElectrons"] = False
|
||||
basedict["LongGhostFiltered"]["04_long_strange_P>5GeV"]["plotElectrons"] = False
|
||||
basedict["LongGhostFiltered"]["05_long_fromB"]["plotElectrons"] = True
|
||||
basedict["LongGhostFiltered"]["06_long_fromB_P>5GeV"]["plotElectrons"] = True
|
||||
basedict["LongGhostFiltered"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
basedict["LongGhostFiltered"]["10_long_strange_P>3GeV_Pt>0.5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
|
||||
basedict["LongGhostFiltered"]["01_long"]["Electrons"] = "07_long_electrons"
|
||||
basedict["LongGhostFiltered"]["05_long_fromB"][
|
||||
"Electrons"
|
||||
] = "08_long_fromB_electrons"
|
||||
basedict["LongGhostFiltered"]["06_long_fromB_P>5GeV"][
|
||||
"Electrons"
|
||||
] = "09_long_fromB_electrons_P>5GeV"
|
||||
basedict["LongGhostFiltered"]["10_long_fromB_P>3GeV_Pt>0.5GeV"][
|
||||
"Electrons"
|
||||
] = "10_long_fromB_electrons_P>3GeV_Pt>0.5GeV"
|
||||
|
||||
# DOWNSTREAMGHOSTFILTERED
|
||||
basedict["DownstreamGhostFiltered"]["01_UT+T"]["title"] = "UT+T, 2 <#eta < 5"
|
||||
basedict["DownstreamGhostFiltered"]["05_noVelo+UT+T_strange"][
|
||||
"title"
|
||||
] = "Down from strange, 2 <#eta < 5"
|
||||
basedict["DownstreamGhostFiltered"]["06_noVelo+UT+T_strange_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange, p>5GeV, 2 <#eta < 5"
|
||||
basedict["DownstreamGhostFiltered"]["13_noVelo+UT+T_SfromDB"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, 2 <#eta < 5"
|
||||
basedict["DownstreamGhostFiltered"]["14_noVelo+UT+T_SfromDB_P>5GeV"][
|
||||
"title"
|
||||
] = "Down from strange from B/D, p>5GeV, 2 <#eta < 5"
|
||||
|
||||
basedict["DownstreamGhostFiltered"]["01_UT+T"]["plotElectrons"] = False
|
||||
basedict["DownstreamGhostFiltered"]["05_noVelo+UT+T_strange"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
basedict["DownstreamGhostFiltered"]["06_noVelo+UT+T_strange_P>5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
basedict["DownstreamGhostFiltered"]["13_noVelo+UT+T_SfromDB"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
basedict["DownstreamGhostFiltered"]["14_noVelo+UT+T_SfromDB_P>5GeV"][
|
||||
"plotElectrons"
|
||||
] = False
|
||||
|
||||
return basedict
|
137
scripts/utils/LHCbStyle.py
Normal file
137
scripts/utils/LHCbStyle.py
Normal file
@ -0,0 +1,137 @@
|
||||
from ROOT import gROOT, TH1, TH1F, TH1D, TEfficiency
|
||||
from ROOT import TStyle
|
||||
|
||||
|
||||
def set_style(graph, color, marker, style):
|
||||
graph.SetLineColor(color)
|
||||
graph.SetMarkerColor(color)
|
||||
graph.SetMarkerSize(1.0)
|
||||
graph.SetMarkerStyle(marker)
|
||||
if (
|
||||
type(graph) == TH1F
|
||||
or type(graph) == TH1
|
||||
or type(graph) == TH1D
|
||||
or type(graph) == TEfficiency
|
||||
):
|
||||
graph.SetFillColor(color)
|
||||
# graph.SetFillColorAlpha(color, 0.5)
|
||||
graph.SetFillStyle(style)
|
||||
graph.SetLineWidth(2)
|
||||
if style == 0:
|
||||
graph.SetFillColor(0)
|
||||
graph.SetStats(False)
|
||||
graph.GetYaxis().SetTitleOffset(1.0)
|
||||
if type(graph) != TEfficiency:
|
||||
graph.GetYaxis().SetTitleOffset(0.85)
|
||||
graph.GetYaxis().SetTitleSize(0.06)
|
||||
graph.GetYaxis().SetLabelSize(0.06)
|
||||
graph.GetXaxis().SetTitleSize(0.06)
|
||||
graph.GetXaxis().SetLabelSize(0.06)
|
||||
graph.GetXaxis().SetTitleFont(132)
|
||||
graph.GetXaxis().SetLabelFont(132)
|
||||
graph.GetYaxis().SetTitleFont(132)
|
||||
graph.GetYaxis().SetLabelFont(132)
|
||||
|
||||
return graph
|
||||
|
||||
|
||||
def setLHCbStyle():
|
||||
global lhcbStyle
|
||||
|
||||
lhcbFont = 132
|
||||
lhcbTSize = 0.05
|
||||
lhcbWidth = 2
|
||||
|
||||
lhcbStyle = TStyle("lhcbStyle", "LHCb plots style")
|
||||
lhcbStyle.SetFillColor(1)
|
||||
lhcbStyle.SetFillStyle(1001) # solid
|
||||
lhcbStyle.SetFrameFillColor(0)
|
||||
lhcbStyle.SetFrameBorderMode(0)
|
||||
lhcbStyle.SetPadBorderMode(0)
|
||||
lhcbStyle.SetPadColor(0)
|
||||
lhcbStyle.SetCanvasBorderMode(0)
|
||||
lhcbStyle.SetCanvasColor(0)
|
||||
lhcbStyle.SetStatColor(0)
|
||||
lhcbStyle.SetLegendBorderSize(0)
|
||||
lhcbStyle.SetLegendFont(132)
|
||||
|
||||
# use large fonts
|
||||
lhcbStyle.SetTextFont(lhcbFont)
|
||||
lhcbStyle.SetTitleFont(lhcbFont)
|
||||
lhcbStyle.SetTextSize(lhcbTSize)
|
||||
lhcbStyle.SetLabelFont(lhcbFont, "x")
|
||||
lhcbStyle.SetLabelFont(lhcbFont, "y")
|
||||
lhcbStyle.SetLabelFont(lhcbFont, "z")
|
||||
lhcbStyle.SetLabelSize(lhcbTSize, "x")
|
||||
lhcbStyle.SetLabelSize(lhcbTSize, "y")
|
||||
lhcbStyle.SetLabelSize(lhcbTSize, "z")
|
||||
lhcbStyle.SetTitleFont(lhcbFont)
|
||||
lhcbStyle.SetTitleFont(lhcbFont, "x")
|
||||
lhcbStyle.SetTitleFont(lhcbFont, "y")
|
||||
lhcbStyle.SetTitleFont(lhcbFont, "z")
|
||||
lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "x")
|
||||
lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "y")
|
||||
lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "z")
|
||||
|
||||
# set the paper & margin sizes
|
||||
lhcbStyle.SetPaperSize(20, 26)
|
||||
lhcbStyle.SetPadTopMargin(0.05)
|
||||
lhcbStyle.SetPadRightMargin(0.05) # increase for colz plots
|
||||
lhcbStyle.SetPadBottomMargin(0.16)
|
||||
lhcbStyle.SetPadLeftMargin(0.14)
|
||||
|
||||
# use medium bold lines and thick markers
|
||||
lhcbStyle.SetLineWidth(lhcbWidth)
|
||||
lhcbStyle.SetFrameLineWidth(lhcbWidth)
|
||||
lhcbStyle.SetHistLineWidth(lhcbWidth)
|
||||
lhcbStyle.SetFuncWidth(lhcbWidth)
|
||||
lhcbStyle.SetGridWidth(lhcbWidth)
|
||||
lhcbStyle.SetLineStyleString(2, "[12 12]")
|
||||
# postscript dashes
|
||||
lhcbStyle.SetMarkerStyle(20)
|
||||
lhcbStyle.SetMarkerSize(1.0)
|
||||
|
||||
# label offsets
|
||||
lhcbStyle.SetLabelOffset(0.010, "X")
|
||||
lhcbStyle.SetLabelOffset(0.010, "Y")
|
||||
|
||||
# by default, do not display histogram decorations:
|
||||
lhcbStyle.SetOptStat(0)
|
||||
# lhcbStyle.SetOptStat("emr") # show only nent -e , mean - m , rms -r
|
||||
# full opts at http:#root.cern.ch/root/html/TStyle.html#TStyle:SetOptStat
|
||||
lhcbStyle.SetStatFormat("6.3g") # specified as c printf options
|
||||
lhcbStyle.SetOptTitle(0)
|
||||
lhcbStyle.SetOptFit(0)
|
||||
# lhcbStyle.SetOptFit(1011) # order is probability, Chi2, errors, parameters
|
||||
# titles
|
||||
lhcbStyle.SetTitleOffset(0.95, "X")
|
||||
lhcbStyle.SetTitleOffset(0.85, "Y")
|
||||
lhcbStyle.SetTitleOffset(1.2, "Z")
|
||||
lhcbStyle.SetTitleFillColor(0)
|
||||
lhcbStyle.SetTitleStyle(0)
|
||||
lhcbStyle.SetTitleBorderSize(0)
|
||||
lhcbStyle.SetTitleFont(lhcbFont, "title")
|
||||
lhcbStyle.SetTitleX(0.0)
|
||||
lhcbStyle.SetTitleY(1.0)
|
||||
lhcbStyle.SetTitleW(1.0)
|
||||
lhcbStyle.SetTitleH(0.05)
|
||||
|
||||
# look of the statistics box:
|
||||
lhcbStyle.SetStatBorderSize(0)
|
||||
lhcbStyle.SetStatFont(lhcbFont)
|
||||
lhcbStyle.SetStatFontSize(0.05)
|
||||
lhcbStyle.SetStatX(0.9)
|
||||
lhcbStyle.SetStatY(0.9)
|
||||
lhcbStyle.SetStatW(0.25)
|
||||
lhcbStyle.SetStatH(0.15)
|
||||
|
||||
# put tick marks on top and RHS of plots
|
||||
lhcbStyle.SetPadTickX(1)
|
||||
lhcbStyle.SetPadTickY(1)
|
||||
|
||||
# histogram divisions: only 5 in x to avoid label overlaps
|
||||
lhcbStyle.SetNdivisions(505, "x")
|
||||
lhcbStyle.SetNdivisions(510, "y")
|
||||
|
||||
gROOT.SetStyle("lhcbStyle")
|
||||
return
|
156
scripts/utils/Legend.py
Normal file
156
scripts/utils/Legend.py
Normal file
@ -0,0 +1,156 @@
|
||||
from __future__ import division
|
||||
import ROOT
|
||||
from ROOT import gStyle
|
||||
|
||||
# Some convenience function to easily iterate over the parts of the collections
|
||||
# Needed if importing this script from another script in case TMultiGraphs are used
|
||||
# ROOT.SetMemoryPolicy(ROOT.kMemoryStrict)
|
||||
|
||||
# Start a bit right of the Yaxis and above the Xaxis to not overlap with the ticks
|
||||
start, stop = 0.28, 0.52
|
||||
x_width, y_width = 0.4, 0.2
|
||||
PLACES = [
|
||||
(start, stop - y_width, start + x_width, stop), # top left opt
|
||||
(start, start, start + x_width, start + y_width), # bottom left opt
|
||||
(stop - x_width, stop - y_width, stop, stop), # top right opt
|
||||
(stop - x_width, start, stop, start + y_width), # bottom right opt
|
||||
(stop - x_width, 0.5 - y_width / 2, stop, 0.5 + y_width / 2), # right
|
||||
(start, 0.5 - y_width / 2, start + x_width, 0.5 + y_width / 2),
|
||||
] # left
|
||||
|
||||
# Needed if importing this script from another script in case TMultiGraphs are used
|
||||
# ROOT.SetMemoryPolicy(ROOT.kMemoryStrict)
|
||||
|
||||
|
||||
def transform_to_user(canvas, x1, y1, x2, y2):
|
||||
"""
|
||||
Transforms from Pad coordinates to User coordinates.
|
||||
|
||||
This can probably be replaced by using the built-in conversion commands.
|
||||
"""
|
||||
xstart = canvas.GetX1()
|
||||
xlength = canvas.GetX2() - xstart
|
||||
xlow = xlength * x1 + xstart
|
||||
xhigh = xlength * x2 + xstart
|
||||
if canvas.GetLogx():
|
||||
xlow = 10**xlow
|
||||
xhigh = 10**xhigh
|
||||
|
||||
ystart = canvas.GetY1()
|
||||
ylength = canvas.GetY2() - ystart
|
||||
ylow = ylength * y1 + ystart
|
||||
yhigh = ylength * y2 + ystart
|
||||
if canvas.GetLogy():
|
||||
ylow = 10**ylow
|
||||
yhigh = 10**yhigh
|
||||
|
||||
return xlow, ylow, xhigh, yhigh
|
||||
|
||||
|
||||
def overlap_h(hist, x1, y1, x2, y2):
|
||||
xlow = hist.FindFixBin(x1)
|
||||
xhigh = hist.FindFixBin(x2)
|
||||
for i in range(xlow, xhigh + 1):
|
||||
val = hist.GetBinContent(i)
|
||||
# Values
|
||||
if y1 <= val <= y2:
|
||||
return True
|
||||
# Errors
|
||||
if val + hist.GetBinErrorUp(i) > y1 and val - hist.GetBinErrorLow(i) < y2:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def overlap_rect(rect1, rect2):
|
||||
"""Do the two rectangles overlap?"""
|
||||
if rect1[0] > rect2[2] or rect1[2] < rect2[0]:
|
||||
return False
|
||||
if rect1[1] > rect2[3] or rect1[3] < rect2[1]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def to_list(pointer):
|
||||
"""turns pointer to array into list after checking if pointer is nullptr"""
|
||||
if len(pointer) == 0:
|
||||
return []
|
||||
return list(pointer)
|
||||
|
||||
|
||||
def overlap_g(graph, x1, y1, x2, y2):
|
||||
x_values = to_list(graph.GetX())
|
||||
y_values = to_list(graph.GetY())
|
||||
|
||||
x_err = to_list(graph.GetEX()) or [0] * len(x_values)
|
||||
y_err = to_list(graph.GetEY()) or [0] * len(y_values)
|
||||
|
||||
for x, ex, y, ey in zip(x_values, x_err, y_values, y_err):
|
||||
# Could maybe be less conservative
|
||||
if overlap_rect((x1, y1, x2, y2), (x - ex, y - ey, x + ex, y + ey)):
|
||||
# print "Overlap with graph", graph.GetName(), "at point", (x, y)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def place_legend(
|
||||
canvas,
|
||||
x1=None,
|
||||
y1=None,
|
||||
x2=None,
|
||||
y2=None,
|
||||
header="LHCb Simulation",
|
||||
option="lpe",
|
||||
):
|
||||
gStyle.SetFillStyle(0)
|
||||
gStyle.SetTextSize(0.06)
|
||||
# If position is specified, use that
|
||||
if all(x is not None for x in (x1, x2, y1, y2)):
|
||||
return canvas.BuildLegend(x1, y1, x2, y2, header, option)
|
||||
|
||||
# Make sure all objects are correctly registered
|
||||
canvas.Update()
|
||||
|
||||
# Build a list of objects to check for overlaps
|
||||
objects = []
|
||||
for x in canvas.GetListOfPrimitives():
|
||||
if isinstance(x, ROOT.TH1) or isinstance(x, ROOT.TGraph):
|
||||
objects.append(x)
|
||||
elif isinstance(x, ROOT.THStack) or isinstance(x, ROOT.TMultiGraph):
|
||||
objects.extend(x)
|
||||
|
||||
for place in PLACES:
|
||||
place_user = canvas.PadtoU(*place)
|
||||
# Make sure there are no overlaps
|
||||
if any(obj.Overlap(*place_user) for obj in objects):
|
||||
continue
|
||||
return canvas.BuildLegend(
|
||||
place[0],
|
||||
place[1],
|
||||
place[2],
|
||||
place[3],
|
||||
header,
|
||||
option,
|
||||
)
|
||||
# As a fallback, use the default values, taken from TCanvas::BuildLegend
|
||||
return canvas.BuildLegend(0.4, 0.37, 0.88, 0.68, header, option)
|
||||
|
||||
|
||||
# Monkey patch ROOT objects to make it all work
|
||||
ROOT.THStack.__iter__ = lambda self: iter(self.GetHists())
|
||||
ROOT.TMultiGraph.__iter__ = lambda self: iter(self.GetListOfGraphs())
|
||||
ROOT.TH1.Overlap = overlap_h
|
||||
ROOT.TGraph.Overlap = overlap_g
|
||||
ROOT.TPad.PadtoU = transform_to_user
|
||||
ROOT.TPad.PlaceLegend = place_legend
|
||||
|
||||
|
||||
def set_legend(legend, gr, title, colors, label):
|
||||
legend.SetTextSize(0.05)
|
||||
legend.SetFillColor(0)
|
||||
legend.SetShadowColor(0)
|
||||
legend.SetBorderSize(0)
|
||||
legend.SetTextFont(132)
|
||||
for idx, lab in enumerate(label):
|
||||
legend.AddEntry(gr[lab], title[lab], "lep").SetTextColor(colors[idx])
|
||||
|
||||
return legend
|
48
scripts/utils/components.py
Normal file
48
scripts/utils/components.py
Normal file
@ -0,0 +1,48 @@
|
||||
# flake8: noqaq
|
||||
import inspect
|
||||
import re
|
||||
import importlib
|
||||
import warnings
|
||||
from collections import OrderedDict
|
||||
from functools import lru_cache
|
||||
from html import escape as html_escape
|
||||
|
||||
# String that separates a name from its unique ID
|
||||
_UNIQUE_SEPARATOR = "_"
|
||||
_IDENTITY_LENGTH = 8
|
||||
_IDENTITY_TABLE = {}
|
||||
|
||||
# If a property ends with this key, it is a pseudo-property which exists to
|
||||
# hold the data dependencies of another property value
|
||||
_DATA_DEPENDENCY_KEY_SUFFIX = "_PyConfDataDependencies"
|
||||
|
||||
_FLOW_GRAPH_NODE_COLOUR = "aliceblue"
|
||||
_FLOW_GRAPH_INPUT_COLOUR = "deepskyblue1"
|
||||
_FLOW_GRAPH_OUTPUT_COLOUR = "coral1"
|
||||
|
||||
|
||||
def unique_name_ext_re():
|
||||
return "(?:%s[1234567890abcdef]{%s})?" % (_UNIQUE_SEPARATOR, _IDENTITY_LENGTH)
|
||||
|
||||
|
||||
def findRootObjByName(rootFile, name):
|
||||
"""
|
||||
Finds the object with given name in the given root file,
|
||||
where name is a regular expression or a set of them separated by '/' in case directories are used
|
||||
"""
|
||||
curObj = rootFile
|
||||
for n in name.split("/"):
|
||||
matches = [
|
||||
k.GetName() for k in curObj.GetListOfKeys() if re.fullmatch(n, k.GetName())
|
||||
]
|
||||
if len(matches) > 1:
|
||||
raise Exception(
|
||||
"Collision of names in Root : found several objects with name matching %s inside %s : %s"
|
||||
% (n, curObj.GetName(), matches)
|
||||
)
|
||||
if len(matches) == 0:
|
||||
raise Exception(
|
||||
"Failed to find object with name %s inside %s" % (n, curObj.GetName())
|
||||
)
|
||||
curObj = curObj.Get(matches[0])
|
||||
return curObj
|
16
setup.sh
Executable file
16
setup.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f "env/miniconda.sh" ]; then
|
||||
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O env/miniconda.sh
|
||||
fi
|
||||
|
||||
if [ ! -d "env/tuner_env" ]; then
|
||||
bash env/miniconda.sh -b -p env/tuner_env &&
|
||||
(
|
||||
source env/tuner_env/bin/activate
|
||||
conda install -y -c conda-forge mamba
|
||||
conda env create -f env/environment.yaml -n tuner
|
||||
conda activate tuner
|
||||
conda env config vars set PATH="/cvmfs/sft.cern.ch/lcg/external/texlive/latest/bin/x86_64-linux:${PATH}"
|
||||
)
|
||||
fi
|
186
test/ghost_data_new_vars.ipynb
Normal file
186
test/ghost_data_new_vars.ipynb
Normal file
File diff suppressed because one or more lines are too long
408
test/ghost_data_test.ipynb
Normal file
408
test/ghost_data_test.ipynb
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user