OpeDisplayer.cpp

00001 #include "OpeDisplayer.h"
00002 #include "DisplayManager.h"
00003 #include "DisplayInfo.h"
00004 
00005 #include "SctData/OpeResult.h"
00006 
00007 #include "TH1.h"
00008 #include "TCanvas.h"
00009 #include "TLatex.h"
00010 
00011 #include <iomanip>
00012 #include <string>
00013 #include <boost/shared_ptr.hpp>
00014 
00015 using namespace std;
00016 using namespace SctData;
00017 using namespace Sct;
00018 using namespace boost;
00019 
00020 namespace SctDataDisplay {
00021 
00022 bool OpeDisplayer::inMap = DisplayManager::addToMap("SctData::OpeResult", shared_ptr<Displayer>(new OpeDisplayer()));
00023     
00024 class OpeDisplayData : public DisplayData {
00025 public:
00026     vector<shared_ptr<TCanvas> > canvas;
00027     shared_ptr<const OpeResult> ope;
00028 };        
00029    
00030    
00031 shared_ptr<DisplayData> OpeDisplayer::display(shared_ptr<const Sct::Serializable> serial, const DisplayInfo& info, std::ostream& os) { 
00032     shared_ptr<OpeDisplayData> data (new OpeDisplayData());
00033     data->ope = dynamic_pointer_cast<const OpeResult>(serial);
00034 
00035     if (info.displayChips.size() > 0) displayChips(*data, info, os);
00036 
00037     return data;
00038 }
00039 
00040 void OpeDisplayer::displayChips(OpeDisplayData& data, const DisplayInfo& info, std::ostream& os) {
00041   shared_ptr<TCanvas> c = createCanvas((string)data.ope->getUniqueID() + "_chipNO", "Noise Occupancy OPE plots for " + (string)data.ope->getUniqueID());
00042     data.canvas.push_back(c);
00043     divideCanvas(info.displayChips.size(), *c);
00044 
00045     for (unsigned int i=0; i<info.displayChips.size(); ++i) {
00046       const ChipOpeResult& r = data.ope->getChipResult(info.displayChips[i]);
00047     os << "Chip " << i << " badmax: " << r.badmax << " threshold: " << r.threshold << endl;
00048         c->cd(i+1);   
00049     gPad->SetLeftMargin(0.15);
00050     gPad->SetBottomMargin(0.15);
00051     gPad->SetTopMargin(0.03);
00052     gPad->SetRightMargin(0.03);
00053 
00054     if (r.hist.get()){
00055       // series of obscure root incantations to make anything actually draw!
00056       r.hist->SetXTitle("Threshold-TrimT(fC)");
00057       r.hist->SetYTitle("Badness");
00058       r.hist->SetLineWidth(2);
00059       r.hist->SetMaximum(r.hist->GetMaximum()*1.2);
00060       r.hist->GetYaxis()->Set(0, 0, r.hist->GetMaximum()*1.2);
00061       r.hist->GetXaxis()->SetLabelSize(0.06);
00062       r.hist->GetYaxis()->SetLabelSize(0.06);
00063       r.hist->GetXaxis()->SetTitleSize(0.06);
00064       r.hist->GetYaxis()->SetTitleSize(0.06);
00065       displayHistogram(r.hist,"");
00066     }
00067     }
00068     
00069 }
00070 }
00071 

Generated on Mon Feb 6 14:01:24 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6