Belle II Software
release-08-00-10
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
b2klm-numberToIndex.cc
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
/* KLM headers. */
10
#include <klm/dataobjects/KLMChannelArrayIndex.h>
11
12
/* Basf2 headers. */
13
#include <framework/logging/Logger.h>
14
15
/* C++ headers. */
16
#include <cstdlib>
17
#include <iostream>
18
19
using namespace
Belle2
;
20
21
int
main
(
int
argc,
char
* argv[])
22
{
23
/* Print the usage message if --help or -h are used. */
24
if
(argc == 1 or std::string(argv[1]) ==
"--help"
or std::string(argv[1]) ==
"-h"
) {
25
std::cout <<
"Usage: "
<< argv[0] <<
" [CHANNEL1] [CHANNEL2] ... [CHANNELN]\n\n"
26
" This tool converts the given channel numbers into the corresponding channel indexes.\n"
27
" A basf2 FATAL message is printed if a channel number does not exist.\n"
;
28
return
0;
29
}
30
/* Print the error messages when needed. */
31
int
nChannels = argc - 1;
32
/* cppcheck-suppress knownConditionTrueFalse */
33
if
(nChannels == 0) {
34
B2ERROR(
"There are no channels to convert."
);
35
return
0;
36
}
37
/* Convert the channel number into the channel index. */
38
const
KLMChannelArrayIndex
* channelArrayIndex = &(
KLMChannelArrayIndex::Instance
());
39
for
(
int
i = 1; i <= nChannels; ++i) {
40
KLMChannelNumber
number = std::atoi(argv[i]);
41
uint16_t index = channelArrayIndex->
getIndex
(number);
42
B2INFO(
"Channel number: "
<< number <<
" ==> Channel index: "
<< index);
43
}
44
return
0;
45
}
Belle2::KLMChannelArrayIndex
KLM channel array index.
Definition:
KLMChannelArrayIndex.h:23
Belle2::KLMChannelArrayIndex::Instance
static const KLMChannelArrayIndex & Instance()
Instantiation.
Definition:
KLMChannelArrayIndex.cc:26
Belle2::KLMElementArrayIndex::getIndex
uint16_t getIndex(uint16_t number) const
Get element index.
Definition:
KLMElementArrayIndex.cc:52
Belle2::KLMChannelNumber
uint16_t KLMChannelNumber
Channel number.
Definition:
KLMElementNumberDefinitions.h:36
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
klm
tools
b2klm-numberToIndex.cc
Generated on Fri Aug 9 2024 00:58:44 for Belle II Software by
1.9.1