// $Id$
+#include <cstdlib>
#include "AliMUONPainterDataSourceFrame.h"
-
#include "AliLog.h"
#include "AliMUONPainterDataSourceItem.h"
#include "AliMUONPainterEnv.h"
#include "AliMUONPainterHelper.h"
#include "AliMUONPainterRegistry.h"
+#include "AliMUONRecoParam.h"
+#include "AliMUONTrackerACFDataMaker.h"
#include "AliMUONTrackerCalibratedDataMaker.h"
#include "AliMUONTrackerOCDBDataMaker.h"
#include "AliMUONTrackerRawDataMaker.h"
fRunSelector(new TGNumberEntry(fOCDBSelector,0)),
fOCDBTypes(new TGComboBox(fOCDBSelector)),
fRecentSources(new TGComboBox(fRecentSourceSelector)),
- fItems(new TObjArray)
+ fItems(new TObjArray),
+ fACFSelector(new TGGroupFrame(this,"ASCII Calib File",kHorizontalFrame)),
+ fACFPath(new TGTextEntry(fACFSelector,"")),
+ fACFTypes(new TGComboBox(fACFSelector))
{
/// Ctor
fRecentSourceSelector->AddFrame(fRecentSources,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
fRecentSourceSelector->AddFrame(createRecentButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
-
+
/// Raw file selection
TGButton* openButton = new TGPictureButton(fRawSelector21,
fOCDBTypes->AddEntry("Pedestals",0);
fOCDBTypes->AddEntry("Gains",1);
fOCDBTypes->AddEntry("Capacitances",2);
+ fOCDBTypes->AddEntry("HV",3);
fOCDBTypes->Select(0);
fOCDBTypes->Resize(100,20);
"AliMUONPainterDataSourceFrame",
this,
"CreateOCDBDataSource()");
-
-
+
+ const char* ocdbToolTip = "Use URL style for either alien or local OCDB (foo://bar). For example :\n"
+ "alien://folder=/alice/data.../OCDB\n"
+ "or\nlocal:///home/user/aliroot (mind the 3 slashes there !)";
+
+ fRawOCDBPath->SetToolTipText(ocdbToolTip);
+ fOCDBPath->SetToolTipText(ocdbToolTip);
+
fOCDBSelector->AddFrame(fOCDBPath,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
fOCDBSelector->AddFrame(fRunSelector,new TGLayoutHints(kLHintsTop,5,5,5,5));
fOCDBSelector->AddFrame(fOCDBTypes,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
fOCDBSelector->AddFrame(createOCDBButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
+
+
+ /// ASCII calibration file selection
+
+ TGButton* openButtonACF = new TGPictureButton(fACFSelector,
+ gClient->GetPicture("fileopen.xpm"));
+ openButtonACF->SetToolTipText("Click to open file dialog");
+
+ fACFTypes->AddEntry("Pedestals",0);
+ fACFTypes->AddEntry("Gains",1);
+ fACFTypes->AddEntry("Capacitances",2);
+ fACFTypes->Select(0);
+ fACFTypes->Resize(100,20);
+
+ fACFSelector->AddFrame(openButtonACF,new TGLayoutHints(kLHintsTop,5,5,5,5));
+ fACFSelector->AddFrame(fACFPath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
+ fACFSelector->AddFrame(fACFTypes,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
+
+ TGButton* createACFButton = new TGTextButton(fACFSelector,"Create data source");
+ createACFButton->Connect("Clicked()",
+ "AliMUONPainterDataSourceFrame",
+ this,
+ "CreateACFDataSource()");
+
+ openButtonACF->Connect("Clicked()",
+ "AliMUONPainterDataSourceFrame",
+ this,
+ "OpenFileDialogACF()");
+
+ fACFSelector->AddFrame(createACFButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
AddFrame(fRecentSourceSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
AddFrame(fOCDBSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
+ AddFrame(fACFSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
+
AddFrame(fDataReaders, new TGLayoutHints(kLHintsExpandX,10,10,10,10));
}
}
}
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::CreateACFDataSource()
+{
+ /// Create an ACF data source (using information from the widgets)
+
+ TString acfPath = fACFPath->GetText();
+ TGTextLBEntry* t = static_cast<TGTextLBEntry*>(fACFTypes->GetSelectedEntry());
+ TString type = t->GetText()->GetString();
+
+ CreateACFDataSource(acfPath,type);
+
+ fACFPath->SetText("");
+}
+
+
//_____________________________________________________________________________
void
AliMUONPainterDataSourceFrame::CreateOCDBDataSource()
fRunSelector->SetNumber(0);
}
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& uri)
+{
+ /// Create an ACF data source, given it's URI
+
+ TObjArray* a = uri.Tokenize(";");
+ TString acfPath = static_cast<TObjString*>(a->At(1))->String();
+ TString type = static_cast<TObjString*>(a->At(2))->String();
+
+ CreateACFDataSource(acfPath,type);
+
+ delete a;
+}
+
+
//_____________________________________________________________________________
void
AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& uri)
delete a;
}
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const TString& type)
+{
+ /// Create an ACF data source for a given (path,type)
+
+ AliMUONVTrackerDataMaker* reader = new AliMUONTrackerACFDataMaker(acfPath.Data(),
+ type.Data());
+
+ if ( reader->IsValid() )
+ {
+ AliMUONPainterRegistry::Instance()->Register(reader);
+
+ AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
+
+ Int_t n = env->Integer(fgkNumberOfDataSourcesKey);
+
+ env->Set(fgkNumberOfDataSourcesKey,n+1);
+
+ TString ds(Form("ACF;%s;%s",acfPath.Data(),type.Data()));
+
+ env->Set(Form(fgkDataSourceURIKey,n),ds.Data());
+
+ env->Save();
+
+ AddRecentSource(ds.Data());
+ }
+
+}
+
//_____________________________________________________________________________
void
AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& cdbPath,
if ( ocdbPath.Length() > 0 )
{
- reader = new AliMUONTrackerCalibratedDataMaker(rawReader,ocdbPath.Data(),
+ AliMUONRecoParam* recoParam = AliMUONRecoParam::GetCosmicParam();
+
+ // FIXME: where to get the reco params from in reality ?
+
+ reader = new AliMUONTrackerCalibratedDataMaker(recoParam,
+ rawReader,
+ ocdbPath.Data(),
calibMode.Data(),
histogram,
sxmin.Atof(),
item->Connect("StartRunning()",
"AliMUONPainterDataSourceFrame",
this,
- Form("StartRunning(=(AliMUONPainterDataSourceItem*)(0x%x))",item));
+ "StartRunning()");
item->Connect("StopRunning()",
"AliMUONPainterDataSourceFrame",
this,
- Form("StopRunning(=(AliMUONPainterDataSourceItem*)(0x%x))",item));
+ "StopRunning()");
fDataReaders->AddFrame(item);
}
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::OpenFileDialogACF()
+{
+ /// Open a file dialog to select an ASCII calibration file to be read
+
+ TGFileInfo fileInfo;
+
+ const char* fileTypes[] = {
+ "All files","*",
+ 0,0 };
+
+ fileInfo.fFileTypes = fileTypes;
+ delete[] fileInfo.fIniDir;
+
+ AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
+
+ fileInfo.fIniDir = StrDup(env->String("LastOpenDirACF","."));
+
+ new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
+ kFDOpen,&fileInfo);
+
+ fACFPath->SetText(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
+
+ env->Set("LastOpenDirACF",fileInfo.fIniDir);
+ env->Save();
+}
+
+
//_____________________________________________________________________________
void
AliMUONPainterDataSourceFrame::OpenRecentSource()
{
CreateOCDBDataSource(uri);
}
+ else if ( uri.Contains(TRegexp("^ACF")) )
+ {
+ CreateACFDataSource(uri);
+ }
fRecentSources->Select(-1);
}
//_____________________________________________________________________________
void
-AliMUONPainterDataSourceFrame::StartRunning(AliMUONPainterDataSourceItem* item)
+AliMUONPainterDataSourceFrame::StartRunning()
{
/// One data source starts running. Disable the Run button of the other ones
+
+ AliMUONPainterDataSourceItem* item = reinterpret_cast<AliMUONPainterDataSourceItem*> (gTQSender);
+
+ AliInfo("");
+
TIter next(fItems);
AliMUONPainterDataSourceItem* o;
while ( ( o = static_cast<AliMUONPainterDataSourceItem*>(next()) ) )
//_____________________________________________________________________________
void
-AliMUONPainterDataSourceFrame::StopRunning(AliMUONPainterDataSourceItem* /*item*/)
+AliMUONPainterDataSourceFrame::StopRunning()
{
/// One data source stops running. Enable the Run button of all items
+
TIter next(fItems);
AliMUONPainterDataSourceItem* o;
while ( ( o = static_cast<AliMUONPainterDataSourceItem*>(next()) ) )