#include <TCollection.h>
-#include <TIterator.h>
#include <TTimeStamp.h>
+#include <TIterator.h>
+#include "AliLog.h"
#include "AliTPCComposedCorrection.h"
: AliTPCCorrection("composed_correction",
"composition of corrections"),
fCorrections(0),
- fMode(kParallel)
+ fMode(kParallel),
+ fWeights(0) // weights of corrections
{
//
// default constructor
: AliTPCCorrection("composed_correction",
"composition of corrections"),
fCorrections(corrections),
- fMode(mode)
+ fMode(mode),
+ fWeights(0) //weights of correction
{
//
// Constructor that defines the set of corrections, this one is composed of.
AliTPCComposedCorrection::~AliTPCComposedCorrection() {
//
- // virtual destructor
+ // destructor
//
+ if (!fCorrections) {
+ AliInfo("No Correction-models were set: can not delete them");
+ } else {
+ TIterator *i=fCorrections->MakeIterator();
+ AliTPCCorrection *c;
+ while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
+ delete c;
+ }
+ delete i;
+ }
+ if (fWeights) delete fWeights;
}
+AliTPCCorrection * AliTPCComposedCorrection::GetSubCorrection(Int_t ipos){
+ //
+ //
+ //
+ TObjArray *arr = (TObjArray*)fCorrections;
+ return (AliTPCCorrection *)arr->At(ipos);
+}
+
+AliTPCCorrection * AliTPCComposedCorrection::GetSubCorrection(const char *cname){
+ //
+ //
+ //
+ TCollection *arr = fCorrections;
+ return (AliTPCCorrection *)arr->FindObject(cname);
+}
+
+
void AliTPCComposedCorrection::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
//
// This applies all correction and the specified manner (see general
// class description for details).
//
+
+ if (!fCorrections) {
+ AliInfo("No Corrections-models were set: can not calculate distortions");
+ return;
+ }
TIterator *i=fCorrections->MakeIterator();
AliTPCCorrection *c;
+ Int_t weightIndex=0;
switch (fMode) {
case kParallel:
Float_t dxi[3];
for (int j=0;j<3;++j) dx[j]=0.;
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
c->GetCorrection(x,roc,dxi);
- for (Int_t j=0;j<3;++j) dx[j]+=dxi[j];
+ Double_t w=1;
+ if (fWeights) w=(*fWeights)[weightIndex++];
+ for (Int_t j=0;j<3;++j) dx[j]+=w*dxi[j];
}
break;
case kQueue:
for (Int_t j=0;j<3;++j) xi[j]=x[j];
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
c->GetCorrection(xi,roc,dx);
- for (Int_t j=0;j<3;++j) xi[j]+=dx[j];
+ Double_t w=1;
+ if (fWeights) w=(*fWeights)[weightIndex++];
+ for (Int_t j=0;j<3;++j) xi[j]+=w*dx[j];
}
for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j];
break;
// class descxiption for details).
//
+ if (!fCorrections) {
+ AliInfo("No Corrections-models were set: can not calculate distortions");
+ return;
+ }
TIterator *i=fCorrections->MakeReverseIterator();
AliTPCCorrection *c;
+ Int_t weightIndex=0;
switch (fMode) {
case kParallel:
Float_t dxi[3];
for (int j=0;j<3;++j) dx[j]=0.;
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
c->GetDistortion(x,roc,dxi);
- for (Int_t j=0;j<3;++j) dx[j]+=dxi[j];
+ Double_t w=1;
+ if (fWeights) w=(*fWeights)[weightIndex++];
+ for (Int_t j=0;j<3;++j) dx[j]+=w*dxi[j];
}
break;
case kQueue:
for (Int_t j=0;j<3;++j) xi[j]=x[j];
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
c->GetDistortion(xi,roc,dx);
- for (Int_t j=0;j<3;++j) xi[j]+=dx[j];
+ Double_t w=1;
+ if (fWeights) w=(*fWeights)[weightIndex++];
+ for (Int_t j=0;j<3;++j) xi[j]+=w*dx[j];
}
for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j];
break;
printf("Composed TPC spacepoint correction \"%s\" -- composed of:\n",GetTitle());
TString opt = option; opt.ToLower();
Int_t in=1;
+ if (!fCorrections) {
+ printf(" - composed correction is empty!\n");
+ return;
+ }
TIterator *i=fCorrections->MakeIterator();
AliTPCCorrection *c;
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {
if (opt.Contains("d")) {
- printf("%d. ",in);
+ printf("\n");
+ printf("%d. %s\t%s\n",in,c->GetTitle(), c->GetName());
c->Print(option);
} else {
- printf("%d. %s\n",in,c->GetTitle());
+ printf("%d. %s\t%s\n",in,c->GetTitle(), c->GetName());
}
++in;
}
//
// Initialization funtion (not used at the moment)
//
-
+ if (!fCorrections) {
+ AliInfo("No Correction-models were set");
+ return;
+ }
TIterator *i=fCorrections->MakeIterator();
AliTPCCorrection *c;
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next())))
//
// Update function
//
+ if (!fCorrections) {
+ AliInfo("No Correction-models were set");
+ return;
+ }
TIterator *i=fCorrections->MakeIterator();
AliTPCCorrection *c;
// Note: overwrites previously set values!
//
+ if (!fCorrections) {
+ AliInfo("No Correction-models were set");
+ return;
+ }
+
TIterator *i=fCorrections->MakeIterator();
AliTPCCorrection *c;
while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) {