ROOT logo
#ifndef ALIITSONLINESPDFO_H
#define ALIITSONLINESPDFO_H  
/* Copyright(c) 2008-2010, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */
////////////////////////////////////////////////////////////////
// Author: A. Mastroserio                                     // 
// This class is used within the detector algorithm framework //
// to write and read FO scan data.                            //
////////////////////////////////////////////////////////////////

#include <TString.h>
#include <THashList.h>

class TFile;
class TArrayS;
class AliITSOnlineSPDfoInfo;

class AliITSOnlineSPDfo {

 public:
  AliITSOnlineSPDfo();//ctor
  AliITSOnlineSPDfo(TString inputfile, Int_t runNr, Int_t eqId); 
  AliITSOnlineSPDfo(const AliITSOnlineSPDfo &c);
  
  virtual ~AliITSOnlineSPDfo(){ delete fArray; delete fDACnames;} //dctor
 
  enum {kFOPOL=0, kCONVPOL=1, kCOMPREF=2, kCGPOL =3, kPreVTH=4, kIdFOPOL=20, kIdCONVPOL=17, kIdCOMPREF=16, kIdCGPOL=14, kIdPreVTH=39};
  
  // GENERAL METHODS
  void    AddMeasurement(const TArrayS dac, Short_t measure[3], Int_t hs, Int_t chipId);
  Int_t   CheckDACEntry(const TArrayS dac);
  TString CreateDACEntry(const TArrayS dacs) const;
  TArrayS CreateDACArray(const TArrayS dacs, const TArrayS dacId) const;
  void    CreateOutputFile(); 
  void    WriteToFile();
  
  // SETTER
 void SetNdacs(UInt_t ndacs) {fNdacs=ndacs;}
 void SetFOscanParams(AliITSOnlineSPDfoInfo *info) {fInfo=info;}
 void SetFile(TString inputfile);
 void SetDACArray(TObjArray *obj) {if(!fArray) fArray = obj; else printf("The fArray is alreay available, no need to set it again.\n");}
 
 // GETTER 
  TFile* GetFile()   const           {return fFile;}
  UInt_t GetNdacs()  const           {return fNdacs;}
  
  TObjArray *GetDACArray() const     {return fArray;}
  THashList * GetDACnameList() const {return fDACnames;}
  
  TArrayI GetDACscanParams() const;                               // retrieves per each DAC the range and the step used in the scan 
  AliITSOnlineSPDfoInfo * GetFOscanInfo() const {return fInfo;}
  Int_t *GetDACvalues(TString s, const Int_t ndacs) const;        // translates the string in the corresponding DACS                                                      // the user has to delete the pointer after use!
  Double_t *GetDACvaluesD(TString s, const Int_t ndacs) const;    // translates the string in the corresponding DACS
  

 protected:
 Int_t fRunNr;
 Int_t fNdacs;
 TString fFileName;
 TFile *fFile; 
 AliITSOnlineSPDfoInfo *fInfo;
 THashList *fDACnames;
 TObjArray *fArray;               // array of the 10 chips in the 6 HS per DAC set
 Double_t fCheckIndex;            // check array index (to speed up)
 Int_t fIndex; 
 TString fInitialConfiguration;
  
  private:
  AliITSOnlineSPDfo& operator= (const AliITSOnlineSPDfo& c);
  
    ClassDef(AliITSOnlineSPDfo,1)
  };
    
#endif
 AliITSOnlineSPDfo.h:1
 AliITSOnlineSPDfo.h:2
 AliITSOnlineSPDfo.h:3
 AliITSOnlineSPDfo.h:4
 AliITSOnlineSPDfo.h:5
 AliITSOnlineSPDfo.h:6
 AliITSOnlineSPDfo.h:7
 AliITSOnlineSPDfo.h:8
 AliITSOnlineSPDfo.h:9
 AliITSOnlineSPDfo.h:10
 AliITSOnlineSPDfo.h:11
 AliITSOnlineSPDfo.h:12
 AliITSOnlineSPDfo.h:13
 AliITSOnlineSPDfo.h:14
 AliITSOnlineSPDfo.h:15
 AliITSOnlineSPDfo.h:16
 AliITSOnlineSPDfo.h:17
 AliITSOnlineSPDfo.h:18
 AliITSOnlineSPDfo.h:19
 AliITSOnlineSPDfo.h:20
 AliITSOnlineSPDfo.h:21
 AliITSOnlineSPDfo.h:22
 AliITSOnlineSPDfo.h:23
 AliITSOnlineSPDfo.h:24
 AliITSOnlineSPDfo.h:25
 AliITSOnlineSPDfo.h:26
 AliITSOnlineSPDfo.h:27
 AliITSOnlineSPDfo.h:28
 AliITSOnlineSPDfo.h:29
 AliITSOnlineSPDfo.h:30
 AliITSOnlineSPDfo.h:31
 AliITSOnlineSPDfo.h:32
 AliITSOnlineSPDfo.h:33
 AliITSOnlineSPDfo.h:34
 AliITSOnlineSPDfo.h:35
 AliITSOnlineSPDfo.h:36
 AliITSOnlineSPDfo.h:37
 AliITSOnlineSPDfo.h:38
 AliITSOnlineSPDfo.h:39
 AliITSOnlineSPDfo.h:40
 AliITSOnlineSPDfo.h:41
 AliITSOnlineSPDfo.h:42
 AliITSOnlineSPDfo.h:43
 AliITSOnlineSPDfo.h:44
 AliITSOnlineSPDfo.h:45
 AliITSOnlineSPDfo.h:46
 AliITSOnlineSPDfo.h:47
 AliITSOnlineSPDfo.h:48
 AliITSOnlineSPDfo.h:49
 AliITSOnlineSPDfo.h:50
 AliITSOnlineSPDfo.h:51
 AliITSOnlineSPDfo.h:52
 AliITSOnlineSPDfo.h:53
 AliITSOnlineSPDfo.h:54
 AliITSOnlineSPDfo.h:55
 AliITSOnlineSPDfo.h:56
 AliITSOnlineSPDfo.h:57
 AliITSOnlineSPDfo.h:58
 AliITSOnlineSPDfo.h:59
 AliITSOnlineSPDfo.h:60
 AliITSOnlineSPDfo.h:61
 AliITSOnlineSPDfo.h:62
 AliITSOnlineSPDfo.h:63
 AliITSOnlineSPDfo.h:64
 AliITSOnlineSPDfo.h:65
 AliITSOnlineSPDfo.h:66
 AliITSOnlineSPDfo.h:67
 AliITSOnlineSPDfo.h:68
 AliITSOnlineSPDfo.h:69
 AliITSOnlineSPDfo.h:70
 AliITSOnlineSPDfo.h:71
 AliITSOnlineSPDfo.h:72
 AliITSOnlineSPDfo.h:73
 AliITSOnlineSPDfo.h:74
 AliITSOnlineSPDfo.h:75
 AliITSOnlineSPDfo.h:76