Skip to content
Snippets Groups Projects
Commit 4e698e4e authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh Committed by Frank Winklmeier
Browse files

Protect DEBUG/VERBOSE messages

parent 815e0b15
No related branches found
No related tags found
1 merge request!1284THistSvc: cache TObject types
......@@ -121,7 +121,9 @@ StatusCode THistSvc::initialize() {
error() << "unable to get the FileMgr" << endmsg;
st = StatusCode::FAILURE;
} else {
debug() << "got the FileMgr" << endmsg;
if ( msgLevel( MSG::DEBUG) ) {
debug() << "got the FileMgr" << endmsg;
}
}
// Register open/close callback actions
......@@ -582,7 +584,10 @@ StatusCode THistSvc::deReg( const std::string& id ) {
}
vhid_t* vh = itr->second;
debug() << "will deregister " << vh->size() << " elements of id \"" << id << "\"" << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "will deregister " << vh->size() << " elements of id \"" << id << "\"" << endmsg;
}
StatusCode sc( StatusCode::SUCCESS );
// vh will get deleted in deReg once empty, so we cannot query the list size in the loop
size_t vh_size = vh->size();
......@@ -612,7 +617,9 @@ StatusCode THistSvc::deReg( TObject* obj ) {
if ( vhid->size() == 1 ) {
// We are the last object, so we have to delete vhid properly
debug() << "vhid for " << hid.id << " is empty. deleting" << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "vhid for " << hid.id << " is empty. deleting" << endmsg;
}
std::string root, rem;
parseString( hid.id, root, rem );
......
......@@ -37,7 +37,9 @@ StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::strin
// It is sad that we lose propper memory management here
T* hist = nullptr;
if ( hist_unique.get() != nullptr ) { hist = hist_unique.release(); }
debug() << "regHist_i obj: " << hist << " id: " << id << " s: " << shared << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "regHist_i obj: " << hist << " id: " << id << " s: " << shared << endmsg;
}
std::string idr( id );
removeDoubleSlash( idr );
......@@ -70,7 +72,9 @@ StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::strin
delete hist;
return StatusCode::FAILURE;
} else {
debug() << "previously registered id \"" << uid << "\": num " << uitr->second->size() << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "previously registered id \"" << uid << "\": num " << uitr->second->size() << endmsg;
}
}
}
......@@ -142,11 +146,13 @@ StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::strin
fname = f->GetName();
}
debug() << "Registering" << ( shared ? " shared " : " " ) << System::typeinfoName( typeid( *hist ) ) << " title: \""
<< hist->GetTitle() << "\" id: \"" << uid
<< "\" dir: "
// << hist->GetDirectory()->GetPath() << " "
<< changeDir( hid )->GetPath() << " file: " << fname << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "Registering" << ( shared ? " shared " : " " ) << System::typeinfoName( typeid( *hist ) ) << " title: \""
<< hist->GetTitle() << "\" id: \"" << uid
<< "\" dir: "
// << hist->GetDirectory()->GetPath() << " "
<< changeDir( hid )->GetPath() << " file: " << fname << endmsg;
}
// create a mutex for all shared histograms
if ( shared ) { hid.mutex = new histMut_t; }
......@@ -168,7 +174,7 @@ StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::strin
m_tobjs.emplace( to, std::pair<vhid_t*, size_t>( vi, 0 ) );
}
debug() << "regHist_i THistID: " << hid << endmsg;
if ( msgLevel( MSG::DEBUG ) ) { debug() << "regHist_i THistID: " << hid << endmsg;}
return StatusCode::SUCCESS;
}
......@@ -207,7 +213,9 @@ T* THistSvc::getHist_i( const std::string& id, const size_t& ind, bool quiet ) c
error() << "dcast failed, Hist id: \"" << id << "\"" << endmsg;
return nullptr;
}
verbose() << "found unique Hist title: \"" << hist->GetTitle() << "\" id: \"" << id << "\"" << endmsg;
if ( msgLevel( MSG::VERBOSE) ) {
verbose() << "found unique Hist title: \"" << hist->GetTitle() << "\" id: \"" << id << "\"" << endmsg;
}
}
return hist;
......@@ -318,7 +326,9 @@ LockedHandle<T> THistSvc::getShared_i( const std::string& name ) const {
T* h1 = dynamic_cast<T*>( hid->obj );
hist = LockedHandle<T>( h1, hid->mutex );
debug() << "getSharedHist: found THistID: " << *hid << endmsg;
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "getSharedHist: found THistID: " << *hid << endmsg;
}
} else if ( i == 0 ) {
error() << "no histograms matching id \"" << name << "\" found" << endmsg;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment