X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCcalibDB.cxx;h=892bf51e2f6ba50a28c7ce41184df7d7629beda2;hb=4c2c255c9f7c4256ced5820dfe710eb26113badd;hp=0d19f8fde41a90914054b312a0c234533f10dec3;hpb=12e42756511363faa1cb25f4d5ab63a13e8ea8b9;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCcalibDB.cxx b/TPC/AliTPCcalibDB.cxx index 0d19f8fde41..892bf51e2f6 100644 --- a/TPC/AliTPCcalibDB.cxx +++ b/TPC/AliTPCcalibDB.cxx @@ -84,7 +84,6 @@ #include #include #include -#include #include "AliTPCcalibDB.h" #include "AliTPCAltroMapping.h" @@ -173,11 +172,16 @@ AliTPCcalibDB::AliTPCcalibDB(): fTemperature(0), fMapping(0), fParam(0), - fClusterParam(0), + fClusterParam(0), + fTimeGainSplines(0), + fTimeGainSplinesArray(100000), fGRPArray(100000), //! array of GRPs - per run - JUST for calibration studies + fGRPMaps(100000), //! array of GRPs - per run - JUST for calibration studies fGoofieArray(100000), //! array of GOOFIE values -per run - Just for calibration studies + fVoltageArray(100000), 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 { @@ -202,10 +206,15 @@ AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ): fMapping(0), fParam(0), fClusterParam(0), + fTimeGainSplines(0), + fTimeGainSplinesArray(100000), fGRPArray(0), //! array of GRPs - per run - JUST for calibration studies + fGRPMaps(0), //! array of GRPs - per run - JUST for calibration studies fGoofieArray(0), //! array of GOOFIE values -per run - Just for calibration studies + fVoltageArray(0), 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 { // @@ -266,15 +275,15 @@ void AliTPCcalibDB::SetRun(Long64_t run) // if (fRun == run) return; - fRun = run; + fRun = run; Update(); } void AliTPCcalibDB::Update(){ - // - AliCDBEntry * entry=0; + // + AliCDBEntry * entry=0; Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag(); // save cache status AliCDBManager::Instance()->SetCacheFlag(kTRUE); // activate CDB cache @@ -287,6 +296,13 @@ void AliTPCcalibDB::Update(){ fPadGainFactor = (AliTPCCalPad*)entry->GetObject(); } // + entry = GetCDBEntry("TPC/Calib/TimeGain"); + if (entry){ + //if (fTimeGainSplines) delete fTimeGainSplines; + entry->SetOwner(kTRUE); + fTimeGainSplines = (TObjArray*)entry->GetObject(); + } + // entry = GetCDBEntry("TPC/Calib/GainFactorDedx"); if (entry){ entry->SetOwner(kTRUE); @@ -363,6 +379,7 @@ void AliTPCcalibDB::Update(){ // if (!fTransform) { fTransform=new AliTPCTransform(); + fTransform->SetCurrentRun(AliCDBManager::Instance()->GetRun()); } // @@ -684,7 +701,7 @@ void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){ Float_t factor = bz/(-5.); // default b filed in Cheb with minus sign - AliMagF* bmap = new AliMagWrapCheb("MapsExB","MapsExB", 2, factor, 10., AliMagWrapCheb::k5kG,kTRUE,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root"); + AliMagF* bmap = new AliMagF("MapsExB","MapsExB", 2,factor,1., 10.,AliMagF::k5kG,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root"); AliTPCExBFirst *exb = new AliTPCExBFirst(bmap,0.88*2.6400e+04,50,50,50); AliTPCExB::SetInstance(exb); @@ -721,7 +738,9 @@ void AliTPCcalibDB::SetExBField(Float_t bz){ -void AliTPCcalibDB::GetRunInformations( Int_t run){ + + +void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){ // // - > Don't use it for reconstruction - Only for Calibration studies // @@ -729,20 +748,58 @@ void AliTPCcalibDB::GetRunInformations( Int_t run){ if (run>= fRunList.GetSize()){ fRunList.Set(run*2+1); fGRPArray.Expand(run*2+1); - fGoofieArray.Expand(run*2+1); + fGRPMaps.Expand(run*2+1); + fGoofieArray.Expand(run*2+1); + fVoltageArray.Expand(run*2+1); fTemperatureArray.Expand(run*2+1); fVdriftArray.Expand(run*2+1); + fDriftCorrectionArray.Expand(run*2+1); + fTimeGainSplinesArray.Expand(run*2+1); } - if (fRunList[run]>0) return; + if (fRunList[run]>0 &&force==kFALSE) return; + // entry = AliCDBManager::Instance()->Get("GRP/GRP/Data",run); - if (entry) fGRPArray.AddAt(entry->GetObject(),run); + if (entry) { + AliGRPObject * grpRun = dynamic_cast(entry->GetObject()); + if (!grpRun){ + TMap* map = dynamic_cast(entry->GetObject()); + if (map){ + //grpRun = new AliGRPObject; + //grpRun->ReadValuesFromMap(map); + grpRun = MakeGRPObjectFromMap(map); + + fGRPMaps.AddAt(map,run); + } + } + fGRPArray.AddAt(grpRun,run); + } entry = AliCDBManager::Instance()->Get("TPC/Calib/Goofie",run); - if (entry) fGoofieArray.AddAt(entry->GetObject(),run); + if (entry){ + fGoofieArray.AddAt(entry->GetObject(),run); + } + // + entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",run); + if (entry) { + fVoltageArray.AddAt(entry->GetObject(),run); + } + // + entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGain",run); + if (entry) { + fTimeGainSplinesArray.AddAt(entry->GetObject(),run); + } + // + entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeDrift",run); + if (entry) { + fDriftCorrectionArray.AddAt(entry->GetObject(),run); + } + // entry = AliCDBManager::Instance()->Get("TPC/Calib/Temperature",run); - if (entry) fTemperatureArray.AddAt(entry->GetObject(),run); + if (entry) { + fTemperatureArray.AddAt(entry->GetObject(),run); + } fRunList[run]=1; // sign as used - AliDCSSensor * press = GetPressureSensor(run); + AliDCSSensor * press = GetPressureSensor(run,0); AliTPCSensorTempArray * temp = GetTemperatureSensor(run); if (press && temp){ AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0); @@ -766,21 +823,52 @@ AliGRPObject *AliTPCcalibDB::GetGRP(Int_t run){ // AliGRPObject * grpRun = dynamic_cast((Instance()->fGRPArray).At(run)); if (!grpRun) { - Instance()->GetRunInformations(run); + Instance()->UpdateRunInformations(run); grpRun = dynamic_cast(Instance()->fGRPArray.At(run)); if (!grpRun) return 0; } return grpRun; } +TMap * AliTPCcalibDB::GetGRPMap(Int_t run){ + // + // + // + TMap * grpRun = dynamic_cast((Instance()->fGRPMaps).At(run)); + if (!grpRun) { + Instance()->UpdateRunInformations(run); + grpRun = dynamic_cast(Instance()->fGRPMaps.At(run)); + if (!grpRun) return 0; + } + return grpRun; +} AliDCSSensor * AliTPCcalibDB::GetPressureSensor(Int_t run, Int_t type){ // + // Get Pressure sensor + // run = run number + // type = 0 - Cavern pressure + // 1 - Suface pressure + // First try to get if trom map - if existing (Old format of data storing) // - AliGRPObject * grpRun = dynamic_cast(fGRPArray.At(run)); + + + TMap *map = GetGRPMap(run); + if (map){ + AliDCSSensor * sensor = 0; + TObject *osensor=0; + if (type==0) osensor = ((*map)("fCavernPressure")); + if (type==1) osensor = ((*map)("fP2Pressure")); + sensor =dynamic_cast(osensor); + if (sensor) return sensor; + } + // + // If not map try to get it from the GRPObject + // + AliGRPObject * grpRun = dynamic_cast(fGRPArray.At(run)); if (!grpRun) { - GetRunInformations(run); + UpdateRunInformations(run); grpRun = dynamic_cast(fGRPArray.At(run)); if (!grpRun) return 0; } @@ -795,38 +883,75 @@ AliTPCSensorTempArray * AliTPCcalibDB::GetTemperatureSensor(Int_t run){ // AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); if (!tempArray) { - GetRunInformations(run); + UpdateRunInformations(run); tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run); } return tempArray; } + +TObjArray * AliTPCcalibDB::GetTimeGainSplinesRun(Int_t run){ + // + // Get temperature sensor array + // + TObjArray * gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run); + if (!gainSplines) { + UpdateRunInformations(run); + gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run); + } + return gainSplines; +} + +AliDCSSensorArray * AliTPCcalibDB::GetVoltageSensors(Int_t run){ + // + // Get temperature sensor array + // + AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run); + if (!voltageArray) { + UpdateRunInformations(run); + voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run); + } + return voltageArray; +} + AliDCSSensorArray * AliTPCcalibDB::GetGoofieSensors(Int_t run){ // // Get temperature sensor array // AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); if (!goofieArray) { - GetRunInformations(run); + UpdateRunInformations(run); goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run); } return goofieArray; } + + AliTPCCalibVdrift * AliTPCcalibDB::GetVdrift(Int_t run){ // // Get the interface to the the vdrift // AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.At(run); if (!vdrift) { - GetRunInformations(run); + UpdateRunInformations(run); vdrift= (AliTPCCalibVdrift*)fVdriftArray.At(run); } return vdrift; } - +Float_t AliTPCcalibDB::GetChamberHighVoltage(Int_t timeStamp, Int_t run, Int_t sector) { + // + // return the chamber HV for given run and time: 0-35 IROC, 36-72 OROC + // + TTimeStamp stamp(timeStamp); + AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(run); + if (!voltageArray) return 0; + AliDCSSensor *sensor = voltageArray->GetSensor((sector+1)*3); + if (!sensor) return 0; + return sensor->GetValue(stamp); +} Float_t AliTPCcalibDB::GetPressure(Int_t timeStamp, Int_t run, Int_t type){ // @@ -835,7 +960,6 @@ Float_t AliTPCcalibDB::GetPressure(Int_t timeStamp, Int_t run, Int_t type){ TTimeStamp stamp(timeStamp); AliDCSSensor * sensor = Instance()->GetPressureSensor(run,type); if (!sensor) return 0; - if (!sensor->GetFit()) return 0; return sensor->GetValue(stamp); } @@ -1043,3 +1167,38 @@ void AliTPCcalibDB::ProcessGoofie( AliDCSSensorArray* goofieArray, TVectorD & ve } } + + +AliGRPObject * AliTPCcalibDB::MakeGRPObjectFromMap(TMap *map){ + // + // Function to covert old GRP run information from TMap to GRPObject + // + // TMap * map = AliTPCcalibDB::GetGRPMap(52406); + if (!map) return 0; + AliDCSSensor * sensor = 0; + TObject *osensor=0; + osensor = ((*map)("fP2Pressure")); + sensor =dynamic_cast(osensor); + // + if (!sensor) return 0; + // + AliDCSSensor * sensor2 = new AliDCSSensor(*sensor); + osensor = ((*map)("fCavernPressure")); + TGraph * gr = new TGraph(2); + gr->GetX()[0]= -100000.; + gr->GetX()[1]= 1000000.; + gr->GetY()[0]= atof(osensor->GetName()); + gr->GetY()[1]= atof(osensor->GetName()); + sensor2->SetGraph(gr); + sensor2->SetFit(0); + + + AliGRPObject *grpRun = new AliGRPObject; + grpRun->ReadValuesFromMap(map); + grpRun->SetCavernAtmosPressure(sensor2); + grpRun->SetSurfaceAtmosPressure(sensor); + return grpRun; +} + + +