]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSAlignMille2Constraint.h
Coding Conventions (Ruban)
[u/mrichter/AliRoot.git] / ITS / AliITSAlignMille2Constraint.h
1 #ifndef ALIITSALIGNMILLE2CONSTRAINT_H
2 #define ALIITSALIGNMILLE2CONSTRAINT_H
3
4 #include <TNamed.h>
5 #include <TArrayS.h>
6 #include <TArrayD.h>
7
8 class AliITSAlignMille2Module;
9
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) 
17
18 Author: ruben.shahoyan@cern.ch
19 ------------------------------------------------------------------------------------------*/
20 class AliITSAlignMille2Constraint : public TNamed
21 {
22  public:
23   enum {kTypeMean,kTypeMedian};
24   enum {kDisabledBit=31};
25   //
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() {}
29   //
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;
41   //
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;}
50   //
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;
54   //
55  protected:
56   AliITSAlignMille2Constraint(const AliITSAlignMille2Constraint& src);
57   AliITSAlignMille2Constraint& operator=(const AliITSAlignMille2Constraint& ) {return *this;}
58   //
59  protected:
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
65   //
66   ClassDef(AliITSAlignMille2Constraint,0)
67 };
68
69
70 #endif