LCOV - code coverage report
Current view: top level - ITS/ITSrec - AliITSAlignMille2.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 111 0.9 %
Date: 2016-06-14 17:26:59 Functions: 1 113 0.9 %

          Line data    Source code
       1             : #ifndef ALIITSALIGNMILLE2_H
       2             : #define ALIITSALIGNMILLE2_H
       3             : 
       4             : /* Copyright(c) 2007-2009 , ALICE Experiment at CERN, All rights reserved. *
       5             :  * See cxx source for full Copyright notice                                */
       6             : 
       7             : /* $Id$ */
       8             : //-----------------------------------------------------------------------------
       9             : //
      10             : //  Interface to AliMillePede2 alignment class for the ALICE ITS detector
      11             : // 
      12             : //  ITS specific alignment class which interface to AliMillepede.   
      13             : //  For each track ProcessTrack calculates the local and global derivatives
      14             : //  at each hit and fill the corresponding local equations. Provide methods for
      15             : //  fixing or constraining detection elements for best results. 
      16             : // 
      17             : //  author M. Lunardon (thanks to J. Castillo), ruben.shahoyan@cern.ch
      18             : //-----------------------------------------------------------------------------
      19             : 
      20             : #include <TString.h>
      21             : #include <TObject.h>
      22             : #include <TGeoMatrix.h>
      23             : #include <TArrayS.h>
      24             : #include <TArrayD.h>
      25             : #include "AliTrackPointArray.h"
      26             : #include "AliITSAlignMille2Module.h"
      27             : 
      28             : class TSystem;
      29             : class TGeoManager;
      30             : class TVirtualFitter;
      31             : class TClonesArray;
      32             : class AliMillePede2;
      33             : class AliAlignObjParams;
      34             : class AliTrackFitterRieman;
      35             : class AliITSAlignMille2Constraint;
      36             : class AliITSAlignMille2ConstrArray;
      37             : class AliITSresponseSDD;
      38             : class AliITSTPArrayFit;
      39             : class AliITSsegmentationSDD;
      40             : class AliITSDriftSpeedArraySDD;
      41             : class AliITSCorrectSDDPoints;
      42             : class AliCDBEntry;
      43             : class AliESDVertex;
      44             : 
      45             : class AliITSAlignMille2: public TObject
      46             : {
      47             :  public:
      48             :   enum {kX,kY,kZ};
      49             :   enum {kCosmics, kCollision, kNDataType};
      50             :   enum {kNLocal=5,kMaxPoints=20,
      51             :         kNParChGeom = AliITSAlignMille2Module::kMaxParGeom,
      52             :         kNParCh     = AliITSAlignMille2Module::kMaxParTot,
      53             :         kMaxITSSensID=2197,kVtxSensID=kMaxITSSensID+1,kMaxITSSensVID=14300,kVtxSensVID=14371,
      54             :         kMinITSSupeModuleID=14336,
      55             :         kSDDoffsID=240,kNSDDmod=260};
      56             :   //
      57             :   enum {kCovIScaleBit=BIT(9),
      58             :         kSameInitDeltasBit=BIT(14),
      59             :         kSameInitSDDRespBit=BIT(15),
      60             :         kSameInitSDDVDriftBit=BIT(16),
      61             :         kSameDiamondBit=BIT(17),
      62             :         kSameInitSDDCorrMapBit=BIT(18),
      63             :         kSameInitGeomBit=BIT(19) };
      64             :   //
      65             :   enum {kDiamondIgnore,kDiamondCheckIfPrompt,kDiamondUse};
      66             :  public:
      67             :   //
      68             :   AliITSAlignMille2(const Char_t *configFilename="AliITSAlignMille.conf",TList* userInfo=0);
      69             :   virtual ~AliITSAlignMille2();
      70             :   //
      71           0 :   AliMillePede2* GetMillePede()                                   const {return fMillepede;}
      72           0 :   AliITSTPArrayFit* GetTPAFitter()                                const {return fTPAFitter;}
      73             :   //
      74             :   // configuration methods
      75             :   //
      76             :   Int_t     IsVIDDefined(UShort_t voluid)                         const;
      77             :   Int_t     IsVIDContained(UShort_t voluid)                       const;
      78             :   Int_t     IsSymDefined(const Char_t* name)                      const;
      79             :   Int_t     IsSymContained(const Char_t* name)                    const;
      80             :   Int_t     GetRequestedModID(UShort_t voluid)                    const;
      81             :   //
      82             :   Int_t     GetModuleIndex(const Char_t *symname);
      83             :   Int_t     GetModuleIndex(UShort_t voluid);
      84             :   UShort_t  GetModuleVolumeID(const Char_t *symname);
      85             :   UShort_t  GetModuleVolumeID(Int_t index);
      86             :   AliITSAlignMille2Module*  GetMilleModuleByVID(UShort_t voluid) const; // get pointer to the defined supermodule
      87             :   AliITSAlignMille2Module*  GetMilleModuleBySymName(const Char_t* symname) const; // get pointer to the defined supermodule
      88             :   AliITSAlignMille2Module*  GetMilleModuleIfContained(const Char_t* symname) const;
      89           0 :   AliITSAlignMille2Module*  GetMilleModule(Int_t id)             const {return (AliITSAlignMille2Module*)fMilleModule[id];}
      90           0 :   AliITSAlignMille2Module*  GetCurrentModule()                   const {return fCurrentModule;}
      91           0 :   AliITSAlignMille2Module*  GetSuperModule(Int_t id)             const {return (AliITSAlignMille2Module*)fSuperModule[id];}
      92             :   AliITSAlignMille2Module*  CreateVertexModule();
      93             :   //
      94             :   AliAlignObjParams*        GetPrealignedObject(const Char_t* symname) const;
      95             :   AliAlignObjParams*        GetConstrRefObject(const Char_t* symname) const;
      96             :   //
      97             :   void          ConvertParamsToGlobal() const;
      98             :   void          ConvertParamsToLocal()  const;
      99             :   //
     100           0 :   const Char_t* GetGeometryPath()                                   {return fGeometryPath.Data();}
     101           0 :   const Char_t* GetPreAlignmentPath()                               {return fPreDeltaPath.Data();}
     102           0 :   TClonesArray* GetPreAlignmentDeltas()                           const {return fPrealignment;}
     103           0 :   AliITSresponseSDD* GetSDDPrecalResp()                           const {return fPreRespSDD;}
     104           0 :   AliITSresponseSDD* GetSDDInitResp()                             const {return fIniRespSDD;}
     105           0 :   TObjArray*         GetSDDInitVDrift()                           const {return fIniVDriftSDD;}
     106           0 :   void      PrintCurrentModuleInfo()                              const {if (fCurrentModule) fCurrentModule->Print();}
     107             :   void      Print(Option_t*)                                      const;
     108           0 :   Bool_t    IsConfigured()                                        const {return fIsConfigured;}
     109           0 :   Bool_t    GetUseGlobalDelta()                                   const {return fUseGlobalDelta;}
     110           0 :   Bool_t    IsConstraintWrtRef()                                  const {return fConstrRef!=0;}
     111             :   Bool_t    FixedOrphans()                                        const;
     112           0 :   Bool_t    IsLocalYError()                                       const {return fUseLocalYErr;}
     113             :   //
     114             :   // geometry stuffs
     115           0 :   Int_t     GetNModules()                   const {return fNModules;}
     116           0 :   Int_t     GetCurrentModuleIndex()         const {return fCurrentModule ? fCurrentModule->GetIndex():-1;}
     117           0 :   TGeoHMatrix *GetCurrentModuleHMatrix()    const {return fCurrentModule ? fCurrentModule->GetMatrix():0;}
     118           0 :   Double_t *GetCurrentModuleTranslation()   const {return fCurrentModule ? fCurrentModule->GetMatrix()->GetTranslation():0;}
     119           0 :   Int_t     GetCurrentModuleInternalIndex() const {return fCurrentModule ? Int_t(fCurrentModule->GetUniqueID()):-1;}
     120           0 :   Int_t     GetTotBadLocEqPoints()          const {return fTotBadLocEqPoints;}
     121           0 :   Int_t     GetNConstraints()               const {return fConstraints.GetLast()+1;}
     122             :   Int_t     InitModuleParams();
     123             :   //
     124             :   // fitting methods
     125           0 :   AliTrackFitterRieman *GetRiemanFitter()   const                       {return fRieman;}
     126             :   AliTrackPointArray   *PrepareTrack(const AliTrackPointArray *track); 
     127           0 :   AliTrackPointArray *GetCurrentTrack()     const                       {return (AliTrackPointArray*)fTrack;}
     128           0 :   AliTrackPoint      *GetCurrentCluster()   const                       {return (AliTrackPoint*)&fCluster;}
     129             :   void      ProcessSDDPointInfo(const AliTrackPoint* pnt,Int_t sID, Int_t pntID);
     130           0 :   void      SetCurrentTrack(const AliTrackPointArray *atp)              {fTrack = (AliTrackPointArray*)atp;}
     131             :   void      SetCurrentCluster(const AliTrackPoint &atp);
     132             :   void      InitTrackParams(int meth=1);
     133             :   Int_t     ProcessTrack(const AliTrackPointArray *track, Double_t wgh=1.0);
     134             :   Int_t     FitTrack();
     135             :   Int_t     CheckCurrentTrack();
     136           0 :   Bool_t    GetFixCurvIfConstraned()        const                       {return fFixCurvIfConstraned;}
     137           0 :   void      SetFixCurvIfConstraned(Bool_t v=kTRUE)                      {fFixCurvIfConstraned = v;}
     138             :   //
     139             :   // methods for point unbiasing (via scaling its inverted cov.matrix)
     140           0 :   Bool_t    IsCovIScaleTouched()                     const {return TestBit(kCovIScaleBit);}
     141           0 :   void      TouchCovIScale(Bool_t v=kTRUE)                 {SetBit(kCovIScaleBit,v);}
     142           0 :   Float_t   GetCovIScale(Int_t ip)                   const {return ip<kMaxPoints ? fCovIScale[ip]:-1.;}
     143           0 :   Float_t*  GetCovIScale()                           const {return (Float_t*)fCovIScale;}
     144           0 :   void      SetCovIScale(Int_t ip, Float_t v=-1.)          {if (ip<kMaxPoints) fCovIScale[ip] = v; TouchCovIScale();}
     145           0 :   void      SetCovIScale(Float_t *v, Int_t np)             {for (int i=TMath::Min(np,kMaxPoints);i--;) fCovIScale[i]=v[i]; TouchCovIScale();}
     146           0 :   void      ResetCovIScale()                               {for (int i=kMaxPoints;i--;) fCovIScale[i]=-1; TouchCovIScale(kFALSE);}
     147             :   //
     148             :   Int_t     CalcIntersectionPoint(const Double_t *lpar, const Double_t *gpar);
     149             :   Int_t     CalcDerivatives(Int_t paridx, Bool_t islpar);
     150             :   void      JacobianPosGloLoc(int locid,double* jacobian);
     151           0 :   Double_t* GetLocalIntersectionPoint()                           const {return (Double_t*)fPintLoc;}
     152           0 :   Double_t* GetGlobalIntersectionPoint()                          const {return (Double_t*)fPintGlo;}
     153             :   AliTrackPointArray *SortTrack(const AliTrackPointArray *atp);
     154           0 :   void      SetTemporaryExcludedModule(Int_t index)                     {fTempExcludedModule=index;}
     155           0 :   Int_t     GetTemporaryExcludedModule()                          const {return fTempExcludedModule;}
     156           0 :   Double_t  GetMeasGlo(Int_t dim)                                 const {return fMeasGlo[dim];}
     157           0 :   Double_t  GetMeasLoc(Int_t dim)                                 const {return fMeasLoc[dim];}
     158             :   Int_t     GetCurrentLayer()                                     const;
     159             :   void      SetBField(Double_t b=0);
     160           0 :   void      SetTypeCosmics()                                            {fDataType = kCosmics;}
     161           0 :   void      SetTypeCollision()                                          {fDataType = kCollision;}
     162           0 :   void      SetDataType(Int_t tp=kCosmics)                              {fDataType = tp>=0&&tp< kNDataType ? tp:kCosmics;}
     163           0 :   void      SetUseLocalYErrors(Bool_t v=kTRUE)                          {fUseLocalYErr = v && fTPAFitter;}
     164           0 :   void      SetMinPointsPerSensor( Int_t n )                            {fMinPntPerSens = n>0 ? n:0;}
     165           0 :   Int_t     GetMinPointsPerSensor()                               const {return fMinPntPerSens;}
     166             :   void      ConstrainHelixFitPT(  Int_t q=0,Double_t pt=-1, Double_t err=-1);
     167             :   void      ConstrainHelixFitCurv(Int_t q=0,Double_t crv=-1,Double_t crverr=-1);
     168             :   void      RemoveHelixFitConstraint();
     169             :   void      SetVertexConstraint(const AliESDVertex* vtx);
     170           0 :   Bool_t    IsVertexSet()                                         const {return fVertexSet;}
     171           0 :   void      RemoveVertexConstraint()                                    {fVertexSet = kFALSE;}
     172           0 :   void      SetVertexSet(Bool_t v)                                      {fVertexSet = v;}
     173           0 :   Double_t  GetHelixContraintCharge()                             const {return fConstrCharge;}
     174           0 :   Double_t  GetHelixContraintPT()                                 const {return fConstrPT;}
     175           0 :   Double_t  GetHelixContraintPTErr()                              const {return fConstrPTErr;}
     176           0 :   Int_t     GetDataType()                                         const {return fDataType;}
     177             :   //
     178             :   TGeoHMatrix* GetSensorOrigMatrixSID(Int_t sid)                  const;
     179             :   TGeoHMatrix* GetSensorOrigMatrixVID(Int_t vid)                  const;
     180             :   //
     181             :   TGeoHMatrix* GetSensorCurrMatrixSID(Int_t sid)                  const;
     182             :   TGeoHMatrix* GetSensorCurrMatrixVID(Int_t vid)                  const;
     183             :   //
     184             :   AliCDBEntry* GetCDBEntry(const char* path);
     185             :   // Hierarchical contraints
     186             :   void      TieSDDVDriftsLR(AliITSAlignMille2Module* mod);
     187           0 :   Bool_t    PseudoParentsAllowed()                                const {return fAllowPseudoParents;}
     188             :   void      ConstrainModuleSubUnitsMean(Int_t idm, Double_t val=0, UInt_t pattern=0xff);
     189             :   void      ConstrainModuleSubUnitsMedian(Int_t idm, Double_t val=0, UInt_t pattern=0xff);
     190             :   void      ConstrainOrphansMean(Double_t val=0, UInt_t pattern=0xff);
     191             :   void      ConstrainOrphansMedian(Double_t val=0, UInt_t pattern=0xff);
     192             :   void      ConstrainLocal(const Char_t* name,Double_t *parcf,Int_t npar,Double_t val,Double_t err);
     193             :   //
     194             :   void      ApplyGaussianConstraint(const AliITSAlignMille2ConstrArray* cstr);
     195             :   void      ApplyPreConstraints();
     196             :   void      ApplyPostConstraints();
     197             :   //
     198           0 :   void      SetWeightPt(Double_t w=1)                                   {fWeightPt = w;}
     199           0 :   void      SetSDDVDCorrMult(Bool_t v=kTRUE)                            {fIsSDDVDriftMult=v;}   
     200           0 :   Double_t  GetWeightPt()                                         const {return fWeightPt;}
     201           0 :   Bool_t    IsSDDVDCorrMult()                                     const {return fIsSDDVDriftMult;}
     202             :   Bool_t    IsParModConstrained(const AliITSAlignMille2Module* mod,Int_t par, Bool_t &meanmed, Bool_t &gaussian) const;
     203             :   Bool_t    IsParModFamilyVaried(const AliITSAlignMille2Module* mod,Int_t par,Int_t depth=999)             const;
     204             :   Bool_t    IsParFamilyFree(const AliITSAlignMille2Module* mod,Int_t par,Int_t depth=999)                  const;
     205             :   //
     206             :   // millepede methods
     207             :   Int_t     GlobalFit();
     208             :   void      FixParameter(Int_t param, Double_t value);
     209             :   void      PrintGlobalParameters();
     210             :   //
     211             :   TClonesArray*      CreateDeltas();
     212             :   AliITSresponseSDD* CreateSDDResponse();
     213             :   // module specific 
     214             :   //
     215             :   Double_t  GetTDriftSDD()                  const;
     216             :   Double_t  GetVDriftSDD()                  const;
     217           0 :   Double_t  GetDriftSpeed(Int_t id)         const {return fDriftSpeed[id];}
     218           0 :   Double_t  GetDriftSpeed0(Int_t id)        const {return fDriftSpeed0[id];}
     219           0 :   Double_t  GetDriftTime0(Int_t id)         const {return fDriftTime0[id];}
     220             : 
     221             :   //
     222           0 :   AliITSAlignMille2Constraint* GetConstraint(Int_t i)            const {return (AliITSAlignMille2Constraint*)fConstraints.At(i);}
     223           0 :   AliITSAlignMille2Constraint* GetConstraint(const char* name)   const {return (AliITSAlignMille2Constraint*)fConstraints.FindObject(name);}
     224             :   //
     225             :   // debug stuffs
     226           0 :   void       FetchCluster(int ip)                                      {fTrack->GetPoint(fCluster,ip);fCluster.SetUniqueID(ip);} 
     227           0 :   void       SetLocalInitParams(const Double_t *par)                   {for (int i=kNLocal;i--;) fLocalInitParam[i]=par[i];}
     228           0 :   Bool_t     IsTypeCosmics()                                     const {return fDataType==kCosmics;}
     229           0 :   Bool_t     IsTypeCollision()                                   const {return fDataType==kCollision;}
     230           0 :   Double_t  *GetMeasLoc()                                        const {return (Double_t*)fMeasLoc;}
     231           0 :   Double_t  *GetSigmaLoc()                                       const {return (Double_t*)fSigmaLoc;}
     232           0 :   Double_t   GetBField()                                         const {return fBField;}
     233           0 :   Bool_t     IsFieldON()                                         const {return fBOn;}
     234           0 :   Bool_t     IsDiamondUsed()                                     const {return fUseDiamond;}
     235           0 :   Int_t      GetCheckDiamondPoint()                              const {return fCheckDiamondPoint;}
     236           0 :   void       SetCheckDiamondPoint(Int_t m=kDiamondCheckIfPrompt)       {fCheckDiamondPoint = m;}
     237           0 :   Bool_t     IsVertexUsed()                                      const {return fUseVertex;}
     238           0 :   Double_t  *GetLocalInitParam()                                 const {return (Double_t*)fLocalInitParam;}
     239           0 :   Double_t  *GetLocalInitParEr()                                 const {return (Double_t*)fLocalInitParEr;}
     240           0 :   Double_t   GetLocalDif(int par, int coor)                      const {return fDerivativeLoc[par][coor];}
     241           0 :   Double_t   GetGlobalDif(int par, int coor)                     const {return fDerivativeGlo[par][coor];}
     242             :   Int_t      GetPreAlignmentQualityFactor(Int_t index)           const;// if not prealign. return -1
     243           0 :   void       SetBug(Int_t bug) {fBug=bug;}                             // 1:SSD inversion sens.18-19
     244           0 :   static     AliITSAlignMille2* GetInstance()                          {return fgInstance;}
     245             : 
     246             :   Int_t      LoadPreSDDCalib();
     247             :   // pepo270809
     248           0 :   Int_t      GetExtraClustersMode() const {return fExtraClustersMode;}
     249           0 :   void       SetExtraClustersMode(Int_t mode) {fExtraClustersMode=mode;}  
     250             :   // endpepo270809
     251             : 
     252             :   // pepo
     253             :   // flag for AliITSAlignMille compatibility
     254           0 :   Int_t      GetMilleVersion() const {return fMilleVersion;}
     255           0 :   void       SetMilleVersion(Int_t m1) {fMilleVersion=m1;}
     256             :   // modified existing methods
     257             :   void      SetCurrentModule(Int_t id);
     258             :   // old methods recovered
     259           0 :   Int_t     IsDefined(UShort_t voluid) const {return IsVIDDefined(voluid);}
     260           0 :   Int_t     IsContained(UShort_t voluid) const {return IsVIDContained(voluid);}
     261             :   // moved from private to public
     262             :   void      SetRequiredPoint(Char_t* where, Int_t ndet, Int_t updw, Int_t nreqpts,Int_t runtype=-1); 
     263             :   Bool_t    InitRiemanFit();
     264           0 :   void      SetMinNPtsPerTrack(Int_t pts=3)  {fMinNPtsPerTrack=pts;}
     265             :   //
     266           0 :   Int_t     GetRunID()                                            const {return fRunID;}
     267           0 :   void      SetRunID(int run)                                           {fRunID = run;}
     268             :   //
     269           0 :   AliITSCorrectSDDPoints * GetPreCorrMapSDD()                    const {return fPreCorrMapSDD;}
     270           0 :   AliITSCorrectSDDPoints * GetIniCorrMapSDD()                    const {return fIniCorrMapSDD;}
     271           0 :   static Bool_t    IsZero(Double_t v,Double_t threshold = 1e-15)       { return TMath::Abs(v)<threshold; }
     272           0 :   static void      SetWordBit(UInt_t word,Int_t bitID)                 { word |= (1<<bitID);}
     273           0 :   static void      ResetWordBit(UInt_t word,Int_t bitID)               { word &= ~(1<<bitID);}
     274           0 :   static Bool_t    TestWordBit(UInt_t word,Int_t bitID)                { return (Bool_t)(word&(1<<bitID));}      
     275             :   //
     276             :  protected:
     277             :   //
     278             :   struct Mille2Data { // structure to store data for LocalEquations (X and Z, optionally Y)
     279             :     enum {kMaxLev = 7};
     280             :     Double_t fMeas[3];                // measured coordinates
     281             :     Double_t fSigma[3];               // measured errors
     282             :     Double_t fDerLoc[kNLocal][3];     // calculated local derivatives
     283             :     Int_t    fNModFilled, fNGlobFilled, fModuleID[kMaxLev]; // used module info
     284             :     Int_t    fParMilleID[AliITSAlignMille2Module::kMaxParTot*kMaxLev]; // param id's
     285             :     Double_t fDerGlo[AliITSAlignMille2Module::kMaxParTot*kMaxLev][3]; // global derivatives
     286             :   };
     287             :   //
     288             :   // configuration methods
     289             :   void      Init();
     290             :   Int_t     CacheMatricesOrig();
     291             :   Int_t     CacheMatricesCurr();
     292             :   Int_t     ProcessUserInfo(TList *userInfo=0);
     293             :   Int_t     GetPathFromUserInfo(const TList* cdbList,const char* calib,TString& path, Int_t useBit);
     294             :   Int_t     LoadConfig(const Char_t *cfile="AliITSAlignMille.conf");
     295             :   TObjArray* GetConfigRecord(FILE* stream, TString& recTitle, TString& recOpt, Bool_t rew);
     296             :   Int_t     CheckConfigRecords(FILE* stream);
     297             :   Int_t     ReloadInitCalib(TList *userInfo);
     298             :   Int_t     ReloadInitCalib();
     299             :   //
     300             :   void      BuildHierarchy();
     301             :   Int_t     LoadSuperModuleFile(const Char_t *cfile="ITSMilleSuperModules.root");
     302             :   Int_t     LoadGeometry(TString& path);
     303             :   Int_t     LoadSDDResponse(TString& path, AliITSresponseSDD *&resp);
     304             :   Int_t     LoadSDDVDrift(TString& path, TObjArray *&arr);
     305             :   Int_t     LoadSDDCorrMap(TString& path, AliITSCorrectSDDPoints *&map);
     306             :   Int_t     LoadDeltas(TString& path, TClonesArray *&arr);
     307             :   Int_t     LoadDiamond(TString& path);
     308             :   void      ResetLocalEquation();
     309             :   Int_t     ApplyToGeometry();
     310             :   //
     311             :   void      ConstrainModuleSubUnits(Int_t idm, Double_t val=0, UInt_t pattern=0xff);
     312             :   void      ConstrainOrphans(Double_t val=0,UInt_t pattern=0xff);
     313             :   void      PostConstrainModuleSubUnits(Int_t type,Int_t idm, Double_t val, UInt_t pattern);
     314             :   void      PostConstrainOrphans(Int_t type,Double_t val, UInt_t pattern);
     315             :   //
     316             :   void      SetGeometryPath(const Char_t* filename="geometry.root") { fGeometryPath = filename; }
     317             : 
     318           0 :   void      SetInitTrackParamsMeth(Int_t meth=1)                        {fIniTrackParamsMeth=meth;}
     319             :   //
     320             :   void      AddConstraint(Double_t *factor, Double_t value, Double_t sigma=0);
     321             :   void      InitGlobalParameters(Double_t *par);
     322           0 :   Bool_t    SetLocalDerivative(Int_t index, Double_t value)             {return IsZero(fLocalDerivatives[index]=value);}
     323           0 :   Bool_t    SetGlobalDerivative(Int_t index, Double_t value)            {return IsZero(fGlobalDerivatives[index]=value);}  
     324             :   //
     325             :   // millepede methods
     326             :   //
     327             :   Int_t     AddLocalEquation(Mille2Data &m);
     328             :   Int_t     AddLocalEquationTPA(Mille2Data &m);
     329             :   void      SetLocalEquations(const Mille2Data *marr, Int_t neq);
     330           0 :   void      SetUseGlobalDelta(Bool_t v=kTRUE)                           {fUseGlobalDelta = v;}
     331           0 :   void      SetAllowPseudoParents(Bool_t v=kTRUE)                       {fAllowPseudoParents = v;} 
     332             :   Int_t     SetConstraintWrtRef(const char* reffname);
     333             :   //
     334             :   void      ConvertDeltas();
     335             :   void      ConvSortHierarchically(TObjArray& matArr);
     336             :   Bool_t    ConvIsJParentOfI(const TGeoHMatrix* matI,const TGeoHMatrix* matJ) const;
     337             :   AliAlignObjParams* ConvFindDelta(const TClonesArray* arrDelta,const TString& algname) const;
     338             : 
     339             :   AliITSAlignMille2(const AliITSAlignMille2& rhs);
     340             :   AliITSAlignMille2& operator=(const AliITSAlignMille2& rhs);
     341             :   //
     342             :  protected:
     343             :   //
     344             :   enum {
     345             :     kOCDBDefaultPath,
     346             :     kOCDBSpecificPath,
     347             :     kGeomFile,
     348             :     kSuperModileFile,
     349             :     kConstrRefFile,
     350             :     kPreDeltaFile,
     351             :     kPreCalSDDFile,
     352             :     kPreVDriftSDDFile,
     353             :     kPreCorrMapSDDFile,
     354             :     kInitCorrMapSDDFile,
     355             :     kInitCalSDDFile,
     356             :     kInitVDriftSDDFile,
     357             :     kInitDeltaFile,
     358             :     kInitGeomFile,
     359             :     kGlobalDeltas,
     360             :     kConstrLocal,
     361             :     kModVolID,
     362             :     kModIndex,
     363             :     kPseudoParents,
     364             :     kTrackFitMethod,
     365             :     kMinPntTrack,
     366             :     kNStDev,
     367             :     kResCutInit,
     368             :     kResCutOther,
     369             :     kLocalSigFactor,
     370             :     kStartFactor,
     371             :     kFinalFactor,
     372             :     kBField,
     373             :     kSparseMatrix,
     374             :     kRequirePoint,
     375             :     kConstrOrphans,
     376             :     kConstrSubunits,
     377             :     kApplyConstr,
     378             :     kExtraClustersMode,
     379             :     kTPAFitter,
     380             :     kUseLocalYErr,
     381             :     kMinPointsSens,
     382             :     kSDDVDCorrMult,
     383             :     kWeightPt,
     384             :     kUseDiamond,
     385             :     kCorrectDiamond,
     386             :     kUseVertex,
     387             :     kSameSDDT0,
     388             :     //
     389             :     kNKeyWords
     390             :   };                                            // id's of the keywirds for config file records
     391             : 
     392             :   // millepede stuffs
     393             :   AliMillePede2 *fMillepede;                    // Detector independent alignment class
     394             :   Double_t      fStartFac;                      // Initial factor for chi2 cut 
     395             :   Double_t      fFinalFac;                      // Final factor for chi2 cut 
     396             :   Double_t      fResCutInitial;                 // Cut on residual for first iteration
     397             :   Double_t      fResCut;                        // Cut on residual for other iterations 
     398             :   Int_t         fNGlobal;                       // Number of global parameters
     399             :   Int_t         fNLocal;                        // Number of local parameters
     400             :   Int_t         fNStdDev;                       // Number of standard deviations for chi2 cut
     401             :   Bool_t        fIsMilleInit;                   // Flag for initialization
     402             :   Bool_t        fAllowPseudoParents;            // For simple constraints don't involve parents into the fit
     403             :   //
     404             :   // fitting stuffs
     405             :   AliITSTPArrayFit        *fTPAFitter;          // TPArrayFitter       
     406             :   AliITSAlignMille2Module *fCurrentModule;      // Current SuperModule index
     407             :   AliTrackPointArray *fTrack;                   // pointer to current track 
     408             :   TObjArray     fTrackBuff;                     // buffer for tracks of min length
     409             :   AliTrackPoint fCluster;                       // current cluster
     410             :   Int_t         fCurrentSensID;                 // sensor index for current cluster
     411             :   TArrayD       fClusLoc;                       // local  coordinates of the clusters
     412             :   TArrayD       fClusGlo;                       // global coordinates of the clusters
     413             :   TArrayD       fClusSigLoc;                    // local cov matrix of the clusters
     414             :   Double_t     *fGlobalDerivatives;             // Array of global derivatives
     415             :   Double_t      fLocalDerivatives[kNLocal];     // Array of local deriv.
     416             :   Double_t      fLocalInitParam[kNLocal];       // Array with inital values for local parameters for current track
     417             :   Double_t      fLocalInitParEr[kNLocal][kNLocal];// Array with inital values for local parameters for current track
     418             :   Double_t      fModuleInitParam[kNParCh];      // Array with inital values for current module parameters (init geometry)
     419             :   Double_t      fPintLoc[3];                    // track/module intersection point in local coordinates
     420             :   Double_t      fPintLoc0[3];                   // track/module intersection point in local coordinates (before variation)
     421             :   Double_t      fPintGlo[3];                    // track/module intersection point in global coordinates
     422             :   Double_t     *fMeasLoc;                       // current point local coordinates (the original ones)
     423             :   Double_t     *fMeasGlo;                       // current point glob. coord (AliTrackPoint)
     424             :   Double_t     *fSigmaLoc;                      // stdev current point
     425             :   Double_t      fSigmaFactor[3];                // multiplicative factor for cluster sigmaX,Y,Z
     426             :   Double_t      fConstrPT;                      // optional PT constraint for helix (abs value)
     427             :   Double_t      fConstrPTErr;                   // error on this constraint (0 - exact)
     428             :   Int_t         fConstrCharge;                  // optional constraint on charge of Helix track (0 - no constraint)
     429             :   Int_t         fRunID;                         // current runID
     430             :   //
     431             :   Double_t      fDerivativeLoc[kNLocal][3];     // XYZ deriv. over local params
     432             :   Double_t      fDerivativeGlo[kNParCh][3];     // XYZ deriv. over global params
     433             :   Int_t         fMinNPtsPerTrack;               // min number of points per track to accept it
     434             :   Int_t         fIniTrackParamsMeth;            // method for track fit
     435             :   Int_t         fTotBadLocEqPoints;             // total number of reject points because of bad EqLoc
     436             :   AliTrackFitterRieman *fRieman;                // riemann fitter for helices
     437             :   //
     438             :   TObjArray     fConstraints;                   // list of constraints
     439             :   TObjArray     fCacheMatrixOrig;               // cach for original geom matrices
     440             :   TObjArray     fCacheMatrixCurr;               // cach for prealigned geom matrices
     441             :   // >> new members
     442             :   Bool_t        fUseGlobalDelta;                // intetpret deltas as global 
     443             :   Bool_t        fRequirePoints[kNDataType];     // required points in specific layers
     444             :   Int_t         fNReqLayUp[kNDataType][6];      // number of points required in layer[n] with Y>0
     445             :   Int_t         fNReqLayDown[kNDataType][6];    // number of points required in layer[n] with Y<0
     446             :   Int_t         fNReqLay[kNDataType][6];        // number of points required in layer[n] 
     447             :   Int_t         fNReqDetUp[kNDataType][3];      // number of points required in Detector[n] with Y>0
     448             :   Int_t         fNReqDetDown[kNDataType][3];    // number of points required in Detector[n] with Y<0
     449             :   Int_t         fNReqDet[kNDataType][3];        // number of points required in Detector[n]
     450             :   Int_t         fTempExcludedModule; /// single module temporary excluded from initial fit
     451             :   UInt_t        fUserProvided;                  // settings which user provided: not to update from the UserUnfo
     452             :   // << new members
     453             :   //
     454             :   // OCDB stuff
     455             :   TList        *fIniUserInfo;                   // initial user info (validity is not guaranteed after initialization)
     456             :   TString       fIniGeomPath;                   // where to take the ideal geometry used to produce the points
     457             :   TString       fIniDeltaPath;                  // where to take the deltas used to produce the points
     458             :   TString       fIniSDDRespPath;                // where to take the initial SDD response used to produce the points
     459             :   TString       fPreCalSDDRespPath;             // precalibration SDD response file name
     460             :   TString       fIniSDDVDriftPath;              // initial SDD vdrift file name
     461             :   TString       fPreSDDVDriftPath;              // precalibration SDD vdrift file name
     462             :   TString       fIniSDDCorrMapPath;             // initial SDD corr.map file name
     463             :   TString       fPreSDDCorrMapPath;             // precalibration SDD corr.map file name
     464             :   // geometry stuffs
     465             :   Bool_t        fConvertPreDeltas;              // when the prealignment deltas come from UserInfo, convert them from UserInfo geometry to target one
     466             :   TString       fGeometryPath;                  // Geometry file name
     467             :   TString       fPreDeltaPath;                  // file with prealigned objects
     468             :   TString       fConstrRefPath;                 // file with prealigned objects wrt which constraints are defined
     469             :   TString       fDiamondPath;                   // file with diamond constraint
     470             :   TGeoManager  *fGeoManager;                    // pointer to Alice geomanager
     471             :   Bool_t        fIsConfigured;                  // flag for loaded config file
     472             :   TArrayS       fPreAlignQF;                    // prealignment flags (not used?)
     473             :   //
     474             :   AliITSresponseSDD* fIniRespSDD;               // array of SDD t0/vdrift calib params used to create the track points
     475             :   AliITSresponseSDD* fPreRespSDD;               // array of SDD t0/vdrift calib params
     476             :   TObjArray*         fIniVDriftSDD;             // array of AliITSDriftSpeedArraySDD objects used for original reco
     477             :   TObjArray*         fPreVDriftSDD;             // array of AliITSDriftSpeedArraySDD objects to be used as a starting point instead of fIniVDriftSDD
     478             :   AliITSCorrectSDDPoints* fIniCorrMapSDD;       // SDD initial correction map
     479             :   AliITSCorrectSDDPoints* fPreCorrMapSDD;       // SDD precalibration correction map
     480             :   AliITSsegmentationSDD* fSegmentationSDD;      // extraction of SDD segmentation params
     481             :   TClonesArray* fPrealignment; // array of prealignment global deltas
     482             :   TClonesArray* fConstrRef;    // array of refererence deltas with respect to which the constraint are defined (survey?)
     483             :   TObjArray     fMilleModule; /// array of super modules to be aligned
     484             :   TObjArray     fSuperModule; /// array of super modules defined in supermodule file
     485             :   Int_t         fNModules;                      // number of defined modules from config file
     486             :   Int_t         fNSuperModules; /// number of custom supermodules in SM file
     487             :   Bool_t        fUsePreAlignment;               // start from prealigned setup 
     488             :   Bool_t        fUseLocalYErr;                  // use local Yerror due to the sensor thickness
     489             :   Bool_t        fBOn;                           // magentic field ON
     490             :   Double_t      fBField;                        // value of magnetic field
     491             :   Int_t         fDataType;                      // is this cosmics or collision processing?
     492             :   Int_t         fMinPntPerSens;                 // min number of points per module to vary it
     493             :   Int_t         fBug;                           /// tag for temporary bug correction
     494             :   // pepo
     495             :   Int_t         fMilleVersion; /// tag for backward compatibility
     496             :   // endpepo
     497             :   // pepo270809
     498             :   Int_t         fExtraClustersMode; /// 1=remove random / 2=remove internal / 10=use only tracks with xcl
     499             :   // endpepo270809
     500             :   //
     501             :   Double_t      fTrackWeight;                      //weight given by the user to current track
     502             :   Double_t      fWeightPt;                         //weight track equations by pT in this power
     503             :   Bool_t        fIsSDDVDriftMult;                  //use multiplicative correction for SDD vdrift
     504             :   Double_t      fDriftSpeed[50];                   //temporary array for corrected drift speed of SDD alitrackpoints
     505             :   Double_t      fDriftSpeed0[50];                  //temporary array for original  drift speed of SDD alitrackpoints
     506             :   Double_t      fDriftTime0[50];                   //temporary array for drift time 0's used for SDD alitrackpoints
     507             :   Double_t      fExtClusterPar[9];                 //array to store the parameters of the externally imposed cluster
     508             :   AliTrackPoint fDiamond;                          //optional constraint on the vertex
     509             :   AliTrackPoint fDiamondI;                         //constraint on the vertex with inverted error matrix
     510             :   Double_t      fCorrDiamond[3];                   //diamond correction
     511             :   Bool_t        fUseDiamond;                       //use diamond as a vertex constraint
     512             :   Bool_t        fUseVertex;                        //use vertex for constraint
     513             :   Bool_t        fVertexSet;                        //vertex is set for current track
     514             :   Int_t         fDiamondPointID;                   //ID of the diamond point in the track
     515             :   Int_t         fDiamondModID;                     //id of the fake diamond module
     516             :   Int_t         fCheckDiamondPoint;                // kDiamondIgnore: ignore in this event, kDiamondCheckIfPrompt: verify if track is prompt, kDiamondUse: use w/o verification
     517             :   Float_t       fCovIScale[kMaxPoints];            //optional scaling for inv.cov matrix (debiasing). MANAGED BY THE USER EXTERNALLY
     518             :   //
     519             :   Bool_t        fFixCurvIfConstraned;              //when fit curv. was constrained, don't pass it as a free param to MP2
     520             :   Bool_t        fCurvFitWasConstrained;            //flag that the last fit had constrained curvature
     521             :   //
     522             :   TObjArray     fConvAlgMatOld;                    //array to keep matrices of alignables for deltas conversion
     523             :   //
     524             :   static AliITSAlignMille2* fgInstance;         // global pointer on itself
     525             :   static Int_t              fgInstanceID;       // global counter of the instances
     526             :   static const Char_t     * fgkRecKeys[];       // keywords for config file records
     527             :   static const Char_t       fgkXYZ[];           // XYZ labels
     528             :   //
     529         116 :   ClassDef(AliITSAlignMille2, 0)
     530             : };
     531             : 
     532             : 
     533             : //______________________________________________________________________________________
     534             : inline void AliITSAlignMille2::SetCurrentCluster(const AliTrackPoint &atp) 
     535             : {
     536             :   // set current cluster
     537           0 :   fCluster = atp; 
     538           0 :   fCurrentSensID = AliITSAlignMille2Module::GetIndexFromVolumeID(fCluster.GetVolumeID());
     539           0 : }
     540             : 
     541             : //______________________________________________________________________________________
     542             : inline TGeoHMatrix* AliITSAlignMille2::GetSensorOrigMatrixSID(Int_t sid) const 
     543             : {
     544             :   // get cached original matrix by sensor ID
     545           0 :   return sid<0 ? 0 : (TGeoHMatrix*) fCacheMatrixOrig[sid];
     546             : }
     547             : 
     548             : //______________________________________________________________________________________
     549             : inline TGeoHMatrix* AliITSAlignMille2::GetSensorOrigMatrixVID(Int_t vid) const
     550             : {
     551             :   // get cached original matrix by sensor volume ID
     552           0 :   return GetSensorOrigMatrixSID( AliITSAlignMille2Module::GetIndexFromVolumeID(vid) );
     553             : }
     554             : 
     555             : //______________________________________________________________________________________
     556             : inline TGeoHMatrix* AliITSAlignMille2::GetSensorCurrMatrixSID(Int_t sid) const 
     557             : {
     558             :   // get cached current matrix by sensor ID
     559           0 :   return sid<0 ? 0 : (TGeoHMatrix*) fCacheMatrixCurr[sid];
     560             : }
     561             : 
     562             : //______________________________________________________________________________________
     563             : inline TGeoHMatrix* AliITSAlignMille2::GetSensorCurrMatrixVID(Int_t vid) const
     564             : {
     565             :   // get cached current matrix by sensor volume ID
     566           0 :   return GetSensorCurrMatrixSID( AliITSAlignMille2Module::GetIndexFromVolumeID(vid) );
     567             : }
     568             : 
     569             : #endif
     570             : 

Generated by: LCOV version 1.11