| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
THistSvc Class Reference

`#include <src/THistSvc/THistSvc.h>`

Inheritance diagram for THistSvc:
[legend]
Collaboration diagram for THistSvc:
[legend]

## Classes
class | GlobalDirectoryRestore
struct | THistID

## Public Member Functions
StatusCode | initialize () override
StatusCode | reinitialize () override
StatusCode | finalize () override
StatusCode | regHist (const std::string &name) override
StatusCode | regHist (const std::string &name, TH1 *) override
StatusCode | regHist (const std::string &name, TH2 *) override
StatusCode | regHist (const std::string &name, TH3 *) override
StatusCode | getHist (const std::string &name, TH1 *&) const override
StatusCode | getHist (const std::string &name, TH2 *&) const override
StatusCode | getHist (const std::string &name, TH3 *&) const override
StatusCode | regTree (const std::string &name) override
StatusCode | regTree (const std::string &name, TTree *) override
StatusCode | getTree (const std::string &name, TTree *&) const override
StatusCode | regGraph (const std::string &name) override
StatusCode | regGraph (const std::string &name, TGraph *) override
StatusCode | getGraph (const std::string &name, TGraph *&) const override
StatusCode | deReg (TObject *obj) override
StatusCode | deReg (const std::string &name) override
std::vector< std::string > | getHists () const override
std::vector< std::string > | getTrees () const override
std::vector< std::string > | getGraphs () const override
StatusCode | getTHists (TDirectory *td, TList &, bool recurse=false) const override
StatusCode | getTHists (const std::string &name, TList &, bool recurse=false) const override
StatusCode | getTHists (TDirectory *td, TList &tl, bool recurse=false, bool reg=false) override
StatusCode | getTHists (const std::string &name, TList &tl, bool recurse=false, bool reg=false) override
StatusCode | getTTrees (TDirectory *td, TList &, bool recurse=false) const override
StatusCode | getTTrees (const std::string &name, TList &, bool recurse=false) const override
StatusCode | getTTrees (TDirectory *td, TList &tl, bool recurse=false, bool reg=false) override
StatusCode | getTTrees (const std::string &name, TList &tl, bool recurse=false, bool reg=false) override
bool | exists (const std::string &name) const override
| THistSvc (const std::string &name, ISvcLocator *svc)
void | handle (const Incident &) override
StatusCode | io_reinit () override
| callback method to reinitialize the internal state of the component for I/O purposes (e.g. More...
Public Member Functions inherited from extends< Service, ITHistSvc, IIncidentListener, IIoComponent >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces...>
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Member Functions
| ~THistSvc () override=default
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Private Types
enum | Mode { READ, WRITE, UPDATE, APPEND, SHARE, INVALID }
typedef std::map< std::string, THistID > | uidMap
typedef std::multimap< std::string, THistID > | idMap
typedef std::map< TObject *, THistID > | objMap
typedef std::multimap< std::string, std::string > | streamMap

## Private Member Functions
template<typename T >
StatusCode | regHist_i (T *hist, const std::string &name)
template<typename T >
StatusCode | getHist_i (const std::string &name, T *&hist, bool quiet=false) const
template<typename T >
StatusCode | readHist_i (const std::string &name, T *&hist) const
StatusCode | readHist (const std::string &name, TH1 *&) const
StatusCode | readHist (const std::string &name, TH2 *&) const
StatusCode | readHist (const std::string &name, TH3 *&) const
StatusCode | readTree (const std::string &name, TTree *&) const
void | updateFiles ()
StatusCode | write ()
StatusCode | connect (const std::string &)
TDirectory * | changeDir (const THistSvc::THistID &hid) const
std::string | dirname (std::string &dir) const
void | removeDoubleSlash (std::string &) const
bool | browseTDir (TDirectory *dir) const
bool | findStream (const std::string &name, std::string &root, std::string &rem, TFile *&file) const
void | parseString (const std::string &id, std::string &root, std::string &rem) const
void | setupInputFile (Property &inputfile)
| call-back method to handle input stream property More...
void | setupOutputFile (Property &outputfile)
| call-back method to handle output stream property More...
void | setupCompressionLevel (Property &cmp)
void | copyFileLayout (TDirectory *, TDirectory *)
| helper function to recursively copy the layout of a TFile into a new TFile More...
void | MergeRootFile (TDirectory *target, TDirectory *source)
StatusCode | rootOpenAction (FILEMGR_CALLBACK_ARGS)
StatusCode | rootOpenErrAction (FILEMGR_CALLBACK_ARGS)

## Private Attributes
MsgStream | m_log
StringArrayProperty | m_inputfile
StringArrayProperty | m_outputfile
std::vector< std::string > | m_Rstream
std::vector< std::string > | m_Wstream
IntegerProperty | m_autoSave
IntegerProperty | m_autoFlush
IntegerProperty | m_compressionLevel
IntegerProperty | m_maxFileSize
BooleanProperty | m_print
std::set< std::string > | m_alreadyConnectedInFiles
| list of already connected files. More...
std::set< std::string > | m_alreadyConnectedOutFiles
| list of already connected files. More...
uidMap | m_uids
idMap | m_ids
objMap | m_tobjs
std::map< std::string, std::pair< TFile *, Mode > > | m_files
streamMap | m_fileStreams
std::map< std::string, std::string > | m_sharedFiles
bool | signaledStop = false
bool | m_delayConnect = false
bool | m_okToConnect = false
std::string | m_curstream
IIncidentSvc * | p_incSvc = nullptr
IFileMgr * | p_fileMgr = nullptr

## Additional Inherited Members
Public Types inherited from extends< Service, ITHistSvc, IIncidentListener, IIoComponent >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces...>
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces...>
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
| take union of the ext_iids of all Interfaces... More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...

## Detailed Description

Definition at line 26 of file THistSvc.h.

## Member Typedef Documentation

typedef std::multimap<std::string, THistID> THistSvc::idMap
| private

Definition at line 197 of file THistSvc.h.

typedef std::map<TObject*, THistID> THistSvc::objMap
| private

Definition at line 198 of file THistSvc.h.

typedef std::multimap<std::string, std::string> THistSvc::streamMap
| private

Definition at line 199 of file THistSvc.h.

typedef std::map<std::string, THistID> THistSvc::uidMap
| private

Definition at line 196 of file THistSvc.h.

## Member Enumeration Documentation

enum THistSvc::Mode
| private

Enumerator
READ |
WRITE |
UPDATE |
APPEND |
SHARE |
INVALID |

Definition at line 107 of file THistSvc.h.

107 {
108 READ,
109 WRITE,
110 UPDATE,
111 APPEND,
112 SHARE,
113 INVALID
114 };
THistSvc::INVALID
Definition: THistSvc.h:113
THistSvc::APPEND
Definition: THistSvc.h:111
THistSvc::UPDATE
Definition: THistSvc.h:110
THistSvc::SHARE
Definition: THistSvc.h:112
THistSvc::READ
Definition: THistSvc.h:108
THistSvc::WRITE
Definition: THistSvc.h:109

## Constructor & Destructor Documentation

THistSvc::THistSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Definition at line 62 of file THistSvc.cpp.

63 : base_class(name, svc), m_log(msgSvc(), name )
64 {
65 declareProperty ("AutoSave", m_autoSave=0 );
66 declareProperty ("AutoFlush", m_autoFlush=0 );
67 declareProperty ("PrintAll", m_print=false);
68 declareProperty ("MaxFileSize", m_maxFileSize=10240,
69 "maximum file size in MB. if exceeded, will cause an abort. -1 to never check.");
70 declareProperty ("CompressionLevel", m_compressionLevel=1 )->declareUpdateHandler( &THistSvc::setupCompressionLevel, this );
71 declareProperty ("Output", m_outputfile )->declareUpdateHandler( &THistSvc::setupOutputFile, this );
72 declareProperty ("Input", m_inputfile )->declareUpdateHandler ( &THistSvc::setupInputFile, this );
73 }
THistSvc::m_autoFlush
IntegerProperty m_autoFlush
Definition: THistSvc.h:184
Property::declareUpdateHandler
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
THistSvc::m_autoSave
IntegerProperty m_autoSave
Definition: THistSvc.h:184
THistSvc::setupCompressionLevel
void setupCompressionLevel(Property &cmp)
Definition: THistSvc.cpp:1223
extends< Service, ITHistSvc, IIncidentListener, IIoComponent >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
THistSvc::m_inputfile
StringArrayProperty m_inputfile
Definition: THistSvc.h:182
THistSvc::m_print
BooleanProperty m_print
Definition: THistSvc.h:185
THistSvc::m_outputfile
StringArrayProperty m_outputfile
Definition: THistSvc.h:182
THistSvc::setupOutputFile
void setupOutputFile(Property &outputfile)
call-back method to handle output stream property
Definition: THistSvc.cpp:1275
THistSvc::m_maxFileSize
IntegerProperty m_maxFileSize
Definition: THistSvc.h:184
THistSvc::m_compressionLevel
IntegerProperty m_compressionLevel
Definition: THistSvc.h:184
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
THistSvc::setupInputFile
void setupInputFile(Property &inputfile)
call-back method to handle input stream property
Definition: THistSvc.cpp:1236

THistSvc::~THistSvc | ( |  | ) |
| override protected default

## Member Function Documentation

bool THistSvc::browseTDir | ( | TDirectory * | dir | ) | const
| private

Definition at line 405 of file THistSvc.cpp.

405 {
406
407 if (!dir) {
408 std::cerr << "TDirectory == 0" << std::endl;
409 return false;
410 }
411
412 GlobalDirectoryRestore restore;
413
414 dir->cd();
415
416
417 cout << "-> " << dir->GetPath() << " "
418 << dir->GetListOfKeys()->GetSize() << endl;
419
420 // TIter nextkey(dir->GetListOfKeys());
421 TIter nextkey(dir->GetList());
422 while (TKey *key = (TKey*)nextkey()) {
423
424 TObject *obj = key->ReadObj();
425 if (!obj) { cout << key->GetName() << " obj==0"<< endl; continue; }
426 // if (obj->IsA()->InheritsFrom("TDirectory")) {
427 cout << " Key: " << key->GetName() << " "
428 << " tit: " << obj->GetTitle() << " "
429 << " (" << key->GetClassName() << ")" << endl;
430 // }
431 }
432
433 nextkey = dir->GetListOfKeys();
434 while (TKey *key = (TKey*)nextkey()) {
435
436 TObject *obj = key->ReadObj();
437 if (!obj) { cout << key->GetName() << " obj==0"<< endl; continue; }
438 if (obj->IsA()->InheritsFrom("TDirectory")) {
439 TDirectory *tt = dynamic_cast<TDirectory*>(obj);
440 browseTDir(tt);
441 }
442 }
443
444 return true;
445 }
THistSvc::browseTDir
bool browseTDir(TDirectory *dir) const
Definition: THistSvc.cpp:405
std::endl
T endl(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::cerr

TDirectory * THistSvc::changeDir | ( | const THistSvc::THistID & | hid | ) | const
| private

Definition at line 1655 of file THistSvc.cpp.

1655 {
1656
1657 string uid = hid.id;
1658 TFile* file = hid.file;
1659 string stream, fdir, bdir, dir, id;
1660
1661 if (file) {
1662 file->cd("/");
1663 } else {
1664 gROOT->cd();
1665 }
1666
1667 fdir = uid;
1668 bdir = dirname(fdir);
1669
1670 while ( (dir = dirname(fdir)) != "") {
1671 if (! gDirectory->GetKey(dir.c_str())) {
1672 gDirectory->mkdir(dir.c_str());
1673 }
1674 gDirectory->cd(dir.c_str());
1675 }
1676
1677 return gDirectory;
1678
1679 }
THistSvc::THistID::file
TFile * file
Definition: THistSvc.h:120
THistSvc::THistID::id
std::string id
Definition: THistSvc.h:117
THistSvc::dirname
std::string dirname(std::string &dir) const
Definition: THistSvc.cpp:1684
ana.file
list file
Definition: ana.py:160
std::string::c_str
T c_str(T...args)

StatusCode THistSvc::connect | ( | const std::string & | ident | ) |
| private

Definition at line 1431 of file THistSvc.cpp.

1431 {
1432
1433 auto loc = ident.find(" ");
1434 string stream = ident.substr(0,loc);
1435 char typ(0);
1436 typedef std::pair<std::string,std::string> Prop;
1437 std::vector<Prop> props;
1438 string filename, db_typ("ROOT");
1439 int cl(1);
1440
1441 if (loc != string::npos) {
1442 using Parser = Gaudi::Utils::AttribStringParser;
1443 for (auto attrib: Parser(ident.substr(loc + 1))) {
1444 auto TAG = boost::algorithm::to_upper_copy(attrib.tag);
1445 auto VAL = boost::algorithm::to_upper_copy(attrib.value);
1446
1447 if (TAG == "FILE" || TAG == "DATAFILE") {
1448 filename = attrib.value;
1449 removeDoubleSlash( filename );
1450 } else if ( TAG == "OPT" ) {
1451 if ( VAL == "APPEND" || VAL == "UPDATE" ) {
1452 typ = 'A';
1453 } else if ( VAL == "CREATE" || VAL == "NEW" || VAL == "WRITE" ) {
1454 typ = 'N';
1455 } else if ( VAL == "RECREATE" ) {
1456 typ = 'R';
1457 } else if (VAL == "SHARE") {
1458 typ = 'S';
1459 } else if ( VAL == "OLD" || VAL == "READ" ) {
1460 typ = 'O';
1461 } else {
1462 m_log << MSG::ERROR << "Unknown OPT: \"" << attrib.value << "\""
1463 << endmsg;
1464 typ = 0;
1465 }
1466 } else if (TAG == "TYP") {
1467 db_typ = std::move(attrib.value);
1468 } else if (TAG == "CL") {
1469 cl = std::stoi(attrib.value);
1470 } else {
1471 props.emplace_back( attrib.tag, attrib.value);
1472 }
1473
1474 }
1475 }
1476
1477 if (stream == "temp") {
1478 m_log << MSG::ERROR << "in JobOption \"" << ident
1479 << "\": stream name \"temp\" reserved."
1480 << endmsg;
1481 return StatusCode::FAILURE;
1482 }
1483
1484 if (db_typ != "ROOT") {
1485 m_log << MSG::ERROR << "in JobOption \"" << ident
1486 << "\": technology type \"" << db_typ << "\" not supported."
1487 << endmsg;
1488 return StatusCode::FAILURE;
1489 }
1490
1491
1492 if (m_files.find(stream) != m_files.end()) {
1493 m_log << MSG::ERROR << "in JobOption \"" << ident
1494 << "\":\n stream \"" << stream << "\" already connected to file: \""
1495 << m_files[stream].first->GetName() << "\""
1496 << endmsg;
1497 return StatusCode::FAILURE;
1498 }
1499
1500 Mode newMode;
1501 if (typ == 'O') {
1502 newMode = THistSvc::READ;
1503 } else if (typ == 'N') {
1504 newMode = THistSvc::WRITE;
1505 } else if (typ == 'A') {
1506 newMode = THistSvc::APPEND;
1507 } else if (typ == 'R') {
1508 newMode = THistSvc::UPDATE;
1509 } else if (typ == 'S') {
1510 newMode = THistSvc::SHARE;
1511 } else {
1512 // something else?
1513 m_log << MSG::ERROR << "No OPT= specified or unknown access mode in: "
1514 << ident << endmsg;
1515 return StatusCode::FAILURE;
1516 }
1517
1518 // Is this file already connected to another stream?
1519 if (m_fileStreams.find(filename) != m_fileStreams.end()) {
1520 auto fitr = m_fileStreams.equal_range(filename);
1521
1522 const std::string& oldstream = fitr.first->second;
1523
1524 const auto& f_info = m_files[oldstream];
1525
1526 if (newMode != f_info.second) {
1527 m_log << MSG::ERROR << "in JobOption \"" << ident
1528 << "\":\n file \"" << filename << "\" already opened by stream: \""
1529 << oldstream << "\" with different access mode."
1530 << endmsg;
1531 return StatusCode::FAILURE;
1532 } else {
1533 TFile *f2 = f_info.first;
1534 m_files[stream] = make_pair(f2,newMode);
1535 if (m_log.level() <= MSG::DEBUG)
1536 m_log << MSG::DEBUG << "Connecting stream: \"" << stream
1537 << "\" to previously opened TFile: \"" << filename << "\""
1538 << endmsg;
1539 return StatusCode::SUCCESS;
1540 }
1541 }
1542
1543
1544 IIncidentSvc *pi = nullptr;
1545 if (service("IncidentSvc",pi).isFailure()) {
1546 m_log << MSG::ERROR << "Unable to get the IncidentSvc" << endmsg;
1547 return StatusCode::FAILURE;
1548 }
1549
1550 void* vf = nullptr;
1551 TFile *f = nullptr;
1552
1553 if (newMode == THistSvc::READ) {
1554 // old file
1555
1556 int r = p_fileMgr->open(Io::ROOT,name(), filename,Io::READ,vf,"HIST");
1557
1558 if (r != 0) {
1559 m_log << "Unable to open ROOT file " << filename << " for reading"
1560 << endmsg;
1561 return StatusCode::FAILURE;
1562 }
1563
1564
1565 f = (TFile*) vf;
1566
1567 // FIX ME!
1568 pi->fireIncident(FileIncident(name(), "BeginHistFile", filename));
1569
1570
1571 } else if (newMode == THistSvc::WRITE) {
1572 // new file. error if file exists
1573
1574 int r = p_fileMgr->open(Io::ROOT,name(),filename, (Io::WRITE|Io::CREATE|Io::EXCL),
1575 vf,"HIST");
1576
1577 if (r != 0) {
1578 m_log << "Unable to open ROOT file " << filename << " for writing"
1579 << endmsg;
1580 return StatusCode::FAILURE;
1581 }
1582
1583 f = (TFile*)vf;
1584
1585 } else if (newMode == THistSvc::APPEND) {
1586 // update file
1587
1588 int r = p_fileMgr->open(Io::ROOT,name(),filename, (Io::WRITE | Io::APPEND),
1589 vf,"HIST");
1590 if (r != 0) {
1591 m_log << MSG::ERROR << "unable to open file \"" << filename
1592 << "\" for appending" << endmsg;
1593 return StatusCode::FAILURE;
1594 }
1595
1596 f = (TFile*) vf;
1597
1598
1599 } else if (newMode == THistSvc::SHARE) {
1600 // SHARE file type
1601 //For SHARE files, all data will be stored in a temp file and will be merged into the target file
1602 //in write() when finalize(), this help to solve some confliction. e.g. with storegate
1603
1604 static int ishared = 0;
1605 string realfilename=filename;
1606 filename = "tmp_THistSvc_"+ std::to_string(ishared++)+".root";
1607
1608 if (m_log.level() <= MSG::DEBUG)
1609 m_log << MSG::DEBUG << "Creating temp file \"" << filename
1610 << "\" and realfilename="<<realfilename << endmsg;
1611 m_sharedFiles[stream]=realfilename;
1612
1613
1614 int r = p_fileMgr->open(Io::ROOT,name(), filename, (Io::WRITE|Io::CREATE|Io::EXCL),
1615 vf,"HIST");
1616
1617 if (r != 0) {
1618 m_log << "Unable to open ROOT file " << filename << " for writing"
1619 << endmsg;
1620 return StatusCode::FAILURE;
1621 }
1622
1623 f = (TFile*)vf;
1624
1625 } else if (newMode == THistSvc::UPDATE) {
1626 // update file
1627
1628 int r = p_fileMgr->open(Io::ROOT,name(), filename, (Io::WRITE|Io::CREATE),
1629 vf, "HIST");
1630
1631 if (r != 0) {
1632 m_log << "Unable to open ROOT file " << filename << " for appending"
1633 << endmsg;
1634 return StatusCode::FAILURE;
1635 }
1636
1637 f = (TFile*)vf;
1638
1639 }
1640
1641 m_files[stream] = make_pair(f,newMode);
1642 m_fileStreams.insert(make_pair(filename,stream));
1643
1644 if (m_log.level() <= MSG::DEBUG)
1645 m_log << MSG::DEBUG << "Opening TFile \"" << filename << "\" stream: \""
1646 << stream << "\" mode: \"" << typ << "\"" << " comp level: " << cl
1647 << endmsg;
1648
1649 return StatusCode::SUCCESS;
1650 }
Gaudi::Utils::AttribStringParser
Parse attribute strings allowing iteration over the various attributes.
Definition: AttribStringParser.h:30
FileIncident
This class is the FileIncident.
Definition: FileIncident.h:17
Io::ROOT
Definition: IFileMgr.h:153
IFileMgr::open
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &, void *&, const std::string &desc, const bool shared=false)=0
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::APPEND
Definition: THistSvc.h:111
std::to_string
T to_string(T...args)
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
graphanalysis.filename
string filename
Definition: graphanalysis.py:109
Io::EXCL
Definition: IFileMgr.h:31
THistSvc::UPDATE
Definition: THistSvc.h:110
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
THistSvc::SHARE
Definition: THistSvc.h:112
std::string
STL class.
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode::FAILURE
Definition: StatusCode.h:29
Io::WRITE
Definition: IFileMgr.h:27
StatusCode::SUCCESS
Definition: StatusCode.h:30
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
Io::READ
Definition: IFileMgr.h:26
std::make_pair
T make_pair(T...args)
std::move
T move(T...args)
THistSvc::Mode
Mode
Definition: THistSvc.h:107
std::pair< std::string, std::string >
std::multimap::insert
T insert(T...args)
std::string::find
T find(T...args)
Io::APPEND
Definition: IFileMgr.h:34
THistSvc::m_sharedFiles
std::map< std::string, std::string > m_sharedFiles
Definition: THistSvc.h:208
std::vector
STL class.
Io::CREATE
Definition: IFileMgr.h:30
THistSvc::READ
Definition: THistSvc.h:108
THistSvc::p_fileMgr
IFileMgr * p_fileMgr
Definition: THistSvc.h:216
MSG::ERROR
Definition: IMessageSvc.h:21
std::string::substr
T substr(T...args)
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
THistSvc::WRITE
Definition: THistSvc.h:109
std::stoi
T stoi(T...args)
std::multimap::equal_range
T equal_range(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::Units::pi
constexpr double pi
Definition: PhysicalConstants.h:45
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
THistSvc::m_fileStreams
streamMap m_fileStreams
Definition: THistSvc.h:206
THistSvc::removeDoubleSlash
void removeDoubleSlash(std::string &) const
Definition: THistSvc.cpp:1720
std::vector::emplace_back
T emplace_back(T...args)

void THistSvc::copyFileLayout | ( | TDirectory * | dst,
|  | TDirectory * | src
| ) |  |
| private

helper function to recursively copy the layout of a TFile into a new TFile

Definition at line 1872 of file THistSvc.cpp.

1872 {
1873
1874 if (m_log.level() <= MSG::DEBUG)
1875 m_log << MSG::DEBUG
1876 << "copyFileLayout() to dst path: " << dst->GetPath () << endmsg;
1877
1878 // strip out URLs
1879 TString path ((char*)strstr (dst->GetPath(), ":"));
1880 path.Remove (0, 2);
1881
1882 src->cd (path);
1883 TDirectory *cur_src_dir = gDirectory;
1884
1885 // loop over all keys in this directory
1886 TList *key_list = cur_src_dir->GetListOfKeys ();
1887 int n = key_list->GetEntries ();
1888 for ( int j = 0; j < n; ++j ) {
1889 TKey *k = (TKey*)key_list->At (j);
1890 const std::string src_pathname = cur_src_dir->GetPath()
1891 + std::string("/")
1892 + k->GetName();
1893 TObject *o=src->Get (src_pathname.c_str());
1894
1895 if ( o && o->IsA()->InheritsFrom ("TDirectory")) {
1896 if (m_log.level() <= MSG::VERBOSE)
1897 m_log << MSG::VERBOSE << " subdir [" << o->GetName() << "]..."
1898 << endmsg;
1899 dst->cd ();
1900 TDirectory * dst_dir = dst->mkdir (o->GetName(), o->GetTitle());
1901 copyFileLayout (dst_dir, src);
1902 }
1903 } // loop over keys
1904 return;
1905 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
ReadAndWriteWhiteBoard.dst
tuple dst
Definition: ReadAndWriteWhiteBoard.py:17
MSG::DEBUG
Definition: IMessageSvc.h:18
THistSvc::copyFileLayout
void copyFileLayout(TDirectory *, TDirectory *)
helper function to recursively copy the layout of a TFile into a new TFile
Definition: THistSvc.cpp:1872
MSG::VERBOSE
Definition: IMessageSvc.h:17
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
std::string
STL class.
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
std::string::c_str
T c_str(T...args)
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::deReg | ( | TObject * | obj | ) |
| override

Definition at line 913 of file THistSvc.cpp.

913 {
914
915 auto itr = m_tobjs.find(obj);
916 if (itr != m_tobjs.end()) {
917 THistID hid = itr->second;
918
919 auto itr2 = m_uids.find(hid.id);
920 if (itr2 == m_uids.end()) {
921 m_log << MSG::ERROR << "Problems deregistering TObject \""
922 << obj->GetName()
923 << "\" with id \"" << hid.id << "\"" << endmsg;
924 return StatusCode::FAILURE;
925 }
926
927 std::string id,root,rem;
928 parseString(hid.id, root, rem);
929
930 auto mitr = m_ids.equal_range(rem);
931 auto itr3 = std::find_if( mitr.first, mitr.second, [&](idMap::const_reference i)
932 { return i.second.obj == obj; } ) ;
933 if (itr3 != mitr.second ) {
934 m_log << MSG::ERROR << "Problems deregistering TObject \""
935 << obj->GetName()
936 << "\" with id \"" << hid.id << "\"" << endmsg;
937 return StatusCode::FAILURE;
938 }
939
940 m_tobjs.erase(itr);
941 m_uids.erase(itr2);
942 m_ids.erase(itr3);
943
944 return StatusCode::SUCCESS;
945
946 } else {
947 m_log << MSG::ERROR << "Cannot unregister TObject \"" << obj->GetName()
948 << "\": not known to THistSvc" << endmsg;
949 return StatusCode::FAILURE;
950 }
951
952 }
std::map::end
T end(T...args)
THistSvc::m_tobjs
objMap m_tobjs
Definition: THistSvc.h:203
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::map::erase
T erase(T...args)
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::map::find
T find(T...args)
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
THistSvc::m_ids
idMap m_ids
Definition: THistSvc.h:202
IOTest.root
tuple root
Definition: IOTest.py:42
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
ana.i
list i
Definition: ana.py:128
std::multimap::equal_range
T equal_range(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::deReg | ( | const std::string & | name | ) |
| override

Definition at line 958 of file THistSvc.cpp.

958 {
959
960 auto itr = m_uids.find(id);
961 if (itr == m_uids.end()) {
962 m_log << MSG::ERROR << "Problems deregistering id \""
963 << id << "\"" << endmsg;
964 return StatusCode::FAILURE;
965 }
966
967 TObject* obj = itr->second.obj;
968 return deReg(obj);
969 }
std::map::end
T end(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29
std::map::find
T find(T...args)
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::deReg
StatusCode deReg(TObject *obj) override
Definition: THistSvc.cpp:913
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

std::string THistSvc::dirname | ( | std::string & | dir | ) | const
| private

Definition at line 1684 of file THistSvc.cpp.

1684 {
1685
1686
1687 string::size_type i = dir.find("/");
1688
1689 if (i == string::npos) return {};
1690
1691 if ( i == 0 ) {
1692 dir.erase(0,1);
1693 return dirname(dir);
1694 }
1695
1696 string root = dir.substr(0,i);
1697 dir.erase(0,i);
1698
1699 return root;
1700
1701 }
THistSvc::dirname
std::string dirname(std::string &dir) const
Definition: THistSvc.cpp:1684
std::string::erase
T erase(T...args)
std::string::find
T find(T...args)
IOTest.root
tuple root
Definition: IOTest.py:42
std::string::substr
T substr(T...args)
ana.i
list i
Definition: ana.py:128

bool THistSvc::exists | ( | const std::string & | name | ) | const
| override

Definition at line 1806 of file THistSvc.cpp.

1806 {
1807
1808 TH1* h;
1809 return getHist_i(name,h,true).isSuccess();
1810
1811 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
HiveAlgSequencer.h
tuple h
Definition: HiveAlgSequencer.py:24
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142

StatusCode THistSvc::finalize | ( |  | ) |
| override

Definition at line 241 of file THistSvc.cpp.

241 {
242
243 GlobalDirectoryRestore restore;
244
245 if (m_log.level() <= MSG::DEBUG)
246 m_log << MSG::DEBUG << "THistSvc::finalize" << endmsg;
247
248 #ifndef NDEBUG
249 if (m_log.level() <= MSG::DEBUG) {
250 for (const auto& uid : m_uids ) {
251
252 TObject* to = uid.second.obj;
253
254 string dirname("none");
255 if (to && to->IsA()->InheritsFrom("TTree")) {
256 TTree* tr = dynamic_cast<TTree*>(to);
257 if (tr->GetDirectory() != 0) {
258 dirname = tr->GetDirectory()->GetPath();
259 }
260 } else if (to && to->IsA()->InheritsFrom("TGraph")) {
261 if (!uid.second.temp) {
262 dirname = uid.second.file->GetPath();
263 string id2(uid.second.id);
264 id2.erase(0,id2.find("/",1));
265 id2.erase(id2.rfind("/"), id2.length());
266 if (id2.find("/") == 0) {
267 id2.erase(0,1);
268 }
269 dirname += id2;
270 } else {
271 dirname = "/tmp";
272 }
273 } else if (to && to->IsA()->InheritsFrom("TH1")) {
274 TH1* th = dynamic_cast<TH1*>(to);
275 if (th == 0) {
276 m_log << MSG::ERROR << "Couldn't dcast: " << uid.first << endmsg;
277 } else {
278 if (th->GetDirectory() != 0) {
279 dirname = th->GetDirectory()->GetPath();
280 }
281 }
282 } else if (! to ) {
283 m_log << MSG::WARNING << uid.first << " has NULL TObject ptr"
284 << endmsg;
285 }
286
287 m_log << MSG::DEBUG << "uid: \"" << uid.first << "\" temp: "
288 << uid.second.temp << " dir: " << dirname
289 << endmsg;
290 }
291 }
292 #endif
293
294 StatusCode sc = write();
295 if (sc.isFailure()) {
296 m_log << MSG::ERROR << "problems writing histograms" << endmsg;
297 }
298
299 if (m_print) {
300 m_log << MSG::INFO << "Listing contents of ROOT files: " << endmsg;
301 }
302 vector<TFile*> deleted_files;
303 for (auto& itr : m_files ) {
304
305 if (find(deleted_files.begin(), deleted_files.end(), itr.second.first) ==
306 deleted_files.end()) {
307 deleted_files.push_back(itr.second.first);
308
309 #ifndef NDEBUG
310 if (m_log.level() <= MSG::DEBUG)
311 m_log << MSG::DEBUG << "finalizing stream/file " << itr.first << ":"
312 << itr.second.first->GetName()
313 << endmsg;
314 #endif
315 } else {
316 #ifndef NDEBUG
317 if (m_log.level() <= MSG::DEBUG)
318 m_log << MSG::DEBUG << "already finalized stream " << itr.first << endmsg;
319 #endif
320 continue;
321 }
322
323
324 if (m_print && m_log.level() <= MSG::INFO) {
325
326 m_log << MSG::INFO;
327 m_log << "==> File: " << itr.second.first->GetName()
328 << " stream: " << itr.first << endmsg;
329
330 itr.second.first->Print("base");
331 }
332
333 string tmpfn=itr.second.first->GetName();
334
335 p_fileMgr->close(itr.second.first, name());
336
337 IIncidentSvc *pi = nullptr;
338 if (service("IncidentSvc",pi).isFailure()) {
339 m_log << MSG::ERROR << "Unable to get the IncidentSvc" << endmsg;
340 return StatusCode::FAILURE;
341 }
342
343 if (itr.second.second==SHARE) {
344
345 //Merge File
346 void* vf = nullptr;
347 int r = p_fileMgr->open(Io::ROOT,name(), m_sharedFiles[itr.first],
348 Io::WRITE|Io::APPEND,vf,"HIST");
349
350 if (r) {
351 m_log << MSG::ERROR << "unable to open Final Output File: \""
352 << m_sharedFiles[itr.first] << "\" for merging"
353 << endmsg;
354 return StatusCode::FAILURE;
355 }
356
357 TFile *outputfile = (TFile*) vf;
358 pi->fireIncident(FileIncident(name(), IncidentType::WroteToOutputFile,
359 m_sharedFiles[itr.first]));
360
361 if (m_log.level() <= MSG::DEBUG)
362 m_log << MSG::DEBUG << "THistSvc::write()::Merging Rootfile "<<endmsg;
363
364 vf = nullptr;
365 r = p_fileMgr->open(Io::ROOT,name(),tmpfn,Io::READ,vf,"HIST");
366
367 if (r) {
368 m_log << MSG::ERROR << "unable to open temporary file: \""
369 << tmpfn << endmsg;
370 return StatusCode::FAILURE;
371 }
372
373 TFile *inputfile = (TFile*) vf;
374
375 outputfile->SetCompressionLevel( inputfile->GetCompressionLevel() );
376
377 MergeRootFile(outputfile, inputfile);
378
379 outputfile->Write();
380 p_fileMgr->close(outputfile,name());
381 p_fileMgr->close(inputfile,name());
382
383 if (m_log.level() <= MSG::DEBUG)
384 m_log << MSG::DEBUG << "Trying to remove temporary file \"" << tmpfn
385 << "\""<<endmsg;
386
387 std::remove(tmpfn.c_str());
388 }
389 delete itr.second.first;
390 }
391
392 m_sharedFiles.clear();
393 m_fileStreams.clear();
394 m_files.clear();
395 m_uids.clear();
396 m_ids.clear();
397 m_tobjs.clear();
398
399 return Service::finalize();
400 }
FileIncident
This class is the FileIncident.
Definition: FileIncident.h:17
Io::ROOT
Definition: IFileMgr.h:153
IFileMgr::open
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &, void *&, const std::string &desc, const bool shared=false)=0
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
std::vector::end
T end(T...args)
std::remove
T remove(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
THistSvc::m_tobjs
objMap m_tobjs
Definition: THistSvc.h:203
THistSvc::write
StatusCode write()
Definition: THistSvc.cpp:1399
THistSvc::SHARE
Definition: THistSvc.h:112
THistSvc::m_print
BooleanProperty m_print
Definition: THistSvc.h:185
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
std::vector::push_back
T push_back(T...args)
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode::FAILURE
Definition: StatusCode.h:29
THistSvc::dirname
std::string dirname(std::string &dir) const
Definition: THistSvc.cpp:1684
Io::WRITE
Definition: IFileMgr.h:27
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
Io::READ
Definition: IFileMgr.h:26
std::map::clear
T clear(T...args)
std::find
T find(T...args)
Io::APPEND
Definition: IFileMgr.h:34
THistSvc::m_sharedFiles
std::map< std::string, std::string > m_sharedFiles
Definition: THistSvc.h:208
std::vector
STL class.
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
std::vector::begin
T begin(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
THistSvc::m_ids
idMap m_ids
Definition: THistSvc.h:202
THistSvc::p_fileMgr
IFileMgr * p_fileMgr
Definition: THistSvc.h:216
MSG::ERROR
Definition: IMessageSvc.h:21
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
MSG::INFO
Definition: IMessageSvc.h:19
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::Units::pi
constexpr double pi
Definition: PhysicalConstants.h:45
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
THistSvc::m_fileStreams
streamMap m_fileStreams
Definition: THistSvc.h:206
THistSvc::MergeRootFile
void MergeRootFile(TDirectory *target, TDirectory *source)
Definition: THistSvc.cpp:1730
IFileMgr::close
virtual Io::close_t close(const Io::Fd, const std::string &caller)=0

bool THistSvc::findStream | ( | const std::string & | name,
|  | std::string & | root,
|  | std::string & | rem,
|  | TFile *& | file
| ) |  | const
| private

Definition at line 1161 of file THistSvc.cpp.

1162 {
1163
1164 auto pos = id.find("/");
1165
1166 if (pos == string::npos) {
1167 stream = "temp";
1168 rem = id;
1169 } else if (pos != 0) {
1170 stream = "temp";
1171 rem = id;
1172 } else {
1173
1174 auto pos2 = id.find("/",pos+1);
1175
1176 if (pos2 == string::npos) {
1177 m_log << MSG::ERROR << "badly formed Hist/Tree id: \"" << id << "\""
1178 << endmsg;
1179 return false;
1180 }
1181
1182 parseString(id,stream,rem);
1183
1184 }
1185
1186 if (stream == "temp") {
1187 file = nullptr;
1188 return true;
1189 }
1190
1191 auto itr = m_files.find(stream);
1192 file = (itr != m_files.end() ? itr->second.first : nullptr );
1193 if (!file) {
1194 m_log << MSG::WARNING << "no stream \"" << stream
1195 << "\" associated with id: \"" << id << "\""
1196 << endmsg;
1197 }
1198
1199 return true;
1200 }
std::map::end
T end(T...args)
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
ana.file
list file
Definition: ana.py:160
std::string::find
T find(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getGraph | ( | const std::string & | name,
|  | TGraph *& | hist
| ) |  | const
| override

Definition at line 1111 of file THistSvc.cpp.

1111 {
1112 return getHist_i(id, hist);
1113 }
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142

std::vector< std::string > THistSvc::getGraphs | ( |  | ) | const
| override

Definition at line 1118 of file THistSvc.cpp.

1118 {
1119
1120 std::vector<std::string> names;
1121 names.reserve(m_uids.size());
1122 transform_if( std::begin(m_uids), std::end(m_uids),
1123 std::back_inserter(names), select1st,
1124 [](uidMap::const_reference i) {
1125 return i.second.obj->IsA()->InheritsFrom("TTree"); }
1126 );
1127 return names;
1128
1129 }
select1st
constexpr struct select1st_t select1st
std::end
T end(T...args)
std::map::size
T size(T...args)
std::vector< std::string >
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
ana.i
list i
Definition: ana.py:128
std::vector::reserve
T reserve(T...args)

StatusCode THistSvc::getHist | ( | const std::string & | name,
|  | TH1 *& | hist
| ) |  | const
| override

Definition at line 1052 of file THistSvc.cpp.

1052 {
1053 return getHist_i(id, hist);
1054 }
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142

StatusCode THistSvc::getHist | ( | const std::string & | name,
|  | TH2 *& | hist
| ) |  | const
| override

Definition at line 1059 of file THistSvc.cpp.

1059 {
1060 return getHist_i(id, hist);
1061 }
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142

StatusCode THistSvc::getHist | ( | const std::string & | name,
|  | TH3 *& | hist
| ) |  | const
| override

Definition at line 1066 of file THistSvc.cpp.

1066 {
1067 return getHist_i(id, hist);
1068 }
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142
template<typename T >

StatusCode THistSvc::getHist_i | ( | const std::string & | name,
|  | T *& | hist,
|  | bool | quiet = `false`
| ) |  | const
| private

Definition at line 142 of file THistSvc.icc.

142 {
143 // id starts with "/": unique
144
145 GlobalDirectoryRestore restore;
146
147 std::string idr(id);
148 removeDoubleSlash( idr );
149
150 if (idr.find("/") == 0) {
151 auto itr = m_uids.find(id);
152 if (itr == m_uids.end()) {
153 if (!quiet) {
154 m_log << MSG::ERROR << "Could not locate Hist with id \"" << idr << "\""
155 << endmsg;
156 }
157 hist = nullptr;
158 return StatusCode::FAILURE;
159 }
160
161 THistID hid = itr->second;
162 if (!quiet) {
163 hist = dynamic_cast<T*>(hid.obj);
164 if ( !hist ) {
165 m_log << MSG::ERROR << "dcast failed, Hist id: \"" << idr << "\""
166 << endmsg;
167 return StatusCode::FAILURE;
168 }
169 if (m_log.level() <= MSG::VERBOSE) {
170 m_log << MSG::VERBOSE << "found unique Hist title: \""
171 << hist->GetTitle()
172 << "\" id: \"" << idr << "\"" << endmsg;
173 }
174 } else {
175 if (m_log.level() <= MSG::VERBOSE) {
176 m_log << MSG::VERBOSE << "found unique Hist id: \"" << idr
177 << "\" type: \"" << hid.obj->IsA()->GetName() << "\""
178 << endmsg;
179 }
180 }
181
182 return StatusCode::SUCCESS;
183
184
185 // not necessarily unique
186 } else {
187
188 auto mitr = m_ids.equal_range(idr);
189
190
191 if (mitr.first == mitr.second) {
192 m_log << MSG::ERROR << "Could not locate Hist with id \"" << idr << "\""
193 << endmsg;
194 hist = nullptr;
195 return StatusCode::FAILURE;
196 } else {
197
198 if (distance(mitr.first,mitr.second) == 1) {
199 THistID hid = mitr.first->second;
200 if (!quiet) {
201 hist = dynamic_cast<T*>(hid.obj);
202 if (hist == 0) {
203 m_log << MSG::ERROR << "dcast failed" << endmsg;
204 return StatusCode::FAILURE;
205 }
206 if (m_log.level() <= MSG::VERBOSE) {
207 m_log << MSG::VERBOSE << "found Hist title: \"" << hist->GetTitle()
208 << "\" id: \"" << idr << "\"" << endmsg;
209 }
210 } else {
211 if (m_log.level() <= MSG::VERBOSE) {
212 m_log << MSG::VERBOSE << "found Hist id: \"" << idr << "\" type: \""
213 << hid.obj->IsA()->GetName() << "\""
214 << endmsg;
215 }
216 }
217 return StatusCode::SUCCESS;
218 } else {
219 if (!quiet) {
220 // return failure if trying to GET a single hist
221 m_log << MSG::ERROR << "Multiple matches with id \"" << idr << "\"."
222 << " Further specifications required."
223 << endmsg;
224 hist = nullptr;
225 return StatusCode::FAILURE;
226 } else {
227 // return a SUCCESS if just INQUIRING
228 m_log << MSG::INFO << "Found multiple matches with id \"" << idr
229 << "\"" << endmsg;
230 hist = nullptr;
231 return StatusCode::SUCCESS;
232 }
233 }
234 }
235 }
236 }
std::distance
T distance(T...args)
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
std::map::end
T end(T...args)
MSG::VERBOSE
Definition: IMessageSvc.h:17
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::map::find
T find(T...args)
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
GlobalDirectoryRestore
Definition: RConverter.h:16
THistSvc::m_ids
idMap m_ids
Definition: THistSvc.h:202
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
MSG::INFO
Definition: IMessageSvc.h:19
std::multimap::equal_range
T equal_range(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::removeDoubleSlash
void removeDoubleSlash(std::string &) const
Definition: THistSvc.cpp:1720

std::vector< std::string > THistSvc::getHists | ( |  | ) | const
| override

Definition at line 1073 of file THistSvc.cpp.

1073 {
1074
1075 std::vector<std::string> names;
1076 names.reserve(m_uids.size());
1077 transform_if( std::begin(m_uids), std::end(m_uids),
1078 std::back_inserter(names), select1st,
1079 [](uidMap::const_reference i) {
1080 return i.second.obj->IsA()->InheritsFrom("TH11"); }
1081 );
1082 return names;
1083
1084 }
select1st
constexpr struct select1st_t select1st
std::end
T end(T...args)
std::map::size
T size(T...args)
std::vector< std::string >
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
ana.i
list i
Definition: ana.py:128
std::vector::reserve
T reserve(T...args)

StatusCode THistSvc::getTHists | ( | TDirectory * | td,
|  | TList & | tl,
|  | bool | recurse = `false`
| ) |  | const
| override

Definition at line 451 of file THistSvc.cpp.

451 {
452 GlobalDirectoryRestore restore;
453
454 gErrorIgnoreLevel = kBreak;
455
456 if (!td->cd()) {
457 m_log << MSG::ERROR << "getTHists: No such TDirectory \"" << td->GetPath()
458 << "\"" << endmsg;
459 return StatusCode::FAILURE;
460 }
461
462 if (m_log.level() <= MSG::DEBUG)
463 m_log << MSG::DEBUG << "getTHists: \"" << td->GetPath() << "\": found "
464 << td->GetListOfKeys()->GetSize() << " keys" << endmsg;
465
466 TIter nextkey(td->GetListOfKeys());
467 while (TKey *key = (TKey*)nextkey()) {
468 if (m_log.level() <= MSG::DEBUG)
469 m_log << MSG::DEBUG << " key: " << key->GetName();
470 TObject *obj = key->ReadObj();
471 if (obj != 0 && obj->IsA()->InheritsFrom("TDirectory")) {
472 if (m_log.level() <= MSG::DEBUG)
473 m_log << " (" << obj->IsA()->GetName() << ")";
474 } else if (obj != 0 && obj->IsA()->InheritsFrom("TH1")) {
475 if (m_log.level() <= MSG::DEBUG)
476 m_log << " (" << obj->IsA()->GetName() << ")";
477 tl.Add(obj);
478 } else if (obj != 0) {
479 if (m_log.level() <= MSG::DEBUG)
480 m_log << " [" << obj->IsA()->GetName() << "]";
481 }
482 if (m_log.level() <= MSG::DEBUG)
483 m_log << endmsg;
484 }
485
486 // operate recursively
487 if (rcs) {
488 nextkey = td->GetListOfKeys();
489 while (TKey *key = (TKey*)nextkey()) {
490 TObject *obj = key->ReadObj();
491 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
492 TDirectory *tt = dynamic_cast<TDirectory*>(obj);
493 getTHists(tt, tl, rcs);
494 }
495 }
496 }
497
498 return StatusCode::SUCCESS;
499
500
501 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
THistSvc::getTHists
StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:451
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
GlobalDirectoryRestore
Definition: RConverter.h:16
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTHists | ( | const std::string & | name,
|  | TList & | tl,
|  | bool | recurse = `false`
| ) |  | const
| override

Definition at line 506 of file THistSvc.cpp.

506 {
507
508 GlobalDirectoryRestore restore;
509
510 gErrorIgnoreLevel = kBreak;
511
512 StatusCode sc;
513
514 std::string stream,rem,r2;
515 parseString(dir,stream,rem);
516
517 auto itr = m_files.find(stream);
518 if (itr != m_files.end()) {
519 r2 = itr->second.first->GetName();
520 r2 += ":/";
521 r2 += rem;
522
523 if (m_log.level() <= MSG::DEBUG)
524 m_log << MSG::DEBUG << "getTHists: \"" << dir
525 << "\" looks like a stream name." << " associated TFile: \""
526 << itr->second.first->GetName() << "\"" << endmsg;
527
528 if (gDirectory->cd(r2.c_str())) {
529 m_curstream = stream;
530 sc = getTHists(gDirectory,tl,rcs);
531 m_curstream = "";
532 return sc;
533 } else {
534 if (m_log.level() <= MSG::DEBUG)
535 m_log << MSG::DEBUG << "getTHists: no such TDirectory \""
536 << r2 << "\"" << endmsg;
537 }
538
539 } else {
540 if (m_log.level() <= MSG::DEBUG)
541 m_log << MSG::DEBUG << "getTHists: stream \"" << stream << "\" not found"
542 << endmsg;
543 }
544
545 if (!gDirectory->cd(dir.c_str())) {
546 m_log << MSG::ERROR << "getTHists: No such TDirectory/stream \"" << dir
547 << "\"" << endmsg;
548 sc = StatusCode::FAILURE;
549 } else {
550 sc = getTHists(gDirectory,tl,rcs);
551 }
552
553 return sc;
554
555 }
THistSvc::m_curstream
std::string m_curstream
Definition: THistSvc.h:213
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
THistSvc::getTHists
StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:451
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::map::find
T find(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTHists | ( | TDirectory * | td,
|  | TList & | tl,
|  | bool | recurse = `false`,
|  | bool | reg = `false`
| ) |  |
| override

Definition at line 659 of file THistSvc.cpp.

659 {
660
661 GlobalDirectoryRestore restore;
662
663 gErrorIgnoreLevel = kBreak;
664
665 if (!td->cd()) {
666 m_log << MSG::ERROR << "getTHists: No such TDirectory \"" << td->GetPath()
667 << "\"" << endmsg;
668 return StatusCode::FAILURE;
669 }
670
671 if (m_log.level() <= MSG::DEBUG)
672 m_log << MSG::DEBUG << "getTHists: \"" << td->GetPath() << "\": found "
673 << td->GetListOfKeys()->GetSize() << " keys" << endmsg;
674
675 TIter nextkey(td->GetListOfKeys());
676 while (TKey *key = (TKey*)nextkey()) {
677 if (m_log.level() <= MSG::DEBUG)
678 m_log << MSG::DEBUG << " key: " << key->GetName();
679 TObject *obj = key->ReadObj();
680 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
681 if (m_log.level() <= MSG::DEBUG)
682 m_log << " (" << obj->IsA()->GetName() << ")";
683 } else if (obj && obj->IsA()->InheritsFrom("TH1")) {
684 if (m_log.level() <= MSG::DEBUG)
685 m_log << " (" << obj->IsA()->GetName() << ")";
686 tl.Add(obj);
687 if (reg && m_curstream != "") {
688 string dir = td->GetPath();
689 string fil = td->GetFile()->GetName();
690 dir.erase(0,fil.length()+1);
691 string id = "/" + m_curstream;
692 if ( dir == "/" ) {
693 id = id + "/" + key->GetName();
694 } else {
695 id = id + dir + "/" + key->GetName();
696 }
697 if (!exists(id)) {
698 if (m_log.level() <= MSG::DEBUG)
699 m_log << " reg as \"" << id << "\"";
700 regHist(id).ignore();
701 } else {
702 if (m_log.level() <= MSG::DEBUG)
703 m_log << " already registered";
704 }
705 }
706 } else if (obj) {
707 if (m_log.level() <= MSG::DEBUG)
708 m_log << " [" << obj->IsA()->GetName() << "]";
709 }
710 if (m_log.level() <= MSG::DEBUG)
711 m_log << endmsg;
712 }
713
714 // operate recursively
715 if (rcs) {
716 nextkey = td->GetListOfKeys();
717 while (TKey *key = (TKey*)nextkey()) {
718 TObject *obj = key->ReadObj();
719 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
720 TDirectory *tt = dynamic_cast<TDirectory*>(obj);
721 getTHists(tt, tl, rcs, reg);
722 }
723 }
724 }
725
726 return StatusCode::SUCCESS;
727
728 }
THistSvc::m_curstream
std::string m_curstream
Definition: THistSvc.h:213
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
THistSvc::getTHists
StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:451
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::string::erase
T erase(T...args)
THistSvc::regHist
StatusCode regHist(const std::string &name) override
Definition: THistSvc.cpp:974
std::string::length
T length(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::exists
bool exists(const std::string &name) const override
Definition: THistSvc.cpp:1806
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTHists | ( | const std::string & | name,
|  | TList & | tl,
|  | bool | recurse = `false`,
|  | bool | reg = `false`
| ) |  |
| override

Definition at line 733 of file THistSvc.cpp.

733 {
734
735 GlobalDirectoryRestore restore;
736
737 gErrorIgnoreLevel = kBreak;
738
739 StatusCode sc;
740
741 std::string stream,rem,r2;
742 parseString(dir,stream,rem);
743
744 auto itr = m_files.find(stream);
745 if (itr != m_files.end()) {
746 r2 = itr->second.first->GetName();
747 r2 += ":/";
748 r2 += rem;
749
750 if (m_log.level() <= MSG::DEBUG)
751 m_log << MSG::DEBUG << "getTHists: \"" << dir
752 << "\" looks like a stream name." << " associated TFile: \""
753 << itr->second.first->GetName() << "\"" << endmsg;
754
755 if (gDirectory->cd(r2.c_str())) {
756 m_curstream = stream;
757 sc = getTHists(gDirectory,tl,rcs,reg);
758 m_curstream.clear();
759 return sc;
760 }
761 if (m_log.level() <= MSG::DEBUG)
762 m_log << MSG::DEBUG << "getTHists: no such TDirectory \""
763 << r2 << "\"" << endmsg;
764
765 } else {
766 if (m_log.level() <= MSG::DEBUG)
767 m_log << MSG::DEBUG << "getTHists: stream \"" << stream << "\" not found"
768 << endmsg;
769 }
770
771 if (!gDirectory->cd(dir.c_str())) {
772 m_log << MSG::ERROR << "getTHists: No such TDirectory/stream \"" << dir
773 << "\"" << endmsg;
774 sc = StatusCode::FAILURE;
775 } else {
776 if (reg) {
777 m_log << MSG::WARNING << "Unable to register histograms automatically "
778 << "without a valid stream name" << endmsg;
779 reg = false;
780 }
781 sc = getTHists(gDirectory,tl,rcs,reg);
782 }
783
784 return sc;
785
786 }
THistSvc::m_curstream
std::string m_curstream
Definition: THistSvc.h:213
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
THistSvc::getTHists
StatusCode getTHists(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:451
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::string::clear
T clear(T...args)
std::map::find
T find(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTree | ( | const std::string & | name,
|  | TTree *& | hist
| ) |  | const
| override

Definition at line 1088 of file THistSvc.cpp.

1088 {
1089 return getHist_i(id, hist);
1090 }
THistSvc::getHist_i
StatusCode getHist_i(const std::string &name, T *&hist, bool quiet=false) const
Definition: THistSvc.icc:142

std::vector< std::string > THistSvc::getTrees | ( |  | ) | const
| override

Definition at line 1095 of file THistSvc.cpp.

1095 {
1096
1097 std::vector<std::string> names;
1098 names.reserve(m_uids.size());
1099 transform_if( std::begin(m_uids), std::end(m_uids),
1100 std::back_inserter(names),
1101 select1st,
1102 [](uidMap::const_reference i) {
1103 return i.second.obj->IsA()->InheritsFrom("TTree"); }
1104 );
1105 return names;
1106
1107 }
select1st
constexpr struct select1st_t select1st
std::end
T end(T...args)
std::map::size
T size(T...args)
std::vector< std::string >
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
ana.i
list i
Definition: ana.py:128
std::vector::reserve
T reserve(T...args)

StatusCode THistSvc::getTTrees | ( | TDirectory * | td,
|  | TList & | tl,
|  | bool | recurse = `false`
| ) |  | const
| override

Definition at line 559 of file THistSvc.cpp.

559 {
560 GlobalDirectoryRestore restore;
561
562 gErrorIgnoreLevel = kBreak;
563
564 if (!td->cd()) {
565 m_log << MSG::ERROR << "getTTrees: No such TDirectory \""
566 << td->GetPath() << "\"" << endmsg;
567 return StatusCode::FAILURE;
568 }
569
570 if (m_log.level() <= MSG::DEBUG)
571 m_log << MSG::DEBUG << "getTHists: \"" << td->GetPath() << "\": found "
572 << td->GetListOfKeys()->GetSize() << " keys" << endmsg;
573
574 TIter nextkey(td->GetListOfKeys());
575 while (TKey *key = (TKey*)nextkey()) {
576 if (m_log.level() <= MSG::DEBUG)
577 m_log << MSG::DEBUG << " key: " << key->GetName();
578 TObject *obj = key->ReadObj();
579 if (obj != 0 && obj->IsA()->InheritsFrom("TDirectory")) {
580 if (m_log.level() <= MSG::DEBUG)
581 m_log << " (" << obj->IsA()->GetName() << ")";
582 } else if (obj != 0 && obj->IsA()->InheritsFrom("TTree")) {
583 if (m_log.level() <= MSG::DEBUG)
584 m_log << " (" << obj->IsA()->GetName() << ")";
585 tl.Add(obj);
586 } else if (obj != 0) {
587 if (m_log.level() <= MSG::DEBUG)
588 m_log << " [" << obj->IsA()->GetName() << "]";
589 }
590 m_log << endmsg;
591 }
592
593 // operate recursively
594 if (rcs) {
595 nextkey = td->GetListOfKeys();
596 while (TKey *key = (TKey*)nextkey()) {
597 TObject *obj = key->ReadObj();
598 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
599 TDirectory *tt = dynamic_cast<TDirectory*>(obj);
600 getTTrees(tt, tl, rcs);
601 }
602 }
603 }
604
605 return StatusCode::SUCCESS;
606
607 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::getTTrees
StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:559
MSG::DEBUG
Definition: IMessageSvc.h:18
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
GlobalDirectoryRestore
Definition: RConverter.h:16
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTTrees | ( | const std::string & | name,
|  | TList & | tl,
|  | bool | recurse = `false`
| ) |  | const
| override

Definition at line 612 of file THistSvc.cpp.

612 {
613 GlobalDirectoryRestore restore;
614
615 gErrorIgnoreLevel = kBreak;
616
617 StatusCode sc;
618
619 std::string stream,rem,r2;
620 parseString(dir,stream,rem);
621
622 auto itr = m_files.find(stream);
623 if (itr != m_files.end()) {
624 r2 = itr->second.first->GetName();
625 r2 += ":/";
626 r2 += rem;
627
628 if (m_log.level() <= MSG::DEBUG)
629 m_log << MSG::DEBUG << "getTTrees: \"" << dir
630 << "\" looks like a stream name." << " associated TFile: \""
631 << itr->second.first->GetName() << "\"" << endmsg;
632
633 if (gDirectory->cd(r2.c_str())) {
634 return getTTrees(gDirectory,tl,rcs);
635 }
636 if (m_log.level() <= MSG::DEBUG)
637 m_log << MSG::DEBUG << "getTTrees: no such TDirectory \""
638 << r2 << "\"" << endmsg;
639 } else {
640 if (m_log.level() <= MSG::DEBUG)
641 m_log << MSG::DEBUG << "getTTrees: stream \"" << stream << "\" not found"
642 << endmsg;
643 }
644
645 if (!gDirectory->cd(dir.c_str())) {
646 m_log << MSG::ERROR << "getTTrees: No such TDirectory/stream \"" << dir
647 << "\"" << endmsg;
648 sc = StatusCode::FAILURE;
649 } else {
650 sc = getTTrees(gDirectory,tl,rcs);
651 }
652 return sc;
653 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::getTTrees
StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:559
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::map::find
T find(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTTrees | ( | TDirectory * | td,
|  | TList & | tl,
|  | bool | recurse = `false`,
|  | bool | reg = `false`
| ) |  |
| override

Definition at line 790 of file THistSvc.cpp.

790 {
791
792 GlobalDirectoryRestore restore;
793
794 gErrorIgnoreLevel = kBreak;
795
796 if (!td->cd()) {
797 m_log << MSG::ERROR << "getTTrees: No such TDirectory \""
798 << td->GetPath() << "\"" << endmsg;
799 return StatusCode::FAILURE;
800 }
801
802 if (m_log.level() <= MSG::DEBUG)
803 m_log << MSG::DEBUG << "getTHists: \"" << td->GetPath() << "\": found "
804 << td->GetListOfKeys()->GetSize() << " keys" << endmsg;
805
806 TIter nextkey(td->GetListOfKeys());
807 while (TKey *key = (TKey*)nextkey()) {
808 if (m_log.level() <= MSG::DEBUG)
809 m_log << MSG::DEBUG << " key: " << key->GetName();
810 TObject *obj = key->ReadObj();
811 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
812 if (m_log.level() <= MSG::DEBUG)
813 m_log << " (" << obj->IsA()->GetName() << ")";
814 } else if (obj && obj->IsA()->InheritsFrom("TTree")) {
815 if (m_log.level() <= MSG::DEBUG)
816 m_log << " (" << obj->IsA()->GetName() << ")";
817 tl.Add(obj);
818 if (reg && m_curstream != "") {
819 string dir = td->GetPath();
820 string fil = td->GetFile()->GetName();
821 dir.erase(0,fil.length()+1);
822 string id = "/" + m_curstream;
823 if ( dir == "/" ) {
824 id = id + "/" + key->GetName();
825 } else {
826 id = id + dir + "/" + key->GetName();
827 }
828 if (!exists(id)) {
829 if (m_log.level() <= MSG::DEBUG)
830 m_log << " reg as \"" << id << "\"";
831 regHist(id).ignore();
832 } else {
833 if (m_log.level() <= MSG::DEBUG)
834 m_log << " already registered";
835 }
836 }
837 } else if (obj != 0) {
838 if (m_log.level() <= MSG::DEBUG)
839 m_log << " [" << obj->IsA()->GetName() << "]";
840 }
841 if (m_log.level() <= MSG::DEBUG)
842 m_log << endmsg;
843 }
844
845 // operate recursively
846 if (rcs) {
847 nextkey = td->GetListOfKeys();
848 while (TKey *key = (TKey*)nextkey()) {
849 TObject *obj = key->ReadObj();
850 if (obj && obj->IsA()->InheritsFrom("TDirectory")) {
851 TDirectory *tt = dynamic_cast<TDirectory*>(obj);
852 getTTrees(tt, tl, rcs, reg);
853 }
854 }
855 }
856
857 return StatusCode::SUCCESS;
858
859 }
THistSvc::m_curstream
std::string m_curstream
Definition: THistSvc.h:213
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::getTTrees
StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:559
MSG::DEBUG
Definition: IMessageSvc.h:18
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::string::erase
T erase(T...args)
THistSvc::regHist
StatusCode regHist(const std::string &name) override
Definition: THistSvc.cpp:974
std::string::length
T length(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::exists
bool exists(const std::string &name) const override
Definition: THistSvc.cpp:1806
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::getTTrees | ( | const std::string & | name,
|  | TList & | tl,
|  | bool | recurse = `false`,
|  | bool | reg = `false`
| ) |  |
| override

Definition at line 864 of file THistSvc.cpp.

864 {
865
866 GlobalDirectoryRestore restore;
867
868 gErrorIgnoreLevel = kBreak;
869
870 StatusCode sc;
871
872 std::string stream,rem,r2;
873 parseString(dir,stream,rem);
874
875 auto itr = m_files.find(stream);
876 if (itr != m_files.end()) {
877 r2 = itr->second.first->GetName();
878 r2 += ":/";
879 r2 += rem;
880
881 if (m_log.level() <= MSG::DEBUG)
882 m_log << MSG::DEBUG << "getTTrees: \"" << dir
883 << "\" looks like a stream name." << " associated TFile: \""
884 << itr->second.first->GetName() << "\"" << endmsg;
885
886 if (gDirectory->cd(r2.c_str())) {
887 return getTTrees(gDirectory,tl,rcs,reg);
888 } else {
889 if (m_log.level() <= MSG::DEBUG)
890 m_log << MSG::DEBUG << "getTTrees: no such TDirectory \""
891 << r2 << "\"" << endmsg;
892 }
893
894 } else {
895 if (m_log.level() <= MSG::DEBUG)
896 m_log << MSG::DEBUG << "getTTrees: stream \"" << stream << "\" not found"
897 << endmsg;
898 }
899
900 if (!gDirectory->cd(dir.c_str())) {
901 m_log << MSG::ERROR << "getTTrees: No such TDirectory/stream \"" << dir
902 << "\"" << endmsg;
903 return StatusCode::FAILURE;
904 }
905
906 return getTTrees(gDirectory,tl,rcs,reg);
907
908 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::getTTrees
StatusCode getTTrees(TDirectory *td, TList &, bool recurse=false) const override
Definition: THistSvc.cpp:559
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::map::find
T find(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void THistSvc::handle | ( | const Incident & |  | ) |
| override

Definition at line 1816 of file THistSvc.cpp.

1816 {
1817
1818 if (signaledStop) return ;
1819
1820 if (m_maxFileSize.value() == -1) return;
1821
1822 // convert to bytes.
1823 Long64_t mfs = (Long64_t)m_maxFileSize.value() * (Long64_t)1048576;
1824 Long64_t mfs_warn = mfs * 95 / 100;
1825
1826 updateFiles();
1827
1828 map<string, pair<TFile*,Mode> >::const_iterator itr;
1829 for (const auto& f : m_files) {
1830 TFile* tf = f.second.first;
1831
1832 #ifndef NDEBUG
1833 if (m_log.level() <= MSG::DEBUG)
1834 m_log << MSG::DEBUG << "stream: " << f.first << " name: "
1835 << tf->GetName() << " size: " << tf->GetSize()
1836 << endmsg;
1837 #endif
1838
1839 // Signal job to terminate if output file is too large
1840 if (tf->GetSize() > mfs) {
1841
1842 signaledStop = true;
1843
1844 m_log << MSG::FATAL << "file \"" << tf->GetName()
1845 << "\" associated with stream \"" << f.first
1846 << "\" has exceeded the max file size of "
1847 << m_maxFileSize.value() << "MB. Terminating Job."
1848 << endmsg;
1849
1850 IEventProcessor* evt = nullptr;
1851 if (service("ApplicationMgr", evt, true).isSuccess()) {
1852 evt->stopRun();
1853 evt->release();
1854 } else {
1855 abort();
1856 }
1857 } else if (tf->GetSize() > mfs_warn) {
1858 m_log << MSG::WARNING << "file \"" << tf->GetName()
1859 << "\" associated with stream \"" << f.first
1860 << "\" is at 95% of its maximum allowable file size of "
1861 << m_maxFileSize.value() << "MB"
1862 << endmsg;
1863 }
1864 }
1865 }
IEventProcessor::stopRun
virtual StatusCode stopRun()=0
Schedule a stop of the current event processing.
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
THistSvc::signaledStop
bool signaledStop
Definition: THistSvc.h:210
std::map
STL class.
MSG::FATAL
Definition: IMessageSvc.h:22
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
read_lhcb_event_file.evt
tuple evt
Definition: read_lhcb_event_file.py:14
THistSvc::m_maxFileSize
IntegerProperty m_maxFileSize
Definition: THistSvc.h:184
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
IEventProcessor
The IEventProcessor is the interface to process events.
Definition: IEventProcessor.h:16
std::abort
T abort(T...args)
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::updateFiles
void updateFiles()
Definition: THistSvc.cpp:1305

StatusCode THistSvc::initialize | ( |  | ) |
| override

Definition at line 78 of file THistSvc.cpp.

78 {
79 GlobalDirectoryRestore restore;
80
81 // Super ugly hack to make sure we have the OutputLevel set first, so we
82 // can see DEBUG printouts in update handlers.
83 auto jos = serviceLocator()->service<IJobOptionsSvc>( "JobOptionsSvc", true );
84 if( jos ) {
85 const auto props = jos->getProperties( name() );
86
87 if ( props ) {
88 auto i = std::find_if(std::begin(*props),std::end(*props),
89 [](const Property* p) { return p->name() == "OutputLevel"; } );
90 if ( i != std::end(*props)) {
91 setProperty( **i ).ignore();
92 m_log.setLevel( m_outputLevel.value() );
93 }
94 }
95 }
96
97
98 StatusCode status = Service::initialize();
99 m_log.setLevel( m_outputLevel.value() );
100
101 if (status.isFailure()) {
102 m_log << MSG::ERROR << "initializing service" << endmsg;
103 return status;
104 }
105
106 StatusCode st(StatusCode::SUCCESS);
107
108 try {
109 setupOutputFile( m_outputfile );
110 } catch ( GaudiException& err ) {
111 m_log << MSG::ERROR
112 << "Caught: " << err << endmsg;
113 st = StatusCode::FAILURE;
114 }
115
116 try {
117 setupInputFile( m_inputfile );
118 } catch ( GaudiException& err ) {
119 m_log << MSG::ERROR
120 << "Caught: " << err << endmsg;
121 st = StatusCode::FAILURE;
122 }
123
124 // Protect against multiple instances of TROOT
125 if ( !gROOT ) {
126 static TROOT root("root","ROOT I/O");
127 // gDebug = 99;
128 } else {
129 if (m_log.level() <= MSG::VERBOSE)
130 m_log << MSG::VERBOSE << "ROOT already initialized, debug = "
131 << gDebug<< endmsg;
132 }
133
134 if (service("IncidentSvc", p_incSvc, true).isFailure()) {
135 m_log << MSG::ERROR << "unable to get the IncidentSvc" << endmsg;
136 st = StatusCode::FAILURE;
137 } else {
138 p_incSvc->addListener( this, "EndEvent", 100, true);
139 }
140
141 if (service("FileMgr",p_fileMgr,true).isFailure()) {
142 m_log << MSG::ERROR << "unable to get the FileMgr" << endmsg;
143 st = StatusCode::FAILURE;
144 } else {
145 m_log << MSG::DEBUG << "got the FileMgr" << endmsg;
146 }
147
148
149 // Register open/close callback actions
150
151 using namespace std::placeholders;
152 auto boa = [this](const Io::FileAttr* fa, const std::string& caller) { return this->rootOpenAction(fa,caller); };
153 if (p_fileMgr->regAction(boa, Io::OPEN, Io::ROOT).isFailure()) {
154 m_log << MSG::ERROR
155 << "unable to register ROOT file open action with FileMgr"
156 << endmsg;
157 }
158 auto bea = [this](const Io::FileAttr* fa, const std::string& caller) { return this->rootOpenErrAction(fa,caller); };
159 if (p_fileMgr->regAction(bea, Io::OPEN_ERR, Io::ROOT).isFailure()) {
160 m_log << MSG::ERROR
161 << "unable to register ROOT file open Error action with FileMgr"
162 << endmsg;
163 }
164
165
166 m_okToConnect = true;
167
168 if (m_delayConnect) {
169 if (!m_inputfile.value().empty()) { setupInputFile(m_inputfile); }
170 if (!m_outputfile.value().empty()) { setupOutputFile(m_outputfile); }
171
172 m_delayConnect = false;
173
174 }
175 m_alreadyConnectedOutFiles.clear();
176 m_alreadyConnectedInFiles.clear();
177
178
179 IIoComponentMgr* iomgr = nullptr;
180
181 if (service("IoComponentMgr", iomgr, true).isFailure()) {
182 m_log << MSG::ERROR << "unable to get the IoComponentMgr" << endmsg;
183 st = StatusCode::FAILURE;
184 } else {
185
186 if ( !iomgr->io_register (this).isSuccess() ) {
187 m_log << MSG::ERROR
188 << "could not register with the I/O component manager !"
189 << endmsg;
190 st = StatusCode::FAILURE;
191 } else {
192 bool all_good = true;
193 // register input/output files...
194 for ( const auto& reg : m_files ) {
195 const std::string& fname = reg.second.first->GetName();
196 const IIoComponentMgr::IoMode::Type iomode =
197 ( reg.second.second==THistSvc::READ
198 ? IIoComponentMgr::IoMode::READ
199 : IIoComponentMgr::IoMode::WRITE );
200 if ( !iomgr->io_register (this, iomode, fname).isSuccess () ) {
201 m_log << MSG::WARNING << "could not register file ["
202 << fname << "] with the I/O component manager..." << endmsg;
203 all_good = false;
204 } else {
205 m_log << MSG::INFO << "registered file [" << fname << "]... [ok]"
206 << endmsg;
207 }
208 }
209 if (!all_good) {
210 m_log << MSG::ERROR
211 << "problem while registering input/output files with "
212 << "the I/O component manager !" << endmsg;
213 st = StatusCode::FAILURE;
214 }
215 }
216
217 }
218
219 if (st.isFailure()) {
220 m_log << MSG::FATAL << "Unable to initialize THistSvc" << endmsg;
221 }
222
223 return st;
224
225 }
THistSvc::m_delayConnect
bool m_delayConnect
Definition: THistSvc.h:211
IIoComponentMgr
Definition: IIoComponentMgr.h:22
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
Service::m_outputLevel
IntegerProperty m_outputLevel
Service output level.
Definition: Service.h:309
IJobOptionsSvc::getProperties
virtual const std::vector< const Property * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
std::vector::empty
T empty(T...args)
Io::ROOT
Definition: IFileMgr.h:153
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
std::placeholders
Io::OPEN
Definition: IFileMgr.h:291
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
Property::name
const std::string & name() const
property name
Definition: Property.h:45
THistSvc::p_incSvc
IIncidentSvc * p_incSvc
Definition: THistSvc.h:215
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MSG::DEBUG
Definition: IMessageSvc.h:18
Service::setProperty
StatusCode setProperty(const Property &p) override
Definition: Service.cpp:330
std::end
T end(T...args)
THistSvc::rootOpenAction
StatusCode rootOpenAction(FILEMGR_CALLBACK_ARGS)
Definition: THistSvc.cpp:2030
MSG::VERBOSE
Definition: IMessageSvc.h:17
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
CommonMessagingBase::err
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:115
std::string
STL class.
IFileMgr::regAction
virtual StatusCode regAction(Io::bfcn_action_t, const Io::Action &, const std::string &d="")=0
THistSvc::m_inputfile
StringArrayProperty m_inputfile
Definition: THistSvc.h:182
IIoComponentMgr::IoMode::Type
Type
Definition: IIoComponentMgr.h:32
MSG::FATAL
Definition: IMessageSvc.h:22
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
THistSvc::m_outputfile
StringArrayProperty m_outputfile
Definition: THistSvc.h:182
THistSvc::setupOutputFile
void setupOutputFile(Property &outputfile)
call-back method to handle output stream property
Definition: THistSvc.cpp:1275
IJobOptionsSvc
Main interface for the JobOptions service.
Definition: IJobOptionsSvc.h:20
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::m_okToConnect
bool m_okToConnect
Definition: THistSvc.h:211
THistSvc::rootOpenErrAction
StatusCode rootOpenErrAction(FILEMGR_CALLBACK_ARGS)
Definition: THistSvc.cpp:2062
std::set::clear
T clear(T...args)
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
std::find_if
T find_if(T...args)
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
std::begin
T begin(T...args)
GlobalDirectoryRestore
Definition: RConverter.h:16
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
MsgStream::setLevel
void setLevel(int level)
Update outputlevel.
Definition: MsgStream.h:106
THistSvc::READ
Definition: THistSvc.h:108
IIoComponentMgr::io_register
virtual StatusCode io_register(IIoComponent *iocomponent)=0
: allow a IIoComponent to register itself with this manager so appropriate actions can be taken when ...
THistSvc::p_fileMgr
IFileMgr * p_fileMgr
Definition: THistSvc.h:216
IOTest.root
tuple root
Definition: IOTest.py:42
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_alreadyConnectedOutFiles
std::set< std::string > m_alreadyConnectedOutFiles
list of already connected files.
Definition: THistSvc.h:193
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
IIoComponentMgr::IoMode::WRITE
Definition: IIoComponentMgr.h:34
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
THistSvc::m_alreadyConnectedInFiles
std::set< std::string > m_alreadyConnectedInFiles
list of already connected files.
Definition: THistSvc.h:189
MSG::INFO
Definition: IMessageSvc.h:19
THistSvc::setupInputFile
void setupInputFile(Property &inputfile)
call-back method to handle input stream property
Definition: THistSvc.cpp:1236
ana.i
list i
Definition: ana.py:128
IIoComponentMgr::IoMode::READ
Definition: IIoComponentMgr.h:33
Io::OPEN_ERR
Definition: IFileMgr.h:294
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Io::FileAttr
Definition: IFileMgr.h:174

StatusCode THistSvc::io_reinit | ( |  | ) |
| override

callback method to reinitialize the internal state of the component for I/O purposes (e.g.

upon `fork(2)`)

Definition at line 1912 of file THistSvc.cpp.

1913 {
1914 bool all_good = true;
1915 if (m_log.level() <= MSG::DEBUG)
1916 m_log << MSG::DEBUG << "reinitializing I/O..." << endmsg;
1917
1918 // retrieve the I/O component manager...
1919
1920 IIoComponentMgr* iomgr = nullptr;
1921
1922 if (service("IoComponentMgr", iomgr, true).isFailure()) {
1923 m_log << MSG::ERROR << "could not retrieve I/O component manager !"
1924 << endmsg;
1925 return StatusCode::FAILURE;
1926 }
1927
1928 GlobalDirectoryRestore restore;
1929 // to hide the expected errors upon closing the files whose
1930 // file descriptors have been swept under the rug...
1931 gErrorIgnoreLevel = kFatal;
1932
1933 typedef std::map<std::string, std::pair<TFile*,Mode> > FileReg_t;
1934
1935 for (auto & ifile : m_files ) {
1936 TFile *f = ifile.second.first;
1937 std::string fname = f->GetName();
1938 if (m_log.level() <= MSG::DEBUG)
1939 m_log << MSG::DEBUG << "file [" << fname << "] mode: ["
1940 << f->GetOption() << "] r:"
1941 << f->GetFileBytesRead()
1942 << " w:" << f->GetFileBytesWritten()
1943 << " cnt:" << f->GetFileCounter()
1944 << endmsg;
1945
1946 if ( ifile.second.second == READ ) {
1947 if (m_log.level() <= MSG::DEBUG)
1948 m_log << MSG::DEBUG
1949 << " TFile opened in READ mode: not reassigning names" << endmsg;
1950 continue;
1951 }
1952
1953 if ( !iomgr->io_retrieve (this, fname).isSuccess () ) {
1954 m_log << MSG::ERROR << "could not retrieve new name for [" << fname
1955 << "] !!" << endmsg;
1956 all_good = false;
1957 continue;
1958 } else {
1959 if (m_log.level() <= MSG::DEBUG)
1960 m_log << MSG::DEBUG << "got a new name [" << fname << "]..." << endmsg;
1961 }
1962 // create a new TFile
1963 // TFile *newfile = TFile::Open (fname.c_str(), f->GetOption());
1964
1965 void* vf;
1966 Option_t *opts = f->GetOption();
1967 int r = p_fileMgr->open(Io::ROOT,name(),fname,Io::WRITE,vf,"HIST");
1968 if (r != 0) {
1969 m_log << MSG::ERROR << "unable to open file \"" << fname
1970 << "\" for writing" << endmsg;
1971 return StatusCode::FAILURE;
1972 }
1973 TFile *newfile = (TFile*) vf;
1974 newfile->SetOption(opts);
1975
1976
1977 if (ifile.second.second != THistSvc::READ) {
1978 copyFileLayout (newfile, f);
1979 ifile.second.first = newfile;
1980 }
1981
1982 // loop over all uids and migrate them to the new file
1983 // XXX FIXME: this double loop sucks...
1984 for ( auto& uid : m_uids ) {
1985 THistID& hid = uid.second;
1986 if ( hid.file != f ) continue;
1987 TDirectory *olddir = this->changeDir (hid);
1988 hid.file = newfile;
1989 // side-effect: create needed directories...
1990 TDirectory *newdir = this->changeDir (hid);
1991 TClass *cl = hid.obj->IsA();
1992
1993 // migrate the objects to the new file.
1994 // thanks to the object model of ROOT, it is super easy.
1995 if (cl->InheritsFrom ("TTree")) {
1996 dynamic_cast<TTree*> (hid.obj)->SetDirectory (newdir);
1997 dynamic_cast<TTree*> (hid.obj)->Reset();
1998 }
1999 else if (cl->InheritsFrom ("TH1")) {
2000 dynamic_cast<TH1*> (hid.obj)->SetDirectory (newdir);
2001 dynamic_cast<TH1*> (hid.obj)->Reset();
2002 }
2003 else if (cl->InheritsFrom ("TGraph")) {
2004 olddir->Remove (hid.obj);
2005 newdir->Append (hid.obj);
2006 } else {
2007 m_log << MSG::ERROR
2008 << "id: \"" << hid.id << "\" is not a inheriting from a class "
2009 << "we know how to handle (received [" << cl->GetName()
2010 << "], " << "expected [TTree, TH1 or TGraph]) !"
2011 << endmsg
2012 << "attaching to current dir [" << newdir->GetPath() << "] "
2013 << "nonetheless..." << endmsg;
2014 olddir->Remove (hid.obj);
2015 newdir->Append (hid.obj);
2016 }
2017 }
2018 f->ReOpen ("READ");
2019 p_fileMgr->close(f,name());
2020 f = newfile;
2021 }
2022
2023 return all_good ? StatusCode::SUCCESS : StatusCode::FAILURE;
2024 }
IIoComponentMgr::io_retrieve
virtual StatusCode io_retrieve(IIoComponent *iocomponent, std::string &fname)=0
: retrieve the new filename for a given IIoComponent and
IIoComponentMgr
Definition: IIoComponentMgr.h:22
Io::ROOT
Definition: IFileMgr.h:153
IFileMgr::open
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &, void *&, const std::string &desc, const bool shared=false)=0
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MSG::DEBUG
Definition: IMessageSvc.h:18
THistSvc::copyFileLayout
void copyFileLayout(TDirectory *, TDirectory *)
helper function to recursively copy the layout of a TFile into a new TFile
Definition: THistSvc.cpp:1872
THistSvc::changeDir
TDirectory * changeDir(const THistSvc::THistID &hid) const
Definition: THistSvc.cpp:1655
std::map
STL class.
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
std::string
STL class.
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
StatusCode::FAILURE
Definition: StatusCode.h:29
ana.opts
dictionary opts
Definition: ana.py:111
Io::WRITE
Definition: IFileMgr.h:27
StatusCode::SUCCESS
Definition: StatusCode.h:30
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
GlobalDirectoryRestore
Definition: RConverter.h:16
THistSvc::READ
Definition: THistSvc.h:108
THistSvc::p_fileMgr
IFileMgr * p_fileMgr
Definition: THistSvc.h:216
MSG::ERROR
Definition: IMessageSvc.h:21
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:144
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IFileMgr::close
virtual Io::close_t close(const Io::Fd, const std::string &caller)=0

void THistSvc::MergeRootFile | ( | TDirectory * | target,
|  | TDirectory * | source
| ) |  |
| private

Definition at line 1730 of file THistSvc.cpp.

1730 {
1731
1732 if (m_log.level() <= MSG::DEBUG)
1733 m_log <<MSG::DEBUG << "Target path: " << target->GetPath() << endmsg;
1734 TString path( (char*)strstr(target->GetPath(), ":") );
1735 path.Remove( 0, 2);
1736
1737 source->cd(path);
1738 TDirectory *current_sourcedir = gDirectory;
1739
1740 // loop over all keys in this directory
1741 TList *lkeys=current_sourcedir->GetListOfKeys();
1742 int nkeys=lkeys->GetEntries();
1743 TKey *key;
1744 for (int jj=0; jj<nkeys; jj++) {
1745 key=(TKey*) lkeys->At(jj);
1746 string pathnameinsource=current_sourcedir->GetPath()+string("/")+key->GetName();
1747 if (m_log.level() <= MSG::DEBUG)
1748 m_log <<MSG::DEBUG << "Reading Key:" << pathnameinsource << endmsg;
1749 //key->Dump();
1750 //TObject *obj=key->ReadObj();
1751 TObject *obj=source->Get(pathnameinsource.c_str());
1752
1753 if (obj) {
1754 if (obj->IsA()->InheritsFrom("TDirectory") ) {
1755 // it's a subdirectory
1756
1757 if (m_log.level() <= MSG::DEBUG)
1758 m_log <<MSG::DEBUG << "Found subdirectory " << obj->GetName()
1759 << endmsg;
1760
1761 // create a new subdir of same name and title in the target file
1762 target->cd();
1763 TDirectory *newtargetdir =
1764 target->mkdir(obj->GetName(), obj->GetTitle() );
1765
1766 MergeRootFile(newtargetdir, source);
1767
1768 } else if (obj->IsA()->InheritsFrom("TTree")) {
1769 if (m_log.level() <= MSG::DEBUG)
1770 m_log <<MSG::DEBUG << "Found TTree " << obj->GetName() << endmsg;
1771 TTree *mytree=dynamic_cast<TTree*>(obj);
1772 int nentries=(int) mytree->GetEntries();
1773 mytree->SetBranchStatus("*",1);
1774
1775 if (m_log.level() <= MSG::DEBUG)
1776 m_log <<MSG::DEBUG << "Dumping TTree " << nentries <<" entries"
1777 << endmsg;
1778 //mytree->Print();
1779 //for (int ij=0; ij<nentries; ij++) {
1780 //m_log <<MSG::DEBUG << "Dumping TTree Show( " << ij <<" )"
1781 //<< endmsg;
1782 //mytree->Show(ij);
1783 //}
1784 target->cd();
1785 mytree->CloneTree();
1786
1787 //m_log <<MSG::DEBUG << "Writing TTree to target file: ( "
1788 //<< mycopiedtree->Write(key->GetName()) <<" ) bytes written"
1789 //<< endmsg;
1790
1791 } else {
1792 target->cd();
1793 obj->Write(key->GetName() );
1794 }
1795 }
1796
1797 } // while ( ( TKey *key = (TKey*)nextkey() ) )
1798
1799 // save modifications to target file
1800
1801 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MSG::DEBUG
Definition: IMessageSvc.h:18
std::string
STL class.
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
std::string::c_str
T c_str(T...args)
std::strstr
T strstr(T...args)
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::MergeRootFile
void MergeRootFile(TDirectory *target, TDirectory *source)
Definition: THistSvc.cpp:1730

void THistSvc::parseString | ( | const std::string & | id,
|  | std::string & | root,
|  | std::string & | rem
| ) |  | const
| private

Definition at line 1205 of file THistSvc.cpp.

1205 {
1206 auto pos = id.find("/");
1207
1208 if (pos == string::npos) {
1209 root.clear();
1210 rem = id;
1211 } else if (pos == 0) {
1212 parseString(id.substr(1),root,rem);
1213 } else {
1214 root = id.substr(0,pos);
1215 rem = id.substr(pos+1);
1216 }
1217
1218 }
THistSvc::parseString
void parseString(const std::string &id, std::string &root, std::string &rem) const
Definition: THistSvc.cpp:1205
std::string::clear
T clear(T...args)
std::string::substr
T substr(T...args)

StatusCode THistSvc::readHist | ( | const std::string & | name,
|  | TH1 *& | hist
| ) |  | const
| private

Definition at line 1133 of file THistSvc.cpp.

1133 {
1134 return readHist_i(id, hist);
1135 }
THistSvc::readHist_i
StatusCode readHist_i(const std::string &name, T *&hist) const
Definition: THistSvc.icc:242

StatusCode THistSvc::readHist | ( | const std::string & | name,
|  | TH2 *& | hist
| ) |  | const
| private

Definition at line 1140 of file THistSvc.cpp.

1140 {
1141 return readHist_i(id, hist);
1142 }
THistSvc::readHist_i
StatusCode readHist_i(const std::string &name, T *&hist) const
Definition: THistSvc.icc:242

StatusCode THistSvc::readHist | ( | const std::string & | name,
|  | TH3 *& | hist
| ) |  | const
| private

Definition at line 1147 of file THistSvc.cpp.

1147 {
1148 return readHist_i(id, hist);
1149 }
THistSvc::readHist_i
StatusCode readHist_i(const std::string &name, T *&hist) const
Definition: THistSvc.icc:242
template<typename T >

StatusCode THistSvc::readHist_i | ( | const std::string & | name,
|  | T *& | hist
| ) |  | const
| private

Definition at line 242 of file THistSvc.icc.

242 {
243
244 GlobalDirectoryRestore restore;
245
246 std::string idr(id);
247 removeDoubleSlash( idr );
248
249 std::string stream, rem, dir, fdir, bdir, fdir2;
250 TFile *file;
251
252 if (!findStream(idr, stream, rem, file) ) {
253 return StatusCode::FAILURE;
254 }
255
256 if ( !file ) {
257 m_log << MSG::ERROR << "no associated file found" << endmsg;
258 return StatusCode::FAILURE;
259 }
260
261 file->cd("/");
262
263 fdir = idr;
264 bdir = dirname(fdir);
265 fdir2 = fdir;
266 while ( (dir=dirname(fdir)) != "" ) {
267 if (! gDirectory->GetKey(dir.c_str())) {
268 m_log << MSG::ERROR << "Directory \"" << fdir2 << "\" doesnt exist in "
269 << file->GetName() << endmsg;
270 return StatusCode::FAILURE;
271 }
272 gDirectory->cd(dir.c_str());
273 }
274
275 TObject *to=nullptr;
276 gDirectory->GetObject(fdir.c_str(), to);
277
278 if ( !to ) {
279 m_log << MSG::ERROR << "Could not get obj \"" << fdir << "\" in "
280 << gDirectory->GetPath() << endmsg;
281 return StatusCode::FAILURE;
282 }
283
284
285
286 hist = dynamic_cast<T*>(to);
287 if ( !hist ) {
288 m_log << MSG::ERROR << "Could not convert \"" << idr << "\" to a "
289 << System::typeinfoName(typeid(*hist)) << " as is a "
290 << to->IsA()->GetName()
291 << endmsg;
292 return StatusCode::FAILURE;
293 }
294
295
296 if (m_log.level() <= MSG::DEBUG) {
297 m_log << MSG::DEBUG << "Read in " << hist->IsA()->GetName() << " \""
298 << hist->GetName() << "\" from file "
299 << file->GetName() << endmsg;
300 hist->Print();
301 }
302
303 return StatusCode::SUCCESS;
304
305 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
THistSvc::findStream
bool findStream(const std::string &name, std::string &root, std::string &rem, TFile *&file) const
Definition: THistSvc.cpp:1161
MSG::DEBUG
Definition: IMessageSvc.h:18
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
THistSvc::dirname
std::string dirname(std::string &dir) const
Definition: THistSvc.cpp:1684
StatusCode::SUCCESS
Definition: StatusCode.h:30
ana.file
list file
Definition: ana.py:160
GlobalDirectoryRestore
Definition: RConverter.h:16
std::string::c_str
T c_str(T...args)
MSG::ERROR
Definition: IMessageSvc.h:21
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::removeDoubleSlash
void removeDoubleSlash(std::string &) const
Definition: THistSvc.cpp:1720

StatusCode THistSvc::readTree | ( | const std::string & | name,
|  | TTree *& | hist
| ) |  | const
| private

Definition at line 1154 of file THistSvc.cpp.

1154 {
1155 return readHist_i(id, hist);
1156 }
THistSvc::readHist_i
StatusCode readHist_i(const std::string &name, T *&hist) const
Definition: THistSvc.icc:242

StatusCode THistSvc::regGraph | ( | const std::string & | name | ) |
| override

Definition at line 1024 of file THistSvc.cpp.

1024 {
1025 TGraph *hist = nullptr;
1026 return regHist_i(hist, id);
1027 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::regGraph | ( | const std::string & | name,
|  | TGraph * | hist
| ) |  |
| override

Definition at line 1032 of file THistSvc.cpp.

1032 {
1033 if ( strcmp(hist->GetName(),"Graph") == 0 ) {
1034
1035 std::string id2(id);
1036 string::size_type i = id2.rfind("/");
1037 if (i != string::npos) {
1038 id2.erase(0,i+1);
1039 }
1040
1041 m_log << MSG::INFO << "setting name of TGraph id: \"" << id << "\" to \""
1042 << id2 << "\" since it is unset" << endmsg;
1043 hist->SetName(id2.c_str());
1044 }
1045
1046 return regHist_i(hist, id);
1047 }
std::string
STL class.
std::strcmp
T strcmp(T...args)
std::list::erase
T erase(T...args)
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
MSG::INFO
Definition: IMessageSvc.h:19
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode THistSvc::regHist | ( | const std::string & | name | ) |
| override

Definition at line 974 of file THistSvc.cpp.

974 {
975
976 TH1 *hist = nullptr;
977 return regHist_i(hist, id);
978 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::regHist | ( | const std::string & | name,
|  | TH1 * | hist
| ) |  |
| override

Definition at line 983 of file THistSvc.cpp.

983 {
984 return regHist_i(hist, id);
985 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::regHist | ( | const std::string & | name,
|  | TH2 * | hist
| ) |  |
| override

Definition at line 990 of file THistSvc.cpp.

990 {
991 return regHist_i(hist, id);
992 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::regHist | ( | const std::string & | name,
|  | TH3 * | hist
| ) |  |
| override

Definition at line 997 of file THistSvc.cpp.

997 {
998 return regHist_i(hist, id);
999 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17
template<typename T >

StatusCode THistSvc::regHist_i | ( | T * | hist,
|  | const std::string & | name
| ) |  |
| private

Definition at line 17 of file THistSvc.icc.

17 {
18
19 GlobalDirectoryRestore restore;
20
21 std::string idr(id);
22 removeDoubleSlash( idr );
23
24 if (idr.find("/") == idr.length()) {
25 m_log << MSG::ERROR << "Badly formed identifier \"" << idr << "\": "
26 << "Must not end with a /" << endmsg;
27 return StatusCode::FAILURE;
28 }
29
30
31 TFile *f = nullptr;
32 std::string stream,rem;
33 if (!findStream(idr, stream, rem, f)) {
34 m_log << MSG::ERROR << "Could not register id: \"" << idr << "\""
35 << endmsg;
36 return StatusCode::FAILURE;
37 }
38
39 std::string uid = "/" + stream + "/" + rem;
40 auto itr = m_uids.find(uid);
41 if (itr != m_uids.end()) {
42 m_log << MSG::ERROR << "already registered an object with identifier \""
43 << idr << "\"" << endmsg;
44 return StatusCode::FAILURE;
45 }
46
47
48 bool temp = false;
49 if ( !f ) {
50 temp = true;
51 if (m_log.level() <= MSG::DEBUG)
52 m_log << MSG::DEBUG << "Historgram with id \"" << idr << "\" is temporary"
53 << endmsg;
54 }
55
56
57 TObject *to = nullptr;
58 THistID hid;
59
60 // check to see if this hist is to be read in;
61 if (!temp && m_files.find(stream)->second.second == READ) {
62
63 if (hist != 0) {
64 m_log << MSG::WARNING << "Registering id: \"" << idr
65 << "\" with non zero pointer!" << endmsg;
66 }
67
68 if (readHist_i(idr,hist).isFailure()) {
69 m_log << MSG::ERROR << "Unable to read in hist" << endmsg;
70 return StatusCode::FAILURE;
71 }
72 to = dynamic_cast<TObject*>(hist);
73 hid = THistID(uid,temp,to,f,m_files.find(stream)->second.second);
74
75 } else if (hist == 0) {
76 m_log << MSG::ERROR << "Unable to read in hist with id: \""
77 << idr << "\"" << endmsg;
78 return StatusCode::FAILURE;
79
80 } else {
81
82 to = dynamic_cast<TObject*>(hist);
83 if (to == 0) {
84 m_log << MSG::ERROR << "Could not dcast to TObject. id: \"" << idr
85 << "\"" << endmsg;
86 return StatusCode::FAILURE;
87 }
88
89 auto oitr = m_tobjs.find(to);
90 if (oitr != m_tobjs.end()) {
91 m_log << MSG::ERROR << "already registered id: \"" << idr
92 << "\" with identifier \"" << oitr->second.id << "\"" << endmsg;
93 return StatusCode::FAILURE;
94 }
95
96 hid = THistID(uid,temp,to,f,m_files.find(stream)->second.second);
97 TDirectory* dir = changeDir(hid);
98
99 if ( dynamic_cast<TTree*>(hist) ) {
100 dynamic_cast<TTree*>(hist)->SetDirectory(dir);
101 } else if ( dynamic_cast<TH1*>(hist) ) {
102 dynamic_cast<TH1*>(hist)->SetDirectory(dir);
103 } else if ( dynamic_cast<TGraph*>(hist) ) {
104 dir->Append(hist);
105 } else {
106 m_log << MSG::ERROR << "id: \"" << idr
107 << "\" is not a TH, TTree, or TGraph. Attaching it to current dir."
108 << endmsg;
109 dir->Append(hist);
110 }
111
112 }
113
114 std::string fname;
115 if ( !f ) {
116 fname = "none";
117 } else {
118 fname = f->GetName();
119 }
120
121 if (m_log.level() <= MSG::DEBUG)
122 m_log << MSG::DEBUG << "Registering " << System::typeinfoName(typeid(*hist))
123 << " title: \"" << hist->GetTitle()
124 << "\" id: \"" << uid << "\" dir: "
125 // << hist->GetDirectory()->GetPath() << " "
126 << changeDir(hid)->GetPath()
127 << " file: " << fname
128 << endmsg;
129
130 m_ids.emplace(rem, hid);
131 m_uids[uid] = hid;
132 m_tobjs[to] = hid;
133
134 return StatusCode::SUCCESS;
135
136 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
THistSvc::findStream
bool findStream(const std::string &name, std::string &root, std::string &rem, TFile *&file) const
Definition: THistSvc.cpp:1161
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
THistSvc::changeDir
TDirectory * changeDir(const THistSvc::THistID &hid) const
Definition: THistSvc.cpp:1655
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
THistSvc::m_tobjs
objMap m_tobjs
Definition: THistSvc.h:203
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
std::map::find
T find(T...args)
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
THistSvc::readHist_i
StatusCode readHist_i(const std::string &name, T *&hist) const
Definition: THistSvc.icc:242
GlobalDirectoryRestore
Definition: RConverter.h:16
std::multimap::emplace
T emplace(T...args)
THistSvc::READ
Definition: THistSvc.h:108
THistSvc::m_ids
idMap m_ids
Definition: THistSvc.h:202
MSG::ERROR
Definition: IMessageSvc.h:21
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::removeDoubleSlash
void removeDoubleSlash(std::string &) const
Definition: THistSvc.cpp:1720

StatusCode THistSvc::regTree | ( | const std::string & | name | ) |
| override

Definition at line 1004 of file THistSvc.cpp.

1004 {
1005 TTree *hist = nullptr;
1006 return regHist_i(hist, id);
1007 }
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::regTree | ( | const std::string & | name,
|  | TTree * | hist
| ) |  |
| override

Definition at line 1012 of file THistSvc.cpp.

1012 {
1013 StatusCode sc = regHist_i(hist, id);
1014 if (hist && sc.isSuccess()) {
1015 if (m_autoSave != 0) hist->SetAutoSave(m_autoSave);
1016 hist->SetAutoFlush(m_autoFlush);
1017 }
1018 return sc;
1019 }
THistSvc::m_autoFlush
IntegerProperty m_autoFlush
Definition: THistSvc.h:184
THistSvc::m_autoSave
IntegerProperty m_autoSave
Definition: THistSvc.h:184
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::regHist_i
StatusCode regHist_i(T *hist, const std::string &name)
Definition: THistSvc.icc:17

StatusCode THistSvc::reinitialize | ( |  | ) |
| override

Definition at line 230 of file THistSvc.cpp.

230 {
231
232 GlobalDirectoryRestore restore;
233 m_log << MSG::WARNING << "reinitialize not implemented" << endmsg;
234 return StatusCode::SUCCESS;
235
236 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
GlobalDirectoryRestore
Definition: RConverter.h:16
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void THistSvc::removeDoubleSlash | ( | std::string & | id | ) | const
| private

Definition at line 1720 of file THistSvc.cpp.

1720 {
1721
1722 while (id.find("//") != std::string::npos) {
1723 id.replace(id.find("//"),2,"/");
1724 }
1725
1726 }
std::find
T find(T...args)

StatusCode THistSvc::rootOpenAction | ( | FILEMGR_CALLBACK_ARGS |  | ) |
| private

Definition at line 2030 of file THistSvc.cpp.

2030 {
2031
2032 if (fa->tech() != Io::ROOT) {
2033 // This should never happen
2034 return StatusCode::SUCCESS;
2035 }
2036
2037 if (fa->desc() != "HIST") {
2038 return StatusCode::SUCCESS;
2039 }
2040
2041 p_incSvc->fireIncident(FileIncident(caller, "OpenHistFile", fa->name()));
2042
2043 if ( fa->flags().isRead() ) {
2044 p_incSvc->fireIncident(FileIncident(caller, "BeginHistFile", fa->name()));
2045 } else if ( fa->flags().isWrite() ) {
2046 p_incSvc->fireIncident(FileIncident(caller, IncidentType::BeginOutputFile,
2047 fa->name()));
2048 } else {
2049 // for Io::RW
2050 p_incSvc->fireIncident(FileIncident(caller, IncidentType::BeginOutputFile,
2051 fa->name()));
2052 }
2053
2054 return StatusCode::SUCCESS;
2055
2056
2057 }
FileIncident
This class is the FileIncident.
Definition: FileIncident.h:17
Io::ROOT
Definition: IFileMgr.h:153
THistSvc::p_incSvc
IIncidentSvc * p_incSvc
Definition: THistSvc.h:215
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode::SUCCESS
Definition: StatusCode.h:30

StatusCode THistSvc::rootOpenErrAction | ( | FILEMGR_CALLBACK_ARGS |  | ) |
| private

Definition at line 2062 of file THistSvc.cpp.

2062 {
2063
2064 if (fa->tech() != Io::ROOT) {
2065 // This should never happen
2066 return StatusCode::SUCCESS;
2067 }
2068
2069 if (fa->desc() != "HIST") {
2070 return StatusCode::SUCCESS;
2071 }
2072
2073 if ( fa->flags().isRead() ) {
2074 p_incSvc->fireIncident(FileIncident(caller, IncidentType::FailInputFile,
2075 fa->name()));
2076 } else if ( fa->flags().isWrite() ) {
2077 p_incSvc->fireIncident(FileIncident(caller, IncidentType::FailOutputFile,
2078 fa->name()));
2079 } else {
2080 // for Io::RW
2081 p_incSvc->fireIncident(FileIncident(caller, "FailRWFile", fa->name()));
2082 }
2083
2084 return StatusCode::SUCCESS;
2085 }
FileIncident
This class is the FileIncident.
Definition: FileIncident.h:17
Io::ROOT
Definition: IFileMgr.h:153
THistSvc::p_incSvc
IIncidentSvc * p_incSvc
Definition: THistSvc.h:215
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode::SUCCESS
Definition: StatusCode.h:30

void THistSvc::setupCompressionLevel | ( | Property & | cmp | ) |
| private

Definition at line 1223 of file THistSvc.cpp.

1224 {
1225
1226 m_log << MSG::WARNING << "\"CompressionLevel\" Property has been deprecated. "
1227 << "Set it via the \"CL=\" parameter in the \"Output\" Property"
1228 << endmsg;
1229
1230 }
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void THistSvc::setupInputFile | ( | Property & | inputfile | ) |
| private

call-back method to handle input stream property

Definition at line 1236 of file THistSvc.cpp.

1237 {
1238
1239 if (FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect ) {
1240
1241 m_log <<MSG::DEBUG << "Delaying connection of Input Files until Initialize"
1242 << ". now in " << FSMState()
1243 << endmsg;
1244
1245 m_delayConnect = true;
1246 } else {
1247
1248 m_log <<MSG::DEBUG << "Now connecting of Input Files"
1249 << endmsg;
1250
1251 StatusCode sc = StatusCode::SUCCESS;
1252
1253 for ( const auto& itr : m_inputfile.value() ) {
1254 if ( m_alreadyConnectedInFiles.end() !=
1255 m_alreadyConnectedInFiles.find( itr ) ) continue;
1256 if ( connect(itr).isFailure() ) {
1257 sc = StatusCode::FAILURE;
1258 } else {
1259 m_alreadyConnectedInFiles.insert( itr );
1260 }
1261
1262 }
1263
1264 if ( !sc.isSuccess() ) {
1265 throw GaudiException( "Problem connecting inputfile !!", name(),
1266 StatusCode::FAILURE );
1267 }
1268
1269 }
1270 }
THistSvc::m_delayConnect
bool m_delayConnect
Definition: THistSvc.h:211
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:57
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MSG::DEBUG
Definition: IMessageSvc.h:18
std::set::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
THistSvc::m_inputfile
StringArrayProperty m_inputfile
Definition: THistSvc.h:182
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_okToConnect
bool m_okToConnect
Definition: THistSvc.h:211
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
std::set::insert
T insert(T...args)
std::set::find
T find(T...args)
THistSvc::connect
StatusCode connect(const std::string &)
Definition: THistSvc.cpp:1431
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
THistSvc::m_alreadyConnectedInFiles
std::set< std::string > m_alreadyConnectedInFiles
list of already connected files.
Definition: THistSvc.h:189
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void THistSvc::setupOutputFile | ( | Property & | outputfile | ) |
| private

call-back method to handle output stream property

Definition at line 1275 of file THistSvc.cpp.

1276 {
1277 if (FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect) {
1278 m_log <<MSG::DEBUG << "Delaying connection of Input Files until Initialize"
1279 << ". now in " << FSMState()
1280 << endmsg;
1281 m_delayConnect = true;
1282 } else {
1283
1284 StatusCode sc = StatusCode::SUCCESS;
1285 for ( const auto & itr : m_outputfile.value() ) {
1286 if ( m_alreadyConnectedOutFiles.end() !=
1287 m_alreadyConnectedOutFiles.find( itr ) ) continue;
1288 if ( connect(itr).isFailure() ) {
1289 sc = StatusCode::FAILURE;
1290 } else {
1291 m_alreadyConnectedOutFiles.insert( itr );
1292 }
1293 }
1294
1295 if ( !sc.isSuccess() ) {
1296 throw GaudiException( "Problem connecting outputfile !!", name(),
1297 StatusCode::FAILURE );
1298 }
1299 }
1300 }
THistSvc::m_delayConnect
bool m_delayConnect
Definition: THistSvc.h:211
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:57
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MSG::DEBUG
Definition: IMessageSvc.h:18
std::set::end
T end(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
THistSvc::m_outputfile
StringArrayProperty m_outputfile
Definition: THistSvc.h:182
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
THistSvc::m_okToConnect
bool m_okToConnect
Definition: THistSvc.h:211
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
std::set::insert
T insert(T...args)
std::set::find
T find(T...args)
THistSvc::connect
StatusCode connect(const std::string &)
Definition: THistSvc.cpp:1431
THistSvc::m_alreadyConnectedOutFiles
std::set< std::string > m_alreadyConnectedOutFiles
list of already connected files.
Definition: THistSvc.h:193
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void THistSvc::updateFiles | ( |  | ) |
| private

Definition at line 1305 of file THistSvc.cpp.

1305 {
1306
1307 // If TTrees grow beyond TTree::fgMaxTreeSize, a new file is
1308 // automatically created by root, and the old one closed. We
1309 // need to migrate all the UIDs over to show the correct file
1310 // pointer. This is ugly.
1311
1312 if (m_log.level() <= MSG::DEBUG)
1313 m_log << MSG::DEBUG << "updateFiles()" << endmsg;
1314
1315
1316 for (auto uitr=m_uids.begin(); uitr != m_uids.end(); ++uitr) {
1317 #ifndef NDEBUG
1318 if (m_log.level() <= MSG::VERBOSE)
1319 m_log << MSG::VERBOSE << " update: " << uitr->first << " "
1320 << uitr->second.id << " " << uitr->second.mode << endmsg;
1321 #endif
1322 TObject* to = uitr->second.obj;
1323 TFile* oldFile = uitr->second.file;
1324 if (!to) {
1325 m_log << MSG::WARNING << uitr->first << ": TObject == 0" << endmsg;
1326 } else if ( uitr->second.temp || uitr->second.mode == READ ) {
1327 // do nothing - no need to check how big the file is since we
1328 // are just reading it.
1329 #ifndef NDEBUG
1330 if (m_log.level() <= MSG::VERBOSE)
1331 m_log << MSG::VERBOSE << " skipping" << endmsg;
1332 #endif
1333
1334 } else if (to->IsA()->InheritsFrom("TTree")) {
1335 TTree* tr = dynamic_cast<TTree*>(to);
1336 TFile* newFile = tr->GetCurrentFile();
1337
1338 if (oldFile != newFile) {
1339 std::string newFileName = newFile->GetName();
1340 std::string oldFileName, streamName, rem;
1341 TFile* dummy = nullptr;
1342 findStream(uitr->second.id, streamName, rem, dummy);
1343
1344 for (auto& itr : m_files ) {
1345 if (itr.second.first == oldFile) itr.second.first = newFile;
1346 }
1347
1348 for (auto uitr2 = uitr; uitr2 != m_uids.end(); ++uitr2) {
1349 if (uitr2->second.file == oldFile) {
1350 uitr2->second.file = newFile;
1351 }
1352 }
1353
1354 auto sitr = std::find_if( std::begin(m_fileStreams), std::end(m_fileStreams),
1355 [&](streamMap::const_reference s) {
1356 return s.second == streamName;
1357 });
1358 if (sitr!=std::end(m_fileStreams)) oldFileName = sitr->first;
1359
1360 #ifndef NDEBUG
1361 if (m_log.level() <= MSG::DEBUG)
1362 m_log << MSG::DEBUG << "migrating uid: " << uitr->second.id
1363 << " stream: " << streamName
1364 << " oldFile: " << oldFileName
1365 << " newFile: " << newFileName
1366 << endmsg;
1367 #endif
1368
1369
1370 if (!oldFileName.empty()) {
1371 auto i = m_fileStreams.lower_bound(oldFileName);
1372 while (i != std::end(m_fileStreams) && i->first == oldFileName) {
1373
1374 #ifndef NDEBUG
1375 if (m_log.level() <= MSG::DEBUG)
1376 m_log << MSG::DEBUG << "changing filename \"" << i->first
1377 << "\" to \"" << newFileName << "\" for stream \""
1378 << i->second << "\"" << endmsg;
1379 #endif
1380 std::string nm = std::move(i->second);
1381 i = m_fileStreams.erase(i);
1382 m_fileStreams.emplace( newFileName, std::move(nm) );
1383 }
1384
1385
1386 } else {
1387 m_log << MSG::ERROR
1388 << "Problems updating fileStreams with new file name" << endmsg;
1389 }
1390
1391 }
1392 }
1393 }
1394 }
std::string::empty
T empty(T...args)
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::findStream
bool findStream(const std::string &name, std::string &root, std::string &rem, TFile *&file) const
Definition: THistSvc.cpp:1161
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
std::multimap::lower_bound
T lower_bound(T...args)
MSG::VERBOSE
Definition: IMessageSvc.h:17
std::string
STL class.
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
std::multimap::erase
T erase(T...args)
std::move
T move(T...args)
Gaudi::Units::nm
constexpr double nm
Definition: SystemOfUnits.h:82
std::find_if
T find_if(T...args)
THistSvc::m_uids
uidMap m_uids
Definition: THistSvc.h:201
std::map::begin
T begin(T...args)
std::multimap::emplace
T emplace(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
THistSvc::READ
Definition: THistSvc.h:108
MSG::ERROR
Definition: IMessageSvc.h:21
MSG::WARNING
Definition: IMessageSvc.h:20
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::m_fileStreams
streamMap m_fileStreams
Definition: THistSvc.h:206

StatusCode THistSvc::write | ( |  | ) |
| private

Definition at line 1399 of file THistSvc.cpp.

1399 {
1400
1401 updateFiles();
1402
1403 std::for_each( m_files.begin(), m_files.end(), [](std::pair<const std::string,std::pair<TFile*,Mode>>& i) {
1404 auto mode = i.second.second;
1405 auto file = i.second.first;
1406 if ( mode == WRITE || mode == UPDATE || mode == SHARE ) {
1407 file->Write("",TObject::kOverwrite);
1408 } else if ( mode == APPEND ) {
1409 file->Write("");
1410 }
1411 } );
1412
1413 if (m_log.level() <= MSG::DEBUG) {
1414 m_log << MSG::DEBUG << "THistSvc::write()::List of Files connected in ROOT "
1415 << endmsg;
1416 TSeqCollection *filelist=gROOT->GetListOfFiles();
1417 for (int ii=0; ii<filelist->GetEntries(); ii++) {
1418 m_log << MSG::DEBUG
1419 << "THistSvc::write()::List of Files connected in ROOT: \""
1420 << filelist->At(ii)->GetName()<<"\""<<endmsg;
1421 }
1422 }
1423
1424 return StatusCode::SUCCESS;
1425
1426 }
MsgStream::level
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
THistSvc::APPEND
Definition: THistSvc.h:111
MSG::DEBUG
Definition: IMessageSvc.h:18
std::map::end
T end(T...args)
THistSvc::UPDATE
Definition: THistSvc.h:110
THistSvc::SHARE
Definition: THistSvc.h:112
StatusCode::SUCCESS
Definition: StatusCode.h:30
THistSvc::m_files
std::map< std::string, std::pair< TFile *, Mode > > m_files
Definition: THistSvc.h:205
ana.file
list file
Definition: ana.py:160
std::pair
std::map::begin
T begin(T...args)
THistSvc::m_log
MsgStream m_log
Definition: THistSvc.h:180
THistSvc::WRITE
Definition: THistSvc.h:109
std::for_each
T for_each(T...args)
ana.i
list i
Definition: ana.py:128
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
THistSvc::updateFiles
void updateFiles()
Definition: THistSvc.cpp:1305

## Member Data Documentation

std::set<std::string> THistSvc::m_alreadyConnectedInFiles
| private

list of already connected files.

This is to keep track of files registered by the setupInputFile callback method

Definition at line 189 of file THistSvc.h.

std::set<std::string> THistSvc::m_alreadyConnectedOutFiles
| private

list of already connected files.

This is to keep track of files registered by the setupOutputFile callback method

Definition at line 193 of file THistSvc.h.

IntegerProperty THistSvc::m_autoFlush
| private

Definition at line 184 of file THistSvc.h.

IntegerProperty THistSvc::m_autoSave
| private

Definition at line 184 of file THistSvc.h.

IntegerProperty THistSvc::m_compressionLevel
| private

Definition at line 184 of file THistSvc.h.

std::string THistSvc::m_curstream
| mutable private

Definition at line 213 of file THistSvc.h.

bool THistSvc::m_delayConnect = false
| private

Definition at line 211 of file THistSvc.h.

std::map<std::string, std::pair<TFile*,Mode> > THistSvc::m_files
| private

Definition at line 205 of file THistSvc.h.

streamMap THistSvc::m_fileStreams
| private

Definition at line 206 of file THistSvc.h.

idMap THistSvc::m_ids
| private

Definition at line 202 of file THistSvc.h.

StringArrayProperty THistSvc::m_inputfile
| private

Definition at line 182 of file THistSvc.h.

MsgStream THistSvc::m_log
| mutable private

Definition at line 180 of file THistSvc.h.

IntegerProperty THistSvc::m_maxFileSize
| private

Definition at line 184 of file THistSvc.h.

bool THistSvc::m_okToConnect = false
| private

Definition at line 211 of file THistSvc.h.

StringArrayProperty THistSvc::m_outputfile
| private

Definition at line 182 of file THistSvc.h.

BooleanProperty THistSvc::m_print
| private

Definition at line 185 of file THistSvc.h.

std::vector<std::string> THistSvc::m_Rstream
| private

Definition at line 183 of file THistSvc.h.

std::map<std::string, std::string > THistSvc::m_sharedFiles
| private

Definition at line 208 of file THistSvc.h.

objMap THistSvc::m_tobjs
| private

Definition at line 203 of file THistSvc.h.

uidMap THistSvc::m_uids
| private

Definition at line 201 of file THistSvc.h.

std::vector<std::string> THistSvc::m_Wstream
| private

Definition at line 183 of file THistSvc.h.

IFileMgr* THistSvc::p_fileMgr = nullptr
| private

Definition at line 216 of file THistSvc.h.

IIncidentSvc* THistSvc::p_incSvc = nullptr
| private

Definition at line 215 of file THistSvc.h.

bool THistSvc::signaledStop = false
| private

Definition at line 210 of file THistSvc.h.

The documentation for this class was generated from the following files:

- GaudiSvc/src/THistSvc/THistSvc.h
- GaudiSvc/src/THistSvc/THistSvc.cpp
- GaudiSvc/src/THistSvc/THistSvc.icc