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

GfxStripList Class Reference

A graphical StripList. This is a TObject which holds a collection of GfxStrip. More...

#include <GfxStripList.h>

Inheritance diagram for GfxStripList:

GfxBase GfxBase List of all members.

Public Member Functions

 GfxStripList ()
 ~GfxStripList ()
void Init (PageDisplay &pd, EVD &mp)
void Configure (Mint &mint)
void Draw (Option_t *option="")
void ExecuteEvent (int event, int, int, GfxStrip *hit)
void ExecuteEvent (int, int, int)
GfxStripListCfgGetCfg ()
RangeDoubleGetColorRange ()
bool StripMasked (const CandStripHandle &csh) const
int GetStripColor (const CandStripHandle &csh) const
MintGetMint ()
EVDGetEVD ()
void HideStrips (bool hide=true)
bool StripsHidden ()
 GfxStripList ()
 ~GfxStripList ()
void Init (PageDisplay &pd, MultiPage &mp)
void Configure (Mint &mint)
void Draw (Option_t *option="")
void ExecuteEventStrip (int event, int px, int py, GfxStrip *hit)
GfxStripListCfgGetCfg ()
RangeDoubleGetColorRange ()
bool StripMasked (const CandStripHandle &csh) const
int GetStripColor (const CandStripHandle &csh) const
MintGetMint ()
void HideStrips (bool hide=true)
bool StripsHidden ()

Private Types

typedef std::vector< GfxStrip * > GfxStripVector_t
typedef std::vector< GfxStrip * > GfxStripVector_t

Private Member Functions

void ReConfigure (void)
void ClearStripList ()
void SetTQfromButton ()
void ReConfigure (void)
void ClearStripList ()
void SetTQfromButton ()

Private Attributes

GfxStripListCfgfCfg
SigC::Ptr< RangeDoublefColorRange
PageDisplayfPageDisplay
EVDfEVD
MintfMint
TClonesArray * fStripsCA
GfxStripVector_t fStrips
bool fHideStrips
GfxStripListCfgfCfg
SigC::Ptr< RangeDoublefColorRange
PageDisplayfPageDisplay
MultiPagefMultiPage
MintfMint
TClonesArray * fStripCA

Detailed Description

A graphical StripList. This is a TObject which holds a collection of GfxStrip.

Id
GfxStripList.h,v 1.4 2003/10/23 19:50:21 musser Exp

EVD

Contact: bv@bnl.gov

Created on: Wed Aug 21 17:00:47 2002

Definition at line 36 of file EventDisplay/GfxStripList.h.


Member Typedef Documentation

typedef std::vector<GfxStrip*> GfxStripList::GfxStripVector_t [private]
 

Definition at line 73 of file Midad/MultiPage/GfxStripList.h.

typedef std::vector<GfxStrip*> GfxStripList::GfxStripVector_t [private]
 

Definition at line 75 of file EventDisplay/GfxStripList.h.


Constructor & Destructor Documentation

GfxStripList::GfxStripList  ) 
 

GfxStripList

Definition at line 51 of file EventDisplay/GfxStripList.cxx.

References fCfg, fStripsCA, RecArrayAllocator::GetArray(), RecArrayAllocator::Instance(), GfxCfg::modified_signal, and ReConfigure().

00052     : fCfg(0)
00053     , fColorRange(0)
00054     , fEVD(0)
00055     , fMint(0)
00056     , fHideStrips(false)
00057 {
00058     fCfg = new GfxStripListCfg();
00059     fCfg->modified_signal.connect
00060         (slot_class(*this,&GfxStripList::ReConfigure));
00061         RecArrayAllocator& a = RecArrayAllocator::Instance();
00062       fStripsCA = a.GetArray("GfxStrip");
00063 }

GfxStripList::~GfxStripList  ) 
 

Definition at line 65 of file EventDisplay/GfxStripList.cxx.

References fStripsCA, RecArrayAllocator::Instance(), and RecArrayAllocator::ReleaseArray().

00066 {
00067    RecArrayAllocator& a = RecArrayAllocator::Instance();
00068    if (fStripsCA) { a.ReleaseArray(fStripsCA); fStripsCA = 0; }
00069 }

GfxStripList::GfxStripList  ) 
 

GfxStripList::~GfxStripList  ) 
 


Member Function Documentation

void GfxStripList::ClearStripList  )  [private]
 

void GfxStripList::ClearStripList  )  [private]
 

Definition at line 155 of file EventDisplay/GfxStripList.cxx.

References fStrips, and fStripsCA.

Referenced by Configure().

00156 {
00157     fStrips.clear();
00158     fStripsCA->Clear("C");
00159 }

void GfxStripList::Configure Mint mint  )  [virtual]
 

This is called every time the Mint object changes. The Gfx object should pull data from Mint to configure itself. Mint will exist for the lifetime of the Gfx object.

Reimplemented from GfxBase.

void GfxStripList::Configure Mint mint  )  [virtual]
 

This is called every time the Mint object changes. The Gfx object should pull data from Mint to configure itself. Mint will exist for the lifetime of the Gfx object.

Reimplemented from GfxBase.

Definition at line 97 of file EventDisplay/GfxStripList.cxx.

References ClearStripList(), fMint, fPageDisplay, fStrips, fStripsCA, RangeControl< TYPE >::GetRange(), GuiSlider::GetRangeCtrl(), Mint::GetStrips(), PageDisplay::GetTimeSlider(), MSG, RangeDouble, ReConfigure(), s(), select_strip(), and time_range().

00098 {
00099     fMint = &mint;
00100     this->ClearStripList();
00101     if (fHideStrips) return;
00102     const CandStripListHandle* cslh = mint.GetStrips();
00103     if (!cslh) { 
00104       MSG("EVD",Msg::kVerbose) << "No CandStripList\n";
00105         return;
00106     }
00107 
00108     RangeDouble& time_range = 
00109         fPageDisplay->GetTimeSlider().GetRangeCtrl().GetRange();
00110  
00111     Mint::StripVector_t sv = CDL2STLvector<CandStripHandle>(*cslh);
00112 
00113     Mint::StripVector_t::iterator it, first = sv.begin(), middle, last = sv.end();
00114     Slot1<bool,const CandStripHandle*> s =
00115         bind(slot(select_strip),this->GetPlaneView(), &time_range);
00116     middle = std::partition(first,last,s);   
00117 
00118     for (it = first; it != middle; ++it) {
00119     
00120       bool addstrip=true;
00121       if(addstrip){
00122         int last = fStripsCA->GetLast()+1;
00123         new ((*fStripsCA)[last]) GfxStrip(**it,*this);     
00124         GfxStrip* gs = dynamic_cast<GfxStrip*>(fStripsCA->UncheckedAt(last));
00125         fStrips.push_back( gs);
00126       }
00127     }
00128     this->ReConfigure();
00129 }

void GfxStripList::Draw Option_t *  option = ""  ) 
 

void GfxStripList::Draw Option_t *  option = ""  ) 
 

Loop over our list and Draw them

Definition at line 142 of file EventDisplay/GfxStripList.cxx.

References done(), fStrips, EVD::GetDrawAll(), EVD::GetDrawGhosts(), GetEVD(), EVD::GetGhostColor(), and option.

00143 {
00145     GfxStripVector_t::iterator it, done = fStrips.end();
00146     for (it = fStrips.begin(); it != done; ++it) {
00147       if(GetEVD()->GetDrawAll() || GetEVD()->GetDrawGhosts()  || (*it)->GetColor()!=GetEVD()->GetGhostColor() ){
00148         (*it)->Draw(option);
00149       }
00150     }
00151 }

void GfxStripList::ExecuteEvent int  ,
int  ,
int 
[inline]
 

Definition at line 50 of file EventDisplay/GfxStripList.h.

00050 {;}

void GfxStripList::ExecuteEvent int  event,
int  ,
int  ,
GfxStrip hit
 

Definition at line 161 of file EventDisplay/GfxStripList.cxx.

References DigitText::AddCandDigitText(), PlexStripEndId::AsString(), DigitText::Clear(), fEVD, fMint, Form(), fPageDisplay, CandStripHandle::GetBegTime(), CandStripHandle::GetCharge(), EVD::GetDigitText(), PageDisplay::GetDigitText(), MomNavigator::GetFragment(), Mint::GetJobC(), CandStripHandle::GetNDigit(), CandStripHandle::GetPlane(), GfxStrip::GetStrip(), CandStripHandle::GetStripEndId(), CandStripHandle::GetTime(), JobC::Mom, s(), Mint::SetPickedStrip(), and Mint::SetSelectedDigits().

Referenced by GfxStrip::ExecuteEvent().

00162 {
00163     switch (event) {
00164     case kMouseEnter: {
00165         const CandStripHandle& csh = gfx_strip->GetStrip();
00166         PlexStripEndId seid = csh.GetStripEndId();
00167         const char* s;
00168         SimSnarlRecord *ssr = 
00169           dynamic_cast<SimSnarlRecord*>(fMint->GetJobC().Mom.GetFragment("SimSnarlRecord"));
00170         if (ssr){
00171           TruthHelper truthHelp(&(fMint->GetJobC().Mom));
00172           s = Form("Strip:   (%s)  %d digit%s, plane=%d, demux charge=%.1f, t0=%.1f ns, <t>=%.1f ns,  Best NeuKin index match:%d", 
00173                                seid.AsString(),
00174                                csh.GetNDigit(), 
00175                                csh.GetNDigit() == 1 ? "" : "s",
00176                                csh.GetPlane(),
00177                                csh.GetCharge(), 
00178                                csh.GetBegTime()/Munits::ns, 
00179                                csh.GetTime()/Munits::ns,
00180                                truthHelp.GetBestNeuMatch(csh));
00181 
00182         }
00183         else{
00184           s = Form("Strip: %d digit%s, plane=%d, demux charge=%.1f, t0=%.1f ns, <t>=%.1f ns (%s)",
00185                                csh.GetNDigit(), csh.GetNDigit() == 1 ? "" : "s",
00186                                csh.GetPlane(),
00187                                csh.GetCharge(), csh.GetBegTime()/Munits::ns, 
00188                                csh.GetTime()/Munits::ns, seid.AsString());
00189         }
00190         text_info.emit(s);
00191 
00192         vector<const CandDigitHandle*> dv = CDL2STLvector<CandDigitHandle>(csh);
00193         int siz = dv.size();
00194         if (!siz) break;
00195 
00196         DigitText* dt = fPageDisplay->GetDigitText();
00197         if (dt) {
00198             dt->Clear();
00199             for (int ind=0; ind < siz; ++ind)
00200                 dt->AddCandDigitText(*dv[ind]);
00201         }
00202          DigitText* JAMdt = fEVD->GetDigitText();
00203         if (JAMdt) {
00204             JAMdt->Clear();
00205             for (int ind=0; ind < siz; ++ind)
00206                 JAMdt->AddCandDigitText(*dv[ind]);
00207         }
00208       if (fMint) {
00209             fMint->SetPickedStrip(csh);
00210             fMint->SetSelectedDigits(dv);
00211         }
00212         
00213         break;
00214     }
00215     default: // nothing
00216         break;
00217     }
00218 }

void GfxStripList::ExecuteEventStrip int  event,
int  px,
int  py,
GfxStrip hit
 

Definition at line 143 of file Midad/MultiPage/GfxStripList.cxx.

References DigitText::AddCandDigitText(), PlexStripEndId::AsString(), DigitText::Clear(), fMint, Form(), fPageDisplay, CandStripHandle::GetBegTime(), CandStripHandle::GetCharge(), PageDisplay::GetDigitText(), CandStripHandle::GetNDigit(), CandStripHandle::GetPlane(), GfxStrip::GetStrip(), CandStripHandle::GetStripEndId(), CandStripHandle::GetTime(), s(), Mint::SetPickedStrip(), and Mint::SetSelectedDigits().

00145 {
00146     switch (event) {
00147     case kMouseEnter: {
00148         const CandStripHandle& csh = gfx_strip->GetStrip();
00149         PlexStripEndId seid = csh.GetStripEndId();
00150         const char* s = Form("Strip: %d digit%s, plane=%d, demux charge=%.1f, t0=%.1f ns, <t>=%.1f ns (%s)",
00151                              csh.GetNDigit(), csh.GetNDigit() == 1 ? "" : "s",
00152                              csh.GetPlane(),
00153                              csh.GetCharge(), csh.GetBegTime()/Munits::ns, 
00154                              csh.GetTime()/Munits::ns, seid.AsString());
00155         text_info.emit(s);
00156 
00157         vector<const CandDigitHandle*> dv = CDL2STLvector<CandDigitHandle>(csh);
00158         int siz = dv.size();
00159         if (!siz) break;
00160 
00161         DigitText* dt = fPageDisplay->GetDigitText();
00162         if (dt) {
00163             dt->Clear();
00164             for (int ind=0; ind < siz; ++ind)
00165                 dt->AddCandDigitText(*dv[ind]);
00166         }
00167         if (fMint) {
00168             fMint->SetPickedStrip(csh);
00169             fMint->SetSelectedDigits(dv);
00170         }
00171         
00172         break;
00173     }
00174     default: // nothing
00175         break;
00176     }
00177 }

GfxStripListCfg& GfxStripList::GetCfg  )  [inline, virtual]
 

Return the configurable associated with this Gfx. Some things may be set which are meaningless for a particular Gfx. The sub class MUST implement this because there is no way to create the base class CfgConfigurable.

Implements GfxBase.

Definition at line 49 of file Midad/MultiPage/GfxStripList.h.

00049 { return *fCfg; }

GfxStripListCfg& GfxStripList::GetCfg  )  [inline, virtual]
 

Return the configurable associated with this Gfx. Some things may be set which are meaningless for a particular Gfx. The sub class MUST implement this because there is no way to create the base class CfgConfigurable.

Implements GfxBase.

Definition at line 52 of file EventDisplay/GfxStripList.h.

Referenced by GfxStrip::ConfigGui(), GfxStrip::Configure(), GfxStrip::ModifyCoords(), and GfxStrip::Paint().

00052 { return *fCfg; }

RangeDouble& GfxStripList::GetColorRange  )  [inline]
 

Definition at line 51 of file Midad/MultiPage/GfxStripList.h.

References RangeDouble.

00051 { return *fColorRange; }

RangeDouble& GfxStripList::GetColorRange  )  [inline]
 

Definition at line 54 of file EventDisplay/GfxStripList.h.

References RangeDouble.

00054 { return *fColorRange; }

EVD* GfxStripList::GetEVD  )  [inline]
 

Definition at line 58 of file EventDisplay/GfxStripList.h.

Referenced by Draw(), and GfxStrip::SetColor().

00058 {return fEVD;}

Mint& GfxStripList::GetMint  )  [inline]
 

Definition at line 54 of file Midad/MultiPage/GfxStripList.h.

00054 { return *fMint; }

Mint& GfxStripList::GetMint  )  [inline]
 

Definition at line 57 of file EventDisplay/GfxStripList.h.

Referenced by GfxStrip::GetRelativeValue().

00057 { return *fMint; }

int GfxStripList::GetStripColor const CandStripHandle csh  )  const
 

int GfxStripList::GetStripColor const CandStripHandle csh  )  const
 

Definition at line 241 of file EventDisplay/GfxStripList.cxx.

References fColorRange, CandStripHandle::GetCharge(), ViewState::GetColorSemantic(), Rainbow::GetRelativeColor(), CandStripHandle::GetTime(), GfxBase::GetViewState(), and StripMasked().

Referenced by GfxStrip::SetColor().

00242 {
00243     if (!fColorRange) return false;
00244 
00245     static Rainbow rainbow;
00246 
00247     if (this->StripMasked(csh)) return 0;
00248 
00249     double val=0;
00250     switch (this->GetViewState()->GetColorSemantic()) {
00251     case ViewState::color_is_time:
00252         val = csh.GetTime();
00253         break;
00254     case ViewState::color_is_charge:
00255         val = csh.GetCharge();
00256         break;
00257     default:
00258         return 0;
00259         break;
00260     }
00261     return rainbow.GetRelativeColor(fColorRange->Relative(val));
00262 }

void GfxStripList::HideStrips bool  hide = true  ) 
 

void GfxStripList::HideStrips bool  hide = true  ) 
 

Definition at line 263 of file EventDisplay/GfxStripList.cxx.

References fEVD, fHideStrips, GfxBase::GetGraphicsView(), ReConfigure(), and EVD::UpdateCanvas().

00264 {
00265     fHideStrips = hide;
00266     this->ReConfigure();
00267     if(GetGraphicsView()==GraphicsView::kVZ)fEVD->UpdateCanvas();
00268 }

void GfxStripList::Init PageDisplay pd,
MultiPage mp
[virtual]
 

Reimplemented from GfxBase.

Definition at line 67 of file Midad/MultiPage/GfxStripList.cxx.

References ViewState::color_semantic, fColorRange, fMultiPage, fPageDisplay, MultiPage::GetColorRangeControl(), RangeControl< TYPE >::GetRange(), GfxBase::GetViewState(), ReConfigure(), and ViewState::spatial_metric.

00068 {
00069     fColorRange = &mp.GetColorRangeControl(this->GetPlaneView()).GetRange();
00070     ViewState* vs = this->GetViewState();
00071     vs->color_semantic.connect(slot_class(*this,&GfxStripList::ReConfigure));
00072     vs->spatial_metric.connect(slot_class(*this,&GfxStripList::ReConfigure));
00073     fPageDisplay = &pd;
00074     fMultiPage = &mp;
00075 }

void GfxStripList::Init PageDisplay pd,
EVD mp
[virtual]
 

Reimplemented from GfxBase.

Definition at line 71 of file EventDisplay/GfxStripList.cxx.

References ViewState::color_semantic, fColorRange, fEVD, fPageDisplay, EVD::GetColorRangeControl(), RangeControl< TYPE >::GetRange(), GfxBase::GetViewState(), ReConfigure(), and ViewState::spatial_metric.

00072 {
00073     fColorRange = &mp.GetColorRangeControl(this->GetPlaneView()).GetRange();
00074     ViewState* vs = this->GetViewState();
00075     vs->color_semantic.connect(slot_class(*this,&GfxStripList::ReConfigure));
00076     vs->spatial_metric.connect(slot_class(*this,&GfxStripList::ReConfigure));
00077     fPageDisplay = &pd;
00078     fEVD = &mp;
00079 }

void GfxStripList::ReConfigure void   )  [private]
 

void GfxStripList::ReConfigure void   )  [private]
 

Definition at line 131 of file EventDisplay/GfxStripList.cxx.

References done(), and fStrips.

Referenced by Configure(), GfxStripList(), HideStrips(), and Init().

00132 {
00133     if (!fMint) return;
00134 
00135     if (fHideStrips) return;
00136 
00137     // configure all GfxStrips
00138     GfxStripVector_t::iterator it, done = fStrips.end();
00139     for (it = fStrips.begin(); it != done; ++it) (*it)->Configure();
00140 }

void GfxStripList::SetTQfromButton  )  [private]
 

void GfxStripList::SetTQfromButton  )  [private]
 

bool GfxStripList::StripMasked const CandStripHandle csh  )  const
 

bool GfxStripList::StripMasked const CandStripHandle csh  )  const
 

Definition at line 220 of file EventDisplay/GfxStripList.cxx.

References fColorRange, CandStripHandle::GetCharge(), ViewState::GetColorSemantic(), CandStripHandle::GetTime(), and GfxBase::GetViewState().

Referenced by GetStripColor().

00221 {
00222     if (!fColorRange) return false;
00223 
00224     double val=0;
00225     switch (this->GetViewState()->GetColorSemantic()) {
00226     case ViewState::color_is_time:
00227         val = csh.GetTime();
00228         break;
00229     case ViewState::color_is_charge:
00230         val = csh.GetCharge();
00231         break;
00232     default:
00233         return false;
00234         break;
00235     }
00236 
00237     bool ret = fColorRange->InRange(val);
00238     return !ret;
00239 }

bool GfxStripList::StripsHidden  )  [inline]
 

Definition at line 57 of file Midad/MultiPage/GfxStripList.h.

00057 { return fHideStrips; }

bool GfxStripList::StripsHidden  )  [inline]
 

Definition at line 60 of file EventDisplay/GfxStripList.h.

00060 { return fHideStrips; }


Member Data Documentation

GfxStripListCfg* GfxStripList::fCfg [private]
 

Definition at line 65 of file Midad/MultiPage/GfxStripList.h.

GfxStripListCfg* GfxStripList::fCfg [private]
 

Definition at line 68 of file EventDisplay/GfxStripList.h.

Referenced by GfxStripList().

SigC::Ptr<RangeDouble> GfxStripList::fColorRange [private]
 

Definition at line 67 of file Midad/MultiPage/GfxStripList.h.

SigC::Ptr<RangeDouble> GfxStripList::fColorRange [private]
 

Definition at line 70 of file EventDisplay/GfxStripList.h.

Referenced by GetStripColor(), Init(), and StripMasked().

EVD* GfxStripList::fEVD [private]
 

Definition at line 72 of file EventDisplay/GfxStripList.h.

Referenced by ExecuteEvent(), HideStrips(), and Init().

bool GfxStripList::fHideStrips [private]
 

Definition at line 76 of file Midad/MultiPage/GfxStripList.h.

Referenced by HideStrips().

Mint* GfxStripList::fMint [private]
 

Definition at line 70 of file Midad/MultiPage/GfxStripList.h.

Mint* GfxStripList::fMint [private]
 

Definition at line 73 of file EventDisplay/GfxStripList.h.

Referenced by Configure(), ExecuteEvent(), and ExecuteEventStrip().

MultiPage* GfxStripList::fMultiPage [private]
 

Definition at line 69 of file Midad/MultiPage/GfxStripList.h.

Referenced by Init().

PageDisplay* GfxStripList::fPageDisplay [private]
 

Definition at line 68 of file Midad/MultiPage/GfxStripList.h.

PageDisplay* GfxStripList::fPageDisplay [private]
 

Definition at line 71 of file EventDisplay/GfxStripList.h.

Referenced by Configure(), ExecuteEvent(), ExecuteEventStrip(), and Init().

TClonesArray* GfxStripList::fStripCA [private]
 

Definition at line 72 of file Midad/MultiPage/GfxStripList.h.

GfxStripVector_t GfxStripList::fStrips [private]
 

Definition at line 74 of file Midad/MultiPage/GfxStripList.h.

Referenced by ClearStripList(), Configure(), Draw(), and ReConfigure().

TClonesArray* GfxStripList::fStripsCA [private]
 

Definition at line 74 of file EventDisplay/GfxStripList.h.

Referenced by ClearStripList(), Configure(), GfxStripList(), and ~GfxStripList().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 11:58:25 2007 for loon by  doxygen 1.3.9.1