Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cmsos
worksuite
Commits
ff0201b1
Commit
ff0201b1
authored
Mar 17, 2021
by
Andrea Petrucci
Browse files
references #226: adapted to EVM python scripts
parent
b9e4319e
Changes
7
Hide whitespace changes
Inline
Side-by-side
gevb2g/include/gevb2g/BU.h
View file @
ff0201b1
...
...
@@ -15,6 +15,7 @@
#include "xdata/Boolean.h"
#include "xdata/Double.h"
#include "xdata/ActionListener.h"
#include "xdata/UnsignedInteger32.h"
// Log4CPLUS
#include "log4cplus/logger.h"
...
...
@@ -211,6 +212,7 @@ namespace gevb2g
std::map<unsigned long, Measurement, std::less<unsigned long> > measurementHistory_;
*/
xdata
::
String
state_
;
xdata
::
UnsignedInteger32
eventRate_
;
};
}
...
...
gevb2g/include/gevb2g/EVM.h
View file @
ff0201b1
...
...
@@ -84,6 +84,7 @@ namespace gevb2g
xdata
::
String
poolName_
;
std
::
vector
<
const
xdaq
::
ApplicationDescriptor
*>
rus_
;
xdata
::
String
state_
;
};
}
...
...
gevb2g/include/gevb2g/InputEmulator.h
View file @
ff0201b1
...
...
@@ -103,6 +103,7 @@ namespace gevb2g
toolbox
::
task
::
ActionSignature
*
process_
;
xdata
::
UnsignedLong
commitedPoolSize_
;
xdata
::
String
state_
;
};
}
...
...
gevb2g/src/common/BU.cc
View file @
ff0201b1
...
...
@@ -62,7 +62,8 @@ gevb2g::BU::BU (xdaq::ApplicationStub* c)
lastReceivedFrameSize_
=
0
;
this
->
state_
=
"halted"
;
this
->
state_
=
"uninitialized"
;
eventRate_
=
0
;
// export variables to control client
//getApplicationInfoSpace()->fireItemAvailable ("samples", &samples_);
...
...
@@ -92,6 +93,8 @@ gevb2g::BU::BU (xdaq::ApplicationStub* c)
getApplicationInfoSpace
()
->
fireItemAvailable
(
"currentSize"
,
&
currentSize_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"lastReceivedFrameSize"
,
&
lastReceivedFrameSize_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"state"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"stateName"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"eventRate"
,
&
eventRate_
);
context_
=
0
;
lockAvailable_
=
new
toolbox
::
BSem
(
toolbox
::
BSem
::
FULL
);
...
...
@@ -138,8 +141,10 @@ gevb2g::BU::BU (xdaq::ApplicationStub* c)
//dataPf_ = new toolbox::PerformanceMeter();
resourcePool_
=
new
gevb2g
::
ResourcePool
(
this
);
this
->
state_
=
"Initialized"
;
this
->
getApplicationInfoSpace
()
->
addListener
(
this
,
"urn:xdaq-event:setDefaultValues"
);
this
->
state_
=
"Halted"
;
}
...
...
@@ -150,6 +155,7 @@ void gevb2g::BU::timeExpired (toolbox::task::TimerEvent& e)
toolbox
::
TimeVal
now
=
toolbox
::
TimeVal
::
gettimeofday
();
double
delta
=
(
double
)
now
-
(
double
)
lastTime_
;
double
rate
=
counter_
/
delta
;
eventRate_
=
(
rate
+
0.5
);
counter_
=
0
;
lastTime_
=
now
;
...
...
@@ -594,7 +600,8 @@ void gevb2g::BU::available (U32 freeResourceId, U32 context)
xoap
::
MessageReference
gevb2g
::
BU
::
Configure
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"configured"
;
this
->
state_
=
"Configuring"
;
eventRate_
=
0
;
maxResourcesPerFrame_
=
(
availableFrameSize_
-
(
sizeof
(
I2O_AVAILABLE_MESSAGE_FRAME
)
+
sizeof
(
ShipRequest
)))
/
sizeof
(
ShipRequest
);
if
(
maxResourcesPerFrame_
>
maxResources_
)
...
...
@@ -620,6 +627,7 @@ xoap::MessageReference gevb2g::BU::Configure (xoap::MessageReference message)
counter_
=
0
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Configured"
);
this
->
state_
=
"Configured"
;
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -633,7 +641,7 @@ xoap::MessageReference gevb2g::BU::Enable (xoap::MessageReference message)
{
lockAvailable_
->
take
();
this
->
state_
=
"
e
nabled"
;
this
->
state_
=
"
E
nabled"
;
stopped_
=
false
;
if
(
measurementHistory_
.
find
(
currentSize_
)
==
measurementHistory_
.
end
())
{
...
...
@@ -674,7 +682,8 @@ void gevb2g::BU::verbose ()
xoap
::
MessageReference
gevb2g
::
BU
::
Halt
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"halted"
;
this
->
state_
=
"Halted"
;
eventRate_
=
0
;
// inhibit cache
stopped_
=
true
;
...
...
gevb2g/src/common/EVM.cc
View file @
ff0201b1
...
...
@@ -49,6 +49,7 @@ gevb2g::EVM::EVM (xdaq::ApplicationStub* c)
triggerTid_
=
0
;
triggerClassInstance_
=
0
;
triggerClassName_
=
"unknown"
;
this
->
state_
=
"uninitialized"
;
createPool_
=
true
;
poolName_
=
"evmPool"
;
...
...
@@ -63,6 +64,9 @@ gevb2g::EVM::EVM (xdaq::ApplicationStub* c)
getApplicationInfoSpace
()
->
fireItemAvailable
(
"createPool"
,
&
createPool_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"poolName"
,
&
poolName_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"state"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"stateName"
,
&
state_
);
requestMutex_
=
new
toolbox
::
BSem
(
toolbox
::
BSem
::
FULL
);
...
...
@@ -92,8 +96,9 @@ gevb2g::EVM::EVM (xdaq::ApplicationStub* c)
}
tid_
=
i2o
::
utils
::
getAddressMap
()
->
getTid
(
this
->
getApplicationDescriptor
());
this
->
state_
=
"Initialized"
;
this
->
getApplicationInfoSpace
()
->
addListener
(
this
,
"urn:xdaq-event:setDefaultValues"
);
this
->
state_
=
"Halted"
;
}
void
gevb2g
::
EVM
::
actionPerformed
(
xdata
::
Event
&
event
)
...
...
@@ -125,6 +130,7 @@ void gevb2g::EVM::actionPerformed (xdata::Event& event)
xoap
::
MessageReference
gevb2g
::
EVM
::
Configure
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"Configuring"
;
// remove any surious elements if any from previous runs
this
->
clear
();
...
...
@@ -165,7 +171,7 @@ xoap::MessageReference gevb2g::EVM::Configure (xoap::MessageReference message)
}
this
->
logConfiguration
();
this
->
state_
=
"Configured"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Configured"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -439,6 +445,7 @@ void gevb2g::EVM::multiCast (toolbox::mem::Reference * ref)
xoap
::
MessageReference
gevb2g
::
EVM
::
Enable
(
xoap
::
MessageReference
message
)
{
stopped_
=
false
;
this
->
state_
=
"Enabled"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Enabling now"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -455,7 +462,7 @@ xoap::MessageReference gevb2g::EVM::Halt (xoap::MessageReference message)
//!!! it cannot be done here due to race conditions
// this->clear();
this
->
state_
=
"Halted"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Halting now"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
gevb2g/src/common/InputEmulator.cc
View file @
ff0201b1
...
...
@@ -53,7 +53,7 @@ gevb2g::InputEmulator::InputEmulator (xdaq::ApplicationStub* c)
poolName_
=
"iePool"
;
yieldCounter_
=
0
;
this
->
state_
=
"uninitialized"
;
veryFirst_
=
true
;
this
->
commitedPoolSize_
=
0x100000
;
...
...
@@ -72,6 +72,8 @@ gevb2g::InputEmulator::InputEmulator (xdaq::ApplicationStub* c)
getApplicationInfoSpace
()
->
fireItemAvailable
(
"frameSendCounter"
,
&
frameSendCounter_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"fixedSize"
,
&
fixedSize_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"rate"
,
&
rate_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"state"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"stateName"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"createPool"
,
&
createPool_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"poolName"
,
&
poolName_
);
...
...
@@ -79,9 +81,10 @@ gevb2g::InputEmulator::InputEmulator (xdaq::ApplicationStub* c)
getApplicationInfoSpace
()
->
fireItemAvailable
(
"commitedPoolSize"
,
&
commitedPoolSize_
);
tid_
=
i2o
::
utils
::
getAddressMap
()
->
getTid
(
this
->
getApplicationDescriptor
());
this
->
state_
=
"Initialized"
;
this
->
getApplicationInfoSpace
()
->
addListener
(
this
,
"urn:xdaq-event:setDefaultValues"
);
this
->
stopped_
=
true
;
this
->
state_
=
"Halted"
;
this
->
stopped_
=
true
;
}
gevb2g
::
InputEmulator
::~
InputEmulator
()
...
...
@@ -159,6 +162,7 @@ void gevb2g::InputEmulator::actionPerformed (xdata::Event& event)
}
xoap
::
MessageReference
gevb2g
::
InputEmulator
::
Configure
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"Configuring"
;
bx_
=
0
;
ruDescriptor_
=
getApplicationContext
()
->
getDefaultZone
()
->
getApplicationDescriptor
(
destinationClassName_
,
destinationClassInstance_
);
...
...
@@ -172,7 +176,7 @@ xoap::MessageReference gevb2g::InputEmulator::Configure (xoap::MessageReference
this
->
logConfiguration
();
stopped_
=
true
;
this
->
state_
=
"Configured"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Successfully configured"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -501,6 +505,7 @@ toolbox::mem::Reference * gevb2g::InputEmulator::createData (U32 bx, ErrorType i
xoap
::
MessageReference
gevb2g
::
InputEmulator
::
Enable
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"Enabling"
;
yieldCounter_
=
0
;
stopped_
=
false
;
//this->activate();
...
...
@@ -530,7 +535,7 @@ xoap::MessageReference gevb2g::InputEmulator::Enable (xoap::MessageReference mes
{
std
::
cerr
<<
"Failed to submit notification to worker pool, caught unknown exception"
<<
std
::
endl
;
}
this
->
state_
=
"Enabled"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Enable, starting to create data."
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -544,6 +549,7 @@ xoap::MessageReference gevb2g::InputEmulator::Halt (xoap::MessageReference messa
{
std
::
cout
<<
"Yield count : "
<<
yieldCounter_
<<
std
::
endl
;
stopped_
=
true
;
this
->
state_
=
"Halted"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Halt, data creation stopped."
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
gevb2g/src/common/RU.cc
View file @
ff0201b1
...
...
@@ -55,7 +55,7 @@ gevb2g::RU::RU (xdaq::ApplicationStub* c)
this
->
counter_
=
0
;
this
->
state_
=
"
halt
ed"
;
this
->
state_
=
"
uninitializ
ed"
;
this
->
doPacking_
=
false
;
this
->
packingSize_
=
0x10000
;
// 64kb
...
...
@@ -73,6 +73,7 @@ gevb2g::RU::RU (xdaq::ApplicationStub* c)
getApplicationInfoSpace
()
->
fireItemAvailable
(
"counter"
,
&
counter_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"preAllocateDAPL"
,
&
preAllocateDAPL_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"state"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"stateName"
,
&
state_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"doPacking"
,
&
doPacking_
);
getApplicationInfoSpace
()
->
fireItemAvailable
(
"packingSize"
,
&
packingSize_
);
...
...
@@ -112,8 +113,10 @@ gevb2g::RU::RU (xdaq::ApplicationStub* c)
tid_
=
i2o
::
utils
::
getAddressMap
()
->
getTid
(
this
->
getApplicationDescriptor
());
LOG4CPLUS_DEBUG
(
getApplicationLogger
(),
"dobe CTOR for RU"
);
this
->
state_
=
"Initialized"
;
this
->
getApplicationInfoSpace
()
->
addListener
(
this
,
"urn:xdaq-event:setDefaultValues"
);
this
->
state_
=
"Halted"
;
}
void
gevb2g
::
RU
::
actionPerformed
(
xdata
::
Event
&
event
)
...
...
@@ -197,7 +200,7 @@ bool gevb2g::RU::process (toolbox::task::WorkLoop* wl)
xoap
::
MessageReference
gevb2g
::
RU
::
Configure
(
xoap
::
MessageReference
message
)
{
this
->
state_
=
"
c
onfigur
ed
"
;
this
->
state_
=
"
C
onfigur
ing
"
;
frameSendCounter_
=
0
;
//clear any spurious data from previous runs
...
...
@@ -226,7 +229,7 @@ xoap::MessageReference gevb2g::RU::Configure (xoap::MessageReference message)
{
samples
[
i
]
->
release
();
}
this
->
state_
=
"Configured"
;
LOG4CPLUS_INFO
(
this
->
getApplicationLogger
(),
"Successfully configured"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -620,7 +623,7 @@ void gevb2g::RU::sendEmptyFrame (gevb2g::RU::FragmentDescriptor fdes)
xoap
::
MessageReference
gevb2g
::
RU
::
Enable
(
xoap
::
MessageReference
message
)
{
stopped_
=
false
;
this
->
state_
=
"
e
nabled"
;
this
->
state_
=
"
E
nabled"
;
LOG4CPLUS_INFO
(
getApplicationLogger
(),
"Enable. Event building will start"
);
xoap
::
MessageReference
reply
=
xoap
::
createMessage
();
xoap
::
SOAPEnvelope
envelope
=
reply
->
getSOAPPart
().
getEnvelope
();
...
...
@@ -633,7 +636,7 @@ xoap::MessageReference gevb2g::RU::Enable (xoap::MessageReference message)
xoap
::
MessageReference
gevb2g
::
RU
::
Halt
(
xoap
::
MessageReference
message
)
{
stopped_
=
true
;
this
->
state_
=
"
h
alted"
;
this
->
state_
=
"
H
alted"
;
// !!!! cannot clear now because of race conditions
//this->clear();
LOG4CPLUS_INFO
(
getApplicationLogger
(),
"Halt now."
);
...
...
Write
Preview
Supports
Markdown
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