+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
///////////////////////////////////////////////////////////////////////////////
-// AliTPCPRF2D - //
+// AliTPCPRF2D - //
// Pad response function object in two dimesions //
// This class contains the basic functions for the //
// calculation of PRF according generic charge distribution //
// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
// //
///////////////////////////////////////////////////////////////////////////////
-#include "TMath.h"
-#include "AliTPCPRF2D.h"
-#include "TF2.h"
-#include <iostream.h>
+
+#include <Riostream.h>
+#include <TCanvas.h>
+#include <TClass.h>
+#include <TF2.h>
+#include <TH1.h>
+#include <TMath.h>
+#include <TPad.h>
+#include <TPaveText.h>
+#include <TStyle.h>
+#include <TText.h>
#include <string.h>
-#include "TCanvas.h"
-#include "TPad.h"
-#include "TStyle.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TPaveText.h"
-#include "TText.h"
+
+#include "AliH2F.h"
+#include "AliTPCPRF2D.h"
+
extern TStyle * gStyle;
-static const Float_t sqrt12=3.46;
-static const Int_t NPRF = 100;
+const Double_t AliTPCPRF2D::fgkDegtoRad = 0.01745329251994;
+const Double_t AliTPCPRF2D::fgkSQRT12=3.464101;
+const Int_t AliTPCPRF2D::fgkNPRF = 100;
static Double_t funGauss2D(Double_t *x, Double_t * par)
{
+//Gauss function -needde by the generic function object
return ( TMath::Exp(-(x[0]*x[0])/(2*par[0]*par[0]))*
TMath::Exp(-(x[1]*x[1])/(2*par[1]*par[1])));
static Double_t funCosh2D(Double_t *x, Double_t * par)
{
+ //Cosh function -needde by the generic function object
return ( 1/(TMath::CosH(3.14159*x[0]/(2*par[0]))*
TMath::CosH(3.14159*x[1]/(2*par[1]))));
}
static Double_t funGati2D(Double_t *x, Double_t * par)
{
- //par[1] = is equal to k3X
- //par[0] is equal to pad wire distance
- Float_t K3=par[1];
- Float_t K3R=TMath::Sqrt(K3);
- Float_t K2=(TMath::Pi()/2)*(1-K3R/2.);
- Float_t K1=K2*K3R/(4*TMath::ATan(K3R));
+ //Gati function -needde by the generic function object
+ Float_t k3=par[1];
+ Float_t k3R=TMath::Sqrt(k3);
+ Float_t k2=(TMath::Pi()/2)*(1-k3R/2.);
+ Float_t k1=k2*k3R/(4*TMath::ATan(k3R));
Float_t l=x[0]/par[0];
- Float_t tan2=TMath::TanH(K2*l);
+ Float_t tan2=TMath::TanH(k2*l);
tan2*=tan2;
- Float_t res = K1*(1-tan2)/(1+K3*tan2);
+ Float_t res = k1*(1-tan2)/(1+k3*tan2);
//par[4] = is equal to k3Y
- K3=par[4];
- K3R=TMath::Sqrt(K3);
- K2=(TMath::Pi()/2)*(1-K3R/2.);
- K1=K2*K3R/(4*TMath::ATan(K3R));
+ k3=par[4];
+ k3R=TMath::Sqrt(k3);
+ k2=(TMath::Pi()/2)*(1-k3R/2.);
+ k1=k2*k3R/(4*TMath::ATan(k3R));
l=x[1]/par[0];
- tan2=TMath::TanH(K2*l);
+ tan2=TMath::TanH(k2*l);
tan2*=tan2;
- res = res*K1*(1-tan2)/(1+K3*tan2);
+ res = res*k1*(1-tan2)/(1+k3*tan2);
return res;
}
-
-///////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
ClassImp(AliTPCPRF2D)
AliTPCPRF2D::AliTPCPRF2D()
+ :TObject(),
+ fcharge(0),
+ fY1(0.),
+ fY2(0.),
+ fNYdiv(0),
+ fNChargeArray(0),
+ fChargeArray(0),
+ fHeightFull(0.),
+ fHeightS(0.),
+ fShiftY(0.),
+ fWidth(0.),
+ fK(0.),
+ fNPRF(0),
+ fNdiv(5),
+ fDStep(0.),
+ fKNorm(1.),
+ fInteg(0.),
+ fGRF(0),
+ fK3X(0.),
+ fK3Y(0.),
+ fPadDistance(0.),
+ fOrigSigmaX(0.),
+ fOrigSigmaY(0.),
+ fChargeAngle(0.),
+ fPadAngle(0.),
+ fSigmaX(0.),
+ fSigmaY(0.),
+ fMeanX(0.),
+ fMeanY(0.),
+ fInterX(0),
+ fInterY(0),
+ fCurrentY(0.),
+ fDYtoWire(0.),
+ fDStepM1(0.)
{
- ffcharge = 0;
- fNPRF =NPRF ;
- fSigmaX = 0;
+ //default constructor for response function object
+
+ fNPRF =fgkNPRF ;
- fGRF = 0;
- fkNorm = 1;
- forigsigmaY=0;
- forigsigmaX=0;
- fNdiv = 5;
//chewron default values
SetPad(0.8,0.8);
SetChevron(0.2,0.0,1.0);
SetY(-0.2,0.2,2);
- // SetGauss(0.22,0.22,1);
+ SetInterpolationType(2,0);
}
AliTPCPRF2D::~AliTPCPRF2D()
{
- if (ffcharge!=0) delete [] ffcharge;
- if (fGRF !=0 ) fGRF->Delete();
+ if (fChargeArray!=0) delete [] fChargeArray;
+ if (fGRF !=0 ) fGRF->Delete();
}
void AliTPCPRF2D::SetY(Float_t y1, Float_t y2, Int_t nYdiv)
//set virtual line position
//first and last line and number of lines
fNYdiv = nYdiv;
- if (ffcharge!=0) delete [] ffcharge;
- ffcharge = new Float_t[fNPRF*fNYdiv];
fY1=y1;
fY2=y2;
}
//set shaping of chewron parameters
fHeightS=hstep;
fShiftY=shifty;
- fK=fWidth*fac/hstep;
+ fK=fac;
}
void AliTPCPRF2D::SetChParam(Float_t width, Float_t height,
}
-Float_t AliTPCPRF2D::GetPRF(Float_t xin, Float_t yin, Bool_t inter)
+Float_t AliTPCPRF2D::GetPRF(Float_t xin, Float_t yin)
{
- if (ffcharge==0) return 0;
- // Float_t y=Float_t(fNYdiv-1)*(yin-fY1)/(fY2-fY1);
+ //function which return pad response
+ //for the charge in distance xin
+ //return cubic aproximation of PRF or PRF at nearest virtual wire
+ if (fChargeArray==0) return 0;
//transform position to "wire position"
Float_t y=fDYtoWire*(yin-fY1);
if (fNYdiv == 1) y=fY1;
//normaly it find nearest line charge
- if (inter ==kFALSE){
+ if (fInterY ==0){
Int_t i=Int_t(0.5+y);
if (y<0) i=Int_t(-0.5+y);
if ((i<0) || (i>=fNYdiv) ) return 0;
- fcharge = &(ffcharge[i*fNPRF]);
+ fcharge = &(fChargeArray[i*fNPRF]);
return GetPRFActiv(xin);
}
- else{
- //make interpolation from more fore lines
- Int_t i= Int_t(y);
- 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 =&(ffcharge[(i-1)*fNPRF]);
- z0 = GetPRFActiv(xin);
- }
- fcharge =&(ffcharge[i*fNPRF]);
- z1=GetPRFActiv(xin);
- if ((i+1)<fNYdiv){
- fcharge =&(ffcharge[(i+1)*fNPRF]);
- z2 = GetPRFActiv(xin);
- }
- if ((i+2)<fNYdiv){
- fcharge =&(ffcharge[(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);
- Float_t res = a+b*dy+c*dy*dy+d*dy*dy*dy;
- //Float_t res = z1*(1-dy)+z2*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;
}
Float_t AliTPCPRF2D::GetPRFActiv(Float_t xin)
{
- //x xin DStep unit
- //return splaine aproximaton
+ //GEt response function on given charege line
+ //return spline aproximaton
Float_t x = (xin*fDStepM1)+fNPRF/2;
Int_t i = Int_t(x);
- if ( (i>0) && ((i+2)<fNPRF)) {
- Float_t a,b,c,d,K,L;
+ if ( (i>1) && ((i+2)<fNPRF)) {
+ Float_t a,b,c,d,k,l;
a = fcharge[i];
b = (fcharge[i+1]-fcharge[i-1])*0.5;
- K = fcharge[i+1]-a-b;
- L = (fcharge[i+2]-fcharge[i])*0.5-b;
- d=L-2.*K;
- c=K-d;
+ k = fcharge[i+1]-a-b;
+ l = (fcharge[i+2]-fcharge[i])*0.5-b;
+ d=l-2.*k;
+ c=k-d;
Float_t dx=x-Float_t(i);
Float_t res = a+b*dx+c*dx*dx+d*dx*dx*dx;
return res;
Float_t AliTPCPRF2D::GetGRF(Float_t xin, Float_t yin)
{
- if (fGRF != 0 )
- return fkNorm*fGRF->Eval(xin,yin)/fInteg;
+ //function which returnoriginal charge distribution
+ //this function is just normalised for fKnorm
+ if (GetGRF() != 0 )
+ return fKNorm*GetGRF()->Eval(xin,yin)/fInteg;
else
return 0.;
}
void AliTPCPRF2D::SetParam( TF2 * GRF, Float_t kNorm,
Float_t sigmaX, Float_t sigmaY)
{
+ //adjust parameters of the original charge distribution
+ //and pad size parameters
if (fGRF !=0 ) fGRF->Delete();
fGRF = GRF;
- fkNorm = kNorm;
- if (sigmaX ==0) sigmaX=(fWidth+fK*fHeightS)/sqrt12;
- if (sigmaY ==0) sigmaY=(fWidth+fK*fHeightS)/sqrt12;
- forigsigmaX=sigmaX;
- forigsigmaY=sigmaY;
- fDStep = TMath::Sqrt(sigmaX*sigmaX+fWidth*fWidth/6.)/10.;
- // Update();
- sprintf(fType,"User");
+ fKNorm = kNorm;
+ sprintf(fType,"User");
+ if (sigmaX ==0) sigmaX=(fWidth*(1+TMath::Abs(fK)))/fgkSQRT12;
+ if (sigmaY ==0) sigmaY=(fWidth*(1+TMath::Abs(fK)))/fgkSQRT12;
+ fOrigSigmaX=sigmaX;
+ fOrigSigmaY=sigmaY;
+ Double_t estimsigma =
+ TMath::Sqrt(sigmaX*sigmaX+(fWidth*fWidth*(1+TMath::Abs(fK))/12)+
+ TMath::Tan(fPadAngle*fgkDegtoRad)*TMath::Tan(fPadAngle*fgkDegtoRad)*fHeightFull*fHeightFull/12);
+ if (estimsigma < 5*sigmaX) {
+ fDStep = estimsigma/10.;
+ fNPRF = Int_t(estimsigma*8./fDStep);
+ }
+ else{
+ fDStep = sigmaX;
+ Double_t width = fWidth*(1+TMath::Abs(fK))+TMath::Abs(TMath::Tan(fPadAngle*fgkDegtoRad))*fHeightFull;
+ fNPRF = Int_t((width+8.*sigmaX)/fDStep);
+ };
+
}
void AliTPCPRF2D::SetGauss(Float_t sigmaX, Float_t sigmaY,
Float_t kNorm)
{
- fkNorm = kNorm;
+ //
+ // set parameters for Gauss generic charge distribution
+ //
+ fKNorm = kNorm;
+ fOrigSigmaX=sigmaX;
+ 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;
funParam[2]=fK;
funParam[3]=fHeightS;
- forigsigmaX=sigmaX;
- forigsigmaY=sigmaY;
- fGRF->SetParameters(funParam);
- fDStep = TMath::Sqrt(sigmaX*sigmaX+fWidth*fWidth/6.)/10.;
- //by default I set the step as one tenth of sigma
- //Update();
- sprintf(fType,"Gauss");
+
+ fGRF->SetParameters(funParam);
+ Double_t estimsigma =
+ TMath::Sqrt(sigmaX*sigmaX+(fWidth*fWidth*(1+TMath::Abs(fK))/12)+
+ TMath::Tan(fPadAngle)*TMath::Tan(fPadAngle*fgkDegtoRad)*fHeightFull*fHeightFull/12);
+ if (estimsigma < 5*sigmaX) {
+ fDStep = estimsigma/10.;
+ fNPRF = Int_t(estimsigma*8./fDStep);
+ }
+ else{
+ fDStep = sigmaX;
+ Double_t width = fWidth*(1+TMath::Abs(fK))+TMath::Abs(TMath::Tan(fPadAngle*fgkDegtoRad))*fHeightFull;
+ fNPRF = Int_t((width+8.*sigmaX)/fDStep);
+ };
+
+
}
-
void AliTPCPRF2D::SetCosh(Float_t sigmaX, Float_t sigmaY,
Float_t kNorm)
-{
- fkNorm = kNorm;
+{
+ // set parameters for Cosh generic charge distribution
+ //
+ fKNorm = kNorm;
+ fOrigSigmaX=sigmaX;
+ 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;
funParam[3]=fHeightS;
fGRF->SetParameters(funParam);
- forigsigmaX=sigmaX;
- forigsigmaY=sigmaY;
- fDStep = TMath::Sqrt(sigmaX*sigmaX+fWidth*fWidth/6.)/10.;
- //by default I set the step as one tenth of sigma
- //Update();
- sprintf(fType,"Cosh");
+
+ Double_t estimsigma = TMath::Sqrt(sigmaX*sigmaX+fWidth*fWidth*(1+TMath::Abs(fK))/12);
+ if (estimsigma < 5*sigmaX) {
+ fDStep = estimsigma/10.;
+ fNPRF = Int_t(estimsigma*8./fDStep);
+ }
+ else{
+ fDStep = sigmaX;
+ fNPRF = Int_t((1.2*fWidth*(1+TMath::Abs(fK))+8.*sigmaX)/fDStep);
+ };
+
}
void AliTPCPRF2D::SetGati(Float_t K3X, Float_t K3Y,
Float_t padDistance,
Float_t kNorm)
{
- fkNorm = kNorm;
- if (fGRF !=0 ) fGRF->Delete();
- fGRF = new TF2("fun", funGati2D,-5.,5.,-5.,5.,5);
+ // set parameters for Gati generic charge distribution
+ //
+ fKNorm = kNorm;
fK3X=K3X;
fK3Y=K3Y;
- fPadDistance=padDistance;
+ fPadDistance=padDistance;
+ sprintf(fType,"Gati");
+ if (fGRF !=0 ) fGRF->Delete();
+ fGRF = new TF2("funGati2D", funGati2D,-5.,5.,-5.,5.,5);
+
funParam[0]=padDistance;
funParam[1]=K3X;
funParam[2]=fK;
funParam[3]=fHeightS;
funParam[4]=K3Y;
fGRF->SetParameters(funParam);
- forigsigmaX=padDistance;
- forigsigmaY=padDistance;
- fDStep = TMath::Sqrt(padDistance*padDistance+fWidth*fWidth/6.)/10.;
- //by default I set the step as one tenth of sigma
- //Update();
- sprintf(fType,"Gati");
+ fOrigSigmaX=padDistance;
+ fOrigSigmaY=padDistance;
+ Float_t sigmaX = fOrigSigmaX;
+ Double_t estimsigma = TMath::Sqrt(sigmaX*sigmaX+fWidth*fWidth*(1+TMath::Abs(fK))/12);
+ if (estimsigma < 5*sigmaX) {
+ fDStep = estimsigma/10.;
+ fNPRF = Int_t(estimsigma*8./fDStep);
+ }
+ else{
+ fDStep = sigmaX;
+ fNPRF = Int_t((1.2*fWidth*(1+TMath::Abs(fK))+8.*sigmaX)/fDStep);
+ };
}
void AliTPCPRF2D::Update()
{
- for (Int_t i=0; i<fNYdiv; i++){
- if (fNYdiv == 1) fActualY = fY1;
+ //
+ //update fields with interpolated values for
+ //PRF calculation
+
+ if ( fGRF == 0 ) return;
+ //initialize interpolated values to 0
+ Int_t i;
+ if (fChargeArray!=0) delete [] fChargeArray;
+ fChargeArray = new Float_t[fNPRF*fNYdiv];
+ fNChargeArray = fNPRF*fNYdiv;
+ for (i =0; i<fNPRF*fNYdiv;i++) fChargeArray[i] = 0;
+ //firstly calculate total integral of charge
+
+ ////////////////////////////////////////////////////////
+ //I'm waiting for normal integral
+ //in this moment only sum
+ Float_t x2= 4*fOrigSigmaX;
+ Float_t y2= 4*fOrigSigmaY;
+ Float_t dx = fOrigSigmaX/Float_t(fNdiv*6);
+ Float_t dy = fOrigSigmaY/Float_t(fNdiv*6);
+ Int_t nx = Int_t(0.5+x2/dx);
+ Int_t ny = Int_t(0.5+y2/dy);
+ Int_t ix,iy;
+ fInteg = 0;
+ Double_t dInteg =0;
+ for (ix=-nx;ix<=nx;ix++)
+ for ( iy=-ny;iy<=ny;iy++)
+ dInteg+=fGRF->Eval(Float_t(ix)*dx,Float_t(iy)*dy)*dx*dy;
+ /////////////////////////////////////////////////////
+ fInteg =dInteg;
+ if ( fInteg == 0 ) fInteg = 1;
+
+ for (i=0; i<fNYdiv; i++){
+ if (fNYdiv == 1) fCurrentY = fY1;
else
- fActualY = fY1+Float_t(i)*(fY2-fY1)/Float_t(fNYdiv-1);
- fcharge = &(ffcharge[i*fNPRF]);
+ fCurrentY = fY1+Double_t(i)*(fY2-fY1)/Double_t(fNYdiv-1);
+ fcharge = &(fChargeArray[i*fNPRF]);
Update1();
}
+ //calculate conversion coefitient to convert position to virtual wire
+ fDYtoWire=Float_t(fNYdiv-1)/(fY2-fY1);
+ fDStepM1=1/fDStep;
+ UpdateSigma();
}
-
-
void AliTPCPRF2D::Update1()
{
- //initialize to 0
-
-
+ //
+ //update fields with interpolated values for
+ //PRF calculation for given charge line
Int_t i;
- Float_t x;
- for (i =0; i<fNPRF;i++) fcharge[i] = 0;
- if ( fGRF == 0 ) return;
- ////////////////////////////////////////////////////////
- //I'm waiting for normal integral
- //in this moment only sum
- Float_t x2= 4*forigsigmaX;
- Float_t y2= 4*forigsigmaY;
- Float_t dx = forigsigmaX/Float_t(fNdiv*6);
- Float_t dy = forigsigmaY/Float_t(fNdiv*6);
- fInteg = 0;
- for (x=0.;x<x2;x+=dx)
- for (Float_t y=0;y<y2;y+=dy) fInteg+=fGRF->Eval(x,y)*dx*dy;
- fInteg*=4;
- /////////////////////////////////////////////////////
+ Double_t cos = TMath::Cos(fChargeAngle);
+ Double_t sin = TMath::Sin(fChargeAngle);
+ const Double_t kprec =0.00000001;
+ //integrate charge over pad for different distance of pad
+ for (i =0; i<fNPRF;i++){
+ //x in cm fWidth in cm
+ //calculate integral
+ Double_t xch = fDStep * (Double_t)(i-fNPRF/2);
+ fcharge[i]=0;
+ Double_t k=1;
+
+
+ for (Double_t ym=-fHeightFull/2.-fShiftY; ym<fHeightFull/2.-kprec;ym+=fHeightS){
+ Double_t y2chev=TMath::Min((ym+fHeightS),Double_t(fHeightFull/2.)); // end of chevron step
+ Double_t y1chev= ym; //beginning of chevron step
+ Double_t y2 = TMath::Min(y2chev,fCurrentY+3.5*fOrigSigmaY);
+ Double_t y1 = TMath::Max((y1chev),Double_t(-fHeightFull/2.));
+ y1 = TMath::Max(y1chev,fCurrentY-3.5*fOrigSigmaY);
+
+ Double_t x0 = fWidth*(-1.-(Double_t(k)*fK))*0.5+ym*TMath::Tan(fPadAngle*fgkDegtoRad);
+ Double_t kx = Double_t(k)*(fK*fWidth)/fHeightS;
+ kx = TMath::Tan(TMath::ATan(kx))+TMath::Tan(fPadAngle*fgkDegtoRad);
+
+ Int_t ny = TMath::Max(Int_t(fNdiv*TMath::Exp(-(y1-fCurrentY)*(y1-fCurrentY)/(2*fOrigSigmaY*fOrigSigmaY))),4);
+ Double_t dy = TMath::Min(fOrigSigmaY/Double_t(ny),y2-y1);
+ Double_t ndy = dy;
-
- if ( fInteg == 0 ) fInteg = 1;
-
- //integrate charge over pad for different distance of pad
- for (i =0; i<fNPRF;i++)
- { //x in cm fWidth in cm
- //calculate integral
- Float_t xch = fDStep * (Float_t)(i-fNPRF/2);
- Float_t k=1;
- fcharge[i]=0;
- for (Float_t y=-fHeightFull/2.-fShiftY;
- y<fHeightFull/2.;y+=fHeightS){
- Float_t y2=TMath::Min((y+fHeightS),Float_t(fHeightFull/2.));
- Float_t y1=TMath::Max((y),Float_t(-fHeightFull/2.));
- Float_t x1;
+ //loop over different y strips with variable step size dy
+ if (y2>(y1+kprec)) for (Double_t y = y1; y<y2+kprec;){
+ //new step SIZE
- if (k>0)
- x1 = (y2-y1)*fK-(fWidth+fK*fHeightS)/2.;
- else
- x1 =-(fWidth+fK*fHeightS)/2. ;
- Float_t x2=x1+fWidth;
-
- if (y2>y1) {
-
- if ((x2-x1)*fNdiv<forigsigmaX) dx=(x2-x1);
- else{
- dx= forigsigmaX/Float_t(fNdiv);
- dx = (x2-x1)/Float_t(Int_t(3+(x2-x1)/dx));
- }
- Float_t dy;
- if ((y2-y1)*fNdiv<forigsigmaY) dy=(y2-y1);
- else{
- dy= forigsigmaY/Float_t(fNdiv);
- dy = (y2-y1)/Float_t(Int_t(3+(y2-y1)/dy));
+ ny = TMath::Max(Int_t(fNdiv*TMath::Exp(-(y-fCurrentY)*(y-fCurrentY)/(2*fOrigSigmaY*fOrigSigmaY))),5);
+ ndy = fOrigSigmaY/Double_t(ny);
+ if (ndy>(y2-y-dy)) {
+ ndy =y2-y-dy;
+ if (ndy<kprec) ndy=2*kprec; //calculate new delta y
+ }
+ //
+ Double_t sumch=0;
+ //calculation of x borders and initial step
+ Double_t deltay = (y-y1chev);
+
+ Double_t xp1 = x0+deltay*kx;
+ //x begining of pad at position y
+ Double_t xp2 =xp1+fWidth; //x end of pad at position y
+ Double_t xp3 =xp1+kx*dy; //...at position y+dy
+ Double_t xp4 =xp2+kx*dy; //..
+
+ Double_t x1 = TMath::Min(xp1,xp3);
+ x1 = TMath::Max(xp1,xch-3.5*fOrigSigmaX); //beging of integration
+ Double_t x2 = TMath::Max(xp2,xp4);
+ x2 = TMath::Min(xp2+dy*kx,xch+3.5*fOrigSigmaX); //end of integration
+
+ Int_t nx = TMath::Max(Int_t(fNdiv*TMath::Exp(-(x1-xch)*(x1-xch)/(2*fOrigSigmaX*fOrigSigmaX))*
+ TMath::Exp(-(y1-fCurrentY)*(y1-fCurrentY)/(2*fOrigSigmaY*fOrigSigmaY))),2);
+ Double_t dx = TMath::Min(fOrigSigmaX/Double_t(nx),x2-x1)/5.; //on the border more iteration
+ Double_t ndx=dx;
+
+ if (x2>(x1+kprec)) {
+ for (Double_t x = x1; x<x2+kprec ;){
+ //new step SIZE
+ nx = TMath::Max(Int_t(fNdiv*TMath::Exp(-(x-xch)*(x-xch)/(2*fOrigSigmaX*fOrigSigmaX))),3);
+ ndx = fOrigSigmaX/Double_t(nx);
+ if (ndx>(x2-x-dx)) {
+ ndx =x2-x-dx;
+ }
+ if ( ( (x+dx+ndx)<TMath::Max(xp3,xp1)) || ( (x+dx+ndx)>TMath::Min(xp4,xp2))) {
+ ndx/=5.;
+ }
+ if (ndx<kprec) ndx=2*kprec;
+ //INTEGRAL APROXIMATION
+ Double_t ddx,ddy,dddx,dddy;
+ ddx = xch-(x+dx/2.);
+ ddy = fCurrentY-(y+dy/2.);
+ dddx = cos*ddx-sin*ddy;
+ dddy = sin*ddx+cos*ddy;
+ Double_t z0=fGRF->Eval(dddx,dddy); //middle point
+
+ ddx = xch-(x+dx/2.);
+ ddy = fCurrentY-(y);
+ dddx = cos*ddx-sin*ddy;
+ dddy = sin*ddx+cos*ddy;
+ Double_t z1=fGRF->Eval(dddx,dddy); //point down
+
+ ddx = xch-(x+dx/2.);
+ ddy = fCurrentY-(y+dy);
+ dddx = cos*ddx-sin*ddy;
+ dddy = sin*ddx+cos*ddy;
+ Double_t z3=fGRF->Eval(dddx,dddy); //point up
+
+ ddx = xch-(x);
+ ddy = fCurrentY-(y+dy/2.);
+ dddx = cos*ddx-sin*ddy;
+ dddy = sin*ddx+cos*ddy;
+ Double_t z2=fGRF->Eval(dddx,dddy); //point left
+
+ ddx = xch-(x+dx);
+ ddy = fCurrentY-(y+dy/2.);
+ dddx = cos*ddx-sin*ddy;
+ dddy = sin*ddx+cos*ddy;
+ Double_t z4=fGRF->Eval(dddx,dddy); //point right
+
+
+ if (z0<0) {z0=0;z1=0;z2=0;z3=0;z4=0;}
+
+ Double_t f2x= (z3+z1-2*z0)*4.;//second derivation in y
+ Double_t f2y= (z2+z4-2*z0)*4.;//second derivation in x
+ Double_t f1y= (z3-z1);
+ Double_t z ;
+ z = (z0+f2x/6.+f2y/6.);//second order aproxiation of integral
+ if (kx>kprec){ //positive derivation
+ if (x<(xp1+dy*kx)){ //calculate volume at left border
+ Double_t xx1 = x;
+ Double_t xx2 = TMath::Min(x+dx,xp1+dy*kx);
+ Double_t yy1 = y+(xx1-xp1)/kx;
+ Double_t yy2 = TMath::Min(y+(xx2-xp1)/kx,y+dy);
+ z=z0;
+ if (yy2<y+dy) {
+ z-= z0*(y+dy-yy2)/dy; //constant part rectangle
+ z-= f1y*(xx2-xx1)*(y+dy-yy2)*(y+dy-yy2)/(2.*dx*dy);
+ }
+ z-=z0*(xx2-xx1)*(yy2-yy1)/(2*dx*dy); //constant part rectangle
+
+ }
+ if (x>xp2){ //calculate volume at right border
+ Double_t xx1 = x;
+ Double_t xx2 = x+dx;
+ Double_t yy1 = y+(xx1-xp2)/kx;
+ Double_t yy2 = y+(xx2-xp2)/kx;
+ z=z0;
+ //rectangle part
+ z-=z0*(yy1-y)/dy; //constant part
+ z-=f1y*(xx2-xx1)*(yy1-y)*(yy1-y)/(2*dx*dy);
+ //triangle part
+ z-=z0*(xx2-xx1)*(yy2-yy1)/(2*dx*dy); //constant part
+ }
+ }
+ if (kx<-kprec){ //negative derivation
+ if (x<(xp1+dy*kx)){ //calculate volume at left border
+ Double_t xx1 = x;
+ Double_t xx2 = TMath::Min(x+dx,xp3-dy/kx);
+ Double_t yy1 = y+(xx1-xp1)/kx;
+ Double_t yy2 = TMath::Max(y,yy1+(xx2-xx1)/kx); //yy2<yy1
+ z = z0;
+ z-= z0*(yy2-y)/dy; // constant part rectangle
+ z-= f1y*(xx2-xx1)*(yy2-y)*(yy2-y)/(2.*dx*dy);
+ z-=z0*(xx2-xx1)*(yy1-yy2)/(2*dx*dy); //constant part triangle
}
+ if (x>xp2){ //calculate volume at right border
+ Double_t xx1 = TMath::Max(x,xp2+dy*kx);
+ Double_t xx2 = x+dx;
+ Double_t yy1 = TMath::Min(y+dy,y-(xp2-xx1)/kx);
+ Double_t yy2 = y-(xp2-xx2)/kx;
+ z=z0;
+ z-=z0*(yy2-y)/dy; //constant part rextangle
+ z-= f1y*(xx2-xx1)*(yy2-y)*(yy2-y)/(2.*dx*dy);
+ z-=z0*(xx2-xx1)*(yy1-yy2)/(2*dx*dy); //constant part triangle
+ }
+ }
+
+ if (z>0.) sumch+=fKNorm*z*dx*dy/fInteg;
+
+ x+=dx;
+ dx = ndx;
+ }; //loop over x
+ fcharge[i]+=sumch;
+ }//if x2>x1
+ y+=dy;
+ dy =ndy;
+ }//step over different y
+ k*=-1.;
+ }//step over chevron
+
+ }//step over different points on line NPRF
+}
- for (x=x1;x<x2;x+=dx)
- for (Float_t y=y1;y<y2;y+=dy){
- if ( (y>(fActualY-(4.0*forigsigmaY))) &&
- (y<(fActualY+(4.0*forigsigmaY)))){
- Float_t xt=x-k*fK*(y-y1);
- if ((TMath::Abs(xch-xt)<4*forigsigmaX)){
-
- Float_t z0=fGRF->Eval(xch-(xt+dx/2.),fActualY-(y+dy/2.));
-
- Float_t z1=fGRF->Eval(xch-(xt+dx/2.),fActualY-y);
- Float_t z2=fGRF->Eval(xch-xt,fActualY-(y+dy/2.));
- Float_t z3=fGRF->Eval(xch-(xt-dx/2.),fActualY-y);
- Float_t z4=fGRF->Eval(xch-xt,fActualY-(y-dy/2.));
- if (z0<0) z0=0;
- if (z1<0) z1=0;
- if (z2<0) z2=0;
- if (z3<0) z3=0;
- if (z4<0) z4=0;
-
- // Float_t a=(z1-z3)/2;
- // Float_t b=(z2-z4)/2;
- Float_t c= (z3+z1-2*z0)/2.;
- Float_t d= (z2+z4-2*z0)/2.;
- Float_t z= (z0+c/12.+d/12.);
-
- //Float_t z= fGRF->Eval(xch-xt,fActualY-y);
- if (z>0.) fcharge[i]+=z*dx*dy/fInteg;
- }
- }
- }
- }
- k*=-1;
- }
- };
-
- fSigmaX = 0;
+void AliTPCPRF2D::UpdateSigma()
+{
+ //
+ //calulate effective sigma X and sigma y of PRF
+ fMeanX = 0;
+ fMeanY = 0;
+ fSigmaX = 0;
+ fSigmaY = 0;
+
Float_t sum =0;
- Float_t mean=0;
- for (x =-fNPRF*fDStep; x<fNPRF*fDStep;x+=fDStep)
- { //x in cm fWidth in cm
- Float_t weight = GetPRFActiv(x);
- fSigmaX+=x*x*weight;
- mean+=x*weight;
- sum+=weight;
+ Int_t i;
+ Float_t x,y;
+
+ for (i=-1; i<=fNYdiv; i++){
+ if (fNYdiv == 1) y = fY1;
+ else
+ y = fY1+Float_t(i)*(fY2-fY1)/Float_t(fNYdiv-1);
+ for (x =-fNPRF*fDStep; x<fNPRF*fDStep;x+=fDStep)
+ {
+ //x in cm fWidth in cm
+ Float_t weight = GetPRF(x,y);
+ fSigmaX+=x*x*weight;
+ fSigmaY+=y*y*weight;
+ fMeanX+=x*weight;
+ fMeanY+=y*weight;
+ sum+=weight;
};
+ }
if (sum>0){
- mean/=sum;
- fSigmaX = TMath::Sqrt(fSigmaX/sum-mean*mean);
+ fMeanX/=sum;
+ fMeanY/=sum;
+ fSigmaX = TMath::Sqrt(fSigmaX/sum-fMeanX*fMeanX);
+ fSigmaY = TMath::Sqrt(fSigmaY/sum-fMeanY*fMeanY);
}
else fSigmaX=0;
- //calculate conversion coefitient to convert position to virtual wire
- fDYtoWire=Float_t(fNYdiv-1)/(fY2-fY1);
- fDStepM1=1/fDStep;
}
+
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 >> fSigmaX;
- R__b >> fHeightFull;
- R__b >> fHeightS;
- R__b >> fShiftY;
- R__b >> fWidth;
- R__b >> fK;
- R__b >> fActualY;
- //read charge parameters
- R__b >> fType[0];
- R__b >> fType[1];
- R__b >> fType[2];
- R__b >> fType[3];
- R__b >> fType[4];
- R__b >> forigsigmaX;
- R__b >> forigsigmaY;
- R__b >> fkNorm;
- R__b >> fK3X;
- R__b >> fK3Y;
- R__b >> fPadDistance;
- R__b >> fInteg;
-
+ 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) {
- delete [] fGRF;
- fGRF=0;
- }
- if (strncmp(fType,"User",3)==0){
- fGRF= new TF2;
- R__b>>fGRF;
+ 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);
}
- 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;
- if (ffcharge!=0) delete [] ffcharge;
- ffcharge = new Float_t[fNPRF*fNYdiv];
- R__b.ReadFastArray(ffcharge,fNPRF*fNYdiv);
- 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 << fSigmaX;
- R__b << fHeightFull;
- R__b << fHeightS;
- R__b << fShiftY;
- R__b << fWidth;
- R__b << fK;
- R__b << fActualY;
- //write charge parameters
- R__b << fType[0];
- R__b << fType[1];
- R__b << fType[2];
- R__b << fType[3];
- R__b << fType[4];
-
- R__b << forigsigmaX;
- R__b << forigsigmaY;
- R__b << fkNorm;
- R__b << fK3X;
- R__b << fK3Y;
- R__b << fPadDistance;
- R__b << fInteg;
-
- 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.WriteFastArray(ffcharge,fNPRF*fNYdiv);
- R__b.WriteFastArray(funParam,5);
+ AliTPCPRF2D::Class()->WriteBuffer(R__b,this);
}
}
-
-
-void AliTPCPRF2D::DrawX(Float_t x1 ,Float_t x2,Float_t y, Bool_t inter)
-{
- if (fGRF==0) return ;
- const Int_t N=100;
- char s[100];
- TCanvas * c1 = new TCanvas("canPRF","Pad response function",700,900);
- c1->cd();
- TPad * pad1 = new TPad("pad1PRF","",0.05,0.61,0.95,0.97,21);
- pad1->Draw();
- TPad * pad2 = new TPad("pad2PRF","",0.05,0.22,0.95,0.60,21);
- pad2->Draw();
-
- // pad1->cd();
- //pad2->cd();
- gStyle->SetOptFit(1);
- gStyle->SetOptStat(0);
- sprintf(s,"PRF response function for chevron pad");
- TH1F * hPRFc = new TH1F("hPRFc",s,N+1,x1,x2);
+TH1F * AliTPCPRF2D::GenerDrawXHisto(Float_t x1, Float_t x2,Float_t y)
+{
+ //gener one dimensional hist of pad response function
+ // at position y
+ char s[100];
+ const Int_t kn=200;
+ sprintf(s,"Pad Response Function");
+ TH1F * hPRFc = new TH1F("hPRFc",s,kn+1,x1,x2);
Float_t x=x1;
Float_t y1;
- // Float_t y2;
- for (Float_t i = 0;i<N+1;i++)
+ for (Int_t i = 0;i<kn+1;i++)
{
- x+=(x2-x1)/Float_t(N);
- y1 = GetPRF(x,y,inter);
+ x+=(x2-x1)/Float_t(kn);
+ y1 = GetPRF(x,y);
hPRFc->Fill(x,y1);
};
+ hPRFc->SetXTitle("pad (cm)");
+ return hPRFc;
+}
- pad1->cd();
- fGRF->SetRange(x1,x1,x2,x2);
- fGRF->SetNpx(25);
- fGRF->SetNpy(25);
- fGRF->Draw("lego2");
- // hPRFo->Fit("gaus");
- gStyle->SetOptStat(1);
- pad2->cd();
- hPRFc->Fit("gaus");
- c1->cd();
+AliH2F * AliTPCPRF2D::GenerDrawHisto(Float_t x1, Float_t x2, Float_t y1, Float_t y2, Int_t Nx, Int_t Ny)
+{
+ //
+ //gener two dimensional histogram with PRF
+ //
+ char s[100];
+ sprintf(s,"Pad Response Function");
+ AliH2F * hPRFc = new AliH2F("hPRFc",s,Nx,x1,x2,Ny,y1,y2);
+ Float_t dx=(x2-x1)/Float_t(Nx);
+ Float_t dy=(y2-y1)/Float_t(Ny) ;
+ Float_t x,y,z;
+ x = x1;
+ y = y1;
+ for ( Int_t i = 0;i<=Nx;i++,x+=dx){
+ y=y1;
+ for (Int_t j = 0;j<=Ny;j++,y+=dy){
+ z = GetPRF(x,y);
+ hPRFc->SetCellContent(i,j,z);
+ };
+ };
+ hPRFc->SetXTitle("pad direction (cm)");
+ hPRFc->SetYTitle("pad row direction (cm)");
+ hPRFc->SetTitleOffset(1.5,"X");
+ hPRFc->SetTitleOffset(1.5,"Y");
+ return hPRFc;
+}
+
+
+AliH2F * AliTPCPRF2D::GenerDrawDistHisto(Float_t x1, Float_t x2, Float_t y1, Float_t y2, Int_t Nx, Int_t Ny, Float_t thr)
+{
+ //return histogram with distortion
+ const Float_t kminth=0.00001;
+ if (thr<kminth) thr=kminth;
+ char s[100];
+ sprintf(s,"COG distortion of PRF (threshold=%2.2f)",thr);
+ AliH2F * hPRFDist = new AliH2F("hDistortion",s,Nx,x1,x2,Ny,y1,y2);
+ Float_t dx=(x2-x1)/Float_t(Nx);
+ Float_t dy=(y2-y1)/Float_t(Ny) ;
+ Float_t x,y,z,ddx;
+ x=x1;
+ for ( Int_t i = 0;i<=Nx;i++,x+=dx){
+ y=y1;
+ for(Int_t j = 0;j<=Ny;j++,y+=dy)
+ {
+ Float_t sumx=0;
+ Float_t sum=0;
+ for (Int_t k=-3;k<=3;k++)
+ {
+ Float_t padx=Float_t(k)*fWidth;
+ z = GetPRF(x-padx,y);
+ if (z>thr){
+ sum+=z;
+ sumx+=z*padx;
+ }
+ };
+ if (sum>kminth)
+ {
+ ddx = (x-(sumx/sum));
+ }
+ else ddx=-1;
+ if (TMath::Abs(ddx)<10) hPRFDist->SetCellContent(i,j,ddx);
+ }
+ }
+
+ hPRFDist->SetXTitle("pad direction (cm)");
+ hPRFDist->SetYTitle("pad row direction (cm)");
+ hPRFDist->SetTitleOffset(1.5,"X");
+ hPRFDist->SetTitleOffset(1.5,"Y");
+ return hPRFDist;
+}
+
+
+
+
+
+void AliTPCPRF2D::DrawX(Float_t x1 ,Float_t x2,Float_t y1,Float_t y2, Int_t N)
+{
+ //
+ //draw pad response function at interval <x1,x2> at given y position
+ //
+ if (N<0) return;
+ TCanvas * c1 = new TCanvas("PRFX","Pad response function",700,900);
+ c1->cd();
+
TPaveText * comment = new TPaveText(0.05,0.02,0.95,0.20,"NDC");
comment->SetTextAlign(12);
comment->SetFillColor(42);
- TText *title = comment->AddText("Chevron pad parameters:");
- title->SetTextSize(0.03);
- sprintf(s,"Full height of pad: %2.2f",fHeightFull);
- comment->AddText(s);
- sprintf(s,"Height of one chevron unit h: %2.2f cm",2*fHeightS);
- comment->AddText(s);
- sprintf(s,"Width of one chevron unit w: %2.2f cm",fWidth);
- comment->AddText(s);
- sprintf(s,"Overlap factor: %2.2f",fK*fHeightS/fWidth);
- comment->AddText(s);
- sprintf(s,"Y position: %2.2f ",y);
- comment->AddText(s);
- sprintf(s,"Sigma x of original distribution: %2.2f ",forigsigmaX);
- comment->AddText(s);
- sprintf(s,"Sigma y of original distribution: %2.2f ",forigsigmaY);
- comment->AddText(s);
- sprintf(s,"Type of original distribution: %s ",fType);
- comment->AddText(s);
+ DrawComment(comment);
comment->Draw();
+ c1->cd();
+
+ TPad * pad2 = new TPad("pPRF","",0.05,0.22,0.95,0.95);
+ pad2->Divide(2,(N+1)/2);
+ pad2->Draw();
+ gStyle->SetOptFit(1);
+ gStyle->SetOptStat(1);
+ for (Int_t i=0;i<N;i++){
+ char ch[200];
+ Float_t y;
+ if (N==1) y=y1;
+ else y = y1+i*(y2-y1)/Float_t(N-1);
+ pad2->cd(i+1);
+ TH1F * hPRFc =GenerDrawXHisto(x1, x2,y);
+ sprintf(ch,"PRF at wire position: %2.3f",y);
+ hPRFc->SetTitle(ch);
+ sprintf(ch,"PRF %d",i);
+ hPRFc->SetName(ch);
+ hPRFc->Fit("gaus");
+ }
+
}
-void AliTPCPRF2D::Draw(Float_t x1 ,Float_t x2,Float_t y1, Float_t y2,
- Bool_t inter, Int_t Nx, Int_t Ny)
+void AliTPCPRF2D::DrawPRF(Float_t x1 ,Float_t x2,Float_t y1, Float_t y2, Int_t Nx, Int_t Ny)
{
- char s[100];
- if (fGRF==0) return ;
+ //
+ //
TCanvas * c1 = new TCanvas("canPRF","Pad response function",700,900);
c1->cd();
- TPad * pad1 = new TPad("pad1PRF","",0.05,0.61,0.95,0.97,21);
- pad1->Draw();
- TPad * pad2 = new TPad("pad2PRF","",0.05,0.22,0.95,0.60,21);
- pad2->Draw();
-
- // pad1->cd();
- //pad2->cd();
+ TPad * pad2 = new TPad("pad2PRF","",0.05,0.22,0.95,0.95);
+ pad2->Draw();
gStyle->SetOptFit(1);
- gStyle->SetOptStat(0);
- sprintf(s,"PRF response function for chevron pad");
- TH2F * hPRFc = new TH2F("hPRFc",s,Nx+1,x1,x2,Ny+1,y1,y2);
- Float_t dx=(x2-x1)/Float_t(Nx);
- Float_t dy=(y2-y1)/Float_t(Ny) ;
- Float_t x,y,z;
- // Float_t y2;
- for ( x = x1;x<=x2;x+=dx){
- for(y = y1;y<=y2;y+=dy)
- {
- z = GetPRF(x,y,inter);
- hPRFc->Fill(x,y,z);
- };
- }
- pad1->cd();
- fGRF->SetRange(x1,y1,x2,y2);
- fGRF->SetNpx(25);
- fGRF->SetNpy(25);
- fGRF->Draw("lego2");
- // hPRFo->Fit("gaus");
gStyle->SetOptStat(1);
+ TH2F * hPRFc = GenerDrawHisto(x1, x2, y1, y2, Nx,Ny);
pad2->cd();
- hPRFc->Draw("lego2");
+ hPRFc->Draw("surf");
c1->cd();
TPaveText * comment = new TPaveText(0.05,0.02,0.95,0.20,"NDC");
comment->SetTextAlign(12);
comment->SetFillColor(42);
- TText *title = comment->AddText("Chevron pad parameters:");
- title->SetTextSize(0.03);
- sprintf(s,"Full height of pad: %2.2f",fHeightFull);
- comment->AddText(s);
- sprintf(s,"Height of one chevron unit h: %2.2f cm",2*fHeightS);
- comment->AddText(s);
- sprintf(s,"Width of one chevron unit w: %2.2f cm",fWidth);
- comment->AddText(s);
- sprintf(s,"Overlap factor: %2.2f",fK*fHeightS/fWidth);
- comment->AddText(s);
- sprintf(s,"Sigma x of original distribution: %2.2f ",forigsigmaX);
- comment->AddText(s);
- sprintf(s,"Sigma y of original distribution: %2.2f ",forigsigmaY);
- comment->AddText(s);
- sprintf(s,"Type of original distribution: %s ",fType);
- comment->AddText(s);
+ DrawComment(comment);
comment->Draw();
}
-void AliTPCPRF2D::DrawDist(Float_t x1 ,Float_t x2,Float_t y1, Float_t y2,
- Bool_t inter, Int_t Nx, Int_t Ny, Float_t thr)
+void AliTPCPRF2D::DrawDist(Float_t x1 ,Float_t x2,Float_t y1, Float_t y2, Int_t Nx, Int_t Ny, Float_t thr)
{
- const Float_t minth=0.00001;
- if (thr<minth) thr=minth;
- char s[100];
- if (fGRF==0) return ;
+ //
+ //draw distortion of the COG method - for different threshold parameter
TCanvas * c1 = new TCanvas("padDistortion","COG distortion",700,900);
c1->cd();
- TPad * pad1 = new TPad("CHARGE","",0.05,0.61,0.95,0.97,21);
+ TPad * pad1 = new TPad("dist","",0.05,0.55,0.95,0.95,21);
pad1->Draw();
- TPad * pad2 = new TPad("dist","",0.05,0.22,0.95,0.60,21);
+ TPad * pad2 = new TPad("dist","",0.05,0.22,0.95,0.53,21);
pad2->Draw();
-
- // pad1->cd();
- //pad2->cd();
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
- sprintf(s,"COG distortion (threshold=%2.2f)",thr);
- TH2F * hPRFDist = new TH2F("hDistortion",s,Nx+1,x1,x2,Ny+1,y1,y2);
- Float_t dx=(x2-x1)/Float_t(Nx);
- Float_t dy=(y2-y1)/Float_t(Ny) ;
- Float_t x,y,z,ddx;
- // Float_t y2;
- for ( x = x1;x<(x2+dx/2.);x+=dx)
- for(y = y1;y<=(y2+dx/2.);y+=dy)
- {
- Float_t sumx=0;
- Float_t sum=0;
- for (Float_t padx=-fWidth;padx<(fWidth*1.1);padx+=fWidth)
- {
- z = GetPRF(x-padx,y,inter);
- if (z>thr){
- sum+=z;
- sumx+=z*padx;
- }
- };
- if (sum>minth)
- {
- ddx = (x-(sumx/sum));
- }
- else ddx=-1;
- if (TMath::Abs(ddx)<10) hPRFDist->Fill(x,y,ddx);
- }
+
+ AliH2F * hPRFDist = GenerDrawDistHisto(x1, x2, y1, y2, Nx,Ny,thr);
+
pad1->cd();
- fGRF->SetRange(x1,y1,x2,y2);
- fGRF->SetNpx(25);
- fGRF->SetNpy(25);
- fGRF->Draw("lego2");
- // hPRFo->Fit("gaus");
- // gStyle->SetOptStat(1);
- pad2->cd();
- hPRFDist->Draw("lego2");
+ hPRFDist->Draw("surf");
+ Float_t distmax =hPRFDist->GetMaximum();
+ Float_t distmin =hPRFDist->GetMinimum();
+ gStyle->SetOptStat(1);
+ TH1F * dist = hPRFDist->GetAmplitudes(distmin,distmax,distmin-1);
+ pad2->cd();
+ dist->Draw();
c1->cd();
TPaveText * comment = new TPaveText(0.05,0.02,0.95,0.20,"NDC");
comment->SetTextAlign(12);
comment->SetFillColor(42);
- // TText *title = comment->AddText("Distortion of COG method");
- // title->SetTextSize(0.03);
- TText * title = comment->AddText("Chevron pad parameters:");
+ DrawComment(comment);
+ comment->Draw();
+}
+
+void AliTPCPRF2D::DrawComment(TPaveText *comment)
+{
+ //
+ //function to write comment to picture
+
+ char s[100];
+ //draw comments to picture
+ TText * title = comment->AddText("Pad Response Function parameters:");
title->SetTextSize(0.03);
- sprintf(s,"Full height of pad: %2.2f",fHeightFull);
+ sprintf(s,"Height of pad: %2.2f cm",fHeightFull);
comment->AddText(s);
- sprintf(s,"Height of one chevron unit h: %2.2f cm",2*fHeightS);
+ sprintf(s,"Width pad: %2.2f cm",fWidth);
comment->AddText(s);
- sprintf(s,"Width of one chevron unit w: %2.2f cm",fWidth);
+ sprintf(s,"Pad Angle: %2.2f ",fPadAngle);
comment->AddText(s);
- sprintf(s,"Overlap factor: %2.2f",fK*fHeightS/fWidth);
- comment->AddText(s);
- sprintf(s,"Sigma x of original distribution: %2.2f ",forigsigmaX);
- comment->AddText(s);
- sprintf(s,"Sigma y of original distribution: %2.2f ",forigsigmaY);
- comment->AddText(s);
- sprintf(s,"Type of original distribution: %s ",fType);
- comment->AddText(s);
- comment->Draw();
+ if (TMath::Abs(fK)>0.0001){
+ sprintf(s,"Height of one chevron unit h: %2.2f cm",2*fHeightS);
+ comment->AddText(s);
+ sprintf(s,"Overlap factor: %2.2f",fK);
+ comment->AddText(s);
+ }
+
+ if (strncmp(fType,"User",3)==0){
+ sprintf(s,"Charge distribution - user defined function %s ",fGRF->GetTitle());
+ comment->AddText(s);
+ sprintf(s,"Sigma x of charge distribution: %2.2f ",fOrigSigmaX);
+ comment->AddText(s);
+ sprintf(s,"Sigma y of charge distribution: %2.2f ",fOrigSigmaY);
+ comment->AddText(s);
+ }
+ if (strncmp(fType,"Gauss",3)==0){
+ sprintf(s,"Gauss charge distribution");
+ comment->AddText(s);
+ sprintf(s,"Sigma x of charge distribution: %2.2f ",fOrigSigmaX);
+ comment->AddText(s);
+ sprintf(s,"Sigma y of charge distribution: %2.2f ",fOrigSigmaY);
+ comment->AddText(s);
+ }
+ if (strncmp(fType,"Gati",3)==0){
+ sprintf(s,"Gati charge distribution");
+ comment->AddText(s);
+ sprintf(s,"K3X of Gati : %2.2f ",fK3X);
+ comment->AddText(s);
+ sprintf(s,"K3Y of Gati: %2.2f ",fK3Y);
+ comment->AddText(s);
+ sprintf(s,"Wire to Pad Distance: %2.2f ",fPadDistance);
+ comment->AddText(s);
+ }
+ if (strncmp(fType,"Cosh",3)==0){
+ sprintf(s,"Cosh charge distribution");
+ comment->AddText(s);
+ sprintf(s,"Sigma x of charge distribution: %2.2f ",fOrigSigmaX);
+ comment->AddText(s);
+ sprintf(s,"Sigma y of charge distribution: %2.2f ",fOrigSigmaY);
+ comment->AddText(s);
+ }
+ sprintf(s,"Normalisation: %2.2f ",fKNorm);
+ comment->AddText(s);
}