ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BSFilePeeker Class Reference
Collaboration diagram for BSFilePeeker:

Public Member Functions

 BSFilePeeker (const std::string &filename)
 
const FileMetaDataget () const
 

Private Member Functions

bool extractValue (const std::string &source, const std::string &key, std::string &value)
 

Private Attributes

FileMetaData m_fmd
 

Detailed Description

Definition at line 13 of file BSFilePeeker.cxx.

Constructor & Destructor Documentation

◆ BSFilePeeker()

BSFilePeeker::BSFilePeeker ( const std::string &  filename)

Definition at line 41 of file BSFilePeeker.cxx.

41  {
42 
44  DataReader *pDR = pickDataReader(fName);
45 
46  if(!pDR) {
47  std::cerr << "Problem opening or reading the bytestream file "
48  << fName << std::endl;
49  return;
50  }
51 
52  if(!pDR->good()) {
53  std::cerr << "No events in file "<< fName << std::endl;
54  }
55 
56  m_fmd.m_runNumbers.insert(pDR->runNumber());
57  m_fmd.m_lbNumbers.insert(pDR->lumiblockNumber());
58  m_fmd.m_project=pDR->projectTag();
59  m_fmd.m_stream=pDR->stream();
60  m_fmd.m_nEvents=pDR->eventsInFile();
61  m_fmd.m_beamEnergy=pDR->beamEnergy()*1000;
62  m_fmd.m_guid=pDR->GUID();
63 
64  const unsigned bt=pDR->beamType();
65 
66  //Accoring to info from Rainer and Guiseppe the beam type is
67  //0: No beam
68  //1: protons
69  //2: ions
70  switch (bt) {
71  case 0:
72  m_fmd.m_beamType="cosmics";
73  break;
74  case 1:
75  case 2: //actally heavy-ion
76  m_fmd.m_beamType="collisions";
77  break;
78  default:
79  std::cerr << "WARNING: Unexpected beam type integer in BS file. Got " << bt << std::endl;
80  m_fmd.m_beamType="unknown";
81  }
82 
83 
84  m_fmd.m_isMC=false; //Generaly, BS-files are real data
85  const std::vector<std::string> fmds=pDR->freeMetaDataStrings();
86  std::string eventTypeMD;
87  for (const std::string& fm : fmds) {
88  extractValue(fm,"GeoAtlas",m_fmd.m_geoTag);
89  extractValue(fm,"IOVDbGlobalTag",m_fmd.m_condTag);
90  extractValue(fm,"Event type",eventTypeMD);
91  }
92 
93  if (eventTypeMD.find("is sim")!=std::string::npos) {
94  m_fmd.m_isMC=true; //This is a simulated bytestream file
95  }
96 
97 
98  m_fmd.m_valid=true;
99  delete pDR;
100 }

Member Function Documentation

◆ extractValue()

bool BSFilePeeker::extractValue ( const std::string &  source,
const std::string &  key,
std::string &  value 
)
private

Definition at line 29 of file BSFilePeeker.cxx.

29  {
30 
31  const size_t sep=source.find(':');
32  if (sep==std::string::npos || source.compare(0,sep,key)!=0) {
33  return false;
34  }
35  else {
36  value=source.substr(sep+1);
37  return true;
38  }
39 }

◆ get()

const FileMetaData& BSFilePeeker::get ( ) const
inline

Definition at line 18 of file BSFilePeeker.cxx.

18 {return m_fmd;}

Member Data Documentation

◆ m_fmd

FileMetaData BSFilePeeker::m_fmd
private

Definition at line 24 of file BSFilePeeker.cxx.


The documentation for this class was generated from the following file:
FileMetaData::m_lbNumbers
std::set< unsigned > m_lbNumbers
Definition: Tools/FilePeeker/src/FileMetaData.h:19
FileMetaData::m_isMC
bool m_isMC
Definition: Tools/FilePeeker/src/FileMetaData.h:37
FileMetaData::m_guid
std::string m_guid
Definition: Tools/FilePeeker/src/FileMetaData.h:28
rootconvert.fName
string fName
Definition: rootconvert.py:5
athena.value
value
Definition: athena.py:124
FileMetaData::m_beamType
std::string m_beamType
Definition: Tools/FilePeeker/src/FileMetaData.h:33
FileMetaData::m_beamEnergy
unsigned m_beamEnergy
Definition: Tools/FilePeeker/src/FileMetaData.h:32
FileMetaData::m_geoTag
std::string m_geoTag
Definition: Tools/FilePeeker/src/FileMetaData.h:25
FileMetaData::m_stream
std::string m_stream
Definition: Tools/FilePeeker/src/FileMetaData.h:22
grepfile.sep
sep
Definition: grepfile.py:38
BSFilePeeker::m_fmd
FileMetaData m_fmd
Definition: BSFilePeeker.cxx:24
FileMetaData::m_project
std::string m_project
Definition: Tools/FilePeeker/src/FileMetaData.h:21
FileMetaData::m_valid
bool m_valid
Definition: Tools/FilePeeker/src/FileMetaData.h:39
BSFilePeeker::extractValue
bool extractValue(const std::string &source, const std::string &key, std::string &value)
Definition: BSFilePeeker.cxx:29
FileMetaData::m_condTag
std::string m_condTag
Definition: Tools/FilePeeker/src/FileMetaData.h:24
copySelective.source
string source
Definition: copySelective.py:32
FileMetaData::m_fileName
std::string m_fileName
Definition: Tools/FilePeeker/src/FileMetaData.h:17
FileMetaData::m_runNumbers
std::set< unsigned > m_runNumbers
Definition: Tools/FilePeeker/src/FileMetaData.h:18
FileMetaData::m_nEvents
unsigned m_nEvents
Definition: Tools/FilePeeker/src/FileMetaData.h:30
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37