#include "TROOT.h" #include "TSystem.h" #include "TStyle.h" #include "TPad.h" #include "TString.h" #include "TFile.h" #include "TSystem.h" #include "TImage.h" #include "TCanvas.h" #include "ROOT/TSeq.hxx" #include #include #include #include #include "Riostream.h" #include "TF1.h" #include "TH1.h" #include "TH2D.h" #include "TH2I.h" #include "TH3I.h" #include "TTree.h" #include "TLatex.h" #include "TLegend.h" #include "TProfile.h" #include "TGraphErrors.h" #include "TLatex.h" #include #include "TChain.h" using namespace std; static const int Nchan = 65; class HitClass : public TObject { public: double lead; double tot; int ch; }; class EvClass : public TObject { public: double xpos; double ypos; double reftime; double abstime; int noev; ULong64_t evnumtot; vector fHitArray; }; void xyplot(){ TString fname = "scanxy.root"; TTree *E; TFile *inFile = new TFile(fname, "read"); inFile->GetObject("E", E); E->SetImplicitMT(false); EvClass *fEvent = new EvClass; E->SetBranchAddress("fEvent",&fEvent); static Long64_t MaxEv = E->GetEntries(); cout << "Number of Entries = " << MaxEv << endl; char hist[1000]; char hist1[1000]; //Histogram definitions TH1I *time_raw[Nchan]; for(Int_t i=0;iSetXTitle("lead time [ns]"); time_raw[i]->SetYTitle("Counts"); } // Main Event Loop for (Long64_t ev = 0; ev < 100000000; ev++) { // cout << "Loop 1 Event " << ev << endl; E->GetEntry(ev); //Do some calculations and fill the histograms for (uint hit = 0; hit < fEvent->fHitArray.size(); hit++) { time_raw[fEvent->fHitArray[hit].ch]->Fill(fEvent->fHitArray[hit].lead * 1.e9 - fEvent->reftime * 1.e9); } } TFile *fout = new TFile("out.root","RECREATE"); fout->cd(); for (Int_t i = 0; i < Nchan; i++) time_raw[i]->Write(); fout->Close(); }