if (!fRefDataQA){
AliError(Form("Could not get object from entry '%s'\nPlease check!!!",entry->GetId().GetPath().Data()));
} else {
- fRefDataQA=(AliTPCdataQA*)fDataQA->Clone();
+ fRefDataQA=(AliTPCdataQA*)fRefDataQA->Clone();
}
delete entry;
}
Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT, Int_t side){
//
- // Get the correction of the drift velocity using the laser tracks calbration
+ // Get the correction of the drift velocity using the offline laser tracks calbration
//
// run - run number
// timeStamp - tim stamp in seconds
// side - 0 - A side, 1 - C side, 2 - mean from both sides
// Note in case no data form both A and C side - the value from active side used
TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run);
+
+ return GetVDriftTPCLaserTracksCommon(dist, timeStamp, deltaT, side, array);
+}
+
+Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracksOnline(Double_t &dist, Int_t /*run*/, Int_t timeStamp, Double_t deltaT, Int_t side){
+ //
+ // Get the correction of the drift velocity using the online laser tracks calbration
+ //
+ // run - run number
+ // timeStamp - tim stamp in seconds
+ // deltaT - integration period to calculate time0 offset
+ // side - 0 - A side, 1 - C side, 2 - mean from both sides
+ // Note in case no data form both A and C side - the value from active side used
+ TObjArray *array =AliTPCcalibDB::Instance()->GetCEfitsDrift();
+
+ Double_t dv = GetVDriftTPCLaserTracksCommon(dist, timeStamp, deltaT, side, array);
+ AliTPCParam *param =AliTPCcalibDB::Instance()->GetParameters();
+ if (!param) return 0;
+
+ //the drift velocity is hard wired in the AliTPCCalibCE class, since online there is no access to OCDB
+ dv*=param->GetDriftV()/2.61301900000000000e+06;
+ if (dv>1e-20) dv=1/dv-1;
+ else return 0;
+ // T/P correction
+ TObjArray* cearray =AliTPCcalibDB::Instance()->GetCEData();
+
+ AliTPCSensorTempArray *temp = (AliTPCSensorTempArray*)cearray->FindObject("TempMap");
+ AliDCSSensor *press = (AliDCSSensor*)cearray->FindObject("CavernAtmosPressure");
+
+ Double_t corrPTA=0;
+ Double_t corrPTC=0;
+
+ if (temp&&press) {
+ AliTPCCalibVdrift corr(temp,press,0);
+ corrPTA=corr.GetPTRelative(timeStamp,0);
+ corrPTC=corr.GetPTRelative(timeStamp,1);
+ }
+
+ if (side==0) dv -= corrPTA;
+ if (side==1) dv -= corrPTC;
+ if (side==2) dv -= (corrPTA+corrPTC)/2;
+
+ return dv;
+}
+
+Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracksCommon(Double_t &dist, Int_t timeStamp, Double_t deltaT,
+ Int_t side, TObjArray * const array){
+ //
+ // common drift velocity retrieval for online and offline method
+ //
TGraphErrors *grlaserA=0;
TGraphErrors *grlaserC=0;
Double_t vlaserA=0, vlaserC=0;
for (Int_t i=0; i<72;i++){
TGraph *graph= (TGraph*)arrT->At(i);
- if (!graph) continue;
+ if (!graph) continue;
+ graph->Sort();
if (graph->GetN()<kMinPoints){
arrT->AddAt(0,i);
delete graph; // delete empty graph
Double_t median = (isec%36<18) ? medianA: medianC;
Double_t rms = (isec%36<18) ? rmsA: rmsC;
Int_t naccept=0;
- for (Int_t ipoint=kMinPoints-1; ipoint<graph->GetN();ipoint++){
+ // for (Int_t ipoint=kMinPoints-1; ipoint<graph->GetN();ipoint++){ //not neccessary to remove first points
+ for (Int_t ipoint=0; ipoint<graph->GetN();ipoint++){
if (TMath::Abs(graph->GetY()[ipoint]-median)>cutAbs) continue;
if (TMath::Abs(graph->GetY()[ipoint]-median)>cutSigma*rms) continue;
vecX[naccept]= graph->GetX()[ipoint];
if (arrayP->GetEntries()<=0) return 0;
if (!arrayM) return 0;
if (arrayM->GetEntries()<=0) return 0;
+
Int_t entries = arrayP->GetEntriesFast();
TObjArray *array = new TObjArray(arrayP->GetEntriesFast());
+
for (Int_t i=0; i<entries; i++){
AliRelAlignerKalman * kalmanP = (AliRelAlignerKalman *) arrayP->UncheckedAt(i);
AliRelAlignerKalman * kalmanM = (AliRelAlignerKalman *) arrayM->UncheckedAt(i);
if (!kalmanP) continue;
if (!kalmanM) continue;
- AliRelAlignerKalman *kalman = new AliRelAlignerKalman(*kalmanP);
- kalman->Merge(kalmanM);
+
+ AliRelAlignerKalman *kalman = NULL;
+ if(kalmanP->GetRunNumber() != 0 && kalmanM->GetRunNumber() != 0) {
+ kalman = new AliRelAlignerKalman(*kalmanP);
+ kalman->Merge(kalmanM);
+ }
+ else if (kalmanP->GetRunNumber() == 0) {
+ kalman = new AliRelAlignerKalman(*kalmanM);
+ }
+ else if (kalmanM->GetRunNumber() == 0) {
+ kalman = new AliRelAlignerKalman(*kalmanP);
+ }
+ else
+ continue;
+
array->AddAt(kalman,i);
}
+
return array;
}