#include <cstdlib>
#include "AliMUONPainterDataSourceFrame.h"
-
#include "AliLog.h"
#include "AliMUONPainterDataSourceItem.h"
#include "AliMUONPainterEnv.h"
#include "AliMUONPainterHelper.h"
#include "AliMUONPainterRegistry.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,
this,
"CreateOCDBDataSource()");
-
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,
}
+//_____________________________________________________________________________
+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);
}
--- /dev/null
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONTrackerACFDataMaker.h"
+
+#include "AliMUONTrackerData.h"
+#include "AliMUONTrackerIO.h"
+#include "AliMUON2DMap.h"
+#include "AliMUON1DMap.h"
+#include "AliLog.h"
+#include <TString.h>
+#include <TSystem.h>
+
+///\class AliMUONTrackerACFDataMaker
+///
+/// Producer of AliMUONVTrackerData from ASCII calibration files
+///
+///\author Laurent Aphecetche, Subatech
+
+///\cond CLASSIMP
+ClassImp(AliMUONTrackerACFDataMaker)
+///\endcond
+
+//_____________________________________________________________________________
+AliMUONTrackerACFDataMaker::AliMUONTrackerACFDataMaker(const char* acfPath,
+ const char* type)
+: AliMUONVTrackerDataMaker(),
+ fIsValid(kTRUE),
+ fData(0x0),
+ fSource(Form("%s-%s",acfPath,type))
+{
+ /// Ctor
+
+ static Int_t number(0);
+
+ ++number;
+
+ AliMUONVStore* store(0x0);
+
+ TString stype(type);
+ stype.ToUpper();
+ Bool_t isSingleEvent(kTRUE);
+ TString filename(gSystem->ExpandPathName(acfPath));
+
+ if ( stype == "PEDESTALS" )
+ {
+ fData = new AliMUONTrackerData(Form("PED",number),"Pedestals",2,isSingleEvent);
+ fData->SetDimensionName(0,"Mean");
+ fData->SetDimensionName(1,"Sigma");
+ store = new AliMUON2DMap(kTRUE);
+ AliMUONTrackerIO::ReadPedestals(filename.Data(),*store);
+ }
+ else if ( stype == "GAINS" )
+ {
+ fData = new AliMUONTrackerData(Form("GAIN%d",number),"Gains",5,isSingleEvent);
+ fData->SetDimensionName(0,"a1");
+ fData->SetDimensionName(1,"a2");
+ fData->SetDimensionName(2,"thres");
+ fData->SetDimensionName(3,"qual");
+ fData->SetDimensionName(4,"sat");
+ store = new AliMUON2DMap(kTRUE);
+ TString comment;
+ AliMUONTrackerIO::ReadGains(filename.Data(),*store,comment);
+ }
+ else if ( stype == "CAPACITANCES" )
+ {
+ fData = new AliMUONTrackerData(Form("CAPA%d",number),"Capacitances",2,isSingleEvent);
+ fData->SetDimensionName(0,"Capa");
+ fData->SetDimensionName(1,"Injection gain");
+ store = new AliMUON1DMap(20000);
+ AliMUONTrackerIO::ReadCapacitances(filename.Data(),*store);
+ }
+
+ if (!store)
+ {
+ fIsValid = kFALSE;
+ delete fData;
+ fData = 0x0;
+ AliError("Could not create store");
+ return;
+ }
+
+ fData->Add(*store);
+}
+
+//_____________________________________________________________________________
+AliMUONTrackerACFDataMaker::~AliMUONTrackerACFDataMaker()
+{
+ /// dtor
+ delete fData;
+}
+
+//_____________________________________________________________________________
+Long64_t
+AliMUONTrackerACFDataMaker::Merge(TCollection*)
+{
+ /// Merge
+ AliError("Not implemented. Does it have sense ?");
+ return 0;
+}
+
--- /dev/null
+#ifndef ALIMUONTRACKERACFDATAMAKER_H
+#define ALIMUONTRACKERACFDATAMAKER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup graphics
+/// \class AliMUONTrackerACFDataMaker
+/// \brief
+///
+// Author Laurent Aphecetche, Subatech
+
+#ifndef ALIMUONVTrackerDataMaker_H
+# include "AliMUONVTrackerDataMaker.h"
+#endif
+#ifndef ROOT_TString
+# include "TString.h"
+#endif
+
+class AliMUONTrackerACFDataMaker : public AliMUONVTrackerDataMaker
+{
+public:
+ AliMUONTrackerACFDataMaker(const char* acfPath="",
+ const char* type="");
+ virtual ~AliMUONTrackerACFDataMaker();
+
+ /// Whether we've been properly initialized or not
+ Bool_t IsValid() const { return fIsValid; }
+
+ /// Return our data
+ virtual AliMUONVTrackerData* Data() const { return fData; }
+
+ /// We are not runnable (i.e. # of event is fixed = 1)
+ virtual Bool_t IsRunnable() const { return kFALSE; }
+
+ /// We cannot be running as we are not runnable...
+ virtual Bool_t IsRunning() const { return kFALSE; }
+
+ /// N/A
+ virtual void SetRunning(Bool_t /*flag*/) {}
+
+ /// N/A
+ virtual Bool_t NextEvent() { return kTRUE; }
+
+ /// N/A
+ virtual void Rewind() { }
+
+ /// Set our source URI
+ virtual void SetSource(const char* source) { fSource = source; }
+
+ /// Get our source URI
+ virtual TString Source() const { return fSource; }
+
+ /// Number of events is always 1
+ Int_t NumberOfEvents() const { return 1; }
+
+ virtual Long64_t Merge(TCollection* li);
+
+private:
+ /// Not implemented
+ AliMUONTrackerACFDataMaker(const AliMUONTrackerACFDataMaker& rhs);
+ /// Not implemented
+ AliMUONTrackerACFDataMaker& operator=(const AliMUONTrackerACFDataMaker& rhs);
+
+private:
+ Bool_t fIsValid; ///< whether we have valid data
+ AliMUONVTrackerData* fData; ///< our data
+ TString fSource; ///< our source
+
+ ClassDef(AliMUONTrackerACFDataMaker,2) // Producer of AliMUONVTrackerData from ACF
+};
+
+#endif