Changes related to the extraction of the V0 finder into a separate class (A. Dainese...
[u/mrichter/AliRoot.git] / ITS / AliITSCorrMap2DSDD.cxx
1 /**************************************************************************\r
2  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *\r
3  *                                                                        *\r
4  * Author: The ALICE Off-line Project.                                    *\r
5  * Contributors are mentioned in the code where appropriate.              *\r
6  *                                                                        *\r
7  * Permission to use, copy, modify and distribute this software and its   *\r
8  * documentation strictly for non-commercial purposes is hereby granted   *\r
9  * without fee, provided that the above copyright notice appears in all   *\r
10  * copies and that both the copyright notice and this permission notice   *\r
11  * appear in the supporting documentation. The authors make no claims     *\r
12  * about the suitability of this software for any purpose. It is          *\r
13  * provided "as is" without express or implied warranty.                  *\r
14  **************************************************************************/\r
15 \r
16 /* $Id$ */\r
17 \r
18 ///////////////////////////////////////////////////////////////////\r
19 //                                                               //\r
20 // Implementation of the base class for SDD map 2D corrections   //\r
21 // Origin: F.Prino, Torino, prino@to.infn.it                     //\r
22 //                                                               //\r
23 ///////////////////////////////////////////////////////////////////\r
24 \r
25 #include "TH1F.h"\r
26 #include "TH2F.h"\r
27 #include "AliITSCorrMapSDD.h"\r
28 #include "AliITSCorrMap2DSDD.h"\r
29 \r
30 ClassImp(AliITSCorrMap2DSDD)\r
31 //______________________________________________________________________\r
32 AliITSCorrMap2DSDD::AliITSCorrMap2DSDD():\r
33 AliITSCorrMapSDD()\r
34 {\r
35   // default constructor\r
36   ResetMap();\r
37 }\r
38 //______________________________________________________________________\r
39 AliITSCorrMap2DSDD::AliITSCorrMap2DSDD(Char_t *mapname):\r
40 AliITSCorrMapSDD(mapname)\r
41 {\r
42   // standard constructor\r
43   ResetMap();\r
44 }\r
45 //______________________________________________________________________\r
46 AliITSCorrMap2DSDD::AliITSCorrMap2DSDD(Char_t *mapname, Int_t nbinsan, Int_t nbinsdr):\r
47 AliITSCorrMapSDD(mapname)\r
48 {\r
49   // standard constructor\r
50   ResetMap();\r
51   SetNBinsAnode(nbinsan);\r
52   SetNBinsDrift(nbinsdr);\r
53 }\r
54 //______________________________________________________________________\r
55 void AliITSCorrMap2DSDD::ResetMap(){\r
56   // Sets contents to zero\r
57   for(Int_t iAn=0;iAn<kMaxNAnodePts; iAn++){\r
58     for(Int_t iDr=0;iDr<kMaxNDriftPts; iDr++){\r
59       fCorrMap[iAn][iDr]=0;\r
60     }\r
61   }\r
62 }\r
63 \r
64 //______________________________________________________________________\r
65 void AliITSCorrMap2DSDD::Set2DMap(TH2F* hmap){\r
66   // Fill map staring from 2D histo \r
67   // with anodes on x axis and drift dist. on y axis\r
68   if(hmap->GetNbinsX()!=fNAnodePts || hmap->GetNbinsY()!=fNDriftPts){ \r
69     AliError(Form("N. of histo bins (%dX%d) not matching N. of map cells (%dX%d)\n",hmap->GetNbinsX(),hmap->GetNbinsY(),fNAnodePts,fNDriftPts));\r
70     return;\r
71   }\r
72   for(Int_t iAn=0;iAn<fNAnodePts; iAn++){\r
73     for(Int_t iDr=0;iDr<fNDriftPts; iDr++){\r
74       SetCellContent(iAn,iDr,hmap->GetBinContent(iAn+1,iDr+1));\r
75     }\r
76   }\r
77 }\r