ROOT logo
#ifndef ALI_SURVEY_OBJ_H
#define ALI_SURVEY_OBJ_H

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/////////////////////////////////////////////////////////////////////
//                                                                 //
//  class AliSurveyObj						   //
//  Retrieve and Convert survey data into ROOT Objects   	   //
//                                                                 //
/////////////////////////////////////////////////////////////////////

#include <TObject.h>

#include <TString.h>
#include <TObjArray.h>

class AliSurveyPoint;
class TGridResult;

class AliSurveyObj: public TObject {

 public:
  AliSurveyObj();
  ~AliSurveyObj();
  Bool_t FillFromLocalFile(const Char_t* filename);
  Bool_t Fill(TString detector, Int_t reportNumber,
	      Int_t reportVersion, TString username = "");
  Bool_t Fill(TString detector, Int_t reportNumber,
	      TString username = "");

  static void ListValidDetectors();
  Int_t ListReports(TString detector = "", Int_t year = -1,
		    Int_t reportNumber = -1,
		    Int_t reportVersion = -1);

  void SetGridUser(TString username);
 
  // Number of points (AliSurveyPoint) in the TObjArray
  Int_t GetEntries() const {return fDataPoints->GetEntries();};

  TString GetReportTitle() const {return fTitle;};
  TString GetReportDate() const {return fDate;};
  TString GetDetector() const {return fDetector;};
  TString GetURL() const {return fURL;};
  Int_t GetReportNumber() const {return fReportNr;};
  Int_t GetReportVersion() const {return fVersion;};

  // General comments and observations
  TString GetObservations() const {return fObs;};

  // Coordinate system used for the measurements
  TString GetCoordSys() const {return fCoordSys;};

  // Units used in the measurement
  TString GetUnits() const {return fUnits;};

  // Number of columns read from file (in the "Data" section)
  Int_t GetNrColumns() const {return fNrColumns;};

  // TObjArray with the names of the columns read
  TObjArray *GetColumnNames() const {return fColNames.Tokenize(',');};

  // TObjArray with the points read (AliSurveyPoint)
  TObjArray *GetData() const {return fDataPoints;};

  Bool_t IsValid() const {return fIsValid;};

  
 private:
  TString fTitle;     // Report Title
  TString fDate;      // Report Date
  TString fDetector;  // Subdetector (or structure) surveyed
  TString fURL;       // Report URL in EDMS
  Int_t fReportNr;    // Report Number
  Int_t fVersion;     // Report Version
  TString fObs;       // General observations / comments
  TString fCoordSys;  // Measurements coordinate system
  TString fUnits;     // Measurements units
  Int_t fNrColumns;   // Number of columns in data values
  TString fColNames;  // Column names sepparated by commas
  Bool_t fIsValid;    // Is the data valid? (sucessfully parsed)
  TString fGridUser;  // Username to be used for the connection to GRID
  
  TObjArray *fDataPoints;	// Actual Data
  
  static const TString fgkStorage; // Storage
  static const TString fgkBaseFolder; // Base folder
  static const TString fgkValidDetectors;// Valid detectors
  static const TString fgkGRPDetectors;// GRP detectors
  static const TString fgkMUONDetectors;// MUON detectors
    
  Bool_t Connect(const char *gridUrl, const char *user);
  Bool_t OpenFile(TString openString);
  TString &Sanitize(TString str);
  Bool_t ParseBuffer(const Char_t* buf);
  void Reset();
  Bool_t IsValidDetector(TString detector) const;
  TString RealFolderName(TString detector) const;
  TString FileNamePathToDetector(TString filename) const;
  Int_t FileNamePathToReportYear(TString filename) const;
  Int_t FileNamePathToReportNumber(TString filename) const;
  Int_t FileNamePathToReportVersion(TString filename) const;
  TGridResult *QueryReports(TString detector, Int_t year,
			    Int_t reportNumber, Int_t reportVersion);

  AliSurveyObj (const AliSurveyObj& surveyObj);
  AliSurveyObj& operator=(const AliSurveyObj& surveyObj); 
  void AddPoint(AliSurveyPoint* point);

  ClassDef(AliSurveyObj, 1);
};

#endif
 AliSurveyObj.h:1
 AliSurveyObj.h:2
 AliSurveyObj.h:3
 AliSurveyObj.h:4
 AliSurveyObj.h:5
 AliSurveyObj.h:6
 AliSurveyObj.h:7
 AliSurveyObj.h:8
 AliSurveyObj.h:9
 AliSurveyObj.h:10
 AliSurveyObj.h:11
 AliSurveyObj.h:12
 AliSurveyObj.h:13
 AliSurveyObj.h:14
 AliSurveyObj.h:15
 AliSurveyObj.h:16
 AliSurveyObj.h:17
 AliSurveyObj.h:18
 AliSurveyObj.h:19
 AliSurveyObj.h:20
 AliSurveyObj.h:21
 AliSurveyObj.h:22
 AliSurveyObj.h:23
 AliSurveyObj.h:24
 AliSurveyObj.h:25
 AliSurveyObj.h:26
 AliSurveyObj.h:27
 AliSurveyObj.h:28
 AliSurveyObj.h:29
 AliSurveyObj.h:30
 AliSurveyObj.h:31
 AliSurveyObj.h:32
 AliSurveyObj.h:33
 AliSurveyObj.h:34
 AliSurveyObj.h:35
 AliSurveyObj.h:36
 AliSurveyObj.h:37
 AliSurveyObj.h:38
 AliSurveyObj.h:39
 AliSurveyObj.h:40
 AliSurveyObj.h:41
 AliSurveyObj.h:42
 AliSurveyObj.h:43
 AliSurveyObj.h:44
 AliSurveyObj.h:45
 AliSurveyObj.h:46
 AliSurveyObj.h:47
 AliSurveyObj.h:48
 AliSurveyObj.h:49
 AliSurveyObj.h:50
 AliSurveyObj.h:51
 AliSurveyObj.h:52
 AliSurveyObj.h:53
 AliSurveyObj.h:54
 AliSurveyObj.h:55
 AliSurveyObj.h:56
 AliSurveyObj.h:57
 AliSurveyObj.h:58
 AliSurveyObj.h:59
 AliSurveyObj.h:60
 AliSurveyObj.h:61
 AliSurveyObj.h:62
 AliSurveyObj.h:63
 AliSurveyObj.h:64
 AliSurveyObj.h:65
 AliSurveyObj.h:66
 AliSurveyObj.h:67
 AliSurveyObj.h:68
 AliSurveyObj.h:69
 AliSurveyObj.h:70
 AliSurveyObj.h:71
 AliSurveyObj.h:72
 AliSurveyObj.h:73
 AliSurveyObj.h:74
 AliSurveyObj.h:75
 AliSurveyObj.h:76
 AliSurveyObj.h:77
 AliSurveyObj.h:78
 AliSurveyObj.h:79
 AliSurveyObj.h:80
 AliSurveyObj.h:81
 AliSurveyObj.h:82
 AliSurveyObj.h:83
 AliSurveyObj.h:84
 AliSurveyObj.h:85
 AliSurveyObj.h:86
 AliSurveyObj.h:87
 AliSurveyObj.h:88
 AliSurveyObj.h:89
 AliSurveyObj.h:90
 AliSurveyObj.h:91
 AliSurveyObj.h:92
 AliSurveyObj.h:93
 AliSurveyObj.h:94
 AliSurveyObj.h:95
 AliSurveyObj.h:96
 AliSurveyObj.h:97
 AliSurveyObj.h:98
 AliSurveyObj.h:99
 AliSurveyObj.h:100
 AliSurveyObj.h:101
 AliSurveyObj.h:102
 AliSurveyObj.h:103
 AliSurveyObj.h:104
 AliSurveyObj.h:105
 AliSurveyObj.h:106
 AliSurveyObj.h:107
 AliSurveyObj.h:108
 AliSurveyObj.h:109
 AliSurveyObj.h:110
 AliSurveyObj.h:111
 AliSurveyObj.h:112
 AliSurveyObj.h:113
 AliSurveyObj.h:114
 AliSurveyObj.h:115