// the corrected position (x+dx1) resulting in dx2, the third one //
// is then called at position (x+dx1+dx2) and so forth. dx=dx1+dx2+... //
// is returned. //
+// 3. kQueueResidual: like kQueue with the exception that in case of //
+// a positive weight the 'Distortion' is called and in case of a negative //
+// weight the 'Correction' is called, where the absolute of the weight //
+// will be applied to the correction
// For the inverse of the correction this is taken into account by reversing //
// the order the corrections are applied in the kQueue case (no issue for //
// kParallel). //
#include <TCollection.h>
#include <TTimeStamp.h>
#include <TIterator.h>
+#include <TMath.h>
#include "AliLog.h"
#include "AliTPCComposedCorrection.h"
}
for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j];
break;
+ case kQueueResidual:
+ //TODO: for the moment assume inverse of distortion
+ // check if this is what is desired
+ GetDistortion(x,roc,dx);
+ for (Int_t j=0;j<3;++j) dx[j]*=-1.;
+ break;
}
delete i;
}
AliInfo("No Corrections-models were set: can not calculate distortions");
return;
}
+
+ if (fMode==kQueueResidual && !fWeights) {
+ AliInfo("kQueueResidual mode was selected but no weights were given. Switching to kQueue instead.");
+ fMode=kQueue;
+ }
+
TIterator *i=fCorrections->MakeReverseIterator();
AliTPCCorrection *c;
Int_t weightIndex=0;
}
for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j];
break;
+ case kQueueResidual:
+ Float_t xi2[3];
+ for (Int_t j=0;j<3;++j) xi2[j]=x[j];
+ while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
+ Double_t w=(*fWeights)[weightIndex++];
+ if (w>0) c->GetDistortion(xi2,roc,dx);
+ else c->GetCorrection(xi2,roc,dx);
+ for (Int_t j=0;j<3;++j) xi2[j]+=TMath::Abs(w)*dx[j];
+ }
+ for (Int_t j=0;j<3;++j) dx[j]=xi2[j]-x[j];
+ break;
}
delete i;
}
class AliTPCComposedCorrection : public AliTPCCorrection {
public:
- enum CompositionType {kParallel,kQueue};
+ enum CompositionType {kParallel,kQueue, kQueueResidual};
AliTPCComposedCorrection();
AliTPCComposedCorrection(TCollection *corrections,CompositionType mode);
--- /dev/null
+#include <TString.h>
+#include <TVectorD.h>
+#include <TObjArray.h>
+#include <TFile.h>
+
+#include <AliTPCComposedCorrection.h>
+#include <AliTPCCorrectionLookupTable.h>
+
+#include <AliToyMCEventGenerator.h>
+
+
+AliTPCComposedCorrection* GetComposedResidualDistortion(TString fluctuationMap, TString averageMap, Bool_t rescale=kTRUE)
+{
+ //
+ //
+ //
+
+
+ TFile fFluct(fluctuationMap);
+ AliTPCCorrectionLookupTable *corrFluct = (AliTPCCorrectionLookupTable*)fFluct.Get("map");
+ fFluct.Close();
+
+ TFile fAverage(averageMap);
+ AliTPCCorrectionLookupTable *corrAverage = (AliTPCCorrectionLookupTable*)fAverage.Get("map");
+ fAverage.Close();
+
+ TObjArray *arrMaps = new TObjArray(2);
+ arrMaps->Add(corrFluct); // distortion with the fluctuation Map
+ arrMaps->Add(corrAverage); // correction with the average Map
+
+ // create the composed correction
+ // if the weight are set to +1 and -1, the first map will be responsible for the distortions
+ // The second map for the corrections
+ AliTPCComposedCorrection *residualDistortion = new AliTPCComposedCorrection(arrMaps, AliTPCComposedCorrection::kQueueResidual);
+ TVectorD weights(2);
+ weights(0)=+1.;
+ weights(1)=-1.;
+ if (rescale) {
+ Float_t dummy=0;
+ weights(1)=-AliToyMCEventGenerator::GetSCScalingFactor(corrFluct, corrAverage,dummy);
+ }
+ residualDistortion->SetWeights(&weights);
+
+ return residualDistortion;
+}