ROOT logo
#ifndef ALITOFALIGNMENT_H
#define ALITOFALIGNMENT_H

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

//////////////////////////////////////////////////////////////////
//  class for TOF Alignment::                                   //
//////////////////////////////////////////////////////////////////
//#include <TObject.h>
//#include <TString.h>
#include "TTask.h"
//#include "TGeoManager.h"
//#include "TGeoVolume.h"
//#include "TGeoBBox.h"
//#include "TGeoTrd1.h"
//#include "TGeoPhysicalNode.h"
//#include "TGeoNode.h"
//#include "TGeoMatrix.h"

class TGeoManager;
class TObjArray;
class TString;
class TGeoMatrix;

class AliTOFAlignment :public TTask{

  enum {kMaxAlignObj=2000}; //maximal number of the TOF Alignable Objects

 public:

  AliTOFAlignment(); 
  AliTOFAlignment(const AliTOFAlignment &t); //Copy Ctor 
  AliTOFAlignment& operator=(const AliTOFAlignment &source); // Assignment Operator
  virtual ~AliTOFAlignment();
  virtual void WriteParOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
  virtual void ReadParFromCDB(const Char_t *sel, Int_t nrun);
  virtual void WriteSimParOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
  virtual void ReadSimParFromCDB(const Char_t *sel, Int_t nrun);
  virtual void Smear(Float_t * const tr=0, Float_t * const rot=0); // create a set of AlignObj for TOF
  virtual void Align(Float_t * const tr=0, Float_t * const rot=0); // create a set of AlignObj for TOF
  TObjArray * GetTOFAlignArray() const {return fTOFAlignObjArray;}

  //methods for survey
  virtual void WriteOnCDBforDC();
  virtual void ReadFromCDBforDC();
  virtual void BuildGeomForSurvey();      //Build ideal geometry (FTOA in BTOF)
  virtual void InsertMisAlignment(Float_t * const mis); //To test align. from Survey
  virtual void MakeDefData(const Int_t nf,TString namefiles[]); //Combines survey data from different files
  virtual void WriteCombData(const Char_t *nomefile, Int_t option); //Write combined data on a file 
  virtual void ReadSurveyDataAndAlign(); //Read survey data and call the right Alignement procedure  
  virtual void WriteSimSurveyData(const Char_t *nomefile); // Write sim data in standard format

private:
  
  static const Double_t fgkRorigTOF;  //Radius of the TOF ext. volume, cm
  static const Double_t fgkX1BTOF;    //x1 size of BTOF
  static const Double_t fgkX2BTOF;    //x2 size of BTOF
  static const Double_t fgkYBTOF;     //y size of BTOF
  static const Double_t fgkZBTOF;     //z size of BTOF
  
  // Four fiducial marks on SM, expressed in local coordinates (origin=center of TOF SM)
  // They are positioned at x=+/- 38 cm, y=+/- 457.3 cm, z=11.2 cm

  static const Double_t fgkXFM; //x pos of FM in BTOF, cm 
  static const Double_t fgkYFM; //y pos of FM in BTOF, cm
  static const Double_t fgkZFM; //z pos of FM in BTOF, cm
  
  Int_t fNTOFAlignObj;           //Number of Alignable Objects
  TGeoManager *fTOFmgr;          //Pointer to TGeoManager
  TObjArray *fTOFAlignObjArray;  //Pointer to the TOF alignable objects
  TGeoHMatrix* fTOFMatrixId[18]; //Ideal Matrices of TOF Volumes in the GRS
  Float_t fCombFMData[72][6];    //Combined survey data
  Int_t fNFMforSM[18][5];        //Number of FM for each SM

  void AlignFromSurveyABC(Int_t iSM);  //From Survey data of FM ABC, derive the needed transformations to get the Alignment Objects. 
  void AlignFromSurveyABD(Int_t iSM);  //From Survey data of FM ABD, derive the needed transformations to get the Alignment Objects. 
  void AlignFromSurveyACD(Int_t iSM);  //From Survey data of FM ACD, derive the needed transformations to get the Alignment Objects. 
  void AlignFromSurveyBCD(Int_t iSM);  //From Survey data of FM BCD, derive the needed transformations to get the Alignment Objects. 

  ClassDef(AliTOFAlignment,2)   // TOF Alignment 
};

#endif
 AliTOFAlignment.h:1
 AliTOFAlignment.h:2
 AliTOFAlignment.h:3
 AliTOFAlignment.h:4
 AliTOFAlignment.h:5
 AliTOFAlignment.h:6
 AliTOFAlignment.h:7
 AliTOFAlignment.h:8
 AliTOFAlignment.h:9
 AliTOFAlignment.h:10
 AliTOFAlignment.h:11
 AliTOFAlignment.h:12
 AliTOFAlignment.h:13
 AliTOFAlignment.h:14
 AliTOFAlignment.h:15
 AliTOFAlignment.h:16
 AliTOFAlignment.h:17
 AliTOFAlignment.h:18
 AliTOFAlignment.h:19
 AliTOFAlignment.h:20
 AliTOFAlignment.h:21
 AliTOFAlignment.h:22
 AliTOFAlignment.h:23
 AliTOFAlignment.h:24
 AliTOFAlignment.h:25
 AliTOFAlignment.h:26
 AliTOFAlignment.h:27
 AliTOFAlignment.h:28
 AliTOFAlignment.h:29
 AliTOFAlignment.h:30
 AliTOFAlignment.h:31
 AliTOFAlignment.h:32
 AliTOFAlignment.h:33
 AliTOFAlignment.h:34
 AliTOFAlignment.h:35
 AliTOFAlignment.h:36
 AliTOFAlignment.h:37
 AliTOFAlignment.h:38
 AliTOFAlignment.h:39
 AliTOFAlignment.h:40
 AliTOFAlignment.h:41
 AliTOFAlignment.h:42
 AliTOFAlignment.h:43
 AliTOFAlignment.h:44
 AliTOFAlignment.h:45
 AliTOFAlignment.h:46
 AliTOFAlignment.h:47
 AliTOFAlignment.h:48
 AliTOFAlignment.h:49
 AliTOFAlignment.h:50
 AliTOFAlignment.h:51
 AliTOFAlignment.h:52
 AliTOFAlignment.h:53
 AliTOFAlignment.h:54
 AliTOFAlignment.h:55
 AliTOFAlignment.h:56
 AliTOFAlignment.h:57
 AliTOFAlignment.h:58
 AliTOFAlignment.h:59
 AliTOFAlignment.h:60
 AliTOFAlignment.h:61
 AliTOFAlignment.h:62
 AliTOFAlignment.h:63
 AliTOFAlignment.h:64
 AliTOFAlignment.h:65
 AliTOFAlignment.h:66
 AliTOFAlignment.h:67
 AliTOFAlignment.h:68
 AliTOFAlignment.h:69
 AliTOFAlignment.h:70
 AliTOFAlignment.h:71
 AliTOFAlignment.h:72
 AliTOFAlignment.h:73
 AliTOFAlignment.h:74
 AliTOFAlignment.h:75
 AliTOFAlignment.h:76
 AliTOFAlignment.h:77
 AliTOFAlignment.h:78
 AliTOFAlignment.h:79
 AliTOFAlignment.h:80
 AliTOFAlignment.h:81
 AliTOFAlignment.h:82
 AliTOFAlignment.h:83
 AliTOFAlignment.h:84