]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSAlignMille2.cxx
General macro to estimate tracking efficiency
[u/mrichter/AliRoot.git] / ITS / AliITSAlignMille2.cxx
index a9bfb90797c5ab65febedebc2ff927038df97224..2fe25dd95944b76572981525188346226c61c0b1 100644 (file)
@@ -211,6 +211,8 @@ AliITSAlignMille2::AliITSAlignMille2(const Char_t *configFilename,TList *userInf
   fDiamondPointID(-1),
   fDiamondModID(-1),
   fCheckDiamondPoint(kDiamondCheckIfPrompt),
+  fFixCurvIfConstraned(kTRUE),
+  fCurvFitWasConstrained(kFALSE),
   fConvAlgMatOld(100)
 {
   /// main constructor that takes input from configuration file
@@ -321,6 +323,7 @@ TObjArray* AliITSAlignMille2::GetConfigRecord(FILE* stream, TString& recTitle, T
 //________________________________________________________________________________________________________
 Int_t AliITSAlignMille2::CheckConfigRecords(FILE* stream)
 {  
+  // check the correctness of the record
   TString record,recTitle;
   int lineCnt = 0;
   rewind(stream);
@@ -2447,6 +2450,7 @@ Int_t AliITSAlignMille2::ProcessTrack(const AliTrackPointArray *track, Double_t
   // finally send local equations to millepede
   SetLocalEquations(md,nloceq);
   fMillepede->SaveRecordData(); // RRR
+  fCurvFitWasConstrained = kFALSE; // restore default
   //
   return 0;
 }
@@ -2557,7 +2561,7 @@ Int_t AliITSAlignMille2::FitTrack()
 }
 
 //________________________________________________________________________________________________________
-Int_t AliITSAlignMille2::CalcIntersectionPoint(Double_t *lpar, Double_t *gpar) 
+Int_t AliITSAlignMille2::CalcIntersectionPoint(const Double_t *lpar, const Double_t *gpar) 
 {
   /// calculate track intersection point in local coordinates
   /// according with a given set of parameters (local(4) and global(6))
@@ -2955,6 +2959,9 @@ Int_t AliITSAlignMille2::AddLocalEquationTPA(Mille2Data &m)
   TGeoHMatrix *tempHMat = GetSensorCurrMatrixSID(fCurrentSensID);// fCurrentModule->GetSensitiveVolumeMatrix(fCluster.GetVolumeID());
   //
   fTPAFitter->GetDResDParams(&fDerivativeLoc[0][0], curpoint);    // resid. derivatives over the track parameters 
+  if (fCurvFitWasConstrained && fFixCurvIfConstraned && !IsZero(fBField)) 
+    for (int i=3;i--;) fDerivativeLoc[AliITSTPArrayFit::kR0][i] = 0; //Fix curvarute
+  //
   for (Int_t i=fNLocal; i--;) tempHMat->MasterToLocalVect(fDerivativeLoc[i],m.fDerLoc[i]); 
   //
   int status = 0;
@@ -3111,6 +3118,12 @@ void AliITSAlignMille2::SetLocalEquations(const Mille2Data *marr, Int_t neq)
   /// Set local equations with data stored in m
   /// return 0 if success
   //
+  Bool_t locPatt[kNLocal] = {0}; // pattern of lacal eq's to account
+  for (int i=fNLocal; i--;) {
+    if (locPatt[i]) continue; // already set
+    for (Int_t j=0; j<neq; j++) for (int ic=3;ic--;) if (!IsZero(marr[j].fDerLoc[i][ic])) locPatt[i]=kTRUE;
+  }
+  //
   for (Int_t j=0; j<neq; j++) {
     //
     const Mille2Data &m = marr[j];
@@ -3120,8 +3133,8 @@ void AliITSAlignMille2::SetLocalEquations(const Mille2Data *marr, Int_t neq)
       // for the diamond point (if any) the Y residual is accounted
       if (ic==kY && !fUseLocalYErr && !(m.fModuleID[0]==fDiamondModID)) continue;
       AliDebug(2,Form("setting local equation %c with fMeas=%.6f  and fSigma=%.6f",fgkXYZ[ic],m.fMeas[ic], m.fSigma[ic]));      
-      Int_t nzero = 0;
-      for (int i=fNLocal; i--;) nzero += SetLocalDerivative(i,m.fDerLoc[i][ic] );
+      Int_t nzero = 0, naddl = 0;
+      for (int i=0;i<=fNLocal;i++) if (locPatt[i]) nzero += SetLocalDerivative(naddl++,m.fDerLoc[i][ic] );
       if (nzero==fNLocal) { 
        AliInfo(Form("Skipping %c residual due to the zero derivatives!",fgkXYZ[ic])); 
        continue; 
@@ -3222,7 +3235,7 @@ Int_t AliITSAlignMille2::LoadSuperModuleFile(const Char_t *sfile)
     strncpy(st,a->GetSymName(),TMath::Min(sizeof(st),strlen(a->GetSymName())+1));
     a->GetMatrix(m);
     //
-    symname[0] = '\0';
+    memset(symname,0,250*sizeof(char));
     sscanf(st,"%249s",symname);
     //
     // decode module list
@@ -3852,7 +3865,7 @@ Bool_t AliITSAlignMille2::FixedOrphans() const
 }
 
 //________________________________________________________________________________________________________
-void AliITSAlignMille2::ConvertParamsToGlobal()
+void AliITSAlignMille2::ConvertParamsToGlobal() const
 {
   // convert params in local frame to global one
   double pars[AliITSAlignMille2Module::kMaxParGeom];
@@ -3866,7 +3879,7 @@ void AliITSAlignMille2::ConvertParamsToGlobal()
 }
 
 //________________________________________________________________________________________________________
-void AliITSAlignMille2::ConvertParamsToLocal()
+void AliITSAlignMille2::ConvertParamsToLocal() const
 {
   // convert params in global frame to local one
   double pars[AliITSAlignMille2Module::kMaxParGeom];
@@ -3968,7 +3981,7 @@ Int_t AliITSAlignMille2::ProcessUserInfo(TList* userInfo)
 }
 
 //________________________________________________________________________________________________________
-Int_t AliITSAlignMille2::GetPathFromUserInfo(TList* cdbList,const char* calib,TString& path, Int_t useBit)
+Int_t AliITSAlignMille2::GetPathFromUserInfo(const TList* cdbList,const char* calib,TString& path, Int_t useBit)
 {
   // extract the path for specific CDB path from user info. If it is the same as already loaded, set corresponing bit
   TIter itList(cdbList);
@@ -4325,6 +4338,7 @@ void AliITSAlignMille2::ConstrainHelixFitPT(Int_t q,Double_t pt,Double_t pterr)
   fConstrCharge = q==0 ? q:TMath::Sign(1,q);
   fConstrPT = pt;
   fConstrPTErr = pterr;
+  fCurvFitWasConstrained = kTRUE;
 }
 
 //________________________________________________________________________________________________________
@@ -4338,10 +4352,12 @@ void AliITSAlignMille2::ConstrainHelixFitCurv(Int_t q,Double_t crv,Double_t crve
   if (crv<0 || IsZero(crv)) {
     fConstrPT    = -1;
     fConstrPTErr = -1;
+    fCurvFitWasConstrained = kFALSE;
   }
   else {
     fConstrPT    = TMath::Abs(1./crv*fBField*kCQConv);
     fConstrPTErr = crverr>1e-10 ? TMath::Abs(fConstrPT/crv*crverr) : 0.;
+    fCurvFitWasConstrained = kTRUE;
   }
 }
 
@@ -4715,7 +4731,7 @@ void AliITSAlignMille2::ProcessSDDPointInfo(const AliTrackPoint* pnt,Int_t sID,
     else                             vdrift += corr*1e-4;
     //
     // if IniRespSDD was used, it should be subtracted back, since it is accounted in the PreResp
-    if (fIniVDriftSDD&&fIniRespSDD) {
+    if (fIniVDriftSDD&&fIniRespSDD && (fPreVDriftSDD==0)) {
       double corr1 = fIniRespSDD->GetDeltaVDrift(sID, sddSide);
       if (fIniRespSDD->IsVDCorrMult()) vdrift *= (1-corr1);
       else vdrift -= corr1*1e-4;