]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCorrMapSDD.cxx
Improvements related to the new FEROM firmware (E. Fragiacomo)
[u/mrichter/AliRoot.git] / ITS / AliITSCorrMapSDD.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////
19 //                                                               //
20 // Implementation of the base class for SDD map corrections      //
21 // Origin: F.Prino, Torino, prino@to.infn.it                     //
22 //                                                               //
23 ///////////////////////////////////////////////////////////////////
24
25 #include "TH1F.h"
26 #include "TH2F.h"
27 #include "AliITSCorrMapSDD.h"
28
29 const Int_t AliITSCorrMapSDD::fgkNAnodePtsDefault = 1;
30 const Int_t AliITSCorrMapSDD::fgkNDriftPtsDefault = 72;
31
32 ClassImp(AliITSCorrMapSDD)
33 //______________________________________________________________________
34 AliITSCorrMapSDD::AliITSCorrMapSDD():
35 TNamed("defaultmap",""),
36 fNAnodePts(fgkNAnodePtsDefault),
37 fNDriftPts(fgkNDriftPtsDefault)
38 {
39   // default constructor  
40 }
41 //______________________________________________________________________
42 AliITSCorrMapSDD::AliITSCorrMapSDD(Char_t *mapname):
43 TNamed(mapname,""),
44 fNAnodePts(fgkNAnodePtsDefault),
45 fNDriftPts(fgkNDriftPtsDefault)
46 {
47   // standard constructor
48 }
49 //______________________________________________________________________
50 Float_t AliITSCorrMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg){
51   // returns correction in cm starting from local coordinates on the module
52   const Double_t kMicronTocm = 1.0e-4; 
53   Int_t nAnodes=seg->Npz();
54   Int_t nAnodesHybrid=seg->NpzHalf();
55   Int_t bina =(Int_t) seg->GetAnodeFromLocal(x,z);
56   if(bina>nAnodes)  AliError("Wrong anode anumber!");
57   if(bina>=nAnodesHybrid) bina-=nAnodesHybrid;
58   Float_t stept = seg->Dx()*kMicronTocm/(Float_t)fNDriftPts;
59   Float_t drLen= seg->Dx()*kMicronTocm-TMath::Abs(x);
60   Int_t bint = TMath::Abs((Int_t)(drLen/stept));
61   if(bint==fNDriftPts) bint-=1;
62   if(bint>=fNDriftPts) AliError("Wrong bin number along drift direction!");
63   return kMicronTocm*GetCellContent(bina,bint);
64 }
65 //______________________________________________________________________
66 TH2F* AliITSCorrMapSDD::GetMapHisto() const{
67   // Returns a TH2F histogram with map of residuals
68   Char_t hname[50];
69   sprintf(hname,"h%s",GetName());
70   TH2F* hmap=new TH2F(hname,"",fNAnodePts,-0.5,255.5,fNDriftPts,0.,35.);
71   for(Int_t iAn=0;iAn<fNAnodePts; iAn++){
72     for(Int_t iDr=0;iDr<fNDriftPts; iDr++){
73       hmap->SetBinContent(iAn+1,iDr+1,GetCellContent(iAn,iDr));
74     }
75   }
76   return hmap;
77 }
78 //______________________________________________________________________
79 TH1F* AliITSCorrMapSDD::GetMapProfile() const{
80   // Returns a TH1F with the projection of the map along drift coordinate
81   Char_t hname[50];
82   sprintf(hname,"p%s",GetName());
83   TH1F* hprof=new TH1F(hname,"",fNDriftPts,0.,35.);
84   for(Int_t iDr=0;iDr<fNDriftPts; iDr++){
85     Float_t meanval=0.;
86     for(Int_t iAn=0;iAn<fNAnodePts; iAn++){
87       meanval+=GetCellContent(iAn,iDr);
88     }
89     hprof->SetBinContent(iDr+1,meanval/fNAnodePts);
90   }
91   return hprof;
92   
93 }
94 //______________________________________________________________________
95 TH1F* AliITSCorrMapSDD::GetResidualDistr(Float_t dmin, Float_t dmax) const{
96   // Returns a TH1F histogram with distribution of residual
97   Char_t hname[50];
98   sprintf(hname,"hd%s",GetName());
99   TH1F* hd=new TH1F(hname,"",100,dmin,dmax);
100   for(Int_t iAn=0;iAn<fNAnodePts; iAn++){
101     for(Int_t iDr=0;iDr<fNDriftPts; iDr++){
102       hd->Fill(GetCellContent(iAn,iDr));
103     }
104   }
105   return hd;
106 }