]>
Commit | Line | Data |
---|---|---|
6526a72c | 1 | #include "AliITSAlignMille2ConstrArray.h" |
2 | #include "AliITSAlignMille2Module.h" | |
3 | ||
4 | //======================================================================================================== | |
5 | ClassImp(AliITSAlignMille2ConstrArray) | |
6 | ||
7 | //________________________________________________________________________________________________________ | |
8 | AliITSAlignMille2ConstrArray::AliITSAlignMille2ConstrArray() : | |
9 | AliITSAlignMille2Constraint(), | |
10 | fModuleIDs(0), | |
11 | fModulePatt(0), | |
12 | fCoeffs(0), | |
13 | fError(0) | |
14 | {} | |
15 | ||
16 | //________________________________________________________________________________________________________ | |
17 | AliITSAlignMille2ConstrArray::AliITSAlignMille2ConstrArray(const Char_t* name,Double_t *parcf,Int_t npar,Double_t val,Double_t err) : | |
18 | AliITSAlignMille2Constraint(name,kTypeGaussian,-100,val,0), | |
19 | fModuleIDs(0), | |
20 | fModulePatt(0), | |
21 | fCoeffs(npar), | |
22 | fError(err) | |
23 | { | |
24 | for (int i=0;i<npar;i++) {fCoeffs[i] = parcf[i]; if (parcf[i]!=0) SetBit(0x1<<i);} | |
25 | } | |
26 | ||
27 | //________________________________________________________________________________________________________ | |
28 | AliITSAlignMille2ConstrArray::AliITSAlignMille2ConstrArray(const AliITSAlignMille2ConstrArray& src) : | |
29 | AliITSAlignMille2Constraint(src), | |
30 | fModuleIDs(0), | |
31 | fModulePatt(0), | |
32 | fCoeffs(0), | |
33 | fError(0) | |
34 | {/* DUMMY */} | |
35 | ||
36 | //________________________________________________________________________________________________________ | |
ef24eb3b | 37 | void AliITSAlignMille2ConstrArray::AddModule(AliITSAlignMille2Module* mod, Bool_t needGeom) |
6526a72c | 38 | { |
39 | int nmd = GetNModules(); | |
40 | // check if its already not there | |
41 | for (int im=nmd;im--;) {if (mod->GetUniqueID() == (UInt_t)fModuleIDs[im]) return; } | |
42 | fModuleIDs.Set(nmd+1); | |
43 | fModulePatt.Set(nmd+1); | |
44 | fModuleIDs[nmd] = mod->GetUniqueID(); | |
ef24eb3b | 45 | if (needGeom) { // this is geometrical constraint |
46 | double jacobian[AliITSAlignMille2Module::kMaxParGeom][AliITSAlignMille2Module::kMaxParGeom]; | |
47 | if (mod->GeomParamsGlobal()) mod->CalcDerivLocGlo(&jacobian[0][0]); | |
48 | // | |
49 | Short_t patt = GetPattern(); | |
50 | if (mod->GeomParamsGlobal()) { | |
51 | // the constraint is defined in the module's local frame. If the alignment of geom params is | |
52 | // done in the global frame, we need to set the real parameter involved | |
53 | patt &= 0xffff<< AliITSAlignMille2Module::kMaxParGeom; // reset the geometry parameters | |
54 | for (int i=0;i<AliITSAlignMille2Module::kMaxParGeom;i++) { | |
55 | if (!IncludesParam(i)) continue; | |
56 | for (int j=0;j<AliITSAlignMille2Module::kMaxParGeom;j++) if (jacobian[i][j]!=0) patt |= (0x1<<j); | |
57 | } | |
6526a72c | 58 | } |
ef24eb3b | 59 | fModulePatt[nmd] = patt; |
6526a72c | 60 | } |
6526a72c | 61 | } |
62 | ||
63 | //________________________________________________________________________________________________________ | |
64 | Bool_t AliITSAlignMille2ConstrArray::IncludesModule(Int_t id) const | |
65 | { | |
66 | // is this module mentioned in the list? | |
67 | int nmd = GetNModules(); | |
68 | for (int i=nmd;i--;) if (fModuleIDs[i]==id) return kTRUE; | |
69 | return kFALSE; | |
70 | } | |
71 | ||
72 | //________________________________________________________________________________________________________ | |
73 | Bool_t AliITSAlignMille2ConstrArray::IncludesModPar(Int_t id,Int_t par) const | |
74 | { | |
75 | // is this module/parameter mentioned in the list? | |
76 | int nmd = GetNModules(); | |
77 | for (int i=nmd;i--;) { | |
78 | if (fModuleIDs[i]!=id) continue; | |
79 | if (fModulePatt[i] & (0x1<<par)) return kTRUE; | |
80 | } | |
81 | return kFALSE; | |
82 | } | |
83 | ||
84 | //________________________________________________________________________________________________________ | |
45993b23 | 85 | Bool_t AliITSAlignMille2ConstrArray::IncludesModPar(const AliITSAlignMille2Module* mod, Int_t par) const |
6526a72c | 86 | { |
87 | // is this module/parameter mentioned in the list? | |
88 | return IncludesModPar(mod->GetUniqueID(), par); | |
89 | } | |
90 | ||
91 | ||
92 | //________________________________________________________________________________________________________ | |
93 | void AliITSAlignMille2ConstrArray::Print(Option_t* ) const | |
94 | { | |
95 | printf("#%3d Constraint %s of type %d | Value=%+e Error=%+e\n",GetConstraintID(),GetName(),GetType(),GetValue(),GetError()); | |
96 | printf("Weights on params: "); for (int i=0;i<GetNCoeffs();i++) printf("%+.3e ",GetCoeff(i)); | |
97 | printf("\nModules involved: \n"); | |
98 | int nmd = GetNModules(); | |
99 | for (int i=0;i<nmd;i++) {printf("%4d |",GetModuleID(i)); if ( ((i+1)%14)==0 ) printf("\n");} | |
100 | if ( nmd%14 ) printf("\n"); | |
101 | // | |
102 | } | |
103 |