Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
20ac8cf7
Commit
20ac8cf7
authored
Jan 10, 2017
by
yannick legoc
Browse files
Implemented LISTMODE_S data block without the need to specify the list of board controllers.
Corrected remote DPP controllers to read live data from the lst file.
parent
0eb96c72
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/controllers/npp/DPPAcquisitionController.cpp
View file @
20ac8cf7
...
...
@@ -17,6 +17,9 @@
*/
#include "DPPAcquisitionController.h"
#include "ListModeBlock.h"
#include "controllers/common/datafile/AsciiDataFileManager.h"
#include "controllers/common/datafile/AsciiDataFile.h"
#include "controllers/common/family/Families.h"
#include <lstdpp128/lstdpp.h>
...
...
@@ -32,6 +35,8 @@ const string DPPAcquisitionController::NO_LIVE_PROCESS = "none";
const
string
DPPAcquisitionController
::
HISTOGRAM_PROCESS
=
"histogram"
;
const
string
DPPAcquisitionController
::
COINCIDENCE_PROCESS
=
"coincidence"
;
DataBlock
*
decodeListModeBlock
(
AsciiDataFileManager
*
dataFileManager
,
AsciiDataFile
*
dataFile
,
string
blockType
,
typename
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>::
iterator
iter
,
typename
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>::
iterator
end
);
/*
* Constructor
*/
...
...
@@ -62,6 +67,8 @@ DPPAcquisitionController::DPPAcquisitionController(const string& name) :
m_coincidenceController
.
init
(
this
,
"coincidence_controller"
);
registerRefresher
(
nbAdcControllers
,
&
DPPAcquisitionController
::
refreshNbAdcControllersProperty
,
this
);
dynamic_cast
<
AsciiDataFileManager
*>
(
DataFileManager
::
getAsciiInstance
())
->
addDataBlockFunction
(
"LISTMODE_S"
,
&
decodeListModeBlock
);
}
/*
...
...
@@ -104,6 +111,45 @@ void DPPAcquisitionController::postConfiguration() {
setCrateNumber
();
registerRefresher
(
liveProcessType
,
&
DPPAcquisitionController
::
refreshLiveProcessTypeProperty
,
this
);
// DPP Context.
// Warning: we suppose that the list mode block is ordered like the ADC controllers
releaseListModeContext
(
listModeContext
);
int32
nbCrates
=
0
;
for
(
int32
adc
=
0
;
adc
<
nbAdcControllers
();
++
adc
)
{
int32
crate
=
adcController
[
adc
]
->
crateNumber
();
if
(
crate
>=
nbCrates
)
{
nbCrates
=
crate
+
1
;
}
}
listModeContext
.
crateBoard
.
nbCrates
=
nbCrates
;
listModeContext
.
crateBoard
.
crates
=
new
Crate
[
nbCrates
];
for
(
int32
crate
=
0
;
crate
<
nbCrates
;
++
crate
)
{
int32
nbBoards
=
0
;
for
(
int32
board
=
0
;
board
<
nbAdcControllers
();
++
board
)
{
if
(
board
>=
nbBoards
)
{
nbBoards
=
board
+
1
;
}
}
listModeContext
.
crateBoard
.
crates
[
crate
].
nbBoards
=
nbBoards
;
listModeContext
.
crateBoard
.
crates
[
crate
].
boards
=
new
Board
[
nbBoards
];
for
(
int32
board
=
0
;
board
<
nbAdcControllers
();
++
board
)
{
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
boardType
=
(
BoardType
)
adcController
[
board
]
->
cardType
();
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
crate
=
crate
;
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
eventType
=
0
;
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
nbChannels
=
adcController
[
board
]
->
nbChannels
();
}
}
cout
<<
"DPP context"
<<
endl
;
cout
<<
listModeContext
<<
endl
;
}
/*
...
...
@@ -498,4 +544,57 @@ void DPPAcquisitionController::setContext() {
// cout << listModeContext << endl;
}
DataBlock
*
decodeListModeBlock
(
AsciiDataFileManager
*
dataFileManager
,
AsciiDataFile
*
dataFile
,
string
blockType
,
typename
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>::
iterator
iter
,
typename
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>::
iterator
end
)
{
cout
<<
"decodeListModeBlock"
<<
endl
;
// Change
// - tok1.end() into end
// - getAbstractController into dataFileManager->getAbstractController
// - m_DataFile into dataFile
// - creation of the block to copy and return the block
// - goto error into return NULL
// Get number of GEGE
if
(
++
iter
==
end
)
{
return
NULL
;
}
uint32
nbgeges
=
(
uint32
)
strtol
((
*
iter
).
c_str
(),
NULL
,
10
);
vector
<
AbstractController
*>
gegecontrollers
;
for
(
uint32
i
=
0
;
i
<
nbgeges
;
++
i
)
{
AbstractController
*
controller
=
NULL
;
if
(
++
iter
==
end
)
{
return
NULL
;
}
if
((
*
iter
).
empty
()
==
false
)
{
controller
=
dataFileManager
->
getAbstractController
(
*
iter
);
}
gegecontrollers
.
push_back
(
controller
);
}
// Get number of detector controller
if
(
++
iter
==
end
)
{
return
NULL
;
}
uint32
nbdetectors
=
(
uint32
)
strtol
((
*
iter
).
c_str
(),
NULL
,
10
);
vector
<
AbstractController
*>
detectorcontrollers
;
for
(
uint32
i
=
0
;
i
<
nbdetectors
;
++
i
)
{
if
(
++
iter
==
end
)
{
return
NULL
;
}
AbstractController
*
detector
=
NULL
;
if
((
*
iter
).
empty
()
==
false
)
{
detector
=
dataFileManager
->
getAbstractController
(
*
iter
);
}
detectorcontrollers
.
push_back
(
detector
);
}
npp
::
ListModeBlock
*
newBlock
=
new
npp
::
ListModeBlock
(
nbgeges
,
gegecontrollers
,
nbdetectors
,
detectorcontrollers
);
dataFile
->
addDataBlock
(
newBlock
);
return
newBlock
;
}
}
src/controllers/npp/ListModeBlock.cpp
0 → 100644
View file @
20ac8cf7
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "ListModeBlock.h"
#include "InstrumentAbstraction/AbstractController.h"
#include <common/base/ServerProperties.h>
#include <lstdpp128/lstdpp.h>
#include <boost/format.hpp>
using
namespace
boost
;
using
namespace
lstdpp128
;
namespace
npp
{
ListModeBlock
::
ListModeBlock
(
uint32
nbgeges
,
const
vector
<
AbstractController
*>&
gegeControllers
,
uint32
nbdetectors
,
const
vector
<
AbstractController
*>&
detectorControllers
)
:
DataBlock
(
true
),
m_NbGeges
(
nbgeges
),
m_GegeControllers
(
gegeControllers
),
m_NbDetectors
(
nbdetectors
),
m_DetectorControllers
(
detectorControllers
),
m_Oldlistmodedatasize
(
0
)
{
// Empty
}
ListModeBlock
::~
ListModeBlock
()
{
// Empty
}
void
ListModeBlock
::
writeBlock
(
std
::
ofstream
&
file
)
{
cout
<<
"ListModeBlock write"
<<
endl
;
int32
*
listmodedata
=
0
;
uint32
listmodedatasize
=
0
;
uint32
totallistmodedatasize
=
0
;
ostringstream
filename
;
filename
<<
common
::
ServerProperties
::
getInstance
()
->
getNomadDataPath
()
<<
boost
::
format
(
"%06i"
)
%
m_RecordNumber
<<
".lst"
;
ofstream
dataFile
;
// Open data file
dataFile
.
open
(
filename
.
str
().
c_str
(),
std
::
ios
::
app
|
std
::
ios
::
binary
);
if
(
dataFile
)
{
// Verify if first write
if
(
dataFile
.
tellp
()
==
0
)
{
// cout << "DPP context (ListModeBlock)" << endl;
// cout << listModeContext << endl;
// Write header
// uint32 buffer[4 + m_NbGeges];
// buffer[0] = 1;
// buffer[1] = 9;
// buffer[2] = 0;
// buffer[3] = m_NbGeges;
// for (uint32 i = 0; i < m_NbGeges; ++i) {
// if (m_GegeControllers[i] != NULL) {
// int32 evtype = 0; //any_cast<int32>(m_GegeControllers[i]->getValue("display_channel"));
// int32 card = any_cast<int32>(m_GegeControllers[i]->getValue("crate_number"));
// int32 channels = any_cast<int32>(m_GegeControllers[i]->getValue("nb_channels"));
// int32 type = any_cast<int32>(m_GegeControllers[i]->getValue("card_type"));
// buffer[4 + i] = type & 0x3F;
// buffer[4 + i] |= (channels & 0x3F) << 6;
// buffer[4 + i] |= (card & 0xF) << 12;
// buffer[4 + i] |= (evtype & 0xFFFF) << 16;
// }
// }
// dataFile.write((const char *) buffer, (4 + m_NbGeges) * sizeof(uint32));
string
buffer
=
writeListModeContextToBinary
(
listModeContext
);
dataFile
.
write
(
buffer
.
c_str
(),
buffer
.
size
());
m_Oldlistmodedatasize
=
0
;
}
for
(
uint32
i
=
0
;
i
<
m_NbDetectors
;
++
i
)
{
// Write list mode
if
(
m_DetectorControllers
[
i
]
!=
NULL
)
{
listmodedata
=
any_cast
<
int32
*>
(
m_DetectorControllers
[
i
]
->
getValue
(
"list_mode_data"
));
listmodedatasize
=
any_cast
<
int32
>
(
m_DetectorControllers
[
i
]
->
getValue
(
"list_mode_data_size"
));
if
((
listmodedatasize
!=
0
)
&&
(
listmodedata
!=
NULL
))
{
totallistmodedatasize
+=
listmodedatasize
/
4
;
dataFile
.
write
((
const
char
*
)
listmodedata
,
listmodedatasize
*
sizeof
(
int32
));
m_DetectorControllers
[
i
]
->
setValue
(
"list_mode_data_size"
,
(
int32
)
0
);
}
}
}
dataFile
.
close
();
}
fstream
dataFile1
;
dataFile1
.
open
(
filename
.
str
().
c_str
(),
ios_base
::
in
|
ios_base
::
out
|
std
::
ios
::
binary
);
if
(
dataFile1
)
{
dataFile1
.
seekp
(
2
*
sizeof
(
uint32
),
ios_base
::
beg
);
totallistmodedatasize
+=
m_Oldlistmodedatasize
;
dataFile1
.
write
((
const
char
*
)
&
totallistmodedatasize
,
sizeof
(
uint32
));
m_Oldlistmodedatasize
=
totallistmodedatasize
;
dataFile1
.
close
();
}
}
}
src/controllers/npp/ListModeBlock.h
0 → 100644
View file @
20ac8cf7
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef NPP_LISTMODEBLOCK_H
#define NPP_LISTMODEBLOCK_H
#include <iostream>
#include <vector>
#include <string>
#include "controllers/common/datafile/DataBlock.h"
class
AbstractController
;
namespace
npp
{
class
ListModeBlock
:
public
DataBlock
{
public:
ListModeBlock
(
uint32
nbgeges
,
const
vector
<
AbstractController
*>&
gegeControllers
,
uint32
nbdetectors
,
const
vector
<
AbstractController
*>&
detectorControllers
);
virtual
~
ListModeBlock
();
void
writeBlock
(
std
::
ofstream
&
file
);
private:
uint32
m_NbGeges
;
std
::
vector
<
AbstractController
*>
m_GegeControllers
;
uint32
m_NbDetectors
;
std
::
vector
<
AbstractController
*>
m_DetectorControllers
;
uint32
m_Oldlistmodedatasize
;
};
}
#endif
src/controllers/remotenpp/RemoteDPPCoincidence.cpp
View file @
20ac8cf7
...
...
@@ -105,130 +105,120 @@ void RemoteDPPCoincidence::setDetectorControllers(const std::vector<ControllerPt
void
RemoteDPPCoincidence
::
start
()
{
initFileReading
();
resetData
();
// Need a mutex to avoid having two start at the same time.
{
boost
::
mutex
::
scoped_lock
lock
(
m_mutex
);
// Numor
string
numor
;
size_t
size
=
fileName
().
size
();
initFileReading
();
resetData
();
if
(
size
<
6
)
{
string
prefix
(
6
-
size
,
'0'
);
numor
=
prefix
+
fileName
();
}
else
{
numor
=
fileName
();
}
// Numor
string
numor
;
size_t
size
=
fileName
().
size
();
// Setting the parameters
ptree
parameters
;
if
(
size
<
6
)
{
string
prefix
(
6
-
size
,
'0'
);
numor
=
prefix
+
fileName
();
}
else
{
numor
=
fileName
();
}
parameters
.
put
(
"numor"
,
numor
);
parameters
.
put
(
"dT"
,
dT
()
/
10
);
parameters
.
put
(
"cleanDT"
,
cleanDT
()
/
10
);
// Setting the parameters
ptree
parameters
;
// detector channels
ptree
detectorChannelArray
;
ptree
channel
;
int32
detectorChannelSize
=
detectorChannel
.
getSize
();
for
(
int32
i
=
0
;
i
<
detectorChannelSize
;
++
i
)
{
channel
.
put
(
""
,
detectorChannel
(
i
));
detectorChannelArray
.
push_back
(
std
::
make_pair
(
""
,
channel
));
}
parameters
.
put_child
(
"detectorChannels"
,
detectorChannelArray
);
parameters
.
put
(
"numor"
,
numor
);
parameters
.
put
(
"dT"
,
dT
()
/
10
);
parameters
.
put
(
"cleanDT"
,
cleanDT
()
/
10
);
parameters
.
put
(
"matrixResolution"
,
coincidenceResolution
());
parameters
.
put
(
"maxBlocks"
,
maxBlock
());
parameters
.
put
(
"blockSize"
,
blockSize
());
parameters
.
put
(
"refreshTime"
,
refreshTimeS
());
// detector channels
ptree
detectorChannelArray
;
ptree
channel
;
int32
detectorChannelSize
=
detectorChannel
.
getSize
();
for
(
int32
i
=
0
;
i
<
detectorChannelSize
;
++
i
)
{
channel
.
put
(
""
,
detectorChannel
(
i
));
detectorChannelArray
.
push_back
(
std
::
make_pair
(
""
,
channel
));
}
parameters
.
put_child
(
"detectorChannels"
,
detectorChannelArray
);
ptree
context
=
writeListModeContextToPropertyTree
(
listModeContext
);
parameters
.
put
(
"matrixResolution"
,
coincidenceResolution
());
parameters
.
put
(
"maxBlocks"
,
maxBlock
());
parameters
.
put
(
"blockSize"
,
blockSize
());
parameters
.
put
(
"refreshTime"
,
refreshTimeS
());
p
arameters
.
put_child
(
"context"
,
c
ontext
);
p
tree
context
=
writeListModeContextToPropertyTree
(
listModeC
ontext
);
// Serialize the parameters
stringstream
os
;
write_json
(
os
,
parameters
,
false
);
parameters
.
put_child
(
"context"
,
context
);
// Serialize the parameters
stringstream
os
;
write_json
(
os
,
parameters
,
false
);
// Kill the application if one remains
m_server
->
killAllAndWaitFor
(
"ncoincidence"
);
vector
<
string
>
args
;
args
.
push_back
(
os
.
str
()
);
// Kill the application if one remains
m_server
->
killAllAndWaitFor
(
"ncoincidence"
);
// Start the application
m_coincidenceApplication
=
m_server
->
start
(
"ncoincidence"
,
args
);
vector
<
string
>
args
;
args
.
push_back
(
os
.
str
()
);
// Test if application started
if
(
!
m_coincidenceApplication
->
exists
())
{
log
(
Level
::
s_Error
)
<<
"cannot start coincidence application"
<<
endlog
;
return
;
}
// Start the application
m_coincidenceApplication
=
m_server
->
start
(
"ncoincidence"
,
args
);
// Create the publisher after the start of the application, because it is a blocking call
m_publisher
.
reset
();
m_publisher
=
application
::
Publisher
::
create
(
"dpp_publisher"
,
1
);
// Test if application started
if
(
!
m_coincidenceApplication
->
exists
())
{
log
(
Level
::
s_Error
)
<<
"cannot start coincidence application"
<<
endlog
;
return
;
}
cout
<<
"publisher "
<<
*
m_publisher
<<
endl
;
// Create the publisher after the start of the application, because it is a blocking call
m_publisher
.
reset
();
m_publisher
=
application
::
Publisher
::
create
(
"dpp_publisher"
,
1
);
// Wait for the subscriber
bool
sync
=
m_publisher
->
waitForSubscribers
();
cout
<<
"publisher "
<<
*
m_publisher
<<
endl
;
// Create the subscriber after the publisher
auto_ptr
<
cameo
::
application
::
Subscriber
>
subscriber
=
application
::
Subscriber
::
create
(
*
m_coincidenceApplication
,
"dpp_coincidence_results"
);
cout
<<
"subscriber "
<<
*
subscriber
<<
endl
;
// Wait for the subscriber
bool
sync
=
m_publisher
->
waitForSubscribers
();
// Start the test thread if necessary
auto_ptr
<
boost
::
thread
>
thread
=
startFileReading
();
// Create the subscriber after the publisher
auto_ptr
<
cameo
::
application
::
Subscriber
>
subscriber
=
application
::
Subscriber
::
create
(
*
m_coincidenceApplication
,
"dpp_coincidence_results"
);
cout
<<
"subscriber "
<<
*
subscriber
<<
endl
;
// Listen to the result stream
vector
<
double
>
channelRates
;
while
(
subscriber
->
receive
(
channelRates
))
{
// copying the rates
for
(
int32
i
=
0
;
i
<
totalNumberOfChannels
();
i
++
)
{
channelRate
.
set
(
i
,
channelRates
[
i
]);
}
// Start the test thread if necessary
auto_ptr
<
boost
::
thread
>
thread
=
startFileReading
();
vector
<
double
>
coincidenceRates
;
if
(
!
subscriber
->
receive
(
coincidenceRates
))
{
break
;
}
// Listen to the result stream
vector
<
double
>
channelRates
;
while
(
subscriber
->
receive
(
channelRates
))
{
// copying the rates
for
(
int32
i
=
0
;
i
<
totalNumberOfChannels
();
i
++
)
{
channelRate
.
set
(
i
,
channelRates
[
i
]);
}
if
(
coincidenceRates
.
size
()
<=
4
*
7
)
{
// Copying values
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
globalRate
.
set
(
i
,
coincidenceRates
[
i
]);
globalCleanRate
.
set
(
i
,
coincidenceRates
[
7
+
i
]);
detectorRate
.
set
(
i
,
coincidenceRates
[
7
*
2
+
i
]);
detectorCleanRate
.
set
(
i
,
coincidenceRates
[
7
*
3
+
i
]);
vector
<
double
>
coincidenceRates
;
if
(
!
subscriber
->
receive
(
coincidenceRates
))
{
break
;
}
}
else
{
cerr
<<
"problem with coincidence rates size"
<<
endl
;
if
(
coincidenceRates
.
size
()
<=
4
*
7
)
{
// Copying values
for
(
int32
i
=
0
;
i
<
7
;
++
i
)
{
globalRate
.
set
(
i
,
coincidenceRates
[
i
]);
globalCleanRate
.
set
(
i
,
coincidenceRates
[
7
+
i
]);
detectorRate
.
set
(
i
,
coincidenceRates
[
7
*
2
+
i
]);
detectorCleanRate
.
set
(
i
,
coincidenceRates
[
7
*
3
+
i
]);
}
}
else
{
cerr
<<
"problem with coincidence rates size"
<<
endl
;
}
}
}
// Wait for the termination of the application
application
::
State
state
=
m_coincidenceApplication
->
waitFor
();
cout
<<
"coincidence application terminated with state "
<<
state
<<
endl
;
// Wait for the termination of the application
application
::
State
state
=
m_coincidenceApplication
->
waitFor
();
// Join the test thread
finishFileReading
(
thread
);
}
void
RemoteDPPCoincidence
::
stop
()
{
// Test the coincidence application and the publisher
if
(
m_coincidenceApplication
.
get
()
!=
0
&&
m_publisher
.
get
()
!=
0
)
{
if
(
fileReadingMode
())
{
m_reader
->
stop
();
}
// Join the test thread
finishFileReading
(
thread
);
cout
<<
*
m_publisher
<<
" end of stream"
<<
endl
;
m_publisher
->
sendEnd
();
// we do not stop the application because the termination of the publisher will do it.
cout
<<
"coincidence application terminated with state "
<<
state
<<
endl
;
}
}
...
...
src/controllers/remotenpp/RemoteDPPCoincidence.h
View file @
20ac8cf7
...
...
@@ -40,7 +40,6 @@ public:
virtual
void
setDetectorControllers
(
const
std
::
vector
<
ControllerPtr
<
acquisition
::
DetectorController
>
>
&
detectorControllers
);
virtual
void
start
();
virtual
void
stop
();
virtual
void
raz
();
void
refreshNumberOfDetectorChannels
(
int32
value
);
...
...
src/controllers/remotenpp/RemoteDPPContext.cpp
View file @
20ac8cf7
...
...
@@ -37,42 +37,42 @@ RemoteDPPContext::~RemoteDPPContext() {
void
RemoteDPPContext
::
postConfiguration
()
{
// Warning: we suppose that the list mode block is ordered like the ADC controllers
releaseListModeContext
(
listModeContext
);
int32
nbCrates
=
0
;
for
(
int32
adc
=
0
;
adc
<
acquisitionController
->
nbAdcControllers
();
++
adc
)
{
int32
crate
=
acquisitionController
->
adcController
[
adc
]
->
crateNumber
();
if
(
crate
>=
nbCrates
)
{
nbCrates
=
crate
+
1
;
}
}
listModeContext
.
crateBoard
.
nbCrates
=
nbCrates
;
listModeContext
.
crateBoard
.
crates
=
new
Crate
[
nbCrates
];
for
(
int32
crate
=
0
;
crate
<
nbCrates
;
++
crate
)
{
int32
nbBoards
=
0
;
for
(
int32
board
=
0
;
board
<
acquisitionController
->
nbAdcControllers
();
++
board
)
{
if
(
board
>=
nbBoards
)
{
nbBoards
=
board
+
1
;
}
}
listModeContext
.
crateBoard
.
crates
[
crate
].
nbBoards
=
nbBoards
;
listModeContext
.
crateBoard
.
crates
[
crate
].
boards
=
new
Board
[
nbBoards
];
for
(
int32
board
=
0
;
board
<
acquisitionController
->
nbAdcControllers
();
++
board
)
{
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
boardType
=
(
BoardType
)
acquisitionController
->
adcController
[
board
]
->
cardType
();
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
crate
=
crate
;
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
eventType
=
0
;
listModeContext
.
crateBoard
.
crates
[
0
].
boards
[
board
].
nbChannels
=
acquisitionController
->
adcController
[
board
]
->
nbChannels
();
}
}
cout
<<
"DPP context"
<<
endl
;
cout
<<
listModeContext
<<
endl
;
//
releaseListModeContext(listModeContext);
//
//
int32 nbCrates = 0;
//
//
for (int32 adc = 0; adc < acquisitionController->nbAdcControllers(); ++adc) {
//
int32 crate = acquisitionController->adcController[adc]->crateNumber();
//
if (crate >= nbCrates) {
//
nbCrates = crate + 1;
//
}
//
}
//
//
listModeContext.crateBoard.nbCrates = nbCrates;
//
listModeContext.crateBoard.crates = new Crate[nbCrates];
//
//
for (int32 crate = 0; crate < nbCrates; ++crate) {
//
int32 nbBoards = 0;
//
//
for (int32 board = 0; board < acquisitionController->nbAdcControllers(); ++board) {
//
if (board >= nbBoards) {
//
nbBoards = board + 1;
//
}
//
}
//
//
listModeContext.crateBoard.crates[crate].nbBoards = nbBoards;
//
listModeContext.crateBoard.crates[crate].boards = new Board[nbBoards];
//
//
for (int32 board = 0; board < acquisitionController->nbAdcControllers(); ++board) {
//
listModeContext.crateBoard.crates[0].boards[board].boardType = (BoardType)acquisitionController->adcController[board]->cardType();
//
listModeContext.crateBoard.crates[0].boards[board].crate = crate;
//
listModeContext.crateBoard.crates[0].boards[board].eventType = 0;