#include <TError.h>
#include "AliCorrectionManagerBase.h"
+/**
+ * Extract corrections from result file
+ *
+ */
struct CorrExtractor
{
+ /**
+ * Constructor
+ *
+ * @param manager Correction manager
+ */
CorrExtractor(AliCorrectionManagerBase* manager)
: fFile(0),
fTop(0),
fRunNo(0),
fSys(0),
fSNN(0),
- fField(0),
+ fField(999),
fMC(false),
fSatellite(false),
fManager(manager)
}
return static_cast<TCollection*>(o);
}
+ /**
+ * Find a collection in a file
+ *
+ * @param path Path to collection
+ *
+ * @return Found collection or null
+ */
TCollection* FindCollection(const TString& path)
{
if (path.IsNull()) return 0;
return p;
}
-
+ /**
+ * Find an object
+ *
+ * @param path Path to object
+ * @param name Name of object
+ *
+ * @return Found object or null
+ */
TObject* FindObject(const TString& path,
const TString& name)
{
}
return p->FindObject(name);
}
-
+ /**
+ * Initialize this extactor
+ *
+ * @param fileName File to extract from
+ * @param sumFolder The summed folder
+ * @param out The result folder
+ *
+ * @return true on success
+ */
Bool_t Init(const TString& fileName,
const TString& sumFolder,
const TString& out)
TObject* oFld = c->FindObject("field");
TObject* oRun = c->FindObject("runNo");
TObject* oSat = c->FindObject("satellite");
- if (oSys) fSys = oSys->GetUniqueID();
- if (oSNN) fSNN = oSNN->GetUniqueID();
- if (oFld) fField = oFld->GetUniqueID();
- if (oRun) fRunNo = oRun->GetUniqueID();
- if (oSat) fSatellite = oSat->GetUniqueID();
+ if (oSys && fSys <= 0) fSys = oSys->GetUniqueID();
+ if (oSNN && fSNN <= 0) fSNN = oSNN->GetUniqueID();
+ if (oFld && fField >= 999) fField = oFld->GetUniqueID();
+ if (oRun && fRunNo <= 0) fRunNo = oRun->GetUniqueID();
+ if (oSat) fSatellite = oSat->GetUniqueID();
- if (fSys <= 0 || fSys > 3 ||
- fSNN <= 0 ||
- fRunNo <= 0) {
+ if (fSys <= 0 || fSys > 3 || fSNN <= 0 || fField >= 999 || fRunNo <= 0 ){
Error("CorrExtractor", "Failed to get settings");
Clear();
return false;
}
return true;
}
+ /**
+ * Set whether this is MC or not
+ *
+ * @param mc If true, consider this MC
+ */
void SetMC(Bool_t mc=true) { fMC = mc; }
+ /**
+ * Extract the stuff
+ *
+ * @param cls Class of object
+ * @param parent Parent folder
+ *
+ * @return
+ */
Bool_t Extract(const TClass* cls, const TString& parent)
{
return Extract(cls->GetName(), parent);
}
+ /**
+ * Extract the stuff
+ *
+ * @param objName Object name
+ * @param parent Parent folder
+ *
+ * @return
+ */
Bool_t Extract(const TString& objName,
const TString& parent="")
{
fSatellite,
fOut.Data());
}
-
+ /**
+ * Clear this extractor
+ *
+ */
void Clear()
{
if (fFile) fFile->Close();
fMC = false;
fSatellite = false;
}
- TFile* fFile;
- TList* fTop;
- TString fOut;
- ULong_t fRunNo;
- UShort_t fSys;
- UShort_t fSNN;
- Short_t fField;
- Bool_t fMC;
- Bool_t fSatellite;
- AliCorrectionManagerBase* fManager;
+ TFile* fFile; // Our file
+ TList* fTop; // Top list
+ TString fOut; // Output
+ ULong_t fRunNo; // Run number
+ UShort_t fSys; // System
+ UShort_t fSNN; // Collision energy in GeV
+ Short_t fField; // L3 field in kG
+ Bool_t fMC; // Simulation flag
+ Bool_t fSatellite; // Satellite interaction flag
+ AliCorrectionManagerBase* fManager; // Correction manager to use
};
//
class AliOADBForward;
class AliOADBForward::Entry;
class TGFrame;
-class TGLVEntry;
+class TGLVEtry;
class TGHorizontalFrame;
class TGTextButton;
class TGTextEntry;
fPrintButton(&fCommandFrame, "Print entry"),
fDrawButton(&fCommandFrame, "Draw entry"),
fPDFButton(&fCommandFrame, "Summarize entry"),
- fList(0),
- fListContainer(0),
+ fList(&fMain, 800, 400),
+ fListContainer(&fList),
fFrameHints(kLHintsExpandX, 0, 0, 2, 0),
fLabelHints(kLHintsNoHints, 4, 2, 0, 0),
fEntryHints(kLHintsExpandX|kLHintsExpandY, 2, 4, 0, 0),
fEntry(0)
{
fMain.Connect("CloseWindow()", "ForwardOADBGUI", this, "HandleKill()");
+ fMain.DontCallClose();
+
fFileSelect.Connect("Clicked()", "ForwardOADBGUI", this, "HandleBrowse()");
fOpenButton.Connect("Clicked()", "ForwardOADBGUI", this, "HandleOpen()");
fCloseButton.Connect("Clicked()", "ForwardOADBGUI", this, "HandleClose()");
fSelectFrame.AddFrame(&fCommandFrame, &fFrameHints);
fCommandFrame.SetLayoutHints(&fButtonHints);
- fList = new TGListView(&fMain, 800, 400);
- fListContainer = new TGLVContainer(fList);
- fListContainer->SetColHeaders("Entry",
- "Run",
- "System",
- "sqrt(sNN)",
- "L3 Field",
- "Type",
- "IP",
- "Date",
- "Author",
- "AliROOT",
- "Data");
- fList->SetViewMode(kLVDetails);
- fList->Connect("Clicked(TGLVEntry*,Int_t)",
+ // fList = new TGListView(&fMain, 800, 400);
+ // fListContainer = new TGLVContainer(fList);
+ fListContainer.SetColHeaders("Entry",
+ "Run",
+ "System",
+ "sqrt(sNN)",
+ "L3 Field",
+ "Type",
+ "IP",
+ "Date",
+ "Author",
+ "AliROOT",
+ "Data");
+ fList.SetViewMode(kLVDetails);
+ fList.Connect("Clicked(TGLVEntry*,Int_t)",
"ForwardOADBGUI", this, "HandleItem(TGLVEntry*,Int_t)");
- fList->Connect("DoubleClicked(TGLVEntry*,Int_t)",
+ fList.Connect("DoubleClicked(TGLVEntry*,Int_t)",
"ForwardOADBGUI", this, "HandleItem(TGLVEntry*,Int_t)");
- fListContainer->Connect("Clicked(TGFrame*,Int_t)",
+ fListContainer.Connect("Clicked(TGFrame*,Int_t)",
"ForwardOADBGUI", this,
"HandleItem(TGFrame*,Int_t)");
- fList->SetMinWidth(400);
- fList->SetMinHeight(200);
- fMain.AddFrame(fList, &fListHints);
+ fList.SetMinWidth(400);
+ fList.SetMinHeight(200);
+ fMain.AddFrame(&fList, &fListHints);
#ifndef __CINT__
::SetErrorHandler(ForwardOADBGUIErrorHandler);
#ifndef __CINT__
::SetErrorHandler(::DefaultErrorHandler);
#endif
- fMain.DontCallClose();
Info("~ForwardOADBGUI", "Closing");
}
void UseDB(AliOADBForward* db)
}
void HandleKill()
{
- fMain.DontCallClose();
+ // fMain.DontCallClose();
+ fMain.DeleteWindow();
Printf("Starting timer");
- TTimer* t = new TTimer(Form("delete (ForwardOADBGUI*)%p", this), 100);
- t->Start(100, true);
+ // TTimer* t = new TTimer(Form("delete (ForwardOADBGUI*)%p", this), 100);
+ // t->Start(100, true);
}
void HandleDBEntry(AliOADBForward::Entry* e)
{
fDrawButton.SetEnabled(en);
fPrintButton.SetEnabled(en);
fPDFButton.SetEnabled(en);
-
+
fEntry = e;
}
void HandleEnable()
fDB = new AliOADBForward();
Info("HandleOpen", "Opening DB file %s for tables %s",
fFileText.GetText(), fTablesText.GetText());
- if (!fDB->Open(fFileText.GetText(), fTablesText.GetText(), false, true)) {
+ if (!fDB->Open(fFileText.GetText(), fTablesText.GetText(),
+ false, true, true)) {
Error("HandleOpen", "Failed to open database");
delete fDB;
fDB = 0;
void HandleBrowse()
{
TGFileInfo fi;
+ TString iniDir(gSystem->ExpandPathName("$(OADB_PATH)"));
+ if (iniDir.IsNull())
+ iniDir = gSystem->ExpandPathName("$(ALICE_ROOT)/OADB");
+ iniDir.Append("/PWGLF/FORWARD/CORRECTIONS/data");
+ char* ini = new char[iniDir.Length()+1];
+ for (int i = 0; i < iniDir.Length(); i++) ini[i] = iniDir[i];
+ ini[iniDir.Length()] = '\0';
+ Printf("Initial directory: %s (%s)", iniDir.Data(), ini);
+ fi.fIniDir = ini;
new TGFileDialog(gClient->GetRoot(), &fMain, kFDOpen, &fi);
TString nf = fi.fFilename; //
}
void HandleEntry(Int_t i, AliOADBForward::Entry* e)
{
- TGLVEntry* lve = new TGLVEntry(fListContainer, Form("%d", i), "");
+ TGLVEntry* lve = new TGLVEntry(&fListContainer, Form("%d", i), "");
if (i < 0) lve->SetUserData(e);
lve->SetUniqueID(i);
TDatime dt(e->fTimestamp);
dt.AsSQLString(),
e->fAuthor, Form("%lu", e->fAliROOTRevision),
(e->fData ? e->fData->GetName() : "null"));
- fListContainer->AddItem(lve);
+ fListContainer.AddItem(lve);
}
void HandleList()
{
}
// HandleQuery();
t->Print(fOptionsText.GetText());
- if (!fListContainer) return;
+ // if (!fListContainer) return;
- fListContainer->RemoveAll();
+ fListContainer.RemoveAll();
TTree* tree = t->fTree;
Int_t n = tree->GetEntries();
for (Int_t i = 0; i < n; i++) {
AliOADBForward::Entry* e = t->fEntry;
HandleEntry(i, e);
}
- fList->AdjustHeaders();
+ fList.AdjustHeaders();
fMain.Layout();
}
void SelectedTable(TString& ret) const
void CorrDraw(const TObject* o, Bool_t summarize)
{
if (!gROOT->GetClass("CorrDrawer")) {
- const char* fwd = "$ALICE_ROOT/../trunk/PWGLF/FORWARD/analysis2";
+ const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
gSystem->AddIncludePath(Form("-I$ALICE_ROOT/include -I%s -I%s/scripts",
fwd, fwd));
gROOT->LoadMacro(Form("%s/scripts/SummaryDrawer.C", fwd));
// if (drawNotPrint) e->Inspect();
// else e->Print(fOptionsText.GetText());
e->Print();
- if (fListContainer) {
- fListContainer->RemoveAll();
- HandleEntry(-1, e);
- }
+ // if (fListContainer) {
+ fListContainer.RemoveAll();
+ HandleEntry(-1, e);
+ // }
if (!e->fData) return 0;
HandleDBEntry(e);
- fList->AdjustHeaders();
+ fList.AdjustHeaders();
fMain.Layout();
return e->fData;
TGTextButton fPrintButton;
TGTextButton fDrawButton;
TGTextButton fPDFButton;
- TGListView* fList;
- TGLVContainer* fListContainer;
+ TGListView fList;
+ TGLVContainer fListContainer;
TGLayoutHints fFrameHints;
TGLayoutHints fLabelHints;
TGLayoutHints fEntryHints;
TGMainFrame* ForwardOADBGui(AliOADBForward* db=0)
{
- const char* fwd = "$ALICE_ROOT/../trunk/PWGLF/FORWARD/analysis2";
+ const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
// if (!gROOT->GetClass("AliOADBForward"))
- gSystem->Load("libGui");
+ // gSystem->Load("libGui");
gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
// gSystem->AddIncludePath(Form("-I%s", fwd));
// gROOT->LoadMacro(Form("%s/corrs/ForwardOADBGUI.C", fwd));
+ new TBrowser;
+ // new TGClient();
ForwardOADBGUI* gui = new ForwardOADBGUI();
if (db) gui->UseDB(db);
return gui->GetMain();