LCOV - code coverage report
Current view: top level - ITS/ITSrec - AliITSAlignMille2ConstrArray.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 58 1.7 %
Date: 2016-06-14 17:26:59 Functions: 1 12 8.3 %

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

Generated by: LCOV version 1.11