Skip to content
Snippets Groups Projects
Commit 4814ffcd authored by Mark Jones's avatar Mark Jones
Browse files

SAW changes

Updated REAdME
parent 09c9bd0f
Branches
Tags
No related merge requests found
online
*.o
*.d
*#
onlineDict.C
protorootfile ../../engine_comparison/hcana_replay/Rootfiles/replay_baryon_XXXXX.root
guicolor lightblue
canvassize 500 800
newpage 4 4
title HMS X1+ Raw TDCS
macro Macros/rawdraw.C("uh1x1postdc")
macro Macros/rawdraw.C("uh1x2postdc")
macro Macros/rawdraw.C("uh1x3postdc")
macro Macros/rawdraw.C("uh1x4postdc")
macro Macros/rawdraw.C("uh1x5postdc")
macro Macros/rawdraw.C("uh1x6postdc")
macro Macros/rawdraw.C("uh1x7postdc")
macro Macros/rawdraw.C("uh1x8postdc")
macro Macros/rawdraw.C("uh1x9postdc")
macro Macros/rawdraw.C("uh1x10postdc")
macro Macros/rawdraw.C("uh1x11postdc")
macro Macros/rawdraw.C("uh1x12postdc")
macro Macros/rawdraw.C("uh1x13postdc")
macro Macros/rawdraw.C("uh1x14postdc")
macro Macros/rawdraw.C("uh1x15postdc")
macro Macros/rawdraw.C("uh1x16postdc")
newpage 4 4
title HMS X1- Raw TDCS
macro Macros/rawdraw.C("uh1x1negtdc")
macro Macros/rawdraw.C("uh1x2negtdc")
macro Macros/rawdraw.C("uh1x3negtdc")
macro Macros/rawdraw.C("uh1x4negtdc")
macro Macros/rawdraw.C("uh1x5negtdc")
macro Macros/rawdraw.C("uh1x6negtdc")
macro Macros/rawdraw.C("uh1x7negtdc")
macro Macros/rawdraw.C("uh1x8negtdc")
macro Macros/rawdraw.C("uh1x9negtdc")
macro Macros/rawdraw.C("uh1x10negtdc")
macro Macros/rawdraw.C("uh1x11negtdc")
macro Macros/rawdraw.C("uh1x12negtdc")
macro Macros/rawdraw.C("uh1x13negtdc")
macro Macros/rawdraw.C("uh1x14negtdc")
macro Macros/rawdraw.C("uh1x15negtdc")
macro Macros/rawdraw.C("uh1x16negtdc")
newpage 4 4
title HMS X1+ Raw ADCS
macro Macros/rawdraw.C("uh1x1posadc")
macro Macros/rawdraw.C("uh1x2posadc")
macro Macros/rawdraw.C("uh1x3posadc")
macro Macros/rawdraw.C("uh1x4posadc")
macro Macros/rawdraw.C("uh1x5posadc")
macro Macros/rawdraw.C("uh1x6posadc")
macro Macros/rawdraw.C("uh1x7posadc")
macro Macros/rawdraw.C("uh1x8posadc")
macro Macros/rawdraw.C("uh1x9posadc")
macro Macros/rawdraw.C("uh1x10posadc")
macro Macros/rawdraw.C("uh1x11posadc")
macro Macros/rawdraw.C("uh1x12posadc")
macro Macros/rawdraw.C("uh1x13posadc")
macro Macros/rawdraw.C("uh1x14posadc")
macro Macros/rawdraw.C("uh1x15posadc")
macro Macros/rawdraw.C("uh1x16posadc")
newpage 4 4
title HMS X1- Raw ADCS
macro Macros/rawdraw.C("uh1x1negadc")
macro Macros/rawdraw.C("uh1x2negadc")
macro Macros/rawdraw.C("uh1x3negadc")
macro Macros/rawdraw.C("uh1x4negadc")
macro Macros/rawdraw.C("uh1x5negadc")
macro Macros/rawdraw.C("uh1x6negadc")
macro Macros/rawdraw.C("uh1x7negadc")
macro Macros/rawdraw.C("uh1x8negadc")
macro Macros/rawdraw.C("uh1x9negadc")
macro Macros/rawdraw.C("uh1x10negadc")
macro Macros/rawdraw.C("uh1x11negadc")
macro Macros/rawdraw.C("uh1x12negadc")
macro Macros/rawdraw.C("uh1x13negadc")
macro Macros/rawdraw.C("uh1x14negadc")
macro Macros/rawdraw.C("uh1x15negadc")
macro Macros/rawdraw.C("uh1x16negadc")
newpage 4 4
title HMS Y1+ Raw TDCS
macro Macros/rawdraw.C("uh1y1postdc")
macro Macros/rawdraw.C("uh1y2postdc")
macro Macros/rawdraw.C("uh1y3postdc")
macro Macros/rawdraw.C("uh1y4postdc")
macro Macros/rawdraw.C("uh1y5postdc")
macro Macros/rawdraw.C("uh1y6postdc")
macro Macros/rawdraw.C("uh1y7postdc")
macro Macros/rawdraw.C("uh1y8postdc")
macro Macros/rawdraw.C("uh1y9postdc")
macro Macros/rawdraw.C("uh1y10postdc")
newpage 4 4
title HMS Y1- Raw TDCS
macro Macros/rawdraw.C("uh1y1negtdc")
macro Macros/rawdraw.C("uh1y2negtdc")
macro Macros/rawdraw.C("uh1y3negtdc")
macro Macros/rawdraw.C("uh1y4negtdc")
macro Macros/rawdraw.C("uh1y5negtdc")
macro Macros/rawdraw.C("uh1y6negtdc")
macro Macros/rawdraw.C("uh1y7negtdc")
macro Macros/rawdraw.C("uh1y8negtdc")
macro Macros/rawdraw.C("uh1y9negtdc")
macro Macros/rawdraw.C("uh1y10negtdc")
newpage 4 4
title HMS Y1+ Raw ADCS
macro Macros/rawdraw.C("uh1y1posadc")
macro Macros/rawdraw.C("uh1y2posadc")
macro Macros/rawdraw.C("uh1y3posadc")
macro Macros/rawdraw.C("uh1y4posadc")
macro Macros/rawdraw.C("uh1y5posadc")
macro Macros/rawdraw.C("uh1y6posadc")
macro Macros/rawdraw.C("uh1y7posadc")
macro Macros/rawdraw.C("uh1y8posadc")
macro Macros/rawdraw.C("uh1y9posadc")
macro Macros/rawdraw.C("uh1y10posadc")
newpage 4 4
title HMS Y1- Raw ADCS
macro Macros/rawdraw.C("uh1y1negadc")
macro Macros/rawdraw.C("uh1y2negadc")
macro Macros/rawdraw.C("uh1y3negadc")
macro Macros/rawdraw.C("uh1y4negadc")
macro Macros/rawdraw.C("uh1y5negadc")
macro Macros/rawdraw.C("uh1y6negadc")
macro Macros/rawdraw.C("uh1y7negadc")
macro Macros/rawdraw.C("uh1y8negadc")
macro Macros/rawdraw.C("uh1y9negadc")
macro Macros/rawdraw.C("uh1y10negadc")
newpage 4 4
title HMS X2+ Raw TDCS
macro Macros/rawdraw.C("uh2x1postdc")
macro Macros/rawdraw.C("uh2x2postdc")
macro Macros/rawdraw.C("uh2x3postdc")
macro Macros/rawdraw.C("uh2x4postdc")
macro Macros/rawdraw.C("uh2x5postdc")
macro Macros/rawdraw.C("uh2x6postdc")
macro Macros/rawdraw.C("uh2x7postdc")
macro Macros/rawdraw.C("uh2x8postdc")
macro Macros/rawdraw.C("uh2x9postdc")
macro Macros/rawdraw.C("uh2x10postdc")
macro Macros/rawdraw.C("uh2x11postdc")
macro Macros/rawdraw.C("uh2x12postdc")
macro Macros/rawdraw.C("uh2x13postdc")
macro Macros/rawdraw.C("uh2x14postdc")
macro Macros/rawdraw.C("uh2x15postdc")
macro Macros/rawdraw.C("uh2x16postdc")
newpage 4 4
title HMS X2- Raw TDCS
macro Macros/rawdraw.C("uh2x1negtdc")
macro Macros/rawdraw.C("uh2x2negtdc")
macro Macros/rawdraw.C("uh2x3negtdc")
macro Macros/rawdraw.C("uh2x4negtdc")
macro Macros/rawdraw.C("uh2x5negtdc")
macro Macros/rawdraw.C("uh2x6negtdc")
macro Macros/rawdraw.C("uh2x7negtdc")
macro Macros/rawdraw.C("uh2x8negtdc")
macro Macros/rawdraw.C("uh2x9negtdc")
macro Macros/rawdraw.C("uh2x10negtdc")
macro Macros/rawdraw.C("uh2x11negtdc")
macro Macros/rawdraw.C("uh2x12negtdc")
macro Macros/rawdraw.C("uh2x13negtdc")
macro Macros/rawdraw.C("uh2x14negtdc")
macro Macros/rawdraw.C("uh2x15negtdc")
macro Macros/rawdraw.C("uh2x16negtdc")
newpage 4 4
title HMS X2+ Raw ADCS
macro Macros/rawdraw.C("uh2x1posadc")
macro Macros/rawdraw.C("uh2x2posadc")
macro Macros/rawdraw.C("uh2x3posadc")
macro Macros/rawdraw.C("uh2x4posadc")
macro Macros/rawdraw.C("uh2x5posadc")
macro Macros/rawdraw.C("uh2x6posadc")
macro Macros/rawdraw.C("uh2x7posadc")
macro Macros/rawdraw.C("uh2x8posadc")
macro Macros/rawdraw.C("uh2x9posadc")
macro Macros/rawdraw.C("uh2x10posadc")
macro Macros/rawdraw.C("uh2x11posadc")
macro Macros/rawdraw.C("uh2x12posadc")
macro Macros/rawdraw.C("uh2x13posadc")
macro Macros/rawdraw.C("uh2x14posadc")
macro Macros/rawdraw.C("uh2x15posadc")
macro Macros/rawdraw.C("uh2x16posadc")
newpage 4 4
title HMS X2- Raw ADCS
macro Macros/rawdraw.C("uh2x1negadc")
macro Macros/rawdraw.C("uh2x2negadc")
macro Macros/rawdraw.C("uh2x3negadc")
macro Macros/rawdraw.C("uh2x4negadc")
macro Macros/rawdraw.C("uh2x5negadc")
macro Macros/rawdraw.C("uh2x6negadc")
macro Macros/rawdraw.C("uh2x7negadc")
macro Macros/rawdraw.C("uh2x8negadc")
macro Macros/rawdraw.C("uh2x9negadc")
macro Macros/rawdraw.C("uh2x10negadc")
macro Macros/rawdraw.C("uh2x11negadc")
macro Macros/rawdraw.C("uh2x12negadc")
macro Macros/rawdraw.C("uh2x13negadc")
macro Macros/rawdraw.C("uh2x14negadc")
macro Macros/rawdraw.C("uh2x15negadc")
macro Macros/rawdraw.C("uh2x16negadc")
newpage 4 4
title HMS Y2+ Raw TDCS
macro Macros/rawdraw.C("uh2y1postdc")
macro Macros/rawdraw.C("uh2y2postdc")
macro Macros/rawdraw.C("uh2y3postdc")
macro Macros/rawdraw.C("uh2y4postdc")
macro Macros/rawdraw.C("uh2y5postdc")
macro Macros/rawdraw.C("uh2y6postdc")
macro Macros/rawdraw.C("uh2y7postdc")
macro Macros/rawdraw.C("uh2y8postdc")
macro Macros/rawdraw.C("uh2y9postdc")
macro Macros/rawdraw.C("uh2y10postdc")
newpage 4 4
title HMS Y2- Raw TDCS
macro Macros/rawdraw.C("uh2y1negtdc")
macro Macros/rawdraw.C("uh2y2negtdc")
macro Macros/rawdraw.C("uh2y3negtdc")
macro Macros/rawdraw.C("uh2y4negtdc")
macro Macros/rawdraw.C("uh2y5negtdc")
macro Macros/rawdraw.C("uh2y6negtdc")
macro Macros/rawdraw.C("uh2y7negtdc")
macro Macros/rawdraw.C("uh2y8negtdc")
macro Macros/rawdraw.C("uh2y9negtdc")
macro Macros/rawdraw.C("uh2y10negtdc")
newpage 4 4
title HMS Y2+ Raw ADCS
macro Macros/rawdraw.C("uh2y1posadc")
macro Macros/rawdraw.C("uh2y2posadc")
macro Macros/rawdraw.C("uh2y3posadc")
macro Macros/rawdraw.C("uh2y4posadc")
macro Macros/rawdraw.C("uh2y5posadc")
macro Macros/rawdraw.C("uh2y6posadc")
macro Macros/rawdraw.C("uh2y7posadc")
macro Macros/rawdraw.C("uh2y8posadc")
macro Macros/rawdraw.C("uh2y9posadc")
macro Macros/rawdraw.C("uh2y10posadc")
newpage 4 4
title HMS Y2- Raw ADCS
macro Macros/rawdraw.C("uh2y1negadc")
macro Macros/rawdraw.C("uh2y2negadc")
macro Macros/rawdraw.C("uh2y3negadc")
macro Macros/rawdraw.C("uh2y4negadc")
macro Macros/rawdraw.C("uh2y5negadc")
macro Macros/rawdraw.C("uh2y6negadc")
macro Macros/rawdraw.C("uh2y7negadc")
macro Macros/rawdraw.C("uh2y8negadc")
macro Macros/rawdraw.C("uh2y9negadc")
macro Macros/rawdraw.C("uh2y10negadc")
protorootfile ../../engine_comparison/hcana_replay/Rootfiles/replay_baryon_XXXXX.root
guicolor lightblue
canvassize 500 800
definecut thtarcut abs(H.tr.tg_th)<0.01
definecut phtarcut abs(H.tr.tg_ph)<0.01
definecut ytarcut abs(H.tr.tg_y)<4
definecut tarcut phtarcut&&thtarcut
newpage 2 2
title HMS focal plane/target
H.dc.x:H.dc.y -type scat
H.tr.tg_y ytarcut -title "Target Position"
RB.raster.frx:RB.raster.fry -type colz
H.tr.tg_ph:H.tr.tg_th phtarcut&&thtarcut -type colz -title "Target Xp vs Yp"
newpage 2 3
title HMS DC Wire Maps (Red=DC2)
macro Macros/overlay.C("hdc1x1_wm","hdc2x1_wm")
macro Macros/overlay.C("hdc1y1_wm","hdc2y1_wm")
macro Macros/overlay.C("hdc1u1_wm","hdc2u1_wm")
macro Macros/overlay.C("hdc1v1_wm","hdc2v1_wm")
macro Macros/overlay.C("hdc1y2_wm","hdc2y2_wm")
macro Macros/overlay.C("hdc1x2_wm","hdc2x2_wm")
newpage 2 3
title HDC1&2 drift distance (Red=DC2)
macro Macros/overlay.C("hdc1x1_dd","hdc2x1_dd")
macro Macros/overlay.C("hdc1y1_dd","hdc2y1_dd")
macro Macros/overlay.C("hdc1u1_dd","hdc2u1_dd")
macro Macros/overlay.C("hdc1v1_dd","hdc2v1_dd")
macro Macros/overlay.C("hdc1y2_dd","hdc2y2_dd")
macro Macros/overlay.C("hdc1x2_dd","hdc2x2_dd")
newpage 2 3
title HDC1&2 drift time (Red=DC2)
macro Macros/overlay.C("hdc1x1_dt","hdc2x1_dt")
macro Macros/overlay.C("hdc1y1_dt","hdc2y1_dt")
macro Macros/overlay.C("hdc1u1_dt","hdc2u1_dt")
macro Macros/overlay.C("hdc1v1_dt","hdc2v1_dt")
macro Macros/overlay.C("hdc1y2_dt","hdc2y2_dt")
macro Macros/overlay.C("hdc1x2_dt","hdc2x2_dt")
newpage 2 4
title HMS Hodo Hits
macro Macros/overlay.C("hpostdc1","hnegtdc1")
macro Macros/overlay.C("hposadc1","hnegadc1")
macro Macros/overlay.C("hpostdc2","hnegtdc2")
macro Macros/overlay.C("hposadc2","hnegadc2")
macro Macros/overlay.C("hpostdc3","hnegtdc3")
macro Macros/overlay.C("hposadc3","hnegadc3")
macro Macros/overlay.C("hpostdc4","hnegtdc4")
macro Macros/overlay.C("hposadc4","hnegadc4")
void overlay(TString hist1name, TString hist2name, Bool_t golden=false,TString samestr=""){
TH1F* H1;
TH1F* H2;
H1 = (TH1F*) gDirectory->Get(hist1name);
H2 = (TH1F*) gDirectory->Get(hist2name);
if (H1 && H2) {
if(golden){
H1->SetLineColor(30);
H1->SetFillColor(30);
H1->SetFillStyle(3027);
H2->SetLineColor(46);
H2->SetFillColor(46);
H2->SetFillStyle(3027);
} else {
H1->SetLineColor(4);
H2->SetLineColor(2);
}
if(golden){
if(!samestr.Contains("sames")) samestr += "sames";
H1->Draw(samestr);
H2->Draw(samestr);
} else {
if(!golden && !samestr.Contains("sames")){
// pick which hist to draw first:
if(H1->GetMaximum() > H2->GetMaximum()){
H1->Draw(samestr);
if(!samestr.Contains("sames")) samestr += "sames";
H2->Draw(samestr);
} else {
H2->Draw(samestr);
if(!samestr.Contains("sames")) samestr += "sames";
H1->Draw(samestr);
}
} else {
H1->Draw(samestr);
if(!samestr.Contains("sames")) samestr += "sames";
H2->Draw(samestr);
}
}
} else {
if (!H1) cout << " Histogram " << hist1name << " does not exist" << endl;
if (!H2) cout << " Histogram " << hist2name << " does not exist" << endl;
}
}
// UserScript.C
//
// Helper macro to build additional histograms
#define NPLANES 4
#define NSIDES 2
#define NSIGNALS 2
#define MAXBARS 16
void UserScript()
{
TString SPECTROMETER="H";
TString DETECTOR="hod";
TString plane_names[NPLANES]={"1x","1y","2x","2y"};
Int_t nbars[NPLANES]={16,10,16,10};
TString sides[NSIDES]={"neg","pos"};
TString signals[NSIGNALS]={"adc","tdc"};
Double_t ADC_MIN=0.0;
Double_t ADC_MAX=4000.0;
Int_t ADC_NBINS=200;
Double_t TDC_MIN=0.0;
Double_t TDC_MAX=4000.0;
Int_t TDC_NBINS=200;
Int_t nhits[NPLANES][NSIDES][NSIGNALS];
Double_t paddles[NPLANES][NSIDES][NSIGNALS][MAXBARS];
Double_t values[NPLANES][NSIDES][NSIGNALS][MAXBARS];
TH1F* h[NPLANES*NSIDES*NSIGNALS*MAXBARS];
TTree *T=(TTree*)gDirectory->Get("T");
for(Int_t ip=0;ip<NPLANES;ip++){
for(Int_t iside=0;iside<NSIDES;iside++) {
for(Int_t isignal=0;isignal<NSIGNALS;isignal++) {
TString base_name = SPECTROMETER+"."+DETECTOR+"."+
plane_names[ip]+"."+sides[iside]+signals[isignal];
TString ndata_name = "Ndata."+base_name+"pad";
TString padlist_name = base_name+"pad";
TString vallist_name = base_name+"val";
// Set branch addresses
T->SetBranchAddress(ndata_name, &nhits[ip][iside][isignal]);
T->SetBranchAddress(padlist_name, &paddles[ip][iside][isignal][0]);
T->SetBranchAddress(vallist_name, &values[ip][iside][isignal][0]);
// Create histograms
// ADC and TDC histogram for each
Int_t nbins,hmin,hmax;
if(signals[isignal]=="adc") {
nbins = ADC_NBINS;
hmin = ADC_MIN;
hmax = ADC_MAX;
} else {
nbins = TDC_NBINS;
hmin = TDC_MIN;
hmax = TDC_MAX;
}
// hfile.cd();
for(Int_t ibar=0;ibar<nbars[ip];ibar++) {
Int_t hindex = ip*NSIDES*NSIGNALS*MAXBARS
+iside*NSIGNALS*MAXBARS+isignal*MAXBARS+ibar;
TString ibarname=Form("%d",ibar+1);
TString title= "hS"+plane_names[ip]+ibarname+sides[iside]
+" "+signals[isignal];
TString name="uh"+plane_names[ip]+ibarname+sides[iside]+
signals[isignal];
// cout << name << " " << title << " " << nbins << " " << hmin << " "
// << hmax << endl;
h[hindex]=new TH1F(name,title,nbins, hmin, hmax);
}
// file.cd();
}
}
}
// Loop over the events, filling the histograms
for(Int_t iev=0, N=T->GetEntries(); iev < N; iev++) {
T->GetEntry(iev);
for(Int_t ip=0;ip<NPLANES;ip++){
for(Int_t iside=0;iside<NSIDES;iside++) {
for(Int_t isignal=0;isignal<NSIGNALS;isignal++) {
Int_t hindex_base = ip*NSIDES*NSIGNALS*MAXBARS
+iside*NSIGNALS*MAXBARS+isignal*MAXBARS;
for(Int_t ihit=0;ihit<nhits[ip][iside][isignal];ihit++) {
Int_t ibar=TMath::Nint(paddles[ip][iside][isignal][ihit])-1;
Double_t val = values[ip][iside][isignal][ihit];
Int_t hindex = hindex_base + ibar;
// cout << ip << " " << iside << " " << isignal << " " << ihit
// << " " << ibar << " " << hindex << endl;
h[hindex]->Fill(val);
}
}
}
}
// Display or save the histograms
}
return;
}
void rawdraw(TString histname) {
TH1F* h;
h = (TH1F*) gDirectory->Get(histname);
if(!h) {
UserScript();
h = (TH1F*) gDirectory->Get(histname);
if(!h) {
cout << "User histogram " << histname << " not found" << endl;
exit(1);
}
}
h->Draw();
}
onlineGUI
============================================
This is the GUI that is used in Hall A for the monitoring of online replay.
Directory structure
----------------------
* Config : directory with the onlineGUI configuration files
* Macros : directory with root macros that can be called by the onlineGUI code
* Files in Macro:
* overlay.C (script to overlay 2 histograms)
* rawdraw.C (script to plot the individual TDc and ADC for HMS hodoscope using the tree. Good example for other scripts)
* onlineGUI_v1.2.1: directory with the online.c and other files.
Compiling code
----------------------
* In onlineGUI_v1.2.1 directory type: make
* executable "online" is created in the onlineGUI directory
Documentation and Running the code
----------------
* The pdf file guiHOWTO2007.pdf documents how to use the code
* One method to run the code is:
* online -f Config/hmsdc.cfg -r 60
* "60" is the run number
* This assumes that hmsdc.cfg as a line such as:protorootfile ../ROOTfiles/hms1190_XXXXX.root
File deleted
This diff is collapsed.
///////////////////////////////////////////////////////////////////
// Macro to help with online analysis
// B. Moffit (moffit@jlab.org)
// - Originally written in Oct. 2003
// Documentation and updates available at:
// http://www.jlab.org/~moffit/onlineGUI/
//
#include <TTree.h>
#include <TFile.h>
#include <TGButton.h>
#include <TGFrame.h>
#include <TRootEmbeddedCanvas.h>
#include "TGLabel.h"
#include "TGString.h"
#include <RQ_OBJECT.h>
#include <TQObject.h>
#include <vector>
#include <TString.h>
#include <TCut.h>
#include <TTimer.h>
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#define UPDATETIME 2000
using namespace std;
/* TTree *raw; */
/* TFile *file; */
struct fileObject {
TString name;
TString title;
TString type;
TString directory;
};
struct RootFileObject {
TFile* RootFile;
vector <TTree*> RootTree;
vector <Int_t> TreeEntries;
vector < vector <TString> > TreeVars;
Bool_t fUpdate;
TH1D *mytemp1d;
TH2D *mytemp2d;
TH3D *mytemp3d;
vector <fileObject> vfileObjects;
};
struct drawcommand {
TString variable;
TString cut;
TString type;
TString title;
TString treename;
TString nostat;
TString noshowgolden;
TString macro;
TString directory;
TString objname;
TString objtype;
TString objtitle;
};
class OnlineConfig {
RQ_OBJECT("OnlineConfig");
// Class that takes care of the config file
private:
TString confFileName; // config filename
ifstream *fConfFile; // original config file
void ParseFile();
vector < vector <TString> > sConfFile; // the config file, in memory
// pageInfo is the vector of the pages containing the sConfFile index
// and how many commands issued within that page (title, 1d, etc.)
TString rootfilename; // Just the name
TString goldenrootfilename; // Golden rootfile for comparisons
TString protorootfile; // Prototype for getting the rootfilename
TString guicolor; // User's choice of background color
TString plotsdir; // Where to store sample plots.. automatically stored as .jpg's).
vector < pair <UInt_t,UInt_t> > pageInfo;
vector <TCut> cutList;
vector <UInt_t> GetDrawIndex(UInt_t);
Bool_t fFoundCfg;
Bool_t fMonitor;
Bool_t ParseForMultiPlots();
public:
OnlineConfig();
OnlineConfig(TString);
Bool_t ParseConfig();
TString GetRootFile() { return rootfilename; };
TString GetGoldenFile() { return goldenrootfilename; };
TString GetGuiColor() { return guicolor; };
TString GetPlotsDir() { return plotsdir; };
TCut GetDefinedCut(TString ident);
vector <TString> GetCutIdent();
// Page utilites
UInt_t GetPageCount() { return pageInfo.size(); };
pair <UInt_t,UInt_t> GetPageDim(UInt_t);
Bool_t IsLogx(UInt_t page);
Bool_t IsLogy(UInt_t page);
Bool_t IsLogz(UInt_t page);
TString GetPageTitle(UInt_t);
UInt_t GetDrawCount(UInt_t); // Number of histograms in a page
drawcommand GetDrawCommand(UInt_t,UInt_t);
vector <TString> SplitString(TString,TString);
void OverrideRootFile(UInt_t);
Bool_t IsMonitor() { return fMonitor; };
};
class OnlineGUI {
// Class that takes care of the GUI
RQ_OBJECT("OnlineGUI")
private:
//UInt_t fRunNum;
TGMainFrame *fMain;
TGHorizontalFrame *fTopframe;
TGVerticalFrame *vframe;
TGRadioButton *fRadioPage[50];
TGPictureButton *wile;
TRootEmbeddedCanvas *fEcanvas;
TGHorizontalFrame *fBottomFrame;
TGHorizontalFrame *hframe;
TGTextButton *fNext;
TGTextButton *fPrev;
TGTextButton *fExit;
TGLabel *fRunNumber;
TGTextButton *fPrint;
TCanvas *fCanvas; // Present Embedded canvas
OnlineConfig *fConfig;
UInt_t current_page;
RootFileObject fRootFile;
RootFileObject fGoldenFile;
Bool_t doGolden;
UInt_t runNumber;
TTimer *timer;
Bool_t fPrintOnly;
Bool_t fFileAlive;
public:
OnlineGUI(OnlineConfig&,Bool_t,UInt_t RunNum=0);
void CreateGUI(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~OnlineGUI();
void DoDraw();
void DrawPrev();
void DrawNext();
void DoRadio();
void CheckPageButtons();
// Specific Draw Methods
void GetFileObjects(RootFileObject *r);
void GetTreeVars(RootFileObject *r);
void GetRootTree(RootFileObject *r);
UInt_t GetTreeIndex(TString,RootFileObject *r);
UInt_t GetTreeIndexFromName(TString, RootFileObject *r);
drawcommand fileObject2command(drawcommand,RootFileObject *r);
void TreeDraw(drawcommand);
void HistDraw(drawcommand);
void MacroDraw(drawcommand);
void CanvasDraw(drawcommand,UInt_t);
void GraphDraw(drawcommand);
void DoDrawClear(RootFileObject *r);
void TimerUpdate();
void BadDraw(TString);
void CheckRootFile();
Int_t OpenRootFile();
void ObtainRunNumber();
void PrintToFile();
void PrintPages();
void MyCloseWindow();
void CloseGUI();
};
///////////////////////////////////////////////////////////////////
// Macro to help with online analysis
// B. Moffit (moffit@jlab.org)
// - Originally written in Oct. 2003
// Documentation and updates available at:
// http://www.jlab.org/~moffit/onlineGUI/
//
#include <TTree.h>
#include <TFile.h>
#include <TGButton.h>
#include <TGFrame.h>
#include <TRootEmbeddedCanvas.h>
#include "TGLabel.h"
#include "TGString.h"
#include <RQ_OBJECT.h>
#include <TQObject.h>
#include <vector>
#include <TString.h>
#include <TCut.h>
#include <TTimer.h>
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#define UPDATETIME 2000
using namespace std;
/* TTree *raw; */
/* TFile *file; */
struct fileObject {
TString name;
TString title;
TString type;
TString directory;
};
struct RootFileObject {
TFile* RootFile;
vector <TTree*> RootTree;
vector <Int_t> TreeEntries;
vector < vector <TString> > TreeVars;
Bool_t fUpdate;
TH1D *mytemp1d;
TH2D *mytemp2d;
TH3D *mytemp3d;
vector <fileObject> vfileObjects;
};
struct drawcommand {
TString variable;
TString cut;
TString type;
TString title;
TString treename;
TString nostat;
TString noshowgolden;
TString macro;
TString directory;
TString objname;
TString objtype;
TString objtitle;
};
class OnlineConfig {
RQ_OBJECT("OnlineConfig");
// Class that takes care of the config file
private:
TString confFileName; // config filename
ifstream *fConfFile; // original config file
void ParseFile();
vector < vector <TString> > sConfFile; // the config file, in memory
// pageInfo is the vector of the pages containing the sConfFile index
// and how many commands issued within that page (title, 1d, etc.)
TString rootfilename; // Just the name
TString goldenrootfilename; // Golden rootfile for comparisons
TString protorootfile; // Prototype for getting the rootfilename
TString guicolor; // User's choice of background color
TString plotsdir; // Where to store sample plots.. automatically stored as .jpg's).
UInt_t canvaswidth; // Width of histogram canvas
UInt_t canvasheight; // Width of histogram canvas
vector < pair <UInt_t,UInt_t> > pageInfo;
vector <TCut> cutList;
vector <UInt_t> GetDrawIndex(UInt_t);
Bool_t fFoundCfg;
Bool_t fMonitor;
Bool_t ParseForMultiPlots();
public:
OnlineConfig();
OnlineConfig(TString);
Bool_t ParseConfig();
TString GetRootFile() { return rootfilename; };
TString GetGoldenFile() { return goldenrootfilename; };
TString GetGuiColor() { return guicolor; };
TString GetPlotsDir() { return plotsdir; };
TCut GetDefinedCut(TString ident);
vector <TString> GetCutIdent();
// Page utilites
UInt_t GetPageCount() { return pageInfo.size(); };
pair <UInt_t,UInt_t> GetPageDim(UInt_t);
Bool_t IsLogx(UInt_t page);
Bool_t IsLogy(UInt_t page);
Bool_t IsLogz(UInt_t page);
TString GetPageTitle(UInt_t);
UInt_t GetDrawCount(UInt_t); // Number of histograms in a page
drawcommand GetDrawCommand(UInt_t,UInt_t);
vector <TString> SplitString(TString,TString);
void OverrideRootFile(UInt_t);
Bool_t IsMonitor() { return fMonitor; };
UInt_t GetCanvasWidth() { return canvaswidth; };
UInt_t GetCanvasHeight() { return canvasheight; };
};
class OnlineGUI {
// Class that takes care of the GUI
RQ_OBJECT("OnlineGUI")
private:
//UInt_t fRunNum;
TGMainFrame *fMain;
TGHorizontalFrame *fTopframe;
TGVerticalFrame *vframe;
TGRadioButton *fRadioPage[50];
TGPictureButton *wile;
TRootEmbeddedCanvas *fEcanvas;
TGHorizontalFrame *fBottomFrame;
TGHorizontalFrame *hframe;
TGTextButton *fNext;
TGTextButton *fPrev;
TGTextButton *fExit;
TGLabel *fRunNumber;
TGTextButton *fPrint;
TCanvas *fCanvas; // Present Embedded canvas
OnlineConfig *fConfig;
UInt_t current_page;
RootFileObject fRootFile;
RootFileObject fGoldenFile;
Bool_t doGolden;
UInt_t runNumber;
TTimer *timer;
Bool_t fPrintOnly;
Bool_t fFileAlive;
public:
OnlineGUI(OnlineConfig&,Bool_t,UInt_t RunNum=0);
void CreateGUI(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~OnlineGUI();
void DoDraw();
void DrawPrev();
void DrawNext();
void DoRadio();
void CheckPageButtons();
// Specific Draw Methods
void GetFileObjects(RootFileObject *r);
void GetTreeVars(RootFileObject *r);
void GetRootTree(RootFileObject *r);
UInt_t GetTreeIndex(TString,RootFileObject *r);
UInt_t GetTreeIndexFromName(TString, RootFileObject *r);
drawcommand fileObject2command(drawcommand,RootFileObject *r);
void TreeDraw(drawcommand);
void HistDraw(drawcommand);
void MacroDraw(drawcommand);
void CanvasDraw(drawcommand,UInt_t);
void GraphDraw(drawcommand);
void DoDrawClear(RootFileObject *r);
void TimerUpdate();
void BadDraw(TString);
void CheckRootFile();
Int_t OpenRootFile();
void ObtainRunNumber();
void PrintToFile();
void PrintPages();
void MyCloseWindow();
void CloseGUI();
};
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment