#include <TStyle.h>
+//______________________________________________________________________________
+//
+// Visualization of an ITS module.
+
+ClassImp(AliEveITSModule)
+
Bool_t AliEveITSModule::fgStaticInitDone = kFALSE;
TEveFrameBox* AliEveITSModule::fgSPDFrameBox = 0;
TEveRGBAPalette* AliEveITSModule::fgSDDPalette = 0;
TEveRGBAPalette* AliEveITSModule::fgSSDPalette = 0;
-//______________________________________________________________________________
-// AliEveITSModule
-//
-//
-
-ClassImp(AliEveITSModule)
-
/******************************************************************************/
AliEveITSModule::AliEveITSModule(const Text_t* n, const Text_t* t) :
fID(-1), fDetID(-1),
fLayer(-1), fLadder(-1), fDet(-1),
fDx(0), fDz(0), fDy(0)
-{}
+{
+ // Constructor.
+}
AliEveITSModule::AliEveITSModule(Int_t gid, AliEveITSDigitsInfo* info) :
TEveQuadSet(Form("ITS module %d", gid)),
fLayer(-1), fLadder(-1), fDet(-1),
fDx(0), fDz(0), fDy(0)
{
+ // Constructor with module id and data-source.
+
SetDigitsInfo(info);
SetID(gid);
}
AliEveITSModule::~AliEveITSModule()
{
+ // Destructor.
+
if(fInfo) fInfo->DecRefCount();
}
void AliEveITSModule::InitStatics(AliEveITSDigitsInfo* info)
{
+ // Initialize static variables,
+
if (fgStaticInitDone) return;
fgStaticInitDone = kTRUE;
void AliEveITSModule::SetDigitsInfo(AliEveITSDigitsInfo* info)
{
+ // Set data and geometry source.
+
if (fInfo == info) return;
if (fInfo) fInfo->DecRefCount();
fInfo = info;
void AliEveITSModule::SetID(Int_t gid, Bool_t trans)
{
+ // Set detector id.
+
static const TEveException eH("AliEveITSModule::SetID ");
if(fInfo == 0)
void AliEveITSModule::LoadQuads()
{
- // Here we still use 'z' for the name of axial coordinates.
- // The transforamtion matrix aplied rotates y -> z.
- // We need this as TEveQuadSet offers optimized treatment for
- // quads in the x-y plane.
-
- // printf("its module load quads \n");
+ // Read module data from source and create low-level objects for
+ // visualization - called quads.
TClonesArray *digits = fInfo->GetDigits(fID, fDetID);
Int_t ndigits = digits ? digits->GetEntriesFast() : 0;
void AliEveITSModule::DigitSelected(Int_t idx)
{
- // Override control-click from TEveQuadSet
+ // Override control-click from TEveQuadSet.
DigitBase_t* qb = GetDigit(idx);
TObject* obj = qb->fId.GetObject();
void AliEveITSModule::Print(Option_t* ) const
{
- printf("ID %d, layer %d, ladder %d, det %d \n", fID, fLayer, fLadder, fDetID);
+ // Print object summary information.
+
+ printf("AliEveITSModule: ID %d, layer %d, ladder %d, det %d\n",
+ fID, fLayer, fLadder, fDetID);
}
AliEveITSModule& operator=(const AliEveITSModule&); // Not implemented
protected:
- AliEveITSDigitsInfo* fInfo;
+ AliEveITSDigitsInfo* fInfo; // Source of geometry and data.
- Int_t fID; // Module id
- Int_t fDetID; // Detector id (0~SPD, 1~SDD, 2~SSD)
+ Int_t fID; // Module id.
+ Int_t fDetID; // Detector id (0~SPD, 1~SDD, 2~SSD).
- Int_t fLayer;
- Int_t fLadder;
- Int_t fDet;
+ Int_t fLayer; // Layer (0 - 5).
+ Int_t fLadder; // Ladder.
+ Int_t fDet; // Detector.
- Float_t fDx;
- Float_t fDz;
- Float_t fDy;
+ Float_t fDx; // Digit half-size in x.
+ Float_t fDz; // Digit half-size in z.
+ Float_t fDy; // Digit half-size in y.
- static Bool_t fgStaticInitDone;
+ static Bool_t fgStaticInitDone; // Flag for static variable initialization.
public:
AliEveITSModule(const Text_t* n="AliEveITSModule", const Text_t* t=0);
virtual void Print(Option_t* opt="") const;
- static TEveFrameBox* fgSPDFrameBox;
- static TEveFrameBox* fgSDDFrameBox;
- static TEveFrameBox* fgSSDFrameBox;
+ static TEveFrameBox *fgSPDFrameBox; // Module frame for SPD.
+ static TEveFrameBox *fgSDDFrameBox; // Module frame for SDD.
+ static TEveFrameBox *fgSSDFrameBox; // Module frame for SSD.
- static TEveRGBAPalette* fgSPDPalette;
- static TEveRGBAPalette* fgSDDPalette;
- static TEveRGBAPalette* fgSSDPalette;
+ static TEveRGBAPalette *fgSPDPalette; // Signal to color mapping for SPD.
+ static TEveRGBAPalette *fgSDDPalette; // Signal to color mapping for SDD.
+ static TEveRGBAPalette *fgSSDPalette; // Signal to color mapping for SSD.
- ClassDef(AliEveITSModule, 1);
+ ClassDef(AliEveITSModule, 1); // Visualization of an ITS module.
};
#endif
//______________________________________________________________________________
-// AliEveITSModuleStepper
//
+// Display scaled ITS modules in a paged layout, also providing
+// GL-overaly control GUI.
+
ClassImp(AliEveITSModuleStepper)
fWActiveCol(45),
fFontCol(8)
{
+ // Constructor.
+
// override member from base TEveElementList
fChildClass = AliEveITSScaledModule::Class();
AliEveITSModuleStepper::~AliEveITSModuleStepper()
{
+ // Destructor.
+
gEve->GetGLViewer()->RemoveOverlayElement(this);
fScaleInfo->DecRefCount();
void AliEveITSModuleStepper::Capacity()
{
+ // Make sure we have just enough children (module representations)
+ // to store as many modules as required by the grid-stepper
+ // configuration.
+
Int_t N = fStepper->GetNx()*fStepper->GetNy();
if (N != GetNChildren())
{
Int_t lastpage = fIDs.size()/Nxy();
if(fIDs.size() % Nxy() ) lastpage++;
- Int_t first_lastpage = (lastpage -1)*Nxy();
- if(first > first_lastpage) first = first_lastpage;
+ Int_t firstLastpage = (lastpage - 1)*Nxy();
+ if(first > firstLastpage) first = firstLastpage;
if(first < 0) first = 0;
fPosition = first;
Apply();
void AliEveITSModuleStepper::Start()
{
+ // Go to first page.
+
fPosition = 0;
Apply();
}
void AliEveITSModuleStepper::Next()
{
+ // Go to next page.
+
SetFirst(fPosition + Nxy());
}
void AliEveITSModuleStepper::Previous()
{
- // move to the top left corner first
+ // Go to previous page.
+
SetFirst(fPosition - Nxy());
}
void AliEveITSModuleStepper::End()
{
+ // Go to last page.
+
Int_t lastpage = fIDs.size()/Nxy();
- if(fIDs.size() % Nxy() ) lastpage++;
- fPosition = (lastpage -1)*Nxy();
+ if (fIDs.size() % Nxy()) lastpage++;
+ fPosition = (lastpage - 1)*Nxy();
fStepper->Reset();
Apply();
void AliEveITSModuleStepper::DisplayDet(Int_t det, Int_t layer)
{
+ // Select modules to display by sub-det type / layer.
+
fSubDet = det;
fIDs.clear();
AliEveITSModuleSelection sel = AliEveITSModuleSelection();
void AliEveITSModuleStepper::DisplayTheta(Float_t min, Float_t max)
{
+ // Select modules to display by theta range.
+
fIDs.clear();
AliEveITSModuleSelection sel = AliEveITSModuleSelection();
sel.SetThetaRange(min, max);
Int_t AliEveITSModuleStepper::GetCurrentPage()
{
- Int_t idx = fPosition +1;
- Int_t n = idx/Nxy();
- if(idx % Nxy()) n++;
+ // Get number of current page.
+
+ Int_t idx = fPosition + 1;
+ Int_t n = idx/Nxy();
+ if (idx % Nxy()) n++;
return n;
}
Int_t AliEveITSModuleStepper::GetPages()
{
+ // Get number of all pages.
+
Int_t n = fIDs.size()/Nxy();
if(fIDs.size() % Nxy()) n++;
return n;
void AliEveITSModuleStepper::Apply()
{
+ // Apply current settings to children modules.
+
// printf("AliEveITSModuleStepper::Apply fPosition %d \n", fPosition);
gEve->DisableRedraw();
Capacity();
void AliEveITSModuleStepper::Render(TGLRnrCtx& rnrCtx)
{
+ // Render the overlay elements.
+
// render everyting in relative coordinates
glMatrixMode(GL_PROJECTION);
glPushMatrix();
//______________________________________________________________________________
Float_t AliEveITSModuleStepper::TextLength(const char* txt)
{
+ // Calculate length of text txt.
+
Float_t llx, lly, llz, urx, ury, urz;
fText->BBox(txt, llx, lly, llz, urx, ury, urz);
return (urx-llx)*fTextSize;
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderString(TString string, Int_t id)
{
+ // Render text for button id.
+
Float_t txtY = fWHeight*0.5;
Float_t txtl = TextLength(string.Data());
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderFrame(Float_t dx, Float_t dy, Int_t id)
{
- if(fRnrFrame == kFALSE)return;
+ // Render frame for button id, taking into account if it is currently
+ // below mouse.
+
+ if (fRnrFrame == kFALSE)return;
glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderSymbol(Float_t dx, Float_t dy, Int_t id)
{
+ // Render an overlay / GUI symbol, based on button id:
+ // 1 ~ <, 2 ~ <<, 3 ~ >, 4 ~ >>, 5 ~ ^, 6 ~ v.
+
glLoadName(id);
UChar_t color[4];
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderPalette(Float_t dx, Float_t x, Float_t y)
{
+ // Render color palette with number axis.
+
glPushMatrix();
glLoadIdentity();
glTranslatef(1 -x- dx, -1+y*4, 0);
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderMenu()
{
+ // Render menu: page control, scale control, detector type buttons.
+
Float_t ww = 2*fWWidth;
Float_t wh = 2*fWHeight;
//______________________________________________________________________________
void AliEveITSModuleStepper::RenderCellIDs()
{
+ // Render module-ids under their cells.
+
fText->SetTextSize(fStepper->GetDy()*0.1);
fText->SetTextColor(fFontCol);
Double_t x, y, z;
//______________________________________________________________________________
Bool_t AliEveITSModuleStepper::Handle(TGLRnrCtx & /*rnrCtx*/,
- TGLOvlSelectRecord & rec,
- Event_t * event)
+ TGLOvlSelectRecord & rec,
+ Event_t * event)
{
// Handle overlay event.
// Return TRUE if event was handled.
//______________________________________________________________________________
Bool_t AliEveITSModuleStepper::MouseEnter(TGLOvlSelectRecord& /*rec*/)
{
+ // Mouse has entered overlay area.
+
return kTRUE;
}
//______________________________________________________________________________
void AliEveITSModuleStepper::MouseLeave()
{
- // Mouse has left the element.
+ // Mouse has left overlay area.
fWActive = -1;
}
typedef std::vector<UInt_t>::iterator vpInt_i;
private:
- vpInt_t fIDs;
- UInt_t fPosition; // position of top corner ITS module in vector fIDs
+ vpInt_t fIDs; // Vector of module IDs to be displayed.
+ UInt_t fPosition; // Position of top corner ITS module in vector fIDs.
AliEveITSModuleStepper(const AliEveITSModuleStepper&); // Not implemented
AliEveITSModuleStepper& operator=(const AliEveITSModuleStepper&); // Not implemented
protected:
- AliEveITSDigitsInfo *fDigitsInfo;
- AliEveDigitScaleInfo *fScaleInfo;
- Int_t fSubDet;
+ AliEveITSDigitsInfo *fDigitsInfo; // Source of data and geometry.
+ AliEveDigitScaleInfo *fScaleInfo; // Parameters for digit-scaling.
+ Int_t fSubDet; // Sub-det, 0~SPD, 1~SDD, 2~SSD.
- TEveGridStepper *fStepper;
- TGLAxis *fAxis;
- TGLText *fText;
- Float_t fTextSize;
- Float_t fPagerGap;
- Bool_t fRnrFrame;
+ TEveGridStepper *fStepper; // Module placement.
+ TGLAxis *fAxis; // Axis of color scale.
+ TGLText *fText; // GL text-output object.
+ Float_t fTextSize; // Overlay text size.
+ Float_t fPagerGap; //
+ Bool_t fRnrFrame; //
// module configuration
- Float_t fExpandCell;
- Color_t fModuleFrameCol;
+ Float_t fExpandCell; //
+ Color_t fModuleFrameCol; //
// palette configuratiom
- Float_t fPaletteOffset;
- Float_t fPaletteLength;
+ Float_t fPaletteOffset; //
+ Float_t fPaletteLength; //
// symbol configuration
- Int_t fWActive;
- Float_t fWWidth;
- Float_t fWHeight;
- Float_t fWOff; // offset relative to widget size
- Color_t fWCol;
- Int_t fWActiveCol;
- Color_t fFontCol;
+ Int_t fWActive; //
+ Float_t fWWidth; //
+ Float_t fWHeight; //
+ Float_t fWOff; // Offset relative to widget size.
+ Color_t fWCol; //
+ Int_t fWActiveCol; //
+ Color_t fFontCol; //
// wrappers
Float_t TextLength(const char* txt);
TGLText* GetFont() { return fText; }
void SetGLText(TGLText* t) { fText = t; }
- ClassDef(AliEveITSModuleStepper, 0);
+ ClassDef(AliEveITSModuleStepper, 0); // Display scaled ITS modules in a paged layout, also providing GL-overaly control GUI.
};
#endif
//______________________________________________________________________________
-// AliEveITSModuleStepperEditor
//
+// Editor for AliEveITSModuleStepper.
ClassImp(AliEveITSModuleStepperEditor)
fM(0),
fStepper(0)
{
+ // Constructor.
+
MakeTitle("AliEveITSModuleStepper");
fStepper = new TEveGridStepperSubEditor(this);
- fStepper->Connect("Changed()", "AliEveITSModuleStepperEditor", this, "UpdateStore()");
+ fStepper->Connect("Changed()", "AliEveITSModuleStepperEditor", this, "UpdateStepper()");
AddFrame(fStepper, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
}
-AliEveITSModuleStepperEditor::~AliEveITSModuleStepperEditor()
-{}
-
/******************************************************************************/
void AliEveITSModuleStepperEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveITSModuleStepper*>(obj);
fStepper->SetModel(fM->GetStepper());
}
/******************************************************************************/
-void AliEveITSModuleStepperEditor::UpdateStore()
+void AliEveITSModuleStepperEditor::UpdateStepper()
{
+ // Update the model object.
+
fM->Apply();
Update();
gEve->Redraw3D(kTRUE);
AliEveITSModuleStepperEditor& operator=(const AliEveITSModuleStepperEditor&); // Not implemented
protected:
- AliEveITSModuleStepper* fM; // fModel dynamic-casted to AliEveITSModuleStepperEditor
+ AliEveITSModuleStepper *fM; // Model object.
- TEveGridStepperSubEditor* fStepper;
+ TEveGridStepperSubEditor *fStepper; // GUI component for grid-stepper control.
public:
AliEveITSModuleStepperEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- virtual ~AliEveITSModuleStepperEditor();
+ virtual ~AliEveITSModuleStepperEditor() {}
virtual void SetModel(TObject* obj);
- void UpdateStore();
- ClassDef(AliEveITSModuleStepperEditor, 0); // Editor for AliEveITSModuleStepper
-}; // endclass AliEveITSModuleStepperEditor
+ void UpdateStepper();
+
+ ClassDef(AliEveITSModuleStepperEditor, 0); // Editor for AliEveITSModuleStepper.
+};
#endif
//______________________________________________________________________________
// AliEveDigitScaleInfo
//
+
ClassImp(AliEveDigitScaleInfo)
AliEveDigitScaleInfo::AliEveDigitScaleInfo():
printf("N %d, sum %f, sqr_sum %f",N, sum, sqr_sum);
}
+
//______________________________________________________________________________
+
// AliEveITSScaledModule
+
+//______________________________________________________________________________
//
+// Visualization of an ITS module with digits aggregated
+// on a grid of pre-defined size.
ClassImp(AliEveITSScaledModule)
AliEveDigitScaleInfo& operator=(const AliEveDigitScaleInfo&); // Not implemented
protected:
- Int_t fScale;
- Int_t fStatType;
+ Int_t fScale; // Current scale.
+ Int_t fStatType; // Digit scaling algorithm, see StatType_e.
- Bool_t fSyncPalette;
+ Bool_t fSyncPalette; // Synchronize palette on next usage.
public:
AliEveDigitScaleInfo();
- virtual ~AliEveDigitScaleInfo(){}
+ virtual ~AliEveDigitScaleInfo() {}
- Int_t GetScale() { return fScale; }
- void ScaleChanged(Int_t s);
+ Int_t GetScale() const { return fScale; }
+ void ScaleChanged(Int_t s);
- Int_t GetStatType() { return fStatType; }
- void StatTypeChanged(Int_t t);
+ Int_t GetStatType() const { return fStatType; }
+ void StatTypeChanged(Int_t t);
- Bool_t GetSyncPalette(){return fSyncPalette;}
- void SetSyncPalette(Bool_t x){fSyncPalette = x;}
+ Bool_t GetSyncPalette() const { return fSyncPalette; }
+ void SetSyncPalette(Bool_t x) { fSyncPalette = x; }
ClassDef(AliEveDigitScaleInfo, 1);
};
void GetScaleData(Int_t& cnx, Int_t& cnz, Int_t& total);
AliEveDigitScaleInfo* GetScaleInfo() { return fScaleInfo; }
- ClassDef(AliEveITSScaledModule, 1);
+ ClassDef(AliEveITSScaledModule, 1); // Visualization of an ITS module with digits aggregated on a grid of pre-defined size.
}; // endclass AliEveITSScaledModule
#endif
//______________________________________________________________________________
-// AliEveITSScaledModuleEditor
//
+// Editor for AliEveITSScaledModule.
ClassImp(AliEveITSScaledModuleEditor)
- AliEveITSScaledModuleEditor::AliEveITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
- UInt_t options, Pixel_t back) :
- TGedFrame(p, width, height, options | kVerticalFrame, back),
-
- fInfoFrame(0),
-
- fModule(0),
-
- fScale(0),
- fStatistic(0),
- fInfoLabel0(0),
- fInfoLabel1(0)
+AliEveITSScaledModuleEditor::AliEveITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
+ TGedFrame(p, width, height, options | kVerticalFrame, back),
+ fModule(0),
+ fScale(0),
+ fStatistic(0),
+ fInfoFrame(0),
+ fInfoLabel0(0),
+ fInfoLabel1(0)
{
+ // Constructor.
+
MakeTitle("AliEveITSScaledModule");
// Create widgets
{
}
/******************************************************************************/
-AliEveITSScaledModuleEditor::~AliEveITSScaledModuleEditor()
-{}
-/******************************************************************************/
void AliEveITSScaledModuleEditor::CreateInfoFrame()
{
+ // Create a frame under tab "Info".
+
fInfoFrame = CreateEditorTabSubFrame("Info");
TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
kHorizontalFrame |
fInfoLabel0 = new TGLabel(fInfoFrame);
fInfoLabel0->SetTextJustify(kTextLeft);
fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
- lp, 0, 8, 0));
+ lp, 0, 8, 0));
fInfoLabel1 = new TGLabel(fInfoFrame);
fInfoLabel1->SetTextJustify(kTextLeft);
fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
- lp, 0, 2, 8));
-
+ lp, 0, 2, 8));
}
/******************************************************************************/
void AliEveITSScaledModuleEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fModule = dynamic_cast<AliEveITSScaledModule*>(obj);
// widgets
void AliEveITSScaledModuleEditor::DoScale()
{
+ // Slot for Scale.
+
fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
Int_t cnx, cnz, total;
void AliEveITSScaledModuleEditor::DoStatType(Int_t v)
{
+ // Slot for StatType.
+
fModule->GetScaleInfo()->StatTypeChanged(v);
Update();
fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
void CreateInfoFrame();
protected:
- TGVerticalFrame* fInfoFrame;
+ AliEveITSScaledModule *fModule; // Model object.
- AliEveITSScaledModule* fModule; // fModel dynamic-casted to AliEveITSScaledModuleEditor
+ TGNumberEntry *fScale; // Number-entry for digit-scale.
+ TGComboBox *fStatistic; // Selection of scaling algorithm.
- TGNumberEntry* fScale;
- TGComboBox* fStatistic;
-
- TGLabel* fInfoLabel0;
- TGLabel* fInfoLabel1;
+ TGVerticalFrame *fInfoFrame; // Frame in "Info" tab.
+ TGLabel *fInfoLabel0; // Info text.
+ TGLabel *fInfoLabel1; // Info text.
public:
AliEveITSScaledModuleEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- virtual ~AliEveITSScaledModuleEditor();
+ virtual ~AliEveITSScaledModuleEditor() {}
virtual void SetModel(TObject* obj);
void DoScale();
void DoStatType(Int_t t);
- ClassDef(AliEveITSScaledModuleEditor, 0); // Editor for AliEveITSScaledModule
-}; // endclass AliEveITSScaledModuleEditor
+ ClassDef(AliEveITSScaledModuleEditor, 0); // Editor for AliEveITSScaledModule.
+};
#endif