Skip to content

Commit

Permalink
ALIROOT-6756: Reset cache of AliTPCTransform after InitDead... in vie…
Browse files Browse the repository at this point in the history
…w of possible recoparam modif.
  • Loading branch information
shahor02 authored and hristov committed Jul 5, 2016
1 parent 0830b3b commit b7e1e6c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
46 changes: 37 additions & 9 deletions TPC/TPCbase/AliTPCTransform.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,31 @@ void AliTPCTransform::Local2RotatedGlobal(Int_t sector, Double_t *x) const {
/// Drift Velocity
/// Current implementation - common drift velocity - for full chamber
/// TODO: use a map or parametrisation!
///
/// If called with NULL x pointer, just reset the cache
static time_t lastStamp=-1; //cached values
static Double_t lastCorr = 1;
// simple caching non thread save
static Double_t vdcorrectionTime=1;
static Double_t vdcorrectionTimeGY=0;
static Double_t time0corrTime=0;
static Double_t deltaZcorrTime=0;
static time_t lastStampT=-1;

if (!x) {
AliInfo("Reseting cache");
lastStamp=-1;
lastCorr = 1;
vdcorrectionTime=1;
vdcorrectionTimeGY=0;
time0corrTime=0;
deltaZcorrTime=0;
lastStampT=-1;
return;
}

if (!fCurrentRecoParam) return;
const Int_t kMax =60; // cache for 60 seconds
static time_t lastStamp=-1; //cached values
static Double_t lastCorr = 1;
//
AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
AliTPCParam * param = calib->GetParameters();
Expand All @@ -334,12 +354,6 @@ void AliTPCTransform::Local2RotatedGlobal(Int_t sector, Double_t *x) const {
}
}
//
// simple caching non thread save
static Double_t vdcorrectionTime=1;
static Double_t vdcorrectionTimeGY=0;
static Double_t time0corrTime=0;
static Double_t deltaZcorrTime=0;
static time_t lastStampT=-1;
//
Bool_t isChange=(lastStampT!=(Int_t)fCurrentTimeStamp)||lastStamp<0;
if (lastStampT!=(Int_t)fCurrentTimeStamp){
Expand Down Expand Up @@ -512,7 +526,8 @@ Bool_t AliTPCTransform::UpdateTimeDependentCache()
//
Bool_t timeChanged = lastTimeStamp!=fCurrentTimeStamp;
if (!fCurrentRecoParam) {
AliWarning("RecoParam is not set, do nothing");
AliWarning("RecoParam is not set, reseting last timestamp");
lastTimeStamp = -1;
return fTimeDependentUpdated;
}
while (fCurrentRecoParam->GetUseCorrectionMap()) {
Expand Down Expand Up @@ -1086,3 +1101,16 @@ Double_t AliTPCTransform::ErrZ2Syst(const AliTPCclusterMI * cl, const double tgA
return sysErr2;
}

//_________________________________
void AliTPCTransform::ResetCache()
{
// reset cached values for last time bin, consider as tmp measure. Preferable to use data members
// instead of static vars.
//
AliInfo("Reseting Transform in view of possible RecoParam modification");
fCurrentRecoParam = 0;
fCurrentMapScaling = 1.0;
SetCurrentTimeStamp(-1);
Local2RotatedGlobal(-1,0); // this will reset the cached values for VDrift
//
}
1 change: 1 addition & 0 deletions TPC/TPCbase/AliTPCTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AliTPCTransform:public AliTransform {
virtual ~AliTPCTransform();
virtual void Transform(Double_t *x,Int_t *i,UInt_t time,
Int_t coordinateType);
void ResetCache();
void SetPrimVertex(Double_t *vtx);
void Local2RotatedGlobal(Int_t sec, Double_t *x) const;
void RotatedGlobal2Global(Int_t sector,Double_t *x) const;
Expand Down
1 change: 1 addition & 0 deletions TPC/TPCbase/AliTPCcalibDB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,7 @@ Int_t AliTPCcalibDB::GetMaskedChannelsFromCorrectionMaps(TBits maskedPads[72])
npadsTotMasked += npadsMasked;
AliInfoF("masked %d pads (%d full padrows, %d individual pads)",
npadsTotMasked,nrowsMasked,npadsMasked);
transform->ResetCache();
return npadsTotMasked;
//
}
Expand Down

0 comments on commit b7e1e6c

Please sign in to comment.