LCOV - code coverage report
Current view: top level - ITS/ITSbase - AliITSMapSDD.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 47 2.1 %
Date: 2016-06-14 17:26:59 Functions: 1 10 10.0 %

          Line data    Source code
       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             : #include "AliITSCorrMap1DSDD.h"
      29             : 
      30         118 : ClassImp(AliITSMapSDD)
      31             : //______________________________________________________________________
      32           0 : AliITSMapSDD::AliITSMapSDD():TNamed("defaultmap","")
      33           0 : {
      34             :   // default constructor
      35           0 :   for(Int_t iAn=0;iAn<fgkNAnodPts; iAn++){
      36           0 :     for(Int_t iDr=0;iDr<fgkNDrifPts; iDr++){
      37           0 :       fMap[iAn][iDr]=0;
      38             :     }
      39             :   }
      40           0 : }
      41             : //______________________________________________________________________
      42           0 : AliITSMapSDD::AliITSMapSDD(Char_t *mapname):TNamed(mapname,"")
      43           0 : {
      44             :   // standard constructor
      45           0 :   for(Int_t iAn=0;iAn<fgkNAnodPts; iAn++){
      46           0 :     for(Int_t iDr=0;iDr<fgkNDrifPts; iDr++){
      47           0 :       fMap[iAn][iDr]=0;
      48             :     }
      49             :   }
      50           0 : }
      51             : 
      52             : //______________________________________________________________________
      53             : void AliITSMapSDD::SetMap(TH2F* hmap){
      54             :   // Fill map staring from 2D histo 
      55             :   // with anodes on x axis and drift dist. on y axis
      56           0 :   for(Int_t iAn=0;iAn<fgkNAnodPts; iAn++){
      57           0 :     for(Int_t iDr=0;iDr<fgkNDrifPts; iDr++){
      58           0 :       SetCellContent(iAn,iDr,hmap->GetBinContent(iAn+1,iDr+1));
      59             :     }
      60             :   }
      61           0 : }
      62             : //______________________________________________________________________
      63             : Float_t AliITSMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg){
      64             :   // returns correction in cm starting from local coordinates on the module
      65             :   const Double_t kMicronTocm = 1.0e-4; 
      66           0 :   Int_t nAnodes=seg->Npz();
      67           0 :   Int_t nAnodesHybrid=seg->NpzHalf();
      68           0 :   Int_t bina =(Int_t) seg->GetAnodeFromLocal(x,z);
      69           0 :   if(bina>nAnodes)  AliError("Wrong anode anumber!");
      70           0 :   if(bina>=nAnodesHybrid) bina-=nAnodesHybrid;
      71           0 :   Float_t stept = seg->Dx()*kMicronTocm/(Float_t)fgkNDrifPts;
      72           0 :   Int_t bint = TMath::Abs((Int_t)(x/stept));
      73           0 :   if(bint==fgkNDrifPts) bint-=1;
      74           0 :   if(bint>=fgkNDrifPts) AliError("Wrong bin number along drift direction!");
      75           0 :   return kMicronTocm*GetCellContent(bina,bint);
      76             : }
      77             : //______________________________________________________________________
      78             : TH2F* AliITSMapSDD::GetMapHisto() const{
      79             :   // Returns a TH2F histogram with map of residuals
      80           0 :   TString hname;
      81           0 :   hname.Form("h%s",GetName());
      82           0 :   TH2F* hmap=new TH2F(hname.Data(),"",fgkNAnodPts,-0.5,255.5,fgkNDrifPts,0.,35.);
      83           0 :   for(Int_t iAn=0;iAn<fgkNAnodPts; iAn++){
      84           0 :     for(Int_t iDr=0;iDr<fgkNDrifPts; iDr++){
      85           0 :       hmap->SetBinContent(iAn+1,iDr+1,GetCellContent(iAn,iDr));
      86             :     }
      87             :   }
      88             :   return hmap;
      89           0 : }
      90             : //______________________________________________________________________
      91             : TH1F* AliITSMapSDD::GetResidualDistr(Float_t dmin, Float_t dmax) const{
      92             :   // Returns a TH1F histogram with distribution of residual
      93           0 :   TString hname;
      94           0 :   hname.Form("hd%s",GetName());
      95           0 :   TH1F* hd=new TH1F(hname.Data(),"",100,dmin,dmax);
      96           0 :   for(Int_t iAn=0;iAn<fgkNAnodPts; iAn++){
      97           0 :     for(Int_t iDr=0;iDr<fgkNDrifPts; iDr++){
      98           0 :       hd->Fill(GetCellContent(iAn,iDr));
      99             :     }
     100             :   }
     101             :   return hd;
     102           0 : }
     103             : //______________________________________________________________________
     104             : AliITSCorrMapSDD* AliITSMapSDD::ConvertToNewFormat() const{
     105             :   // convert correction map to new format  
     106           0 :   Char_t* name=(Char_t*)GetName();
     107           0 :   AliITSCorrMapSDD* newmap=new AliITSCorrMap1DSDD(name,fgkNDrifPts);
     108           0 :   for(Int_t i=0; i<fgkNDrifPts; i++){
     109           0 :     newmap->SetCellContent(0,i,GetCellContent(0,i));
     110             :   }
     111           0 :   return newmap;
     112           0 : }
     113             : 

Generated by: LCOV version 1.11