1 #include "AliITSAlignMille2ConstrArray.h"
2 #include "AliITSAlignMille2Module.h"
4 //========================================================================================================
5 ClassImp(AliITSAlignMille2ConstrArray)
7 //________________________________________________________________________________________________________
8 AliITSAlignMille2ConstrArray::AliITSAlignMille2ConstrArray() :
9 AliITSAlignMille2Constraint(),
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),
24 for (int i=0;i<npar;i++) {fCoeffs[i] = parcf[i]; if (parcf[i]!=0) SetBit(0x1<<i);}
27 //________________________________________________________________________________________________________
28 AliITSAlignMille2ConstrArray::AliITSAlignMille2ConstrArray(const AliITSAlignMille2ConstrArray& src) :
29 AliITSAlignMille2Constraint(src),
36 //________________________________________________________________________________________________________
37 void AliITSAlignMille2ConstrArray::AddModule(AliITSAlignMille2Module* mod, Bool_t needGeom)
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();
45 if (needGeom) { // this is geometrical constraint
46 double jacobian[AliITSAlignMille2Module::kMaxParGeom][AliITSAlignMille2Module::kMaxParGeom];
47 if (mod->GeomParamsGlobal()) mod->CalcDerivLocGlo(&jacobian[0][0]);
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);
59 fModulePatt[nmd] = patt;
63 //________________________________________________________________________________________________________
64 Bool_t AliITSAlignMille2ConstrArray::IncludesModule(Int_t id) const
66 // is this module mentioned in the list?
67 int nmd = GetNModules();
68 for (int i=nmd;i--;) if (fModuleIDs[i]==id) return kTRUE;
72 //________________________________________________________________________________________________________
73 Bool_t AliITSAlignMille2ConstrArray::IncludesModPar(Int_t id,Int_t par) const
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;
84 //________________________________________________________________________________________________________
85 Bool_t AliITSAlignMille2ConstrArray::IncludesModPar(const AliITSAlignMille2Module* mod, Int_t par) const
87 // is this module/parameter mentioned in the list?
88 return IncludesModPar(mod->GetUniqueID(), par);
92 //________________________________________________________________________________________________________
93 void AliITSAlignMille2ConstrArray::Print(Option_t* ) const
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");