Adding some further mother volumes to speed-up the overlap checking and particle...
[u/mrichter/AliRoot.git] / ITS / AliITSMapSDD.cxx
CommitLineData
efb451bf 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 "AliITSMapSDD.h"
28
ba0a07bf 29const Int_t AliITSMapSDD::fgkNAnodePtsDefault = 1;
30const Int_t AliITSMapSDD::fgkNDriftPtsDefault = 72;
31
efb451bf 32ClassImp(AliITSMapSDD)
33//______________________________________________________________________
ba0a07bf 34AliITSMapSDD::AliITSMapSDD():
35TNamed("defaultmap",""),
36fNAnodePts(fgkNAnodePtsDefault),
37fNDriftPts(fgkNDriftPtsDefault)
efb451bf 38{
39 // default constructor
efb451bf 40}
41//______________________________________________________________________
ba0a07bf 42AliITSMapSDD::AliITSMapSDD(Char_t *mapname):
43TNamed(mapname,""),
44fNAnodePts(fgkNAnodePtsDefault),
45fNDriftPts(fgkNDriftPtsDefault)
efb451bf 46{
47 // standard constructor
efb451bf 48}
49//______________________________________________________________________
c9a38d3d 50Float_t AliITSMapSDD::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;
ba0a07bf 58 Float_t stept = seg->Dx()*kMicronTocm/(Float_t)fNDriftPts;
c9a38d3d 59 Int_t bint = TMath::Abs((Int_t)(x/stept));
ba0a07bf 60 if(bint==fNDriftPts) bint-=1;
61 if(bint>=fNDriftPts) AliError("Wrong bin number along drift direction!");
c9a38d3d 62 return kMicronTocm*GetCellContent(bina,bint);
63}
64//______________________________________________________________________
efb451bf 65TH2F* AliITSMapSDD::GetMapHisto() const{
66 // Returns a TH2F histogram with map of residuals
67 Char_t hname[50];
68 sprintf(hname,"h%s",GetName());
ba0a07bf 69 TH2F* hmap=new TH2F(hname,"",fNAnodePts,-0.5,255.5,fNDriftPts,0.,35.);
70 for(Int_t iAn=0;iAn<fNAnodePts; iAn++){
71 for(Int_t iDr=0;iDr<fNDriftPts; iDr++){
ab516493 72 hmap->SetBinContent(iAn+1,iDr+1,GetCellContent(iAn,iDr));
efb451bf 73 }
74 }
75 return hmap;
76}
77//______________________________________________________________________
78TH1F* AliITSMapSDD::GetResidualDistr(Float_t dmin, Float_t dmax) const{
79 // Returns a TH1F histogram with distribution of residual
80 Char_t hname[50];
81 sprintf(hname,"hd%s",GetName());
82 TH1F* hd=new TH1F(hname,"",100,dmin,dmax);
ba0a07bf 83 for(Int_t iAn=0;iAn<fNAnodePts; iAn++){
84 for(Int_t iDr=0;iDr<fNDriftPts; iDr++){
ab516493 85 hd->Fill(GetCellContent(iAn,iDr));
efb451bf 86 }
87 }
88 return hd;
89}