Hi,
When I try to run my script in root I get this error message:
fatal error: TLegend.h: No such file or directory #include “TLegend.h”
Can someone help me?
This is my code:
#include <iostream>
using namespace std;
#include <fstream>
#include <sstream>
#include "stdio.h"
#include <string>
#include <iomanip>
#include "TLegend.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TTree.h"
#include "TH1D.h"
#include "TLegend.h"
#include "TFile.h"
#include "TStyle.h"
#include "TRandom3.h"
#include "TDatime.h"
#include "TLine.h"
#include "TSystem.h"
#include "TString.h"
#include <TUUID.h>
#include "TLegend.h"
#include "TPaveStats.h"
#include "TFile.h"
#include "TF1.h"
#include "TFitResult.h"
#include "TLatex.h"
#include "TMath.h"
#include "TStopwatch.h"
#include "THStack.h"
#define TWOTHIRTYONE 2147483648 // 2^31
#define ROIS 4
#define MAXRONLINES 1000000
#define nentriesMAX 1000000
void MakeTree(
TString folder = "..",
TString listModePrefix= "MC2_019",
TString prefixPath = "",
double maxtime = 864000.,
double mintime = 0.
)
{
TString prefix = prefixPath + folder + "/";
TString input = prefix + listModePrefix;
double time, energy;
double lastTime = 0, totalTime = 0;
TString caenFileName = input + "_ch000.txt";
cout << caenFileName << endl;
TH1D* histo_raw = new TH1D("histo_raw", "Raw HPGe; Channels;Counts",
16384, 0, 16384);
char Line[200];
FILE* tempFile = fopen(caenFileName, "r");
//get rid of header
for (int i = 0; i < 4; i++) {
fgets(Line, 200, tempFile);
}
while (fgets(Line, 200, tempFile)) {
stringstream data;
data << Line;
data >> time >> energy;
if (time - lastTime < 0) {
totalTime += lastTime;
//cout << "2^32s reached" << endl;
}
lastTime = time;
if (energy > 0 && energy < 16384)
histo_raw->Fill(energy);
}
totalTime += lastTime;
fclose(tempFile);
caenFileName = input + "_ch002.txt";
cout << caenFileName << endl;
fopen(caenFileName,"r");
double current;
double totalCurrent = 0;
while (fgets(Line, 200, tempFile)) {
stringstream data;
data << Line;
data >> time >> current;
if (current > 0)
totalCurrent += current;
}
fclose(tempFile);
cout << "collected charge during this run was: " << totalCurrent*1.E-8/1.E-6 << " uC" << endl;
cout << "mean current during this run was: " << totalCurrent/totalTime/5.E8/1.E-8/1.E-6 << " uA" << endl;
cout << "runtime was " << totalTime/2.5E8/2. << " seconds" << endl;
TCanvas *c1 = new TCanvas("Raw_spectra","Raw specta, ",200,110,1200,700);
histo_raw->Draw();
}
Thank you.
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided