Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BDQViewer.cxx

Go to the documentation of this file.
00001 #include "BDQViewer.h"
00002 
00003 #include <RootUtil/CanvasViewer.h>
00004 #include <HistMan/HistMan.h>
00005 
00006 #include <TH1F.h>
00007 #include <TH1I.h>
00008 #include <TH2F.h>
00009 #include <TFile.h>
00010 #include <TGTab.h>
00011 #include <TGText.h>
00012 #include <TGTextView.h>
00013 #include <TGText.h>
00014 #include <TApplication.h>
00015 #include <RQ_OBJECT.h>
00016 
00017 #include <iostream>
00018 using namespace std;
00019 
00020 
00021 class Earliest : public CanvasTab
00022 {
00023     TGTextView* fText;
00024 
00025 public:
00026     Earliest(TGTextView* text) : fText(text) {}
00027 
00028     void Init(TCanvas* canvas) {
00029 
00030         HistMan file_hists("BDP Data Quality/File Hists");
00031 
00032         const char* earliest_names[] = {
00033             "earliest_dae_stnd",
00034             "earliest_vme_stnd",
00035             "earliest_last_dae",
00036             0
00037         };
00038         canvas->SetTitle("Earliest-time plots");
00039         canvas->Divide(1,3);
00040         for (int ind=0; earliest_names[ind]; ++ind) {
00041             canvas->cd(ind+1);
00042             gPad->SetLogy();
00043             TH1F* h = file_hists.Get<TH1F>(earliest_names[ind]);
00044             if (!h) continue;
00045             h->SetXTitle("#Delta Time (seconds)");
00046             h->DrawCopy();
00047         }
00048     }
00049 
00050     void Expose() {
00051         fText->Clear();
00052         fText->AddLine("(a) The time between the first device time (DAE) "
00053                            "and the spill time from SpillTimeND DB table.  ");
00054         fText->AddLine("Inherent jitter should be well less than 0.5 seconds.  ");
00055         fText->AddLine("Anything more than 1 second indicates a missing entry ");
00056         fText->AddLine("in the SpillTimeND table.");
00057         fText->AddLine("(b) Same but using the time of the earliest SWIC-like device ");
00058         fText->AddLine("(from the Hadron/muon/profile monitor's VME crate).");
00059         fText->AddLine("(c) Repetition period. Typically 2 seconds, but can be larger.");
00060     }
00061 };
00062 
00063 class PerTime : public CanvasTab {
00064     TGTextView* fText;
00065 
00066 public:
00067     PerTime(TGTextView* text) : fText(text) {}
00068 
00069     void Init(TCanvas* canvas) {
00070         HistMan file_hists("BDP Data Quality/File Hists");
00071         const char* per_names[] = {
00072             "npot_per_hour",
00073             "npot_per_min",
00074             "spills_per_hour",
00075             "spills_per_min",
00076             0
00077         };
00078         canvas->SetTitle("Per time plots");
00079         canvas->Divide(2,2);
00080         for (int ind=0; per_names[ind]; ++ind) {
00081             canvas->cd(ind+1);
00082             gPad->SetLogy();
00083             TH1F* h = file_hists.Get<TH1F>(per_names[ind]);
00084             if (!h) continue;
00085             h->SetXTitle("Time from start of file");
00086             h->DrawCopy();
00087         }
00088     }
00089 
00090     void Expose() {
00091         fText->Clear();
00092         fText->AddLine("Number of protons and spills per hour and minute.  ");
00093         fText->AddLine("Any drop outs not associated with actual beam down time ");
00094         fText->AddLine("indicates a problem.");
00095     }
00096 
00097 };
00098 
00099 class DbCheck : public CanvasTab {
00100     TGTextView* fText;
00101 public:
00102     DbCheck(TGTextView* text) : fText(text) {}
00103 
00104     void Init(TCanvas* canvas) {
00105         HistMan db_hists("BDP Data Quality/DB Hists");
00106         const char* db_names[] = {
00107             "stnd_bdp_dt",
00108             "stnd_bdp_dt_hour",
00109             "stnd_bdp_dt_min",
00110             0
00111         };
00112         canvas->SetTitle("STND-BDP plots");
00113         canvas->Divide(1,3);
00114         for (int ind=0; db_names[ind]; ++ind) {
00115             canvas->cd(ind+1);
00116             if (!ind) {
00117                 gPad->SetLogy();
00118                 TH1F* h1 = db_hists.Get<TH1F>(db_names[ind]);
00119                 if (!h1) continue;
00120                 h1->SetXTitle("SpillTimeND - BDP time");
00121                 h1->DrawCopy();
00122             }
00123             else {
00124                 gPad->SetLogy(false);
00125                 TH2F* h2 = db_hists.Get<TH2F>(db_names[ind]);
00126                 if (!h2) continue;
00127                 h2->SetXTitle("Time from begin of file");
00128                 h2->SetYTitle("SpillTimeND - BDP time");
00129                 h2->DrawCopy("colz");
00130             }
00131             
00132         }
00133     }
00134     void Expose() {
00135         fText->Clear();
00136         fText->AddLine("(a)Difference between SpillTimeND and BeamMonSpill DB entries.");
00137         fText->AddLine("Anything more than 1 sec from zero indicates lost BeamMonSpill.");
00138         fText->AddLine("(b)This difference version time in hour bins. ");
00139         fText->AddLine("This indicates when any loss occurs");
00140         fText->AddLine("(c)Same but for minute bins");
00141     }
00142             
00143 };
00144 
00145 class TorCheck : public CanvasTab {
00146     TGTextView* fText;
00147 public:
00148     TorCheck(TGTextView* text) : fText(text) {}
00149 
00150     void Init(TCanvas* canvas) {
00151         HistMan file_hists("BDP Data Quality/File Hists");
00152         
00153         const char* tor_names[] = {
00154             "toroids",
00155             "tortgt_trtgtd",
00156             "tor101_tr101d",
00157             0
00158         };
00159         canvas->SetTitle("Toroid comparison plots");
00160         canvas->Divide(1,3);
00161         for (int ind=0; tor_names[ind]; ++ind) {
00162             cerr << "\"" << tor_names[ind] << "\"\n";
00163             canvas->cd(ind+1);
00164             if (ind) gPad->SetLogy();
00165             
00166             TH1F* h = file_hists.Get<TH1F>(tor_names[ind]);
00167 
00168             if (!h) {
00169                 cerr << "No such TH1F: " << tor_names[ind] << endl;
00170                 continue;
00171             }
00172             if (ind) 
00173                 h->SetXTitle(Form("%s differences (npot)",tor_names[ind]));
00174             else {
00175                 h->SetYTitle("Proton count (tera-protons)");
00176                 h->SetXTitle("Toroids (npot)");
00177             }
00178             h->DrawCopy();
00179         }       
00180     }
00181 
00182     void Expose() {
00183         fText->Clear();
00184         fText->AddLine("(a) Proton count for each NuMI toroid.");
00185         fText->AddLine("(b) Relative differences between TORTGT and TRTGTD");
00186         fText->AddLine("(b) Relative differences between TOR101 and TR101D");
00187         fText->AddLine("These should all be w/in 1%.");
00188     }
00189 };
00190 
00191 class DevCount : public CanvasTab {
00192     TGTextView* fText;
00193 public:
00194     DevCount(TGTextView* text) : fText(text) {}
00195 
00196     void Init(TCanvas* canvas) {
00197         HistMan file_hists("BDP Data Quality/File Hists");
00198         canvas->SetTitle("Device Counts");
00199         canvas->Divide(1,2);
00200         canvas->cd(1);
00201         TH1F* h = file_hists.Get<TH1F>("dev_count");
00202         if (h) h->DrawCopy();
00203         else cerr << "Can't get \"dev_count\" histogram\n";
00204 
00205         canvas->cd(2);
00206         TVirtualPad* pad = gPad;
00207         pad->Divide(2,1);
00208 
00209         pad->cd(1);
00210         TH1I* hi = file_hists.Get<TH1I>("total_blocks");
00211         if (hi) hi->DrawCopy();
00212         else cerr << "Can't get \"total_blocks\" histogram\n";
00213 
00214         pad->cd(2);
00215         hi = file_hists.Get<TH1I>("unique_blocks");
00216         if (hi) hi->DrawCopy();
00217         else cerr << "Can't get \"unique_blocks\" histogram\n";
00218         
00219 
00220     }
00221     void Expose() {
00222         fText->Clear();
00223         fText->AddLine("(a) Number of spills in which various important device exist.");
00224         fText->AddLine("Any droupouts more than about 1% should be noted.");
00225         fText->AddLine("(b) Total RawBeamMonBlocks in \"mom\".  Should be one.");
00226         fText->AddLine("Multiple blocks indicate serious problem!");
00227         fText->AddLine("(c) \"Unique\" blocks.  When multiple blocks happen they");
00228         fText->AddLine("can be somewhat filtered.  Should always be 1.");
00229     }
00230 };
00231 
00232 
00233 BDQViewer::BDQViewer(const char* filename)
00234 {
00235     fMain = new TGMainFrame(0, 800,800);
00236     fMain->SetCleanup(kDeepCleanup);
00237     fMain->Connect("CloseWindow()", "BDQViewer", this, "CloseWindow()");
00238     
00239     fMain->SetWindowName("GuiTest Signal/Slots");
00240     
00241     fCTabs = new CanvasTabs(fMain);
00242 
00243     TGTab& tab = fCTabs->GetTabs();
00244     tab.Connect("Selected(Int_t)", "BDQViewer", this, "DoTab(Int_t)");
00245 
00246     TFile f(filename);
00247     HistMan io(f);
00248 
00249     fText = new TGTextView(fMain,800,150,"");
00250 
00251     DbCheck* dbcheck  = new DbCheck(fText);
00252     fCTabs->AdoptTab("SpillTimeND check",dbcheck);
00253     fCTabs->AdoptTab("File based spill dT",new Earliest(fText));
00254     fCTabs->AdoptTab("#POT per time",new PerTime(fText));
00255     fCTabs->AdoptTab("Toroid comparisons",new TorCheck(fText));
00256     fCTabs->AdoptTab("Device counts",new DevCount(fText));
00257     dbcheck->Expose();
00258 
00259     TGLayoutHints* lh = new TGLayoutHints(kLHintsBottom | kLHintsLeft |
00260                                           kLHintsExpandX, 5, 5, 5, 5);
00261     fMain->AddFrame(fText,lh);
00262 
00263     fMain->Resize(800,800);
00264     fMain->Layout();
00265     fMain->MapSubwindows();
00266     fMain->MapWindow();
00267     
00268     //fMain->Print();
00269 }
00270 
00271 void BDQViewer::DoTab(Int_t /*tab*/)
00272 {
00273 }
00274 
00275 void BDQViewer::CloseWindow() 
00276 {
00277     gApplication->Terminate();
00278 }
00279 
00280 
00281 

Generated on Mon Feb 15 11:06:24 2010 for loon by  doxygen 1.3.9.1