4 #pragma warning(disable:2259)
10 #pragma warning(disable:4996)
52 if ( !obj ) {
return rel ; }
54 if ( !reg ) {
return rel ; }
57 if ( rel .empty() ) {
return histoAddr ( name ) ; }
58 if (
'/' == name[name.
size()-1] ||
59 '/' == rel[0] ) {
return histoAddr ( name + rel ) ; }
60 return histoAddr ( name +
"/" + rel ) ;
75 if (!hObj->annotation().addItem(
"id", obj.
substr(1)))
76 hObj->annotation().setValue(
"id", obj.
substr(1));
80 if (!hObj->annotation().addItem(
"id", obj))
81 hObj->annotation().setValue(
"id", obj);
90 TH3D *h3d = Gaudi::getRepresentation<IHistogram3D,TH3D>(
h);
92 TH2D *h2d =
dynamic_cast<TH2D*
>(h3d->Project3D(dir.
c_str()));
108 if (b)
return b->
print(s);
109 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase."
116 if (b)
return b->
write(s);
117 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase."
124 if (b)
return b->
write(file_name);
125 error() <<
"Unknown histogram type: Cannot cast to Gaudi::HistogramBase."
166 error() <<
"Unable to create the histogram path" <<
endmsg;
181 error() <<
"Unable to create the histogram directory: "
182 << parentDir <<
"/" << subDir <<
endmsg;
187 error() <<
"Unable to create the histogram directory: "
188 << parentDir <<
"/" << subDir <<
endmsg;
192 return directory.release();
205 std::string::size_type loc = ident.
find(
" ");
208 for (
auto attrib: Parser(ident.
substr(loc+1))) {
209 switch(::
toupper(attrib.tag[0])) {
221 if (typ.length() > 0) {
225 entryname += logname;
230 filename,entryname,0,
'O');
234 filename,entryname,0,
'O');
240 info() <<
"Added stream file:" << filename
241 <<
" as " << logname <<
endmsg;
248 error() <<
"Cannot add " << ident <<
" invalid filename!" <<
endmsg;
257 status =
setRoot(
"/stat", rootObj.get());
261 error() <<
"Unable to set hstogram data store root." <<
endmsg;
264 auto svc = service<IConversionSvc>(
"HistogramPersistencySvc",
true);
268 error() <<
"Could not find HistogramPersistencySvc." <<
endmsg;
279 info() <<
" Predefined 1D-Histograms: " <<
endmsg ;
283 <<
" Path='" << ih.first <<
"'"
284 <<
" Description " << ih.second <<
endmsg ;
295 (
CSTR name,
const IHistogram2D& h,
int idxY1,
int idxY2) {
303 throw GaudiException(
"Cannot cast 2D histogram to H2D to create sliceX `"
310 throw GaudiException(
"Cannot create sliceX `" + name +
"' of 2D histogram!",
331 throw GaudiException(
"Cannot create sliceY `"+name+
"' of 2D histogram!",
345 if ( m_defs1D.empty () )
348 auto ifound = m_defs1D.find( hn ) ;
349 if ( m_defs1D.end() == ifound )
353 <<
" Redefine the parameters for the histogram '" + hn +
"' to be "
357 m_mods1D.insert ( hn ) ;
358 return i_book ( pPar , rel , ifound ->
second.title () ,
360 ( ifound ->
second.title () ,
361 ifound ->
second.bins () ,
362 ifound ->
second.lowEdge () ,
363 ifound ->
second.lowEdge () ) ) ;
376 "Histograms with predefined parameters" ) ;
387 inline size_t removeLeading
390 for (
auto it = m.
begin() ; m.
end() != it ; ++it )
392 if ( 0 == it->first.find ( lead ) )
398 return 1 + removeLeading ( m , lead ) ;
408 removeLeading (
m_defs1D ,
"/stat/" ) ;
422 debug() <<
" Path='" << ih <<
"'" ;
Parse attribute strings allowing iteration over the various attributes.
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
std::ostream & write(Base *h, std::ostream &s=std::cout) const override
Write (ASCII) the 1D histogram table into the output stream.
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)
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
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...
std::string m_rootName
Name of root event.
virtual std::ostream & print(std::ostream &s) const =0
Print histogram to output stream.
virtual std::ostream & write(std::ostream &s) const =0
Write (binary) histogram to output stream.
~HistogramSvc() override
Destructor.
StatusCode unregisterObject(Base *obj) override
Generic Transient Address.
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
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.
DBaseEntries m_input
Input streams.
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.
DataObject * createPath(CSTR newPath) override
Create all directories in a given full path.
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.
void update1Ddefs(Property &)
handler to be invoked for updating property m_defs1D
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
std::ostream & print(Base *h, std::ostream &s=std::cout) const override
Print (ASCII) the 1D histogram into the output stream.
StatusCode finalize() override
Service initialization.
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.
Property base class allowing Property* collections to be "homogeneous".
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
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
static int toRootIndex(int index, int nbins)
virtual const id_type & identifier() const =0
Full identifier (or key)
DataObject * createDirectory(CSTR parentDir, CSTR subDir) override
Create a sub-directory in a directory.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
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.