]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSDDLModuleMapSDD.cxx
Extend q_ij range for pp and pPb
[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::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},
223       {315,316,317,321,322,323,-1,-1,-1,-1,-1,263},
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},
226       {243,244,245,249,250,251,255,256,257,261,262,-1},
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 void AliITSDDLModuleMapSDD::SetJun09Map(){
236   // Fill DDL map according to 2009 cosmic run connection 
237   Int_t jun09map[kDDLsNumber][kModulesPerDDL] = 
238     {
239       {336,337,338,339,328,329,330,331,344,345,346,347}, //Crate TOP
240       {352,353,354,355,360,361,362,363,368,369,370,371},
241       {376,377,378,379,384,385,386,387,392,393,394,395},
242       {400,401,402,403,408,409,410,411,416,417,418,419},
243       {424,425,426,427,432,433,434,435,440,441,442,443},
244       {448,449,450,451,456,457,458,459,464,465,466,467},
245       {472,474,473,475,480,481,482,483,488,489,490,491},
246       {496,497,498,499,-1,-1,-1,-1,-1,-1,-1,-1},
247       {324,325,326,327,332,333,334,335,340,341,342,343},//Crate MED
248       {348,349,350,351,356,357,358,359,364,365,366,367},
249       {372,373,374,375,380,381,382,383,388,389,390,391},
250       {396,397,398,399,404,405,406,407,412,413,414,415},
251       {420,421,422,423,428,429,430,431,436,437,438,439},
252       {444,445,446,447,452,453,454,455,460,461,462,463},
253       {468,469,470,471,476,477,478,479,484,485,486,487},
254       {492,493,494,495,-1,-1,-1,-1,-1,-1,-1,-1},
255       {240,241,242,246,247,248,252,253,254,276,277,278},//Crate BOT
256       {264,265,266,270,271,272,258,259,260,282,283,284},
257       {288,289,290,294,295,296,300,301,302,306,307,308},
258       {312,313,314,318,319,320,-1,-1,-1,-1,-1,-1},
259       {315,316,317,323,322,321,-1,-1,-1,-1,-1,263},
260       {291,292,293,297,298,299,303,304,305,309,310,311},
261       {273,274,275,267,268,269,279,280,281,285,286,287},
262       {243,244,245,249,250,251,255,256,257,261,262,-1},
263     };
264   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
265     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
266       fDDLModuleMap[iddl][ichan]=jun09map[iddl][ichan];
267     }
268   }
269 }
270
271 //______________________________________________________________________
272 void AliITSDDLModuleMapSDD::SetDDLMap(AliITSDDLModuleMapSDD* ddlmap){
273 // Fill DDL map
274   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
275     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
276       fDDLModuleMap[iddl][ichan]=ddlmap->GetModuleNumber(iddl,ichan);
277     }
278   }
279 }
280 //______________________________________________________________________
281 void AliITSDDLModuleMapSDD::FindInDDLMap(Int_t modIndex, Int_t &iDDL, Int_t &iCarlos) const {
282   // finds DDL and carlos number for a given module
283   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
284     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
285       if(fDDLModuleMap[iddl][ichan]==modIndex){
286         iDDL=iddl;
287         iCarlos=ichan;
288         return;
289       }
290     }
291   }
292   AliWarning("Module not found in DDL map");
293   iDDL=-1;
294   iCarlos=-1;
295   return;
296 }
297 //______________________________________________________________________
298 void AliITSDDLModuleMapSDD::ReadDDLModuleMap(Char_t *ddlmapfile){
299   // Fill DDL map from ASCCI data file
300   FILE *fil;
301   fil=fopen(ddlmapfile,"r");  
302   Int_t mod;
303   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
304     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
305       if(fscanf(fil,"%d",&mod)<1)AliError(Form("Not able to read file %s ",ddlmapfile));
306       fDDLModuleMap[iddl][ichan]=mod;
307     }
308   }
309   fclose(fil);
310 }
311
312 //______________________________________________________________________
313 void AliITSDDLModuleMapSDD::PrintDDLMap() const {
314   // printout DDL map
315   for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
316     for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
317       printf("%d  ",fDDLModuleMap[iddl][ichan]);
318     }
319     printf("\n");
320   }
321 }