Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
GANILAnalysis
MFMlib
Commits
050faf13
Commit
050faf13
authored
Mar 09, 2021
by
LEGEARD Luc
☢
Browse files
Remove a bug in MFMtest with usage of MFMReaGenericFrame
parent
2d8cd7c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
35 deletions
+57
-35
sources/CUtilities.h
sources/CUtilities.h
+10
-0
sources/MFMReaGenericFrame.cc
sources/MFMReaGenericFrame.cc
+29
-19
sources/MFMReaGenericFrame.h
sources/MFMReaGenericFrame.h
+1
-1
sources/MFMtest.cc
sources/MFMtest.cc
+16
-14
sources/Version.h
sources/Version.h
+1
-1
No files found.
sources/CUtilities.h
View file @
050faf13
#include <stdlib.h>
#ifndef __CUtilities__
#define __CUtilities__
//
...
...
@@ -65,6 +66,15 @@ class UtilVector_c
char
*
GetPointer
()
const
{
return
fPt
;
}
//_______________________________________________________________________________
char
GetValue
(
int
i
){
return
(((
char
*
)
fPt
)[
i
]);
}
//_______________________________________________________________________________
void
SetValue
(
int
i
,
char
c
){
((
char
*
)
fPt
)[
i
]
=
c
;
}
//_______________________________________________________________________________
int
GetSize
()
const
{
return
fSize
;
...
...
sources/MFMReaGenericFrame.cc
View file @
050faf13
...
...
@@ -24,11 +24,13 @@ MFMReaGenericFrame::MFMReaGenericFrame(){
fEnergy
=
NULL
;
fTime
=
NULL
;
fNumberOfBoards
=
0
;
fInitTabValuesDone
=
false
;
}
//_______________________________________________________________________________
MFMReaGenericFrame
::~
MFMReaGenericFrame
(){
int
card
;
int
card
=
0
;
if
(
fInitTabValuesDone
==
false
)
return
;
for
(
card
=
0
;
card
<
fNumberOfBoards
;
card
++
){
if
(
fStatus1
[
card
]
!=
NULL
)
delete
[]
fStatus1
[
card
];
if
(
fStatus2
[
card
]
!=
NULL
)
delete
[]
fStatus2
[
card
];
...
...
@@ -41,7 +43,6 @@ MFMReaGenericFrame::~MFMReaGenericFrame(){
if
(
fTypeTNS
!=
NULL
)
delete
[]
fTypeTNS
;
if
(
fEnergy
!=
NULL
)
delete
[]
fEnergy
;
if
(
fTime
!=
NULL
)
delete
[]
fTime
;
}
//_______________________________________________________________________________
...
...
@@ -194,11 +195,13 @@ string MFMReaGenericFrame::GetStat(string info)const {
//_______________________________________________________________________________
void
MFMReaGenericFrame
::
InitTabValues
(
uint16_t
*
listofboards
,
int
numberofboards
){
// method to init tab for analyse and use to fill TTree
int
board
=
0
,
channel
=
0
;
fNumberOfBoards
=
numberofboards
;
fInitTabValuesDone
=
true
;
for
(
board
=
0
;
board
<
NUMEXO_MAX_NUMB_BOARDS
;
board
++
)
{
fConvertNoBoardIndex
[
board
]
=
0
;
fConvertIndexNoBoard
[
board
]
=
0
;
fConvertNoBoardIndex
[
board
]
=
0
;
fConvertIndexNoBoard
[
board
]
=
0
;
}
if
(
fEnergy
==
NULL
)
fEnergy
=
new
uint16_t
*
[
fNumberOfBoards
];
if
(
fTime
==
NULL
)
fTime
=
new
uint16_t
*
[
fNumberOfBoards
];
...
...
@@ -213,13 +216,14 @@ void MFMReaGenericFrame::InitTabValues(uint16_t *listofboards,int numberofboard
fTime
[
board
]
=
new
uint16_t
[
NUMEXO_NB_CHANNELS
];
fTypeTNS
[
board
]
=
new
uint16_t
[
NUMEXO_NB_CHANNELS
];
fStatus1
[
board
]
=
new
uint16_t
[
NUMEXO_NB_CHANNELS
];
fStatus2
[
board
]
=
new
uint16_t
[
NUMEXO_NB_CHANNELS
];
fStatus2
[
board
]
=
new
uint16_t
[
NUMEXO_NB_CHANNELS
];
}
ResetTabValues
();
}
//_______________________________________________________________________________
void
MFMReaGenericFrame
::
ResetTabValues
(){
if
(
fInitTabValuesDone
==
false
)
return
;
int
board
=
0
,
channel
=
0
;
fTabValueEventNumber
=
0
;
...
...
@@ -227,13 +231,14 @@ int board =0, channel=0;
fChannel
=
0
;
fBoardNumber
=
0
;
fBoardIndex
=
0
;
for
(
board
=
0
;
board
<
fNumberOfBoards
;
board
++
){
for
(
channel
=
0
;
channel
<
NUMEXO_NB_CHANNELS
;
channel
++
){
fEnergy
[
board
][
channel
]
=
0
;
fTime
[
board
][
channel
]
=
0
;
fTypeTNS
[
board
][
channel
]
=
0
;
fStatus1
[
board
][
channel
]
=
0
;
fStatus2
[
board
][
channel
]
=
0
;
fEnergy
[
board
][
channel
]
=
0
;
fTime
[
board
][
channel
]
=
0
;
fTypeTNS
[
board
][
channel
]
=
0
;
fStatus1
[
board
][
channel
]
=
0
;
fStatus2
[
board
][
channel
]
=
0
;
}
}
}
...
...
@@ -244,13 +249,19 @@ void MFMReaGenericFrame::SetTabValues(){
fBoardNumber
=
GetBoardId
();
fTabValueEventNumber
=
GetEventNumber
();
fTabValueTimeStamp
=
GetTimeStamp
();
fBoardIndex
=
fConvertNoBoardIndex
[
fBoardNumber
];
fEnergy
[
fBoardIndex
][
fChannel
]
=
GetEnergy
();
fTime
[
fBoardIndex
][
fChannel
]
=
GetTime
();
fTypeTNS
[
fBoardIndex
][
fChannel
]
=
GetTypeTns
();
fStatus1
[
fBoardIndex
][
fChannel
]
=
GetStatus
(
0
);
fStatus2
[
fBoardIndex
][
fChannel
]
=
GetStatus
(
1
);
fBoardIndex
=
fConvertNoBoardIndex
[
fBoardNumber
];
if
(
fInitTabValuesDone
==
false
)
return
;
if
((
fNumberOfBoards
>
fBoardIndex
)
and
(
fNumberOfBoards
>
fChannel
)){
fEnergy
[
fBoardIndex
][
fChannel
]
=
GetEnergy
();
fTime
[
fBoardIndex
][
fChannel
]
=
GetTime
();
fTypeTNS
[
fBoardIndex
][
fChannel
]
=
GetTypeTns
();
fStatus1
[
fBoardIndex
][
fChannel
]
=
GetStatus
(
0
);
fStatus2
[
fBoardIndex
][
fChannel
]
=
GetStatus
(
1
);
}
else
{
cout
<<
"Warning , index of card or No Channel to big
\n
"
;
cout
<<
dec
<<
" BoardIndex = "
<<
fBoardIndex
<<
" <-> NumberOfBoards = "
<<
fNumberOfBoards
<<
"
\n
"
;
cout
<<
" ChannelIndex = "
<<
fChannel
<<
" <-> NUMEXO_NB_CHANNELS = "
<<
NUMEXO_NB_CHANNELS
<<
"
\n
"
;
}
}
//_______________________________________________________________________________
...
...
@@ -275,7 +286,6 @@ string MFMReaGenericFrame::GetDumpData(char mode, bool nozero) const {
if
(
GetEventNumber
()
==
0xFFFFFFFF
)
{
ss
<<
"No Event , so no event dump. Get a new event frame"
;
}
else
{
ss
<<
" E = "
<<
GetEnergy
()
<<
" T = "
<<
GetTime
()
;
}
display
=
ss
.
str
();
...
...
sources/MFMReaGenericFrame.h
View file @
050faf13
...
...
@@ -48,11 +48,11 @@ class MFMReaGenericFrame : public MFMNumExoFrame
uint16_t
**
fStatus1
,
**
fStatus2
,
**
fTypeTNS
,
**
fEnergy
,
**
fTime
;
uint32_t
fTabValueEventNumber
;
uint64_t
fTabValueTimeStamp
;
bool
fInitTabValuesDone
;
// init of Tab/Values for root Tree convertion
int
fNumberOfBoards
;
//sum of board
int
fBoardNumber
;
//current number of board
int
fBoardIndex
;
//current index of board
int
fChannel
;
//current number of channel
// attributes to do convertion between index and number of board
int
fConvertNoBoardIndex
[
NUMEXO_MAX_NUMB_BOARDS
];
int
fConvertIndexNoBoard
[
NUMEXO_MAX_NUMB_BOARDS
];
...
...
sources/MFMtest.cc
View file @
050faf13
...
...
@@ -67,7 +67,6 @@ int fNbFramesStart;// no of frame to start the dump if dump is asked
int
fNbFramesDump
;
// no of frame to the dump if dump is asked
uint32_t
fEventNumber
;
int
fNbItems
;
int
fVerbose
;
int
fFormat
;
int
fNbOfEvent
;
...
...
@@ -137,7 +136,7 @@ int main(int argc, char **argv) {
fNbFramesDump
=
0
;
fVerbose
=
5
;
fNbItems
=-
1
;
// if -1 , we leave frame to get its defined value
fExpSize
=-
1
;
fExpType
=-
1
;
fExpEndian
=-
1
;
...
...
@@ -180,9 +179,9 @@ int main(int argc, char **argv) {
fS3eGUNframe
=
new
MFMS3eGUNFrame
();
fS3Synchroframe
=
new
MFMS3SynchroFrame
();
fReaGenericframe
=
new
MFMReaGenericFrame
();
uint16_t
tabcard
[
1
];
tabcard
[
0
]
=
112
;
fReaGenericframe
->
InitTabValues
(
tabcard
,
1
);
uint16_t
tabcard
[
1
];
// this is given in example
tabcard
[
0
]
=
112
;
// this is given in example
//
fReaGenericframe -> InitTabValues(tabcard,1);
// this is given in example
fReaTraceframe
=
new
MFMReaTraceFrame
();
fSiriusframe
=
new
MFMSiriusFrame
();
fDeflectorframe
=
new
MFMS3DeflectorFrame
();
...
...
@@ -296,8 +295,9 @@ int main(int argc, char **argv) {
if
(
fLun
<=
0
)
{
Error
.
TreatError
(
2
,
0
,
"Error open file :"
,
filename
);
}
cout
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
cout
<<
" MFMtest "
<<
endl
;
cout
<<
" MFMtest "
<<
" version : "
<<
MFM_VERSION
<<
endl
;
cout
<<
"| READ MFMFrame from file : "
<<
filename
<<
""
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
cout
<<
endl
;
...
...
@@ -366,6 +366,7 @@ int main(int argc, char **argv) {
cout
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
cout
<<
"| MFMtest "
<<
" version : "
<<
MFM_VERSION
<<
endl
;
cout
<<
"| TEST MFMFrame in extract mode from file "
<<
filename
<<
""
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
...
...
@@ -482,6 +483,7 @@ int main(int argc, char **argv) {
if
(
fPatternMode
==
true
)
{
cout
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
cout
<<
"| MFMtest "
<<
" version : "
<<
MFM_VERSION
<<
endl
;
cout
<<
"| TEST MFMFrame in Pattern mode from file "
<<
filename
<<
""
<<
endl
;
cout
<<
"-------------------------------------------------------------"
<<
endl
;
...
...
@@ -639,13 +641,12 @@ void deletefunction(){
delete
(
fS3eGUNframe
);
if
(
fS3Synchroframe
)
delete
(
fS3Synchroframe
);
if
(
fReaGenericframe
)
delete
(
fReaGenericframe
);
if
(
fReaTraceframe
)
delete
(
fReaTraceframe
);
if
(
fSiriusframe
)
delete
(
fSiriusframe
)
;
if
(
fDeflectorframe
)
delete
(
fDeflectorframe
)
;
if
(
fReaGenericframe
)
delete
(
fReaGenericframe
);
if
(
fReaTraceframe
)
delete
(
fReaTraceframe
);
if
(
fSiriusframe
)
delete
(
fSiriusframe
)
;
if
(
fDeflectorframe
)
delete
(
fDeflectorframe
)
;
}
//_______________________________________________________________________________________________________________________
void
PrintQuestion
()
{
cout
<<
"Which Frame you want to generate?
\n
"
;
...
...
@@ -700,9 +701,10 @@ void Announce(char* progname){
}
//_______________________________________________________________________________________________________________________
void
Help
()
{
cout
<<
"MFMtest.exe : utility to generate and use MFM frame in different formats
\n
"
;
cout
<<
" The generated frames are stored in a file
\n
"
;
cout
<<
endl
;
cout
<<
" MFMtest "
<<
" Version : "
<<
MFM_VERSION
<<
endl
;
cout
<<
" Utility to generate and use MFM frame in different formats
\n
"
;
cout
<<
" The generated frames are stored in a file
\n
"
;
cout
<<
" Usage :
\n
"
;
cout
<<
" MFMtest.exe [-h] or [--help] , print this help
\n
"
;
...
...
sources/Version.h
View file @
050faf13
#define MFM_VERSION "21.0
2.01
"
#define MFM_VERSION "21.0
3.XX
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment