]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSurveyObj.h
- Update and add new ESD QA histograms
[u/mrichter/AliRoot.git] / MUON / AliMUONSurveyObj.h
CommitLineData
ba8b0266 1#ifndef ALIMUONSURVEYOBJ_H
2#define ALIMUONSURVEYOBJ_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/// \ingroup geometry
7/// \class AliMUONSurveyObj
8/// \brief Base class for survey of muon spectrometer
9//
10// Author: Javier Castillo
11
12#include <TObject.h>
13
14class TObjArray;
15class TGeoCombiTrans;
16class TVector3;
17class TH2;
18class TF2;
19class TFitter;
20class TArrayD;
21
22class AliSurveyPoint;
23
24class AliMUONSurveyObj:public TObject
25{
26
27 public:
28 AliMUONSurveyObj();
29 virtual ~AliMUONSurveyObj();
30
31 virtual Int_t AddStickerTargets(TObjArray *pArray, TString stBaseName, Int_t lTargetMax = 9);
32 virtual Int_t AddGButtonTargets(TObjArray *pArray, TString btBaseName, Int_t lTargetMax = 9);
33 virtual Int_t AddLButtonTargets(TObjArray *pArray, TString btBaseName, Int_t lTargetMax = 9);
34
35 virtual Int_t AddStickerTargets(TString stBaseName, Int_t lTargetMax = 9) = 0;
36 virtual Int_t AddGButtonTargets(TString btBaseName, Int_t lTargetMax = 9) = 0;
37
38 void AddStickerTarget(AliSurveyPoint *stPoint);
39 void AddGButtonTarget(AliSurveyPoint *btPoint);
40 void AddLButtonTarget(AliSurveyPoint *btPoint);
41 void AddLButtonTarget(TVector3 *btVector);
42
43 Int_t GetNStickerTargets();
44 AliSurveyPoint *GetStickerTarget(Int_t stIndex);
45 Int_t GetNGButtonTargets();
46 AliSurveyPoint *GetGButtonTarget(Int_t btIndex);
47 Int_t GetNLButtonTargets();
48 AliSurveyPoint *GetLButtonTarget(Int_t btIndex);
49 /// Set transformation of geoemtrical element
50 void SetBaseTransformation(TGeoCombiTrans *baseTrf, Bool_t ownerBaseTrf = kFALSE) {
51 fBaseTrf = baseTrf;
52 fOwnerBaseTrf=ownerBaseTrf;
53 }
54 /// Set local transformation of geometrical element
55 virtual void SetLocalTransformation(TGeoCombiTrans *localTrf, Bool_t ownerLocalTrf = kFALSE) {
56 fLocalTrf=localTrf;
57 fOwnerLocalTrf=ownerLocalTrf;
58 }
59
f7d36813 60 TGeoCombiTrans* GetLocalTrf() const {return fLocalTrf;}
61 TGeoCombiTrans* GetBaseTrf() const {return fBaseTrf;}
62 TGeoCombiTrans* GetAlignTrf()const {return fAlignTrf;}
63
64 void SetUseCM(Bool_t bUseCM = kTRUE) {fUseCM = bUseCM;}
65 Bool_t GetUseCM() const {return fUseCM;}
ba8b0266 66
67 void SetPlane(TString pName, Double_t xMin=-2000., Double_t xMax=+2000., Double_t yMin=-2000., Double_t yMax=2000.);
68 void SetPlaneParameters(Double_t p0, Double_t p1, Double_t p2);
69
70 void DrawSTargets();
71 Double_t FitPlane();
72
f7d36813 73 TF2* GetPlane() const {return fPlane;}
ba8b0266 74
f7d36813 75 TFitter* GetFitter() const {return fFitter;}
ba8b0266 76
77 Int_t SurveyToAlign(TGeoCombiTrans &quadTransf, Double_t *parErr, Double_t psi=0., Double_t tht=0., Double_t epsi=0., Double_t etht=0.);
78 Int_t SurveyToAlign(Double_t psi=0., Double_t tht=0., Double_t epsi=0., Double_t etht=0.);
79 Double_t SurveyChi2(Double_t *par);
80
f7d36813 81 Double_t EvalFunction(const TF2 *lFunction, Int_t iP1, Int_t iP2, const Char_t *lCoord);
ba8b0266 82
83 void CalculateTranslation(TF2 *xFunc, TF2 *yFunc, TF2 *zFunc, Int_t iP1, Int_t iP2, Double_t *lCenTemp);
84 // TGeoCombiTrans *CalculateTransformation(TF2 *xFunc, TF2 *yFunc, TF2 *zFunc, TF2 *pFunc, Int_t iP1, Int_t iP2);
85
86 Double_t CalculateGlobalDiff(TGeoCombiTrans &lTransf, Int_t nPoints, TArrayD &lDiff);
87
88 Int_t CalculateBestTransf(Int_t iP1, Int_t iP2, Double_t *lXYZ, Double_t *lPTP);
89
90 void CalculateMeanTransf(Double_t *lXYZ, Double_t *lPTP);
91
92 void SetXMin(Double_t xMin) {fXMin = xMin;}
93 void SetXMax(Double_t xMax) {fXMax = xMax;}
94 void SetYMin(Double_t yMin) {fYMin = yMin;}
95 void SetYMax(Double_t yMax) {fYMax = yMax;}
96 void SetZMin(Double_t zMin) {fZMin = zMin;}
97 void SetZMax(Double_t zMax) {fZMax = zMax;}
98
99 virtual void PrintLocalTrf();
100 virtual void PrintAlignTrf();
101
102 void FillSTHistograms(TString baseNameC, TH2 *hSTc, TString baseNameA="", TH2 *hSTa = 0);
103
104 Double_t GetAlignResX();
105 Double_t GetAlignResY();
106
f7d36813 107 AliSurveyPoint* ConvertPointUnits(AliSurveyPoint *stPoint, Float_t lFactor = 0.1);
108
ba8b0266 109 private:
110 /// Not implemented
111 AliMUONSurveyObj(const AliMUONSurveyObj& right);
112 /// Not implemented
113 AliMUONSurveyObj& operator = (const AliMUONSurveyObj& right);
114
f7d36813 115 Double_t EqPlane(const Double_t *x, const Double_t *par) const {
ba8b0266 116 return (-par[1]*x[0] +par[0]*x[1] -par[2]); // then psi=ATan(par[0]) and tht=ATan(par[0])
117 // return (-par[0]*x[0] -par[1]*x[1] -par[2]);
118 }
119
120 TObjArray *fSTargets; ///< Array of AliSurveyPoint of Sticker Targets
121 TObjArray *fGBTargets; ///< Array of AliSurveyPoint of Button Targets
122 TObjArray *fLBTargets; ///< Array of TVector3 or AliSurveyPoint of local position of Button Targets
123 TGeoCombiTrans *fLocalTrf; ///< Local transformation
124 TGeoCombiTrans *fAlignTrf; ///< Local alignment transformation
125 TGeoCombiTrans *fBaseTrf; ///< Base Transformation
126
127 Bool_t fOwnerLocalTrf; ///< Flag for owner of fLocalTrf
128 Bool_t fOwnerAlignTrf; ///< Flag for owner of fAlignTrf
129 Bool_t fOwnerBaseTrf; ///< Flag for owner of fBaseTrf
130
f7d36813 131 Bool_t fUseCM; ///< Use centimeters, survey units are mm but aliroot uses cm
132
ba8b0266 133 TF2 *fPlane; ///< TF2 for plane fitting
134
135 TFitter *fFitter; ///< Fitter for best local to global transformation
136
137 Double_t fXMin;
138 Double_t fXMax;
139 Double_t fYMin;
140 Double_t fYMax;
141 Double_t fZMin;
142 Double_t fZMax;
143
144
145ClassDef(AliMUONSurveyObj, 0) //Class for alignment of muon spectrometer
146};
147
148#endif