]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/STEERBase/AliTRDPIDResponseObject.cxx
Temporary splines for LHC12b-e anchored MC
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTRDPIDResponseObject.cxx
index ca7b0f15ee47d72c368f062a12dde64f5c598d7e..b7f0445e5afaf230afeb3b0d052271fed9ad83b9 100644 (file)
@@ -97,11 +97,17 @@ AliTRDPIDResponseObject &AliTRDPIDResponseObject::operator=(const AliTRDPIDRespo
            TNamed::operator=(ref);
            fNSlicesQ0=ref.fNSlicesQ0;
            for(Int_t method=0;method<AliTRDPIDResponse::kNMethod;method++){
-               if(TestBit(kIsOwner) && fPIDParams[method])delete fPIDParams[method];
-                if(TestBit(kIsOwner) && fPIDReference[method])delete fPIDReference[method];
-
-               fPIDParams[method]=ref.fPIDParams[method];       // new Object is not owner, copy only pointer
-               fPIDReference[method]=ref.fPIDReference[method];    // new Object is not owner, copy only pointer
+             if(TestBit(kIsOwner) && fPIDParams[method]){
+               delete fPIDParams[method];
+               fPIDParams[method]= 0;
+             }
+             if(TestBit(kIsOwner) && fPIDReference[method]){
+               delete fPIDReference[method];
+               fPIDReference[method] = 0;
+             }
+             printf("Assignment");
+             fPIDParams[method]=ref.fPIDParams[method];       // new Object is not owner, copy only pointer
+             fPIDReference[method]=ref.fPIDReference[method];    // new Object is not owner, copy only pointer
            }
            SetBit(kIsOwner, kFALSE);
        }
@@ -114,9 +120,15 @@ AliTRDPIDResponseObject::~AliTRDPIDResponseObject(){
        // Destructor
        // references are deleted if the object is the owner
        //
-    if(fPIDParams && TestBit(kIsOwner)) delete [] fPIDParams;
-    if(fPIDReference && TestBit(kIsOwner)) delete [] fPIDReference;
-
+    for(Int_t method=0;method<AliTRDPIDResponse::kNMethod;method++){
+       if(fPIDParams[method] && TestBit(kIsOwner)){
+       delete fPIDParams[method];fPIDParams[method] = 0;
+      }
+      if(fPIDReference[method] && TestBit(kIsOwner)){
+       delete fPIDReference[method];
+       fPIDReference[method] = 0;
+      }
+    }
 }
 
 //____________________________________________________________
@@ -171,14 +183,14 @@ TObject *AliTRDPIDResponseObject::GetLowerReference(AliPID::EParticleType spec,
        return NULL;
     }
 
-     if(fPIDReference[method]){
+    if(fPIDReference[method]){
         return fPIDReference[method]->GetLowerReference(spec,p,pLower);
      }
     return NULL;
 }
 
 //____________________________________________________________
-Bool_t AliTRDPIDResponseObject::GetThresholdParameters(Int_t ntracklets, Double_t efficiency, Double_t *params,AliTRDPIDResponse::ETRDPIDMethod method) const{
+Bool_t AliTRDPIDResponseObject::GetThresholdParameters(Int_t ntracklets, Double_t efficiency, Double_t *params,Double_t centrality,AliTRDPIDResponse::ETRDPIDMethod method) const{
 
     if(Int_t(method)>=Int_t(AliTRDPIDResponse::kNMethod)||Int_t(method)<0){
        AliError("Method does not exist");
@@ -186,8 +198,9 @@ Bool_t AliTRDPIDResponseObject::GetThresholdParameters(Int_t ntracklets, Double_
     }
 
     if(fPIDParams[method]){
-       return fPIDParams[method]->GetThresholdParameters(ntracklets,efficiency,params);
+       return fPIDParams[method]->GetThresholdParameters(ntracklets,efficiency,params,centrality);
     }
+    AliError("TRD Threshold Container does not exist");
     return kFALSE;
 }
 
@@ -214,6 +227,6 @@ void AliTRDPIDResponseObject::Print(const Option_t* opt) const{
    
     for(Int_t method=0;method<AliTRDPIDResponse::kNMethod;method++){
        if(fPIDReference[method])fPIDReference[method]->Print(opt);
-       if(fPIDParams[method])printf("+ Threshold Parameters \n");
+       if(fPIDParams[method])fPIDParams[method]->Print(opt);
     }
 }