New version of alignment framework.
[u/mrichter/AliRoot.git] / STEER / AliAlignmentTracks.h
1 #ifndef ALIALIGNMENTTRACKS_H
2 #define ALIALIGNMENTTRACKS_H
3
4 //*************************************************************************
5 // AliAlignmentTracks: main steering class which deals with the alignment *
6 // procedures based on reconstructed tracks.                              *
7 // More comments will come with the development of the interfaces and     *
8 // functionalities of the class.                                          *
9 //*************************************************************************
10
11 #include <TObject.h>
12
13 #include "AliAlignObj.h"
14
15 class TChain;
16 class AliTrackPointArray;
17 class AliAlignObj;
18 class AliTrackFitter;
19 class AliTrackResiduals;
20
21 class AliAlignmentTracks : public TObject {
22
23  public:
24
25   AliAlignmentTracks();
26   AliAlignmentTracks(TChain *esdchain);
27   AliAlignmentTracks(const char *esdfilename, const char *esdtreename = "esdTree");
28   AliAlignmentTracks(const AliAlignmentTracks & alignment);
29   AliAlignmentTracks& operator= (const AliAlignmentTracks& alignment);
30   virtual ~AliAlignmentTracks();
31
32   void AddESD(TChain *esdchain);
33   void AddESD(const char *esdfilename, const char *esdtreename = "esdTree");
34
35   void SetPointsFilename(const char *pointsfilename = "AliTrackPoints.root") { fPointsFilename = pointsfilename; }
36
37   void ProcessESD(TSelector *selector);
38   void ProcessESD();
39
40   void BuildIndex();
41 /*   void BuildIndexLayer(AliAlignObj::ELayerID layer); */
42 /*   void BuildIndexVolume(UShort_t volid); */
43
44   Bool_t ReadAlignObjs(const char *alignObjFileName = "AlignObjs.root", const char* arrayName = "Alignment");
45
46   void SetTrackFitter(AliTrackFitter *fitter) { fTrackFitter = fitter; }
47   void SetMinimizer(AliTrackResiduals *minimizer) { fMinimizer = minimizer; }
48
49   void Align(Int_t iterations = 100);
50   void AlignLayer(AliAlignObj::ELayerID layer,
51                   AliAlignObj::ELayerID layerRangeMin = AliAlignObj::kFirstLayer,
52                   AliAlignObj::ELayerID layerRangeMax = AliAlignObj::kLastLayer,
53                   Int_t iterations = 1);
54   void AlignVolume(UShort_t volid, UShort_t volidfit = 0,
55                    AliAlignObj::ELayerID layerRangeMin = AliAlignObj::kFirstLayer,
56                    AliAlignObj::ELayerID layerRangeMax = AliAlignObj::kLastLayer,
57                    Int_t iterations = 1);
58
59  protected:
60
61   void InitIndex();
62   void ResetIndex();
63   void DeleteIndex();
64
65   void InitAlignObjs();
66   void ResetAlignObjs();
67   void DeleteAlignObjs();
68
69   Int_t LoadPoints(UShort_t volid, AliTrackPointArray** &points);
70   void  UnloadPoints(Int_t n, AliTrackPointArray **points);
71
72   AliTrackFitter *CreateFitter();
73   AliTrackResiduals *CreateMinimizer();
74
75   Bool_t Misalign(const char *misalignObjFileName, const char* arrayName);
76
77   TChain           *fESDChain;       //! Chain with ESDs
78   TString           fPointsFilename; //  Name of the file containing the track point arrays
79   TFile            *fPointsFile;     //  File containing the track point arrays
80   TTree            *fPointsTree;     //  Tree with the track point arrays
81   Int_t           **fLastIndex;      //! Last filled index in volume arrays
82   TArrayI        ***fArrayIndex;     //! Volume arrays which contains the tree index
83   Bool_t            fIsIndexBuilt;   //  Is points tree index built
84   AliAlignObj    ***fAlignObjs;      //  Array with alignment objects
85   AliAlignObj    ***fMisalignObjs;   //  Array with alignment objects used to introduce misalignment of the space-points
86   AliTrackFitter   *fTrackFitter;    //  Pointer to the track fitter
87   AliTrackResiduals*fMinimizer;      //  Pointer to track residuals minimizer
88
89   ClassDef(AliAlignmentTracks,1)
90
91 };
92
93 #endif