gROOT->ProcessLine(Form("clusters_from_label(%d);", fLabel));
}
+/**************************************************************************/
+
+void Track::CtrlClicked(Reve::Track* track)
+{
+ Emit("CtrlClicked(Reve::Track*)", (Long_t)track);
+}
+
/**************************************************************************/
/**************************************************************************/
TPolyMarker3D::Paint(option);
}
if(fRnrTracks) {
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
if((*i)->GetRnrElement())
(*i)->GetObject()->Paint(option);
}
void TrackList::MakeTracks()
{
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->MakeTrack();
}
gReve->Redraw3D();
void TrackList::MakeMarkers()
{
Reset(fChildren.size());
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
Track& t = *((Track*)(*i));
if(t.GetN() > 0)
SetNextPoint(t.fV.x, t.fV.y, t.fV.z);
{
Width_t oldw = fRnrStyle->fWidth;
fRnrStyle->fWidth = w;
- for (lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
Track& t = *((Track*)(*i));
if (t.GetLineWidth() == oldw)
t.SetLineWidth(w);
Float_t maxptsq = max_pt*max_pt;
Float_t ptsq;
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
ptsq = ((Track*)(*i))->fP.Perp2();
(*i)->SetRnrElement(ptsq >= minptsq && ptsq <= maxptsq);
}
void TrackList::ImportHits()
{
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->ImportHits();
}
}
void TrackList::ImportClusters()
{
- for(lpRE_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
+ for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
((Track*)(*i))->ImportClusters();
}
}
+
+/**************************************************************************/
+/**************************************************************************/
+/**************************************************************************/
+
+#include "RGEditor.h"
+
+//______________________________________________________________________
+// TrackCounter
+//
+
+ClassImp(TrackCounter)
+
+TrackCounter::TrackCounter(const Text_t* name, const Text_t* title) :
+ RenderElement(),
+ TNamed(name, title),
+
+ fBadLineStyle (6),
+ fClickAction (CA_ToggleTrack),
+ fAllTracks (0),
+ fGoodTracks (0),
+ fTrackLists ()
+{
+ TQObject::Connect("Reve::Track", "CtrlClicked(Reve::Track*)",
+ "Reve::TrackCounter", this, "DoTrackAction(Reve::Track*)");
+}
+
+TrackCounter::~TrackCounter()
+{
+ TQObject::Disconnect("Reve::Track", "DoTrackAction(Reve::Track*)");
+}
+
+/**************************************************************************/
+
+void TrackCounter::Reset()
+{
+ printf("TrackCounter::Reset()\n");
+ fAllTracks = 0;
+ fGoodTracks = 0;
+ TIter next(&fTrackLists);
+ TrackList* tlist;
+ while ((tlist = dynamic_cast<TrackList*>(next())))
+ tlist->RemoveParent(this);
+ fTrackLists.Clear();
+}
+
+void TrackCounter::RegisterTracks(TrackList* tlist, Bool_t goodTracks)
+{
+ // printf("TrackCounter::RegisterTracks '%s', %s\n",
+ // tlist->GetObject()->GetName(), goodTracks ? "good" : "bad");
+
+ tlist->AddParent(this);
+ fTrackLists.Add(tlist);
+
+ List_i i = tlist->BeginChildren();
+ while (i != tlist->EndChildren())
+ {
+ Track* t = dynamic_cast<Track*>(*i);
+ if (t != 0)
+ {
+ if (goodTracks)
+ {
+ ++fGoodTracks;
+ } else {
+ t->SetLineStyle(fBadLineStyle);
+ }
+ ++fAllTracks;
+ }
+ ++i;
+ }
+}
+
+void TrackCounter::DoTrackAction(Track* track)
+{
+ // !!!! No check done if ok.
+ // !!!! Should also override RemoveElementLocal
+ // !!!! But then ... should also sore local information if track is ok.
+
+ switch (fClickAction)
+ {
+
+ case CA_PrintTrackInfo:
+ {
+ printf("Track '%s'\n", track->GetObject()->GetName());
+ Vector &v = track->fV, &p = track->fP;
+ printf(" Vx=%f, Vy=%f, Vz=%f; Pt=%f, Pz=%f, phi=%f)\n",
+ v.x, v.y, v.z, p.Perp(), p.z, TMath::RadToDeg()*p.Phi());
+ printf(" <other information should be printed ... full AliESDtrack>\n");
+ break;
+ }
+
+ case CA_ToggleTrack:
+ {
+ if (track->GetLineStyle() == 1)
+ {
+ track->SetLineStyle(fBadLineStyle);
+ --fGoodTracks;
+ } else {
+ track->SetLineStyle(1);
+ ++fGoodTracks;
+ }
+ gReve->Redraw3D();
+
+ printf("TrackCounter::CountTrack All=%d, Good=%d, Bad=%d\n",
+ fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
+
+ if (gReve->GetEditor()->GetModel() == GetObject())
+ gReve->EditRenderElement(this);
+
+ break;
+ }
+
+ } // end switch fClickAction
+}
class TrackRnrStyle;
class TrackList;
-class Track : public Line
+class Track : public Line, public TQObject
{
friend class TrackList;
+ friend class TrackCounter;
Track(const Track&); // Not implemented
Track& operator=(const Track&); // Not implemented
void ImportHits(); // *MENU*
void ImportClusters(); // *MENU*
+ //--------------------------------
+
+ void CtrlClicked(Reve::Track*); // *SIGNAL*
+
ClassDef(Track, 1);
}; // endclass Track
// TrackList has Get/Set methods for RnrStlye and
// TrackListEditor provides editor access to them.
-class TrackRnrStyle : public TObject
+class TrackRnrStyle : public TObject
{
public:
Color_t fColor;
ClassDef(TrackList, 1);
};
+/**************************************************************************/
+// TrackCounter
+/**************************************************************************/
+
+class TrackCounter : public RenderElement, public TNamed
+{
+ friend class TrackCounterEditor;
+
+public:
+ enum ClickAction_e { CA_PrintTrackInfo, CA_ToggleTrack };
+
+private:
+ TrackCounter(const TrackCounter&); // Not implemented
+ TrackCounter& operator=(const TrackCounter&); // Not implemented
+
+protected:
+ Int_t fBadLineStyle;
+ Int_t fClickAction;
+
+ Int_t fAllTracks;
+ Int_t fGoodTracks;
+
+ TList fTrackLists;
+
+public:
+ TrackCounter(const Text_t* name="TrackCounter", const Text_t* title="");
+ virtual ~TrackCounter();
+
+ void Reset();
+
+ void RegisterTracks(TrackList* tlist, Bool_t goodTracks);
+
+ void DoTrackAction(Track* track);
+
+ Int_t GetClickAction() const { return fClickAction; }
+ void SetClickAction(Int_t a) { fClickAction = a; }
+
+ ClassDef(TrackCounter, 1);
+}; // endclass TrackCounter
+
} // namespace Reve