X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCcalibDB.cxx;h=ec3e9bb3d1d1fb05702dc457eac5c3e0ec47a623;hb=e658398a50b3844e1cca15b5eb43fdf2da17f2fe;hp=9b38f2a8df7daf057f554a1f4c7117b044f936ba;hpb=a8f8b6a12d61c574139f5e77370a2991c334e2ee;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCcalibDB.cxx b/TPC/AliTPCcalibDB.cxx index 9b38f2a8df7..ec3e9bb3d1d 100644 --- a/TPC/AliTPCcalibDB.cxx +++ b/TPC/AliTPCcalibDB.cxx @@ -82,11 +82,15 @@ #include #include +#include #include #include #include +#include #include "AliTPCcalibDB.h" +#include "AliTPCdataQA.h" +#include "AliTPCcalibDButil.h" #include "AliTPCAltroMapping.h" #include "AliTPCExB.h" @@ -175,6 +179,7 @@ AliTPCcalibDB::AliTPCcalibDB(): fPadNoise(0), fPedestals(0), fCalibRaw(0), + fDataQA(0), fALTROConfigData(0), fPulserData(0), fCEData(0), @@ -191,8 +196,9 @@ AliTPCcalibDB::AliTPCcalibDB(): fTemperatureArray(100000), //! array of temperature sensors - per run - Just for calibration studies fVdriftArray(100000), //! array of v drift interfaces fDriftCorrectionArray(100000), //! array of drift correction - fRunList(100000) //! run list - indicates try to get the run param - + fRunList(100000), //! run list - indicates try to get the run param + fDButil(0), + fCTPTimeParams(0) { // // constructor @@ -212,6 +218,7 @@ AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): fPadNoise(0), fPedestals(0), fCalibRaw(0), + fDataQA(0), fALTROConfigData(0), fPulserData(0), fCEData(0), @@ -228,7 +235,9 @@ AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): fTemperatureArray(0), //! array of temperature sensors - per run - Just for calibration studies fVdriftArray(0), //! array of v drift interfaces fDriftCorrectionArray(0), //! array of v drift interfaces - fRunList(0) //! run list - indicates try to get the run param + fRunList(0), //! run list - indicates try to get the run param + fDButil(0), + fCTPTimeParams(0) { // // Copy constructor invalid -- singleton implementation @@ -299,7 +308,7 @@ void AliTPCcalibDB::Update(){ AliCDBEntry * entry=0; Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache - + fDButil = new AliTPCcalibDButil; // entry = GetCDBEntry("TPC/Calib/PadGainFactor"); if (entry){ @@ -390,6 +399,12 @@ void AliTPCcalibDB::Update(){ TObjArray *arr=(TObjArray*)(entry->GetObject()); if (arr) fCalibRaw=(AliTPCCalibRaw*)arr->At(0); } + //QA calibration data + entry = GetCDBEntry("TPC/Calib/QA"); + if (entry){ + entry->SetOwner(kTRUE); + fDataQA=dynamic_cast(entry->GetObject()); + } entry = GetCDBEntry("TPC/Calib/Mapping"); if (entry){ @@ -404,7 +419,13 @@ void AliTPCcalibDB::Update(){ } } - + //QA calibration data + entry = GetCDBEntry("GRP/CTP/CTPtiming"); + if (entry){ + //entry->SetOwner(kTRUE); + fCTPTimeParams=dynamic_cast(entry->GetObject()); + } + //entry = GetCDBEntry("TPC/Calib/ExB"); //if (entry) { @@ -729,7 +750,44 @@ void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const cha } } +Int_t AliTPCcalibDB::GetRCUTriggerConfig() const +{ + // + // return the RCU trigger configuration register + // + TMap *map=GetRCUconfig(); + if (!map) return -1; + TVectorF *v=(TVectorF*)map->GetValue("TRGCONF_TRG_MODE"); + Float_t mode=-1; + for (Int_t i=0; iGetNrows(); ++i){ + Float_t newmode=v->GetMatrixArray()[i]; + if (newmode>-1){ + if (mode>-1&&newmode!=mode) AliWarning("Found different RCU trigger configurations!!!"); + mode=newmode; + } + } + return (Int_t)mode; +} + +Bool_t AliTPCcalibDB::IsTrgL0() +{ + // + // return if the FEE readout was triggered on L0 + // + Int_t mode=GetRCUTriggerConfig(); + if (mode<0) return kFALSE; + return (mode==1); +} +Bool_t AliTPCcalibDB::IsTrgL1() +{ + // + // return if the FEE readout was triggered on L1 + // + Int_t mode=GetRCUTriggerConfig(); + if (mode<0) return kFALSE; + return (mode==0); +} void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){ // @@ -793,8 +851,9 @@ void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){ // // - > Don't use it for reconstruction - Only for Calibration studies // + if (run<0) return; AliCDBEntry * entry = 0; - if (run>= fRunList.GetSize()){ + if (run>= fRunList.fN){ fRunList.Set(run*2+1); fGRPArray.Expand(run*2+1); fGRPMaps.Expand(run*2+1); @@ -804,8 +863,18 @@ void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){ fVdriftArray.Expand(run*2+1); fDriftCorrectionArray.Expand(run*2+1); fTimeGainSplinesArray.Expand(run*2+1); + // + // + fALTROConfigData->Expand(run*2+1); // ALTRO configuration data + fPulserData->Expand(run*2+1); // Calibration Pulser data + fCEData->Expand(run*2+1); // CE data + if (!fTimeGainSplines) fTimeGainSplines = new TObjArray(run*2+1); + fTimeGainSplines->Expand(run*2+1); // Array of AliSplineFits: at 0 MIP position in } if (fRunList[run]>0 &&force==kFALSE) return; + + fRunList[run]=1; // sign as used + // entry = AliCDBManager::Instance()->Get("GRP/GRP/Data",run); if (entry) { @@ -846,14 +915,31 @@ void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){ if (entry) { fTemperatureArray.AddAt(entry->GetObject(),run); } - fRunList[run]=1; // sign as used + //apply fDButil filters + + fDButil->UpdateFromCalibDB(); + if (fTemperature) fDButil->FilterTemperature(fTemperature); AliDCSSensor * press = GetPressureSensor(run,0); AliTPCSensorTempArray * temp = GetTemperatureSensor(run); - if (press && temp){ + Bool_t accept=kTRUE; + if (temp) { + accept = fDButil->FilterTemperature(temp)>0.1; + } + if (press) { + const Double_t kMinP=950.; + const Double_t kMaxP=1050.; + const Double_t kMaxdP=10.; + const Double_t kSigmaCut=4.; + fDButil->FilterSensor(press,kMinP,kMaxP,kMaxdP,kSigmaCut); + if (press->GetFit()==0) accept=kFALSE; + } + if (press && temp &&accept){ AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0); fVdriftArray.AddAt(vdrift,run); } + fDButil->FilterCE(120., 3., 4.,0); + fDButil->FilterTracks(run, 10.,0); } @@ -1486,27 +1572,59 @@ Bool_t AliTPCcalibDB::CreateGUITree(Int_t run, const char* filename) AliTPCcalibDB *db=AliTPCcalibDB::Instance(); // retrieve cal pad objects db->SetRun(run); + db->CreateGUITree(filename); + return kTRUE; +} + +Bool_t AliTPCcalibDB::CreateGUITree(const char* filename){ + // + // + // + if (!AliCDBManager::Instance()->GetDefaultStorage()){ + AliError("Default Storage not set. Cannot create calibration Tree!"); + return kFALSE; + } + AliTPCPreprocessorOnline prep; //noise and pedestals - prep.AddComponent(db->GetPedestals()); - prep.AddComponent(db->GetPadNoise()); + if (GetPedestals()) prep.AddComponent(new AliTPCCalPad(*(GetPedestals()))); + if (GetPadNoise() ) prep.AddComponent(new AliTPCCalPad(*(GetPadNoise()))); //pulser data - prep.AddComponent(db->GetPulserTmean()); - prep.AddComponent(db->GetPulserTrms()); - prep.AddComponent(db->GetPulserQmean()); + if (GetPulserTmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserTmean()))); + if (GetPulserTrms() ) prep.AddComponent(new AliTPCCalPad(*(GetPulserTrms()))); + if (GetPulserQmean()) prep.AddComponent(new AliTPCCalPad(*(GetPulserQmean()))); //CE data - prep.AddComponent(db->GetCETmean()); - prep.AddComponent(db->GetCETrms()); - prep.AddComponent(db->GetCEQmean()); + if (GetCETmean()) prep.AddComponent(new AliTPCCalPad(*(GetCETmean()))); + if (GetCETrms() ) prep.AddComponent(new AliTPCCalPad(*(GetCETrms()))); + if (GetCEQmean()) prep.AddComponent(new AliTPCCalPad(*(GetCEQmean()))); //Altro data - prep.AddComponent(db->GetALTROAcqStart() ); - prep.AddComponent(db->GetALTROZsThr() ); - prep.AddComponent(db->GetALTROFPED() ); - prep.AddComponent(db->GetALTROAcqStop() ); - prep.AddComponent(db->GetALTROMasked() ); + if (GetALTROAcqStart() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROAcqStart() ))); + if (GetALTROZsThr() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROZsThr() ))); + if (GetALTROFPED() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROFPED() ))); + if (GetALTROAcqStop() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROAcqStop() ))); + if (GetALTROMasked() ) prep.AddComponent(new AliTPCCalPad(*(GetALTROMasked() ))); + //QA + AliTPCdataQA *dataQA=GetDataQA(); + if (dataQA) { + if (dataQA->GetNLocalMaxima()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNLocalMaxima()))); + if (dataQA->GetMaxCharge()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMaxCharge()))); + if (dataQA->GetMeanCharge()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetMeanCharge()))); + if (dataQA->GetNoThreshold()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNoThreshold()))); + if (dataQA->GetNTimeBins()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNTimeBins()))); + if (dataQA->GetNPads()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetNPads()))); + if (dataQA->GetTimePosition()) + prep.AddComponent(new AliTPCCalPad(*(dataQA->GetTimePosition()))); + } + // TString file(filename); - if (file.IsNull()) file=Form("guiTreeRun_%d.root",run); + if (file.IsNull()) file=Form("guiTreeRun_%d.root",fRun); prep.DumpToFile(file.Data()); return kTRUE; } @@ -1556,7 +1674,7 @@ Bool_t AliTPCcalibDB::CreateRefFile(Int_t run, const char* filename) -Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t /*mode*/){ +Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t /*side*/, Int_t mode){ // // Get time dependent drift velocity correction // multiplication factor vd = vdnom *(1+vdriftcorr) @@ -1568,27 +1686,42 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_ // // Notice - Extrapolation outside of calibration range - using constant function // - if (run<=0 && fTransform) run = fTransform->GetCurrentRunNumber(); - UpdateRunInformations(run,kFALSE); - TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run); - if (!array) return 0; - TGraphErrors *laserA= (TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_A"); - TGraphErrors *laserC= (TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_C"); - - Double_t result=0; - if (laserA && laserC){ - result= (laserA->Eval(timeStamp)+laserC->Eval(timeStamp))*0.5; - } - if (laserA && side==0){ - result = (laserA->Eval(timeStamp)); - } - if (laserC &&side==1){ - result = (laserC->Eval(timeStamp)); + Double_t result; + // mode 1 automatic mode - according to the distance to the valid calibration + // - + Double_t deltaP=0, driftP=0, wP = 0.; + Double_t deltaITS=0,driftITS=0, wITS= 0.; + Double_t deltaLT=0, driftLT=0, wLT = 0.; + Double_t deltaCE=0, driftCE=0, wCE = 0.; + driftP = fDButil->GetVDriftTPC(deltaP,run,timeStamp); + driftITS= fDButil->GetVDriftTPCITS(deltaITS,run,timeStamp); + driftCE = fDButil->GetVDriftTPCCE(deltaCE, run,timeStamp,36000,2); + driftLT = fDButil->GetVDriftTPCLaserTracks(deltaLT,run,timeStamp,36000,2); + deltaITS = TMath::Abs(deltaITS); + deltaP = TMath::Abs(deltaP); + deltaLT = TMath::Abs(deltaLT); + deltaCE = TMath::Abs(deltaCE); + if (mode==1) { + const Double_t kEpsilon=0.00000000001; + const Double_t kdeltaT=360.; // 10 minutes + wITS = 64.*kdeltaT/(deltaITS +kdeltaT); + wLT = 16.*kdeltaT/(deltaLT +kdeltaT); + wP = 0. *kdeltaT/(deltaP +kdeltaT); + wCE = 1. *kdeltaT/(deltaCE +kdeltaT); + // + // + if (TMath::Abs(driftP)GetCurrentRunNumber(); - UpdateRunInformations(run,kFALSE); - TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run); - if (!array) return 0; - TGraphErrors *laserA= (TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_A"); - TGraphErrors *laserC= (TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_C"); - - Double_t lresult=0; - if (laserA && laserC){ - lresult= (laserA->Eval(timeStamp)+laserC->Eval(timeStamp))*0.5; - } - if (laserA && side==0){ - lresult = (laserA->Eval(timeStamp)); - } - if (laserC &&side==1){ - lresult = (laserC->Eval(timeStamp)); + Double_t result=0; + if (mode==2) { + // TPC-TPC mode + result=fDButil->GetTriggerOffsetTPC(run,timeStamp); + result *=fParam->GetZLength(); } - TGraphErrors *cosmic =(TGraphErrors*)array->FindObject("TGRAPHERRORS_MEAN_VDRIFT_COSMICS_ALL"); - if (cosmic){ - Double_t cresult =cosmic->Eval(timeStamp); - Double_t result =(cresult-lresult)*fParam->GetZLength(); - return result; + if (mode==1){ + // TPC-ITS mode + Double_t dist=0; + result= -fDButil->GetTime0TPCITS(dist, run, timeStamp)*fParam->GetDriftV()/1000000.; } - return 0; + return result; } @@ -1663,3 +1784,6 @@ Double_t AliTPCcalibDB::GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t } return -result/250.; //normalized before } + + +