]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCPRF2D.cxx
Obsolete TRD options removed + fast way to ask for tracks
[u/mrichter/AliRoot.git] / TPC / AliTPCPRF2D.cxx
index ae8b8b560ce40979153ec8e996f1c176e53fcc58..81cee46219d34f56e6304eae21ccbbed1cab7d7b 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.5  2000/06/30 12:07:50  kowal2
-Updated from the TPC-PreRelease branch
-
-Revision 1.4.4.3  2000/06/26 07:39:42  kowal2
-Changes to obey the coding rules
-
-Revision 1.4.4.2  2000/06/25 08:38:41  kowal2
-Splitted from AliTPCtracking
-
-Revision 1.4.4.1  2000/06/14 16:48:24  kowal2
-Parameter setting improved. Removed compiler warnings
-
-Revision 1.4  2000/04/17 09:37:33  kowal2
-removed obsolete AliTPCDigitsDisplay.C
-
-Revision 1.3.8.2  2000/04/10 08:40:46  kowal2
-
-Small changes by M. Ivanov, improvements of algorithms
-
-Revision 1.3.8.1  2000/04/10 07:56:53  kowal2
-Not used anymore - removed
-
-Revision 1.3  1999/10/05 17:15:46  fca
-Minor syntax for the Alpha OSF
-
-Revision 1.2  1999/09/29 09:24:34  fca
-Introduction of the Copyright and cvs Log
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //  AliTPCPRF2D -                                                            //
@@ -63,7 +33,7 @@ Introduction of the Copyright and cvs Log
 #include "TMath.h"
 #include "AliTPCPRF2D.h"
 #include "TF2.h"
-#include <iostream.h>
+#include <Riostream.h>
 #include <string.h>
 #include "TCanvas.h"
 #include "TPad.h"
@@ -128,6 +98,7 @@ ClassImp(AliTPCPRF2D)
 AliTPCPRF2D::AliTPCPRF2D()
 {
   //default constructor for response function object
+  fcharge = 0;
   fNChargeArray = 0;
   fChargeArray = 0;
   fNPRF =fgkNPRF ;
@@ -206,42 +177,39 @@ Float_t AliTPCPRF2D::GetPRF(Float_t xin, Float_t yin)
     fcharge   = &(fChargeArray[i*fNPRF]);
     return GetPRFActiv(xin);
   }
-  else{
-    //make interpolation from more fore lines
-    Int_t i= Int_t(y);
-    Float_t res;
-    if ((i<0) || (i>=fNYdiv) ) return 0;
-    Float_t z0=0;
-    Float_t z1=0;
-    Float_t z2=0;
-    Float_t z3=0;
-    if (i>0) {
-      fcharge =&(fChargeArray[(i-1)*fNPRF]);
-      z0 = GetPRFActiv(xin);
-    }
-    fcharge =&(fChargeArray[i*fNPRF]);
-    z1=GetPRFActiv(xin);
-    if ((i+1)<fNYdiv){
-      fcharge =&(fChargeArray[(i+1)*fNPRF]);
-      z2 = GetPRFActiv(xin);
-    }
-    if ((i+2)<fNYdiv){
-      fcharge =&(fChargeArray[(i+2)*fNPRF]);
-      z3 = GetPRFActiv(xin);
-    }
-    Float_t a,b,c,d,k,l;
-    a=z1;
-    b=(z2-z0)/2.;
-    k=z2-a-b;
-    l=(z3-z1)/2.-b;
-    d=l-2*k;
-    c=k-d;
-    Float_t dy=y-Float_t(i);
-
-    res = a+b*dy+c*dy*dy+d*dy*dy*dy;  
-    return res;            
-  }        
-  return 0.;
+  //make interpolation from more fore lines
+  Int_t i= Int_t(y);
+  Float_t res;
+  if ((i<0) || (i>=fNYdiv) ) return 0;
+  Float_t z0=0;
+  Float_t z1=0;
+  Float_t z2=0;
+  Float_t z3=0;
+  if (i>0) {
+    fcharge =&(fChargeArray[(i-1)*fNPRF]);
+    z0 = GetPRFActiv(xin);
+  }
+  fcharge =&(fChargeArray[i*fNPRF]);
+  z1=GetPRFActiv(xin);
+  if ((i+1)<fNYdiv){
+    fcharge =&(fChargeArray[(i+1)*fNPRF]);
+    z2 = GetPRFActiv(xin);
+  }
+  if ((i+2)<fNYdiv){
+    fcharge =&(fChargeArray[(i+2)*fNPRF]);
+    z3 = GetPRFActiv(xin);
+  }
+  Float_t a,b,c,d,k,l;
+  a=z1;
+  b=(z2-z0)/2.;
+  k=z2-a-b;
+  l=(z3-z1)/2.-b;
+  d=l-2*k;
+  c=k-d;
+  Float_t dy=y-Float_t(i);
+  
+  res = a+b*dy+c*dy*dy+d*dy*dy*dy;  
+  return res;            
 } 
 
 
@@ -319,7 +287,7 @@ void AliTPCPRF2D::SetGauss(Float_t sigmaX, Float_t sigmaY,
   fOrigSigmaY=sigmaY;
   sprintf(fType,"Gauss");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",funGauss2D,-5.,5.,-5.,5.,4);
+  fGRF = new TF2("funGauss2D",funGauss2D,-5.,5.,-5.,5.,4);
   
   funParam[0]=sigmaX;
   funParam[1]=sigmaY;  
@@ -352,7 +320,7 @@ void AliTPCPRF2D::SetCosh(Float_t sigmaX, Float_t sigmaY,
   fOrigSigmaY=sigmaY; 
   sprintf(fType,"Cosh");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",        funCosh2D,-5.,5.,-5.,5.,4);   
+  fGRF = new TF2("funCosh2D",  funCosh2D,-5.,5.,-5.,5.,4);   
   funParam[0]=sigmaX;
   funParam[1]=sigmaY;
   funParam[2]=fK;  
@@ -383,7 +351,7 @@ void AliTPCPRF2D::SetGati(Float_t K3X, Float_t K3Y,
   fPadDistance=padDistance;  
   sprintf(fType,"Gati");
   if (fGRF !=0 ) fGRF->Delete();
-  fGRF = new TF2("fun",        funGati2D,-5.,5.,-5.,5.,5);  
+  fGRF = new TF2("funGati2D",  funGati2D,-5.,5.,-5.,5.,5);  
  
   funParam[0]=padDistance;
   funParam[1]=K3X;
@@ -679,99 +647,25 @@ void AliTPCPRF2D::Streamer(TBuffer &R__b)
    // Stream an object of class AliTPCPRF2D
 
    if (R__b.IsReading()) {
-      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-      TObject::Streamer(R__b);     
-      //read chewron parameters
-      R__b >> fHeightFull;
-      R__b >> fHeightS;
-      R__b >> fShiftY;
-      R__b >> fWidth;
-      R__b >> fK;
-      R__b >> fSigmaX;
-      R__b >> fSigmaY;
-      R__b >> fMeanX;
-      R__b >> fMeanY;
-      //read charge parameters     
-      R__b.ReadFastArray(fType,5);
-      R__b >> fOrigSigmaX;
-      R__b >> fOrigSigmaY;
-      R__b >> fKNorm;
-      R__b >> fK3X;
-      R__b >> fK3Y;
-      R__b >> fPadDistance;
-      R__b >> fInteg;   
-      //read angle parameters
-      R__b >> fChargeAngle;
-      R__b >> fPadAngle;
+      UInt_t R__s, R__c;
+      Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
+      AliTPCPRF2D::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
       //read functions
-      if (fGRF!=0) { 
-       fGRF->Delete();  
-       fGRF=0;
-      }
-      if (strncmp(fType,"User",3)==0){
-       fGRF= new TF2;
-       R__b>>fGRF;   
-      }
-      if (strncmp(fType,"Gauss",3)==0) 
-       fGRF = new TF2("fun",funGauss2D,-5.,5.,-5.,5.,4);
-      if (strncmp(fType,"Cosh",3)==0) 
-       fGRF = new TF2("fun",funCosh2D,-5.,5.,-5.,5.,4);
-       if (strncmp(fType,"Gati",3)==0) 
-       fGRF = new TF2("fun",funGati2D,-5.,5.,-5.,5.,5);      
-      //read interpolation parameters
-      R__b >>fY1;
-      R__b >>fY2;
-      R__b >>fNYdiv;  
-      R__b >>fDStep;  
-      R__b >>fNPRF;
-      R__b >>fNChargeArray;
-      if (fChargeArray!=0) delete [] fChargeArray;
-      if (fNChargeArray>0) {
-       fChargeArray = new Float_t[fNChargeArray];
-       R__b.ReadFastArray(fChargeArray,fNChargeArray); 
+      if (strncmp(fType,"User",3)!=0){
+       delete fGRF;  
+        if (strncmp(fType,"Gauss",3)==0) 
+         fGRF = new TF2("funGauss2D",funGauss2D,-5.,5.,-5.,5.,4);
+        if (strncmp(fType,"Cosh",3)==0) 
+         fGRF = new TF2("funCosh2D",funCosh2D,-5.,5.,-5.,5.,4);
+        if (strncmp(fType,"Gati",3)==0) 
+         fGRF = new TF2("funGati2D",funGati2D,-5.,5.,-5.,5.,5);      
+        if (fGRF!=0) fGRF->SetParameters(funParam);
       }
-      //
-      R__b.ReadFastArray(funParam,5); 
-      if (fGRF!=0) fGRF->SetParameters(funParam);
       //calculate conversion coefitient to convert position to virtual wire
       fDYtoWire=Float_t(fNYdiv-1)/(fY2-fY1);
       fDStepM1=1/fDStep;
    } else {
-      R__b.WriteVersion(AliTPCPRF2D::IsA());
-      TObject::Streamer(R__b);      
-      //write chewron parameters
-      R__b << fHeightFull;
-      R__b << fHeightS;
-      R__b << fShiftY;
-      R__b << fWidth;
-      R__b << fK;
-      R__b << fSigmaX;
-      R__b << fSigmaY;
-      R__b << fMeanX;
-      R__b << fMeanY;
-      //write charge parameters
-      R__b.WriteFastArray(fType,5);
-      R__b << fOrigSigmaX;
-      R__b << fOrigSigmaY;
-      R__b << fKNorm;
-      R__b << fK3X;
-      R__b << fK3Y;
-      R__b << fPadDistance;  
-      R__b << fInteg;
-      //angle parameters
-      R__b << fChargeAngle;
-      R__b << fPadAngle;
-      if (strncmp(fType,"User",3)==0)  R__b <<fGRF;         
-      //write interpolation parameters
-      R__b <<fY1;
-      R__b <<fY2;
-      R__b <<fNYdiv;   
-      R__b <<fDStep;
-      R__b <<fNPRF;    
-      R__b <<fNChargeArray;
-      if (fNChargeArray>0) 
-       R__b.WriteFastArray(fChargeArray,fNPRF*fNYdiv); 
-      R__b.WriteFastArray(funParam,5); 
+      AliTPCPRF2D::Class()->WriteBuffer(R__b,this);
    }
 }