]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSAlignMille2.cxx
Fixes for wrong use of const causing PW.CAST_TO_QUALIFIED_TYPE defect in Coverity
[u/mrichter/AliRoot.git] / ITS / AliITSAlignMille2.cxx
index 84fe5fcd77eb179f0983cf5462b6fe6a2731b88d..80c6a439e33a4966b34901e90f6fa78ec57449fd 100644 (file)
@@ -323,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);
@@ -2560,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))
@@ -3234,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
@@ -3864,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];
@@ -3878,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];
@@ -3980,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);
@@ -4146,6 +4147,50 @@ Int_t AliITSAlignMille2::LoadSDDCorrMap(TString& path, AliITSCorrectSDDPoints *&
   return 0;
 }
 
+//________________________________________________________________________________________________________
+Int_t AliITSAlignMille2::LoadPreSDDCalib()
+{
+  // Load SDD correction map for prealignment from current CDB
+  //
+  AliInfo(Form("Loading SDD Calibration set for run %d",fRunID));
+  AliCDBManager* man = AliCDBManager::Instance();
+  man->SetRun(fRunID);
+  AliCDBEntry *entry = man->Get("ITS/Calib/MapsTimeSDD");
+  if(!entry){
+    AliError("Error accessing OCDB: SDD maps not found");
+    return -1;
+  }
+  delete fPreCorrMapSDD;
+  TObjArray* arr = (TObjArray*) entry->GetObject();
+  entry->SetObject(NULL);
+  entry->SetOwner(kTRUE);
+  arr->SetOwner(kTRUE);
+  fPreCorrMapSDD = new AliITSCorrectSDDPoints(arr);
+  //
+  entry = man->Get("ITS/Calib/RespSDD");
+  if(!entry){
+    AliError("Error accessing OCDB: SDD response not found");
+    return -1;
+  }
+  delete fPreRespSDD;
+  fPreRespSDD = (AliITSresponseSDD*) entry->GetObject();
+  entry->SetObject(NULL);
+  entry->SetOwner(kTRUE);
+  //
+  entry = man->Get("ITS/Calib/DriftSpeedSDD");
+  if(!entry){
+    AliError("Error accessing OCDB: SDD Drift speed not found");
+    return -1;
+  }
+  delete fPreVDriftSDD;
+  fPreVDriftSDD = (TObjArray*) entry->GetObject();
+  entry->SetObject(NULL);
+  entry->SetOwner(kTRUE);
+  delete entry;
+  //
+  return 0;
+}
+
 //________________________________________________________________________________________________________
 Int_t AliITSAlignMille2::LoadDiamond(TString& path)
 {
@@ -4272,7 +4317,7 @@ Int_t AliITSAlignMille2::CacheMatricesOrig()
   // build arrays for the fast access to sensor original matrices (used for production)
   //
   TGeoHMatrix mdel;
-  AliInfo("Building sensors original matrices cache");
+  AliInfo(Form("Building sensors original matrices cache. InitDeltaPath: %s",fIniDeltaPath.Data()));
   //
   /*if (fIniGeomPath!=fGeometryPath)*/ if (LoadGeometry(fIniGeomPath)) {AliInfo("Failed to re-load ideal geometry");exit(1);}
   //
@@ -4562,6 +4607,7 @@ Int_t AliITSAlignMille2::ReloadInitCalib()
   // Load the initial calib parameters (geometry, SDD response...)
   // Can be used if set of data was processed with different calibration
   //
+  AliInfo(Form("SameInitDelta: %d | SameInitGeom: %d",TestBit(kSameInitDeltasBit), TestBit(kSameInitGeomBit)));
   // 1st cache original matrices
   if (!(TestBit(kSameInitDeltasBit) && TestBit(kSameInitGeomBit))) { // need to reload geometry
     //
@@ -4730,7 +4776,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;
@@ -4963,4 +5009,3 @@ AliAlignObjParams* AliITSAlignMille2::ConvFindDelta(const TClonesArray* arrDelta
   }
   return delta;
 }
-