]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSDDLModuleMapSDD.cxx
LUTs mapping symnames and original global matrices removed from AliGeomManager, which...
[u/mrichter/AliRoot.git] / ITS / AliITSDDLModuleMapSDD.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 class for SDD DDL mapping in the OCDB   //
21 // Origin: F.Prino, Torino, prino@to.infn.it                     //
22 //                                                               //
23 ///////////////////////////////////////////////////////////////////
24
25 #include "AliITSDDLModuleMapSDD.h"
26 #include "AliLog.h"
27
28 ClassImp(AliITSDDLModuleMapSDD)
29
30
31 //______________________________________________________________________
32 AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD():TObject(){
33   // default constructor
34   SetDefaultMap();
35 }
36 //______________________________________________________________________
37 AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD(Char_t *ddlmapfile):TObject(){
38   // constructor used to read DDL map  from text file
39   ReadDDLModuleMap(ddlmapfile);
40 }
41 //______________________________________________________________________
42 void AliITSDDLModuleMapSDD::SetDefaultMap(){
43   // Fill DDL map according to the default connection scheme
44   Int_t defaultmap[kDDLsNumber][kModulesPerDDL] = 
45     {
46  
47       {240,241,242,246,247,248,252,253,254,258,259,260},
48       {264,265,266,270,271,272,276,277,278,282,283,284},
49       {288,289,290,294,295,296,300,301,302,306,307,308},
50       {312,313,314,318,319,320,-1,-1,-1,-1,-1,-1},
51       {243,244,245,249,250,251,255,256,257,261,262,263},
52       {267,268,269,273,274,275,279,280,281,285,286,287},
53       {291,292,293,297,298,299,303,304,305,309,310,311},
54       {315,316,317,321,322,323,-1,-1,-1,-1,-1,-1},
55       {324,325,326,327,332,333,334,335,340,341,342,343},
56       {348,349,350,351,356,357,358,359,364,365,366,367},
57       {372,373,374,375,380,381,382,383,388,389,390,391},
58       {396,397,398,399,404,405,406,407,412,413,414,415},
59       {420,421,422,423,428,429,430,431,436,437,438,439},
60       {444,445,446,447,452,453,454,455,460,461,462,463},
61       {468,469,470,471,476,477,478,479,484,485,486,487},
62       {492,493,494,495,-1,-1,-1,-1,-1,-1,-1,-1},
63       {328,329,330,331,336,337,338,339,344,345,346,347},
64       {352,353,354,355,360,361,362,363,368,369,370,371},
65       {376,377,378,379,384,385,386,387,392,393,394,395},
66       {400,401,402,403,408,409,410,411,416,417,418,419},
67       {424,425,426,427,432,433,434,435,440,441,442,443},
68       {448,449,450,451,456,457,458,459,464,465,466,467},
69       {472,473,474,475,480,481,482,483,488,489,490,491},
70       {496,497,498,499,-1,-1,-1,-1,-1,-1,-1,-1}
71     };
72
73   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
74     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
75       fDDLModuleMap[iddl][ichan]=defaultmap[iddl][ichan];
76     }
77   }
78 }
79
80 //______________________________________________________________________
81 void AliITSDDLModuleMapSDD::SetDec07part1Map(){
82   // Fill DDL map according to dec07 cosmic run connections (run<14435)
83   Int_t dec07part1map[kDDLsNumber][kModulesPerDDL] = 
84     {
85       {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
86       {352,353,354,355,-1,-1,-1,-1,-1,-1,-1,-1},
87       {376,377,378,379,384,385,386,387,408,409,410,411},
88       {400,401,402,403,392,393,394,395,416,417,418,419},
89       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
90       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
91       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
92       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
93     
94       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate MED
95       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
96       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
97       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
98       {368,369,370,371,360,361,362,363,-1,-1,-1,-1},
99       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
100       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
101       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
102     
103       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate BOT
104       {240,241,242,246,247,248,-1,-1,-1,-1,-1,-1},
105       {-1,-1,-1,-1,-1,-1,264,265,266,270,271,272},
106       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
107       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
108       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
109       {267,268,269,273,274,275,-1,-1,-1,-1,-1,-1},
110       {243,244,245,249,250,251,255,256,257,261,262,263}
111     };
112   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
113     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
114       fDDLModuleMap[iddl][ichan]=dec07part1map[iddl][ichan];
115     }
116   }
117 }
118
119
120 //______________________________________________________________________
121 void AliITSDDLModuleMapSDD::SetDec07part2Map(){
122   // Fill DDL map according to dec07 cosmic run connection (run>14435)
123   Int_t dec07part2map[kDDLsNumber][kModulesPerDDL] = 
124     {
125       {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
126       {352,353,354,355,360,361,362,363,368,369,370,371},
127       {376,377,378,379,384,385,386,387,408,409,410,411},
128       {400,401,402,403,392,393,394,395,416,417,418,419},
129       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
130       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
131       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
132       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
133       
134       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate MED
135       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
136       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
137       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
138       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
139       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
140       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
141       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
142       
143       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate BOT
144       {240,241,242,246,247,248,-1,-1,-1,-1,-1,-1},
145       {-1,-1,-1,-1,-1,-1,264,265,266,270,271,272},
146       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
147       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
148       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
149       {267,268,269,273,274,275,-1,-1,-1,-1,-1,-1},
150       {243,244,245,249,250,251,255,256,257,261,262,263}
151     };
152   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
153     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
154       fDDLModuleMap[iddl][ichan]=dec07part2map[iddl][ichan];
155     }
156   }
157 }
158
159 //______________________________________________________________________
160 void AliITSDDLModuleMapSDD::SetFeb08Map(){
161   // Fill DDL map according to feb08 cosmic run connection 
162   Int_t feb08map[kDDLsNumber][kModulesPerDDL] = 
163     {
164       {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
165       {352,353,354,355,360,361,362,363,368,369,370,371},
166       {376,377,378,379,384,385,386,387,392,393,394,395},
167       {400,401,402,403,408,409,410,411,416,417,418,419},
168       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
169       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
170       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
171       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
172       
173       {324,325,326,327,332,333,334,335,340,341,342,343},   //Crate MED
174       {348,349,350,351,356,357,358,359,364,365,366,367},
175       {372,373,374,375,380,381,382,383,388,389,390,391},
176       {396,397,398,399,404,405,406,407,412,413,414,415},
177       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
178       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
179       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
180       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
181       
182       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate BOT
183       {240,241,242,246,247,248,-1,-1,-1,-1,-1,-1},
184       {252,253,254,-1,-1,-1,264,265,266,270,271,272},
185       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
186       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
187       {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
188       {273,274,275,267,268,269,-1,-1,-1,-1,-1,-1},
189       {243,244,245,249,250,251,255,256,257,261,262,263}
190     };
191   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
192     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
193       fDDLModuleMap[iddl][ichan]=feb08map[iddl][ichan];
194     }
195   }
196 }
197
198 //______________________________________________________________________
199 void AliITSDDLModuleMapSDD::SetDDLMap(AliITSDDLModuleMapSDD* ddlmap){
200 // Fill DDL map
201   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
202     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
203       fDDLModuleMap[iddl][ichan]=ddlmap->GetModuleNumber(iddl,ichan);
204     }
205   }
206 }
207 //______________________________________________________________________
208 void AliITSDDLModuleMapSDD::FindInDDLMap(Int_t modIndex, Int_t &iDDL, Int_t &iCarlos) const {
209   // finds DDL and carlos number for a given module
210   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
211     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
212       if(fDDLModuleMap[iddl][ichan]==modIndex){
213         iDDL=iddl;
214         iCarlos=ichan;
215         return;
216       }
217     }
218   }
219   AliWarning("Module not found in DDL map");
220   iDDL=-1;
221   iCarlos=-1;
222   return;
223 }
224 //______________________________________________________________________
225 void AliITSDDLModuleMapSDD::ReadDDLModuleMap(Char_t *ddlmapfile){
226   // Fill DDL map from ASCCI data file
227   FILE *fil;
228   fil=fopen(ddlmapfile,"r");  
229   Int_t mod;
230   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
231     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
232       fscanf(fil,"%d",&mod);
233       fDDLModuleMap[iddl][ichan]=mod;
234     }
235   }
236   fclose(fil);
237 }
238
239 //______________________________________________________________________
240 void AliITSDDLModuleMapSDD::PrintDDLMap() const {
241   // printout DDL map
242   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
243     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
244       printf("%d  ",fDDLModuleMap[iddl][ichan]);
245     }
246     printf("\n");
247   }
248 }