]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSMap2DSDD.cxx
Avoiding geometry lock/unlock (R. Grosso)
[u/mrichter/AliRoot.git] / ITS / AliITSMap2DSDD.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 "AliITSMapSDD.h"\r
28 #include "AliITSMap2DSDD.h"\r
29 \r
30 ClassImp(AliITSMap2DSDD)\r
31 //______________________________________________________________________\r
32 AliITSMap2DSDD::AliITSMap2DSDD():\r
33 AliITSMapSDD()\r
34 {\r
35   // default constructor\r
36   ResetMap();\r
37 }\r
38 //______________________________________________________________________\r
39 AliITSMap2DSDD::AliITSMap2DSDD(Char_t *mapname):\r
40 AliITSMapSDD(mapname)\r
41 {\r
42   // standard constructor\r
43   ResetMap();\r
44 }\r
45 //______________________________________________________________________\r
46 AliITSMap2DSDD::AliITSMap2DSDD(Char_t *mapname, Int_t nbinsan, Int_t nbinsdr):\r
47 AliITSMapSDD(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 AliITSMap2DSDD::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       fMap[iAn][iDr]=0;\r
60     }\r
61   }\r
62 }\r
63 \r
64 //______________________________________________________________________\r
65 void AliITSMap2DSDD::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