#include <TVirtualPad.h>
#include <TVirtualViewer3D.h>
-
//______________________________________________________________________________
-// AliEveJetPlane
//
+// Show jets and tracks in eta-phi plane.
+ClassImp(AliEveJetPlane)
Bool_t AliEveJetPlane::fgOneMomentumXYZ = kFALSE;
Bool_t AliEveJetPlane::fgOneMomentumPhiTheta = kFALSE;
-Bool_t AliEveJetPlane::fgOneEta = kFALSE;
-Bool_t AliEveJetPlane::fgOneE = kFALSE;
-Bool_t AliEveJetPlane::fgOneChgMass = kFALSE;
+Bool_t AliEveJetPlane::fgOneEta = kFALSE;
+Bool_t AliEveJetPlane::fgOneE = kFALSE;
+Bool_t AliEveJetPlane::fgOneChgMass = kFALSE;
-ClassImp(AliEveJetPlane)
-
AliEveJetPlane::AliEveJetPlane(Int_t iev) :
TEveElementList(Form("AliEveJetPlane %i",iev), Form("%i",iev)),
void AliEveJetPlane::AddJet(AliAODJet jet)
{
+ // Add a jet for display.
+
fJets.push_back(jet);
}
void AliEveJetPlane::AddTrack(AliAODTrack track)
{
+ // Add a track for display.
+
fTracks.push_back(track);
}
void AliEveJetPlane::ComputeBBox()
{
+ // Calculate bounding-box.
+
BBoxInit();
BBoxCheckPoint(-350, -350, -20);
BBoxCheckPoint( 350, 350, 20);
void AliEveJetPlane::Paint(Option_t* /*option*/)
{
+ // Paint the object.
+
TBuffer3D buff(TBuffer3DTypes::kGeneric);
// Section kCore
AliEveJetPlane& operator=(const AliEveJetPlane&); // Not implemented
protected:
- Float_t fMinEta;
- Float_t fMaxEta;
- Float_t fMinPhi;
- Float_t fMaxPhi;
- Int_t fNEtaDiv;
- Int_t fNPhiDiv;
+ Float_t fMinEta; // Min eta for display.
+ Float_t fMaxEta; // Max eta for display.
+ Float_t fMinPhi; // Min phi for display.
+ Float_t fMaxPhi; // Max phi for display.
+ Int_t fNEtaDiv; // Number of eta divisions for display.
+ Int_t fNPhiDiv; // Number of phi divisions for display.
- Float_t fEtaScale;
- Float_t fPhiScale;
- Float_t fEnergyScale;
- Float_t fEnergyColorScale;
+ Float_t fEtaScale; // Multiplier for eta.
+ Float_t fPhiScale; // Multiplier for phi.
+ Float_t fEnergyScale; // Multiplier for energy.
+ Float_t fEnergyColorScale; // Multiplier for energy color.
- Color_t fGridColor;
+ Color_t fGridColor; // Color of coordinate grid.
- TEveTrans fHMTrans;
+ TEveTrans fHMTrans;// Transformation matrix.
- std::vector<AliAODJet> fJets;
- std::vector<AliAODTrack> fTracks;
+ std::vector<AliAODJet> fJets; // Jets to display.
+ std::vector<AliAODTrack> fTracks; // Tracks to display.
- Bool_t fRnrJets;
- Bool_t fRnrTracks;
- Bool_t fOneSelection;
- Bool_t fTwoSelection;
+ Bool_t fRnrJets; // Show jets.
+ Bool_t fRnrTracks; // Show tracks.
+ Bool_t fOneSelection; // One object selected.
+ Bool_t fTwoSelection; // Two objects selected.
- AliAODJet *fJet1, *fJet2;
- AliAODTrack *fTrack1, *fTrack2;
+ AliAODJet *fJet1, *fJet2; // Selection jets.
+ AliAODTrack *fTrack1, *fTrack2; // Selection tracks.
- Int_t fSelectionFlag;
+ Int_t fSelectionFlag; // Selection state, handled by GL renderer.
- static Bool_t fgOneMomentumXYZ;
- static Bool_t fgOneMomentumPhiTheta;
- static Bool_t fgOneEta;
- static Bool_t fgOneE;
- static Bool_t fgOneChgMass;
+ // Common settings:
+ static Bool_t fgOneMomentumXYZ; // Display momentum as coordinates.
+ static Bool_t fgOneMomentumPhiTheta; // Display momentum as phi/theta.
+ static Bool_t fgOneEta; // Display eta.
+ static Bool_t fgOneE; // Display energy.
+ static Bool_t fgOneChgMass; // Display charge and mass.
public:
AliEveJetPlane(Int_t iev);
void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
- ClassDef(AliEveJetPlane, 1);
+ ClassDef(AliEveJetPlane, 1); // Show jets and tracks in eta-phi plane.
}; // endclass AliEveJetPlane
#endif
fRnrTracks(0),
fEnergyScale(0),
fEnergyColorScale(0),
- fOneSelection(0),
- fTwoSelection(0),
+ fOneSelection(0), fTwoSelection(0),
fInformationSetup(0)
- // Initialize widget pointers to 0
{
+ // Constructor.
+
MakeTitle("AliEveJetPlane");
Int_t labelW = 67;
- // Create widgets
- // fXYZZ = new TGSomeWidget(this, ...);
- // AddFrame(fXYZZ, new TGLayoutHints(...));
- // fXYZZ->Connect("SignalName()", "AliEveJetPlaneEditor", this, "DoXYZZ()");
-
fRnrJets = new TGCheckButton(this, "Rnr Jets");
AddFrame(fRnrJets, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fRnrJets->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoRnrJets()");
// fInformationSetup->Connect("Clicked()", "AliEveJetPlaneEditor", this, "DoStaticDataWindow()");
}
-AliEveJetPlaneEditor::~AliEveJetPlaneEditor()
-{}
-
/******************************************************************************/
void AliEveJetPlaneEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveJetPlane*>(obj);
// Set values of widgets
/******************************************************************************/
-// Implements callback/slot methods
-
-// void AliEveJetPlaneEditor::DoXYZZ()
-// {
-// fM->SetXYZZ(fXYZZ->GetValue());
-// Update();
-// }
-
void AliEveJetPlaneEditor::DoRnrJets()
{
+ // Slot for RnrJets.
+
fM->SetRnrJets(fRnrJets->IsOn());
Update();
}
void AliEveJetPlaneEditor::DoRnrTracks()
{
+ // Slot for RnrTracks.
+
fM->SetRnrTracks(fRnrTracks->IsOn());
Update();
}
void AliEveJetPlaneEditor::DoEnergyColorScale()
{
+ // Slot for EnergyColorScale.
+
fM->SetEnergyColorScale(fEnergyColorScale->GetValue());
Update();
}
void AliEveJetPlaneEditor::DoEnergyScale()
{
+ // Slot for EnergyScale.
+
fM->SetEnergyScale(fEnergyScale->GetValue());
Update();
}
void AliEveJetPlaneEditor::DoOneSelection()
{
+ // Slot for OneSelection.
+
fTwoSelection->SetState(kButtonUp);
fM->SetOneSelection(fOneSelection->IsOn());
fM->SetTwoSelection(fTwoSelection->IsOn());
void AliEveJetPlaneEditor::DoTwoSelection()
{
+ // Slot for TwoSelection.
+
fOneSelection->SetState(kButtonUp);
fM->SetOneSelection(fOneSelection->IsOn());
fM->SetTwoSelection(fTwoSelection->IsOn());
void AliEveJetPlaneEditor::DoStaticDataWindow()
{
+ // Slot for StaticDataWindow.
+
printf("\n Soon available ... \n");
if (fgStaticWindow == 0)
fgStaticWindow = new StaticDataWindow(gClient->GetRoot(), this, 400, 200);
fgStaticWindow->CenterOnParent();
}
+
+/******************************************************************************/
/******************************************************************************/
+//______________________________________________________________________________
+//
+// Common settings for all AliEveJetPlane objects.
+
ClassImp(AliEveJetPlaneEditor::StaticDataWindow)
AliEveJetPlaneEditor::StaticDataWindow::StaticDataWindow(const TGWindow *p, const TGWindow *main,
- UInt_t w, UInt_t h, UInt_t options) :
+ UInt_t w, UInt_t h, UInt_t options) :
TGTransientFrame(p, main, w, h, options),
fFrame1(0), fF2(0),
fOkButton(0), fCancelButton(0),
fTab(0),
fChk1(0), fChk2(0), fChk3(0), fChk4(0), fChk5(0)
{
+ // Constructor.
// Create a dialog window. A dialog window pops up with respect to its
// "main" window.
AliEveJetPlaneEditor::StaticDataWindow::~StaticDataWindow()
{
+ // Destructor, deletes the window.
+
DeleteWindow();
}
void AliEveJetPlaneEditor::StaticDataWindow::DoClose()
{
+ // Close the window.
+
UnmapWindow();
}
void AliEveJetPlaneEditor::StaticDataWindow::DoCancel()
{
+ // Cancel, close the window.
+
SendCloseMessage();
}
void AliEveJetPlaneEditor::StaticDataWindow::DoTab(Int_t /*id*/)
{
+ // Tab selected.
+
// printf("Tab item %d activated\n", id);
}
AliEveJetPlaneEditor& operator=(const AliEveJetPlaneEditor&); // Not implemented
protected:
- AliEveJetPlane *fM; // fModel dynamic-casted to AliEveJetPlaneEditor
+ AliEveJetPlane *fM; // Model object.
- // Declare widgets
- // TGSomeWidget* fXYZZ;
- TGCheckButton* fRnrJets;
- TGCheckButton* fRnrTracks;
- TEveGValuator* fEnergyScale;
- TEveGValuator* fEnergyColorScale;
- TGButton *fOneSelection, *fTwoSelection;
- TGButton *fInformationSetup;
+ TGCheckButton *fRnrJets; // Widget for flag RnrJets.
+ TGCheckButton *fRnrTracks; // Widget for flag RnrTracks.
+ TEveGValuator *fEnergyScale; // Widget for EnergyScale.
+ TEveGValuator *fEnergyColorScale; // Widget for EnergyColorScale.
+ TGButton *fOneSelection, *fTwoSelection; // Widgets for one/two selection flags.
+ TGButton *fInformationSetup; // Widget for InformationSetup.
public:
AliEveJetPlaneEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
- UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- virtual ~AliEveJetPlaneEditor();
+ UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+ virtual ~AliEveJetPlaneEditor() {}
virtual void SetModel(TObject* obj);
StaticDataWindow(const StaticDataWindow&); // Not implemented
StaticDataWindow& operator=(const StaticDataWindow&); // Not implemented
- TGCompositeFrame *fFrame1, *fF2;
- TGButton *fOkButton, *fCancelButton;
- TGLayoutHints *fL1, *fL2, *fL3, *fL5;
- TGTab *fTab;
- TGButton *fChk1, *fChk2,*fChk3, *fChk4,*fChk5;
+ TGCompositeFrame *fFrame1, *fF2; // Frames.
+ TGButton *fOkButton, *fCancelButton; // Ok, cancel buttons.
+ TGLayoutHints *fL1, *fL2, *fL3, *fL5; // Layout hints.
+ TGTab *fTab; // Tab container.
+ TGButton *fChk1, *fChk2,*fChk3, *fChk4,*fChk5; // Check-buttons.
public:
StaticDataWindow(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
void DoCancel();
void DoTab(Int_t id);
- ClassDef(StaticDataWindow, 0);
+ ClassDef(StaticDataWindow, 0); // Common settings for all AliEveJetPlane objects.
};
protected:
- static StaticDataWindow* fgStaticWindow;
+ static StaticDataWindow* fgStaticWindow; // Common window for global settings.
- ClassDef(AliEveJetPlaneEditor, 1); // Editor for AliEveJetPlane
+ ClassDef(AliEveJetPlaneEditor, 1); // Editor for AliEveJetPlane.
}; // endclass AliEveJetPlaneEditor
#endif
//______________________________________________________________________________
-// AliEveJetPlaneGL
//
+// GL renderer for AliEveJetPlane.
ClassImp(AliEveJetPlaneGL)
AliEveJetPlaneGL::AliEveJetPlaneGL() : TGLObject(), fM(0)
{
+ // Constructor.
+
fDLCache = kFALSE; // Disable display list -- axis pain.
}
-AliEveJetPlaneGL::~AliEveJetPlaneGL()
-{}
-
/******************************************************************************/
Bool_t AliEveJetPlaneGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
+ // Set model object.
+
if(SetModelCheckClass(obj, AliEveJetPlane::Class())) {
fM = dynamic_cast<AliEveJetPlane*>(obj);
return kTRUE;
void AliEveJetPlaneGL::SetBBox()
{
- // !! This ok if master sub-classed from TAttBBox
+ // Set bounding box.
+
SetAxisAlignedBBox(((AliEveJetPlane*)fExternalObj)->AssertBBox());
}
void AliEveJetPlaneGL::DirectDraw(TGLRnrCtx & /*rnrCtx*/) const
{
+ // Render the object.
Float_t minEta = (fM->fMinEta)*(fM->fEtaScale);
Float_t maxEta = (fM->fMaxEta)*(fM->fEtaScale);
Float_t minPhi = (fM->fMinPhi)*(fM->fPhiScale);
Float_t maxPhi = (fM->fMaxPhi)*(fM->fPhiScale);
Float_t phiCoord, etaCoord, dPhi, dEta;
- Double_t eta, phi, E, x, y;
+ Double_t eta, phi, e, x, y;
// Show frame for Eta-Phi coordinates
{
eta = j->Eta();
phi = j->Phi();
- E = j->E();
+ e = j->E();
x = eta*(fM->fEtaScale);
y = phi*(fM->fPhiScale);
- Int_t colBin = TMath::Min((Int_t) ((nCol-2)*E*
+ Int_t colBin = TMath::Min((Int_t) ((nCol-2)*e*
TMath::Power(10.,fM->fEnergyColorScale)/(eMax)),nCol-2);
Int_t colIdx = gStyle->GetColorPalette(colBin);
TColor* c = gROOT->GetColor(colIdx);
}
glLoadName(jetid);
- TGLUtil::DrawLine( TGLVertex3(x,y,0.),
- TGLVector3(0.,0.,TMath::Log(E + 1.)*fM->fEnergyScale),
- TGLUtil::kLineHeadArrow, 25.0, col);
-
+ TGLUtil::DrawLine(TGLVertex3(x,y,0.),
+ TGLVector3(0.,0.,TMath::Log(e + 1.)*fM->fEnergyScale),
+ TGLUtil::kLineHeadArrow, 25.0, col);
++j; ++jetid;
}
}
glEnable(GL_DEPTH_TEST); // Turn Depth Testing On
UInt_t trackid = 0;
-
k = fM->fTracks.begin();
while (k != fM->fTracks.end())
{
eta = k->Eta();
phi = k->Phi();
- E = k->E();
+ e = k->E();
- if (E < 0.)
+ if (e < 0.)
{
// printf(" WARNING: Particle with negative energy has been found.\n");
// printf(" PARTICLE NOT DISPLAYED. TrackID: %i\n", trackid);
x = eta*(fM->fEtaScale);
y = phi*(fM->fPhiScale);
- Int_t colBin = TMath::Min((Int_t) ((nCol-2)*E*
+ Int_t colBin = TMath::Min((Int_t) ((nCol-2)*e*
TMath::Power(10.,fM->fEnergyColorScale)/(eMax)),nCol-2);
Int_t colIdx = gStyle->GetColorPalette(colBin);
TColor* c = gROOT->GetColor(colIdx);
glLoadName(trackid);
TGLUtil::DrawLine( TGLVertex3(x,y,0.),
- TGLVector3(0.,0.,TMath::Log(E + 1.)*fM->fEnergyScale),
+ TGLVector3(0.,0.,TMath::Log(e + 1.)*fM->fEnergyScale),
TGLUtil::kLineHeadArrow, 5.0, col);
++k; ++trackid;
glPopName();
TGLUtil::ResetDrawQuality();
-
-
-
}
/******************************************************************************/
void AliEveJetPlaneGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/, TGLSelectRecord & rec)
{
+ // Process selection and print jet information.
+
// printf("beep %u\n", rec.GetN());
// rec.Print();
static Int_t jet1State;
if(jet1State && jet2State)
{
- Double_t Eta1, Eta2, Phi1, Phi2, d;
+ Double_t eta1, eta2, phi1, phi2, d;
- Eta1 = (fM->GetJet1()).Eta();
- Eta2 = (fM->GetJet2()).Eta();
- Phi1 = (fM->GetJet1()).Phi();
- Phi2 = (fM->GetJet2()).Phi();
+ eta1 = (fM->GetJet1()).Eta();
+ eta2 = (fM->GetJet2()).Eta();
+ phi1 = (fM->GetJet1()).Phi();
+ phi2 = (fM->GetJet2()).Phi();
- d = TMath::Sqrt(TMath::Power(Eta2-Eta1,2) + TMath::Power(Phi2-Phi1,2));
+ d = TMath::Sqrt(TMath::Power(eta2-eta1,2) + TMath::Power(phi2-phi1,2));
- printf("Eta-Phi: %f, %f\n", Eta1, Phi1 );
- printf("Eta-Phi: %f, %f\n", Eta2, Phi2 );
+ printf("Eta-Phi: %f, %f\n", eta1, phi1);
+ printf("Eta-Phi: %f, %f\n", eta2, phi2);
printf("Eta-Phi Distance: %f\n", d);
}
AliEveJetPlaneGL& operator=(const AliEveJetPlaneGL&); // Not implemented
protected:
- AliEveJetPlane* fM; // fModel dynamic-casted to AliEveJetPlaneGL
+ AliEveJetPlane* fM; // Model object.
virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
public:
AliEveJetPlaneGL();
- virtual ~AliEveJetPlaneGL();
+ virtual ~AliEveJetPlaneGL() {}
virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
virtual void SetBBox();
virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
- ClassDef(AliEveJetPlaneGL, 0);
+ ClassDef(AliEveJetPlaneGL, 0); // GL renderer for AliEveJetPlane.
}; // endclass AliEveJetPlaneGL
#endif
//______________________________________________________________________________
-// AliEveTPCData
//
// A central manager for TPC data of an event. Can read digits (from
// a tree: LoadDigits()) and raw-data (via AliRawReader: LoadRaw()).
fSectors(36), fSectorBlockSize(65536),
fLoadThreshold(0), fLoadPedestal(0), fAutoPedestal(kFALSE)
{
+ // Constructor.
+
AliEveTPCSectorData::InitStatics();
}
AliEveTPCData::~AliEveTPCData()
{
+ // Destructor, deletes all sector-data.
+
DeleteAllSectors();
}
void AliEveTPCData::CreateSector(Int_t sector)
{
- if(fSectors[sector] == 0)
+ // Create sector-data for sector if it does not exist already.
+
+ if (fSectors[sector] == 0)
fSectors[sector] = new AliEveTPCSectorData(sector, fSectorBlockSize);
}
void AliEveTPCData::CreateAllSectors()
{
- for(Int_t s=0; s<36; ++s)
+ // Create all 36 sectors.
+
+ for (Int_t s=0; s<36; ++s)
CreateSector(s);
}
void AliEveTPCData::DropAllSectors()
{
- for(Int_t s=0; s<36; ++s) {
- if(fSectors[s] != 0)
+ // Drop data of all existing sectors.
+
+ for (Int_t s=0; s<36; ++s) {
+ if (fSectors[s] != 0)
fSectors[s]->DropData();
}
}
void AliEveTPCData::DeleteAllSectors()
{
- for(Int_t s=0; s<36; ++s) {
+ // Delete all sector-data.
+
+ for (Int_t s=0; s<36; ++s) {
delete fSectors[s];
fSectors[s] = 0;
}
AliEveTPCSectorData* AliEveTPCData::GetSectorData(Int_t sector, Bool_t spawnSectors)
{
- if(sector < 0 || sector > 35) return 0;
- if(fSectors[sector] == 0 && spawnSectors)
+ // Get sector-data for sector. If spawnSectors is true, the
+ // sector-data is created if it does not exist already.
+
+ if (sector < 0 || sector > 35) return 0;
+ if (fSectors[sector] == 0 && spawnSectors)
CreateSector(sector);
return fSectors[sector];
}
for (Int_t ent=0; ent<numEnt; ent++) {
tree->GetEntry(ent);
AliEveTPCSectorData::GetParam().AdjustSectorRow(digit.GetID(), sector, row);
- if(sector >= 36) {
+ if (sector >= 36) {
sector -= 36;
row += AliEveTPCSectorData::GetInnSeg().GetNRows();
}
secData = GetSectorData(sector, spawnSectors);
- if(secData == 0)
+ if (secData == 0)
continue;
- if(digit.First() == kFALSE)
+ if (digit.First() == kFALSE)
continue;
curPad = -1;
do {
time = digit.CurrentRow();
signal = digit.CurrentDigit();
- if(pad != curPad) {
- if(inFill)
+ if (pad != curPad) {
+ if (inFill)
secData->EndPad(fAutoPedestal, fLoadThreshold);
secData->BeginPad(row, pad, kFALSE);
curPad = pad;
inFill = kTRUE;
}
- if(fAutoPedestal) {
+ if (fAutoPedestal) {
secData->RegisterData(time, signal);
} else {
signal -= fLoadPedestal;
- if(signal >= fLoadThreshold)
+ if (signal >= fLoadThreshold)
secData->RegisterData(time, signal);
}
} while (digit.Next());
- if(inFill) {
+ if (inFill) {
secData->EndPad(fAutoPedestal, fLoadThreshold);
inFill = kFALSE;
}
while (input.Next()) {
if (input.IsNewSector()) {
- if(inFill) {
+ if (inFill) {
secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
sector = input.GetSector();
- if(sector >= 36) {
+ if (sector >= 36) {
sector -= 36;
rowOffset = AliEveTPCSectorData::GetInnSeg().GetNRows();
} else {
continue;
if (input.IsNewPad()) {
- if(inFill) {
+ if (inFill) {
secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
row = input.GetRow() + rowOffset;
pad = input.GetPad();
- if(pad >= AliEveTPCSectorData::GetNPadsInRow(row)) {
- if(warn) {
+ if (pad >= AliEveTPCSectorData::GetNPadsInRow(row)) {
+ if (warn) {
Warning(eH.Data(), "pad out of range (row=%d, pad=%d, maxpad=%d).",
row, pad, AliEveTPCSectorData::GetNPadsInRow(row));
}
}
AliEveTPCSectorData::PadRowHack* prh = secData->GetPadRowHack(row, pad);
- if(prh != 0) {
+ if (prh != 0) {
threshold = prh->fThrExt + Short_t(prh->fThrFac*fLoadThreshold);
} else {
threshold = fLoadThreshold;
time = input.GetTime();
signal = input.GetSignal();
- if(time >= lastTime) {
- if(lastTimeWarn == kFALSE) {
- if(warn)
+ if (time >= lastTime) {
+ if (lastTimeWarn == kFALSE) {
+ if (warn)
Warning(eH.Data(), "time out of order (row=%d, pad=%d, time=%d, lastTime=%d).",
row, pad, time, lastTime);
lastTimeWarn = kTRUE;
continue;
}
lastTime = time;
- if(fAutoPedestal) {
+ if (fAutoPedestal) {
secData->RegisterData(time, signal);
} else {
signal -= fLoadPedestal;
- if(signal > threshold)
+ if (signal > threshold)
secData->RegisterData(time, signal);
}
}
- if(inFill) {
+ if (inFill) {
secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
class AliEveTPCData : public TObject, public TEveRefCnt
{
protected:
- std::vector<AliEveTPCSectorData*> fSectors;
- Int_t fSectorBlockSize;
- Short_t fLoadThreshold;
- Short_t fLoadPedestal;
- Bool_t fAutoPedestal;
+ std::vector<AliEveTPCSectorData*> fSectors; // Vector of sector-data.
+ Int_t fSectorBlockSize; // Block-size of sector-data.
+ Short_t fLoadThreshold; // Threshold at load-time.
+ Short_t fLoadPedestal; // Pedestal at load-time.
+ Bool_t fAutoPedestal; // If true determine pedestals automatically for each pad.
public:
AliEveTPCData();
//______________________________________________________________________________
-// AliEveTPCLoader
//
+// Front-end for stand-alone inspection of TPC raw-data.
+// GUI is implemented in AliEveTPCLoaderEditor class.
ClassImp(AliEveTPCLoader)
fSetInitSectorParams(kFALSE),
fInitMinTime(0), fInitMaxTime(460), fInitThreshold(5), fInitMaxVal(128)
{
+ // Constructor.
+
fData = new AliEveTPCData;
}
AliEveTPCLoader::~AliEveTPCLoader()
{
+ // Destructor.
+
delete fReader;
delete fData;
}
void AliEveTPCLoader::RemoveElementLocal(TEveElement* el)
{
- for(Int_t i=0; i<36; ++i) {
- if(fSec2Ds[i] == el) fSec2Ds[i] = 0;
- if(fSec3Ds[i] == el) fSec3Ds[i] = 0;
+ // Local removal an element, virtual from TEveElement.
+ // Need to search for it in visual sector representations and remove
+ // it there as well.
+
+ for (Int_t i=0; i<36; ++i) {
+ if (fSec2Ds[i] == el) fSec2Ds[i] = 0;
+ if (fSec3Ds[i] == el) fSec3Ds[i] = 0;
}
}
void AliEveTPCLoader::RemoveElementsLocal()
{
- for(Int_t i=0; i<36; ++i) {
+ // Local removal of all elements, virtual from TEveElement.
+ // Must remove all visual sector representations.
+
+ for (Int_t i=0; i<36; ++i) {
fSec2Ds[i] = 0;
fSec3Ds[i] = 0;
}
void AliEveTPCLoader::SetData(AliEveTPCData* d)
{
+ // Set external TPC-data container. The old one is deleted.
+
delete fData;
fData = d;
}
void AliEveTPCLoader::OpenFile()
{
+ // Open the raw-data file, as set in fFile data-member.
+ // Raw-reader is also created and attached to the file.
+ // First event is loaded and all sectors for which the data-exists
+ // are created.
+
static const TEveException eH("AliEveTPCLoader::OpenFile ");
- if(gSystem->AccessPathName(fFile, kReadPermission))
+ if (gSystem->AccessPathName(fFile, kReadPermission))
throw(eH + "can not read '" + fFile + "'.");
fData->DeleteAllSectors();
fEvent = -1;
fReader = new AliRawReaderRoot(fFile);
- if(fTPCEquipementMap != "")
+ if (fTPCEquipementMap != "")
fReader->LoadEquipmentIdsMap
(gSystem->ExpandPathName(fTPCEquipementMap.Data()));
void AliEveTPCLoader::LoadEvent()
{
+ // Load an event.
+
static const TEveException eH("AliEveTPCLoader::LoadEvent ");
- if(fReader == 0)
+ if (fReader == 0)
throw(eH + "data file not opened.");
printf("Now loading event %d\n", fEvent);
void AliEveTPCLoader::NextEvent(Bool_t rewindOnEnd)
{
+ // Go o the next event.
+ // When the last event is reached and rewindOnEnd is true, the file
+ // is rewound back to the first event. Otherwise an exception is thrown.
+
static const TEveException eH("AliEveTPCLoader::NextEvent ");
- if(fReader == 0)
+ if (fReader == 0)
throw(eH + "data file not opened.");
- if(fReader->NextEvent() == kTRUE) {
+ if (fReader->NextEvent() == kTRUE) {
++fEvent;
} else {
- if(fEvent == -1)
+ if (fEvent == -1)
throw(eH + "no events available.");
- if(rewindOnEnd) {
+ if (rewindOnEnd) {
printf("Reached end of stream (event=%d), rewinding to first event.\n", fEvent);
fReader->RewindEvents();
fReader->NextEvent();
void AliEveTPCLoader::GotoEvent(Int_t event)
{
+ // Go to specified event.
+
static const TEveException eH("AliEveTPCLoader::GotoEvent ");
- if(fReader == 0)
+ if (fReader == 0)
throw(eH + "data file not opened.");
- if(event == fEvent)
+ if (event == fEvent)
return;
Bool_t checkEnd;
- if(event < fEvent) {
+ if (event < fEvent) {
fReader->RewindEvents();
fEvent = -1;
checkEnd = kFALSE;
}
do {
NextEvent();
- } while(fEvent != event && !(checkEnd == kTRUE && fEvent == 0));
+ } while (fEvent != event && !(checkEnd == kTRUE && fEvent == 0));
LoadEvent();
UpdateSectors();
}
void* AliEveTPCLoader::LoopEvent(AliEveTPCLoader* loader)
{
+ // Loop to next event on given loader. Static member to be used for
+ // external control during animations.
+ // Calls NextEvent(), LoadEvent() and UpdateSectors().
+
loader->NextEvent();
loader->LoadEvent();
loader->UpdateSectors();
void AliEveTPCLoader::UpdateSectors(Bool_t dropNonPresent)
{
+ // Update visual representations of sectors.
+ // If dropNonPresent is true, the sectors for which there is no data in
+ // the current event are removed.
+
gEve->DisableRedraw();
- for(Int_t i=0; i<=35; ++i)
+ for (Int_t i=0; i<=35; ++i)
{
AliEveTPCSectorData* sd = fData->GetSectorData(i);
// 2D sectors
- if(fSec2Ds[i] != 0)
+ if (fSec2Ds[i] != 0)
{
if (dropNonPresent && sd == 0) {
gEve->RemoveElement(fSec2Ds[i], this);
}
else
{
- if(sd != 0) {
+ if (sd != 0) {
AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("Sector2D %d", i));
fSec2Ds[i] = s;
s->SetSectorID(i);
s->SetDataSource(fData);
- if(fDoubleSR)
+ if (fDoubleSR)
s->SetMaxTime(1023);
- if(fSetInitSectorParams) {
+ if (fSetInitSectorParams) {
s->SetMinTime(fInitMinTime);
s->SetMaxTime(fInitMaxTime);
s->SetThreshold(fInitThreshold);
}
// 3D sectors
- if(fSec3Ds[i] != 0)
+ if (fSec3Ds[i] != 0)
{
if (dropNonPresent && sd == 0) {
gEve->RemoveElement(fSec3Ds[i], this);
void AliEveTPCLoader::ReloadSectors()
{
+ // Reload current event and update sectors.
+
LoadEvent();
UpdateSectors();
}
void AliEveTPCLoader::CreateSectors3D()
{
+ // Create 3D representations of sectors.
+
gEve->DisableRedraw();
- for(Int_t i=0; i<=35; ++i) {
+ for (Int_t i=0; i<=35; ++i) {
AliEveTPCSectorData* sd = fData->GetSectorData(i);
- if(sd != 0 && fSec3Ds[i] == 0) {
+ if (sd != 0 && fSec3Ds[i] == 0) {
AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("Sector3D %d", i));
fSec3Ds[i] = s;
s->SetSectorID(i);
s->SetDataSource(fData);
- if(fDoubleSR)
+ if (fDoubleSR)
s->SetDriftVel(2.273);
- if(fSec2Ds[i] != 0)
+ if (fSec2Ds[i] != 0)
s->CopyVizParams(*fSec2Ds[i]);
s->SetAutoTrans(kTRUE);
void AliEveTPCLoader::DeleteSectors3D()
{
+ // Delete 3D representations of sectors.
+
gEve->DisableRedraw();
- for(Int_t i=0; i<=35; ++i) {
+ for (Int_t i=0; i<=35; ++i) {
TEveElement* re = fSec3Ds[i];
- if(re != 0) {
+ if (re != 0) {
gEve->RemoveElement(re, this);
// delete re; // Done automatically.
fSec3Ds[i] = 0;
void AliEveTPCLoader::SetInitParams(Int_t mint, Int_t maxt, Int_t thr, Int_t maxval)
{
+ // Set initial viualization parameters for 2D and 3D sector representations.
+
fSetInitSectorParams = kTRUE;
fInitMinTime = mint;
fInitMaxTime = maxt;
AliEveTPCLoader& operator=(const AliEveTPCLoader&); // Not implemented
protected:
- TString fFile;
- Int_t fEvent;
- Bool_t fDoubleSR;
+ TString fFile; // File holding raw-data.
+ Int_t fEvent; // Current event.
+ Bool_t fDoubleSR; // Set to true for double sampling-rate.
- TString fTPCEquipementMap;
- AliRawReaderRoot* fReader;
- AliEveTPCData* fData;
+ TString fTPCEquipementMap; // Equipement-map file-name, if set passed to raw-reader.
+ AliRawReaderRoot *fReader; // Raw-data reader.
+ AliEveTPCData *fData; // TPC data container.
- std::vector<AliEveTPCSector2D*> fSec2Ds;
- std::vector<AliEveTPCSector3D*> fSec3Ds;
+ std::vector<AliEveTPCSector2D*> fSec2Ds; // 2D sector representations.
+ std::vector<AliEveTPCSector3D*> fSec3Ds; // 3D sector representations.
- Bool_t fSetInitSectorParams;
- Int_t fInitMinTime;
- Int_t fInitMaxTime;
- Int_t fInitThreshold;
- Int_t fInitMaxVal;
+ Bool_t fSetInitSectorParams; // If true, initial parameters of 2D and 3D sectors are set from values below.
+ Int_t fInitMinTime; // Min time for display.
+ Int_t fInitMaxTime; // Max time for display.
+ Int_t fInitThreshold; // Threshold.
+ Int_t fInitMaxVal; // Maximum-signal value (all signals above mapped to saturation color).
public:
AliEveTPCLoader(const Text_t* n="AliEveTPCLoader", const Text_t* t=0);
void SetInitParams(Int_t mint, Int_t maxt, Int_t thr, Int_t maxval=128);
- ClassDef(AliEveTPCLoader, 1);
+ ClassDef(AliEveTPCLoader, 1); // Front-end for stand-alone inspection of TPC raw-data.
}; // endclass AliEveTPCLoader
#endif
//______________________________________________________________________________
-// AliEveTPCLoaderEditor
//
+// Editor for AliEveTPCLoader.
ClassImp(AliEveTPCLoaderEditor)
fCreateSectors3D (0),
fDeleteSectors3D (0)
{
+ // Constructor.
+
MakeTitle("AliEveTPCLoader");
Int_t labelW;
}
}
-AliEveTPCLoaderEditor::~AliEveTPCLoaderEditor()
-{}
-
/******************************************************************************/
void AliEveTPCLoaderEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveTPCLoader*>(obj);
// !!!! order changed, need TGTextEntry::SetText NO BLOODY EMIT.
void AliEveTPCLoaderEditor::FileSelect()
{
+ // Slot for FileSelect.
+
TGFileInfo fi;
fi.fIniDir = StrDup(gSystem->DirName (fM->fFile));
fi.fFilename = StrDup(gSystem->BaseName(fM->fFile));
void AliEveTPCLoaderEditor::FileChanged()
{
+ // Slot for FileChanged.
+
fM->fFile = fFile->GetText();
}
void AliEveTPCLoaderEditor::DoOpen()
{
+ // Slot for Open.
+
fM->OpenFile();
SetModel(fM);
}
void AliEveTPCLoaderEditor::DoEvent()
{
+ // Slot for Event.
+
fM->GotoEvent((Int_t) fEvent->GetValue());
SetModel(fM);
}
void AliEveTPCLoaderEditor::DoDoubleSR()
{
+ // Slot for DoubleSR.
+
fM->SetDoubleSR(fDoubleSR->IsOn());
Update();
}
void AliEveTPCLoaderEditor::DoDataLoadThreshold()
{
+ // Slot for DataLoadThreshold.
+
if (fM->GetData() == 0) return;
fM->GetData()->SetLoadThreshold((Short_t) fDataLoadThreshold->GetValue());
}
void AliEveTPCLoaderEditor::DoDataLoadPedestal()
{
+ // Slot for DataLoadPedestal.
+
if (fM->GetData() == 0) return;
fM->GetData()->SetLoadPedestal((Short_t) fDataLoadPedestal->GetValue());
}
void AliEveTPCLoaderEditor::DoDataAutoPedestal()
{
+ // Slot for DataAutoPedestal.
+
if (fM->GetData() == 0) return;
fM->GetData()->SetAutoPedestal(fDataAutoPedestal->IsOn());
fDataLoadPedestal->SetEnabled(!fDataAutoPedestal->IsOn());
void AliEveTPCLoaderEditor::DoUpdateSectors()
{
+ // Slot for UpdateSectors.
+
fM->UpdateSectors();
}
void AliEveTPCLoaderEditor::DoReloadSectors()
{
+ // Slot for ReloadSectors.
+
fM->ReloadSectors();
}
void AliEveTPCLoaderEditor::DoCreateSectors3D()
{
+ // Slot for CreateSectors3D.
+
fM->CreateSectors3D();
}
void AliEveTPCLoaderEditor::DoDeleteSectors3D()
{
+ // Slot for DeleteSectors3D.
+
fM->DeleteSectors3D();
}
AliEveTPCLoaderEditor& operator=(const AliEveTPCLoaderEditor&); // Not implemented
protected:
- AliEveTPCLoader* fM; // fModel dynamic-casted to AliEveTPCLoaderEditor
+ AliEveTPCLoader *fM; // Model object.
- TGTextEntry* fFile;
- TGTextButton* fOpenFile;
+ TGTextEntry *fFile; // Text entry for file-name.
+ TGTextButton *fOpenFile; // Button to open the file.
- TEveGValuator* fEvent;
- TGCheckButton* fDoubleSR;
+ TEveGValuator *fEvent; // Valueator for event number.
+ TGCheckButton *fDoubleSR; // Check-box for double sampling-rate.
// AliEveTPCData loading settings
- TEveGValuator* fDataLoadThreshold;
- TEveGValuator* fDataLoadPedestal;
- TGCheckButton* fDataAutoPedestal;
+ TEveGValuator *fDataLoadThreshold; // Valuator for threshold.
+ TEveGValuator *fDataLoadPedestal; // Valuator for pedestal.
+ TGCheckButton *fDataAutoPedestal; // Check-box for auto pedestal.
- TGTextButton* fUpdateSectors;
- TGTextButton* fReloadSectors;
- TGTextButton* fCreateSectors3D;
- TGTextButton* fDeleteSectors3D;
+ TGTextButton *fUpdateSectors; // Button to update sectors.
+ TGTextButton *fReloadSectors; // Button to reload sectors.
+ TGTextButton *fCreateSectors3D; // Button to create 3D sectors.
+ TGTextButton *fDeleteSectors3D; // Button to delete 3D sectors.
public:
AliEveTPCLoaderEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
- UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- ~AliEveTPCLoaderEditor();
+ UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+ ~AliEveTPCLoaderEditor() {}
virtual void SetModel(TObject* obj);
void DoCreateSectors3D();
void DoDeleteSectors3D();
- ClassDef(AliEveTPCLoaderEditor, 0); // Editor for AliEveTPCLoader
+ ClassDef(AliEveTPCLoaderEditor, 0); // Editor for AliEveTPCLoader.
}; // endclass AliEveTPCLoaderEditor
#endif
fUseTexture (kTRUE),
fPickEmpty (kFALSE),
fPickMode (1)
-{}
-
-AliEveTPCSector2D::~AliEveTPCSector2D()
-{}
+{
+ // Constructor.
+}
/******************************************************************************/
void AliEveTPCSector2D::MakeSector3D()
{
+ // Make a 3D sector with same setting as this one.
+ // It is added as a child ot this object.
+
AliEveTPCSector3D* s = new AliEveTPCSector3D;
s->SetDataSource(fTPCData);
s->SetSectorID(fSectorID);
s->SetAutoTrans(fAutoTrans);
+ s->CopyVizParams(*this);
gEve->AddElement(s, this);
gEve->Redraw3D();
}
void AliEveTPCSector2D::ComputeBBox()
{
+ // Compute boundig-box.
+
const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg();
const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg();
void AliEveTPCSector2D::Paint(Option_t* )
{
+ // Paint object.
+
if(fRnrSelf == kFALSE)
return;
friend class AliEveTPCSector2DEditor;
protected:
- Bool_t fShowMax;
- Bool_t fAverage;
+ Bool_t fShowMax; // Show maximum signal-value in time range.
+ Bool_t fAverage; // Show average signal value in time range.
- Bool_t fUseTexture;
- Bool_t fPickEmpty;
- Int_t fPickMode; // 0-print, 1-1dhisto of pad, 2-2dhisto of padrow
+ Bool_t fUseTexture; // Use texture to draw each segment.
+ Bool_t fPickEmpty; // Pick also empty pads.
+ Int_t fPickMode; // Pick mode: 0-print, 1-1dhisto of pad, 2-2dhisto of padrow.
public:
AliEveTPCSector2D(const Text_t* n="AliEveTPCSector2D", const Text_t* t=0);
- virtual ~AliEveTPCSector2D();
+ virtual ~AliEveTPCSector2D() {}
void SetShowMax(Bool_t sm) { fShowMax = sm; IncRTS(); }
void SetAverage(Bool_t avg) { fAverage = avg; IncRTS(); }
virtual void Paint(Option_t* option="");
- ClassDef(AliEveTPCSector2D, 1); // Visualization of TPC raw-data in 2D
+ ClassDef(AliEveTPCSector2D, 1); // Visualization of TPC raw-data in 2D.
}; // endclass AliEveTPCSector2D
#endif
//______________________________________________________________________________
-// AliEveTPCSector2DEditor
//
+// Editor for AliEveTPCSector2D.
ClassImp(AliEveTPCSector2DEditor)
AliEveTPCSector2DEditor::AliEveTPCSector2DEditor(const TGWindow *p,
- Int_t width, Int_t height,
- UInt_t options, Pixel_t back) :
+ Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(0),
fShowMax(0), fAverage(0), fUseTexture(0), fPickEmpty(0), fPickMode(0)
{
+ // Constructor.
+
MakeTitle("AliEveTPCSector2D");
{
}
}
-AliEveTPCSector2DEditor::~AliEveTPCSector2DEditor()
-{}
-
/******************************************************************************/
void AliEveTPCSector2DEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveTPCSector2D*>(obj);
fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
void AliEveTPCSector2DEditor::DoShowMax()
{
+ // Slot for ShowMax.
+
fM->SetShowMax(fShowMax->IsOn());
SetupAverage();
Update();
void AliEveTPCSector2DEditor::DoAverage()
{
+ // Slot for Average.
+
fM->SetAverage(fAverage->IsOn());
Update();
}
void AliEveTPCSector2DEditor::SetupAverage()
{
- if(fM->fShowMax) {
+ // Setup Average button according to mode.
+
+ if (fM->fShowMax) {
fAverage->SetEnabled(kFALSE);
} else {
fAverage->SetEnabled(kTRUE);
void AliEveTPCSector2DEditor::DoUseTexture()
{
+ // Slot for UseTexture.
+
fM->fUseTexture = fUseTexture->IsOn();
Update();
}
void AliEveTPCSector2DEditor::DoPickEmpty()
{
+ // Slot for PickEmpty.
+
fM->fPickEmpty = fPickEmpty->IsOn();
- // Update();
}
void AliEveTPCSector2DEditor::DoPickMode(Int_t mode)
{
+ // Slot for PickMode.
+
fM->fPickMode = mode;
- // Update();
}
AliEveTPCSector2DEditor& operator=(const AliEveTPCSector2DEditor&); // Not implemented
protected:
- AliEveTPCSector2D* fM; // fModel dynamic-casted to AliEveTPCSector2DEditor
+ AliEveTPCSector2D *fM; // Model object.
- TGCheckButton* fShowMax;
- TGCheckButton* fAverage;
+ TGCheckButton *fShowMax; // Check to show maximum signal.
+ TGCheckButton *fAverage; // Check-box to show average of the signal.
- TGCheckButton* fUseTexture;
- TGCheckButton* fPickEmpty;
- TGComboBox* fPickMode;
+ TGCheckButton *fUseTexture; // Check-box to use texture.
+ TGCheckButton *fPickEmpty; // Check-box for picking of empty pads.
+ TGComboBox *fPickMode; // Selector of pick-mode.
public:
AliEveTPCSector2DEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- ~AliEveTPCSector2DEditor();
+ ~AliEveTPCSector2DEditor() {}
virtual void SetModel(TObject* obj);
void DoPickEmpty();
void DoPickMode(Int_t mode);
- ClassDef(AliEveTPCSector2DEditor, 0); // Editor for AliEveTPCSector2D
+ ClassDef(AliEveTPCSector2DEditor, 0); // Editor for AliEveTPCSector2D.
}; // endclass AliEveTPCSector2DEditor
#endif
#include <TGLSelectRecord.h>
#include <TGLIncludes.h>
-using namespace std;
-
//______________________________________________________________________________
-// AliEveTPCSector2DGL
//
+// GL renderer for TPCSector2D.
ClassImp(AliEveTPCSector2DGL)
fImage (0),
fTexture (0),
fRTS (0)
-{}
+{
+ // Constructor.
+}
AliEveTPCSector2DGL::~AliEveTPCSector2DGL()
{
- if(fImage) delete fImage;
- if(fTexture) glDeleteTextures(1, &fTexture);
+ // Destructor.
+ // !!!! Should unregister texture via ContextIdentity!
+
+ if (fImage) delete fImage;
+ if (fTexture) glDeleteTextures(1, &fTexture);
}
/******************************************************************************/
Bool_t AliEveTPCSector2DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
- if(SetModelCheckClass(obj, AliEveTPCSector2D::Class())) {
+ // Set model object.
+
+ if (SetModelCheckClass(obj, AliEveTPCSector2D::Class())) {
fSector = (AliEveTPCSector2D*) fExternalObj;
return kTRUE;
}
void AliEveTPCSector2DGL::SetBBox()
{
+ // Set bounding-box.
+
SetAxisAlignedBBox(((AliEveTPCSector2D*)fExternalObj)->AssertBBox());
}
/******************************************************************************/
void AliEveTPCSector2DGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/,
- TGLSelectRecord & rec)
+ TGLSelectRecord & rec)
{
+ // Process selection record.
+ // Determine row and pad, call PadSelected() in model object.
+
if (rec.GetN() != 3) return;
Int_t row = rec.GetItem(1);
Int_t pad = rec.GetItem(2);
/******************************************************************************/
void AliEveTPCSector2DGL::LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
- Int_t row, Int_t col_off) const
+ Int_t row, Int_t col_off) const
{
+ // Load data for one pad-row into the texture.
+
Int_t padVal;
Int_t time, val;
void AliEveTPCSector2DGL::CreateTexture() const
{
+ // Create texture that holds pad data.
+
if (fImage == 0 ) {
fImage = new UChar_t[fgkTextureByteSize];
glGenTextures(1, &fTexture);
/******************************************************************************/
void AliEveTPCSector2DGL::DisplayTexture(const AliEveTPCSectorData::SegmentInfo& seg,
- Int_t startCol, Int_t startRow) const
+ Int_t startCol, Int_t startRow) const
{
+ // Display segment data via one textured rectangle.
+
Float_t w = seg.GetNMaxPads()*seg.GetPadWidth()/2;
Float_t y1 = seg.GetRLow();
Float_t y2 = y1 + seg.GetNRows()*seg.GetPadHeight();
/******************************************************************************/
void AliEveTPCSector2DGL::DisplayQuads(const AliEveTPCSectorData::SegmentInfo& seg,
- Int_t startCol, Int_t startRow) const
+ Int_t startCol, Int_t startRow) const
{
+ // Display segment data by rendering one quad per pad.
+
Float_t y_d, y_u;
Float_t x_off, x;
Float_t padW = seg.GetPadWidth();
}
void AliEveTPCSector2DGL::DisplayNamedQuads(const AliEveTPCSectorData::SegmentInfo& seg,
- Int_t startCol, Int_t startRow) const
+ Int_t startCol, Int_t startRow) const
{
+ // Display segmen data as one quad per pad.
+ // Tag the rows and pads for selection.
+
Float_t y_d, y_u;
Float_t x_off, x;
Float_t padW = seg.GetPadWidth();
void AliEveTPCSector2DGL::TraceStepsUp(const AliEveTPCSectorData::SegmentInfo& s)
{
+ // Trace border of segment upwards.
+
Float_t x = -(s.GetNMaxPads()*1.0/2 - s.GetNYSteps())*s.GetPadWidth();
Float_t y = s.GetRLow();
glVertex2f(x, y);
void AliEveTPCSector2DGL::TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s)
{
+ // Trace border of segment downwards.
+
Float_t x = s.GetNMaxPads()*s.GetPadWidth()/2;
Float_t y = s.GetRLow() + s.GetNRows()*s.GetPadHeight();
glVertex2f(x, y);
void AliEveTPCSector2DGL::DisplayFrame() const
{
+ // Display frame of the sector.
+ // Each segment's frame is drawn only if its data is drawn, too.
+
UChar_t col[4];
TEveUtil::TEveUtil::ColorFromIdx(fSector->fFrameColor, col);
glColor4ubv(col);
UChar_t* GetRowCol(Int_t row, Int_t col) const;
- AliEveTPCSector2D* fSector;
- mutable AliEveTPCSectorData* fSectorData;
+ AliEveTPCSector2D *fSector; // Model object.
+ mutable AliEveTPCSectorData *fSectorData; // Data of displayed sector.
- mutable UChar_t* fImage;
- mutable UInt_t fTexture;
- mutable UInt_t fRTS;
+ mutable UChar_t *fImage; // Texture data.
+ mutable UInt_t fTexture; // Texture id.
+ mutable UInt_t fRTS; // Render time-stamp.
public:
AliEveTPCSector2DGL();
static void TraceStepsUp (const AliEveTPCSectorData::SegmentInfo& s);
static void TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s);
- static const Int_t fgkTextureWidth;
- static const Int_t fgkTextureHeight;
- static const Int_t fgkTextureByteSize;
+ static const Int_t fgkTextureWidth; // Width of the texture.
+ static const Int_t fgkTextureHeight; // Height of the texture.
+ static const Int_t fgkTextureByteSize; // Size of the texture in bytes.
-}; // endclass TPCSector2D_GL_Rnr
+ ClassDef(AliEveTPCSector2DGL, 0); // GL renderer for TPCSector2D.
+};
inline UChar_t* AliEveTPCSector2DGL::GetRowCol(Int_t row, Int_t col) const
//______________________________________________________________________________
-// AliEveTPCSector3D
//
+// Visualization of TPC raw-data in 3D.
ClassImp(AliEveTPCSector3D)
fDriftVel (1),
fZStep (250.0/450)
{
+ // Constructor.
+
fRnrFrame = kFALSE;
ComputeBBox();
}
-AliEveTPCSector3D::~AliEveTPCSector3D()
-{}
-
/******************************************************************************/
void AliEveTPCSector3D::SetRnrFrame(Bool_t rf)
{
+ // Setter for fRnrFrame.
+
if(fRnrFrame != rf) {
fRnrFrame = rf;
IncRTS();
void AliEveTPCSector3D::ComputeBBox()
{
+ // Compute bounding box containing whole sector.
+
const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg();
const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg();
void AliEveTPCSector3D::Paint(Option_t* /*option*/)
{
+ // Paint object.
+
if(fRnrSelf == kFALSE)
return;
void AliEveTPCSector3D::LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
Float_t xs, Float_t ys, Float_t pw, Float_t ph)
{
+ // Load data of one padrow. Fill internal boxset and pointset objects.
+
Short_t pad, time, val;
Float_t x0, z0;
Float_t ym = ys + 0.5*ph;
}
}
-void AliEveTPCSector3D::UpdateBoxes()
+void AliEveTPCSector3D::UpdateBoxesAndPoints()
{
- // Populate parent class TEveBoxSet with digit information.
+ // Populate BoxSet and PointSet with digit information.
// printf("AliEveTPCSector3D update boxes\n");
}
fBoxSet.RefitPlex();
- if(fPointSetOn)
+ if (fPointSetOn)
fPointSetArray.CloseBins();
}
}
void AliEveTPCSector3D::SetupPointSetArray()
{
- Int_t nBins = (Int_t) TMath::Nint(fPointFrac*gStyle->GetNumberOfColors());
- if(nBins > 0) {
+ // Setup fPointSetArray for current settings.
+
+ Int_t nBins = (Int_t) TMath::Nint(fPointFrac*gStyle->GetNumberOfColors());
+ if (nBins > 0) {
fPointSetOn = kTRUE;
fPointSetMaxVal = fThreshold + (Int_t) TMath::Nint(fPointFrac*(fMaxVal - fThreshold));
// printf("SetupPointSetArray frac=%f nbins=%d psmv=%d (%d,%d)\n", fPointFrac, nBins, fPointSetMaxVal, fThreshold, fMaxVal);
fPointSetArray.InitBins("", nBins, fThreshold, fPointSetMaxVal, kFALSE);
- for(Int_t b=0; b<nBins; ++b) {
+ for (Int_t b=0; b<nBins; ++b) {
fPointSetArray.GetBin(b)->SetMarkerColor(gStyle->GetColorPalette(b));
}
} else {
protected:
void LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
Float_t sx, Float_t sy, Float_t pw, Float_t ph);
- void UpdateBoxes();
+ void UpdateBoxesAndPoints();
void SetupPointSetArray();
- TEveBoxSet fBoxSet;
- TEvePointSetArray fPointSetArray;
- Float_t fPointFrac;
- Float_t fPointSize;
- Bool_t fPointSetOn;
- Int_t fPointSetMaxVal;
+ TEveBoxSet fBoxSet; // BoxSet used to display digits as boxes.
+ TEvePointSetArray fPointSetArray; // PointSet used to display digits as points.
+ Float_t fPointFrac; // Fraction of signal range shown as points.
+ Float_t fPointSize; // Point size.
+ Bool_t fPointSetOn; // PointSet initialized.
+ Int_t fPointSetMaxVal; // Maximum signal value for data in pointset.
- Float_t fDriftVel;
- Float_t fZStep;
+ Float_t fDriftVel; // Drift velocity for 'z' coordinate.
+ Float_t fZStep; // Z width of a time-bin.
public:
AliEveTPCSector3D(const Text_t* n="AliEveTPCSector3D", const Text_t* t=0);
- virtual ~AliEveTPCSector3D();
+ virtual ~AliEveTPCSector3D() {}
void SetPointFrac(Float_t f) { fPointFrac = f; IncRTS(); }
void SetPointSize(Float_t s) { fPointSize = s; }
virtual void ComputeBBox();
virtual void Paint(Option_t* option="");
- ClassDef(AliEveTPCSector3D, 1);
-}; // endclass AliEveTPCSector3D
+ ClassDef(AliEveTPCSector3D, 1); // Visualization of TPC raw-data in 3D.
+};
#endif
//______________________________________________________________________________
-// AliEveTPCSector3DEditor
//
+// Editor for AliEveTPCSector3D.
ClassImp(AliEveTPCSector3DEditor)
AliEveTPCSector3DEditor::AliEveTPCSector3DEditor(const TGWindow *p,
- Int_t width, Int_t height,
- UInt_t options, Pixel_t back) :
+ Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(0),
fRnrFrame(0), fDriftVel(0), fPointFrac(0), fPointSize(0)
{
+ // Constructor.
+
MakeTitle("AliEveTPCSector3D");
Int_t labelW = 60;
AddFrame(fPointSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
}
-AliEveTPCSector3DEditor::~AliEveTPCSector3DEditor()
-{}
-
/******************************************************************************/
void AliEveTPCSector3DEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveTPCSector3D*>(obj);
fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
void AliEveTPCSector3DEditor::DoRnrFrame()
{
+ // Slot for RnrFrame.
+
fM->SetRnrFrame(fRnrFrame->IsOn());
Update();
}
void AliEveTPCSector3DEditor::DoDriftVel()
{
+ // Slot for DriftVel.
+
fM->SetDriftVel(fDriftVel->GetValue());
Update();
}
void AliEveTPCSector3DEditor::DoPointFrac()
{
+ // Slot for PointFrac.
+
fM->SetPointFrac(fPointFrac->GetValue());
Update();
}
void AliEveTPCSector3DEditor::DoPointSize()
{
+ // Slot for PointSize.
+
fM->SetPointSize(fPointSize->GetValue());
Update();
}
AliEveTPCSector3DEditor& operator=(const AliEveTPCSector3DEditor&); // Not implemented
protected:
- AliEveTPCSector3D* fM; // fModel dynamic-casted to AliEveTPCSector3DEditor
+ AliEveTPCSector3D *fM; // Model object.
- TGCheckButton* fRnrFrame;
- TEveGValuator* fDriftVel;
+ TGCheckButton *fRnrFrame; // Check-box for frame rendering.
+ TEveGValuator *fDriftVel; // Valuator for drift velocity.
- TEveGValuator* fPointFrac;
- TEveGValuator* fPointSize;
+ TEveGValuator *fPointFrac; // Valuator for signal fraction displayed as points.
+ TEveGValuator *fPointSize; // Size of point in GL.
public:
AliEveTPCSector3DEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- virtual ~AliEveTPCSector3DEditor();
+ virtual ~AliEveTPCSector3DEditor() {}
virtual void SetModel(TObject* obj);
void DoPointFrac();
void DoPointSize();
- ClassDef(AliEveTPCSector3DEditor, 0); // Editor for AliEveTPCSector3D
+ ClassDef(AliEveTPCSector3DEditor, 0); // Editor for AliEveTPCSector3D.
}; // endclass AliEveTPCSector3DEditor
#endif
//______________________________________________________________________________
-// AliEveTPCSector3DGL
//
+// GL renderer for AliEveTPCSector3D.
ClassImp(AliEveTPCSector3DGL)
fSector(0), fBoxRnr(0),
fRTS(0)
{
+ // Constructor.
+
// fDLCache = false; // Disable display list.
}
AliEveTPCSector3DGL::~AliEveTPCSector3DGL()
{
+ // Destructor.
+
delete fBoxRnr;
}
Bool_t AliEveTPCSector3DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
+ // Set model object.
+
if(SetModelCheckClass(obj, AliEveTPCSector3D::Class())) {
fSector = (AliEveTPCSector3D*) fExternalObj;
if(fBoxRnr == 0) {
void AliEveTPCSector3DGL::SetBBox()
{
+ // Set bounding-box.
+
SetAxisAlignedBBox(((AliEveTPCSector3D*)fExternalObj)->AssertBBox());
}
void AliEveTPCSector3DGL::DirectDraw(TGLRnrCtx & rnrCtx) const
{
+ // Render object.
+
// printf("AliEveTPCSector3DGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD());
if(fRTS < fSector->fRTS) {
- fSector->UpdateBoxes();
+ fSector->UpdateBoxesAndPoints();
fRTS = fSector->fRTS;
}
}
void AliEveTPCSector3DGL::DrawSegmentFrame(const AliEveTPCSectorData::SegmentInfo& s,
- Int_t botExtraPads, Int_t topExtraPads) const
+ Int_t botExtraPads, Int_t topExtraPads) const
{
+ // Draw frame of given segment.
+
Float_t xl, xh, yl, yh, zl, zh;
xl = 0.5*s.GetPadWidth()*(AliEveTPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
xh = 0.5*s.GetPadWidth()*(AliEveTPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
AliEveTPCSector3DGL& operator=(const AliEveTPCSector3DGL&); // Not implemented
protected:
- AliEveTPCSector3D* fSector; // fModel dynamic-casted to AliEveTPCSector3DGL
- TEveBoxSetGL* fBoxRnr;
+ AliEveTPCSector3D *fSector; // Model object.
+ TEveBoxSetGL *fBoxRnr; // Box-set GL renderer.
- mutable UInt_t fRTS;
+ mutable UInt_t fRTS; // Rendering time-stamp.
virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
- ClassDef(AliEveTPCSector3DGL, 0);
+ ClassDef(AliEveTPCSector3DGL, 0); // GL renderer for AliEveTPCSector3D.
}; // endclass AliEveTPCSector3DGL
#endif
#include <string.h>
//______________________________________________________________________________
-// AliEveTPCSectorData
//
// Stores data from a fiven TPC sector.
//
// inner/outer segments. The SegmentInfo objects can be used to get
// information about low-level segments.
//
-// A lot of TPC-sector information is stored as static data.
+// A lot of TPC-sector geometry information is stored as static data.
//
// For accessing data, see for example AliEveTPCSector2DGL::CreateTexture()
// and LoadPadrow().
//
-
ClassImp(AliEveTPCSectorData)
AliTPCParam* AliEveTPCSectorData::fgParam = 0;
void AliEveTPCSectorData::InitStatics()
{
- if(fgParam != 0) return;
+ // Initialize static variables.
+
+ if (fgParam != 0) return;
fgParam = new AliTPCParamSR;
- fgZLength = fgParam->GetZLength(0)+0.275;
- fgNAllRows = fgParam->GetNRowLow() + fgParam->GetNRowUp();
+ fgZLength = fgParam->GetZLength(0) + 0.275;
+ fgNAllRows = fgParam->GetNRowLow() + fgParam->GetNRowUp();
fgNAllPads = 0;
fgRowBegs = new Int_t[fgNAllRows + 1];
Int_t row = 0;
- for(Int_t i=0; i<fgParam->GetNRowLow(); ++i, ++row) {
+ for (Int_t i=0; i<fgParam->GetNRowLow(); ++i, ++row) {
fgRowBegs[row] = fgNAllPads;
fgNAllPads += fgParam->GetNPadsLow(i);
}
- for(Int_t i=0; i<fgParam->GetNRowUp(); ++i, ++row) {
+ for (Int_t i=0; i<fgParam->GetNRowUp(); ++i, ++row) {
fgRowBegs[row] = fgNAllPads;
fgNAllPads += fgParam->GetNPadsUp(i);
}
Int_t AliEveTPCSectorData::GetNPadsInRow(Int_t row)
{
+ // Return number of pads in given row.
+
if(row < 0 || row >= fgNAllRows) return 0;
return fgRowBegs[row + 1] - fgRowBegs[row];
}
const AliEveTPCSectorData::SegmentInfo& AliEveTPCSectorData::GetSeg(Int_t seg)
{
+ // Return reference to segment geometry information.
+ // 0 ~ inner, 1 ~ middle, 2 ~ outer.
+
static const SegmentInfo null;
if(seg < 0 || seg > 2)
void AliEveTPCSectorData::NewBlock()
{
+ // Create new data-block. Position is set to the beginning.
+
fBlocks.push_back(new Short_t[fBlockSize]);
fBlockPos = 0;
}
fCurrentRow(0), fCurrentPad(0), fCurrentPos(0), fCurrentStep(0),
fPadRowHackSet(0)
{
+ // Constructor.
+
if(fgParam == 0) InitStatics();
fPads.assign(fgNAllPads, PadData());
AliEveTPCSectorData::~AliEveTPCSectorData()
{
+ // Destructor.
+
for(std::vector<Short_t*>::iterator b=fBlocks.begin(); b!=fBlocks.end(); ++b)
delete [] *b;
DeletePadRowHack();
void AliEveTPCSectorData::DropData()
{
+ // Drop data, deallocate data-blocks.
+
fPads.assign(fgNAllPads, PadData());
for(std::vector<Short_t*>::iterator b=fBlocks.begin(); b!=fBlocks.end(); ++b)
delete [] *b;
void AliEveTPCSectorData::Print(Option_t* /*opt*/) const
{
+ // Print summary information.
+
printf("AliEveTPCSectorData sector=%d, NPadsFilled=%d, NBlocks=%d, BlockPos=%d\n",
fSectorID, fNPadsFilled, fBlocks.size(), fBlockPos);
}
void AliEveTPCSectorData::BeginPad(Int_t row, Int_t pad, Bool_t reverseTime)
{
+ // Begin filling of pad-data as specified with arguments.
+
fCurrentRow = row;
fCurrentPad = pad;
if(reverseTime) {
void AliEveTPCSectorData::EndPad(Bool_t autoPedestal, Short_t threshold)
{
+ // End filling of pad-data. At this point data is compressed and moved
+ // into the cuurent position in memory block.
+
Short_t *beg, *end;
- if(fCurrentStep > 0) {
+ if (fCurrentStep > 0) {
beg = fPadBuffer;
end = fPadBuffer + fCurrentPos;
} else {
//printf("endpad for row=%d pad=%d\n buf=%p beg=%p end=%p pos=%d step=%d\n",
// fCurrentRow, fCurrentPad,
// fPadBuffer, beg, end, fCurrentPos, fCurrentStep);
- if(beg >= end)
+ if (beg >= end)
return;
- if(autoPedestal) {
+ if (autoPedestal) {
Short_t array[1024];
Short_t* val;
val = beg + 1;
}
Short_t pedestal = TMath::Nint(TMath::Median((end-beg)/2, array));
val = beg + 1;
- while(val <= end) {
+ while (val <= end) {
*val -= pedestal;
val += 2;
}
Short_t* wpos = beg;
Short_t* rpos = beg;
- while(rpos < end) {
- if(rpos[1] >= threshold) {
+ while (rpos < end) {
+ if (rpos[1] >= threshold) {
wpos[0] = rpos[0];
wpos[1] = rpos[1];
wpos += 2;
Short_t* rpos = beg;
// Compress pad buffer
- while(rpos < end) {
+ while (rpos < end) {
Short_t* spos = rpos;
Short_t t = spos[0];
- while(true) {
+ while (true) {
rpos += 2;
if(rpos >= end || *rpos > t + 1 || t == 0)
break;
++t;
}
Short_t n = t - spos[0] + 1;
- if(n == 1) {
+ if (n == 1) {
wpos[0] = -spos[0];
wpos[1] = spos[1];
wpos += 2;
wpos[2] = spos[1];
wpos[1] = n;
wpos += 3; spos += 3;
- while(--n) {
+ while (--n) {
*wpos = *spos;
++wpos; spos += 2;
}
}
// Copy buffer to storage, set PadData
- if(wpos > beg) {
+ if (wpos > beg) {
Short_t len = wpos - beg;
- if(len > fBlockSize - fBlockPos)
+ if (len > fBlockSize - fBlockPos)
NewBlock();
Short_t *dest = fBlocks.back() + fBlockPos;
memcpy(dest, beg, len*sizeof(Short_t));
const AliEveTPCSectorData::PadData& AliEveTPCSectorData::GetPadData(Int_t padAddr)
{
+ // Get pad-data reference by absolute index.
+
static const PadData null;
if(padAddr < 0 || padAddr >= fgNAllPads) return null;
const AliEveTPCSectorData::PadData& AliEveTPCSectorData::GetPadData(Int_t row, Int_t pad)
{
+ // Get pad-data reference by row and pad number.
+
static const PadData null;
Int_t np = GetNPadsInRow(row);
AliEveTPCSectorData::PadIterator AliEveTPCSectorData::MakePadIterator(Int_t padAddr, Short_t thr)
{
+ // Get pad-data iterator by absolute index.
+
return PadIterator(GetPadData(padAddr), thr);
}
AliEveTPCSectorData::PadIterator AliEveTPCSectorData::MakePadIterator(Int_t row, Int_t pad, Short_t thr)
{
+ // Get pad-data iterator by row and pad number.
+
return PadIterator(GetPadData(row, pad), thr);
}
AliEveTPCSectorData::RowIterator AliEveTPCSectorData::MakeRowIterator(Int_t row, Short_t thr)
{
+ // Get row iterator.
+
Short_t npads = GetNPadsInRow(row);
if(npads > 0)
return RowIterator(&fPads[fgRowBegs[row]], npads, thr);
void AliEveTPCSectorData::PadData::Print(Option_t* /*opt*/)
{
+ // Print summary information.
+
printf("addr=%p, len=%hd>\n", (void*)fData, fLength);
for(Int_t i=0; i<fLength; ++i)
printf(" %3d %hd\n", i, fData[i]);
Bool_t AliEveTPCSectorData::PadIterator::Next()
{
- if(fPos >= fEnd) return kFALSE;
- if(fNChunk > 0) {
+ // Move iterator to next signal above the iteration threshold.
+ // Returns false when the end of data is reached.
+
+ if (fPos >= fEnd) return kFALSE;
+ if (fNChunk > 0) {
++fTime;
--fNChunk;
fSignal = *fPos; ++fPos;
} else {
fTime = fPos[0];
- if(fTime <= 0) {
+ if (fTime <= 0) {
fTime = -fTime;
fSignal = fPos[1];
fPos += 2;
Bool_t AliEveTPCSectorData::RowIterator::NextPad()
{
+ // Move iterator to next pad.
+
++fPad;
if(fPad >= fNPads) return kFALSE;
Reset(fPadArray[fPad]);
fPad = -1;
}
-void AliEveTPCSectorData::RowIterator::Test()
-{
- while(NextPad()) {
- printf("TEvePad %d\n", fPad);
- PadIterator::Test();
- }
-}
-
/******************************************************************************/
// AliEveTPCSectorData::SegmentInfo
/******************************************************************************/
+//______________________________________________________________________________
+//
+// Stores geometry data about a segment needed for fast data-access
+// and rendering
+
ClassImp(AliEveTPCSectorData::SegmentInfo)
AliEveTPCSectorData::SegmentInfo::SegmentInfo() :
fNMaxPads(0),
fNYSteps(0)
{
+ // Constructor.
+
memset(fYStep, sizeof(fYStep), 0);
}
AliEveTPCSectorData::PadRowHack* AliEveTPCSectorData::GetPadRowHack(Int_t r, Int_t p)
{
- if(fPadRowHackSet == 0) return 0;
+ // Get PadRowHack applicable to given row and pad.
+
+ if (fPadRowHackSet == 0) return 0;
std::set<PadRowHack>* hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
std::set<PadRowHack>::iterator i = hs->find(PadRowHack(r,p));
return (i == hs->end()) ? 0 : const_cast<PadRowHack*>(&*i);
void AliEveTPCSectorData::AddPadRowHack(Int_t r, Int_t p, Int_t te, Float_t tf)
{
- if(fPadRowHackSet == 0) fPadRowHackSet = new std::set<PadRowHack>;
+ // Register PadRowHack for given row and pad.
+
+ if (fPadRowHackSet == 0) fPadRowHackSet = new std::set<PadRowHack>;
PadRowHack* prh = GetPadRowHack(r, p);
- if(prh == 0) {
+ if (prh == 0) {
std::set<PadRowHack>* hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
hs->insert(PadRowHack(r, p, te, tf));
} else {
void AliEveTPCSectorData::RemovePadRowHack(Int_t r, Int_t p)
{
- if(fPadRowHackSet == 0) return;
+ // Remove PadRowHack for given row and pad.
+
+ if (fPadRowHackSet == 0) return;
std::set<PadRowHack>*hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
std::set<PadRowHack>::iterator i = hs->find(PadRowHack(r,p));
if(i != hs->end()) hs->erase(i);
void AliEveTPCSectorData::DeletePadRowHack()
{
- if(fPadRowHackSet != 0) {
+ // Delete all PadRowHacks and their container.
+
+ if (fPadRowHackSet != 0) {
std::set<PadRowHack>*hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
delete hs;
fPadRowHackSet = 0;
class PadData
{
protected:
- Short_t* fData;
- Short_t fLength;
+ Short_t* fData; // Data for given pad.
+ Short_t fLength; // Length of pad-data.
public:
PadData(Short_t* d=0, Short_t l=0) : fData(d), fLength(l) {}
class PadIterator
{
protected:
- Short_t *fBeg, *fEnd, *fPos;
- Short_t fTime, fSignal;
- Short_t fThreshold;
- Short_t fNChunk;
+ Short_t *fBeg, *fEnd; // Begin and end of data.
+ Short_t *fPos; // Current position.
+ Short_t fTime, fSignal; // Current time and signal.
+ Short_t fThreshold; // Threshold for data iteration.
+ Short_t fNChunk; // Number of contiguous signals still to read.
public:
PadIterator(const PadData& pd, Short_t thr=0) :
class RowIterator : public PadIterator
{
protected:
- const PadData* fPadArray;
- Short_t fNPads;
- Short_t fPad;
+ const PadData *fPadArray; // Pointer to array of pad-data.
+ Short_t fNPads; // Number of pads in row.
+ Short_t fPad; // Current pad.
public:
RowIterator(const PadData* first, Short_t npads, Short_t thr=0) :
void ResetRow(const PadData* first, Short_t npads);
Short_t TEvePad() const { return fPad; }
-
- void Test();
};
class SegmentInfo : public TObject
friend class AliEveTPCSectorData;
private:
- Float_t fPadWidth;
- Float_t fPadHeight;
- Float_t fRLow; // Radius at the bottom of first row
- Int_t fNRows; // Number of rows in this segment
- Int_t fFirstRow; // First row index within sector
- Int_t fLastRow; // Last row index within sector
- Int_t fNMaxPads; // Maximum number of pads in a row
- Int_t fNYSteps; // Number of steps in pad-count
- Float_t fYStep[64]; // Y coords where pad-count changes
+ Float_t fPadWidth; // Width of pad in this segment.
+ Float_t fPadHeight; // Height of pad in this segment.
+ Float_t fRLow; // Radius at the bottom of first row.
+ Int_t fNRows; // Number of rows in this segment.
+ Int_t fFirstRow; // First row index within sector.
+ Int_t fLastRow; // Last row index within sector.
+ Int_t fNMaxPads; // Maximum number of pads in a row.
+ Int_t fNYSteps; // Number of steps in pad-count.
+ Float_t fYStep[64]; // Y coords where pad-count changes.
public:
SegmentInfo();
};
private:
- static AliTPCParam *fgParam;
- static Float_t fgZLength;
- static Int_t fgNAllRows;
- static Int_t fgNAllPads;
- static Int_t *fgRowBegs;
+ static AliTPCParam *fgParam; // Global TPC parameters.
+ static Float_t fgZLength; // Z-length of a sector.
+ static Int_t fgNAllRows; // Number of rows in all segments.
+ static Int_t fgNAllPads; // Number of pads in all segments.
+ static Int_t *fgRowBegs; // Ids of pads at row-beginnings.
- static SegmentInfo fgInnSeg;
- static SegmentInfo fgOut1Seg;
- static SegmentInfo fgOut2Seg;
+ static SegmentInfo fgInnSeg; // Geometry information for inner segment.
+ static SegmentInfo fgOut1Seg; // Geometry information for middle segment.
+ static SegmentInfo fgOut2Seg; // Geometry information for outer segment.
- static SegmentInfo* fgSegInfoPtrs[3];
+ static SegmentInfo* fgSegInfoPtrs[3]; // Array of geometry information objects, for access by segment id.
protected:
- Int_t fSectorID;
- Int_t fNPadsFilled;
- std::vector<PadData> fPads;
+ Int_t fSectorID; // Sector id.
+ Int_t fNPadsFilled; // Number of filled pads.
+ std::vector<PadData> fPads; // Vector of pad-data.
// Blocks of pad-data.
- const Int_t fBlockSize;
- Int_t fBlockPos;
- std::vector<Short_t*> fBlocks;
+ const Int_t fBlockSize; // Size of pad-data block.
+ Int_t fBlockPos; // Position in current block.
+ std::vector<Short_t*> fBlocks; // Vector of blocks.
void NewBlock();
- // Intermediate buffer/vars for pad-data.
- Short_t fPadBuffer[2048];
- Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
+
+ // Intermediate buffer/vars used during filling of pad-data.
+ Short_t fPadBuffer[2048]; // Buffer for current pad.
+ Int_t fCurrentRow; // Current row.
+ Int_t fCurrentPad; // Current pad.
+ Int_t fCurrentPos; // Current position in pad-buffer.
+ Int_t fCurrentStep; // Step, can be -2 or +2, depending on fill direction.
Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
class PadRowHack
{
public:
- Int_t fRow, fPad;
- Int_t fThrExt;
- Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
+ Int_t fRow, fPad; // For which row, pad we hack.
+ Int_t fThrExt; // Additional treshold
+ Float_t fThrFac; // Additional threshold factor.
+ // Actual threshold = fThrExt + fThrFac*thr
PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
fRow(r), fPad(p), fThrExt(te), fThrFac(tf) {}
void DeletePadRowHack();
protected:
- void* fPadRowHackSet;
+ void* fPadRowHackSet; // Pointer to set of PadRowHacks.
- ClassDef(AliEveTPCSectorData, 0);
-}; // endclass AliEveTPCSectorData
+ ClassDef(AliEveTPCSectorData, 0); // Holds pad-data of a single TPC sector. Also stores geometry information in static data-members.
+};
inline void AliEveTPCSectorData::RegisterData(Short_t time, Short_t signal)
{
+ // Register data for given time.
+
fPadBuffer[fCurrentPos] = time;
fPadBuffer[fCurrentPos+1] = signal;
fCurrentPos += fCurrentStep;
//______________________________________________________________________________
-// AliEveTPCSectorViz
//
// Base class for TPC raw-data visualization.
// See AliEveTPCSector2D and AliEveTPCSector3D for concrete implementations.
fRTS (1),
fColorArray (0)
-{}
+{
+ // Constructor.
+}
AliEveTPCSectorViz::~AliEveTPCSectorViz()
{
- if(fTPCData) fTPCData->DecRefCount();
+ // Destructor.
+
+ if (fTPCData) fTPCData->DecRefCount();
delete [] fColorArray;
}
void AliEveTPCSectorViz::CopyVizParams(const AliEveTPCSectorViz& v)
{
+ // Copy basic viualization parameters from another TPCSectorViz.
+
fMinTime = v.fMinTime;
fMaxTime = v.fMaxTime;
fThreshold = v.fThreshold;
void AliEveTPCSectorViz::SetDataSource(AliEveTPCData* data)
{
- if(data == fTPCData) return;
- if(fTPCData) fTPCData->DecRefCount();
+ // Set the data source.
+
+ if (data == fTPCData) return;
+ if (fTPCData) fTPCData->DecRefCount();
fTPCData = data;
- if(fTPCData) fTPCData->IncRefCount();
+ if (fTPCData) fTPCData->IncRefCount();
IncRTS();
}
void AliEveTPCSectorViz::SetSectorID(Int_t id)
{
- if(id < 0) id = 0;
- if(id > 35) id = 35;
+ // Set sector id.
+
+ if (id < 0) id = 0;
+ if (id > 35) id = 35;
fSectorID = id;
- if(fAutoTrans)
+ if (fAutoTrans)
SetAutoTrans(kTRUE); // Force repositioning.
IncRTS();
}
AliEveTPCSectorData* AliEveTPCSectorViz::GetSectorData() const
{
+ // Get sector-data.
+
return fTPCData ? fTPCData->GetSectorData(fSectorID) : 0;
}
void AliEveTPCSectorViz::SetThreshold(Short_t t)
{
+ // Set visualization threshold.
+
fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1));
ClearColorArray();
IncRTS();
void AliEveTPCSectorViz::SetMaxVal(Int_t mv)
{
+ // Set visualization max signal value.
+ // Signals above this will have the same color.
+
fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1));
ClearColorArray();
IncRTS();
void AliEveTPCSectorViz::SetAutoTrans(Bool_t trans)
{
+ // Set automatic update of transformation matrix.
+ // The position is calculated immediately.
+
fAutoTrans = trans;
- if(fAutoTrans) {
+ if (fAutoTrans) {
fHMTrans.UnitTrans();
using namespace TMath;
Float_t s = Sin((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
Float_t z = AliEveTPCSectorData::GetZLength();
Float_t d = -1;
- if(fSectorID >= 18) {
+ if (fSectorID >= 18) {
z = -z;
d = -d;
}
void AliEveTPCSectorViz::SetupColor(Int_t val, UChar_t* pixel) const
{
+ // Set pixel color to represent signal val from the current palette.
+
using namespace TMath;
Float_t div = Max(1, fMaxVal - fThreshold);
Int_t nCol = gStyle->GetNumberOfColors();
Int_t cBin = (Int_t) Nint(nCol*(val - fThreshold)/div);
- TEveUtil::TEveUtil::ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
+ TEveUtil::ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
}
void AliEveTPCSectorViz::ClearColorArray()
{
- if(fColorArray) {
+ // Clear cached color array.
+
+ if (fColorArray) {
delete [] fColorArray;
fColorArray = 0;
}
void AliEveTPCSectorViz::SetupColorArray() const
{
- if(fColorArray)
+ // Initialize cached color array.
+
+ if (fColorArray)
return;
fColorArray = new UChar_t [4 * (fMaxVal - fThreshold + 1)];
UChar_t* p = fColorArray;
- for(Int_t v=fThreshold; v<=fMaxVal; ++v, p+=4)
+ for (Int_t v=fThreshold; v<=fMaxVal; ++v, p+=4)
SetupColor(v, p);
}
AliEveTPCSectorViz& operator=(const AliEveTPCSectorViz&); // Not implemented
protected:
- AliEveTPCData *fTPCData;
- Int_t fSectorID;
+ AliEveTPCData *fTPCData; // Source of data.
+ Int_t fSectorID; // Id of the displayed sector.
- Int_t fMinTime;
- Int_t fMaxTime;
- Short_t fThreshold;
- Int_t fMaxVal;
+ Int_t fMinTime; // Min time-bin to display.
+ Int_t fMaxTime; // Max time-bin to display.
+ Short_t fThreshold; // Threshold for display/
+ Int_t fMaxVal; // Maximum signal-value, all above is of the same color.
- Bool_t fRnrInn;
- Bool_t fRnrOut1;
- Bool_t fRnrOut2;
+ Bool_t fRnrInn; // Render inner segment.
+ Bool_t fRnrOut1; // Render middle segment.
+ Bool_t fRnrOut2; // Render outer segment.
- Color_t fFrameColor;
- Bool_t fRnrFrame;
- TEveTrans fHMTrans;
- Bool_t fAutoTrans;
- UInt_t fRTS; //! Rendering TimeStamp
+ Color_t fFrameColor; // Color of the frame, the main color.
+ Bool_t fRnrFrame; // Render frame.
+ TEveTrans fHMTrans; // Transformation matrix.
+ Bool_t fAutoTrans; // Automatically calculate transformation based on sector id.
+ UInt_t fRTS; //! Rendering TimeStamp
- mutable UChar_t *fColorArray;
+ mutable UChar_t *fColorArray; // Color array caching signal to color mapping.
void SetupColor(Int_t val, UChar_t* pix) const;
void ClearColorArray();
TEveTrans& RefHMTrans() { return fHMTrans; }
void SetUseTrans(Bool_t t) { fHMTrans.SetUseTrans(t); }
- ClassDef(AliEveTPCSectorViz, 1); // Base-class for TPC raw-data visualization
+ ClassDef(AliEveTPCSectorViz, 1); // Base-class for visualization of data for one TPC sector.
}; // endclass AliEveTPCSectorViz
//______________________________________________________________________________
-// AliEveTPCSectorVizEditor
//
+// Editor for AliEveTPCSectorViz.
ClassImp(AliEveTPCSectorVizEditor)
fThreshold (0), fMaxVal (0),
fTime (0)
{
+ // Constructor.
+
fPriority = 40;
Int_t labelW = 60;
AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
}
-AliEveTPCSectorVizEditor::~AliEveTPCSectorVizEditor()
-{}
-
/******************************************************************************/
void AliEveTPCSectorVizEditor::SetModel(TObject* obj)
{
+ // Set model object.
+
fM = dynamic_cast<AliEveTPCSectorViz*>(obj);
fHMTrans->SetModel(&fM->fHMTrans);
void AliEveTPCSectorVizEditor::DoSectorID()
{
+ // Slot for SectorID.
+
fM->SetSectorID((Int_t) fSectorID->GetValue());
Update();
}
void AliEveTPCSectorVizEditor::DoAutoTrans()
{
+ // Slot for AutoTrans.
+
fM->SetAutoTrans(fAutoTrans->IsOn());
Update();
}
void AliEveTPCSectorVizEditor::DoRnrInn()
{
+ // Slot for RnrInn.
+
fM->SetRnrInn(fRnrInn->IsOn());
Update();
}
void AliEveTPCSectorVizEditor::DoRnrOut1()
{
+ // Slot for RnrOut1.
+
fM->SetRnrOut1(fRnrOut1->IsOn());
Update();
}
void AliEveTPCSectorVizEditor::DoRnrOut2()
{
+ // Slot for RnrOut2.
+
fM->SetRnrOut2(fRnrOut2->IsOn());
Update();
}
void AliEveTPCSectorVizEditor::DoThreshold()
{
+ // Slot for Threshold.
+
fM->SetThreshold((Short_t) fThreshold->GetValue());
fThreshold->SetValue(fM->fThreshold);
Update();
void AliEveTPCSectorVizEditor::DoMaxVal()
{
+ // Slot for MaxVal.
+
fM->SetMaxVal((Int_t) fMaxVal->GetValue());
fMaxVal->SetValue(fM->fMaxVal);
Update();
void AliEveTPCSectorVizEditor::DoTime()
{
+ // Slot for time-range.
+
fM->SetMinTime((Int_t) fTime->GetMin());
fM->SetMaxTime((Int_t) fTime->GetMax());
Update();
AliEveTPCSectorVizEditor& operator=(const AliEveTPCSectorVizEditor&); // Not implemented
protected:
- AliEveTPCSectorViz* fM; // fModel dynamic-casted to AliEveTPCSectorVizEditor
+ AliEveTPCSectorViz *fM; // Model dynamic-casted to AliEveTPCSectorVizEditor
- TEveTransSubEditor* fHMTrans;
+ TEveTransSubEditor *fHMTrans; // Widget for transormation.
- TEveGValuator* fSectorID;
- TGCheckButton* fAutoTrans;
+ TEveGValuator *fSectorID; // Widget for SectorID.
+ TGCheckButton *fAutoTrans; // Widget for AutoTrans.
- TGCheckButton* fRnrInn;
- TGCheckButton* fRnrOut1;
- TGCheckButton* fRnrOut2;
+ TGCheckButton *fRnrInn; // Widget for RnrInn.
+ TGCheckButton *fRnrOut1; // Widget for RnrOut1.
+ TGCheckButton *fRnrOut2; // Widget for RnrOut2.
- TEveGValuator* fThreshold;
- TEveGValuator* fMaxVal;
+ TEveGValuator *fThreshold; // Widget for Threshold.
+ TEveGValuator *fMaxVal; // Widget for MaxVal.
- TEveGDoubleValuator* fTime;
+ TEveGDoubleValuator *fTime; // Widget for time-range.
public:
AliEveTPCSectorVizEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- ~AliEveTPCSectorVizEditor();
+ ~AliEveTPCSectorVizEditor() {}
virtual void SetModel(TObject* obj);
void DoTime();
- ClassDef(AliEveTPCSectorVizEditor, 0); // Editor for AliEveTPCSectorViz
+ ClassDef(AliEveTPCSectorVizEditor, 0); // Editor for AliEveTPCSectorViz.
}; // endclass AliEveTPCSectorVizEditor
#endif