#include "AliTPCCalibViewerGUI.h"
+#include "AliTPCCalPad.h"
#include <iostream>
#include <TCanvas.h>
#include <TVirtualPad.h>
#include <TROOT.h>
+#include <TMath.h>
#include <TObjArray.h>
#include <TObjString.h>
#include <TVector.h>
#include <string.h>
#include <TH1.h>
#include "TStyle.h"
-#include "AliTPCCalibViewer.h"
-#include "TGFileDialog.h"
#include "TGFileDialog.h"
+#include "TGInputDialog.h"
+#include "AliTPCCalibViewer.h"
+#include "AliTPCPreprocessorOnline.h"
// #include "TGListBox.h"
// #include "TGNumberEntry"
AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const TGWindow *p, UInt_t w, UInt_t h, char* fileName)
: TGCompositeFrame(p, w, h),
fViewer(0),
+ fPreprocessor(0),
fContTopBottom(0),
fContLCR(0),
fContLeft(0),
fRadioTPC(0),
fRadioSideA(0),
fRadioSideC(0),
+ fRadioROC(0),
fRadioSector(0),
fComboAddDrawOpt(0),
fChkAuto(0),
+ fChkAutoAppend(0),
fComboMethod(0),
fListNormalization(0),
fComboCustom(0),
fContAddExport(0),
fComboExportName(0),
fBtnExport(0),
- fBtnAddNorm(0)
+ fBtnAddNorm(0),
+ fContTree(0),
+ fBtnDumpToFile(0),
+ fBtnLoadTree(0),
+ fChkAddAsReference(0),
+ fTxtRefName(0),
+ fInitialized(0)
{
//
// AliTPCCalibViewerGUI constructor; fileName specifies the ROOT tree used for drawing
//
// draw the GUI:
+ fPreprocessor = new AliTPCPreprocessorOnline();
DrawGUI(p, w, h);
// initialize the AliTPCCalibViewer:
if (fileName) Initialize(fileName);
// set default button states:
SetInitialValues();
// do first drawing:
- DoDraw();
+ if (fileName) DoDraw();
}
// ======================================================================
SetCleanup(kDeepCleanup);
+ p = p; // to avoid compiler warnings
// *****************************************************************************
// ************************* content of this MainFrame *************************
fChkAuto = new TGCheckButton(fContDrawOpt, "Auto redraw");
fContDrawOpt->AddFrame(fChkAuto, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
fChkAuto->SetToolTipText("Decide if you want an automatic redraw on each new selection.\nNot recommended on a slow machine, during remote connection or if your draw option is 'same'.");
+
+ // automatic append ending check button
+ fChkAutoAppend = new TGCheckButton(fContDrawOpt, "Auto add appending");
+ fContDrawOpt->AddFrame(fChkAutoAppend, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
+ fChkAutoAppend->SetToolTipText("Tries to repair your custom draw string or custom cut string, if you forgot '~' or '.fElements' \nThis function may be buggy!");
// *** predefined radio button *** " Predefined "
fRadioSideC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
fRadioSideC->SetToolTipText("Use only side C.");
- // sector radio button
- fRadioSector = new TGRadioButton(fContCuts, "ROC", 23);
+ // roc radio button
+ fRadioROC = new TGRadioButton(fContCuts, "ROC", 23);
+ fContCuts->AddFrame(fRadioROC, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+ fRadioROC->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
+ fRadioROC->SetToolTipText("Use only one ROC (readout chamber).");
+
+ // sector radio button
+ fRadioSector = new TGRadioButton(fContCuts, "Sector", 24);
fContCuts->AddFrame(fRadioSector, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
fRadioSector->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "HandleButtonsCuts()");
- fRadioSector->SetToolTipText("Use only one ROC (readout chamber).");
+ fRadioSector->SetToolTipText("Use only one Sector (0-17 A-Side, 18-35 C-Side).");
// sector options container
fContSector = new TGCompositeFrame(fContCuts, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
fBtnExport->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExport()");
fBtnExport->SetToolTipText("Export the current 2D view as AliTPCCalPad to the CINT command line interpreter, use the specified name. \nThis works only in 2D mode.");
- // export button
+ // add to normalisation button
fBtnAddNorm = new TGTextButton(fContExport, "&Add to normalization");
fContExport->AddFrame(fBtnAddNorm, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
fBtnAddNorm->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoExportNorm()");
fBtnAddNorm->SetToolTipText("Use the current 2D view as normalization variable, use the specified name. \nNot yet working!");
-
-
+
+ // Tree container
+ fContTree = new TGGroupFrame(fTabRight1, "Tree", kVerticalFrame | kFitWidth | kFitHeight);
+ fTabRight1->AddFrame(fContTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+
+ // dump tree to file button
+ fBtnDumpToFile = new TGTextButton(fContTree, "&Dump to File");
+ fContTree->AddFrame(fBtnDumpToFile, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+ fBtnDumpToFile->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoDumpToFile()");
+ fBtnDumpToFile->SetToolTipText("Write the exported CalPads to a new CalibTree");
+
+ // dump tree to file button
+ fBtnLoadTree = new TGTextButton(fContTree, "&Load Tree");
+ fContTree->AddFrame(fBtnLoadTree, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+ fBtnLoadTree->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
+ fBtnLoadTree->SetToolTipText("Load and initialize a new calibration tree. ");
+
+ fChkAddAsReference = new TGCheckButton(fContTree, "as reference:");
+ fContTree->AddFrame(fChkAddAsReference, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ fChkAddAsReference->Connect("Clicked()", "AliTPCCalibViewerGUI", this, "DoLoadTree()");
+ fChkAddAsReference->SetToolTipText("To add a new tree as reference tree.");
+
+ fTxtRefName = new TGTextEntry(fContTree, "R", 500);
+ fContTree->AddFrame(fTxtRefName, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 15, 0, 0, 0));
+ // fTxtRefName->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsNoRedraw(=50)");
+ fTxtRefName->SetToolTipText("Reference Name");
+
+
// Fit options container
fContFit = new TGGroupFrame(fTabRight1, "Custom fit", kVerticalFrame | kFitWidth | kFitHeight);
fTabRight1->AddFrame(fContFit, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
//
// Set the default button states
//
+ fChkAuto->SetState(kButtonUp);
fRadioPredefined->SetState(kButtonDown);
fRadioRaw->SetState(kButtonDown);
fRadioTPC->SetState(kButtonDown);
fRadio1D->SetState(kButtonDown);
- fChkAuto->SetState(kButtonDown);
fChkAddCuts->SetState(kButtonUp);
fChkGetMinMaxAuto->SetState(kButtonDown);
fChkSetMin->SetState(kButtonUp);
//fCanvMain->GetCanvas()->GetCanvasImp()->ShowStatusBar(kTRUE); // klappt auch nicht
fListVariables->IntegralHeight(kFALSE); // naja
fListNormalization->IntegralHeight(kFALSE); // naja
-
+ fChkAuto->SetState(kButtonDown);
+
// Make first drawing:
// DoDraw();
}
AliTPCCalibViewerGUI::AliTPCCalibViewerGUI(const AliTPCCalibViewerGUI &c)
: TGCompositeFrame(c.fParent, c.fWidth, c.fHeight),
fViewer(0),
+ fPreprocessor(0),
fContTopBottom(0),
fContLCR(0),
fContLeft(0),
fRadioTPC(0),
fRadioSideA(0),
fRadioSideC(0),
+ fRadioROC(0),
fRadioSector(0),
fComboAddDrawOpt(0),
fChkAuto(0),
+ fChkAutoAppend(0),
fComboMethod(0),
fListNormalization(0),
fComboCustom(0),
fContAddExport(0),
fComboExportName(0),
fBtnExport(0),
- fBtnAddNorm(0)
+ fBtnAddNorm(0),
+ fContTree(0),
+ fBtnDumpToFile(0),
+ fBtnLoadTree(0),
+ fChkAddAsReference(0),
+ fTxtRefName(0),
+ fInitialized(0)
{
//
// dummy AliTPCCalibViewerGUI copy constructor
}
-AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & param) {
+AliTPCCalibViewerGUI & AliTPCCalibViewerGUI::operator =(const AliTPCCalibViewerGUI & /*param*/) {
//
// dummy assignment operator
//
}
Cleanup();
if (fViewer) fViewer->Delete();
+ delete fPreprocessor;
}
*/
-void AliTPCCalibViewerGUI::Initialize(char* fileName, char* treeName) {
+void AliTPCCalibViewerGUI::Initialize(const char* fileName, const char* treeName) {
//
// initialize the GUI with a calibrationTree from fileName
//
// fill fListVariables, list of drawable variables:
TObjArray* arr = fViewer->GetListOfVariables();
+ if (!arr) return;
TIterator* iter = arr->MakeIterator();
iter->Reset();
TObjString* currentStr = 0;
if (fInitialized && currentStr->GetString() == selectedVariable) variableId = id;
id++;
}
- delete iter;
- arr->Delete();
- delete arr;
// fill fListNorm, list of normalization variables:
- arr = fViewer->GetListOfNormalizationVariables();
- iter = arr->MakeIterator();
- iter->Reset();
+ TObjArray *arrNorm = fViewer->GetListOfNormalizationVariables();
+ TIterator *iterNorm = arrNorm->MakeIterator();
+ iterNorm->Reset();
currentStr = 0;
id = 0;
fListNormalization->RemoveAll();
+ while ((currentStr = (TObjString*)(iterNorm->Next()))) {
+ fListNormalization->AddEntry(currentStr->GetString().Data(), id);
+ if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
+ id++;
+ }
+ currentStr = 0;
+ iter->Reset();
+ //Add draw variables to the list of normalisation
while ((currentStr = (TObjString*)(iter->Next()))) {
+ if (currentStr->GetString().BeginsWith("Map")) continue; //don't add mapping information
fListNormalization->AddEntry(currentStr->GetString().Data(), id);
if (fInitialized && currentStr->GetString() == selectedNormalization) normalizationId = id;
id++;
}
+
+ delete iterNorm;
+ arrNorm->Delete();
+ delete arrNorm;
+
delete iter;
arr->Delete();
delete arr;
}
+void AliTPCCalibViewerGUI::Reset(){
+ //
+ // reset variables, delete calib viewer
+ //
+ if (fViewer) delete fViewer;
+ fListVariables->RemoveAll();
+ fListNormalization->RemoveAll();
+ fInitialized = kFALSE;
+}
void AliTPCCalibViewerGUI::HandleButtonsGeneral(Int_t id) {
//
case 20: // fRadioTPC
fRadioSideA->SetState(kButtonUp);
fRadioSideC->SetState(kButtonUp);
+ fRadioROC->SetState(kButtonUp);
fRadioSector->SetState(kButtonUp);
break;
case 21: // fRadioSideA
fRadioTPC->SetState(kButtonUp);
fRadioSideC->SetState(kButtonUp);
+ fRadioROC->SetState(kButtonUp);
fRadioSector->SetState(kButtonUp);
break;
case 22: // fRadioSideC
fRadioTPC->SetState(kButtonUp);
fRadioSideA->SetState(kButtonUp);
+ fRadioROC->SetState(kButtonUp);
fRadioSector->SetState(kButtonUp);
break;
- case 23: // fRadioSector
+ case 23: // fRadioROC
fRadioTPC->SetState(kButtonUp);
fRadioSideA->SetState(kButtonUp);
fRadioSideC->SetState(kButtonUp);
+ fRadioSector->SetState(kButtonUp);
+ break;
+ case 24: // fRadioSector
+ fRadioTPC->SetState(kButtonUp);
+ fRadioSideA->SetState(kButtonUp);
+ fRadioSideC->SetState(kButtonUp);
+ fRadioROC->SetState(kButtonUp);
break;
case 31: // fComboAddCuts
fChkAddCuts->SetState(kButtonDown);
SetMinMaxLabel();
}
-
+void AliTPCCalibViewerGUI::ReplacePlaceHolders(TString &str)
+{
+ //
+ // replace the defined placeholders in the custom draw string and cut string
+ //
+ TString drawPlaceHolder("#draw#");
+ TString normPlaceHolder("#norm#");
+
+ //current draw variable
+ TString desiredData("");
+ if (fListVariables->GetSelectedEntry()){
+ desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
+ str.ReplaceAll(drawPlaceHolder,desiredData);
+ }
+// desiredData += fViewer->GetAbbreviation();
+
+ //current normalisation
+ TString normalizationData("");
+ if (fListNormalization->GetSelectedEntry()){
+ normalizationData += ((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle();
+ if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
+ if ( normalizationData.BeginsWith("_") ) normalizationData = desiredData+normalizationData;
+ if ( fListVariables->FindEntry(normalizationData.Data()) )
+ normalizationData+="~";
+ str.ReplaceAll(normPlaceHolder,normalizationData);
+ }
+}
void AliTPCCalibViewerGUI::DoNewSelection() {
//
cutStr += "(sector/18)%2==0"; // side A
if (fRadioSideC->GetState() == kButtonDown)
cutStr+= "(sector/18)%2==1"; // side C
- if (fRadioSector->GetState() == kButtonDown) {
+ if (fRadioROC->GetState() == kButtonDown) {
Int_t sector = (Int_t)(fNmbSector->GetNumber());
cutStr += "sector==";
cutStr += sector;
}
+ if (fRadioSector->GetState() == kButtonDown) {
+ Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36;
+ cutStr += "sector%36==";
+ cutStr += sector;
+ }
if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
cutStr += fComboAddCuts->GetTextEntry()->GetText();
desiredData += op;
if (! (TString(((TGTextLBEntry*)(fListNormalization->GetSelectedEntry()))->GetTitle())).BeginsWith("Fit"))
- desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
+ if ( normalizationData.BeginsWith("_") ) desiredData += ((TGTextLBEntry*)(fListVariables->GetSelectedEntry()))->GetTitle();
+ if ( fListVariables->FindEntry(normalizationData.Data()) )
+ normalizationData+="~";
desiredData += normalizationData;
}
else if (fRadioCustom->GetState() == kButtonDown) {
desiredData = fComboCustom->GetTextEntry()->GetText();
if (desiredData == "") return 0;
+ ReplacePlaceHolders(desiredData);
}
+ // try to add forgotten '~'
+ if (fChkAutoAppend->GetState() == kButtonDown)
+ desiredData = TString(fViewer->AddAbbreviations((char*)desiredData.Data()));
return new TString(desiredData.Data());
}
sectorStr += "A"; //cuts += "(sector/18)%2==0";
if (fRadioSideC->GetState() == kButtonDown)
sectorStr+= "C"; //cuts += "(sector/18)%2==1";
- if (fRadioSector->GetState() == kButtonDown) {
+ if (fRadioROC->GetState() == kButtonDown) {
Int_t sector = (Int_t)(fNmbSector->GetNumber());
sectorStr += sector; //cuts += "sector==";
}
+ if (fRadioSector->GetState() == kButtonDown) {
+ Int_t sector = ((Int_t)(fNmbSector->GetNumber()))%36;
+ sectorStr += "S";
+ sectorStr += sector; //cuts += "sector%36==";
+ }
return new TString(sectorStr.Data());
}
cutsStr += "!=0";
if (fChkAddCuts->GetState() == kButtonDown) cutsStr += " && ";
}
- if (fChkAddCuts->GetState() == kButtonDown)
- cutsStr += fComboAddCuts->GetTextEntry()->GetText();
+ if (fChkAddCuts->GetState() == kButtonDown){
+ cutsStr += fComboAddCuts->GetTextEntry()->GetText();
+ ReplacePlaceHolders(cutsStr);
+ }
+
+
+ // try to add forgotten '~'
+ if (fChkAutoAppend->GetState() == kButtonDown)
+ cutsStr = TString(fViewer->AddAbbreviations((char*)cutsStr.Data()));
return new TString(cutsStr.Data());
}
//
// specify data to plot:
+ if (!GetDrawString()) return;
TString desiredData(GetDrawString()->Data());
// specify sector:
TString sectorStr(GetSectorString()->Data());
TMatrixD covMatrix(0,0);
TString cutStr("");
TString formulaStr("");
- TString *returnStr = new TString("");
// specify data to plot:
TString drawStr(GetDrawString()->Data());
-
-
+
// ********** create cut string **********
if (fRadioTPC->GetState() == kButtonDown)
cutStr += ""; // whole TPC is used for fitting
cutStr += "(sector/18)%2==0"; // side A
if (fRadioSideC->GetState() == kButtonDown)
cutStr+= "(sector/18)%2==1"; // side C
- if (fRadioSector->GetState() == kButtonDown) {
+ if (fRadioROC->GetState() == kButtonDown) {
Int_t sector = (Int_t)(fNmbSector->GetNumber());
cutStr += "sector==";
cutStr += sector;
}
+ if (fRadioSector->GetState() == kButtonDown) {
+ Int_t sector = (Int_t)(fNmbSector->GetNumber())%36;
+ cutStr += "sector%36==";
+ cutStr += sector;
+ }
if (fChkAddCuts->GetState() == kButtonDown && strcmp(fComboAddCuts->GetTextEntry()->GetText(), "") != 0){
if (fRadioTPC->GetState() != kButtonDown) cutStr += " && ";
cutStr += fComboAddCuts->GetTextEntry()->GetText();
}
+ // try to add forgotten '~'
+ if (fChkAutoAppend->GetState() == kButtonDown)
+ cutStr = TString(fViewer->AddAbbreviations((char*)cutStr.Data()));
// ********** get formula string **********
formulaStr += fComboCustomFit->GetTextEntry()->GetText();
+ if (fChkAutoAppend->GetState() == kButtonDown)
+ formulaStr = TString(fViewer->AddAbbreviations((char*)formulaStr.Data()));
// ********** call AliTPCCalibViewer's fit-function
- returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
+ ReplacePlaceHolders(drawStr);
+ ReplacePlaceHolders(cutStr);
+ TString *returnStr = fViewer->Fit(drawStr.Data(), formulaStr.Data(), cutStr.Data(), chi2, fitParam, covMatrix);
std::cout << std::endl;
std::cout << "Your fit formula reads as follows:" << std::endl;
std::cout << returnStr->Data() << std::endl;
std::cout << "chi2 = " << chi2 << std::endl;
+
+ delete returnStr;
}
// create calPad according to drawCommand and cuts
AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)calPadName);
// finally export calPad to Cint:
- gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
+ gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t)calPad));
+ fPreprocessor->AddComponent(calPad);
Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
}
}
Error("DoExportNorm", "Not yet implemented.");
+/*
return;
// specify data to plot:
// create calPad according to drawCommand and cuts
AliTPCCalPad *calPad = fViewer->GetCalPad(desiredData.Data(), (char*)cutsStr.Data(), (char*)fComboExportName->GetTextEntry()->GetText());
// finally export calPad to Cint:
- gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, calPad));
+ gROOT->ProcessLine(Form("AliTPCCalPad* %s = (AliTPCCalPad*)0x%lx;", calPadName, (ULong_t) calPad));
Info("ExportCalPad", "Current 2D view has been exported to an AliTPCCalPad* with name '%s'", calPadName);
+ */
}
ptr = listOfPrimitives->At(i);
if ( ptr->InheritsFrom("TH1") ) break;
}
- if ( ptr != 0 && !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
+ if ( !ptr || !ptr->InheritsFrom("TH1") ) return; // if the loop did not find a TH1
TH1 *hist = (TH1*)ptr;
- Double_t histMax = hist->GetMaximum();
- Double_t histMin = hist->GetMinimum();
- fTxtSetMax->SetText(Form("%f",histMax));
- fTxtSetMin->SetText(Form("%f",histMin));
+
+// Double_t histMax = hist->GetMaximum();
+// Double_t histMin = hist->GetMinimum();
+// fTxtSetMax->SetText(Form("%f",histMax));
+// fTxtSetMin->SetText(Form("%f",histMin));
+
+ if (fRadio2D->GetState() == kButtonDown) {
+ if (fChkSetMax->GetState() == kButtonUp)
+ fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
+ if (fChkSetMin->GetState() == kButtonUp)
+ fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
+ }
+ else if (fRadio1D->GetState() == kButtonDown) {
+ if (fChkSetMax->GetState() == kButtonUp)
+ fTxtSetMax->SetText( Form("%f", hist->GetXaxis()->GetXmax()) );
+ if (fChkSetMin->GetState() == kButtonUp)
+ fTxtSetMin->SetText( Form("%f", hist->GetXaxis()->GetXmin()) );
+ }
}
TH1 *hist = (TH1*)ptr;
TString minTxt(fTxtSetMin->GetText());
TString maxTxt(fTxtSetMax->GetText());
+
// set min and max according to specified values, if checkbox is checked
- if (fChkSetMax->GetState() == kButtonDown && (maxTxt.IsDigit() || maxTxt.IsFloat()) )
- hist->SetMaximum(maxTxt.Atof());
- if (fChkSetMax->GetState() == kButtonUp)
- hist->SetMaximum(-1111); // default value, to unzoom
- if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
- hist->SetMinimum(minTxt.Atof());
- if (fChkSetMin->GetState() == kButtonUp)
- hist->SetMinimum(-1111); // default value, to unzoom
- // get min and max from plot
- if (fChkGetMinMaxAuto->GetState() == kButtonDown) {
- // maybe call here GetMinMax ???
+ if (fRadio2D->GetState() == kButtonDown) {
+ if (fChkSetMax->GetState() == kButtonDown && fChkSetMax->GetState() == kButtonDown &&(maxTxt.IsDigit() || maxTxt.IsFloat()) )
+ hist->SetMaximum(maxTxt.Atof());
if (fChkSetMax->GetState() == kButtonUp)
- fTxtSetMax->SetText(Form("%f", hist->GetMaximum()));
+ hist->SetMaximum(-1111); // default value, to unzoom
+ if (fChkSetMin->GetState() == kButtonDown && (minTxt.IsDigit() || minTxt.IsFloat()) )
+ hist->SetMinimum(minTxt.Atof());
if (fChkSetMin->GetState() == kButtonUp)
- fTxtSetMin->SetText(Form("%f", hist->GetMinimum()));
+ hist->SetMinimum(-1111); // default value, to unzoom
}
+ else if (fRadio2D->GetState() == kButtonDown) {
+ if (fChkSetMin->GetState() == kButtonDown &&
+ fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
+ hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), hist->GetXaxis()->GetXmax());
+ else if (fChkSetMax->GetState() == kButtonDown && hist->GetXaxis())
+ hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), maxTxt.Atof());
+ else if (fChkSetMin->GetState() == kButtonDown && hist->GetXaxis())
+ hist->GetXaxis()->SetRangeUser(minTxt.Atof(), hist->GetXaxis()->GetXmax());
+ hist->SetTitle(hist->GetTitle()); // trick to update the histogram
+ }
+
+ // get min and max from plot
+ GetMinMax();
// set labels according to specification, if cehckboxes are checked
if (fChkLabelTitle->GetState() == kButtonDown)
//
// function that is called, when the number of the sector is changed
// to change the sector label
- //
+ //
+ if ( fRadioROC->GetState()!=kButtonDown && fRadioSector->GetState()!=kButtonDown ){
+ fLblSector->SetText("not used");
+ return;
+ }
+
Int_t sector = (Int_t)(fNmbSector->GetNumber());
- char* secLabel = "";
- if (sector >= 0 && sector <= 17) // IROC, Side A
- secLabel = "IROC, A";
- if (sector >= 18 && sector <= 35) // IROC, Side C
- secLabel = "IROC, C";
- if (sector >= 36 && sector <= 53) // OROC, Side A
- secLabel = "OROC, A";
- if (sector >= 54 && sector <= 71) // OROC, Side C
- secLabel = "OROC, C";
+ TString secLabel = "";
+ if ( sector < 36 )
+ secLabel = "IROC";
+ else
+ secLabel = "OROC";
+
+ if (fRadioSector->GetState()==kButtonDown)
+ secLabel="Sector";
+
+ if ( sector%36<18 ) //A-Side
+ secLabel += ", A";
+ else
+ secLabel += ", C";
+
+ secLabel += Form("%02d",sector%18);
+
fLblSector->SetText(secLabel);
DoNewSelection();
}
if (!selectedObject->InheritsFrom("TH2")) return;
// zoom to sector works ONLY in 2D mode, if one side is specified
if (fRadio2D->GetState() == kButtonUp) return;
- if (fRadioSector->GetState() == kButtonDown) { // return to full side view
+ if (fRadioROC->GetState() == kButtonDown) { // return to full side view
// return to full side view
Int_t sector = (Int_t)(fNmbSector->GetNumber());
if ( (sector >= 0 && sector <= 17) || (sector >= 36 && sector <= 53) ) {
if (quadrant == 3) phi = pi + phi;
if (quadrant == 4) phi = 2 * pi - phi;
Double_t phiGrad = phi / pi * 180;
- Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20°
+ Int_t sector = (Int_t) phiGrad / 20; // one sector coresponds to 20�
// IROC starts at 84.5 cm
// IROC ends at 135.5 cm, OROC begins
// OROC ends at 250 cm
}
// printf("r: %f, phi: %f, phiGrad: %f, gy/gx: %f, quadrant: %i, sector: %i \n", r, phi, phiGrad, gy/gx, quadrant, sector);
fNmbSector->SetNumber(sector);
- fRadioSector->Clicked();
- fRadioSector->SetState(kButtonDown);
+ fRadioROC->Clicked();
+ fRadioROC->SetState(kButtonDown);
ChangeSector();
}
}
+void AliTPCCalibViewerGUI::DoDumpToFile() {
+ //
+ // This function is called, when the "Dump to File" button is pressed.
+ // All the exported CalPads will be written into an new CalibTree,
+ // a Save File dialog will appear to specify the filename
+ //
+ const char *kSaveAsTypes[] = {
+ "ROOT file", "*.root",
+ 0, 0
+ };
+ TString dir(".");
+ TGFileInfo fi;
+ fi.fFileTypes = kSaveAsTypes;
+ // fi.fIniDir = StrDup(dir);
+ fi.fOverwrite = kFALSE;
+ new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
+ if (fi.fFilename && strlen(fi.fFilename)) {
+ fPreprocessor->DumpToFile(fi.fFilename);
+ Info("DumpToFile", Form("New CalibTree has been writen to file '%s'", fi.fFilename));
+ }
+}
+
+
+void AliTPCCalibViewerGUI::DoLoadTree() {
+ // function to load a new calib tree
+ //
+ //
+ const char *kFileTypes[] = {
+ "ROOT file", "*.root",
+ 0, 0
+ };
+ TString dir(".");
+ TGFileInfo fi;
+ fi.fFileTypes = kFileTypes;
+ // fi.fIniDir = StrDup(dir);
+ fi.fOverwrite = kFALSE;
+ new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDOpen, &fi);
+ if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonUp) {
+ Initialize(fi.fFilename);
+ Reload();
+ }
+ else if (fi.fFilename && strlen(fi.fFilename) && fChkAddAsReference->GetState() == kButtonDown) {
+ fViewer->AddReferenceTree(fi.fFilename, "calPads", fTxtRefName->GetText());
+ Reload();
+ }
+}
+
+
TObjArray* AliTPCCalibViewerGUI::ShowGUI(const char* fileName) {
//
// Initialize and show GUI for presentation for demonstration purposes