Go to the documentation of this file.
25 constexpr
bool essentiallyEqual(
double const a,
double const b ) {
35 if ( cmd.
find(
"genconf" ) != std::string::npos )
return;
37 info() <<
"Read handler called for property: " << p <<
endmsg;
47 info() <<
"Update handler called for property: " << os.
str() <<
endmsg;
62 if ( cmd.
find(
"genconf" ) != std::string::npos )
return;
65 info() <<
"Before Initialization......" <<
endmsg;
89 info() <<
"PDouble = " << os.
str() <<
endmsg;
105 info() <<
"After Initialization having read the JobOptions file..." <<
endmsg;
130 info() <<
"PDouble = " << os.
str() <<
endmsg;
142 for (
unsigned int i = 0; i < doublearrayunits.size(); i++ ) {
144 if ( !essentiallyEqual( doublearrayunits[i], doublearray[i] ) ) {
145 error() <<
format(
"DoubleArrayWithUnits[%d] = %g and should be %g", i, doublearrayunits[i], doublearray[i] )
148 info() <<
format(
"DoubleArrayWithUnits[%d] = %g", i, doublearrayunits[i] ) <<
endmsg;
155 info() <<
"===============Checking Property Verifier ===============" <<
endmsg;
157 info() <<
"Playing with PropertyVerifiers..." <<
endmsg;
159 p_int.verifier().setBounds( 0, 200 );
164 info() <<
format(
"PInt= %d [should be 155, bounds are %d, %d]", (
int)
p_int, (
int)
p_int.verifier().lower(),
165 (
int)
p_int.verifier().upper() )
169 }
catch ( ... ) { info() <<
"Got an exception when setting a value outside bounds" <<
endmsg; }
170 info() <<
"PInt= " <<
p_int <<
" [should be 155]" <<
endmsg;
175 info() <<
"===============Checking Property CallBaks ===============" <<
endmsg;
178 info() <<
"Accessing PDouble ... " <<
endmsg;
181 info() <<
"Value obtained is: " << d <<
endmsg;
183 info() <<
"Updating PDouble ... " <<
endmsg;
190 info() <<
"==========Checking Accesing Properties by string=========" <<
endmsg;
195 error() <<
"Unable to locate the ApplicationMgr" <<
endmsg;
198 appmgr->getProperty(
"ExtSvc", value ).ignore();
199 info() <<
" Got property ApplicationMgr.ExtSvc = " << value <<
";" <<
endmsg;
201 appmgr->setPropertyRepr(
"ExtSvc",
"[\"EvtDataSvc/EventDataSvc\", \"DetDataSvc/DetectorDataSvc\"]" ).ignore();
202 info() <<
" Set property ApplicationMgr.ExtSvc = "
203 <<
" [\"EvtDataSvc/EventDataSvc\", \"DetDataSvc/DetectorDataSvc\"]"
205 appmgr->getProperty(
"ExtSvc", value ).ignore();
206 info() <<
" Got property ApplicationMgr.ExtSvc = " << value <<
";" <<
endmsg;
208 appmgr->setPropertyRepr(
"ExtSvc",
"[ 'EventDataSvc', 'DetectorDataSvc']" ).ignore();
209 info() <<
" Set property ApplicationMgr.ExtSvc = "
210 <<
" [ 'EventDataSvc', 'DetectorDataSvc']"
212 appmgr->getProperty(
"ExtSvc", value ).ignore();
213 info() <<
" Got property ApplicationMgr.ExtSvc = " << value <<
";" <<
endmsg;
224 for (
auto&
c : cases ) {
229 if ( !sc || (
p_bool != std::get<1>(
c ) ) ) {
230 error() <<
"PBool can not be set to " << std::get<0>(
c ) <<
endmsg;
235 if ( !sc || (
m_bool != std::get<1>(
c ) ) ) { error() <<
"Bool can not be set to " << std::get<0>(
c ) <<
endmsg; }
241 newlog <<
MSG::DEBUG <<
"This should be printed if threshold is DEBUG" <<
endmsg;
242 newlog <<
MSG::INFO <<
"This should be printed if threshold is INFO" <<
endmsg;
244 newlog <<
MSG::ERROR <<
"This should be printed if threshold is ERROR" <<
endmsg;
245 newlog <<
MSG::FATAL <<
"This should be printed if threshold is FATAL" <<
endmsg;
252 info() <<
"=================================================" <<
endmsg;
254 auto opt_items =
opts.items();
255 ostream_joiner( info() <<
"Dump of the property catalogue:\n", opt_items,
'\n',
257 return os << std::get<0>( item ) <<
": " << std::get<1>( item );
260 info() <<
"=================================================" <<
endmsg;
263 opts.set(
name() +
'.' +
"PInt",
"154" );
264 info() <<
"PInt= " <<
p_int <<
" [should be 154]" <<
endmsg;
269 info() <<
"Try to assign invalid value to DoubleArray" <<
endmsg;
270 opts.set(
name() +
'.' +
"DoubleArray",
"{\"12.12\", \"13.13\"}" );
274 info() <<
"Try to assign invalid value to StringMap" <<
endmsg;
275 opts.set(
name() +
'.' +
"StringMap",
"{\"one\", {\"une\", \"eins\"}}" );
281 info() <<
"=================================================" <<
endmsg;
288 info() <<
"executing...." <<
endmsg;
295 info() <<
"finalizing...." <<
endmsg;
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Gaudi::Property< std::vector< double > > m_doublearray
Gaudi::Property< std::vector< double > > m_emptyarray
StatusCode initialize() override
Three mandatory member functions of any algorithm.
Gaudi::Property< std::vector< std::string > > m_stringarray
Gaudi::Property< std::vector< std::string > > p_stringarray
const std::string & name() const override
The identifying name of the algorithm object.
Gaudi::Property< std::map< std::string, std::string > > m_strmap
Gaudi::PropertyWithReadHandler< double > p_double
Alias for backward compatibility.
Gaudi::Property< bool > p_bool
Gaudi::Property< std::vector< std::pair< int, int > > > u_intpairarray
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
PropertyAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor of this form must be provided.
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.
void readHandler(Gaudi::Details::PropertyBase &)
Callbacks for properties.
Gaudi::Property< std::vector< double > > p_doublearray
Gaudi::Property< std::set< int > > m_intset
Gaudi::Property< std::vector< long long > > m_int64array
Gaudi::Property< std::set< std::string > > m_stringset
Gaudi::Property< std::string > p_string
Gaudi::Property< unsigned long long > m_uint64
Gaudi::Property< std::vector< bool > > p_boolarray
StatusCode setPropertyRepr(const std::string &n, const std::string &r) override
set the property from name and value string representation
const ValueType & value() const
Gaudi::Property< std::vector< int > > m_intarray
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi::Property< std::vector< double > > u_doublearrayunits
ParsingErrorPolicy setParsingErrorPolicy(ParsingErrorPolicy p)
Gaudi::Property< std::vector< std::pair< double, double > > > u_doublepairarray
Gaudi::Property< std::unordered_set< float > > m_floatuset
Gaudi::Property< std::string > m_string
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Gaudi::CheckedProperty< int > p_int
Gaudi::Property< std::vector< unsigned long long > > m_uint64array
constexpr static const auto SUCCESS
StatusCode execute() override
Gaudi::Property< bool > m_bool
#define DECLARE_COMPONENT(type)
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
void updateHandler(Gaudi::Details::PropertyBase &)
Gaudi::Property< std::vector< bool > > m_boolarray
Gaudi::Property< double > m_double
Gaudi::Property< std::vector< int > > p_intarray
constexpr static const auto FAILURE
StatusCode finalize() override
Gaudi::Property< long long > m_int64
Gaudi::Property< int > m_int
These data members are used in the execution of this algorithm They are set in the initialization pha...
Gaudi::Property< std::vector< double > > u_doublearray
const char * what() const override
method from std::exception
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})