// Simulation: applied in the AliTPC::MakeSector - adding offset
// Reconstruction: AliTPCTransform::Transform() - remove offset
// AliTPCTransform::Transform() - to be called
-// in AliTPCtracker::Transform()
+// in AliTPCtrackerMI::Transform()
//
//
// 2.) Space points transformation:
#include "AliTPCCalibRaw.h"
#include "AliTPCParam.h"
#include "AliTPCCorrection.h"
+#include "AliTPCComposedCorrection.h"
#include "AliTPCPreprocessorOnline.h"
-
+#include "AliTimeStamp.h"
+#include "AliTriggerRunScalers.h"
+#include "AliTriggerScalers.h"
+#include "AliTriggerScalersRecord.h"
ClassImp(AliTPCcalibDB)
{
//
// Singleton implementation
- // Returns an instance of this class, it is created if neccessary
+ // Returns an instance of this class, it is created if necessary
//
if (fgTerminated != kFALSE)
fTransform(0),
fExB(0),
fPadGainFactor(0),
+ fActiveChannelMap(0),
fDedxGainFactor(0),
fPadTime0(0),
fDistortionMap(0),
fCalibRaw(0),
fDataQA(0),
fALTROConfigData(0),
+ fIonTailArray(0),
fPulserData(0),
fCEData(0),
+ fHVsensors(),
+ fGrRunState(0x0),
fTemperature(0),
fMapping(0),
fParam(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
+ fTimeGainSplinesArray(1),
+ fGRPArray(1), //! array of GRPs - per run - JUST for calibration studies
+ fGRPMaps(1), //! array of GRPs - per run - JUST for calibration studies
+ fGoofieArray(1), //! array of GOOFIE values -per run - Just for calibration studies
+ fVoltageArray(1),
+ fTemperatureArray(1), //! array of temperature sensors - per run - Just for calibration studies
+ fVdriftArray(1), //! array of v drift interfaces
+ fDriftCorrectionArray(1), //! array of drift correction
+ fRunList(1), //! run list - indicates try to get the run param
+ fBHasAlignmentOCDB(kFALSE), // Flag - has the alignment on the composed correction ?
fDButil(0),
- fCTPTimeParams(0)
+ fCTPTimeParams(0),
+ fMode(-1)
{
//
// constructor
//
//
fgInstance=this;
+ for (Int_t i=0;i<72;++i){
+ fChamberHVStatus[i]=kTRUE;
+ fChamberHVmedian[i]=-1;
+ fCurrentNominalVoltage[i]=0.;
+ fChamberHVgoodFraction[i]=0.;
+ }
Update(); // temporary
+ fTimeGainSplinesArray.SetOwner(); //own the keys
+ fGRPArray.SetOwner(); //own the keys
+ fGRPMaps.SetOwner(); //own the keys
+ fGoofieArray.SetOwner(); //own the keys
+ fVoltageArray.SetOwner(); //own the keys
+ fTemperatureArray.SetOwner(); //own the keys
+ fVdriftArray.SetOwner(); //own the keys
+ fDriftCorrectionArray.SetOwner(); //own the keys
}
AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& ):
fTransform(0),
fExB(0),
fPadGainFactor(0),
+ fActiveChannelMap(0),
fDedxGainFactor(0),
fPadTime0(0),
fDistortionMap(0),
fCalibRaw(0),
fDataQA(0),
fALTROConfigData(0),
+ fIonTailArray(0),
fPulserData(0),
fCEData(0),
+ fHVsensors(),
+ fGrRunState(0x0),
fTemperature(0),
fMapping(0),
fParam(0),
fClusterParam(0),
fTimeGainSplines(0),
- fTimeGainSplinesArray(100000),
+ fTimeGainSplinesArray(1),
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
fVdriftArray(0), //! array of v drift interfaces
fDriftCorrectionArray(0), //! array of v drift corrections
fRunList(0), //! run list - indicates try to get the run param
+ fBHasAlignmentOCDB(kFALSE), // Flag - has the alignment on the composed correction ?
fDButil(0),
- fCTPTimeParams(0)
+ fCTPTimeParams(0),
+ fMode(-1)
{
//
// Copy constructor invalid -- singleton implementation
//
- Error("copy constructor","invalid -- singleton implementation");
+ Error("copy constructor","invalid -- singleton implementation");
+ for (Int_t i=0;i<72;++i){
+ fChamberHVStatus[i]=kTRUE;
+ fChamberHVmedian[i]=-1;
+ fCurrentNominalVoltage[i]=0.;
+ fChamberHVgoodFraction[i]=0.;
+ }
+ fTimeGainSplinesArray.SetOwner(); //own the keys
+ fGRPArray.SetOwner(); //own the keys
+ fGRPMaps.SetOwner(); //own the keys
+ fGoofieArray.SetOwner(); //own the keys
+ fVoltageArray.SetOwner(); //own the keys
+ fTemperatureArray.SetOwner(); //own the keys
+ fVdriftArray.SetOwner(); //own the keys
+ fDriftCorrectionArray.SetOwner(); //own the keys
}
AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& )
// destructor
//
+ delete fActiveChannelMap;
+ delete fGrRunState;
}
AliTPCCalPad* AliTPCcalibDB::GetDistortionMap(Int_t i) const {
//
AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
if (!entry)
{
- sprintf(chinfo,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
+ snprintf(chinfo,1000,"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
AliError(chinfo);
return 0;
}
entry->SetOwner(kTRUE);
fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry TPC/Calib/PadGainFactor")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/PadGainFactor");
}
//
entry = GetCDBEntry("TPC/Calib/TimeGain");
entry->SetOwner(kTRUE);
fTimeGainSplines = (TObjArray*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry TPC/Calib/Timegain")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/Timegain");
}
//
entry = GetCDBEntry("TPC/Calib/GainFactorDedx");
entry->SetOwner(kTRUE);
fDedxGainFactor = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry TPC/Calib/gainFactordEdx")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/gainFactordEdx");
}
//
entry = GetCDBEntry("TPC/Calib/PadTime0");
entry->SetOwner(kTRUE);
fPadTime0 = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry");
}
entry = GetCDBEntry("TPC/Calib/Distortion");
entry->SetOwner(kTRUE);
fPadNoise = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry");
}
entry = GetCDBEntry("TPC/Calib/Pedestals");
if (entry){
//if (fPadNoise) delete fPadNoise;
entry->SetOwner(kTRUE);
- fParam = (AliTPCParam*)(entry->GetObject()->Clone());
+ fParam = (AliTPCParam*)(entry->GetObject());
}else{
- AliFatal("TPC - Missing calibration entry TPC/Calib/Parameters")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/Parameters");
}
entry = GetCDBEntry("TPC/Calib/ClusterParam");
if (entry){
entry->SetOwner(kTRUE);
- fClusterParam = (AliTPCClusterParam*)(entry->GetObject()->Clone());
+ fClusterParam = (AliTPCClusterParam*)(entry->GetObject());
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry");
}
//ALTRO configuration data
entry->SetOwner(kTRUE);
fALTROConfigData=(TObjArray*)(entry->GetObject());
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry");
}
//Calibration Pulser data
fPulserData=(TObjArray*)(entry->GetObject());
}
+ //Calibration ION tail data
+ // entry = GetCDBEntry("TPC/Calib/IonTail");
+// if (entry){
+// entry->SetOwner(kTRUE);
+// fIonTailArray=(TObjArray*)(entry->GetObject());
+// }
+
+
//CE data
entry = GetCDBEntry("TPC/Calib/CE");
if (entry){
}
//RAW calibration data
// entry = GetCDBEntry("TPC/Calib/Raw");
-
+
entry = GetCDBEntry("TPC/Calib/Mapping");
if (entry){
//if (fPadNoise) delete fPadNoise;
//entry->SetOwner(kTRUE);
fCTPTimeParams=dynamic_cast<AliCTPTimeParams*>(entry->GetObject());
}else{
- AliError("TPC - Missing calibration entry")
+ AliError("TPC - Missing calibration entry");
}
//TPC space point correction data
entry = GetCDBEntry("TPC/Calib/Correction");
fComposedCorrectionArray=dynamic_cast<TObjArray*>(entry->GetObject());
if (fComposedCorrectionArray){
for (Int_t i=0; i<fComposedCorrectionArray->GetEntries(); i++){
- AliTPCCorrection* composedCorrection= dynamic_cast<AliTPCCorrection*>(fComposedCorrectionArray->At(i));
- if (composedCorrection) composedCorrection->Init();
+ AliTPCComposedCorrection* composedCorrection= dynamic_cast<AliTPCComposedCorrection*>(fComposedCorrectionArray->At(i));
+ if (composedCorrection) {
+ composedCorrection->Init();
+ if (composedCorrection->GetCorrections()){
+ if (composedCorrection->GetCorrections()->FindObject("FitAlignTPC")){
+ fBHasAlignmentOCDB=kTRUE;
+ }
+ }
+ }
}
- }
+ }
}else{
- AliError("TPC - Missing calibration entry- TPC/Calib/Correction")
- }
-
+ AliError("TPC - Missing calibration entry- TPC/Calib/Correction");
+ }
+ //RCU trigger config mode
+ fMode=GetRCUTriggerConfig();
//
if (!fTransform) {
fTransform=new AliTPCTransform();
fTransform->SetCurrentRun(AliCDBManager::Instance()->GetRun());
}
+ // Chamber HV data
+ // needs to be called before InitDeadMap
+ UpdateChamberHighVoltageData();
+
+ // Create Dead Channel Map
+ InitDeadMap();
+
//
AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
}
fDataQA=dynamic_cast<AliTPCdataQA*>(entry->GetObject());
}
// High voltage
- if (fRun>=0){
+ if (fRun>=0 && !fVoltageArray.GetValue(Form("%i",fRun))){
entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",fRun);
if (entry) {
- fVoltageArray.AddAt(entry->GetObject(),fRun);
+ fVoltageArray.Add(new TObjString(Form("%i",fRun)),entry->GetObject());
}
}
TObjString *sObjType = (TObjString*)(arrNextCol->At(0));
TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1));
-
+ delete arrNextCol;
+
if ( !sObjType || ! sObjFileName ) continue;
TString sType(sObjType->GetString());
TString sFileName(sObjFileName->GetString());
- printf("%s\t%s\n",sType.Data(),sFileName.Data());
+// printf("%s\t%s\n",sType.Data(),sFileName.Data());
TFile *fIn = TFile::Open(sFileName);
if ( !fIn ){
}
delete fIn;
}
+ delete arrFileLine;
}
+Int_t AliTPCcalibDB::InitDeadMap() {
+ // Initialize DeadChannel Map
+ // Source of information:
+ // - HV (see UpdateChamberHighVoltageData())
+ // - Altro disabled channels. Noisy channels.
+ // - DDL list
+
+ // check necessary information
+ const Int_t run=GetRun();
+ if (run<0){
+ AliError("run not set in CDB manager. Cannot create active channel map");
+ return 0;
+ }
+ AliDCSSensorArray* voltageArray = GetVoltageSensors(run);
+ AliTPCCalPad* altroMap = GetALTROMasked();
+ TMap* mapddl = GetDDLMap();
+
+ if (!voltageArray && !altroMap && !mapddl) {
+ AliError("All necessary information to create the activate channel are map missing.");
+ return 0;
+ }
+
+ //=============================================================
+ // Setup DDL map
+
+ Bool_t ddlMap[216]={0};
+ for (Int_t iddl=0; iddl<216; ++iddl) ddlMap[iddl]=1;
+ if (mapddl){
+ TObjString *s = (TObjString*)mapddl->GetValue("DDLArray");
+ if (s){
+ for (Int_t iddl=0; iddl<216; ++iddl) ddlMap[iddl]=TString(s->GetString()(iddl))!="0";
+ }
+ } else {
+ AliError("DDL map missing. ActiveChannelMap can only be created with parts of the information.");
+ }
+ // Setup DDL map done
+ // ============================================================
+
+ //=============================================================
+ // Setup active chnnel map
+ //
+
+ if (!fActiveChannelMap) fActiveChannelMap=new AliTPCCalPad("ActiveChannelMap","ActiveChannelMap");
+ AliTPCmapper map(gSystem->ExpandPathName("$ALICE_ROOT/TPC/mapping/"));
+
+ if (!altroMap) AliError("ALTRO dead channel map missing. ActiveChannelMap can only be created with parts of the information.");
+
+ for (Int_t iROC=0;iROC<AliTPCCalPad::kNsec;++iROC){
+ AliTPCCalROC *roc=fActiveChannelMap->GetCalROC(iROC);
+ if (!roc){
+ AliError(Form("No ROC %d in active channel map",iROC));
+ continue;
+ }
+
+ // check for bad voltage
+ // see UpdateChamberHighVoltageData()
+ if (!fChamberHVStatus[iROC]){
+ roc->Multiply(0.);
+ continue;
+ }
+
+ AliTPCCalROC *masked=0x0;
+ if (altroMap) masked=altroMap->GetCalROC(iROC);
+
+ for (UInt_t irow=0; irow<roc->GetNrows(); ++irow){
+ for (UInt_t ipad=0; ipad<roc->GetNPads(irow); ++ipad){
+ //per default the channel is on
+ roc->SetValue(irow,ipad,1);
+ // apply altro dead channel mask (inverse logik, it is not active, but inactive channles)
+ if (masked && masked->GetValue(irow, ipad)) roc->SetValue(irow, ipad ,0);
+ // mask channels if a DDL is inactive
+ Int_t ddlId=map.GetEquipmentID(iROC, irow, ipad)-768;
+ if (ddlId>=0 && !ddlMap[ddlId]) roc->SetValue(irow, ipad ,0);
+ }
+ }
+ }
+
+ return 1;
+}
void AliTPCcalibDB::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) {
//
//
// return if the FEE readout was triggered on L0
//
- Int_t mode=GetRCUTriggerConfig();
- if (mode<0) return kFALSE;
- return (mode==1);
+ if (fMode<0) return kFALSE;
+ return (fMode==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);
+ if (fMode<0) return kFALSE;
+ return (fMode==0);
}
void AliTPCcalibDB::RegisterExB(Int_t index, Float_t bz, Bool_t bdelete){
-
-
void AliTPCcalibDB::UpdateRunInformations( Int_t run, Bool_t force){
//
// - > Don't use it for reconstruction - Only for Calibration studies
//
if (run<=0) return;
+ TObjString runstr(Form("%i",run));
fRun=run;
AliCDBEntry * entry = 0;
if (run>= fRunList.fN){
fRunList.Set(run*2+1);
- fGRPArray.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);
//
//
fALTROConfigData->Expand(run*2+1); // ALTRO configuration data
//grpRun->ReadValuesFromMap(map);
grpRun = MakeGRPObjectFromMap(map);
- fGRPMaps.AddAt(map,run);
+ fGRPMaps.Add(new TObjString(runstr),map);
}
}
- fGRPArray.AddAt(grpRun,run);
+ fGRPArray.Add(new TObjString(runstr),grpRun);
}
entry = AliCDBManager::Instance()->Get("TPC/Calib/Goofie",run);
if (entry){
- fGoofieArray.AddAt(entry->GetObject(),run);
+ fGoofieArray.Add(new TObjString(runstr),entry->GetObject());
}
//
//
entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGain",run);
if (entry) {
- fTimeGainSplinesArray.AddAt(entry->GetObject(),run);
+ fTimeGainSplinesArray.Add(new TObjString(runstr),entry->GetObject());
}else{
- AliFatal("TPC - Missing calibration entry TimeGain")
+ AliFatal("TPC - Missing calibration entry TimeGain");
}
//
entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeDrift",run);
if (entry) {
- fDriftCorrectionArray.AddAt(entry->GetObject(),run);
+ TObjArray * timeArray = (TObjArray*)entry->GetObject();
+ fDriftCorrectionArray.Add(new TObjString(runstr),entry->GetObject());
+ AliTPCCorrection * correctionTime = (AliTPCCorrection *)timeArray->FindObject("FitCorrectionTime");
+ if (correctionTime && fComposedCorrectionArray){
+ correctionTime->Init();
+ if (fComposedCorrectionArray->GetEntriesFast()<4) fComposedCorrectionArray->Expand(40);
+ fComposedCorrectionArray->AddAt(correctionTime,4); //add time dependent correction to the list of available corrections
+ }
}else{
- AliFatal("TPC - Missing calibration entry TimeDrift")
+ AliFatal("TPC - Missing calibration entry TimeDrift");
}
//
entry = AliCDBManager::Instance()->Get("TPC/Calib/Temperature",run);
if (entry) {
- fTemperatureArray.AddAt(entry->GetObject(),run);
+ fTemperatureArray.Add(new TObjString(runstr),entry->GetObject());
}
+
+ // High voltage
+ entry = AliCDBManager::Instance()->Get("TPC/Calib/HighVoltage",run);
+ if (!fVoltageArray.GetValue(runstr.GetName()) && entry) {
+ fVoltageArray.Add(new TObjString(runstr),entry->GetObject());
+ }
+
//apply fDButil filters
fDButil->UpdateFromCalibDB();
accept = fDButil->FilterTemperature(temp)>0.1;
}
if (press) {
- const Double_t kMinP=950.;
+ const Double_t kMinP=900.;
const Double_t kMaxP=1050.;
const Double_t kMaxdP=10.;
const Double_t kSigmaCut=4.;
if (press && temp &&accept){
AliTPCCalibVdrift * vdrift = new AliTPCCalibVdrift(temp, press,0);
- fVdriftArray.AddAt(vdrift,run);
+ fVdriftArray.Add(new TObjString(runstr),vdrift);
}
fDButil->FilterCE(120., 3., 4.,0);
//
// Get GRP object for given run
//
- if (run>= ((Instance()->fGRPArray)).GetEntriesFast()){
- Instance()->UpdateRunInformations(run);
- }
- AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>((Instance()->fGRPArray).At(run));
+ AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>((Instance()->fGRPArray).GetValue(Form("%i",run)));
if (!grpRun) {
Instance()->UpdateRunInformations(run);
- grpRun = dynamic_cast<AliGRPObject *>(Instance()->fGRPArray.At(run));
+ grpRun = dynamic_cast<AliGRPObject *>(Instance()->fGRPArray.GetValue(Form("%i",run)));
if (!grpRun) return 0;
}
return grpRun;
//
// Get GRP map for given run
//
- TMap * grpRun = dynamic_cast<TMap *>((Instance()->fGRPMaps).At(run));
+ TMap * grpRun = dynamic_cast<TMap *>((Instance()->fGRPMaps).GetValue(Form("%i",run)));
if (!grpRun) {
Instance()->UpdateRunInformations(run);
- grpRun = dynamic_cast<TMap *>(Instance()->fGRPMaps.At(run));
+ grpRun = dynamic_cast<TMap *>(Instance()->fGRPMaps.GetValue(Form("%i",run)));
if (!grpRun) return 0;
}
return grpRun;
//
// If not map try to get it from the GRPObject
//
- AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run));
+ AliGRPObject * grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.GetValue(Form("%i",run)));
if (!grpRun) {
UpdateRunInformations(run);
- grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.At(run));
+ grpRun = dynamic_cast<AliGRPObject *>(fGRPArray.GetValue(Form("%i",run)));
if (!grpRun) return 0;
}
AliDCSSensor * sensor = grpRun->GetCavernAtmosPressure();
//
// Get temperature sensor array
//
- AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run);
+ AliTPCSensorTempArray * tempArray = (AliTPCSensorTempArray *)fTemperatureArray.GetValue(Form("%i",run));
if (!tempArray) {
UpdateRunInformations(run);
- tempArray = (AliTPCSensorTempArray *)fTemperatureArray.At(run);
+ tempArray = (AliTPCSensorTempArray *)fTemperatureArray.GetValue(Form("%i",run));
}
return tempArray;
}
//
// Get temperature sensor array
//
- TObjArray * gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run);
+ TObjArray * gainSplines = (TObjArray *)fTimeGainSplinesArray.GetValue(Form("%i",run));
if (!gainSplines) {
UpdateRunInformations(run);
- gainSplines = (TObjArray *)fTimeGainSplinesArray.At(run);
+ gainSplines = (TObjArray *)fTimeGainSplinesArray.GetValue(Form("%i",run));
}
return gainSplines;
}
//
// Get drift spline array
//
- TObjArray * driftSplines = (TObjArray *)fDriftCorrectionArray.At(run);
+ TObjArray * driftSplines = (TObjArray *)fDriftCorrectionArray.GetValue(Form("%i",run));
if (!driftSplines) {
UpdateRunInformations(run);
- driftSplines = (TObjArray *)fDriftCorrectionArray.At(run);
+ driftSplines = (TObjArray *)fDriftCorrectionArray.GetValue(Form("%i",run));
}
return driftSplines;
}
//
// Get temperature sensor array
//
- AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run);
+ AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)fVoltageArray.GetValue(Form("%i",run));
if (!voltageArray) {
UpdateRunInformations(run);
- voltageArray = (AliDCSSensorArray *)fVoltageArray.At(run);
+ voltageArray = (AliDCSSensorArray *)fVoltageArray.GetValue(Form("%i",run));
}
return voltageArray;
}
//
// Get temperature sensor array
//
- AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run);
+ AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)fGoofieArray.GetValue(Form("%i",run));
if (!goofieArray) {
UpdateRunInformations(run);
- goofieArray = (AliDCSSensorArray *)fGoofieArray.At(run);
+ goofieArray = (AliDCSSensorArray *)fGoofieArray.GetValue(Form("%i",run));
}
return goofieArray;
}
//
// Get the interface to the the vdrift
//
- AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.At(run);
+ AliTPCCalibVdrift * vdrift = (AliTPCCalibVdrift*)fVdriftArray.GetValue(Form("%i",run));
if (!vdrift) {
UpdateRunInformations(run);
- vdrift= (AliTPCCalibVdrift*)fVdriftArray.At(run);
+ vdrift= (AliTPCCalibVdrift*)fVdriftArray.GetValue(Form("%i",run));
}
return vdrift;
}
if (val==0 ){
Double_t x,y;
gr->GetPoint(0,x,y);
- Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
- if ((time-timeStamp)<5*60) val=y;
+ const Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
+ const Int_t dtime=time-timeStamp;
+ if ( (dtime>0) && (dtime<5*60) ) val=y;
}
//last point
if (val==0 ){
Double_t x,y;
gr->GetPoint(gr->GetN()-1,x,y);
- Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
- if ((timeStamp-time)<5*60) val=y;
+ const Int_t time=TMath::Nint(sensor->GetStartTime()+x*3600); //time in graph is hours
+ const Int_t dtime=timeStamp-time;
+ if ( (dtime>0) && (dtime<5*60) ) val=y;
}
} else {
val=sensor->GetValue(timeStamp);
return val;
}
-Float_t AliTPCcalibDB::GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits) {
+Bool_t AliTPCcalibDB::IsDataTakingActive(time_t timeStamp)
+{
+ if (!fGrRunState) return kFALSE;
+ Double_t time=Double_t(timeStamp);
+ Int_t currentPoint=0;
+ Bool_t currentVal=fGrRunState->GetY()[currentPoint]>0.5;
+ Bool_t retVal=currentVal;
+ Double_t currentTime=fGrRunState->GetX()[currentPoint];
+
+ while (time>currentTime){
+ retVal=currentVal;
+ if (currentPoint==fGrRunState->GetN()) break;
+ currentVal=fGrRunState->GetY()[currentPoint]>0.5;
+ currentTime=fGrRunState->GetX()[currentPoint];
+ ++currentPoint;
+ }
+
+ return retVal;
+}
+
+void AliTPCcalibDB::UpdateChamberHighVoltageData()
+{
+ //
+ // set chamber high voltage data
+ // 1. Robust median (sampling the hv graphs over time)
+ // 2. Current nominal voltages (nominal voltage corrected for common HV offset)
+ // 3. Fraction of good HV values over time (deviation from robust median)
+ // 4. HV status, based on the above
+ //
+
+ // start and end time of the run
+ const Int_t run=GetRun();
+ if (run<0) return;
+
+ // if no valid run information - return
+ AliGRPObject* grp = GetGRP(run);
+ if (!grp) return;
+
+ const Int_t startTimeGRP = grp->GetTimeStart();
+ const Int_t stopTimeGRP = grp->GetTimeEnd();
+
+ //
+ // check active state by analysing the scalers
+ //
+ // initialise graph with active running
+ AliCDBEntry *entry = GetCDBEntry("GRP/CTP/Scalers");
+ entry->SetOwner(kTRUE);
+ AliTriggerRunScalers *sca = (AliTriggerRunScalers*)entry->GetObject();
+ Int_t nchannels = sca->GetNumClasses(); // number of scaler channels (i.e. trigger classes)
+ Int_t npoints = sca->GetScalersRecords()->GetEntries(); // number of samples
+
+ delete fGrRunState;
+ fGrRunState=new TGraph;
+ fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(startTimeGRP)-.001,0);
+ fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(startTimeGRP),1);
+ ULong64_t lastSum=0;
+ Double_t timeLast=0.;
+ Bool_t active=kTRUE;
+ for (int i=0; i<npoints; i++) {
+ AliTriggerScalersRecord *rec = (AliTriggerScalersRecord *) sca->GetScalersRecord(i);
+ Double_t time = ((AliTimeStamp*) rec->GetTimeStamp())->GetSeconds();
+ ULong64_t sum=0;
+ for (int j=0; j<nchannels; j++) sum += ((AliTriggerScalers*) rec->GetTriggerScalers()->At(j))->GetL2CA();
+ if (TMath::Abs(time-timeLast)<.001 && sum==lastSum ) continue;
+ if (active && sum==lastSum){
+ fGrRunState->SetPoint(fGrRunState->GetN(),timeLast-.01,1);
+ fGrRunState->SetPoint(fGrRunState->GetN(),timeLast,0);
+ active=kFALSE;
+ } else if (!active && sum>lastSum ){
+ fGrRunState->SetPoint(fGrRunState->GetN(),timeLast-.01,0);
+ fGrRunState->SetPoint(fGrRunState->GetN(),timeLast,1);
+ active=kTRUE;
+ }
+ lastSum=sum;
+ timeLast=time;
+ }
+ fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(stopTimeGRP),active);
+ fGrRunState->SetPoint(fGrRunState->GetN(),Double_t(stopTimeGRP)+.001,0);
+
+
+
+ // reset all values
+ for (Int_t iROC=0;iROC<72;++iROC) {
+ fChamberHVmedian[iROC] = -1;
+ fChamberHVgoodFraction[iROC] = 0.;
+ fCurrentNominalVoltage[iROC] = -999.;
+ fChamberHVStatus[iROC] = kFALSE;
+ }
+
+ AliDCSSensorArray* voltageArray = GetVoltageSensors(run);
+ if (!voltageArray) {
+ AliError("Voltage Array missing. Cannot calculate HV information!");
+ return;
+ }
+
+ // max HV diffs before a chamber is masked
+ const Float_t maxVdiff = fParam->GetMaxVoltageDeviation();
+ const Float_t maxDipVoltage = fParam->GetMaxDipVoltage();
+ const Float_t maxFracHVbad = fParam->GetMaxFractionHVbad();
+
+ const Int_t samplingPeriod=1;
+
+ // array with sampled voltages
+ const Int_t maxSamples=(stopTimeGRP-startTimeGRP)/samplingPeriod + 10*samplingPeriod;
+ Float_t *vSampled = new Float_t[maxSamples];
+
+ // deviation of the median from the nominal voltage
+ Double_t chamberMedianDeviation[72]={0.};
+
+ for (Int_t iROC=0; iROC<72; ++iROC){
+ chamberMedianDeviation[iROC]=0.;
+ TString sensorName="";
+ Char_t sideName='A';
+ if ((iROC/18)%2==1) sideName='C';
+ if (iROC<36) sensorName=Form("TPC_ANODE_I_%c%02d_VMEAS",sideName,iROC%18);
+ else sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,iROC%18);
+
+ AliDCSSensor *sensor = voltageArray->GetSensor(sensorName);
+
+ fHVsensors[iROC]=sensor;
+ if (!sensor) continue;
+
+ Int_t nPointsSampled=0;
+
+ TGraph *gr=sensor->GetGraph();
+ if ( gr && gr->GetN()>1 ){
+ //1. sample voltage over time
+ // get a robust median
+ // buffer sampled voltages
+
+ // current sampling time
+ Int_t time=startTimeGRP;
+
+ // input graph sampling point
+ const Int_t nGraph=gr->GetN();
+ Int_t pointGraph=0;
+
+ //initialise graph information
+ Int_t timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
+ Double_t sampledHV=gr->GetY()[pointGraph++];
+
+ while (time<stopTimeGRP){
+ while (timeGraph<=time && pointGraph+1<nGraph){
+ timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
+ sampledHV=gr->GetY()[pointGraph++];
+ }
+ time+=samplingPeriod;
+ if (!IsDataTakingActive(time-samplingPeriod)) continue;
+ vSampled[nPointsSampled++]=sampledHV;
+ }
+
+ if (nPointsSampled<1) continue;
+
+ fChamberHVmedian[iROC]=TMath::Median(nPointsSampled,vSampled);
+ chamberMedianDeviation[iROC]=fChamberHVmedian[iROC]-fParam->GetNominalVoltage(iROC);
+
+ //2. calculate good HV fraction
+ Int_t ngood=0;
+ for (Int_t ipoint=0; ipoint<nPointsSampled; ++ipoint) {
+ if (TMath::Abs(vSampled[ipoint]-fChamberHVmedian[iROC])<maxDipVoltage) ++ngood;
+ }
+
+ fChamberHVgoodFraction[iROC]=Float_t(ngood)/Float_t(nPointsSampled);
+ } else {
+ AliError(Form("No Graph or too few points found for HV sensor of ROC %d",iROC));
+ }
+ }
+
+ delete [] vSampled;
+ vSampled=0x0;
+
+ // get median deviation from all chambers (detect e.g. -50V)
+ const Double_t medianIROC=TMath::Median( 36, chamberMedianDeviation );
+ const Double_t medianOROC=TMath::Median( 36, chamberMedianDeviation+36 );
+
+ // Define current default voltages
+ for (Int_t iROC=0;iROC<72/*AliTPCCalPad::kNsec*/;++iROC){
+ const Float_t averageDeviation=(iROC<36)?medianIROC:medianOROC;
+ fCurrentNominalVoltage[iROC]=fParam->GetNominalVoltage(iROC)+averageDeviation;
+ }
+
+ //
+ // Check HV status
+ //
+ for (Int_t iROC=0;iROC<72/*AliTPCCalPad::kNsec*/;++iROC){
+ fChamberHVStatus[iROC]=kTRUE;
+
+ //a. Deviation of median from current nominal voltage
+ // allow larger than nominal voltages
+ if (fCurrentNominalVoltage[iROC]-fChamberHVmedian[iROC] > maxVdiff) fChamberHVStatus[iROC]=kFALSE;
+
+ //b. Fraction of bad hv values
+ if ( 1-fChamberHVgoodFraction[iROC] > maxFracHVbad ) fChamberHVStatus[iROC]=kFALSE;
+ }
+}
+
+Float_t AliTPCcalibDB::GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp, Int_t sigDigits, Bool_t current) {
//
// return the chamber HV for given run and time: 0-35 IROC, 36-72 OROC
// if timeStamp==-1 return mean value
//OROC
sensorName=Form("TPC_ANODE_O_%c%02d_0_VMEAS",sideName,sector%18);
}
+ if (current){
+ if (sector<36){
+ //IROC
+ sensorName=Form("TPC_ANODE_I_%c%02d_IMEAS",sideName,sector%18);
+ }else{
+ //OROC
+ sensorName=Form("TPC_ANODE_O_%c%02d_0_IMEAS",sideName,sector%18);
+ }
+
+ }
if (timeStamp==-1){
val=AliTPCcalibDB::GetDCSSensorMeanValue(voltageArray, sensorName.Data(),sigDigits);
} else {
AliGRPObject *grpRun = new AliGRPObject;
grpRun->ReadValuesFromMap(map);
grpRun->SetCavernAtmosPressure(sensor2);
+ grpRun->SetCavernAtmosPressure(sensor2);
grpRun->SetSurfaceAtmosPressure(sensor);
return grpRun;
}
//
TString file(filename);
- if (file.IsNull()) file=Form("guiTreeRun_%lld.root",fRun);
+ if (file.IsNull()) file=Form("guiTreeRun_%i.root",fRun);
prep.DumpToFile(file.Data());
return kTRUE;
}
if (mode==1) {
const Double_t kEpsilon=0.00000000001;
const Double_t kdeltaT=360.; // 10 minutes
- if(TMath::Abs(driftITS) < 12*kdeltaT) {
+ if(TMath::Abs(deltaITS) < 12*kdeltaT) {
result = driftITS;
} else {
wITS = 64.*kdeltaT/(deltaITS +kdeltaT);
// use TPC-ITS if present
TGraphErrors *gr= (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_VDGY");
+ if (!gr) gr = (TGraphErrors*)array->FindObject("ALIGN_TOFB_TPC_VDGY");
if(gr) {
- result = (gr->Eval(timeStamp));
+ result = AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
// transform from [(cm/mus)/ m] to [1/cm]
result /= (fParam->GetDriftV()/1000000.);
TFile *fileMapping = new TFile(nameMappingFile, "read");
AliTPCmapper *mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
if (!mapping) {
- sprintf(chinfo,"Failed to get mapping object from %s. ...\n", nameMappingFile);
+ snprintf(chinfo,1000,"Failed to get mapping object from %s. ...\n", nameMappingFile);
AliError (chinfo);
return 0;
}
Double_t active;
for (Int_t i=0; i<mapping->GetNumDdl(); i++) {
idDDL= i+offset;
+ if (idDDL<0) continue;
Int_t patch = mapping->GetPatchFromEquipmentID(idDDL);
+ if (patch<0) continue;
Int_t roc=mapping->GetRocFromEquipmentID(idDDL);
+ if (roc<0) continue;
AliTPCCalROC *calRoc=deadMap->GetCalROC(roc);
if (calRoc) {
for ( Int_t branch = 0; branch < 2; branch++ ) {
AliTPCCorrection * AliTPCcalibDB::GetTPCComposedCorrection(Float_t field) const{
//
// GetComposed correction for given field setting
- //
+ // If not specific correction for field used return correction for all field
+ // - Complication needed to gaurantee OCDB back compatibility
+ // - Not neeeded for the new space point correction
if (!fComposedCorrectionArray) return 0;
- if (field>0.1) return (AliTPCCorrection *)fComposedCorrectionArray->At(1);
- if (field<-0.1) return (AliTPCCorrection *)fComposedCorrectionArray->At(2);
+ if (field>0.1 && fComposedCorrectionArray->At(1)) {
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(1);
+ }
+ if (field<-0.1 &&fComposedCorrectionArray->At(2)) {
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(2);
+ }
return (AliTPCCorrection *)fComposedCorrectionArray->At(0);
}
+
+AliTPCCorrection * AliTPCcalibDB::GetTPCComposedCorrectionDelta() const{
+ //
+ // GetComposedCorrection delta
+ // Delta is time dependent - taken form the CalibTime OCDB entry
+ //
+ if (!fComposedCorrectionArray) return 0;
+ if (fRun<0) return 0;
+ if (fDriftCorrectionArray.GetValue(Form("%i",fRun))==0) return 0;
+ if (fComposedCorrectionArray->GetEntriesFast()<=4) {
+ fComposedCorrectionArray->Expand(5);
+ TObjArray * timeArray =(TObjArray*)(fDriftCorrectionArray.GetValue(Form("%i",fRun)));
+ AliTPCCorrection * correctionTime = (AliTPCCorrection *)timeArray->FindObject("FitCorrectionTime");
+ if (correctionTime){
+ correctionTime->Init();
+ fComposedCorrectionArray->AddAt(correctionTime,4); //add time dependent c
+ }
+ }
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(4); //
+}
+