#include <Alieve/TPCData.h>
-#include <TH1S.h>
-#include <TH2S.h>
-#include <TVirtualPad.h>
-#include <TStopwatch.h>
-
-#include <TGLDrawFlags.h>
-#include <GL/gl.h>
+#include <TGLRnrCtx.h>
+#include <TGLSelectRecord.h>
+#include <TGLIncludes.h>
using namespace Reve;
using namespace Alieve;
/**************************************************************************/
-Bool_t TPCSector2DGL::SetModel(TObject* obj)
+Bool_t TPCSector2DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
-#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
- if(set_model(obj, "Alieve::TPCSector2D")) {
-#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
- if(SetModelCheckClass(obj, "Alieve::TPCSector2D")) {
-#else
if(SetModelCheckClass(obj, Alieve::TPCSector2D::Class())) {
-#endif
fSector = (TPCSector2D*) fExternalObj;
return kTRUE;
}
void TPCSector2DGL::SetBBox()
{
-#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
- set_axis_aligned_bbox(((TPCSector2D*)fExternalObj)->AssertBBox());
-#else
SetAxisAlignedBBox(((TPCSector2D*)fExternalObj)->AssertBBox());
-#endif
}
/**************************************************************************/
-void TPCSector2DGL::ProcessSelection(UInt_t* ptr, TGLViewer*, TGLScene*)
+void TPCSector2DGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/,
+ TGLSelectRecord & rec)
{
- if (ptr[0] != 3) return;
- ptr += 3; // skip n, zmin, zmax
- Int_t row = ptr[1];
- Int_t pad = ptr[2];
- Int_t seg = fSector->fSectorID;
- if (row < 0 || row >= TPCSectorData::GetNAllRows()) return;
+ if (rec.GetN() != 3) return;
+ Int_t row = rec.GetItem(1);
+ Int_t pad = rec.GetItem(2);
+ if (row < 0 || row >= TPCSectorData::GetNAllRows()) return;
if (pad < 0 || pad >= TPCSectorData::GetNPadsInRow(row)) return;
- // EVE -> Std convention
- Int_t sseg = seg, srow = row;
- if (row >= TPCSectorData::GetInnSeg().GetNRows()) {
- sseg += 18;
- srow -= TPCSectorData::GetInnSeg().GetNRows();
- }
- switch (fSector->fPickMode)
- {
- case 0: {
- printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
- sseg, srow, pad);
- break;
- }
- case 1: {
- if (fSectorData == 0) return;
- Int_t mint = fSector->GetMinTime();
- Int_t maxt = fSector->GetMaxTime();
- TH1S* h = new TH1S(Form("Seg%d_Row%d_Pad%d", sseg, srow, pad),
- Form("Segment %d, Row %d, Pad %d", sseg, srow, pad),
- maxt - mint +1 , mint, maxt);
- h->SetXTitle("Time");
- h->SetYTitle("ADC");
- TPCSectorData::PadIterator i = fSectorData->MakePadIterator(row, pad);
- while (i.Next())
- h->Fill(i.Time(), i.Signal());
- h->Draw();
- gPad->Modified();
- gPad->Update();
- break;
- }
- case 2: {
- if (fSectorData == 0) return;
- Int_t mint = fSector->GetMinTime();
- Int_t maxt = fSector->GetMaxTime();
- Int_t npad = TPCSectorData::GetNPadsInRow(row);
- TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
- Form("Segment %d, Row %d", sseg, srow),
- maxt - mint +1 , mint, maxt,
- npad, 0, npad - 1);
- h->SetXTitle("Time");
- h->SetYTitle("Pad");
- h->SetZTitle("ADC");
- TPCSectorData::RowIterator i = fSectorData->MakeRowIterator(row);
- while (i.NextPad())
- while (i.Next())
- h->Fill(i.Time(), i.Pad(), i.Signal());
- h->Draw();
- gPad->Modified();
- gPad->Update();
- break;
- }
- } // switch
+ fSector->PadSelected(row, pad);
}
/**************************************************************************/
-void TPCSector2DGL::DirectDraw(const TGLDrawFlags& flags) const
+void TPCSector2DGL::DirectDraw(TGLRnrCtx& rnrCtx) const
{
// Actual GL drawing.
const TPCSectorData::SegmentInfo& o1Seg = TPCSectorData::GetOut1Seg();
const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
- if(flags.SecSelection()) {
+ if(rnrCtx.SecSelection()) {
if(fSector->fRnrInn) DisplayNamedQuads(iSeg, 0, 0);
if(fSector->fRnrOut1) DisplayNamedQuads(o1Seg, iSeg.GetNMaxPads(), 0);