Diana Software
QGFileHandler.cc
Go to the documentation of this file.
1 #include "QGFileHandler.hh"
2 #include <algorithm>
3 #include <iostream>
4 #include <map>
5 #include <string>
6 
7 #ifndef WIN32
8  #include <sys/types.h>
9  #include <sys/stat.h>
10  #include <unistd.h>
11 #endif
12 
13 #include "QBaseTree.hh"
14 #include "QChain.hh"
15 #include "QRawEvent.hh"
16 #include "QRunData.hh"
17 #include "QRunDataHandle.hh"
18 #include "QGDefaultsHandler.hh"
19 #include "QGTextFileHandler.hh"
20 #include <TAuthenticate.h>
21 #include <TCollection.h>
22 #include <TCut.h>
23 #include <TDirectory.h>
24 #include <TEventList.h>
25 #include <TFile.h>
26 #include <TGClient.h>
27 #include <TGFileDialog.h>
28 #include <TGInputDialog.h>
29 #include <TKey.h>
30 #include <TLeaf.h>
31 #include <TList.h>
32 #include <TString.h>
33 #include "QGlobalDataManager.hh"
34 #include "QVectorI.hh"
35 #include "TDataMember.h"
36 
38 
39 using std::cout;
40 using std::endl;
41 using std::flush;
42 using std::map;
43 using std::string;
44 using std::vector;
45 using std::pair;
46 using std::set;
47 using Diana::QVector;
48 using Diana::QVectorI;
49 
51  : fFile(0), fFileOpen(false), fHeader(0), fPulseInfo(0), fQChain(0)
52 {
53  fDefaultPulseLabel = "";
55  SetUpChain();
56  fDataManager = new Diana::QGlobalDataManager;
57  fDataManager->SetOwner("GUI");
58  fGenericObject = 0;
59 }
60 
62 {
63  if (fQChain) delete fQChain;
64 }
65 
67 {
68  bool foundModifiedFile = false;
69 
70 #ifndef WIN32
71  map<string, time_t>::const_iterator fileIter;
72  for (fileIter = fModificationTime.begin();
73  fileIter != fModificationTime.end() && foundModifiedFile == false;
74  ++fileIter) {
75  if (ModificationTime(fileIter->first) > fileIter->second) {
76  foundModifiedFile = true;
77  }
78  }
79  if (foundModifiedFile) {
80  cout << "Some open files were modified. Reopening files." << endl;
81  ReopenFiles();
82  }
83 #endif
84 
85  return foundModifiedFile;
86 }
87 
89 {
90  fFileOpen = false;
91  fFilenames.clear();
92  fModificationTime.clear();
93  if (fQChain) delete fQChain;
94  fQChain = 0;
95  fHeader = 0;
96  fPulseInfo = 0;
97 
98  fTreeClass = "";
99  SetUpChain();
101 }
102 
103 void QGFileHandler::GetEvent(const Long64_t eventNumber, const std::string& samplesname)
104 {
105  fQChain->GetEntry(eventNumber);
106 
107  TBranch* br = 0;
108  if(!samplesname.empty() && fQChain->FindBranch(samplesname.c_str())) {
109  std::string brname = samplesname;
110  br = fQChain->GetBranch(brname.c_str());
111  TLeaf* leaf = br->GetLeaf(brname.c_str());
112  if(leaf) {
113  const char* leafType = leaf->GetTypeName();
114  TClass thisClass(leafType);
115  bool isQVector = std::string("Diana::QVector") == thisClass.GetName();
116  bool isQVectorI = std::string("Diana::QVectorI") == thisClass.GetName();
117  bool isQPulse = std::string("QPulse") == thisClass.GetName();
118  if(isQVector) {
119  QVector* samples = 0;
120  fQChain->SetBranchAddress(samplesname.c_str(),&samples);
121  fQChain->GetEntry(eventNumber);
122  fSamples = *samples;
123  } else if(isQVectorI) {
124  QVectorI* samples = 0;
125  fQChain->SetBranchAddress(samplesname.c_str(),&samples);
126  fQChain->GetEntry(eventNumber);
127  fSamples = *samples;
128  } else if(isQPulse) {
129  QPulse* samples = 0;
130  fQChain->SetBranchAddress(samplesname.c_str(),&samples);
131  fQChain->GetEntry(eventNumber);
132  fSamples = samples->GetSamples();
133  } else {
134  fGenericObject = 0;
135  fQChain->SetBranchAddress(samplesname.c_str(),&fGenericObject);
136  fQChain->GetEntry(eventNumber);
137  }
138  } // leaf
139  }
140  if(br) fQChain->ResetBranchAddress(br);
141 }
142 
143 TEventList QGFileHandler::GetEventList(TCut cuts)
144 {
145  fQChain->Draw(">>eList", cuts, "goff same");
146  // FIX ME: this may create a TEntryList in future releases of ROOT
147  TEventList *eventListPtr = (TEventList*) gDirectory->Get("eList");
148  TEventList eventList = *eventListPtr;
149  eventList.SetName("eventList");
150  delete eventListPtr;
151  return eventList;
152 }
153 
154 const QSampleInfo& QGFileHandler::GetMasterSample(const Long64_t eventNumber) {
155  if(fPulseInfo) fPulseInfo->Clear();
156  GetEvent(eventNumber);
157  static QSampleInfo empty;
158  if (fPulseInfo) {
159  return fPulseInfo->GetMasterSample();
160  }
161  else {
162  return empty;
163  }
164 }
165 
166 const QVector& QGFileHandler::GetPulse(const Long64_t eventNumber, const std::string& samplesname)
167 {
168  fSamples.Clear();
169  GetEvent(eventNumber,samplesname);
170  return fSamples;
171 }
172 
173 TObject* QGFileHandler::GetGenericObject(const Long64_t eventNumber, const std::string& samplesname)
174 {
175  fGenericObject = 0;
176  GetEvent(eventNumber,samplesname);
177  return fGenericObject;
178 }
179 
180 
181 const vector<QSampleInfo>& QGFileHandler::GetSignificantSamples(
182  const Long64_t eventNumber)
183 {
184  if(fPulseInfo) fPulseInfo->Clear();
185  GetEvent(eventNumber);
186  static vector<QSampleInfo> empty;
187  if (fPulseInfo) {
188  return fPulseInfo->GetSamplesInfo();
189  }
190  else {
191  return empty;
192  }
193 }
194 
195 
196 const QRunData* QGFileHandler::GetRunData(const Long64_t eventNumber)
197 {
198  GetEvent(eventNumber);
199 
200  if (fHeader && fPulseInfo) {
201  const Int_t run = fHeader->GetRun();
202  // check if already taken for this run
203  QRunDataHandle rh(run);
204  fDataManager->Get("DAQ",&rh,"");
205  if(rh.IsValid()) return &rh.Get();
206  // not found, look in files
207  // clear cache
208  fDataManager->Clear();
209  fQChain->LoadTree(eventNumber);
210  TTree *tree = fQChain->GetTree();
211  if (tree) {
212  TDirectory *directory = tree->GetDirectory();
213  if (directory) {
214  fDataManager->Get("DAQ",&rh,directory->GetName());
215  }
216  if (!rh.IsValid()) {
217  // did not find run data in the file
218  // possibly because the file is not the first partial file
219  // try looking for run data in the first partial file
220  string currentFile = directory->GetName();
221  string firstPartial = currentFile;
222  firstPartial.replace(firstPartial.size() - 8, 3, "001");
223  fDataManager->Get("DAQ",&rh,firstPartial);
224  }
225  }
226  if(rh.IsValid()) return &(rh.Get());
227  }
228  return 0;
229 
230 
231 }
232 const QChannelRunData* QGFileHandler::GetChannelRunData(const Long64_t eventNumber)
233 {
234  const QRunData* runData = GetRunData(eventNumber);
235  if(!runData) return 0;
236  const Int_t chan = fPulseInfo->GetChannelId();
237  const QChannelRunData* chanRunData = 0;
238  try{
239  chanRunData = &runData->GetChannelRunData(chan);
240  }
241  catch(...) {
242  chanRunData = 0;
243  }
244  return chanRunData;
245 
246 }
247 
249  set<string> aliases;
250  if (fFileOpen) {
251  TList* aliasList = fQChain->GetListOfAllAliases();
252  if (aliasList) {
253  int N = aliasList->GetSize();
254  for (int i = 0; i < N; ++i) {
255  string alias
256  = aliasList->At(i)->GetName();
257  bool notSamples = (alias != "Samples");
258  if (notSamples) {
259  aliases.insert(alias);
260  }
261  }
262  }
263  if ( fQChain->GetListOfAliases() ) {
264  int N = fQChain->GetListOfAliases()->GetSize();
265  for (int i = 0; i < N; ++i) {
266  string alias = fQChain->GetListOfAliases()->At(i)->GetName();
267  aliases.insert(alias);
268  }
269  }
270  }
271  return aliases;
272 }
274 {
275  set<string> aliases;
276  return aliases;
277 }
278 
280  set<string> leaves;
281  if (fFileOpen) {
282  TObjArray* leafList = fQChain->GetListOfAllLeaves();
283  int N = leafList->GetSize();
284  for (int i = 0; i < N; ++i) {
285  TLeaf *leaf = (TLeaf*) leafList->At(i);
286  if (leaf) {
287  string type = leaf->GetTypeName();
288  string name = leaf->GetName();
289  bool numericType = fNumericTypes.count(type) > 0;
290  bool notfUniqueID = name.find(".fUniqueID") == string::npos;
291  bool notfBits = name.find(".fBits") == string::npos;
292  if (numericType && notfUniqueID && notfBits) {
293  leaves.insert(name);
294  }
295  }
296  }
297  }
298  return leaves;
299 }
300 
302  set<string> leaves;
303  if (fFileOpen) {
304  TObjArray* leafList = fQChain->GetListOfAllLeaves();
305  TIter next(leafList);
306  while(TLeaf* leaf = (TLeaf*)next()) {
307  if (leaf) {
308  string type = leaf->GetTypeName();
309  string name = leaf->GetName();
310  TClass thisClass(type.c_str(),kTRUE);
311  bool isQVector = std::string("Diana::QVector") == thisClass.GetName();
312  bool isQVectorI = std::string("Diana::QVectorI") == thisClass.GetName();
313  bool isQPulse = std::string("QPulse") == thisClass.GetName();
314  bool isQPulseC = std::string("QPulseC") == thisClass.GetName();
315  if (isQVector || isQVectorI || isQPulse || isQPulseC) {
316  leaves.insert(name);
317  }
318  }
319  }
320  leaves.insert(fDefaultPulseLabel);
321  }
322  return leaves;
323 }
324 
325 
326 
328 {
329  cout << endl << endl;
330  if (fFileOpen) {
331  if (fFilenames.size() == 1)
332  cout << "There is 1 open file:" << endl;
333  else
334  cout << "There are " << fFilenames.size() << " open files:" << endl;
335  for (unsigned int i = 0; i != fFilenames.size(); ++i) {
336  cout << fFilenames[i] << endl;
337  }
338  } else {
339  cout << "There are no open files." << endl;
340  }
341  cout << endl;
342 }
343 
344 #ifndef WIN32
345 time_t QGFileHandler::ModificationTime(const std::string& filename)
346 {
347  time_t mtime = 0;
348 
349  // create a file attribute structure
350  struct stat attrib;
351 
352  // get the attributes of filename
353  if (stat(filename.c_str(), &attrib) != -1) {
354  mtime = attrib.st_mtime;
355  }
356 
357  return mtime;
358 }
359 #endif
360 
362 {
364  TString dir(fDataDirectory.c_str());
365  TGFileInfo fi;
366  fi.fIniDir = StrDup(dir);
367  const char *filetypes[] = { "ROOT files", "*.root",
368  "File lists", "*.list",
369  0, 0 };
370  fi.fFileTypes = filetypes;
371  new TGFileDialog(gClient->GetRoot(), 0, kFDOpen, &fi);
372 
373  if (fi.fMultipleSelection) {
374  if (fi.fFileNamesList) {
375  int N = fi.fFileNamesList->GetEntries();
376  for (int i = 0; i < N; ++i) {
377  OpenFile(fi.fFileNamesList->At(i)->GetName());
378  }
379  }
380  }
381  else if (fi.fFilename) {
382  OpenFile(fi.fFilename);
383  }
384 
385  if (fi.fFilename || fi.fFileNamesList) {
386  string currentDirectory = fi.fIniDir;
387  if (currentDirectory != fDataDirectory) {
388  fDataDirectory = currentDirectory;
389  QGDefaultsHandler::Instance()->SetDataDirectory(currentDirectory);
390  }
391  }
392 }
393 
394 void QGFileHandler::OpenFile(string filename)
395 {
396  //cout << "Opening file " << filename << endl;
397 
398  string prefixRemovedFilename = filename;
399  if (prefixRemovedFilename.find(":\\") != string::npos) {
400  // filename begins with something like C:\ on Windows
401  // remove the C:
402  prefixRemovedFilename
403  = prefixRemovedFilename.substr(prefixRemovedFilename.find(":\\")
404  + 1);
405  }
406  if (prefixRemovedFilename.find("root://") == string::npos
407  && prefixRemovedFilename.find(':') != string::npos) {
408  string server
409  = prefixRemovedFilename.substr(0, prefixRemovedFilename.find(':'));
410  if (server.find_last_of("/\\") != string::npos) {
411  server = server.substr(server.find_last_of("/\\") + 1);
412  }
413  string file
414  = prefixRemovedFilename.substr(prefixRemovedFilename.find(':') + 1);
415  if (server == "corc") {
416  server = "corleone.roma1.infn.it";
417  file = "/data/dianadata/ntp_cuoricino/" + file;
418  }
419  else if (server == "apollo") {
420  server = "dianadaqha1.lngs.infn.it";
421  file = "/data/daq/rawdata/" + file;
422  }
423  filename = "root://" + server + '/' + file;
424  TAuthenticate::SetGlobalUser("diana");
425  static char* passwd = NULL;
426  if (!passwd) {
427  passwd = TAuthenticate::PromptPasswd("Password for user diana: ");
428  TAuthenticate::SetGlobalPasswd(passwd);
429  }
430  }
431  TString filenameTString(filename);
432  if (filenameTString.EndsWith(".list")) {
433  ParseFileList(filename);
434  } else if (filenameTString.EndsWith(".root")) {
435  // Check whether file is already open
436  bool alreadyOpen = (find(fFilenames.begin(), fFilenames.end(), filename)
437  != fFilenames.end());
438  if (alreadyOpen) {
439  cout << "Warning: The file " << filename
440  << " is already open and will not be added to the chain again."
441  << endl;
442  } else if (filename != "") {
443  fFile = TFile::Open(filename.c_str(), "READ");
444  if (!fFile || fFile->IsZombie()) { // failed to open file
445  cout << "File " << filename
446  << " does not appear to be a valid ROOT file." << endl;
447  }
448  else { // file opened successfully
449  // if the file contains a key named QTREE_NAME, try to use it
450  TKey *key = fFile->FindKey(QTREE_NAME);
451  if (!key) { // file does not contain a key called QTREE_NAME
452  // try to find the tree in the file
453  // if the file contains a unique tree, use it
454  // otherwise, prompt for the name of the tree
455  unsigned int numberOfTreesFound = 0;
456  TList *listOfKeys = fFile->GetListOfKeys();
457  TIter keyIter(listOfKeys);
458  while ( TKey *currentKey = dynamic_cast<TKey*>(keyIter()) ) {
459  if ( TObject *currentObj
460  = dynamic_cast<TObject*>(currentKey->ReadObj()) ) {
461  if (currentObj->InheritsFrom("TTree")) {
462  key = currentKey;
463  ++numberOfTreesFound;
464  }
465  }
466  }
467  if (numberOfTreesFound != 1) {
468  cout << "File " << filename
469  << " does not contain a tree named " << QTREE_NAME
470  << endl;
471  fFile->ls();
472  char treeName[80];
473  new TGInputDialog(gClient->GetRoot(), gClient->GetRoot(),
474  "Enter the name of the tree:", 0,
475  treeName);
476  key = fFile->FindKey(treeName);
477  }
478  }
479  if (key) {
480  string keyClass = key->GetClassName();
481  if (fFileOpen) {
482  if (keyClass == fTreeClass) {
483  if (fQChain->Add(filename.c_str())) {
484  fFilenames.push_back(filename);
485  fModificationTime[filename] = ModificationTime(filename);
486  SetLowestStartTimeUnix(key->GetName());
487  }
488  } else {
489  cout << "Tree class " << keyClass << " in file "
490  << filename
491  << " does not match existing tree class "
492  << fTreeClass
493  << ". "
494  << "The tree will not be added to the chain."
495  << endl;
496  }
497  } else if (fQChain->Add(filename.c_str())) {
498  fFilenames.push_back(filename);
499  fModificationTime[filename] = ModificationTime(filename);
500  fTreeClass = keyClass;
501  fFileOpen = true;
502  if (fTreeClass == "QTree"
503  || fTreeClass == "QiTree"
504  || fTreeClass == "QATree") {
505  // current diana
506  fQChain->SetBranchAddress("DAQ@Header.",&fHeader);
507  fQChain->SetBranchAddress("DAQ@PulseInfo.",&fPulseInfo);
508  if(fQChain->FindBranch("DAQ@Pulse.")) fDefaultPulseLabel = "DAQ@Pulse.";
509  const char* pulserPath = fQChain->GetAlias("IsHeater");
510  if(pulserPath) {
511  fQChain->SetAlias("IsPulser",pulserPath);
512  }
513  }
514  SetLowestStartTimeUnix(key->GetName());
515  }
516  } else {
517  cout << "The file " << filename
518  << " does not contain a tree with the given name."
519  << endl;
520  }
521  }
522  if (fFile) {
523  fFile->Close();
524  delete fFile;
525  fFile = 0;
526  }
527  }
528  }
529 }
530 
531 void QGFileHandler::OpenFiles(const std::vector<std::string>& files)
532 {
533  vector<string>::const_iterator fileIter;
534  for (fileIter = files.begin(); fileIter != files.end(); ++fileIter) {
535  OpenFile(*fileIter);
536  }
537 }
538 
539 void QGFileHandler::ParseFileList(const std::string& filename)
540 {
541  QGTextFileHandler textFileHandler;
542  if (textFileHandler.ReadFile(filename)) {
543  string dataPath;
544  if (textFileHandler.DoesKeyExist("DATAPATH")) {
545  dataPath = textFileHandler.GetValue("DATAPATH");
546 
547  // if dataPath does not end with a "/", append a "/"
548  if ( dataPath.rfind("/") + 1 != dataPath.size() ) {
549  dataPath = dataPath + "/";
550  }
551  }
552  else if ( filename.find_last_of("/\\") != std::string::npos ) {
553  dataPath
554  = filename.substr( 0, filename.find_last_of("/\\") + 1 );
555  // dataPath will end in a "/" or "\" unless the filename was given
556  // without a directory, in which case dataPath will be empty
557  }
558 
559  const vector<pair<string, string> >& lines = textFileHandler.GetLines();
560  vector<pair<string, string> >::const_iterator lineIter = lines.begin();
561  while (lineIter != lines.end() && lineIter->first != "START") {
562  ++lineIter;
563  }
564  ++lineIter;
565  while (lineIter != lines.end() && lineIter->first != "END") {
566  string dataFile = lineIter->first;
567  if (!dataFile.empty() && dataFile[0] != '#') {
568  OpenFile(dataPath + dataFile);
569  // dataPath already ends in "/" or is empty
570  }
571  ++lineIter;
572  }
573  }
574 }
575 
577 {
578  vector<string> filenames = fFilenames;
579  CloseFiles();
580  fDataManager->Clear();
582  OpenFiles(filenames);
583 }
584 
585 void QGFileHandler::SetLowestStartTimeUnix(const string& treeName)
586 {
587  if (fFile && !fFile->IsZombie()) {
588  const TKey* key = fFile->FindKey(treeName.c_str());
589  string treeClass = key->GetClassName();
590 
591  if (treeClass == "QTree"
592  || treeClass == "QiTree"
593  || treeClass == "QATree") {
594  TTree* tree = NULL;
595  fFile->GetObject(treeName.c_str(), tree);
596 
597  TObject* utv = fQChain->GetListOfAllAliases() ? fQChain->GetListOfAllAliases()->FindObject("StartRunUnixTime") : 0;
598  const char* unixTimeVar = utv ? utv->GetTitle() : "";
599  double minTime = tree->GetMinimum(unixTimeVar);
600  if (fFilenames.size() == 1 || minTime < fLowestStartTimeUnix) {
601  fQChain->SetAlias( "LowestStartRunUnixTime", Form("%.9g", minTime) );
602  fLowestStartTimeUnix = minTime;
603  }
604  }
605  }
606 }
607 
609 {
610  fQChain = new QChain();
611  fQChain->SetDirectory(0);
612 }
613 
615  fNumericTypes.insert("double");
616  fNumericTypes.insert("Double_t");
617  fNumericTypes.insert("Double32_t");
618  fNumericTypes.insert("float");
619  fNumericTypes.insert("Float_t");
620  fNumericTypes.insert("int");
621  fNumericTypes.insert("Int_t");
622  fNumericTypes.insert("UInt_t");
623  fNumericTypes.insert("long");
624  fNumericTypes.insert("Long64_t");
625  fNumericTypes.insert("ULong64_t");
626  fNumericTypes.insert("Short_t");
627  fNumericTypes.insert("UShort_t");
628  fNumericTypes.insert("bool");
629  fNumericTypes.insert("Bool_t");
630 }
int N
Definition: CheckOF.C:24
QChannelRunData chanRunData
#define QTREE_NAME
Definition: QBaseTree.hh:18
ClassImp(QObject)
TChain used in diana.
Definition: QChain.hh:23
TList * GetListOfAllAliases()
Definition: QChain.cc:148
Int_t Add(const char *filename, Long64_t nentries=kBigNumber)
Definition: QChain.cc:50
TObjArray * GetListOfAllLeaves()
Definition: QChain.cc:122
basic channel and run based info. Used in the QRunData object.
void SetDataDirectory(const std::string &directory)
Set data directory.
const std::string & GetDataDirectory()
Get data directory.
static QGDefaultsHandler * Instance()
Singleton.
Class to handle ROOT files.
time_t ModificationTime(const std::string &filename)
Return modification time of file.
Diana::QGlobalDataManager * fDataManager
std::set< std::string > GetSetOfQVectorAliases()
Get the aliases defined in the tree.
double fLowestStartTimeUnix
Lowest StartTimeUnix of open files.
std::set< std::string > GetSetOfLeaves()
Get the names of the leaves of the tree.
bool fFileOpen
File open flag.
Diana::QVector fSamples
samples (QVector or QVectorI or QPulse) to load
std::set< std::string > GetSetOfAliases()
Get the aliases defined in the tree.
const QRunData * GetRunData(const Long64_t eventNumber)
Get the run data for an event.
std::string fDataDirectory
Directory containing data files.
const QChannelRunData * GetChannelRunData(const Long64_t eventNumber)
Get the run data for an event.
const Diana::QVector & GetPulse(const Long64_t eventNumber, const std::string &samplesName)
Get the pulse of an event.
bool CheckForModifiedFiles()
Check whether any open file has been modified.
TEventList GetEventList(TCut cuts)
Get an event list containing the events passing a cut.
std::set< std::string > fNumericTypes
Collection of numeric data types.
void SetUpChain()
Set up the chain.
std::vector< std::string > fFilenames
Filenames.
QHeader * fHeader
QBaseEvent.
std::string fTreeClass
Name of tree's class.
void OpenFile()
Pop up a file open dialog.
TObject * GetGenericObject(const Long64_t eventNumber, const std::string &samplesName)
QPulseInfo * fPulseInfo
void ParseFileList(const std::string &filename)
Parse file list.
void ReopenFiles()
Reopen files.
void SetUpNumericTypes()
Specify the numeric data types.
QChain * fQChain
QChain.
std::set< std::string > GetSetOfQVectorLeaves()
Get the names of the leaves of the tree.
const std::vector< QSampleInfo > & GetSignificantSamples(const Long64_t eventNumber)
Get significant samples of an event.
std::string fDefaultPulseLabel
defalt label of samples to load
TObject * fGenericObject
const QSampleInfo & GetMasterSample(const Long64_t eventNumber)
Get master sample of an event.
void SetLowestStartTimeUnix(const std::string &treeName)
Set LowestStartTimeUnix alias.
void GetEvent(const Long64_t eventNumber, const std::string &samplesName="")
Get an event.
void ListOpenFiles()
Print a list of open files to the console.
virtual ~QGFileHandler()
Destructor.
std::map< std::string, time_t > fModificationTime
Modification times of every open file.
QGFileHandler()
Constructor.
void CloseFiles()
Close all open files, empty the chain.
void OpenFiles(const std::vector< std::string > &files)
Open files, add them to the chain.
TFile * fFile
ROOT file.
Class to handle input and output for text files.
const std::vector< std::pair< std::string, std::string > > & GetLines()
Get the lines of the file as key, value pairs.
std::string GetValue(std::string key)
Retrieve value associated with a key.
bool ReadFile(std::string filename)
Read file, returns true if successful.
bool DoesKeyExist(std::string key)
Return true if key exists.
static QGlobalReaderDispatcher & GetInstance()
int GetRun() const
destructor
Definition: QHeader.hh:22
const QSampleInfo & GetMasterSample() const
Get MasterSample.
Definition: QPulseInfo.hh:26
const std::vector< QSampleInfo > & GetSamplesInfo() const
Get Samples Info.
Definition: QPulseInfo.hh:31
void Clear()
Clear()
const int & GetChannelId() const
Get ChannelId.
Definition: QPulseInfo.hh:22
Raw event: sampled waveform.
Definition: QPulse.hh:22
const Diana::QVector & GetSamples() const
Get Samples casted to double (QVector instead of QVectorI). Use this method in place of GetSamplesADC...
Definition: QPulse.cc:49
global handle for QRunData
Basic run based info.
Definition: QRunData.hh:20
const QChannelRunData & GetChannelRunData(const int channel) const
get channel based run data quantities
Definition: QRunData.cc:339
contains information on flagged samples
Definition: QSampleInfo.hh:24
Interface for raw daq vectors in Diana.
Definition: QVectorI.hh:19
Interface for vectors in Diana analysis.
Definition: QVector.hh:30