#include "AliSurveyObj.h"
#include "TObjArray.h"
#include "TGrid.h"
#include "TGridResult.h"
#include "TFile.h"
#include "TObjString.h"
#include "AliLog.h"
#include "AliSurveyPoint.h"
ClassImp(AliSurveyObj)
const TString AliSurveyObj::fgkStorage = "alien://alice.cern.ch";
const TString AliSurveyObj::fgkBaseFolder = "/alice/data/Reference";
const TString AliSurveyObj::fgkValidDetectors = "ACORDE,BABYFRAME,BACKFRAME,\
EMCAL,FMD,HMPID,ITS,L3 MAGNET,MUON,MUON ABSORBERS,MUON DIPOLE,PHOS,PMD,\
SPACEFRAME,SUPERSTRUCTURE,T0,TOF,TPC,TRD,VZERO,ZDC,GRP";
const TString AliSurveyObj::fgkGRPDetectors = "BABYFRAME,BACKFRAME,L3 MAGNET,\
SPACEFRAME,MUON DIPOLE,MUON ABSORBERS,GRP";
const TString AliSurveyObj::fgkMUONDetectors = "MUON,SUPERSTRUCTURE";
AliSurveyObj::AliSurveyObj():
TObject(),
fTitle(""),
fDate(""),
fDetector(""),
fURL("http://edms.cern.ch/"),
fReportNr(-1),
fVersion(-1),
fObs(""),
fCoordSys(""),
fUnits(""),
fNrColumns(-1),
fColNames(""),
fIsValid(kFALSE),
fGridUser(""),
fDataPoints(new TObjArray(1))
{
fDataPoints->SetOwner(kTRUE);
}
AliSurveyObj::~AliSurveyObj() {
if (fDataPoints) {
fDataPoints->Delete();
fDataPoints = 0;
}
}
AliSurveyObj::AliSurveyObj(const AliSurveyObj& surveyObj):
TObject(),
fTitle(surveyObj.fTitle),
fDate(surveyObj.fDate),
fDetector(surveyObj.fDetector),
fURL(surveyObj.fURL),
fReportNr(surveyObj.fReportNr),
fVersion(surveyObj.fVersion),
fObs(surveyObj.fObs),
fCoordSys(surveyObj.fCoordSys),
fUnits(surveyObj.fUnits),
fNrColumns(surveyObj.fNrColumns),
fColNames(surveyObj.fColNames),
fIsValid(surveyObj.fIsValid),
fGridUser(surveyObj.fGridUser),
fDataPoints(new TObjArray(1))
{
TObject *curr = surveyObj.fDataPoints->First();
while (curr != 0) {
fDataPoints->Add(curr);
curr = surveyObj.fDataPoints->After(curr);
}
}
AliSurveyObj& AliSurveyObj::operator=(const AliSurveyObj& surveyObj)
{
if (this != &surveyObj) {
fTitle = surveyObj.fTitle;
fDate = surveyObj.fDate;
fDetector = surveyObj.fDetector;
fURL = surveyObj.fURL;
fReportNr = surveyObj.fReportNr;
fVersion = surveyObj.fVersion;
fObs = surveyObj.fObs;
fCoordSys = surveyObj.fCoordSys;
fUnits = surveyObj.fUnits;
fNrColumns = surveyObj.fNrColumns;
fColNames = surveyObj.fColNames;
fIsValid = surveyObj.fIsValid;
fGridUser = surveyObj.fGridUser;
TObject *curr = surveyObj.fDataPoints->First();
while (curr != 0) {
fDataPoints->Add(curr);
curr = surveyObj.fDataPoints->After(curr);
}
}
return *this;
}
void AliSurveyObj::AddPoint(AliSurveyPoint* point) {
fDataPoints->Add(point);
return;
}
Bool_t AliSurveyObj::Connect(const char *gridUrl, const char *user) {
if (!gGrid || gridUrl != gGrid->GridUrl() ||
(( strcmp(user,"") ) && ( strcmp(user,gGrid->GetUser()) )) ) {
AliInfo("\nConnecting to the Grid...");
if (gGrid) {
AliInfo(Form("gGrid = %p; GridUrl = %s; gGrid->GridUrl() = %s",
gGrid, gridUrl, gGrid->GridUrl()));
AliInfo(Form("User = %s; gGrid->GetUser() = %s",
user, gGrid->GetUser()));
}
TGrid::Connect(gridUrl,user);
}
if(!gGrid) {
AliError("Connection failed!");
return kFALSE;
}
return kTRUE;
}
Bool_t AliSurveyObj::OpenFile(TString openString) {
AliInfo(Form("Opening file \"%s\"\n for survey data", openString.Data()));
if (openString.BeginsWith("alien://"))
if (!Connect(fgkStorage.Data(), fGridUser.Data())) {
AliError(Form("Error connecting to GRID"));
return kFALSE;
}
TFile *file = TFile::Open(openString.Data(), "READ");
if ( !file ) {
AliError(Form("Error opening file \"%s\"", openString.Data()));
return kFALSE;
}
Int_t size = file->GetSize();
char *buf = new Char_t[size + 1];
memset(buf, '\0', size + 1);
file->Seek(0);
if ( file->ReadBuffer(buf, size) ) {
AliError("Error reading file contents to buffer!");
return kFALSE;
}
AliInfo(Form("%lld bytes read!\n", file->GetBytesRead()));
Bool_t goodParsing = ParseBuffer(buf);
file->Close();
delete[] buf;
return goodParsing;
}
Bool_t AliSurveyObj::FillFromLocalFile(const Char_t* filename) {
TString fullOpenString = "file://" + TString(filename) + "?filetype=raw";
return OpenFile(fullOpenString);
}
Bool_t AliSurveyObj::IsValidDetector(TString detector) const {
detector.ToUpper();
TObjArray *dets = fgkValidDetectors.Tokenize(',');
TObject *found = dets->FindObject(detector);
delete dets;
if (!found) return kFALSE;
else return kTRUE;
}
TString AliSurveyObj::RealFolderName(TString detector) const {
detector.ToUpper();
TString folderName = detector;
TObjArray *dets = fgkGRPDetectors.Tokenize(',');
if (dets->FindObject(detector)) folderName = "GRP";
delete dets;
dets = fgkMUONDetectors.Tokenize(',');
if (dets->FindObject(detector)) folderName = "MUON";
delete dets;
return folderName;
}
Bool_t AliSurveyObj::Fill(TString detector, Int_t reportNumber,
TString username) {
return Fill(detector, reportNumber, -1, username);
}
Bool_t AliSurveyObj::Fill(TString detector, Int_t reportNumber,
Int_t reportVersion, TString username) {
detector.ToUpper();
if (!IsValidDetector(detector)) {
AliWarning(Form("Detector '%s' is not a valid detector/structure!", detector.Data()));
return kFALSE;
}
if ((reportNumber < 1) || (reportVersion < -1) || (0 == reportVersion)) {
AliError("Invalid parameter values for AliSurveyObj::Fill. (Report Number or Report Version)");
return kFALSE;
}
if (username.Length() > 0) SetGridUser(username);
else if (0 == fGridUser.Length()) {
AliError("GRID username not specified and not previously set!");
return kFALSE;
}
TGridResult *res = QueryReports(detector, -1, reportNumber, reportVersion);
if (!res) AliError(Form("Error querying AliEn for detector '%s', \
report number '%d' and report version '%d'.",
detector.Data(), reportNumber, reportVersion));
Int_t numberEntries = res->GetEntries();
if (0 == numberEntries) {
AliError(Form("No report found for detector '%s', report number '%d' and report version '%d'",
detector.Data(), reportNumber, reportVersion));
return kFALSE;
}
TString fileNamePath = "";
if (1 == numberEntries) fileNamePath = res->GetFileNamePath(0);
else if (numberEntries > 1) {
TString higherVerFNP = res->GetFileNamePath(0);
Int_t lastYear = FileNamePathToReportYear(higherVerFNP);
for (Int_t i = 1; i < numberEntries; ++i) {
TString currFNP = res->GetFileNamePath(i);
if (FileNamePathToReportVersion(currFNP) >
FileNamePathToReportVersion(higherVerFNP)) higherVerFNP = currFNP;
if (lastYear != FileNamePathToReportYear(currFNP))
AliWarning("Inconsistency detected, year differs for reports with the same report number! Please inform the responsible and check the report against the one in DCDB.");
}
fileNamePath = higherVerFNP;
}
TString fullOpenString = "alien://" + fileNamePath + "?filetype=raw";
return OpenFile(fullOpenString);
}
TString AliSurveyObj::FileNamePathToDetector(TString filename) const {
TString ret = "";
if (filename.Length() > fgkBaseFolder.Length()) {
ret = filename.Remove(0, fgkBaseFolder.Length());
ret.Remove(TString::kLeading, '/');
ret = ret(0, ret.First('/'));
if (!IsValidDetector(ret)) ret = "";
}
return ret;
}
Int_t AliSurveyObj::FileNamePathToReportYear(TString filename) const {
TString ret = "";
if (filename.Length() > fgkBaseFolder.Length()) {
ret = filename.Remove(0, fgkBaseFolder.Length());
ret.Remove(TString::kLeading, '/');
Int_t beg = ret.First('/') + TString("RawSurvey/").Length() + 1;
ret = ret(beg, ret.Last('/') - beg);
return ret.Atoi();
}
return -1;
}
Int_t AliSurveyObj::FileNamePathToReportNumber(TString filename) const {
TString ret = "";
if (filename.Length() > fgkBaseFolder.Length()) {
ret = filename.Remove(0, fgkBaseFolder.Length());
ret.Remove(TString::kLeading, '/');
if ((ret.CountChar('/') > 3) || (ret.CountChar('.') > 1)) {
AliWarning("Error getting the Report Number from the filename path!");
return -1;
}
ret = ret(ret.Last('/') + 1 , ret.Last('_') - ret.Last('/') - 1);
return ret.Atoi();
}
AliWarning("Error getting the Report Number from the filename path!");
return -1;
}
Int_t AliSurveyObj::FileNamePathToReportVersion(TString filename) const {
TString ret = "";
if (filename.Length() > fgkBaseFolder.Length()) {
ret = filename.Remove(0, fgkBaseFolder.Length());
ret.Remove(TString::kLeading, '/');
if ((ret.CountChar('/') > 3) || (ret.CountChar('.') > 1)) {
AliWarning("Error getting the Report Version from the filename path!");
return -1;
}
ret = ret(ret.Last('_') + 1 + 1 , ret.Last('.') - ret.Last('_') - 1 - 1);
return ret.Atoi();
}
AliWarning("Error getting the Report Version from the filename path!");
return -1;
}
void AliSurveyObj::ListValidDetectors() {
Printf("Listing all valid detectors:\n");
TObjArray *dets = fgkValidDetectors.Tokenize(',');
for (int i = 0; i < dets->GetEntries(); ++i)
Printf("%s", ((TObjString *) dets->At(i))->GetString().Data());
delete dets;
Printf("Some reports are stored in more general folders.\n"
"These reports can be opened using either name, the original or the\n"
"folder name. Example: 'SPACEFRAME' or 'GRP' are both valid when\n"
"opening a report for the Spaceframe.\n\n"
"Detectors stored in 'MUON' folder:");
dets = fgkMUONDetectors.Tokenize(',');
for (int i = 0; i < dets->GetEntries(); ++i)
Printf("%s", ((TObjString *) dets->At(i))->GetString().Data());
delete dets;
Printf("Detectors stored in 'GRP' folder:");
dets = fgkGRPDetectors.Tokenize(',');
for (int i = 0; i < dets->GetEntries(); ++i)
Printf("%s", ((TObjString *) dets->At(i))->GetString().Data());
delete dets;
return;
}
TGridResult * AliSurveyObj::QueryReports(TString detector, Int_t year,
Int_t reportNumber,
Int_t reportVersion) {
TString lsArg = fgkBaseFolder;
TString detectorFolder = "";
if (detector.Length() > 0) {
detector.ToUpper();
if (!IsValidDetector(detector)) {
AliError(Form("Detector '%s' is not a valid detector/structure!",
detector.Data()));
return 0;
}
detectorFolder = "/" + RealFolderName(detector);
} else detectorFolder = "/*";
lsArg += detectorFolder + "/RawSurvey";
TString yearFolder = "";
if (year > 1950) yearFolder.Form("/%d", year);
else yearFolder = "/*";
TString reportFolder = "";
if (reportNumber > 0) reportFolder.Form("/%d", reportNumber);
else reportFolder = "/*";
TString versionFolder = "";
if (reportVersion > 0) versionFolder.Form("_v%d", reportVersion);
else versionFolder = "_v*";
lsArg += yearFolder + reportFolder + versionFolder + ".txt";
AliInfo(Form("\nLooking for: %s \n", lsArg.Data()));
if (0 == fGridUser.Length()) {
AliError("To use this method it's necessary to call SetGridUser(...) in advance.");
return 0;
} else if (!Connect(fgkStorage.Data(), fGridUser.Data())) {
AliError(Form("Error connecting to GRID"));
return 0;
}
return gGrid->Ls(lsArg);
}
Int_t AliSurveyObj::ListReports(TString detector, Int_t year,
Int_t reportNumber,
Int_t reportVersion) {
TGridResult *res = QueryReports(detector, year, reportNumber, reportVersion);
if (0 == res) {
AliError("Query failed.");
return 0;
}
TString fn = "";
Int_t numberEntries = res->GetEntries();
if (numberEntries > 0) {
Printf("%d reports found:", numberEntries);
for (int i = 0; i < res->GetEntries(); ++i) {
fn = res->GetFileNamePath(i);
Printf("Detector:%s\tYear:%d\tEDMS Report Number:%d\tVersion:%d",
FileNamePathToDetector(fn).Data(),
FileNamePathToReportYear(fn),
FileNamePathToReportNumber(fn),
FileNamePathToReportVersion(fn));
}
delete res;
return numberEntries;
} else {
AliInfo("No results found for the requested query.");
delete res;
return 0;
}
}
void AliSurveyObj::SetGridUser(TString username){
fGridUser = username;
return;
}
TString &AliSurveyObj::Sanitize(TString str) {
str.Remove(TString::kTrailing, '\r');
str.Remove(TString::kTrailing, '\n');
str.Remove(TString::kTrailing, '\r');
if (!str.IsAscii()) {
AliWarning("Warning: Non-ASCII characters!\n");
str = "";
}
return str.Remove(TString::kBoth, ' ');
}
Bool_t AliSurveyObj::ParseBuffer(const Char_t* buf) {
if (fIsValid) Reset();
TString buffer = TString(buf);
TObjArray *linesRaw = buffer.Tokenize('\n');
TString oneLine = "";
TObjString* oneLineObj = 0;
TObjArray *lines = new TObjArray();
for(Int_t i=0; i<linesRaw->GetEntries(); i++)
{
oneLine = ((TObjString *)(linesRaw->At(i)))->GetString().Data();
oneLine = Sanitize(oneLine);
if (oneLine.Length() == 0) continue;
oneLineObj = new TObjString(oneLine);
lines->Add(oneLineObj);
}
delete linesRaw;
linesRaw = NULL;
TObjArray *dataLine = NULL;
TObjArray *colLine = NULL;
const Int_t kFieldCheck = 10;
Bool_t check[kFieldCheck];
for (Int_t i = 0; i < kFieldCheck; ++i) check[i] = kFALSE;
TString tmpname = "";
Float_t tmpx = 0.0, tmpy = 0.0, tmpz = 0.0;
Float_t tmpprecX = -1., tmpprecY = -1., tmpprecZ = -1.;
Char_t tmptype = '\0';
Bool_t tmptarg = kTRUE;
AliSurveyPoint *dp = 0;
TString *orderedValues[9] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
TString value[9];
Int_t nrLines = lines->GetEntries();
Printf("Lines in file: %d\n", nrLines);
TString currLine = "", nextLine = "";
for (Int_t i = 0; i < nrLines; ++i) {
currLine = ((TObjString *)(lines->At(i)))->GetString().Data();
nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
if (currLine.BeginsWith(">") && !nextLine.BeginsWith(">")) {
currLine.Remove(TString::kLeading, '>');
currLine.Remove(TString::kTrailing, ':');
currLine.Remove(TString::kBoth, ' ');
nextLine.Remove(TString::kBoth, ' ');
AliDebug(2, Form(" -> field line: \"%s\"\n", currLine.Data()));
AliDebug(2, Form(" -> value line: \"%s\"\n", nextLine.Data()));
if (currLine.BeginsWith("Title", TString::kIgnoreCase)) {
fTitle = nextLine;
++i;
} else if (currLine.BeginsWith("Date", TString::kIgnoreCase)) {
fDate = nextLine;
++i;
} else if (currLine.BeginsWith("Subdetector", TString::kIgnoreCase)) {
fDetector = nextLine;
++i;
} else if (currLine.BeginsWith("Report URL", TString::kIgnoreCase)) {
if (nextLine.BeginsWith("http://edms.cern.ch/document/", TString::kIgnoreCase) ||
nextLine.BeginsWith("https://edms.cern.ch/document/", TString::kIgnoreCase)) {
fURL = nextLine;
nextLine.Remove(TString::kTrailing, '/');
nextLine = nextLine(nextLine.Last('/') + 1, nextLine.Length() - nextLine.Last('/') + 1);
if (!nextLine.IsDigit()) {
AliError("Survey text file sintax error! (incorrectly formatted Report URL)");
AliError(Form("Wrong report number string: \"%s\"",nextLine.Data()));
lines->Delete();
delete lines; lines = NULL;
return kFALSE;
}
fReportNr = nextLine.Atoi();
++i;
} else {
AliError("Survey text file sintax error! (incorrectly formatted Report URL)");
return kFALSE;
}
} else if (currLine.BeginsWith("Version", TString::kIgnoreCase)) {
if (!nextLine.IsDigit()) {
lines->Delete();
delete lines; lines = NULL;
AliError("Survey text file sintax error! (incorrectly formatted Report Version)");
return kFALSE;
}
fVersion = nextLine.Atoi();
++i;
} else if (currLine.BeginsWith("General Observations", TString::kIgnoreCase)) {
fObs = "";
while (('>' != nextLine[0]) && (nextLine.Length() > 0) && (i < nrLines)) {
fObs += (0 == fObs.Length()) ? nextLine : " / " + nextLine;
++i;
nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
}
} else if (currLine.BeginsWith("Coordinate System", TString::kIgnoreCase)) {
fCoordSys = nextLine;
++i;
} else if (currLine.BeginsWith("Units", TString::kIgnoreCase)) {
fUnits = nextLine;
++i;
} else if (currLine.BeginsWith("Nr Columns", TString::kIgnoreCase)) {
if (!nextLine.IsDigit()) {
lines->Delete();
delete lines; lines = NULL;
AliError("Survey text file sintax error! (incorrectly formatted Number of Columns)");
return kFALSE;
}
fNrColumns = nextLine.Atoi();
++i;
} else if (currLine.BeginsWith("Column Names", TString::kIgnoreCase)) {
fColNames = nextLine;
colLine = nextLine.Tokenize(',');
if (colLine->GetEntries() != fNrColumns) {
AliError("Survey text file sintax error! (Declared number of Columns doesn't match number of column names)");
delete colLine;
lines->Delete();
delete lines; lines = NULL;
return kFALSE;
}
++i;
Bool_t prX = kFALSE;
Bool_t prY = kFALSE;
Bool_t prZ = kFALSE;
for (Int_t j = 0; j < fNrColumns; ++j) {
TString cn = ((TObjString *)(colLine->At(j)))->GetString();
if (cn.BeginsWith("Point Name", TString::kIgnoreCase)) {
orderedValues[0] = &value[j];
check[0] = kTRUE;
} else if (cn.BeginsWith("X", TString::kIgnoreCase)) {
orderedValues[1] = &value[j];
check[1] = kTRUE;
} else if (cn.BeginsWith("Y", TString::kIgnoreCase)) {
orderedValues[2] = &value[j];
check[2] = kTRUE;
} else if (cn.BeginsWith("Z", TString::kIgnoreCase)) {
orderedValues[3] = &value[j];
check[3] = kTRUE;
} else if (cn.BeginsWith("Precision", TString::kIgnoreCase)) {
TString tmpCN = cn(0, cn.First('('));
Int_t precLength = TString("Precision").Length();
if (precLength == tmpCN.Length()) {
if(!orderedValues[6]){
orderedValues[6] = &value[j];
check[6] = kTRUE;
}else{
AliWarning("Global precision will not be used for X axis");
}
if(!orderedValues[7]){
orderedValues[7] = &value[j];
check[7] = kTRUE;
}else{
AliWarning("Global precision will not be used for Y axis");
}
if(!orderedValues[8]){
orderedValues[8] = &value[j];
check[8] = kTRUE;
}else{
AliWarning("Global precision will not be used for Z axis");
}
} else {
Bool_t orXYZ = kFALSE;
TString axis = cn(precLength, tmpCN.Length() - precLength);
if (axis.Contains('X', TString::kIgnoreCase)) {
if(!prX){
orderedValues[6] = &value[j];
check[6] = kTRUE;
orXYZ = kTRUE;
prX = kTRUE;
}else{
AliError("Precision for X axis was already set!");
return kFALSE;
}
}
if (axis.Contains('Y', TString::kIgnoreCase)) {
if(!prY){
orderedValues[7] = &value[j];
check[7] = kTRUE;
orXYZ = kTRUE;
prY = kTRUE;
}else{
AliError("Precision for Y axis was already set!");
return kFALSE;
}
}
if (axis.Contains('Z', TString::kIgnoreCase)) {
if(!prZ){
orderedValues[8] = &value[j];
check[8] = kTRUE;
orXYZ = kTRUE;
prZ = kTRUE;
}else{
AliError("Precision for Z axis was already set!");
return kFALSE;
}
}
if(!orXYZ)
{
AliError("Survey text file sintax error: precision column name does not refer to any axis!");
return kFALSE;
}
}
} else if (cn.BeginsWith("Point Type", TString::kIgnoreCase)) {
orderedValues[4] = &value[j];
check[4] = kTRUE;
} else if (cn.BeginsWith("Target Used", TString::kIgnoreCase)) {
orderedValues[5] = &value[j];
check[5] = kTRUE;
}
}
if(!check[0]){
AliError("Missing mandatory column \"Point Name\"!");
return kFALSE;
}
if(!(check[1]&&check[2]&&check[3])){
AliError("Missing one or more mandatory columns for coordinates \"X\",\"Y\",\"Z\"");
return kFALSE;
}
if(!check[4]){
AliError("Missing mandatory column \"Point Type\"!");
return kFALSE;
}
if(!(check[6]&&check[7]&&check[8])){
AliError("Missing one or more mandatory columns for precision along \"X\",\"Y\",\"Z\" axes");
return kFALSE;
}
} else if (currLine.BeginsWith("Data", TString::kIgnoreCase)) {
while ((nextLine.Length() > 0) && ('>' != nextLine[0])) {
if (fNrColumns == nextLine.CountChar(',') + 1) dataLine = nextLine.Tokenize(',');
else if (fNrColumns == nextLine.CountChar('\t') + 1) dataLine = nextLine.Tokenize('\t');
else if (fNrColumns == nextLine.CountChar(' ') + 1) dataLine = nextLine.Tokenize(' ');
else {
AliError("Survey text file syntax error! Error processing data line!");
lines->Delete();
delete lines; lines = NULL;
return kFALSE;
}
if (dataLine->GetEntries() != fNrColumns) {
AliError("Survey text file sintax error! (Number of entries in line is different from number of Columns)");
delete dataLine;
lines->Delete();
delete lines; lines = NULL;
return kFALSE;
}
for (Int_t j = 0; j < dataLine->GetEntries(); ++j) {
value[j] = ((TObjString *)(dataLine->At(j)))->GetString();
}
tmpname = *orderedValues[0];
tmpx = orderedValues[1]->Atof();
tmpy = orderedValues[2]->Atof();
tmpz = orderedValues[3]->Atof();
tmpprecX = orderedValues[6]->Atof();
tmpprecY = orderedValues[7]->Atof();
tmpprecZ = orderedValues[8]->Atof();
tmptype = orderedValues[4]->Data()[0];
if(orderedValues[5]) tmptarg = (orderedValues[5]->Data()[0] == 'Y') ? kTRUE : kFALSE;
dp = new AliSurveyPoint(tmpname, tmpx, tmpy, tmpz, tmpprecX, tmpprecY, tmpprecZ, tmptype, tmptarg);
if(AliLog::GetDebugLevel("","AliSurveyObj")>1) dp->PrintPoint();
AddPoint(dp);
dataLine->Delete();
dataLine = NULL;
++i;
nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
}
}
} else {
AliError("Survey text file sintax error!");
lines->Delete();
delete lines; lines = NULL;
return kFALSE;
}
}
lines->Delete();
delete lines; lines = NULL;
fIsValid = kTRUE;
return kTRUE;
}
void AliSurveyObj::Reset() {
if (fDataPoints) {
fDataPoints->Delete();
fDataPoints = 0;
}
fTitle = "";
fDate = "";
fDetector = "";
fURL = "http://edms.cern.ch/";
fReportNr = -1;
fVersion = -1;
fObs = "";
fCoordSys = "";
fUnits = "";
fNrColumns = -1;
fColNames = "";
fIsValid = kFALSE;
fDataPoints = new TObjArray(1);
fDataPoints->SetOwner(kTRUE);
return;
}