4 #pragma warning( disable : 2259 ) 10 #pragma warning( disable : 4996 ) 43 if ( 0 == name.
find(
"/stat/" ) ) {
61 return histoAddr( name );
63 if (
'/' == name[name.
size() - 1] ||
'/' == rel[0] ) {
64 return histoAddr( name + rel );
66 return histoAddr( name +
"/" + rel );
82 if ( !hObj->annotation().addItem(
"id", obj.
substr( 1 ) ) ) hObj->annotation().setValue(
"id", obj.
substr( 1 ) );
85 if ( !hObj->annotation().addItem(
"id", obj ) ) hObj->annotation().setValue(
"id", obj );
94 TH3D* h3d = Gaudi::getRepresentation<IHistogram3D, TH3D>(
h );
96 TH2D* h2d =
dynamic_cast<TH2D*
>( h3d->Project3D( dir.
c_str() ) );
113 if ( b )
return b->
print( s );
114 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase." <<
endmsg;
121 if ( b )
return b->
write( s );
122 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase." <<
endmsg;
129 if ( b )
return b->
write( file_name );
130 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase." <<
endmsg;
171 error() <<
"Unable to create the histogram path" <<
endmsg;
187 error() <<
"Unable to create the histogram directory: " << parentDir <<
"/" << subDir <<
endmsg;
191 error() <<
"Unable to create the histogram directory: " << parentDir <<
"/" << subDir <<
endmsg;
195 return directory.release();
210 std::string::size_type loc = ident.
find(
" " );
213 for (
auto attrib : Parser( ident.
substr( loc + 1 ) ) ) {
214 switch (::
toupper( attrib.tag[0] ) ) {
226 if ( typ.length() > 0 ) {
230 entryname += logname;
232 switch (::
toupper( typ[0] ) ) {
243 info() <<
"Added stream file:" << filename <<
" as " << logname <<
endmsg;
250 error() <<
"Cannot add " << ident <<
" invalid filename!" <<
endmsg;
260 status =
setRoot(
"/stat", rootObj.get() );
264 error() <<
"Unable to set hstogram data store root." <<
endmsg;
267 auto svc = service<IConversionSvc>(
"HistogramPersistencySvc", true );
271 error() <<
"Could not find HistogramPersistencySvc." <<
endmsg;
277 if ( !status.
isSuccess() )
return status;
281 info() <<
" Predefined 1D-Histograms: " <<
endmsg;
283 info() <<
" Path='" << ih.first <<
"'" 284 <<
" Description " << ih.second <<
endmsg;
300 throw GaudiException(
"Cannot cast 2D histogram to H2D to create sliceX `" + name +
"'!",
"HistogramSvc",
347 debug() <<
" Redefine the parameters for the histogram '" + hn +
"' to be " << ifound->second <<
endmsg;
350 return i_book( pPar, rel, ifound->second.title(),
351 Gaudi::createH1D( ifound->second.title(), ifound->second.bins(), ifound->second.lowEdge(),
352 ifound->second.lowEdge() ) );
371 for (
auto it = m.
begin(); m.
end() != it; ++it ) {
372 if ( 0 == it->first.find( lead ) ) {
377 return 1 + removeLeading( m, lead );
387 removeLeading(
m_defs1D.value(),
"/stat/" );
399 debug() <<
" " << im->second;
Parse attribute strings allowing iteration over the various attributes.
Gaudi::Property< CLID > m_rootCLID
virtual std::ostream & write(std::ostream &s) const =0
Write (binary) histogram to output stream.
Gaudi::Property< Histo1DMap > m_defs1D
std::pair< DataObject *, AIDA::IHistogram1D * > slice1DY(const std::string &name, const AIDA::IHistogram2D &h, int firstbin, int lastbin)
Create 1D slice from 2D histogram.
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const long HBOOK_StorageType
std::set< std::string > m_mods1D
H1D * book(CSTR par, CSTR rel, CSTR title, DBINS(x)) override
Book histogram and register it with the histogram data store.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
std::pair< DataObject *, AIDA::IHistogram1D * > createH1D(const AIDA::IHistogram1D &hist)
Copy constructor.
bool isSuccess() const
Test for a status code of SUCCESS.
unsigned long release() override
release reference to object
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
StatusCode findObject(IRegistry *pReg, CSTR path, P1D *&obj) override
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Gaudi::Property< std::string > m_rootName
~HistogramSvc() override
Destructor.
T * i_book(DataObject *pPar, CSTR rel, CSTR title, const std::pair< DataObject *, T * > &o)
StatusCode unregisterObject(Base *obj) override
Generic Transient Address.
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
H2D * i_project(CSTR nameAndTitle, const H3D &h, CSTR dir)
Helper for 2D projections.
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
virtual std::ostream & print(std::ostream &s) const =0
Print histogram to output stream.
StatusCode initialize() override
Initialise the service.
StatusCode connectInput(CSTR ident)
Connect input histogram file to the service.
IRegistry * registry() const
Get pointer to Registry.
#define DECLARE_COMPONENT(type)
StatusCode finalize() override
finalize the service
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
std::pair< std::string, std::string > i_splitPath(CSTR full)
Split full path into its components.
std::ostream & print(Base *h, std::ostream &s=std::cout) const override
Print (ASCII) the 1D histogram into the output stream.
DataObject * createPath(CSTR newPath) override
Create all directories in a given full path.
virtual const id_type & identifier() const =0
Full identifier (or key)
bool destroy(IBaseHistogram *hist) override
This class is used for returning status codes from appropriate routines.
void clear(STATE_TYPE _i=std::ios_base::failbit)
H1D * sliceY(CSTR name, const H2D &h, int indexX) override
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
std::pair< DataObject *, AIDA::IHistogram2D * > createH2D(const AIDA::IHistogram2D &hist)
Copy constructor.
std::pair< DataObject *, AIDA::IHistogram1D * > slice1DX(const std::string &name, const AIDA::IHistogram2D &h, int firstbin, int lastbin)
Create 1D slice from 2D histogram.
static DataObject * __cast(T *p)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
const long ROOT_StorageType
StatusCode finalize() override
Service initialization.
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
std::ostream & write(Base *h, std::ostream &s=std::cout) const override
Write (ASCII) the 1D histogram table into the output stream.
StatusCode registerObject(CSTR parent, CSTR rel, Base *obj) override
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
void update1Ddefs(Gaudi::Details::PropertyBase &)
handler to be invoked for updating property m_defs1D
Common base class for all histograms Use is solely functional to minimize dynamic_casts inside Histog...
HistogramSvc(const std::string &name, ISvcLocator *svc)
Statndard Constructor.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode initialize() override
Service initialization.
H1D * sliceX(CSTR name, const H2D &h, int indexY) override
static int toRootIndex(int index, int nbins)
Gaudi::Property< DBaseEntries > m_input
DataObject * createDirectory(CSTR parentDir, CSTR subDir) override
Create a sub-directory in a directory.
StatusCode reinitialize() override
Initialise the service.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
A DataObject is the base class of any identifiable object on any data store.
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
HistogramSvc class definition.