ROOT Version: 6.14/06
Hi everyone!
I am quite new to Root and I am finding some difficulties in approaching the use of this tool in cluster computation. I work in the Virgo collaboration so I use the Cascina farm for the analysis.
In this macro I just want to plot the amplitude of the events vs time, so I read the data, put them in arrays and plot them. The problem is that the Draw() command does not produce anything!
Here is the code:
#include <stdio.h>
#include <algorithm>
#include <iostream>
void Test1(char *iFileName = (char*)"/data/dev/cbc2/O3-offline/MBTA_Results/chunk1/BBH/DATA-V4r29-repro/MbtaDat_WithExcessRate_WithFAR_Clustered-1238166000-34000.gwf", char *format = (char*)"png"){
char text[256];
double amplitude,L1_SNR, H1_SNR, time;
FrFile *iFile = FrFileINew(iFileName);
FrEvent *Events = FrEventReadTF1(iFile, (char*)"*", FrFileITStart(iFile), FrFileITEnd(iFile)-FrFileITStart(iFile), 0, (char*)"amplitude", 0, 1000);
FrEvent *eve = Events;
int nEve = 0;
//cout<<eve<<endl;
//cout<<iFile<<endl;
//cout<<nEve<<endl;
vector<double> amp;
vector<double> t;
int i =0;
while(eve){
nEve++;
//printf("Event #%d\n", nEve);
L1_SNR = FrEventGetParam(eve, (char*)"L1:SNR");
H1_SNR = FrEventGetParam(eve, (char*)"H1:SNR");
amplitude = sqrt(L1_SNR*L1_SNR + H1_SNR + H1_SNR);
time = FrEventGetParam(eve, (char*)"template duration");
//cout<<amplitude<<" "<<time<<endl;
amp.push_back(amplitude);
t.push_back(time);
eve=eve->next;
}
/*
for(int i=0; i<nEve; i++){
cout<<amp[i]<<endl;
cout<<t[i]<<endl;
}
*/
double amp1[nEve];
double t1[nEve];
for(int i =0; i<nEve; i++){
t1[i] = t[i];
amp1[i] = amp[i];
//cout<<i<<" "<<t1[i]<<" "<<amp1[i]<<endl;
}
//cout<<t.size()<<" "<<amp.size()<<endl;
TCanvas *c1 = new TCanvas("c1", "c1", 1500, 1500);
TGraph *gr1 = new TGraph(nEve, t1, amp1);
//gr1->Print();
c1->SetGrid();
gr1->Draw("AP");
}
The I call the root interpreter and run
root -b Test1.C
and my output is:
root [0]
Processing Test1.C...
root [1]
Where is my plot?
I would really appreciate any help thanks!