#include #include #include #include #include #include #include #include #include #include #include #include void graph2d() { TString filename; cout << " Select a ROOT file please : "; cin >> filename; TFile f(filename) ; TTree *T = HVtree ; TBranch *br ; struct thvinfo { int sts; float im,vm; time_t t; }; thvinfo info; time_t tfirst; T->SetBranchAddress("offset", &tfirst ); br = HVtree->GetBranch("offset"); br->GetEntry(0); TCanvas *c = new TCanvas("c","Current Distribution",50,50,900,700); TGraph2D *dt = new TGraph2D(); for (int mod = 0; mod < 320; mod++){ for (int ch = 0; ch < 16; ch++){ int index = mod*100 + ch; T->SetBranchAddress( Form( "channel_%d", index ), &info); br = HVtree->GetBranch( Form( "channel_%d", index) ); int n = br->GetEntries(); cout << "Module -----> " << mod << " Channel -----> " << ch << endl; vector Ivect; vector Tvect; for (int k=0 ; kGetEntry(k); Tvect.push_back(difftime((info.t),tfirst)); Ivect.push_back(info.im); } float* Current = new float[Ivect.size()]; float* TimeAxis = new float[Ivect.size()]; for (unsigned m=0 ; mSetPoint(index,TimeAxis,CH,Current); } } char datemp[100]; struct tm *ptm; ptm = localtime ( &tfirst ); strftime(datemp, 100, "%Y-%m-%d %H:%M:%S", ptm); TDatime da(datemp); gStyle->SetTimeOffset(da.Convert()); dt->Draw("surf1"); dt->GetXaxis()->SetTimeDisplay(1); c->Update(); } /* //Fill the 2D graph for (Int_t i=0; iSetPoint(i,x,y,z); } dt->Draw("surf1");*/