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

Anp::EventHitTab Class Reference

#include <EventHitTab.h>

Inheritance diagram for Anp::EventHitTab:

Anp::EventTab Anp::Base List of all members.

Public Member Functions

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

void SetTrack (const Track &track, const Record &record, short index)
void SetShowers (const Event &event, const Record &record)
void SetOthers (const Event &event, const Record &record)
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
TGraph * fgShwU
TGraph * fgShwV
TGraph * fgTrk1U
TGraph * fgTrk1V
TGraph * fgTrk2U
TGraph * fgTrk2V

Constructor & Destructor Documentation

Anp::EventHitTab::EventHitTab  ) 
 

Definition at line 24 of file EventHitTab.cxx.

00025    :fInit(false),
00026     fDraw(true),
00027     fCanvas(0),
00028     fPadU(0),
00029     fPadV(0),
00030     f2hU(0),
00031     f2hV(0),
00032     fgShwU(0),
00033     fgShwV(0),
00034     fgTrk1U(0),
00035     fgTrk1V(0),
00036     fgTrk2U(0),
00037     fgTrk2V(0)
00038 {
00039 }

Anp::EventHitTab::~EventHitTab  )  [virtual]
 

Definition at line 42 of file EventHitTab.cxx.

References fObjVec.

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


Member Function Documentation

void Anp::EventHitTab::Config const Registry reg  )  [virtual]
 

Implements Anp::EventTab.

Definition at line 239 of file EventHitTab.cxx.

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

00240 {
00241    fConfig.UnLockValues();
00242    fConfig.Merge(reg); 
00243    fConfig.LockValues();
00244 }

void Anp::EventHitTab::Expose  )  [virtual]
 

Implements Anp::EventTab.

Definition at line 203 of file EventHitTab.cxx.

References Draw(), f2hU, f2hV, fCanvas, fDraw, fgShwU, fgShwV, fgTrk1U, fgTrk1V, fgTrk2U, fgTrk2V, fPadU, and fPadV.

00204 {
00205    if(!fInit)
00206    {
00207       return;
00208    }
00209 
00210    if(!fPadU || !fPadV)
00211    {
00212       return;
00213    }
00214 
00215    if(fDraw)
00216    {
00217       fPadU -> cd();   
00218       f2hU -> Draw("");
00219       if(fgShwU -> GetN() > 0) fgShwU -> Draw("p");
00220       if(fgTrk1U -> GetN() > 0) fgTrk1U -> Draw("p");
00221       if(fgTrk2U -> GetN() > 0) fgTrk2U -> Draw("p");
00222       
00223       
00224       fPadV -> cd();
00225       f2hV -> Draw("");
00226       if(fgShwV -> GetN() > 0) fgShwV -> Draw("p");
00227       if(fgTrk1V -> GetN() > 0) fgTrk1V -> Draw("p");
00228       if(fgTrk2V -> GetN() > 0) fgTrk2V -> Draw("p");
00229 
00230       fDraw = false;
00231    }
00232 
00233    fCanvas -> cd();
00234    fCanvas -> Modified();
00235    fCanvas -> Update();
00236 }

bool Anp::EventHitTab::Init const Record record  )  [private]
 

Definition at line 247 of file EventHitTab.cxx.

References Anp::Draw::CreateTGraph(), Anp::Draw::CreateTH2(), f2hU, f2hV, fConfig, fgShwU, fgShwV, fgTrk1U, fgTrk1V, fgTrk2U, fgTrk2V, fInit, fObjVec, and Anp::Record::GetHeader().

00248 {
00249    if(fInit)
00250    {
00251       cerr << "EventHitTab is already initialized" << endl;
00252       return false;
00253    }
00254 
00255    fInit = true;  
00256 
00257    f2hU = Draw::CreateTH2("Uview", fConfig, record.GetHeader());
00258    f2hV = Draw::CreateTH2("Vview", fConfig, record.GetHeader());
00259 
00260    fgShwU = Draw::CreateTGraph("Shower", fConfig);
00261    fgShwV = Draw::CreateTGraph("Shower", fConfig);
00262 
00263    fgTrk1U = Draw::CreateTGraph("Track1", fConfig);
00264    fgTrk1V = Draw::CreateTGraph("Track1", fConfig);
00265    
00266    fgTrk2U = Draw::CreateTGraph("Track2", fConfig);
00267    fgTrk2V = Draw::CreateTGraph("Track2", fConfig);      
00268 
00269    fObjVec.push_back(f2hU);
00270    fObjVec.push_back(f2hV);
00271    fObjVec.push_back(fgTrk1U);
00272    fObjVec.push_back(fgTrk1V);
00273    fObjVec.push_back(fgTrk2U);
00274    fObjVec.push_back(fgTrk2V);
00275 
00276    return true;
00277 }

void Anp::EventHitTab::Init TCanvas *  canvas  )  [virtual]
 

Implements Anp::EventTab.

Definition at line 169 of file EventHitTab.cxx.

References Anp::Draw::Config(), fCanvas, fConfig, fPadU, and fPadV.

Referenced by Set().

00170 {
00171    if(!canvas)
00172    {
00173       cerr << "EventHitTab::Expose(): null TCanvas pointer" << endl;
00174       return;
00175    }
00176    if(fPadU || fPadV || fCanvas)
00177    {
00178       cerr << "EventHitTab::Expose(): pads have been already initialized" << endl;
00179       return;
00180    }
00181 
00182    fCanvas = canvas;
00183 
00184    fCanvas -> Divide(0, 2);
00185 
00186    fPadU = dynamic_cast<TPad *> (canvas -> cd(1));
00187    fPadV = dynamic_cast<TPad *> (canvas -> cd(2));
00188    
00189    if(!fPadU || !fPadV)
00190    {
00191       cerr << "EventHitTab::Expose(): failed to create new pads" << endl;
00192       fCanvas = 0;
00193       fPadU = 0;
00194       fPadV = 0;
00195       return;
00196    }
00197 
00198    Draw::Config(fPadU, "", fConfig);
00199    Draw::Config(fPadV, "", fConfig);
00200 }

void Anp::EventHitTab::Reset  )  [private]
 

Definition at line 280 of file EventHitTab.cxx.

References fDraw, fgShwU, fgShwV, fgTrk1U, fgTrk1V, fgTrk2U, fgTrk2V, fSpan, Anp::DrawSpan::Reset(), and Set().

Referenced by Set().

00281 {
00282    fDraw = true;
00283 
00284    fSpan.Reset();
00285 
00286    if(fgShwU)
00287    {
00288       fgShwU -> Set(0);
00289    }
00290    if(fgShwV)
00291    {
00292       fgShwV -> Set(0);
00293    }
00294    if(fgTrk1U)
00295    {
00296       fgTrk1U -> Set(0);
00297    }
00298    if(fgTrk1V)
00299    {
00300       fgTrk1V -> Set(0);
00301    }
00302    if(fgTrk2U)
00303    {
00304       fgTrk2U -> Set(0);
00305    }
00306    if(fgTrk2V)
00307    {
00308       fgTrk2V -> Set(0);
00309    }
00310 }

void Anp::EventHitTab::Set const Event event,
const Record record
[virtual]
 

Implements Anp::EventTab.

Definition at line 52 of file EventHitTab.cxx.

References Anp::DrawSpan::FindSpan(), fSpan, Anp::GetTrack(), Init(), Reset(), SetShowers(), SetTrack(), and Anp::TrackVec.

Referenced by Reset(), SetShowers(), and SetTrack().

00053 {  
00054    if(!fInit)
00055    {
00056       Init(record);
00057    }
00058    else
00059    {
00060       Reset();
00061    }
00062 
00063    fSpan.FindSpan(event, record);
00064 
00065    SetShowers(event, record);
00066 
00067    const TrackVec tvec = GetTrack(event, record);
00068    for(TrackVec::const_iterator it = tvec.begin(); it != tvec.end(); ++it)
00069    {
00070       SetTrack(*(*it), record, std::distance(tvec.begin(), it));
00071    }
00072 }

void Anp::EventHitTab::SetOthers const Event event,
const Record record
[private]
 

void Anp::EventHitTab::SetShowers const Event event,
const Record record
[private]
 

Definition at line 121 of file EventHitTab.cxx.

References fgShwU, fgShwV, Anp::Event::GetNShowers(), Anp::GetShower(), Anp::GetStrip(), Set(), Anp::ShowerVec, and StripVec.

Referenced by Set().

00122 {
00123    if(!fgShwU || !fgShwV)
00124    {
00125       return;
00126    }
00127 
00128    if(event.GetNShowers() < 1)
00129    {
00130       return;
00131    }
00132 
00133    const ShowerVec shw_vec = GetShower(event, record);
00134 
00135    StripVec uvec, vvec;
00136 
00137    for(ShowerVec::const_iterator it = shw_vec.begin(); it != shw_vec.end(); ++it)
00138    {           
00139       const Shower &shower = *(*it);
00140 
00141       const StripVec suvec = GetStrip(shower, record, "U");
00142       const StripVec svvec = GetStrip(shower, record, "V");
00143 
00144       uvec.insert(uvec.end(), suvec.begin(), suvec.end());
00145       vvec.insert(vvec.end(), svvec.begin(), svvec.end());
00146    }
00147    
00148    if(uvec.empty() || vvec.empty())
00149    {
00150       cerr << "EventHitTab::SetShower() - no strips matching a shower" << endl;
00151       return;
00152    }  
00153    
00154    fgShwU -> Set(uvec.size());
00155    fgShwV -> Set(vvec.size());
00156 
00157    for(Draw::SIterator sit = uvec.begin(); sit != uvec.end(); ++sit)
00158    {
00159       fgShwU -> SetPoint(std::distance(uvec.begin(), sit), (*sit) -> ZPos(), (*sit) -> TPos());
00160    }
00161 
00162    for(Draw::SIterator sit = vvec.begin(); sit != vvec.end(); ++sit)
00163    {
00164       fgShwV -> SetPoint(std::distance(vvec.begin(), sit), (*sit) -> ZPos(), (*sit) -> TPos());
00165    }
00166 }   

void Anp::EventHitTab::SetTrack const Track track,
const Record record,
short  index
[private]
 

Definition at line 75 of file EventHitTab.cxx.

References Anp::GetStrip(), Set(), and StripVec.

Referenced by Set().

00076 {
00077    TGraph *ug = 0;
00078    TGraph *vg = 0;
00079 
00080    if(index == 0)
00081    {
00082       ug = fgTrk1U;
00083       vg = fgTrk1V;
00084    }
00085    else if(index == 1)
00086    {
00087       ug = fgTrk2U;
00088       vg = fgTrk2V;
00089    }
00090 
00091    if(!ug || !vg)
00092    {
00093       return;
00094    }
00095 
00096    const StripVec uvec = GetStrip(track, record, "U");
00097    const StripVec vvec = GetStrip(track, record, "V");
00098    
00099    if(uvec.empty() || vvec.empty())
00100    {
00101       cerr << "EventHitTab::SetTrack() - no strips matching a track" << endl;
00102       return;
00103    }
00104    
00105    ug -> Set(uvec.size());
00106    vg -> Set(vvec.size());
00107 
00108    for(Draw::SIter sit = uvec.begin(); sit != uvec.end(); ++sit)
00109    {
00110       ug -> SetPoint(std::distance(uvec.begin(), sit), (*sit) -> ZPos(), (*sit) -> TPos());
00111    }
00112 
00113    for(Draw::SIter sit = vvec.begin(); sit != vvec.end(); ++sit)
00114    {
00115       vg -> SetPoint(std::distance(vvec.begin(), sit), (*sit) -> ZPos(), (*sit) -> TPos());
00116    }
00117 }   

void Anp::EventHitTab::ZoomIn  )  [virtual]
 

Reimplemented from Anp::EventTab.

Definition at line 314 of file EventHitTab.cxx.

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

00315 {
00316    fDraw = true;
00317 
00318    static double ZoomBorderScale = 1.2;
00319    static double ZoomBorderWidth = 0.1;
00320 
00321    static bool init = false;
00322    if(!init)
00323    {
00324       init = true;
00325       ZoomBorderScale = Draw::Read("ZoomBorderScale", ZoomBorderScale, fConfig);
00326       ZoomBorderWidth = Draw::Read("ZoomBorderWidth", ZoomBorderWidth, fConfig);
00327 
00328       if(ZoomBorderScale < 1.0) ZoomBorderScale = 1.2;
00329       if(ZoomBorderWidth < 0.0) ZoomBorderWidth = 0.1;
00330    }
00331 
00332    if(fSpan.InitU())
00333    {
00334       fSpan.SetRangeU(f2hU -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00335    }
00336    if(fSpan.InitZ())
00337    {
00338       fSpan.SetRangeZ(f2hU -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00339    }
00340    if(fSpan.InitV())
00341    {
00342       fSpan.SetRangeV(f2hV -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00343    }
00344    if(fSpan.InitZ())
00345    {
00346       fSpan.SetRangeZ(f2hV -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00347    }
00348 }

void Anp::EventHitTab::ZoomOut  )  [virtual]
 

Reimplemented from Anp::EventTab.

Definition at line 351 of file EventHitTab.cxx.

References f2hU, f2hV, and fDraw.

00352 {
00353    fDraw = true;
00354 
00355    f2hU -> GetXaxis() -> UnZoom();
00356    f2hU -> GetYaxis() -> UnZoom();
00357 
00358    f2hV -> GetXaxis() -> UnZoom();
00359    f2hV -> GetYaxis() -> UnZoom();
00360 }


Member Data Documentation

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

Definition at line 65 of file EventHitTab.h.

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

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

Definition at line 66 of file EventHitTab.h.

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

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

Definition at line 60 of file EventHitTab.h.

Referenced by Expose(), and Init().

Registry Anp::EventHitTab::fConfig [private]
 

Definition at line 51 of file EventHitTab.h.

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

bool Anp::EventHitTab::fDraw [private]
 

Definition at line 56 of file EventHitTab.h.

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

TGraph* Anp::EventHitTab::fgShwU [private]
 

Definition at line 68 of file EventHitTab.h.

Referenced by Expose(), Init(), Reset(), and SetShowers().

TGraph* Anp::EventHitTab::fgShwV [private]
 

Definition at line 69 of file EventHitTab.h.

Referenced by Expose(), Init(), Reset(), and SetShowers().

TGraph* Anp::EventHitTab::fgTrk1U [private]
 

Definition at line 71 of file EventHitTab.h.

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

TGraph* Anp::EventHitTab::fgTrk1V [private]
 

Definition at line 72 of file EventHitTab.h.

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

TGraph* Anp::EventHitTab::fgTrk2U [private]
 

Definition at line 74 of file EventHitTab.h.

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

TGraph* Anp::EventHitTab::fgTrk2V [private]
 

Definition at line 75 of file EventHitTab.h.

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

bool Anp::EventHitTab::fInit [private]
 

Definition at line 55 of file EventHitTab.h.

Referenced by Init().

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

Definition at line 53 of file EventHitTab.h.

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

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

Definition at line 62 of file EventHitTab.h.

Referenced by Expose(), and Init().

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

Definition at line 63 of file EventHitTab.h.

Referenced by Expose(), and Init().

DrawSpan Anp::EventHitTab::fSpan [private]
 

Definition at line 58 of file EventHitTab.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:31 2010 for loon by  doxygen 1.3.9.1