ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
dataset Class Reference

#include <dataset.h>

Inheritance diagram for dataset:
Collaboration diagram for dataset:

Public Member Functions

 dataset (const std::string &st)
 
 ~dataset ()
 
const std::string & directory () const
 
const std::vector< std::string > & datafiles ()
 

Public Attributes

elements
 STL member. More...
 

Private Attributes

std::string m_directory
 

Detailed Description

Definition at line 27 of file dataset.h.

Constructor & Destructor Documentation

◆ dataset()

dataset::dataset ( const std::string &  st)
inline

need to open on eos

eos.select no longer works

grrrr, the getenv actually crashes for some reason

Definition at line 31 of file dataset.h.

31  : m_directory(st) {
32  std::cout << "dataset::dataset() reading files from " << st << std::endl;
33 
34  std::string s = st;
35 
36  if ( s.find("root://eos")!=std::string::npos ) {
38 
40  // std::string xcmd = "/afs/cern.ch/project/eos/installation/0.3.84-aquamarine/bin/eos.select ls "+s+"/";
41  size_t pos=s.find("//");
42  while( pos!=std::string::npos ) {
43  s = s.substr(pos+1,s.length());
44  pos=s.find("//");
45  }
46  // std::string xcmd = "eos ls "+bases+"/";
47  std::string xcmd = "eos ls "+s+"/";
48  std::system( (xcmd+" > .eosfiles-$$.log").c_str() );
49 
50  std::string cmd = "export EOSFILES=$("+xcmd+")";
51  std::system( cmd.c_str() );
52 
53  std::ifstream infile(".eosfiles-$$.log");
54 
55  while( !infile.fail() ) {
56  std::string file;
57  infile >> file;
58  if ( !infile.fail() &&
59  file.find(".root")!=std::string::npos &&
60  file.find(".part")==std::string::npos &&
61  file.find(".bak")==std::string::npos &&
62  file.find(".skimmed")==std::string::npos ) push_back( s+"/"+file );
63  }
64 
65  // for ( unsigned i=size() ; i-- ; ) std::cout << at(i) << std::endl;
66 
68  // std::string files = std::getenv("EOSFILES");
69  // std::cout << "files " << files << std::endl;
70 
71  }
72  else {
73  DIR *dirp;
74  struct dirent *entry;
75 
76  if( ( dirp = opendir(s.c_str()) ) ) {
77  while( ( entry = readdir(dirp) ) ) {
78  std::string file = entry->d_name;
79  if ( file.find(".root")!=std::string::npos ) {
80  push_back( s+"/"+file );
81  // std::cout << " read file: " << entry->d_name << std::endl;
82  }
83  }
84  closedir(dirp);
85  }
86  std::cout << "dataset::dataset() " << size() << " files in dataset" << std::endl;
87  }
88  }

◆ ~dataset()

dataset::~dataset ( )
inline

Definition at line 90 of file dataset.h.

90 { }

Member Function Documentation

◆ datafiles()

const std::vector<std::string>& dataset::datafiles ( )
inline

Definition at line 94 of file dataset.h.

94 { return *this; }

◆ directory()

const std::string& dataset::directory ( ) const
inline

Definition at line 92 of file dataset.h.

92 { return m_directory; }

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.

◆ m_directory

std::string dataset::m_directory
private

Definition at line 98 of file dataset.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
run.infile
string infile
Definition: run.py:13
rerun_display.cmd
string cmd
Definition: rerun_display.py:67
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
file
TFile * file
Definition: tile_monitor.h:29
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
dataset::m_directory
std::string m_directory
Definition: dataset.h:98