ClassImp(TPCSector2DEditor)
-TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
- UInt_t options, Pixel_t back) :
- TGedFrame(p, id, width, height, options | kVerticalFrame, back)
+ TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
+ TGedFrame(p, id, width, height, options | kVerticalFrame, back)
{
fM = 0;
MakeTitle("TPCSector2D");
f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
fSectorID = new TGNumberEntry(f, 0., 6, -1,
- TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax, 0, 35);
+ TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+ TGNumberFormat::kNELLimitMinMax, 0, 35);
fSectorID->GetNumberEntry()->SetToolTipText("0-17 +z plate 18-35 -z plate");
f->AddFrame(fSectorID, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
fSectorID->Associate(this);
fSectorID->Connect("ValueSet(Long_t)",
- "Alieve::TPCSector2DEditor", this, "DoSectorID()");
+ "Alieve::TPCSector2DEditor", this, "DoSectorID()");
- AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+ AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+ }
+ {
+ TGHorizontalFrame* f = new TGHorizontalFrame(this);
+
+ fRnrInn = new TGCheckButton(f, "Inner");
+ f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrInn()");
+
+ fRnrOut1 = new TGCheckButton(f, "Outer 1");
+ f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrOut1()");
+
+ fRnrOut2 = new TGCheckButton(f, "Outer 2");
+ f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+ fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrOut2()");
+
+ AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
- fThresholdLabel = new TGLabel(f, "threshold [XXX]:");
+ fThresholdLabel = new TGLabel(f, "Threshold [XXX]:");
f->AddFrame(fThresholdLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
- fthreshold = new TGHSlider(f, 150);
- fthreshold->SetRange(0,149);
- fthreshold->Associate(this);
- f->AddFrame(fthreshold, new TGLayoutHints(kLHintsLeft, 0, 5));
- fthreshold->Connect("PositionChanged(Int_t)",
- "Alieve::TPCSector2DEditor", this, "Dothreshold()");
+ fThreshold = new TGHSlider(f, 150);
+ fThreshold->SetRange(0,149);
+ fThreshold->Associate(this);
+ f->AddFrame(fThreshold, new TGLayoutHints(kLHintsLeft, 0, 5));
+ fThreshold->Connect("PositionChanged(Int_t)",
+ "Alieve::TPCSector2DEditor", this, "DoThreshold()");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
{
"Alieve::TPCSector2DEditor", this, "DoMaxVal()");
AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
- fShowMax = new TGCheckButton(this, "ShowMax");
- AddFrame(fShowMax, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
- fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
-
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
+ fShowMax = new TGCheckButton(f, "ShowMax");
+ f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
+ fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
+ fAverage = new TGCheckButton(f, "Average");
+ f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
+ fAverage->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoAverage()");
+ AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+ }
+
+ {
+ TGVerticalFrame* vf = new TGVerticalFrame(this);
+
+ TGHorizontalFrame* f = new TGHorizontalFrame(vf);
+
TGLabel *l = new TGLabel(f, "Time Range:");
f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
- fTime = new TGDoubleHSlider(f);
- fTime->SetRange(0, 500);
- fTime->Resize(160, 20);
- f->AddFrame(fTime);//, new TGLayoutHints(kLHintsLeft, 0, 5));
+ fMinTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+ TGNumberFormat::kNELLimitMinMax, 0, 1023);
+ fMinTime->GetNumberEntry()->SetToolTipText("MinTime");
+ f->AddFrame(fMinTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+ fMinTime->Associate(this);
+ fMinTime->Connect("ValueSet(Long_t)", "Alieve::TPCSector2DEditor", this, "DoMinTime()");
+
+ fMaxTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+ TGNumberFormat::kNELLimitMinMax, 0, 1023);
+ fMaxTime->GetNumberEntry()->SetToolTipText("MaxTime");
+ f->AddFrame(fMaxTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+ fMaxTime->Associate(this);
+ fMaxTime->Connect("ValueSet(Long_t)", "Alieve::TPCSector2DEditor", this, "DoMaxTime()");
+
+ vf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+
+ fTime = new TGDoubleHSlider(vf);
+ fTime->SetRange(0, 1023);
+ fTime->Resize(250, 20);
+ vf->AddFrame(fTime);//, new TGLayoutHints(kLHintsLeft, 0, 5));
fTime->Connect("PositionChanged()", "Alieve::TPCSector2DEditor",
this, "DoTime()");
- AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+
+ AddFrame(vf, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
// What is this crap?
TClass *cl = TPCSector2DEditor::Class();
fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
fSectorID->SetNumber(fM->fSectorID);
- fThresholdLabel->SetText(Form("threshold [%3d]:", fM->fthreshold));
- fthreshold->SetPosition(fM->fthreshold);
+ fRnrInn->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
+ fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
+ fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
+ fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
+ fThreshold->SetPosition(fM->fThreshold);
fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
fMaxVal->SetPosition(fM->fMaxVal);
+ fMinTime->SetNumber(fM->fMinTime);
+ fMaxTime->SetNumber(fM->fMaxTime);
fTime->SetPosition(fM->fMinTime, fM->fMaxTime);
fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
+ SetupAverage();
SetActive();
}
Update();
}
-void TPCSector2DEditor::Dothreshold()
+void TPCSector2DEditor::DoRnrInn()
+{
+ fM->SetRnrInn(fRnrInn->IsOn());
+ Update();
+}
+
+void TPCSector2DEditor::DoRnrOut1()
+{
+ fM->SetRnrOut1(fRnrOut1->IsOn());
+ Update();
+}
+
+void TPCSector2DEditor::DoRnrOut2()
+{
+ fM->SetRnrOut2(fRnrOut2->IsOn());
+ Update();
+}
+
+
+void TPCSector2DEditor::DoThreshold()
{
- fM->Setthreshold((Short_t) fthreshold->GetPosition());
- fThresholdLabel->SetText(Form("threshold [%3d]:", fM->fthreshold));
+ fM->SetThreshold((Short_t) fThreshold->GetPosition());
+ fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
Update();
}
void TPCSector2DEditor::DoShowMax()
{
fM->SetShowMax(fShowMax->IsOn());
+ SetupAverage();
+ Update();
+}
+
+void TPCSector2DEditor::DoAverage()
+{
+ fM->SetAverage(fAverage->IsOn());
+ Update();
+}
+
+void TPCSector2DEditor::SetupAverage()
+{
+ if(fM->fShowMax) {
+ fAverage->SetEnabled(kFALSE);
+ } else {
+ fAverage->SetEnabled(kTRUE);
+ fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
+ }
+}
+
+void TPCSector2DEditor::DoMinTime()
+{
+ Int_t minTime = (Int_t) fMinTime->GetNumber();
+ if(minTime > fM->fMaxTime) {
+ minTime = fM->fMaxTime;
+ fMinTime->SetNumber(minTime);
+ }
+ fM->SetMinTime(minTime);
+ fTime->SetPosition(minTime, fM->fMaxTime);
+ Update();
+}
+
+void TPCSector2DEditor::DoMaxTime()
+{
+ Int_t maxTime = (Int_t) fMaxTime->GetNumber();
+ if(maxTime < fM->fMinTime) {
+ maxTime = fM->fMinTime;
+ fMaxTime->SetNumber(maxTime);
+ }
+ fM->SetMaxTime(maxTime);
+ fTime->SetPosition(fM->fMinTime, maxTime);
Update();
}
void TPCSector2DEditor::DoTime()
{
- Double_t min = fTime->GetMinPosition(), max = fTime->GetMaxPosition();
- printf("hslidor min=%f max=%f\n", min, max);
- fM->SetMinTime((Int_t) min);
- fM->SetMaxTime((Int_t) max);
+ Int_t min = (Int_t) TMath::Nint(fTime->GetMinPosition());
+ Int_t max = (Int_t) TMath::Nint(fTime->GetMaxPosition());
+ fM->SetMinTime(min);
+ fM->SetMaxTime(max);
+ fMinTime->SetNumber(min);
+ fMaxTime->SetNumber(max);
Update();
}
Int_t ci = gStyle->GetColorPalette
(TMath::Min(n_col - 1,
- Int_t((n_col*(z - fSector->fthreshold))/(fSector->fMaxVal - fSector->fthreshold))));
+ Int_t((n_col*(z - fSector->fThreshold))/(fSector->fMaxVal - fSector->fThreshold))));
TColor* c = gROOT->GetColor(ci);
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glShadeModel(GL_FLAT);
-
- glBindTexture (GL_TEXTURE_2D, fTexture);
glPolygonOffset(2,2);
glEnable(GL_POLYGON_OFFSET_FILL);
glBindTexture(GL_TEXTURE_2D, fTexture);
glEnable(GL_TEXTURE_2D);
- DisplayTexture(iSeg.GetPadWidth(), iSeg.GetPadHeight(), iSeg.GetRLow(),
+ if(fSector->fRnrInn)
+ DisplayTexture(iSeg.GetPadWidth(), iSeg.GetPadHeight(), iSeg.GetRLow(),
+ iSeg.GetNMaxPads(), iSeg.GetNRows(),
+ 0, 0);
+ if(fSector->fRnrOut1)
+ DisplayTexture(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
+ o1Seg.GetNMaxPads(), o1Seg.GetNRows(),
+ iSeg.GetNMaxPads(), 0);
+ if(fSector->fRnrOut2)
+ DisplayTexture(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
+ o2Seg.GetNMaxPads(), o2Seg.GetNRows(),
+ 0, o1Seg.GetNRows());
+
+ glDisable(GL_TEXTURE_2D);
+ } else {
+ if(fSector->fRnrInn)
+ DisplayQuads(iSeg.GetPadWidth(), iSeg.GetPadHeight(), iSeg.GetRLow(),
iSeg.GetNMaxPads(), iSeg.GetNRows(),
0, 0);
- DisplayTexture(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
+ if(fSector->fRnrOut1)
+ DisplayQuads(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
o1Seg.GetNMaxPads(), o1Seg.GetNRows(),
- iSeg.GetNMaxPads(), 0);
- DisplayTexture(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
+ iSeg.GetNMaxPads(), 0);
+ if(fSector->fRnrOut2)
+ DisplayQuads(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
o2Seg.GetNMaxPads(), o2Seg.GetNRows(),
0, o1Seg.GetNRows());
-
- glDisable(GL_TEXTURE_2D);
- } else {
- DisplayQuads(iSeg.GetPadWidth(), iSeg.GetPadHeight(), iSeg.GetRLow(),
- iSeg.GetNMaxPads(), iSeg.GetNRows(),
- 0, 0);
- DisplayQuads(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
- o1Seg.GetNMaxPads(), o1Seg.GetNRows(),
- iSeg.GetNMaxPads(), 0);
- DisplayQuads(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
- o2Seg.GetNMaxPads(), o2Seg.GetNRows(),
- 0, o1Seg.GetNRows());
}
}
void TPCSector2DGL::LoadPadrow(TPCSectorData::RowIterator& iter,
Int_t row, Int_t col_off) const
{
- Int_t pad_var;
+ Int_t padVal;
Int_t time, val;
- Int_t min_time = fSector->fMinTime;
- Int_t max_time = fSector->fMaxTime;
- Bool_t half_border_time = ((fSector->fMaxTime - fSector->fMinTime) % 2 == 0);
+ Int_t minTime = fSector->fMinTime;
+ Int_t maxTime = fSector->fMaxTime;
+ Bool_t halfBorderTime = ((maxTime - minTime) % 2 == 0);
UChar_t* img_pos = GetRowCol(row, col_off);
while (iter.NextPad()) {
- pad_var = 0;
+ padVal = 0;
while (iter.Next()) {
time = iter.Time();
val = iter.Signal();
+ if(time < minTime || time > maxTime)
+ continue;
+
if(fSector->fShowMax) {
- if(val > pad_var) {
- pad_var = val;
+ if(val > padVal) {
+ padVal = val;
}
} else {
- // Integrate int max_val.
- if(time >= min_time && time <= max_time) {
- if(half_border_time && (time == min_time || time == max_time))
- pad_var += val/2;
- else
- pad_var += val;
- }
+ if(halfBorderTime && (time == minTime || time == maxTime))
+ padVal += val/2;
+ else
+ padVal += val;
}
}
- pad_var = TMath::Min(pad_var, fSector->fMaxVal);
- if(pad_var > fSector->fthreshold)
- SetCol(pad_var, img_pos);
+ if(fSector->fShowMax == kFALSE && fSector->fAverage) {
+ padVal = (Int_t)((Float_t)padVal / (maxTime - minTime));
+ }
+ padVal = TMath::Min(padVal, fSector->fMaxVal);
+ if(padVal > fSector->fThreshold)
+ SetCol(padVal, img_pos);
img_pos += 4;
}
}
memset(fImage, 0, fgkTextureByteSize);
Int_t rowOff[3], colOff[3];
- rowOff[0] = 0; rowOff[1] = rowOff[2] = -TPCSectorData::GetSeg(1).GetFirstRow();
- colOff[0] = colOff[2] = 0; colOff[1] = TPCSectorData::GetSeg(0).GetNMaxPads();
+ Bool_t isOn[3];
+ rowOff[0] = 0;
+ rowOff[1] = rowOff[2] = -TPCSectorData::GetSeg(1).GetFirstRow();
+ colOff[0] = colOff[2] = 0;
+ colOff[1] = TPCSectorData::GetSeg(0).GetNMaxPads();
+ isOn[0] = fSector->fRnrInn;
+ isOn[1] = fSector->fRnrOut1;
+ isOn[2] = fSector->fRnrOut2;
// Loop over 3 main segments
for (Int_t sId = 0; sId <= 2; ++sId) {
+ if(isOn[sId] == kFALSE)
+ continue;
const TPCSectorData::SegmentInfo& sInfo = TPCSectorData::GetSeg(sId);
for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) {
TPCSectorData::RowIterator i = fSectorData->MakeRowIterator(row);
(UChar_t)(255*c->GetGreen()),
(UChar_t)(255*c->GetBlue()));
- glBegin(GL_LINE_LOOP);
- TraceStepsUp (TPCSectorData::GetInnSeg());
- TraceStepsDown(TPCSectorData::GetInnSeg());
- glEnd();
-
- glBegin(GL_LINE_LOOP);
- TraceStepsUp (TPCSectorData::GetOut1Seg());
- TraceStepsDown(TPCSectorData::GetOut1Seg());
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- TraceStepsUp (TPCSectorData::GetOut2Seg());
- TraceStepsDown(TPCSectorData::GetOut2Seg());
- glEnd();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ if(fSector->fRnrInn) {
+ glBegin(GL_POLYGON);
+ TraceStepsUp (TPCSectorData::GetInnSeg());
+ TraceStepsDown(TPCSectorData::GetInnSeg());
+ glEnd();
+ }
+ if(fSector->fRnrOut1) {
+ glBegin(GL_POLYGON);
+ TraceStepsUp (TPCSectorData::GetOut1Seg());
+ TraceStepsDown(TPCSectorData::GetOut1Seg());
+ glEnd();
+ }
+ if(fSector->fRnrOut2) {
+ glBegin(GL_POLYGON);
+ TraceStepsUp (TPCSectorData::GetOut2Seg());
+ TraceStepsDown(TPCSectorData::GetOut2Seg());
+ glEnd();
+ }
}