ROOT Version: 6.14.02
Platform: Not Provided
Compiler: Not Provided
Hi, I have a source input file with two columns of data separated by white space (X Y). I want to graph all these points. I have a code, i trying to run it with macros but it doesn’t let me have a void function().
Here is my code:
#include <vector>
#include <iostream>
#include <fstream>
using std::cin;
using std::cout;
using std::endl;
//some ROOT includes
#include "TInterpreter.h"
#include "TROOT.h"
#include "TH1F.h"
#include "TH2S.h"
#include "TFile.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TVectorD.h"
#include "TGraph.h"
void readFile()
{
std::vector<Double_t> channel, activity;
ifstream inputFile;
inputFile.open("/Desktop/Channel2415.txt");
int line = 0;
while (!inputFile.eof())
{
inputFile >> channel.push_back(line);
inputFile >> activity.push_back(line);
++line;
}
auto Graph5 = new TCanvas("Graph","Channel Activity");
auto channelGraph = new TGraph(8256, channel.data(),activity.data());
channelGraph -> Draw();
Graph5 -> Draw();
inputFile.close();
} ```