Changed cuts (Ana)
[u/mrichter/AliRoot.git] / ITS / AliITSAlignMille2Module.h
3/* Copyright(c) 2007-2009 , ALICE Experiment at CERN, All rights reserved. * \r
4 * See cxx source for full Copyright notice */ \r
5 \r
6/// \ingroup rec \r
7/// \class AliITSAlignMille2Module\r
8/// \brief Class for alignment of ITS \r
9// \r
10// Authors: Marcello Lunardon \r
12// RS Converted static arrays fSensVolVolumeID and fSensVolIndex\r
13// to TArrays in user transparent way.\r
15/* $Id$ */ \r
16//#include <TString.h> \r
17//#include <TObject.h> \r
18#include <TNamed.h> \r
19#include <TArrayI.h> \r
20#include <TArrayS.h> \r
6526a72c 21#include <TObjArray.h> \r
7b85e477 22class AliITSAlignMille2;\r
24class AliAlignObjParams; \r
25class TGeoHMatrix; \r
27class AliITSAlignMille2Module : public TNamed \r
28{ \r
29public: \r
6526a72c 30 enum {kSPD,kSDD,kSSD};\r
8fd71c0a 31 enum {kMaxParGeom=6,kMaxParTot=8,kSensDefBit=BIT(14),kGlobalGeomBit=BIT(15),kNotInConfBit=BIT(16)};\r
33 //\r
7b85e477 34 AliITSAlignMille2Module(); \r
35 AliITSAlignMille2Module(UShort_t volid);\r
6be22b3f 36 AliITSAlignMille2Module(Int_t index, UShort_t volid, const char* symname, const TGeoHMatrix *m, Int_t nsv=0, const UShort_t *volidsv=NULL);\r
7b85e477 37 AliITSAlignMille2Module(const AliITSAlignMille2Module& rhs); // copy constructor\r
38 AliITSAlignMille2Module& operator=(const AliITSAlignMille2Module& rhs); \r
39 //\r
40 virtual ~AliITSAlignMille2Module(); \r
41 //\r
42 // geometry methods \r
43 Int_t GetIndex() const {return fIndex;} \r
44 UShort_t GetVolumeID() const {return fVolumeID;} \r
45 Int_t GetNSensitiveVolumes() const {return fNSensVol;} \r
46 Int_t GetSensVolIndex(Int_t at) const {return fSensVolIndex[at];}\r
47 Short_t GetSensVolVolumeID(Int_t at) const {return fSensVolVolumeID[at];}\r
48 TGeoHMatrix *GetMatrix() const {return fMatrix;}\r
49 void GetLocalMatrix(TGeoHMatrix& mat) const;\r
50 UShort_t *GetSensitiveVolumeVolumeID() const {return (UShort_t*)fSensVolVolumeID.GetArray();}\r
51 Float_t GetSigmaFactor(Int_t i) const {return fSigmaFactor[i];}\r
52 Float_t GetSigmaXFactor() const {return fSigmaFactor[0];}\r
53 Float_t GetSigmaYFactor() const {return fSigmaFactor[1];}\r
54 Float_t GetSigmaZFactor() const {return fSigmaFactor[2];}\r
55 Int_t GetNProcessedPoints() const {return fNProcPoints;}\r
6526a72c 56 Bool_t IsFreeDOF(Int_t dof) const {return fParCstr[dof]>0;}\r
8fd71c0a 57 Bool_t AreSensorsProvided() const {return TestBit(kSensDefBit);}\r
58 Bool_t GeomParamsGlobal() const {return TestBit(kGlobalGeomBit);}\r
59 Bool_t IsNotInConf() const {return TestBit(kNotInConfBit);}\r
7b85e477 60 Bool_t IsIn(UShort_t volid) const;\r
61 Bool_t IsAlignable() const;\r
62 Bool_t BelongsTo(AliITSAlignMille2Module* parent) const;\r
63 AliITSAlignMille2Module* GetParent() const {return fParent;}\r
6526a72c 64 AliITSAlignMille2Module* GetChild(Int_t i) const {return (AliITSAlignMille2Module*)fChildren[i];}\r
65 Int_t GetNChildren() const {return fChildren.GetLast()+1;}\r
66 //\r
7b85e477 67 void Print(Option_t* opt="") const; \r
68 //\r
6526a72c 69 void EvaluateDOF();\r
70 UShort_t GetNParTot() const {return fNParTot;}\r
71 UShort_t GetNParFree() const {return fNParFree;}\r
72 Float_t *GetParVals() const {return fParVals;}\r
73 Double_t GetParVal(int par) const {return fParVals[par];}\r
74 Double_t GetParErr(int par) const {return fParErrs[par];}\r
75 Double_t GetParConstraint(int par) const {return fParCstr[par];}\r
76 Int_t GetParOffset(Int_t par) const {return fParOffs[par];}\r
77 Int_t GetDetType() const {return fDetType;}\r
78 Bool_t IsParConstrained(Int_t par) const {return fParCstr[par]>0 && fParCstr[par]<fgkDummyConstraint;}\r
79 Bool_t IsSPD() const {return fDetType == kSPD;}\r
80 Bool_t IsSDD() const {return fDetType == kSDD;}\r
81 Bool_t IsSSD() const {return fDetType == kSSD;}\r
82 Bool_t IsSensor() const {return IsSensor(fVolumeID);}\r
83 void SetDetType(Int_t tp) {fDetType = tp;}\r
84 void SetParOffset(Int_t par,Int_t offs) {fParOffs[par] = offs;}\r
85 //\r
86 void SetParVals(Double_t *vl,Int_t npar); \r
87 void SetParVal(Int_t par,Double_t v=0) {fParVals[par] = v;}\r
88 void SetParErr(Int_t par,Double_t e=0) {fParErrs[par] = e;}\r
89 void SetParConstraint(Int_t par,Double_t s=1e6) {fParCstr[par] = s>0. ? s:0.0;}\r
abd7ef79 90 void SetSigmaFactor(Int_t i,Float_t v) {fSigmaFactor[i]=TMath::Max(0.001F,v);}\r
91 void SetSigmaXFactor(Float_t v) {SetSigmaFactor(0,v);}\r
92 void SetSigmaYFactor(Float_t v) {SetSigmaFactor(1,v);}\r
93 void SetSigmaZFactor(Float_t v) {SetSigmaFactor(2,v);}\r
7b85e477 94 void IncNProcessedPoints(Int_t step=1) {fNProcPoints += step;}\r
95 void SetNProcessedPoints(Int_t v) {fNProcPoints = v;}\r
96 void SetParent(AliITSAlignMille2Module* par) {fParent = par;}\r
6526a72c 97 void AddChild(AliITSAlignMille2Module* cld) {fChildren.Add(cld);}\r
98 void SetFreeDOF(Int_t dof,Double_t cstr);\r
8fd71c0a 99 void SetSensorsProvided(Bool_t v=kTRUE) {SetBit(kSensDefBit,v);}\r
100 void SetGeomParamsGlobal(Bool_t v=kTRUE) {SetBit(kGlobalGeomBit,v);}\r
101 void SetNotInConf(Bool_t v=kTRUE) {SetBit(kNotInConfBit,v);}\r
6be22b3f 102 Int_t Set(Int_t index,UShort_t volid, const char* symname, const TGeoHMatrix *m,Int_t nsv=0, const UShort_t *volidsv=0);\r
7b85e477 103 //\r
104 void AddSensitiveVolume(UShort_t volid);\r
105 void DelSensitiveVolume(Int_t at);\r
6526a72c 106 void DelSensitiveVolumes() {fNSensVol = 0;}\r
107 //\r
108 void GetGeomParamsGlo(Double_t *pars);\r
109 void GetGeomParamsLoc(Double_t *pars);\r
7b85e477 110 //\r
111 TGeoHMatrix *GetSensitiveVolumeMatrix(UShort_t voluid);\r
112 TGeoHMatrix *GetSensitiveVolumeOrigGlobalMatrix(UShort_t voluid);\r
113 TGeoHMatrix *GetSensitiveVolumeModifiedMatrix(UShort_t voluid, Double_t *delta,Bool_t local=kTRUE); \r
114 AliAlignObjParams *GetSensitiveVolumeMisalignment(UShort_t voluid, AliAlignObjParams *a); \r
115 AliAlignObjParams *GetSensitiveVolumeMisalignment(UShort_t voluid, Double_t *deltalocal); \r
116 //\r
6526a72c 117 void GetGlobalParams(Double_t *t, Double_t *r);\r
118 void GetGlobalParams(const Double_t *loct, const Double_t *locr,Double_t *t, Double_t *r);\r
119 void GetLocalParams(const Double_t *loct, const Double_t *locr,Double_t *t, Double_t *r);\r
120 //\r
121 void GetSensVolGlobalParams(UShort_t volid,Double_t *t, Double_t *r);\r
122 void GetSensVolLocalParams(UShort_t volid,Double_t *t, Double_t *r);\r
123 void GetSensVolGlobalParams(UShort_t volid,Double_t* loct,Double_t* locr,Double_t *t, Double_t *r);\r
124 void GetSensVolLocalParams(UShort_t volid,Double_t* loct,Double_t* locr,Double_t *t, Double_t *r);\r
125 //\r
126 void CalcDerivLocGlo(Double_t *deriv);\r
127 void CalcDerivGloLoc(Int_t idx,Double_t *deriv);\r
128 void CalcDerivGloLoc(Int_t sensVol,Int_t paridx,Double_t* derivative);\r
129 void CalcDerivCurLoc(Int_t sensVol,Int_t paridx,Double_t* derivative);\r
6be22b3f 130 void CalcDerivDPosDPar(Int_t sensVol,const Double_t *pl,Double_t *deriv);\r
6526a72c 131 //\r
7b85e477 132 // forse non serve...\r
133 AliAlignObjParams *GetSensitiveVolumeGlobalMisalignment(UShort_t voluid, Double_t *deltalocal); \r
134 // mo' proviamo questo\r
135 AliAlignObjParams *GetSensitiveVolumeTotalMisalignment(UShort_t voluid, Double_t *deltalocal); \r
136 //\r
6526a72c 137 static Int_t GetIndexFromVolumeID(UShort_t volid);\r
7b85e477 138 static UShort_t GetVolumeIDFromSymname(const Char_t *symname);\r
139 static UShort_t GetVolumeIDFromIndex(Int_t index);\r
6526a72c 140 static Bool_t IsSensor(UShort_t vid);\r
abd7ef79 141 static Int_t SensVolMatrix(UShort_t volid, TGeoHMatrix *m); \r
142 static Int_t SensVolOrigGlobalMatrix(UShort_t volid, TGeoHMatrix *m); \r
7b85e477 144 //\r
146 //\r
6526a72c 147 void AssignDetType();\r
7b85e477 148 //\r
150 //\r
151 Int_t fNSensVol; // number of sensor it refers to\r
152 Int_t fIndex; // aliroot index\r
6526a72c 153 Int_t fDetType; // Detector type\r
7b85e477 154 UShort_t fVolumeID; // aliroot volune ID\r
6526a72c 155 UShort_t fNParTot; // total number of parameters\r
156 UShort_t fNParFree; // number of free parameters\r
157 TArrayS fParOffs; // offsets of free params in the fit results\r
7b85e477 158 Int_t fNProcPoints; // number of processed points\r
159 Float_t fSigmaFactor[3]; // multiplicative factor for referred sensor X,Y,Z error\r
6526a72c 160 Float_t *fParVals; // values of the fitted params\r
161 Float_t *fParErrs; // errors of the fitted params\r
162 Float_t *fParCstr; // Gaussian type constraint on parameter, 0 means fixed param\r
7b85e477 163 //\r
164 TArrayI fSensVolIndex; // aliroot indices for sensors\r
165 TArrayS fSensVolVolumeID; // aliroot indices for sensors volumes\r
166 TGeoHMatrix *fMatrix; // ideal TGeoHMatrix of the supermodule\r
167 TGeoHMatrix *fSensVolMatrix; // sensor's ideal matrices\r
168 TGeoHMatrix *fSensVolModifMatrix; // sensor's modified matrices\r
169 //\r
170 AliITSAlignMille2Module* fParent; // optional parent pointer\r
6526a72c 171 TObjArray fChildren; // array of optional children\r
7b85e477 172 //\r
6526a72c 173 static AliAlignObjParams fgTempAlignObj; // temp.alignment object used as a buffer \r
174 static const Float_t fgkDummyConstraint; // dummy (lose) contraint on parameter\r
7b85e477 175 //\r
176 ClassDef(AliITSAlignMille2Module, 0)\r
177}; \r
179#endif \r