ATLAS Offline Software
Loading...
Searching...
No Matches
reference Class Reference
Collaboration diagram for reference:

Public Member Functions

 reference (const std::string &n, const std::string &f)
 reference (const reference &r)
const std::string & name () const
const std::string & file () const
int run () const

Private Attributes

std::string m_name
std::string m_file
int m_run {}

Detailed Description

Definition at line 440 of file hcg.cxx.

Constructor & Destructor Documentation

◆ reference() [1/2]

reference::reference ( const std::string & n,
const std::string & f )
inline

oh dear, find the run number from the specified file

go through sub directories

Definition at line 444 of file hcg.cxx.

444 :
445 m_name(n), m_file(f) {
446
448
449 std::cerr << "opening file " << f << std::endl;
450
451 TFile* r = TFile::Open(f.c_str());
452 if ( r==0 ) {
453 std::cerr << "cannot open root file " << f << std::endl;
454 std::exit(-1);
455 }
456
457 r->cd();
458
459 TList* tl = gDirectory->GetListOfKeys();
460
462 static const std::string runPrefix{"run_"};
463 for ( int i=0 ; i<tl->GetSize() ; i++ ) {
464
465 TKey* tobj = (TKey*)tl->At(i);
466
467 if ( std::string(tobj->GetClassName()).find("TDirectory")!=std::string::npos ) {
468 // (*outp) << ns << "Directory " << tobj->GetName() << std::endl;
469
470 TDirectory* tnd = (TDirectory*)tobj->ReadObj();
471
472 std::string dir = tnd->GetName();
473
474 if ( contains( dir, runPrefix ) ) {
475 dir.erase( 0, runPrefix.size() );
476 m_run = std::atoi( dir.c_str() );
477
478 break;
479 }
480
481 }
482 }
483
484 r->Close();
485 }
int m_run
Definition hcg.cxx:501
std::string m_name
Definition hcg.cxx:498
std::string m_file
Definition hcg.cxx:499
int r
Definition globals.cxx:22
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116

◆ reference() [2/2]

reference::reference ( const reference & r)
inline

Definition at line 488 of file hcg.cxx.

488: m_name(r.m_name), m_file(r.m_file), m_run(r.m_run) { }

Member Function Documentation

◆ file()

const std::string & reference::file ( ) const
inline

Definition at line 492 of file hcg.cxx.

492{ return m_file; }

◆ name()

const std::string & reference::name ( ) const
inline

Definition at line 491 of file hcg.cxx.

491{ return m_name; }

◆ run()

int reference::run ( ) const
inline

Definition at line 494 of file hcg.cxx.

494{ return m_run; }

Member Data Documentation

◆ m_file

std::string reference::m_file
private

Definition at line 499 of file hcg.cxx.

◆ m_name

std::string reference::m_name
private

Definition at line 498 of file hcg.cxx.

◆ m_run

int reference::m_run {}
private

Definition at line 501 of file hcg.cxx.

501{};

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