fDiamondPointID(-1),
fDiamondModID(-1),
fCheckDiamondPoint(kDiamondCheckIfPrompt),
+ fFixCurvIfConstraned(kTRUE),
+ fCurvFitWasConstrained(kFALSE),
fConvAlgMatOld(100)
{
/// main constructor that takes input from configuration file
//________________________________________________________________________________________________________
Int_t AliITSAlignMille2::CheckConfigRecords(FILE* stream)
{
+ // check the correctness of the record
TString record,recTitle;
int lineCnt = 0;
rewind(stream);
if (k<0) return -1;
AliITSAlignMille2Module* md = GetMilleModule(k);
while (md && md->IsNotInConf()) md = md->GetParent();
- return md ? md->GetUniqueID() : -1;
+ if (md) return int(md->GetUniqueID());
+ else return -1;
}
//________________________________________________________________________________________________________
// finally send local equations to millepede
SetLocalEquations(md,nloceq);
fMillepede->SaveRecordData(); // RRR
+ fCurvFitWasConstrained = kFALSE; // restore default
//
return 0;
}
}
//________________________________________________________________________________________________________
-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))
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;
/// 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];
// 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;
for (Int_t i=0; i<nsma; i++) {
AliAlignObjParams *a = (AliAlignObjParams*)sma->UncheckedAt(i);
volid=a->GetVolUID();
- strcpy(st,a->GetSymName());
+ strncpy(st,a->GetSymName(),TMath::Min(sizeof(st),strlen(a->GetSymName())+1));
a->GetMatrix(m);
//
- sscanf(st,"%s",symname);
+ memset(symname,0,250*sizeof(char));
+ sscanf(st,"%249s",symname);
//
// decode module list
char *stp=strstr(st,"ModuleList:");
int idx[2200];
char spp[200]; int jp=0;
char cl[20];
- strcpy(st,stp);
+ strncpy(st,stp,TMath::Min(sizeof(st),strlen(stp)+1));
int l=strlen(st);
int j=0;
int n=0;
if (strlen(spp)) {
int k=strcspn(spp,"-");
if (k<int(strlen(spp))) { // c'e' il -
- strcpy(cl,&(spp[k+1]));
+ strncpy(cl,&(spp[k+1]), TMath::Min(sizeof(cl),strlen(&spp[k+1])+1));
spp[k]=0;
int ifrom=atoi(spp); int ito=atoi(cl);
for (int b=ifrom; b<=ito; b++) {
}
//________________________________________________________________________________________________________
-void AliITSAlignMille2::ConvertParamsToGlobal()
+void AliITSAlignMille2::ConvertParamsToGlobal() const
{
// convert params in local frame to global one
double pars[AliITSAlignMille2Module::kMaxParGeom];
}
//________________________________________________________________________________________________________
-void AliITSAlignMille2::ConvertParamsToLocal()
+void AliITSAlignMille2::ConvertParamsToLocal() const
{
// convert params in global frame to local one
double pars[AliITSAlignMille2Module::kMaxParGeom];
}
//________________________________________________________________________________________________________
-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);
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)
{
// 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);}
//
fConstrCharge = q==0 ? q:TMath::Sign(1,q);
fConstrPT = pt;
fConstrPTErr = pterr;
+ fCurvFitWasConstrained = kTRUE;
}
//________________________________________________________________________________________________________
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;
}
}
// SPD Sector -> Layer parentship is fake, need special treatment
if ( mdName.CountChar('/')==2 && mdName.BeginsWith("ITS/SPD") && // SPD sector
prName.CountChar('/')==1 && mdName.BeginsWith("ITS/SPD") ) // SPD Layer
- parent = parent ? parent->GetParent(): GetMilleModuleIfContained(prName.Data());
+ parent = parent->GetParent();//: GetMilleModuleIfContained(prName.Data());
}
//
AliAlignObjParams* preob = GetPrealignedObject(algname); // was it prealigned ?
// 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
//
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;