35 for (
int i = 0; i < ndatapoints; ++i)
47 for (
int i = 0; i < int(bcdataset.
fBCDataVector->size()); ++i) {
63 for (
int i = 0; i < int(bcdataset.
fBCDataVector->size()); ++i) {
92 BCLog::OutError(
"BCDataSet::GetNValuesPerPoint : Data set doesn't exist yet");
111 BCLog::OutError(
"BCDataSet::GetDataPoint : Index out of range. Return 0.");
119 std::vector<double> components( N , 0.0 );
122 for (
unsigned int i = 0; i < N; ++i) {
125 components[i] = point->
GetValue(index);
138 TFile * file = TFile::Open(filename,
"READ");
143 BCLog::OutError(Form(
"BCDataSet::ReadDataFromFileTree : Could not open file %s.", filename));
148 TTree * tree = (TTree*) file->Get(treename);
153 BCLog::OutError(Form(
"BCDataSet::ReadDataFromFileTree : Could not find TTree %s.", treename));
166 BCLog::OutDetail(
"BCDataSet::ReadDataFromFileTree : Overwrite existing data.");
176 std::string branches(branchnames);
179 std::vector<std::string> * branchnamevector =
new std::vector<std::string>;
183 int temp_index = branches.find_first_of(
",");
189 while(branches.size() > 0)
192 std::string branchname;
197 if (temp_index == -1)
198 branchname = branches;
202 branchname.assign(branches, 0, temp_index);
205 branchnamevector->push_back(branchname);
213 if (temp_index == -1)
218 branches.erase(0, temp_index + 1);
221 temp_index = branches.find_first_of(
",");
225 std::vector<double> data;
226 data.assign(nbranches, 0.0);
229 for (
int i = 0; i < nbranches; i++)
230 tree->SetBranchAddress(branchnamevector->at(i).data(), &data.at(i));
233 int nentries = tree->GetEntries();
238 BCLog::OutError(Form(
"BCDataSet::ReadDataFromFileTree : No events in TTree %s.", treename));
247 for (
int ientry = 0; ientry < nentries; ientry++)
250 tree->GetEntry(ientry);
257 for (
int i = 0; i < nbranches; i++)
281 file.open(filename, std::fstream::in);
286 BCLog::OutError(Form(
"BCDataSet::ReadDataFromFileText : Could not open file %s.", filename));
295 BCLog::OutDetail(
"BCDataSet::ReadDataFromFileTxt : Overwrite existing data.");
303 std::vector<double> data;
304 data.assign(nbranches, 0.0);
314 while(file >> data[i])
327 for (
int i = 0; i < nbranches; i++)
341 BCLog::OutError(Form(
"BCDataSet::ReadDataFromFileText : No events in the file %s.", filename));
388 BCLog::OutError(
"BCDataSet::Dump : Data set is empty. Nothing to dump.");
398 for (
unsigned int j=0; j<n; j++)
399 BCLog::OutSummary(Form(
"%d : %12.5g", j,
GetDataPoint(i)->GetValue(j)));