Anp::EventAdcTab Class Reference

#include <EventAdcTab.h>

Inheritance diagram for Anp::EventAdcTab:
Anp::EventTab Anp::Base

List of all members.

Public Member Functions

 EventAdcTab ()
virtual ~EventAdcTab ()
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 ()

Private Attributes

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

Detailed Description

Definition at line 23 of file EventAdcTab.h.


Constructor & Destructor Documentation

Anp::EventAdcTab::EventAdcTab (  ) 

Definition at line 24 of file EventAdcTab.cxx.

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

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

Definition at line 36 of file EventAdcTab.cxx.

References fObjVec, and it.

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


Member Function Documentation

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

Implements Anp::EventTab.

Definition at line 148 of file EventAdcTab.cxx.

References fConfig, Registry::LockValues(), Registry::Merge(), and Registry::UnLockValues().

Referenced by Init().

00149 {
00150    fConfig.UnLockValues();
00151    fConfig.Merge(reg); 
00152    fConfig.LockValues();
00153 }

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

Implements Anp::EventTab.

Definition at line 119 of file EventAdcTab.cxx.

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

00120 {
00121    if(!fInit)
00122    {
00123       return;
00124    }
00125 
00126    if(!fPadU || !fPadV)
00127    {
00128       return;
00129    }
00130    
00131    if(fDraw)
00132    {
00133       fPadU -> cd();   
00134       f2hU -> Draw("colz");
00135       
00136       fPadV -> cd();   
00137       f2hV -> Draw("colz");
00138 
00139       fDraw = false;
00140    }
00141 
00142    fCanvas -> cd();
00143    fCanvas -> Modified();
00144    fCanvas -> Update();
00145 }

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

Definition at line 156 of file EventAdcTab.cxx.

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

00157 {
00158    if(fInit)
00159    {
00160       cerr << "EventAdcTab is already initialized" << endl;
00161       return false;
00162    }
00163 
00164    fInit = true;
00165 
00166    f2hU = Draw::CreateTH2("Uview", fConfig, record.GetHeader());
00167    f2hV = Draw::CreateTH2("Vview", fConfig, record.GetHeader());
00168 
00169    fObjVec.push_back(f2hU);
00170    fObjVec.push_back(f2hV);
00171 
00172    return true;
00173 }

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

Implements Anp::EventTab.

Definition at line 85 of file EventAdcTab.cxx.

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

Referenced by Set().

00086 {
00087    if(!canvas)
00088    {
00089       cerr << "EventAdcTab::Expose(): null TCanvas pointer" << endl;
00090       return;
00091    }
00092    if(fPadU || fPadV || fCanvas)
00093    {
00094       cerr << "EventAdcTab::Expose(): pads have been already initialized" << endl;
00095       return;
00096    }
00097 
00098    fCanvas = canvas;
00099 
00100    fCanvas -> Divide(0, 2);
00101 
00102    fPadU = dynamic_cast<TPad *> (canvas -> cd(1));
00103    fPadV = dynamic_cast<TPad *> (canvas -> cd(2));
00104    
00105    if(!fPadU || !fPadV)
00106    {
00107       cerr << "EventAdcTab::Expose(): failed to create new pads" << endl;
00108       fCanvas = 0;
00109       fPadU = 0;
00110       fPadV = 0;
00111       return;
00112    }
00113 
00114    Draw::Config(fPadU, "", fConfig);
00115    Draw::Config(fPadV, "", fConfig);
00116 }

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

Definition at line 176 of file EventAdcTab.cxx.

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

Referenced by Set().

00177 {
00178    fDraw = true;
00179 
00180    fSpan.Reset();
00181 
00182    if(f2hU)
00183    {
00184       f2hU -> Reset();
00185    }
00186    if(f2hV)
00187    {
00188       f2hV -> Reset();
00189    }
00190 }

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

Implements Anp::EventTab.

Definition at line 46 of file EventAdcTab.cxx.

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

00047 {  
00048    if(!fInit)
00049    {
00050       Init(record);
00051    }
00052    else
00053    {
00054       Reset();
00055    }
00056 
00057    if(!f2hU || !f2hV)
00058    {
00059       return;
00060    }
00061 
00062    fSpan.FindSpan(event, record);
00063 
00064    const StripVec uvec = GetStrip(event, record, "U");
00065    const StripVec vvec = GetStrip(event, record, "V");
00066 
00067    if(uvec.empty() || vvec.empty())
00068    {
00069       cerr << "EventAdcTab::SetEvent() - no strips matching a track" << endl;
00070       return;
00071    }    
00072 
00073    for(Draw::SIter sit = uvec.begin(); sit != uvec.end(); ++sit)
00074    {
00075       f2hU -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00076    }
00077 
00078    for(Draw::SIter sit = vvec.begin(); sit != vvec.end(); ++sit)
00079    {
00080       f2hV -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00081    }
00082 }   

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

Reimplemented from Anp::EventTab.

Definition at line 193 of file EventAdcTab.cxx.

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

00194 {
00195    fDraw = true;
00196 
00197    static double ZoomBorderScale = 1.2;
00198    static double ZoomBorderWidth = 0.1;
00199 
00200    static bool init = false;
00201    if(!init)
00202    {
00203       init = true;
00204       ZoomBorderScale = Draw::Read("ZoomBorderScale", ZoomBorderScale, fConfig);
00205       ZoomBorderWidth = Draw::Read("ZoomBorderWidth", ZoomBorderWidth, fConfig);
00206 
00207       if(ZoomBorderScale < 1.0) ZoomBorderScale = 1.2;
00208       if(ZoomBorderWidth < 0.0) ZoomBorderWidth = 0.1;
00209    }
00210 
00211    if(fSpan.InitU())
00212    {
00213       fSpan.SetRangeU(f2hU -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00214    }
00215    if(fSpan.InitZ())
00216    {
00217       fSpan.SetRangeZ(f2hU -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00218    }
00219    if(fSpan.InitV())
00220    {
00221       fSpan.SetRangeV(f2hV -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00222    }
00223    if(fSpan.InitZ())
00224    {
00225       fSpan.SetRangeZ(f2hV -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00226    }
00227 }

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

Reimplemented from Anp::EventTab.

Definition at line 230 of file EventAdcTab.cxx.

References f2hU, f2hV, and fDraw.

00231 {
00232    fDraw = true;
00233 
00234    if(f2hU)
00235    {
00236       f2hU -> GetXaxis() -> UnZoom();
00237       f2hU -> GetYaxis() -> UnZoom();
00238    }
00239 
00240    if(f2hV)
00241    {
00242       f2hV -> GetXaxis() -> UnZoom();
00243       f2hV -> GetYaxis() -> UnZoom();
00244    }
00245 }


Member Data Documentation

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

Definition at line 60 of file EventAdcTab.h.

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

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

Definition at line 61 of file EventAdcTab.h.

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

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

Definition at line 55 of file EventAdcTab.h.

Referenced by Expose(), and Init().

Definition at line 46 of file EventAdcTab.h.

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

bool Anp::EventAdcTab::fDraw [private]

Definition at line 51 of file EventAdcTab.h.

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

bool Anp::EventAdcTab::fInit [private]

Definition at line 50 of file EventAdcTab.h.

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

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

Definition at line 48 of file EventAdcTab.h.

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

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

Definition at line 57 of file EventAdcTab.h.

Referenced by Expose(), and Init().

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

Definition at line 58 of file EventAdcTab.h.

Referenced by Expose(), and Init().

Definition at line 53 of file EventAdcTab.h.

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


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

Generated on 18 Oct 2018 for loon by  doxygen 1.6.1