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 438 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 442 of file hcg.cxx.

442 :
443 m_name(n), m_file(f) {
444
446
447 std::cerr << "opening file " << f << std::endl;
448
449 TFile* r = TFile::Open(f.c_str());
450 if ( r==0 ) {
451 std::cerr << "cannot open root file " << f << std::endl;
452 std::exit(-1);
453 }
454
455 r->cd();
456
457 TList* tl = gDirectory->GetListOfKeys();
458
460
461 for ( int i=0 ; i<tl->GetSize() ; i++ ) {
462
463 TKey* tobj = (TKey*)tl->At(i);
464
465 if ( std::string(tobj->GetClassName()).find("TDirectory")!=std::string::npos ) {
466 // (*outp) << ns << "Directory " << tobj->GetName() << std::endl;
467
468 TDirectory* tnd = (TDirectory*)tobj->ReadObj();
469
470 std::string dir = tnd->GetName();
471
472 if ( contains( dir, "run_" ) ) {
473 dir.erase( 0, std::string( "run_").size() );
474 m_run = std::atoi( dir.c_str() );
475
476 break;
477 }
478
479 }
480 }
481
482 r->Close();
483 }
int m_run
Definition hcg.cxx:499
std::string m_name
Definition hcg.cxx:496
std::string m_file
Definition hcg.cxx:497
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:114

◆ reference() [2/2]

reference::reference ( const reference & r)
inline

Definition at line 486 of file hcg.cxx.

486: 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 490 of file hcg.cxx.

490{ return m_file; }

◆ name()

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

Definition at line 489 of file hcg.cxx.

489{ return m_name; }

◆ run()

int reference::run ( ) const
inline

Definition at line 492 of file hcg.cxx.

492{ return m_run; }

Member Data Documentation

◆ m_file

std::string reference::m_file
private

Definition at line 497 of file hcg.cxx.

◆ m_name

std::string reference::m_name
private

Definition at line 496 of file hcg.cxx.

◆ m_run

int reference::m_run {}
private

Definition at line 499 of file hcg.cxx.

499{};

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