Adding some further mother volumes to speed-up the overlap checking and particle...
[u/mrichter/AliRoot.git] / ITS / AliITSDDLModuleMapSDD.cxx
CommitLineData
979b5a5f 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
3902fbcf 16/* $Id$ */
979b5a5f 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"
1de75654 26#include "AliLog.h"
979b5a5f 27
28ClassImp(AliITSDDLModuleMapSDD)
29
30
31//______________________________________________________________________
32AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD():TObject(){
33 // default constructor
34 SetDefaultMap();
35}
36//______________________________________________________________________
37AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD(Char_t *ddlmapfile):TObject(){
38 // constructor used to read DDL map from text file
39 ReadDDLModuleMap(ddlmapfile);
40}
41//______________________________________________________________________
42void 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//______________________________________________________________________
81void 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//______________________________________________________________________
121void 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//______________________________________________________________________
94934b95 160void 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//______________________________________________________________________
8ce449c9 199void AliITSDDLModuleMapSDD::SetJun08Map(){
200 // Fill DDL map according to jun08 cosmic run connection
201 Int_t jun08map[kDDLsNumber][kModulesPerDDL] =
202 {
203 {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
204 {352,353,354,355,360,361,362,363,368,369,370,371},
205 {376,377,378,379,384,385,386,387,392,393,394,395},
206 {400,401,402,403,408,409,410,411,416,417,418,419},
207 {424,425,426,427,432,433,434,435,440,441,442,443},
208 {448,449,450,451,456,457,458,459,464,465,466,467},
209 {472,473,474,475,480,481,482,483,488,489,490,491},
210 {496,497,498,499,-1,-1,-1,-1,-1,-1,-1,-1},
211 {324,325,326,327,332,333,334,335,340,341,342,343},//Crate MED
212 {348,349,350,351,356,357,358,359,364,365,366,367},
213 {372,373,374,375,380,381,382,383,388,389,390,391},
214 {396,397,398,399,404,405,406,407,412,413,414,415},
215 {420,421,422,423,428,429,430,431,436,437,438,439},
216 {444,445,446,447,452,453,454,455,460,461,462,463},
217 {468,469,470,471,476,477,478,479,484,485,486,487},
218 {492,493,494,495,-1,-1,-1,-1,-1,-1,-1,-1},
219 {240,241,242,246,247,248,252,253,254,276,277,278},//Crate BOT
220 {264,265,266,270,271,272,258,259,260,282,283,284},
221 {288,289,290,294,295,296,300,301,302,306,307,308},
222 {312,313,314,318,319,320,-1,-1,-1,-1,-1,-1},
3902fbcf 223 {315,316,317,321,322,323,-1,-1,-1,-1,-1,263},
8ce449c9 224 {291,292,293,297,298,299,303,304,305,309,310,311},
225 {267,268,269,273,274,275,279,280,281,285,286,287},
3902fbcf 226 {243,244,245,249,250,251,255,256,257,261,262,-1},
8ce449c9 227 };
228 for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
229 for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
230 fDDLModuleMap[iddl][ichan]=jun08map[iddl][ichan];
231 }
232 }
233}
234
235//______________________________________________________________________
979b5a5f 236void AliITSDDLModuleMapSDD::SetDDLMap(AliITSDDLModuleMapSDD* ddlmap){
237// Fill DDL map
238 for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
239 for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
240 fDDLModuleMap[iddl][ichan]=ddlmap->GetModuleNumber(iddl,ichan);
241 }
242 }
243}
244//______________________________________________________________________
1de75654 245void AliITSDDLModuleMapSDD::FindInDDLMap(Int_t modIndex, Int_t &iDDL, Int_t &iCarlos) const {
246 // finds DDL and carlos number for a given module
247 for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
248 for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
249 if(fDDLModuleMap[iddl][ichan]==modIndex){
250 iDDL=iddl;
251 iCarlos=ichan;
252 return;
253 }
254 }
255 }
256 AliWarning("Module not found in DDL map");
257 iDDL=-1;
258 iCarlos=-1;
259 return;
260}
261//______________________________________________________________________
979b5a5f 262void AliITSDDLModuleMapSDD::ReadDDLModuleMap(Char_t *ddlmapfile){
263 // Fill DDL map from ASCCI data file
264 FILE *fil;
265 fil=fopen(ddlmapfile,"r");
266 Int_t mod;
267 for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
268 for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
269 fscanf(fil,"%d",&mod);
270 fDDLModuleMap[iddl][ichan]=mod;
271 }
272 }
273 fclose(fil);
274}
275
276//______________________________________________________________________
277void AliITSDDLModuleMapSDD::PrintDDLMap() const {
278 // printout DDL map
279 for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
280 for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
281 printf("%d ",fDDLModuleMap[iddl][ichan]);
282 }
283 printf("\n");
284 }
285}