#include "AliTPCGenDBTemp.h"
#include "AliLog.h"
ClassImp(AliTPCGenDBTemp)
const Int_t kValCut = 100;
const Int_t kDiffCut = 5;
AliTPCGenDBTemp::AliTPCGenDBTemp():
AliDCSGenDB()
{
}
AliTPCGenDBTemp::AliTPCGenDBTemp(const char *defaultStorage, const char *specificStorage) :
AliDCSGenDB(defaultStorage,specificStorage)
{
}
AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& ) : AliDCSGenDB()
{
AliError("copy constructor not implemented");
}
AliTPCGenDBTemp::~AliTPCGenDBTemp(){
}
AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& )
{
AliError("assignment operator not implemented");
return *this;
}
void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
const TTimeStamp& startTime,
const TTimeStamp& endTime,
Int_t run, const TString& amandaString )
{
AliTPCSensorTempArray *temperature=0;
if ( amandaString.Length()== 0 ) {
temperature = new AliTPCSensorTempArray(fList);
} else {
temperature = new AliTPCSensorTempArray(fList,amandaString);
}
temperature->SetStartTime(startTime);
temperature->SetEndTime(endTime);
temperature->SetValCut(kValCut);
temperature->SetDiffCut(kDiffCut);
TMap* map = SetGraphFile(fMap);
if (map) {
temperature->MakeSplineFit(map);
}
delete map;
map=0;
fMap=0;
SetFirstRun(run);
SetLastRun(run);
SetSensorArray(temperature);
StoreObject("TPC/Calib/Temperature",temperature, fMetaData);
}
TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname, const char *title,
const TString& amandaString) {
TTree* tree = new TTree(title,title);
tree->ReadFile(fname,"");
TClonesArray *arr;
if ( amandaString.Length()== 0 ) {
arr = AliTPCSensorTemp::ReadTree(tree);
} else {
arr = AliTPCSensorTemp::ReadTree(tree,amandaString);
}
delete tree;
return arr;
}
TTree * AliTPCGenDBTemp::ReadListTree(const char *fname, const char *title) {
TTree* tree = new TTree(title,title);
tree->ReadFile(fname,"");
return tree;
}
void AliTPCGenDBTemp::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun,
const char *confDir)
{
TTree *tree = ReadListTree(file,"tempConf");
SetConfTree(tree);
SetFirstRun(firstRun);
SetLastRun(lastRun);
StoreObject(confDir, fConfTree, fMetaData);
}