ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
WCSimASCIReader.cpp
Go to the documentation of this file.
1 #include "WCSimASCIReader.h"
2 
4 
5 
6 bool WCSimASCIReader::Initialise(std::string configfile, DataModel &data){
7 
8  if(configfile!="") m_variables.Initialise(configfile);
9  //m_variables.Print();
10 
11  m_data= &data;
12 
13  return true;
14 }
15 
16 
18 
19  std::string inputfile;
20  m_variables.Get("inputfile",inputfile);
21  std::string line;
22  std::ifstream data (inputfile.c_str());
23  if (data.is_open()){
24  std::vector<int>PMTid;
25  std::vector<float>time;
26  while ( getline (data,line) )
27  {
28  int tmpPMTid=0;
29  int tmptime=0;
30  std::stringstream tmp(line);
31  tmp >> tmpPMTid>>tmptime;
32  PMTid.push_back(tmpPMTid);
33  time.push_back(tmptime);
34 
35  }
36 
37  SubSample tmpsb(PMTid,time);
38  m_data->IDSamples.push_back(tmpsb);
39 
40  data.close();
41 
42  printf("qqq reader from file %s found %d \n", inputfile.c_str(), PMTid.size());
43 
44  }
45 
46  else {
47  std::cout << "Unable to open file";
48  return false;
49  }
50 
51  return true;
52 }
53 
54 
56 
57  return true;
58 }
bool Initialise(std::string configfile, DataModel &data)