1 #ifndef ALIITSALIGNMILLE2CONSTRAINT_H
2 #define ALIITSALIGNMILLE2CONSTRAINT_H
8 class AliITSAlignMille2Module;
10 /*-----------------------------------------------------------------------------------------
11 Simple constraint on the subunits of the module ID (if ID>=0) or all modules w/o
12 parents (ID=-1): the mean or median of the GLOBAL corrections of each parameter requested
13 in the pattern must be = 0. When added explicitly to the fit it requires addition of
14 Lagrange multipliers which may require more powerfull matrix preconditioners. For this
15 reason we usually ommit the constrain from explicit fit and apply it afterwards to obtained
16 parameters (with median constraint this is the only method possible)
18 Author: ruben.shahoyan@cern.ch
19 ------------------------------------------------------------------------------------------*/
20 class AliITSAlignMille2Constraint : public TNamed
23 enum {kTypeMean,kTypeMedian};
24 enum {kDisabledBit=31};
26 AliITSAlignMille2Constraint();
27 AliITSAlignMille2Constraint(const Char_t* name,Int_t t,Int_t mdID,Double_t val=0,UInt_t pattern=0x0ffff);
28 virtual ~AliITSAlignMille2Constraint() {}
30 UInt_t GetConstraintID() const {return GetUniqueID();}
31 Int_t GetType() const {return fType;}
32 Int_t GetModuleID() const {return fModuleID;}
33 Double_t GetValue() const {return fVal;}
34 UInt_t GetPattern() const {return fPattern;}
35 UInt_t GetAppliedPattern() const {return fApplied;}
36 UInt_t GetRemainingPattern() const {return (~fApplied)&GetPattern();}
37 Bool_t IsApplied(Int_t par) const {return fApplied & (0x1<<par);}
38 Bool_t IsApplied() const {return (fApplied&0xffff)==GetPattern();}
39 Bool_t IncludesParam(int id) const {return fPattern&BIT(id);}
40 void Print(Option_t* opt="") const;
42 void SetConstraintID(UInt_t id) {SetUniqueID(id);}
43 void SetType(Int_t t) {fType = t;}
44 void SetPattern(UInt_t pat) {fPattern = pat;}
45 void SetValue(Double_t val) {fVal = val;}
46 void SetApplied(Int_t par) {fApplied |= par<0 ? 0x0ffff : (0x1<<par);}
47 void Disable() {fApplied |= UInt_t(0x1)<<kDisabledBit;}
48 void Enable() {fApplied &= ~(UInt_t(0x1)<<kDisabledBit);}
49 Bool_t IsDisabled() const {return (fApplied>>kDisabledBit)&0x1;}
51 virtual Bool_t IncludesModule(Int_t id) const {return fModuleID==id;}
52 virtual Bool_t IncludesModPar(Int_t id,Int_t par) const {return IncludesModule(id) && IncludesParam(par);}
53 virtual Bool_t IncludesModPar(const AliITSAlignMille2Module* mod, Int_t par) const;
56 AliITSAlignMille2Constraint(const AliITSAlignMille2Constraint& src);
57 AliITSAlignMille2Constraint& operator=(const AliITSAlignMille2Constraint& ) {return *this;}
60 Int_t fType; // constriant type: mean, median ...
61 Double_t fVal; // constraint value
62 Int_t fModuleID; // Id of the module involved, -1 for orphans
63 UInt_t fApplied; // was it already applied?
64 UInt_t fPattern; // pattern of params involved
66 ClassDef(AliITSAlignMille2Constraint,0)