1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // ITS cluster error and shape parameterization //
22 // andrea.dainese@lnl.infn.it //
23 ///////////////////////////////////////////////////////////////////////////////
26 //#include <TVectorF.h>
27 //#include <TLinearFitter.h>
29 //#include <TProfile2D.h>
32 #include "AliGeomManager.h"
33 #include "AliITSRecPoint.h"
34 #include "AliITSClusterParam.h"
35 #include "AliITSReconstructor.h"
36 #include "AliExternalTrackParam.h"
38 ClassImp(AliITSClusterParam)
41 AliITSClusterParam* AliITSClusterParam::fgInstance = 0;
45 Example usage fitting parameterization (NOT YET...):
46 TFile fres("resol.root"); //tree with resolution and shape
47 TTree * treeRes =(TTree*)fres.Get("Resol");
49 AliITSClusterParam param;
50 param.SetInstance(¶m);
51 param.FitResol(treeRes);
52 param.FitRMS(treeRes);
53 TFile fparam("ITSClusterParam.root","recreate");
57 TFile fparam("ITSClusterParam.root");
58 AliITSClusterParam *param2 = (AliITSClusterParam *) fparam.Get("Param");
59 param2->SetInstance(param2);
60 param2->Test(treeRes);
63 treeRes->Draw("(Resol-AliITSClusterParam::SGetError0(Dim,Pad,Zm,AngleM))/Resol","Dim==0&&QMean<0")
66 //-------------------------------------------------------------------------
67 AliITSClusterParam* AliITSClusterParam::Instance()
70 // Singleton implementation
71 // Returns an instance of this class, it is created if neccessary
74 fgInstance = new AliITSClusterParam();
78 //-------------------------------------------------------------------------
79 void AliITSClusterParam::GetNTeor(Int_t layer,const AliITSRecPoint* /*cl*/,
80 Float_t tgl,Float_t tgphitr,
81 Float_t &ny,Float_t &nz)
84 // Get "mean shape" (original parametrization from AliITStrackerMI)
86 tgl = TMath::Abs(tgl);
87 tgphitr = TMath::Abs(tgphitr);
101 if (layer==4 || layer==5) {
102 ny = 2.02+tgphitr*1.95;
103 nz = 2.02+tgphitr*2.35;
107 ny = 6.6-2.7*tgphitr;
108 nz = 2.8-3.11*tgphitr+0.45*tgl;
111 //--------------------------------------------------------------------------
112 Int_t AliITSClusterParam::GetError(Int_t layer,
113 const AliITSRecPoint *cl,
114 Float_t tgl,Float_t tgphitr,Float_t expQ,
115 Float_t &erry,Float_t &errz)
118 // Calculate cluster position error
120 switch(AliITSReconstructor::GetRecoParam()->GetClusterErrorsParam()) {
122 return GetErrorOrigRecPoint(cl,erry,errz);
125 return GetErrorParamMI(layer,cl,tgl,tgphitr,expQ,erry,errz);
128 return GetErrorParamAngle(layer,cl,tgl,tgphitr,erry,errz);
131 return GetErrorParamMI(layer,cl,tgl,tgphitr,expQ,erry,errz);
136 //--------------------------------------------------------------------------
137 Int_t AliITSClusterParam::GetErrorOrigRecPoint(const AliITSRecPoint*cl,
138 Float_t &erry,Float_t &errz)
141 // Calculate cluster position error (just take error from AliITSRecPoint)
143 erry = TMath::Sqrt(cl->GetSigmaY2());
144 errz = TMath::Sqrt(cl->GetSigmaZ2());
148 //--------------------------------------------------------------------------
149 Int_t AliITSClusterParam::GetErrorParamMI(Int_t layer,const AliITSRecPoint*cl,
150 Float_t tgl,Float_t tgphitr,
152 Float_t &erry,Float_t &errz)
155 // Calculate cluster position error (original parametrization from
159 GetNTeor(layer, cl,tgl,tgphitr,ny,nz);
160 erry = TMath::Sqrt(cl->GetSigmaY2());
161 errz = TMath::Sqrt(cl->GetSigmaZ2());
165 if (TMath::Abs(ny-cl->GetNy())>0.6) {
167 erry*=0.4+TMath::Abs(ny-cl->GetNy());
168 errz*=0.4+TMath::Abs(ny-cl->GetNy());
170 erry*=0.7+0.5*TMath::Abs(ny-cl->GetNy());
171 errz*=0.7+0.5*TMath::Abs(ny-cl->GetNy());
174 if (TMath::Abs(nz-cl->GetNz())>1.) {
175 erry*=TMath::Abs(nz-cl->GetNz());
176 errz*=TMath::Abs(nz-cl->GetNz());
180 erry= TMath::Min(erry,float(0.0050));
181 errz= TMath::Min(errz,float(0.0300));
187 //factor 1.8 appears in new simulation
190 if (cl->GetNy()==100||cl->GetNz()==100){
195 if (cl->GetNy()+cl->GetNz()>12){
200 Float_t normq = cl->GetQ()/(TMath::Sqrt(1+tgl*tgl+tgphitr*tgphitr));
201 Float_t chargematch = TMath::Max(double(normq/expQ),2.);
203 if (cl->GetType()==1 || cl->GetType()==10 ){
204 if (chargematch<1.0 || (cl->GetNy()+cl->GetNz()<nz+ny+0.5)){
206 erry = 0.00094*scale;
209 if (cl->GetNy()+cl->GetNz()<nz+ny+1.2){
215 errz = TMath::Min(0.028*(chargematch+cl->GetNy()+cl->GetNz()-nz+ny),0.15)*scale;
218 if (cl->GetType()==2 || cl->GetType()==11 ){
219 erry = TMath::Min(0.0010*(1+chargematch+cl->GetNy()+cl->GetNz()-nz+ny),0.05)*scale;
220 errz = TMath::Min(0.025*(1+chargematch+cl->GetNy()+cl->GetNz()-nz+ny),0.5)*scale;
224 if (cl->GetType()>100 ){
225 if ((chargematch+cl->GetNy()+cl->GetNz()-nz-ny<1.5)){
227 erry = 0.00096*scale;
230 if (cl->GetNy()+cl->GetNz()-nz-ny<1){
236 errz = TMath::Min(0.05*(chargematch+cl->GetNy()+cl->GetNz()-nz-ny),0.4)*scale;
237 erry = TMath::Min(0.003*(chargematch+cl->GetNy()+cl->GetNz()-nz-ny),0.05)*scale;
240 Float_t diff = cl->GetNy()+cl->GetNz()-ny-nz;
244 if (cl->GetType()==5||cl->GetType()==6||cl->GetType()==7||cl->GetType()==8){
254 Float_t normq = cl->GetQ()/(TMath::Sqrt(1+tgl*tgl+tgphitr*tgphitr));
255 Float_t chargematch = normq/expQ;
256 chargematch/=2.4; // F. Prino Sept. 2007: SDD charge conversion keV->ADC
258 Int_t cnz = cl->GetNz()%10;
260 if (cl->GetType()==1){
261 if (chargematch<1.25){
262 erry = 0.0028*(1.+6./cl->GetQ()); // gold clusters
265 erry = 0.003*chargematch;
266 if (cl->GetNz()==3) erry*=1.5;
268 if (chargematch<1.0){
269 errz = 0.0011*(1.+6./cl->GetQ());
272 errz = 0.002*(1+2*(chargematch-1.));
276 errz*=1.4*(cnz-nz+0.5);
279 if (cl->GetType()>1){
281 erry = 0.00385*(1.+6./cl->GetQ()); // gold clusters
282 errz = 0.0016*(1.+6./cl->GetQ());
285 errz = 0.0014*(1+3*(chargematch-1.));
286 erry = 0.003*(1+3*(chargematch-1.));
290 errz*=1.4*(cnz-nz+0.5);
294 if (TMath::Abs(cl->GetY())>2.5){
295 factorz*=1+2*(TMath::Abs(cl->GetY())-2.5);
297 if (TMath::Abs(cl->GetY())<1){
298 factorz*=1.+0.5*TMath::Abs(TMath::Abs(cl->GetY())-1.);
300 factorz= TMath::Min(factorz,float(4.));
303 erry= TMath::Min(erry,float(0.05));
304 errz= TMath::Min(errz,float(0.05));
307 //--------------------------------------------------------------------------
308 Int_t AliITSClusterParam::GetErrorParamAngle(Int_t layer,
309 const AliITSRecPoint *cl,
310 Float_t tgl,Float_t tgphitr,
311 Float_t &erry,Float_t &errz)
314 // Calculate cluster position error (parametrization extracted from rp-hit
315 // residuals, as a function of angle between track and det module plane.
316 // Origin: M.Lunardon, S.Moretto)
319 Double_t maxSigmaSPDx=100.;
320 Double_t maxSigmaSPDz=400.;
321 Double_t maxSigmaSDDx=100.;
322 Double_t maxSigmaSDDz=400.;
323 Double_t maxSigmaSSDx=100.;
324 Double_t maxSigmaSSDz=1000.;
326 Double_t paramSPDx[3]={-6.417,0.18,11.14};
327 Double_t paramSPDz[2]={118.,-0.155};
328 Double_t paramSDDx[2]={30.93,0.059};
329 Double_t paramSDDz[2]={33.09,0.011};
330 Double_t paramSSDx[2]={18.64,-0.0046};
331 Double_t paramSSDz[2]={784.4,-0.828};
332 Double_t sigmax=1000.0,sigmaz=1000.0;
334 Int_t volId = (Int_t)cl->GetVolumeId();
335 Double_t tra[3]; AliGeomManager::GetOrigTranslation(volId,tra);
336 Double_t rot[9]; AliGeomManager::GetOrigRotation(volId,rot);
339 Double_t phitr = TMath::ATan(tgphitr);
340 Double_t alpha = TMath::ATan2(tra[1],tra[0]);
341 Double_t phiglob = alpha+phitr;
343 p[0] = TMath::Cos(phiglob);
344 p[1] = TMath::Sin(phiglob);
346 TVector3 pvec(p[0],p[1],p[2]);
347 TVector3 normvec(rot[1],-rot[0],0.);
348 Double_t angle = pvec.Angle(normvec);
349 if(angle>0.5*TMath::Pi()) angle = TMath::Pi()-angle;
350 Double_t angleDeg = angle*180./TMath::Pi();
352 if(layer==0 || layer==1) { // SPD
354 sigmax = TMath::Exp(angleDeg*paramSPDx[1]+paramSPDx[0])+paramSPDx[2];
355 sigmaz = paramSPDz[0]+paramSPDz[1]*angleDeg;
356 if(sigmax > maxSigmaSPDx) sigmax = maxSigmaSPDx;
357 if(sigmaz > maxSigmaSPDz) sigmax = maxSigmaSPDz;
359 } else if(layer==2 || layer==3) { // SDD
361 sigmax = angleDeg*paramSDDx[1]+paramSDDx[0];
362 sigmaz = paramSDDz[0]+paramSDDz[1]*angleDeg;
363 if(sigmax > maxSigmaSDDx) sigmax = maxSigmaSDDx;
364 if(sigmaz > maxSigmaSDDz) sigmax = maxSigmaSDDz;
366 } else if(layer==4 || layer==5) { // SSD
368 sigmax = angleDeg*paramSSDx[1]+paramSSDx[0];
369 sigmaz = paramSSDz[0]+paramSSDz[1]*angleDeg;
370 if(sigmax > maxSigmaSSDx) sigmax = maxSigmaSSDx;
371 if(sigmaz > maxSigmaSSDz) sigmax = maxSigmaSSDz;
375 // convert from micron to cm
381 //--------------------------------------------------------------------------
382 void AliITSClusterParam::Print(Option_t* /*option*/) const {
384 // Print param Information
388 // Error parameterization
390 printf("NOT YET...\n");