Anp::SnarlAdcTab Class Reference

#include <SnarlAdcTab.h>

Inheritance diagram for Anp::SnarlAdcTab:
Anp::EventTab Anp::Base

List of all members.

Public Member Functions

 SnarlAdcTab ()
virtual ~SnarlAdcTab ()
void Init (TCanvas *canvas)
void Expose ()
void Set (const Event &event, const Record &record)
void ZoomIn ()
void ZoomOut ()
void Config (const Registry &reg)

Private Member Functions

bool Init (const Record &record)
void Reset ()
void Add (StripVec &svec, const Record &record, const std::string &view)

Private Attributes

Registry fConfig
std::vector< TObject * > fObjVec
bool fInit
bool fDraw
bool fPlotAll
bool fUsePE
DrawSpan fSpan
TCanvas * fCanvas
TPad * fPadU
TPad * fPadV
TH2 * f2hU
TH2 * f2hV

Detailed Description

Definition at line 29 of file SnarlAdcTab.h.


Constructor & Destructor Documentation

Anp::SnarlAdcTab::SnarlAdcTab (  ) 

Definition at line 24 of file SnarlAdcTab.cxx.

00025    :fConfig(false),
00026     fInit(false),
00027     fDraw(true),
00028     fPlotAll(true),
00029     fUsePE(true),
00030     fCanvas(0),
00031     fPadU(0),
00032     fPadV(0),
00033     f2hU(0),
00034     f2hV(0)
00035 {
00036 }

Anp::SnarlAdcTab::~SnarlAdcTab (  )  [virtual]

Definition at line 39 of file SnarlAdcTab.cxx.

References fObjVec, and it.

00040 {
00041    for(std::vector<TObject *>::iterator it = fObjVec.begin(); it != fObjVec.begin(); ++it)
00042    {
00043       TObject *obj = *it;
00044       delete obj;
00045    }
00046 }


Member Function Documentation

void Anp::SnarlAdcTab::Add ( StripVec svec,
const Record record,
const std::string &  view 
) [private]

Referenced by Set().

void Anp::SnarlAdcTab::Config ( const Registry reg  )  [virtual]

Implements Anp::EventTab.

Definition at line 168 of file SnarlAdcTab.cxx.

References fConfig, fPlotAll, fUsePE, and Anp::Read().

Referenced by Init().

00169 {
00170    fConfig = reg;
00171 
00172    //
00173    // Read bool
00174    //
00175    Anp::Read(reg, "SnarlAdcTabPlotAll", fPlotAll);
00176    Anp::Read(reg, "SnarlAdcTabUsePE",   fUsePE);
00177 }

void Anp::SnarlAdcTab::Expose (  )  [virtual]

Implements Anp::EventTab.

Definition at line 139 of file SnarlAdcTab.cxx.

References cd(), Draw(), f2hU, f2hV, fCanvas, fDraw, fInit, fPadU, and fPadV.

00140 {
00141    if(!fInit)
00142    {
00143       return;
00144    }
00145 
00146    if(!fPadU || !fPadV)
00147    {
00148       return;
00149    }
00150    
00151    if(fDraw)
00152    {
00153       fPadU -> cd();   
00154       f2hU -> Draw("colz");
00155       
00156       fPadV -> cd();   
00157       f2hV -> Draw("colz");
00158 
00159       fDraw = false;
00160    }
00161 
00162    fCanvas -> cd();
00163    fCanvas -> Modified();
00164    fCanvas -> Update();
00165 }

bool Anp::SnarlAdcTab::Init ( const Record record  )  [private]

Definition at line 180 of file SnarlAdcTab.cxx.

References Anp::Draw::CreateTH2(), f2hU, f2hV, fConfig, fInit, fObjVec, and Anp::Record::GetHeader().

00181 {
00182    if(fInit)
00183    {
00184       cerr << "SnarlAdcTab is already initialized" << endl;
00185       return false;
00186    }
00187 
00188    fInit = true;
00189 
00190    f2hU = Draw::CreateTH2("Uview", fConfig, record.GetHeader());
00191    f2hV = Draw::CreateTH2("Vview", fConfig, record.GetHeader());
00192 
00193    fObjVec.push_back(f2hU);
00194    fObjVec.push_back(f2hV);
00195 
00196    return true;
00197 }

void Anp::SnarlAdcTab::Init ( TCanvas *  canvas  )  [virtual]

Implements Anp::EventTab.

Definition at line 105 of file SnarlAdcTab.cxx.

References cd(), Config(), Divide(), fCanvas, fConfig, fPadU, and fPadV.

Referenced by Set().

00106 {
00107    if(!canvas)
00108    {
00109       cerr << "SnarlAdcTab::Expose(): null TCanvas pointer" << endl;
00110       return;
00111    }
00112    if(fPadU || fPadV || fCanvas)
00113    {
00114       cerr << "SnarlAdcTab::Expose(): pads have been already initialized" << endl;
00115       return;
00116    }
00117 
00118    fCanvas = canvas;
00119 
00120    fCanvas -> Divide(0, 2);
00121 
00122    fPadU = dynamic_cast<TPad *> (canvas -> cd(1));
00123    fPadV = dynamic_cast<TPad *> (canvas -> cd(2));
00124    
00125    if(!fPadU || !fPadV)
00126    {
00127       cerr << "SnarlAdcTab::Expose(): failed to create new pads" << endl;
00128       fCanvas = 0;
00129       fPadU = 0;
00130       fPadV = 0;
00131       return;
00132    }
00133 
00134    Draw::Config(fPadU, "", fConfig);
00135    Draw::Config(fPadV, "", fConfig);
00136 }

void Anp::SnarlAdcTab::Reset (  )  [private]

Definition at line 200 of file SnarlAdcTab.cxx.

References f2hU, f2hV, fDraw, fSpan, and Anp::DrawSpan::Reset().

Referenced by Set().

00201 {
00202    fDraw = true;
00203 
00204    fSpan.Reset();
00205 
00206    if(f2hU)
00207    {
00208       f2hU -> Reset();
00209    }
00210    if(f2hV)
00211    {
00212       f2hV -> Reset();
00213    }
00214 }

void Anp::SnarlAdcTab::Set ( const Event event,
const Record record 
) [virtual]

Implements Anp::EventTab.

Definition at line 49 of file SnarlAdcTab.cxx.

References Add(), f2hU, f2hV, Anp::DrawSpan::FindSpan(), fInit, fSpan, fUsePE, Anp::GetStrip(), Init(), and Reset().

00050 {  
00051    if(!fInit)
00052    {
00053       Init(record);
00054    }
00055    else
00056    {
00057       SnarlAdcTab::Reset();
00058    }
00059 
00060    if(!f2hU || !f2hV)
00061    {
00062       return;
00063    }
00064 
00065    fSpan.FindSpan(event, record);
00066 
00067    StripVec uvec = GetStrip(event, record, "U");
00068    StripVec vvec = GetStrip(event, record, "V");   
00069 
00070    if(uvec.empty() || vvec.empty())
00071    {
00072       cerr << "SnarlAdcTab::SetEvent() - no strips matching a track" << endl;
00073       return;
00074    }
00075 
00076    SnarlAdcTab::Add(uvec, record, "U");
00077    SnarlAdcTab::Add(vvec, record, "V");
00078 
00079    for(Draw::SIter sit = uvec.begin(); sit != uvec.end(); ++sit)
00080    {
00081       if(fUsePE)
00082       {
00083          f2hU -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> PE());
00084       }
00085       else
00086       {
00087          f2hU -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00088       }
00089    }
00090 
00091    for(Draw::SIter sit = vvec.begin(); sit != vvec.end(); ++sit)
00092    {
00093       if(fUsePE)
00094       {
00095          f2hV -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00096       }
00097       else
00098       {
00099          f2hV -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> PE());
00100       }
00101    }
00102 }   

void Anp::SnarlAdcTab::ZoomIn (  )  [virtual]

Reimplemented from Anp::EventTab.

Definition at line 267 of file SnarlAdcTab.cxx.

References f2hU, f2hV, fConfig, fDraw, fSpan, Anp::DrawSpan::InitU(), Anp::DrawSpan::InitV(), Anp::DrawSpan::InitZ(), Anp::Read(), Anp::DrawSpan::SetRangeU(), Anp::DrawSpan::SetRangeV(), and Anp::DrawSpan::SetRangeZ().

00268 {
00269    fDraw = true;
00270 
00271    static double ZoomBorderScale = 1.2;
00272    static double ZoomBorderWidth = 0.1;
00273 
00274    static bool init = false;
00275    if(!init)
00276    {
00277       init = true;
00278       ZoomBorderScale = Draw::Read("ZoomBorderScale", ZoomBorderScale, fConfig);
00279       ZoomBorderWidth = Draw::Read("ZoomBorderWidth", ZoomBorderWidth, fConfig);
00280 
00281       if(ZoomBorderScale < 1.0) ZoomBorderScale = 1.2;
00282       if(ZoomBorderWidth < 0.0) ZoomBorderWidth = 0.1;
00283    }
00284 
00285    if(fSpan.InitU())
00286    {
00287       fSpan.SetRangeU(f2hU -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00288    }
00289    if(fSpan.InitZ())
00290    {
00291       fSpan.SetRangeZ(f2hU -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00292    }
00293    if(fSpan.InitV())
00294    {
00295       fSpan.SetRangeV(f2hV -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00296    }
00297    if(fSpan.InitZ())
00298    {
00299       fSpan.SetRangeZ(f2hV -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00300    }
00301 }

void Anp::SnarlAdcTab::ZoomOut (  )  [virtual]

Reimplemented from Anp::EventTab.

Definition at line 304 of file SnarlAdcTab.cxx.

References f2hU, f2hV, and fDraw.

00305 {
00306    fDraw = true;
00307 
00308    f2hU -> GetXaxis() -> UnZoom();
00309    f2hU -> GetYaxis() -> UnZoom();
00310 
00311    f2hV -> GetXaxis() -> UnZoom();
00312    f2hV -> GetYaxis() -> UnZoom();
00313 }


Member Data Documentation

TH2* Anp::SnarlAdcTab::f2hU [private]

Definition at line 71 of file SnarlAdcTab.h.

Referenced by Expose(), Init(), Reset(), Set(), ZoomIn(), and ZoomOut().

TH2* Anp::SnarlAdcTab::f2hV [private]

Definition at line 72 of file SnarlAdcTab.h.

Referenced by Expose(), Init(), Reset(), Set(), ZoomIn(), and ZoomOut().

TCanvas* Anp::SnarlAdcTab::fCanvas [private]

Definition at line 66 of file SnarlAdcTab.h.

Referenced by Expose(), and Init().

Definition at line 54 of file SnarlAdcTab.h.

Referenced by Config(), Init(), and ZoomIn().

bool Anp::SnarlAdcTab::fDraw [private]

Definition at line 59 of file SnarlAdcTab.h.

Referenced by Expose(), Reset(), ZoomIn(), and ZoomOut().

bool Anp::SnarlAdcTab::fInit [private]

Definition at line 58 of file SnarlAdcTab.h.

Referenced by Expose(), Init(), and Set().

std::vector<TObject *> Anp::SnarlAdcTab::fObjVec [private]

Definition at line 56 of file SnarlAdcTab.h.

Referenced by Init(), and ~SnarlAdcTab().

TPad* Anp::SnarlAdcTab::fPadU [private]

Definition at line 68 of file SnarlAdcTab.h.

Referenced by Expose(), and Init().

TPad* Anp::SnarlAdcTab::fPadV [private]

Definition at line 69 of file SnarlAdcTab.h.

Referenced by Expose(), and Init().

Definition at line 61 of file SnarlAdcTab.h.

Referenced by Config().

Definition at line 64 of file SnarlAdcTab.h.

Referenced by Reset(), Set(), and ZoomIn().

bool Anp::SnarlAdcTab::fUsePE [private]

Definition at line 62 of file SnarlAdcTab.h.

Referenced by Config(), and Set().


The documentation for this class was generated from the following files:

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1