StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPmdGeom.cxx
1 /*******************************************************
2  *
3  * $Id: StPmdGeom.cxx,v 1.30 2011/05/04 12:27:52 rashmi Exp $
4  *
5  * Author: Dipak Mishra
6  *
7  *********************************************************
8  *
9  * Description: This the class of PMD geometry for calculating
10  * various utility functions from geometry parameters
11  *
12  *********************************************************
13  * $Log: StPmdGeom.cxx,v $
14  * Revision 1.30 2011/05/04 12:27:52 rashmi
15  * year==12 fix in chains
16  *
17  * Revision 1.29 2011/04/26 13:16:06 rashmi
18  * year==12 inserted for taking new mapping
19  *
20  * Revision 1.28 2010/04/15 06:55:48 rashmi
21  * functions to draw XY and eta/phi coverage & modifcations to mapping
22  *
23  * Revision 1.27 2010/02/28 02:56:04 rashmi
24  * included year11 as year number and also change in mapping after day48
25  *
26  * Revision 1.26 2009/12/24 17:55:45 rashmi
27  * year10 mappiing
28  *
29  * Revision 1.25 2007/12/21 09:48:01 rashmi
30  * Changes in readBoardDetail for dAu run by Subhasis
31  *
32  * Revision 1.24 2007/11/02 11:04:39 rashmi
33  * removed some print statements
34  *
35  * Revision 1.23 2007/08/31 10:56:27 rashmi
36  * removed a warning on chtemp ondate 31/08/07; removed some print statements
37  *
38  * Revision 1.22 2007/07/12 19:52:31 fisyak
39  * Add includes for ROOT 5.16
40  *
41  * Revision 1.21 2007/04/28 17:56:38 perev
42  * Redundant StChain.h removed
43  *
44  * Revision 1.20 2007/04/28 07:46:02 rashmi
45  * mapping after access on date 26/04/07
46  *
47  * Revision 1.19 2007/04/18 04:54:44 rashmi
48  * status after 11April07 access
49  *
50  * Revision 1.18 2007/04/17 11:19:47 rashmi
51  * Chain19 mapping corrected, functions to return nboards in a chain/SMs added
52  *
53  * Revision 1.17 2007/03/29 04:54:52 rashmi
54  * BoardDetail of access on 29/03/07 added
55  *
56  * Revision 1.16 2007/03/21 16:39:58 rashmi
57  * StPmdGeom after new mapping (run7) and with DrawPmd function for viewing PMD Geometry
58  *
59  * Revision 1.15 2005/03/07 05:02:23 subhasis
60  * printout commented
61  *
62  * Revision 1.14 2005/02/22 07:36:52 subhasis
63  * big prinout on picking.. commented
64  *
65  * Revision 1.13 2005/01/27 13:09:50 subhasis
66  * New map for 2005 data
67  *
68  * Revision 1.12 2005/01/08 16:47:02 subhasis
69  * status problem fixed for chain#7 (Rashmi)
70  *
71  * Revision 1.10 2004/11/15 23:27:23 subhasis
72  * if() removed in ctor to stop valgrind error
73  *
74  * Revision 1.9 2004/09/19 00:08:21 perev
75  * Small Walgrind leak fixed
76  *
77  * Revision 1.8 2004/04/13 20:12:55 subhasis
78  * Rashmi's fix of chain46 mapping
79  *
80  * Revision 1.7 2004/04/01 15:41:00 subhasis
81  * 3rd (or 4th?) access board detail added by Dipak
82  *
83  * Revision 1.6 2004/03/23 08:49:27 subhasis
84  * biardDetail put by had
85  *
86  * Mapping modified according to final mounting of FEE : Dipak
87  *
88  * Revision 1.4 2003/11/27 12:31:56 subhasis
89  * ADC2EDEP added by Supriya
90  *
91  * Revision 1.3 2003/09/02 17:58:49 perev
92  * gcc 3.2 updates + WarnOff
93  *
94  * Revision 1.2 2003/05/12 12:07:13 subhasis
95  * Mapping added
96  *
97  * Revision 1.2 2003/05/11 10:21:05 Dipak
98  * Mapping of chain # and channel # to supmod,row,col
99  **********************************************************/
100 
101 #include "Stypes.h"
102 #include "StPmdGeom.h"
103 #include <strings.h>
104 #include <stdlib.h>
105 #include <math.h>
106 #include <TROOT.h>
107 #include<TMatrix.h>
108 #include<TH2F.h>
109 #include<TMarker.h>
110 #include<TLatex.h>
111 #include<TCanvas.h>
112 #include<TPolyLine.h>
113 #include<TArrayF.h>
114 #include "TMath.h"
115 ClassImp(StPmdGeom)
116 
117 
119  Float_t StPmdGeom::mxcon[17]={22.63367,66.84988,112.60741,66.51461,112.3336,
120  -23.71335,-1.75714,-1.80849,-69.33651,-69.33518,
121  3.60214,-45.43217,-67.35937,-112.86835,3.60151,
122  3.60214,-42.7025};
123 
124  Float_t StPmdGeom::mycon[17]={13.95724,-36.74996,-63.1415,41.57234,15.11893,
125  12.62782,76.01182,128.98824,36.68728,89.59438,
126  -27.89206,-27.81838,-40.5852,-67.40152,-53.35941,
127  -78.78845,-105.38004};
131  Float_t StPmdGeom::mdetxcon[12]={-69.33518,-1.80849,-69.33651,-1.75714,
132  -112.86835,-67.35937,-42.7025,66.51461,
133  112.3336,66.84988,112.60741,-40.31029};
134 
135  Float_t StPmdGeom::mdetycon[12]={89.59438,128.98824,36.68728,76.01182,
136  -67.40152,-40.5852,-105.38004,41.57234,
137  15.11893,-36.74996,-63.1415,-52.64566};
138 
141 Int_t StPmdGeom::inorm[192] = {23,24,24,24,24,23,22,23,23,22,21,22,22,20,21,
142  21,21,19,18,20,19,18,20,20,17,17,19,18,17,17,
143  19,18,18,17,17,17,17,18,19,18,18,19,20,19,19,
144  21,20,20,20,22,23,21,22,23,21,21,24,24,22,23,
145  24,24,22,23,15,16,16,16,16,15,14,15,15,14,13,
146  14,14,12,13,13,13,11,10,12,11,10,12,12,9,9,11,
147  10,9,9,11,10,10,9,9,9,9,10,11,10,10,11,12,11,
148  11,13,12,12,12,14,15,13,14,15,13,13,16,16,14,
149  15,16,16,14,15,7,8,8,8,8,7,6,7,7,6,5,6,6,4,5,5,
150  5,3,2,4,3,2,4,4,1,1,3,2,1,1,3,2,2,1,1,1,1,2,3,
151  2,2,3,4,3,3,5,4,4,4,6,7,5,6,7,5,5,8,8,6,7,8,8,
152  6,7};
153 
154 Int_t StPmdGeom::jnorm[192] = {4,4,3,2,1,3,4,2,1,1,1,2,3,1,4,2,3,1,1,2,2,2,4,
155  3,1,2,3,3,3,4,4,4,5,5,6,7,8,6,5,7,8,8,8,7,6,8,
156  5,7,6,8,8,7,7,7,5,6,8,7,6,6,6,5,5,5,4,4,3,2,1,
157  3,4,2,1,1,1,2,3,1,4,2,3,1,1,2,2,2,4,3,1,2,3,3,
158  3,4,4,4,5,5,6,7,8,6,5,7,8,8,8,7,6,8,5,7,6,8,8,
159  7,7,7,5,6,8,7,6,6,6,5,5,5,4,4,3,2,1,3,4,2,1,1,
160  1,2,3,1,4,2,3,1,1,2,2,2,4,3,1,2,3,3,3,4,4,4,5,
161  5,6,7,8,6,5,7,8,8,8,7,6,8,5,7,6,8,8,7,7,7,5,6,
162  8,7,6,6,6,5,5,5};
163 
164 Int_t StPmdGeom::imirr[192] = {4,4,4,3,3,3,2,1,3,4,2,2,2,1,1,3,2,4,1,3,2,1,1,
165  1,2,4,3,1,2,3,4,4,5,5,5,6,6,6,7,8,6,5,7,7,7,8,
166  8,6,7,5,8,6,7,8,8,8,7,5,6,8,7,6,5,5,4,4,4,3,3,
167  3,2,1,3,4,2,2,2,1,1,3,2,4,1,3,2,1,1,1,2,4,3,1,
168  2,3,4,4,5,5,5,6,6,6,7,8,6,5,7,7,7,8,8,6,7,5,8,
169  6,7,8,8,8,7,5,6,8,7,6,5,5,4,4,4,3,3,3,2,1,3,4,
170  2,2,2,1,1,3,2,4,1,3,2,1,1,1,2,4,3,1,2,3,4,4,5,
171  5,5,6,6,6,7,8,6,5,7,7,7,8,8,6,7,5,8,6,7,8,8,8,
172  7,5,6,8,7,6,5,5};
173 
174 Int_t StPmdGeom::jmirr[192] = {2,3,1,1,2,3,1,1,4,4,2,3,4,2,3,5,5,5,4,6,6,5,6,
175  7,7,6,7,8,8,8,8,7,7,6,8,8,7,6,8,8,5,5,7,6,5,7,
176  6,4,4,4,5,3,3,4,3,2,2,3,2,1,1,1,1,2,10,11,9,9,
177  10,11,9,9,12,12,10,11,12,10,11,13,13,13,12,14,
178  14,13,14,15,15,14,15,16,16,16,16,15,15,14,16,16,
179  15,14,16,16,13,13,15,14,13,15,14,12,12,12,13,
180  11,11,12,11,10,10,11,10,9,9,9,9,10,18,19,17,17,
181  18,19,17,17,20,20,18,19,20,18,19,21,21,21,20,
182  22,22,21,22,23,23,22,23,24,24,24,24,23,23,22,
183  24,24,23,22,24,24,21,21,23,22,21,23,22,20,20,
184  20,21,19,19,20,19,18,18,19,18,17,17,17,17,18};
185 
186 //Int_t status[48][27];
187 Int_t status[48][36];
188 
190 {
191  // cout<<" StPmdGeom Constructor"<<endl;
192  commonconstants();
193  readBoardDetail();
194 }
195 
197 
199 Int_t StPmdGeom::NModule(Int_t sector , Int_t super, Int_t& nmod)
200 {
201  nmod=(sector-1)*5 + super;
202  return nmod;
203 }
205 void StPmdGeom::Cell_xy(Int_t nmod,Int_t row, Int_t col,Float_t& xreal, Float_t& yreal,Float_t& eta,Float_t& phi)
206 {
207  if(nmod<=5)
208  {
209  xreal = mxcon[nmod-1] - (row-1)*mcelldia_y;
210  yreal = mycon[nmod-1] + (col-1)*mcelldia_x + (row-1)*mcell_rad;
211  }
212  if (nmod>5 && nmod<=10)
213  {
214  xreal = mxcon[nmod-1] - (col - 1) * mconst2;
215  yreal = mycon[nmod-1] - (col - 1) * mconst1 - (row - 1) * mcelldia_x;
216  }
217  if (nmod>10 && nmod<=17)
218  {
219  xreal = mxcon[nmod-1] + (col - 1)*mconst2 + (row - 1)*mconst2;
220  yreal = mycon[nmod-1] + (row - col ) * mconst1;
221  }
222  Cell_eta_phi(xreal,yreal,eta,phi);
223  // cout<<"eta,phi="<<eta<<","<<phi<<endl;
224 }
225 
227 void StPmdGeom::DetCell_xy(Int_t nmod,Float_t row, Float_t col,Float_t& xreal, Float_t& yreal,Float_t& eta,Float_t& phi)
228 {
229  if(nmod<=4)
230  {
231  xreal = mdetxcon[nmod-1] - (col - 1) * mconst2;
232  yreal = mdetycon[nmod-1] - (col - 1) * mconst1 - (row - 1) * mcelldia_x;
233 
234  }
235  if (nmod>4 && nmod<=7)
236  {
237  xreal = mdetxcon[nmod-1] + (col - 1)*mconst2 + (row - 1)*mconst2;
238  yreal = mdetycon[nmod-1] + (row - col ) * mconst1;
239  }
240 
241  if (nmod>7 && nmod<=11)
242  {
243  xreal = mdetxcon[nmod-1] - (row-1)*mcelldia_y;
244  yreal = mdetycon[nmod-1] + (col-1)*mcelldia_x + (row-1)*mcell_rad;
245 
246  }
247  if (nmod==12){
248  xreal = mdetxcon[nmod-1] + (col - 1)*mconst2 + (row - 1)*mconst2;
249  yreal = mdetycon[nmod-1] + (row - col ) * mconst1;
250  }
251  Cell_eta_phi(xreal,yreal,eta,phi);
252 }
254 void StPmdGeom::IntDetCell_xy(Int_t nmod,Int_t row, Int_t col,Float_t& xreal, Float_t& yreal,Float_t& eta,Float_t& phi)
255 {
256  if(nmod>12)
257  { nmod=nmod-12;}
258  if(nmod<=4)
259  {
260  xreal = mdetxcon[nmod-1] - (col - 1) * mconst2;
261  yreal = mdetycon[nmod-1] - (col - 1) * mconst1 - (row - 1) * mcelldia_x;
262 
263  }
264  if (nmod>4 && nmod<=7)
265  {
266  xreal = mdetxcon[nmod-1] + (col - 1)*mconst2 + (row - 1)*mconst2;
267  yreal = mdetycon[nmod-1] + (row - col ) * mconst1;
268  }
269 
270  if (nmod>7 && nmod<=11)
271  {
272  xreal = mdetxcon[nmod-1] - (row-1)*mcelldia_y;
273  yreal = mdetycon[nmod-1] + (col-1)*mcelldia_x + (row-1)*mcell_rad;
274 
275  }
276  if (nmod==12){
277  xreal = mdetxcon[nmod-1] + (col - 1)*mconst2 + (row - 1)*mconst2;
278  yreal = mdetycon[nmod-1] + (row - col ) * mconst1;
279  }
280  Cell_eta_phi(xreal,yreal,eta,phi);
281 }
282 
284 
285 void StPmdGeom::Cell_eta_phi(Float_t xreal,Float_t yreal,Float_t& eta,Float_t& phi){
286  Float_t rdist = (TMath::Sqrt(xreal*xreal + yreal*yreal))/mzreal;
287  Float_t theta = TMath::ATan(rdist);
288 //Bedanga & pawan - added theta !=0.
289  if(theta !=0.){ eta = TMath::Log(TMath::Tan(0.5*theta));}
290  if( xreal==0) {
291  if(yreal>0) {phi = 1.571428;}
292  if(yreal<0) {phi = -1.571428;}
293  }
294  if(xreal != 0) {phi = atan2(yreal,xreal);}
295 
296 }
297 
299 
300 void StPmdGeom::Sim2Detmap(Int_t& nmod,Int_t& row,Int_t& col)
301 {
302  Int_t module;
303  module = nmod;
304  switch(module){
305  case 1:
306  nmod = 10;
307  row = row + 48;
308  col = col +24;
309  break;
310  case 2:
311  nmod = 10;
312  row = row;
313  col = col;
314  break;
315  case 3:
316  nmod = 11;
317  row = row;
318  col = col;
319  break;
320  case 4:
321  nmod = 8;
322  row = row;
323  col = col;
324  break;
325  case 5:
326  nmod = 9;
327  row = row;
328  col = col;
329  break;
330  case 6:
331  nmod = 4;
332  row = row + 48;
333  col = col + 24;
334  break;
335  case 7:
336  nmod = 4;
337  row = row;
338  col = col;
339  break;
340  case 8:
341  nmod = 2;
342  row = row;
343  col = col;
344  break;
345  case 9:
346  nmod = 3;
347  row = row;
348  col = col;
349  break;
350  case 10:
351  nmod = 1;
352  row = row;
353  col = col;
354  break;
355  case 11:
356  nmod = 12;
357  row = row + 48;
358  col = col;
359  break;
360  case 12:
361  nmod = 6;
362  row = row + 24;
363  col = col;
364  break;
365  case 13:
366  nmod = 6;
367  row = row;
368  col = col;
369  break;
370  case 14:
371  nmod = 5;
372  row = row;
373  col = col;
374  break;
375  case 15:
376  nmod = 12;
377  row = row + 24;
378  col = col + 24;
379  break;
380  case 16:
381  nmod = 12;
382  row = row;
383  col = col + 48;
384  break;
385  case 17:
386  nmod = 7;
387  row = row;
388  col = col;
389  break;
390  }
391 }
392 // Function used for mapping from Chain#, Channel# to Detector SM, Col, Row
393 Int_t StPmdGeom::ChainMapping(Int_t& chainno,Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t&chmod)
394 {
395 
396  // cout<<"picking chainmapping for year 5"<<endl;
397  //Bedanga and pawan changed the chain mapping conditions
398 
399  Int_t chain;
400  Int_t col1,row1;
401  chain = chainno;
402  Int_t chtemp=ch;
403  // Int_t brd=int((ch-1)/64)+1;
404  Int_t brd=int((ch)/64)+1;
405  Int_t missing=0;
406  Int_t brdCount=0;
407  // for(Int_t ibrd=0;ibrd<27;ibrd++){
408  for(Int_t ibrd=0;ibrd<36;ibrd++){
409  if(brdCount<brd){
410  if(status[chainno-1][ibrd]==0){missing++;}
411  brdCount+=status[chainno-1][ibrd];
412  }
413  }
414  chtemp=ch+missing*64;
415  chmod=chtemp;
416 
417  if(chtemp>=1728)return kStWarn;
418  switch(chain){
419 
420  case 1:
421  chain1(chtemp,supmod,col,row);
422  break;
423  case 2:
424  chain2(chtemp,supmod,col,row);
425  break;
426  case 3:
427  chain3(chtemp,supmod,col,row);
428  break;
429  case 4:
430  chain2(chtemp,supmod,col1,row1);
431  col = col1; row = row1 + 24;
432  break;
433  case 5:
434  chain5(chtemp,supmod,col,row);
435  break;
436  case 6:
437  chain2(chtemp,supmod,col,row);
438  supmod = 4;
439  break;
440  case 7:
441  chain2(chtemp,supmod,col1,row1);
442  col = col1; row = row1 + 24; supmod = 4;
443  break;
444  case 8:
445  chain2(chtemp,supmod,col1,row1);
446  col = 73 - col1; row = 25 - row1; supmod = 5;
447  break;
448  case 9:
449  chain9(chtemp,supmod,col,row);
450  break;
451  case 10:
452  chain10(chtemp,supmod,col,row);
453  break;
454  case 11:
455  chain10(chtemp,supmod,col1,row1);
456  row =row1;col =col1;
457  if(supmod==4){col = col1 - 24;}
458  if(supmod==6){row = row1 + 24;}
459  break;
460  case 12:
461  chain12(chtemp,supmod,col,row);
462  break;
463  case 13:
464  chain12(chtemp,supmod,col1,row1);
465  row =row1;col =col1;
466  if(supmod==5) {row = row1 -24; supmod = 6;}
467  if(supmod==7) {row = row1 + 24;}
468  break;
469  case 14:
470  chain5(chtemp,supmod,col,row);
471  supmod = 8;
472  break;
473  case 15:
474  chain15(chtemp,supmod,col,row);
475  break;
476  case 16:
477  chain5(chtemp,supmod,col1,row1);
478  supmod = 8; col = col1 -24; row =row1;
479  break;
480  case 17:
481  chain17(chtemp,supmod,col,row);
482  break;
483  case 18:
484  chain5(chtemp,supmod,col1,row1);
485  supmod = 10; col = col1 + 24; row =row1;
486  break;
487  case 19:
488  chain2(chtemp,supmod,col,row);
489  supmod = 11;
490  break;
491  case 20:
492  chain5(chtemp,supmod,col,row);
493  supmod = 10;
494  break;
495  case 21:
496  chain21(chtemp,supmod,col,row);
497  break;
498  case 22:
499  chain22(chtemp,supmod,col,row);
500  break;
501  case 23:
502  chain23(chtemp,supmod,col,row);
503  break;
504  case 24:
505  chain5(chtemp,supmod,col1,row1);
506  supmod = 12; col = 121 - col1; row = 73 - row1;
507  break;
508  case 25:
509  chain15(chtemp,supmod, col1, row1);
510  supmod = 13; col = 49 - row1; row = 49 - col1;
511  break;
512  case 26:
513  chain5(chtemp,supmod,col1,row1);
514  supmod = 14; col = 73 - row1; row = 49 - col1;
515  break;
516  case 27:
517  chain17(chtemp,supmod,col1,row1);
518  supmod = supmod + 4;
519  col = 49 - row1;
520  row = 49 - col1;
521  if(supmod==15){ row = 73 - col1;}
522  break;
523  case 28:
524  chain5(chtemp,supmod,col1,row1);
525  supmod = 14; col = 73 - row1; row = 49 - col1 +24;
526  break;
527  case 29:
528  chain2(chtemp,supmod,col1,row1);
529  supmod = 15; col = 49 - row1; row = 73 - col1;
530  break;
531  case 30:
532  chain5(chtemp,supmod,col1,row1);
533  supmod = 16; col = 73 - row1; row = 49 - col1;
534  break;
535  case 31:
536  chain5(chtemp,supmod,col1,row1);
537  supmod = 16; col = 73 - row1; row = 49 - col1 +24;
538  break;
539  case 32:
540  chain5(chtemp,supmod,col1,row1);
541  supmod = 17; col = row1; row = col1 -24;
542  break;
543  case 33:
544  chain22(chtemp,supmod,col1,row1);
545  row =row1;col =col1;
546  if(supmod==11){
547  supmod = 15;
548  col = 49 - row1;
549  row = 73 - col1;
550  }
551  if(supmod==12){
552  supmod = 17;
553  col = 73 - row1;
554  row = 97 - col1;
555  }
556  break;
557  case 34:
558  chain34(chtemp,supmod,col,row);
559  break;
560  case 35:
561  chain34(chtemp,supmod,col1,row1);
562  row =row1;col =col1;
563  if(supmod == 16){ col = col1 - 24;}
564  if(supmod == 18){ row = row1 + 24;}
565  break;
566  case 36:
567  chain34(chtemp,supmod,col1,row1);
568  row =row1;col =col1;
569  if(supmod == 16) {col = 121-col1;row = 97 - row1;}
570  supmod = supmod + 1;
571  break;
572  case 37:
573  chain34(chtemp,supmod,col1,row1);
574  row =row1;col =col1;
575  if(supmod==18){row = row1 + 24;supmod = 19;}
576  if(supmod == 16){
577  col = 121-col1; row = 73 - row1;
578  supmod = 18;}
579  break;
580  case 38:
581  chain2(chtemp,supmod,col1,row1);
582  supmod = 20; col = 49 - row1; row = 73 - col1;
583  break;
584  case 39:
585  chain39(chtemp,supmod,col1,row1);
586  col = 49 - row1; row = 49 - col1;
587  break;
588  case 40:
589  chain2(chtemp,supmod,col1,row1);
590  supmod = 20; col = 25 - row1; row = 73 - col1;
591  break;
592  case 41:
593  chain41(chtemp,supmod,col1,row1);
594  if(supmod==21){col = 49 - row1; row = 49 - col1;}
595  if(supmod==23){col = 73 - row1; row = 49 - col1;}
596  break;
597  case 42:
598  chain2(chtemp,supmod,col1,row1);
599  supmod = 22; col = 73 - row1; row = 73 - col1;
600  break;
601  case 43:
602  chain5(chtemp,supmod,col1,row1);
603  supmod = 23; col = 73 - row1; row = 49 - col1;
604  break;
605  case 44:
606  chain2(chtemp,supmod,col1,row1);
607  supmod = 22; col = 49 - row1; row = 73 - col1;
608  break;
609  case 45:
610  chain45(chtemp,supmod,col,row);
611  break;
612  case 46:
613  chain46(chtemp,supmod,col1,row1);
614  if(supmod==23){col = 73 - row1; row = 49 - col1;}
615  if(supmod==24){col = col1; row = row1;}
616  break;
617  case 47:
618  chain45(chtemp,supmod,col1,row1);
619  row =row1;col =col1;
620  if(supmod ==22){col = 49 - col1; row = 73 -row1;}
621  if(supmod==24){col = 48 + col1; row = row1 - 48;}
622  supmod = 24;
623  break;
624  case 48:
625  chain2(chtemp,supmod,col1,row1);
626  supmod = 24; col = 72 + row1; row = col1;
627  break;
628 
629  }
630  return kStOk;
631 }
632 
633 // SM1 has been mounted worngly in the STAND, so mapping has been changed accordingly.
634 void StPmdGeom::chain1(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
635 {
636  supmod = 1;
637  int zone = ch/192;
638  switch(zone){
639  case 0:
640  col = inorm[ch] + 24; row = jnorm[ch]; //old
641  // col = 25 - inorm[ch]; row = 9 - jnorm[ch];
642  break;
643  case 1:
644  col = inorm[ch-192]; row = jnorm[ch-192]; //old
645  // col = 25 - inorm[ch-192]+ 24; row = 9 - jnorm[ch-192];
646  break;
647  case 2:
648  col = 25 - inorm[ch-2*192]; row = 9 - jnorm[ch-2*192] + 8; //old
649  //col = inorm[ch-2*192] + 24; row = jnorm[ch-2*192] + 8;
650  break;
651  case 3:
652  col = 25 - inorm[ch-3*192] + 24; row = 9 - jnorm[ch-3*192] + 8; //old
653  //col = inorm[ch-3*192]; row = jnorm[ch -3*192] + 8;
654  break;
655  case 4:
656  col = inorm[ch-4*192] + 24; row = jnorm[ch - 4*192] + 16; //old
657  //col = 25 - inorm[ch-4*192]; row = 9 - jnorm[ch-4*192] + 16;
658  break;
659  case 5:
660  col = inorm[ch-5*192]; row = jnorm[ch-5*192] + 16; //old
661  //col = 25 - inorm[ch-5*192]+ 24; row = 9 - jnorm[ch-5*192] + 16;
662  break;
663  case 6:
664  col = inorm[ch-6*192]; row = jnorm[ch-6*192] + 24; //old
665  //col = 25 - inorm[ch-6*192]; row = 9 - jnorm[ch-6*192] + 24;
666  break;
667  case 7:
668  col = 25 - inorm[ch-7*192]; row = 9 - jnorm[ch-7*192] + 24 + 8; //old
669  //col = inorm[ch-7*192]; row = jnorm[ch-7*192] + 24 + 8;
670  break;
671  case 8:
672  col = inorm[ch-8*192]; row = jnorm[ch-8*192] + 24 + 16; //old
673  //col = 25 - inorm[ch-8*192]; row = 9 - jnorm[ch-8*192] + 24 + 16;
674  break;
675  }
676 }
677 
678 void StPmdGeom::chain2(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
679 {
680  supmod = 2;
681  int zone = ch/192;
682  switch(zone){
683  case 0:
684  col = inorm[ch] + 48; row = jnorm[ch];
685  break;
686  case 1:
687  col = inorm[ch-192] + 24; row = jnorm[ch-192];
688  break;
689  case 2:
690  col = inorm[ch-2*192]; row = jnorm[ch-2*192];
691  break;
692  case 3:
693  col = 25 - inorm[ch-3*192]; row = 9 - jnorm[ch-3*192] + 8;
694  break;
695  case 4:
696  col = 25 - inorm[ch-4*192] + 24; row = 9 - jnorm[ch-4*192] + 8;
697  break;
698  case 5:
699  col = 25 - inorm[ch-5*192] + 48; row = 9 - jnorm[ch-5*192] + 8;
700  break;
701  case 6:
702  col = inorm[ch-6*192] + 48; row = jnorm[ch-6*192] + 16;
703  break;
704  case 7:
705  col = inorm[ch-7*192] + 24; row = jnorm[ch-7*192] + 16;
706  break;
707  case 8:
708  col = inorm[ch-8*192]; row = jnorm[ch-8*192] + 16;
709  break;
710  }
711 }
712 
713 // SM1 has been mounted worngly on the stand, so mapping has been changed accordingly
714 void StPmdGeom::chain3(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
715 {
716  supmod = 1;
717  int zone = ch/192;
718  switch(zone){
719  case 0:
720  col = inorm[ch] + 24; row = jnorm[ch] + 24; //old
721  // col = 25 - inorm[ch]+ 24; row = 9 - jnorm[ch] + 24;
722  break;
723  case 1:
724  col = 25 - inorm[ch-192] + 24; row = 9 - jnorm[ch-192] + 24 + 8; //old
725  // col = inorm[ch-192] + 24; row = jnorm[ch-192] + 8;
726  break;
727  case 2:
728  col = inorm[ch-2*192] + 24; row = jnorm[ch-2*192] + 24 + 16; //old
729  // col = 25 - inorm[ch-2*192]+ 24; row = 9 - jnorm[ch-2*192] +24 + 16;
730  break;
731  case 3:
732  col = imirr[ch-3*192] + 16; row = jmirr[ch-3*192];
733  supmod = 3;
734  break;
735  case 4:
736  col = imirr[ch-4*192] + 16; row = jmirr[ch-4*192] + 24;
737  supmod = 3;
738  break;
739  case 5:
740  col = 9 - imirr[ch-5*192] + 8; row = 25 - jmirr[ch-5*192] + 24;
741  supmod = 3;
742  break;
743  case 6:
744  col = 9 - imirr[ch-6*192] + 8; row = 25 - jmirr[ch-6*192];
745  supmod = 3;
746  break;
747  case 7:
748  col = imirr[ch-7*192]; row = jmirr[ch-7*192];
749  supmod = 3;
750  break;
751  case 8:
752  col = imirr[ch-8*192] ; row = jmirr[ch-8*192] + 24;
753  supmod = 3;
754  break;
755  }
756 }
757 
758 void StPmdGeom::chain5(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
759 {
760  supmod = 3;
761  int zone = ch/192;
762  switch(zone){
763  case 0:
764  col = imirr[ch] + 24 + 16; row = jmirr[ch];
765  break;
766  case 1:
767  col = imirr[ch-192] + 24 +16; row = jmirr[ch-192] + 24;
768  break;
769  case 2:
770  col = imirr[ch-2*192] + 24 + 16; row = jmirr[ch-2*192] + 48;
771  break;
772  case 3:
773  col = 9 - imirr[ch-3*192] + 24 + 8; row = 25 - jmirr[ch-3*192] +48;
774  break;
775  case 4:
776  col = 9 - imirr[ch-4*192] + 24 +8; row = 25 -jmirr[ch-4*192] + 24;
777  break;
778  case 5:
779  col = 9 - imirr[ch-5*192] + 24 +8; row = 25 -jmirr[ch-5*192];
780  break;
781  case 6:
782  col = imirr[ch-6*192] + 24 ; row = jmirr[ch-6*192];
783  break;
784  case 7:
785  col = imirr[ch-7*192] + 24; row = jmirr[ch-7*192] + 24;
786  break;
787  case 8:
788  col = imirr[ch-8*192] + 24; row = jmirr[ch-8*192] + 48;
789  break;
790  }
791 }
792 //Chain 9,10,11 have been combined(1 UM each) to make chain- 9
793 void StPmdGeom::chain9(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
794 {
795  supmod = 3;
796  int zone = ch/192;
797  switch(zone){
798  case 0:
799  col = imirr[ch] + 16; row = jmirr[ch] + 48;
800  break;
801  case 1:
802  col = 9 - imirr[ch-192] + 8; row = 25 - jmirr[ch-192] + 48;
803  break;
804  case 2:
805  col = imirr[ch-2*192]; row = jmirr[ch-2*192] + 48;
806  break;
807  case 3:
808  // col = inorm[ch-3*192] + 48; row = jnorm[ch-3*192] + 48;
809  col = 25 - inorm[ch-3*192]; row = 9-jnorm[ch-3*192] +24 + 16; //old
810  supmod = 5;
811  break;
812  case 4:
813  //col = inorm[ch-4*192] + 24; row = jnorm[ch-4*192] + 48;
814  col = 25 - inorm[ch-4*192] + 24; row = 9-jnorm[ch-4*192] + 24 + 16; //old
815  supmod = 5;
816  break;
817  case 5:
818  //col = 25 - inorm[ch-5*192] + 24; row = 9 - jnorm[ch-5*192] +48 + 8;
819  col = inorm[ch-5*192] + 24; row = jnorm[ch-5*192] + 24 + 8; //old
820  supmod = 5;
821  break;
822  case 6:
823  //col = 25 - inorm[ch-6*192] + 48; row = 9 - jnorm[ch-6*192] +48 + 8;
824  col = inorm[ch-6*192]; row = jnorm[ch-6*192]+ 24 +8; //old
825  supmod = 5;
826  break;
827  case 7:
828  //col = inorm[ch-7*192] + 48; row = jnorm[ch-7*192] + 48 + 16;
829  col = 25 - inorm[ch-7*192]; row = 9-jnorm[ch-7*192] + 24; //old
830  supmod = 5;
831  break;
832  case 8:
833  //col = inorm[ch-8*192] + 24; row = jnorm[ch-8*192] + 48 + 16;
834  col = 25 - inorm[ch-8*192] + 24; row = 9-jnorm[ch-8*192] + 24; //old
835  supmod = 5;
836  break;
837  }
838 }
839 void StPmdGeom::chain10(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
840 {
841  supmod = 4;
842  int zone = ch/192;
843  switch(zone){
844  case 0:
845  col = inorm[ch] + 48; row = jnorm[ch] + 48;
846  break;
847  case 1:
848  col = 25 - inorm[ch-192] + 48; row = 9 - jnorm[ch-192] +48 + 8;
849  break;
850  case 2:
851  col = inorm[ch-2*192] + 48; row = jnorm[ch-2*192] + 48 + 16;
852  break;
853  case 3:
854  col = 25 - inorm[ch-3*192]; row = 9 -jnorm[ch-3*192] + 16;
855  supmod = 6;
856  break;
857  case 4:
858  col = 25 - inorm[ch-4*192] + 24; row = 9 -jnorm[ch-4*192] + 16;
859  supmod = 6;
860  break;
861  case 5:
862  col = inorm[ch-5*192] + 24; row = jnorm[ch-5*192] + 8;
863  supmod = 6;
864  break;
865  case 6:
866  col = inorm[ch-6*192]; row = jnorm[ch-6*192] +8;
867  supmod = 6;
868  break;
869  case 7:
870  col = 25 - inorm[ch-7*192]; row = 9 -jnorm[ch-7*192];
871  supmod = 6;
872  break;
873  case 8:
874  col = 25 - inorm[ch-8*192]+ 24; row = 9-jnorm[ch-8*192];
875  supmod = 6;
876  break;
877  }
878 }
879 void StPmdGeom::chain12(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
880 {
881  supmod = 5;
882  int zone = ch/192;
883  switch(zone){
884  case 0:
885  col = 25 - inorm[ch]+ 48; row = 9-jnorm[ch] +24 + 16;
886  break;
887  case 1:
888  col = inorm[ch-192] + 48; row = jnorm[ch-192] + 24 + 8;
889  break;
890  case 2:
891  col = 25 - inorm[ch-2*192]+ 48; row = 9-jnorm[ch-2*192] +24;
892  break;
893  case 3:
894  col = 25 - inorm[ch-3*192]; row = 9-jnorm[ch-3*192] + 16;
895  supmod = 7;
896  break;
897  case 4:
898  col = 25 - inorm[ch-4*192]+24; row = 9-jnorm[ch-4*192] + 16;
899  supmod = 7;
900  break;
901  case 5:
902  col = inorm[ch-5*192] + 24; row = jnorm[ch-5*192] + 8;
903  supmod = 7;
904  break;
905  case 6:
906  col = inorm[ch-6*192]; row = jnorm[ch-6*192] + 8;
907  supmod = 7;
908  break;
909  case 7:
910  col = 25 - inorm[ch-7*192]; row = 9-jnorm[ch-7*192];
911  supmod = 7;
912  break;
913  case 8:
914  col = 25 - inorm[ch-8*192]+24; row = 9-jnorm[ch-8*192];
915  supmod = 7;
916  break;
917  }
918 }
919 
920 void StPmdGeom::chain15(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
921 {
922  supmod = 9;
923  Int_t zone = ch/192;
924  switch(zone){
925  case 0:
926  col = imirr[ch] + 24 + 16; row = jmirr[ch];
927  break;
928  case 1:
929  col = imirr[ch-192] + 24 +16; row = jmirr[ch-192] + 24;
930  break;
931  case 2:
932  col = 9 - imirr[ch-2*192] + 24 + 8; row = 25 - jmirr[ch-2*192] +24;
933  break;
934  case 3:
935  col = 9 - imirr[ch-3*192] + 24 + 8; row = 25 - jmirr[ch-3*192];
936  break;
937  case 4:
938  col = imirr[ch-4*192] + 24; row = jmirr[ch-4*192];
939  break;
940  case 5:
941  col = imirr[ch-5*192] + 24; row = jmirr[ch-5*192] + 24;
942  break;
943  case 6:
944  col = imirr[ch-6*192] + 16; row = jmirr[ch-6*192] + 24;
945  break;
946  case 7:
947  col = 9 - imirr[ch-7*192] + 8; row = 25 - jmirr[ch-7*192] +24;
948  break;
949  case 8:
950  col = imirr[ch-8*192]; row = jmirr[ch-8*192] + 24;
951  break;
952  }
953 }
954 void StPmdGeom:: chain17(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
955 {
956  supmod = 9;
957  int zone = ch/192;
958  switch(zone){
959  case 0:
960  col = imirr[ch] + 16; row = jmirr[ch];
961  break;
962  case 1:
963  col = 9 - imirr[ch-192] + 8; row = 25 - jmirr[ch-192];
964  break;
965  case 2:
966  col = imirr[ch-2*192]; row = jmirr[ch-2*192];
967  break;
968  case 3:
969  col = inorm[ch-3*192] + 48; row = jnorm[ch-3*192] + 24;
970  supmod = 11;
971  break;
972  case 4:
973  col = inorm[ch-4*192] + 24; row = jnorm[ch-4*192] + 24;
974  supmod = 11;
975  break;
976  case 5:
977  col = 25 - inorm[ch-5*192] + 24; row = 9 - jnorm[ch-5*192] +24 + 8;
978  supmod = 11;
979  break;
980  case 6:
981  col = 25 - inorm[ch-6*192] + 48; row = 9 - jnorm[ch-6*192] +24 + 8;
982  supmod = 11;
983  break;
984  case 7:
985  col = inorm[ch-7*192] + 48; row = jnorm[ch-7*192] + 24 + 16;
986  supmod = 11;
987  break;
988  case 8:
989  col = inorm[ch-8*192] + 24; row = jnorm[ch-8*192] + 24 + 16;
990  supmod = 11;
991  break;
992  }
993 }
994 
995 void StPmdGeom::chain21(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
996 {
997  supmod = 10;
998  int zone = ch/192;
999  switch(zone){
1000  case 0:
1001  col = imirr[ch] + 16; row = jmirr[ch];
1002  break;
1003  case 1:
1004  col = imirr[ch-192] +16; row = jmirr[ch-192] + 24;
1005  break;
1006  case 2:
1007  col = 9 - imirr[ch-2*192] + 8; row = 25 - jmirr[ch-2*192] +24;
1008  break;
1009  case 3:
1010  col = 9 - imirr[ch-3*192] + 8; row = 25 - jmirr[ch-3*192];
1011  break;
1012  case 4:
1013  col = imirr[ch-4*192] ; row = jmirr[ch-4*192];
1014  break;
1015  case 5:
1016  col = imirr[ch-5*192]; row = jmirr[ch-5*192] + 24;
1017  break;
1018  case 6:
1019  col = 9 - imirr[ch-6*192]; row = 25 -jmirr[ch-6*192] + 48;
1020  supmod = 12;
1021  break;
1022  case 7:
1023  col = imirr[ch-7*192] + 8; row = jmirr[ch-7*192] + 48;
1024  supmod = 12;
1025  break;
1026  case 8:
1027  col = 9 - imirr[ch-8*192]+ 16; row = 25 -jmirr[ch-8*192] + 48;
1028  supmod = 12;
1029  break;
1030  }
1031 }
1032 void StPmdGeom::chain22(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1033 {
1034  supmod = 11;
1035  int zone = ch/192;
1036  switch(zone){
1037  case 0:
1038  col = inorm[ch]; row = jnorm[ch] + 24;
1039  break;
1040  case 1:
1041  col = 25 - inorm[ch-192]; row = 9 - jnorm[ch-192] +24 + 8;
1042  break;
1043  case 2:
1044  col = inorm[ch-2*192]; row = jnorm[ch-2*192] + 24 +16;
1045  break;
1046  case 3:
1047  col = 9 - imirr[ch-3*192]+48; row = 25 -jmirr[ch-3*192] + 48;
1048  supmod = 12;
1049  break;
1050  case 4:
1051  col = 9 - imirr[ch-4*192]+48; row = 25 -jmirr[ch-4*192] + 24;
1052  supmod = 12;
1053  break;
1054  case 5:
1055  col = imirr[ch-5*192] +48+ 8; row = jmirr[ch-5*192] + 24;
1056  supmod = 12;
1057  break;
1058  case 6:
1059  col = imirr[ch-6*192] + 48 + 8; row = jmirr[ch-6*192] + 48;
1060  supmod = 12;
1061  break;
1062  case 7:
1063  col = 9 - imirr[ch-7*192]+48 + 16; row = 25 -jmirr[ch-7*192] + 48;
1064  supmod = 12;
1065  break;
1066  case 8:
1067  col = 9 - imirr[ch-8*192]+48 + 16; row = 25 -jmirr[ch-8*192] + 24;
1068  supmod = 12;
1069  break;
1070  }
1071 }
1072 void StPmdGeom::chain23(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1073 {
1074  supmod = 12;
1075  int zone = ch/192;
1076  switch(zone){
1077  case 0:
1078  col = 9 - imirr[ch]+ 24; row = 25 -jmirr[ch] + 48;
1079  break;
1080  case 1:
1081  col = 9 - imirr[ch-192]+ 24; row = 25 -jmirr[ch-192] + 24;
1082  break;
1083  case 2:
1084  col = imirr[ch-2*192] +24+ 8; row = jmirr[ch-2*192] + 24;
1085  break;
1086  case 3:
1087  col = imirr[ch-3*192] +24+ 8; row = jmirr[ch-3*192] + 48;
1088  break;
1089  case 4:
1090  col = 9 - imirr[ch-4*192]+ 24 +16; row = 25 -jmirr[ch-4*192] + 48;
1091  break;
1092  case 5:
1093  col = 9 - imirr[ch-5*192]+ 24 +16; row = 25 -jmirr[ch-5*192] + 24;
1094  break;
1095  case 6:
1096  col = 9 - imirr[ch-6*192]+ 48; row = 25 -jmirr[ch-6*192];
1097  break;
1098  case 7:
1099  col = imirr[ch-7*192] +48+ 8; row = jmirr[ch-7*192];
1100  break;
1101  case 8:
1102  col = 9 - imirr[ch-8*192]+ 48 +16; row = 25 -jmirr[ch-8*192];
1103  break;
1104  }
1105 }
1106 void StPmdGeom::chain34(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1107 {
1108  supmod = 16;
1109  int zone = ch/192;
1110  switch(zone){
1111  case 0:
1112  col = 73 - jmirr[ch]; row = 9 - imirr[ch] +48;
1113  break;
1114  case 1:
1115  col = 48 + jmirr[ch-192]; row = 48 + imirr[ch-192] +8;
1116  break;
1117  case 2:
1118  col = 73 - jmirr[ch-2*192]; row = 9- imirr[ch-2*192] +48 +16;
1119  break;
1120  case 3:
1121  col = jmirr[ch-3*192]; row = imirr[ch-3*192] + 16;
1122  supmod = 18;
1123  break;
1124  case 4:
1125  col = jmirr[ch-4*192] + 24; row = imirr[ch-4*192] +16;
1126  supmod = 18;
1127  break;
1128  case 5:
1129  col = 49 - jmirr[ch-5*192]; row = 9 - imirr[ch-5*192] + 8;
1130  supmod = 18;
1131  break;
1132  case 6:
1133  col = 25 - jmirr[ch-6*192]; row = 9 - imirr[ch-6*192] + 8;
1134  supmod = 18;
1135  break;
1136  case 7:
1137  col = jmirr[ch-7*192]; row = imirr[ch-7*192];
1138  supmod = 18;
1139  break;
1140  case 8:
1141  col = jmirr[ch-8*192]+24; row = imirr[ch-8*192];
1142  supmod = 18;
1143  break;
1144  }
1145 }
1146 
1147 void StPmdGeom::chain39(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1148 {
1149  supmod = 21;
1150  int zone = ch/192;
1151  switch(zone){
1152  case 0:
1153  col = inorm[ch] + 24; row = jnorm[ch];
1154  break;
1155  case 1:
1156  col = inorm[ch-192]; row = jnorm[ch-192];
1157  break;
1158  case 2:
1159  col = 25 - inorm[ch-2*192]; row = 9 - jnorm[ch-2*192] + 8;
1160  break;
1161  case 3:
1162  col = 25 - inorm[ch-3*192] + 24; row = 9 - jnorm[ch-3*192] + 8;
1163  break;
1164  case 4:
1165  col = inorm[ch-4*192] + 24; row = jnorm[ch - 4*192] + 16;
1166  break;
1167  case 5:
1168  col = inorm[ch-5*192]; row = jnorm[ch-5*192] + 16;
1169  break;
1170  case 6:
1171  col = inorm[ch-6*192]; row = jnorm[ch-6*192] + 24;
1172  break;
1173  case 7:
1174  col = 25 - inorm[ch-7*192]; row = 9 - jnorm[ch-7*192] + 24 + 8;
1175  break;
1176  case 8:
1177  col = inorm[ch-8*192]; row = jnorm[ch-8*192] + 24 + 16;
1178  break;
1179  }
1180 }
1181 
1182 void StPmdGeom::chain41(int& ch,int& supmod,int& col,int& row)
1183 {
1184  supmod = 21;
1185  int zone = ch/192;
1186  switch(zone){
1187  case 0:
1188  col = inorm[ch] + 24; row = jnorm[ch] + 24;
1189  break;
1190  case 1:
1191  col = 25 - inorm[ch-192] + 24; row = 9 - jnorm[ch-192] + 24 + 8;
1192  break;
1193  case 2:
1194  col = inorm[ch-2*192] + 24; row = jnorm[ch-2*192] + 24 + 16;
1195  break;
1196  case 3:
1197  col = imirr[ch-3*192] + 16; row = jmirr[ch-3*192];
1198  supmod = 23;
1199  break;
1200  case 4:
1201  col = imirr[ch-4*192] + 16; row = jmirr[ch-4*192] + 24;
1202  supmod = 23;
1203  break;
1204  case 5:
1205  col = 9 - imirr[ch-5*192] + 8; row = 25 - jmirr[ch-5*192] + 24;
1206  supmod = 23;
1207  break;
1208  case 6:
1209  col = 9 - imirr[ch-6*192] + 8; row = 25 - jmirr[ch-6*192];
1210  supmod = 23;
1211  break;
1212  case 7:
1213  col = imirr[ch-7*192]; row = jmirr[ch-7*192];
1214  supmod = 23;
1215  break;
1216  case 8:
1217  col = imirr[ch-8*192] ; row = jmirr[ch-8*192] + 24;
1218  supmod = 23;
1219  break;
1220  }
1221 }
1222 
1223 void StPmdGeom::chain45(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1224 {
1225  supmod = 22;
1226  int zone = ch/192;
1227  switch(zone){
1228  case 0:
1229  col = 25 - jnorm[ch]; row = 25 - inorm[ch];
1230  break;
1231  case 1:
1232  col = 25 - jnorm[ch-192]; row = 25 - inorm[ch-192] + 24;
1233  break;
1234  case 2:
1235  col = jnorm[ch-2*192] +8;row = inorm[ch-2*192]+24;
1236  break;
1237  case 3:
1238  col = jnorm[ch-3*192] +8;row = inorm[ch-3*192];
1239  break;
1240  case 4:
1241  col = 9 - jnorm[ch-4*192] ; row = 25 - inorm[ch-4*192];
1242  break;
1243  case 5:
1244  col = 9 - jnorm[ch-5*192] ; row = 25 - inorm[ch-5*192]+ 24;
1245  break;
1246  case 6:
1247  col = jnorm[ch-6*192]; row = 48 + inorm[ch-6*192];
1248  supmod = 24;
1249  break;
1250  case 7:
1251  col = 9 - jnorm[ch-7*192] + 8; row = 73 - inorm[ch-7*192];
1252  supmod = 24;
1253  break;
1254  case 8:
1255  col = jnorm[ch-8*192] + 16; row = 48 + inorm[ch-8*192];
1256  supmod = 24;
1257  break;
1258  }
1259 }
1260 
1261 void StPmdGeom::chain46(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row)
1262 {
1263  supmod = 23;
1264  int zone = ch/192;
1265  switch(zone){
1266  case 0:
1267  col = imirr[ch] + 16; row = jmirr[ch] + 48;
1268  break;
1269  case 1:
1270  col = 9 - imirr[ch-192] + 8; row = 25 - jmirr[ch-192] + 48;
1271  break;
1272  case 2:
1273  col = imirr[ch-2*192]; row = jmirr[ch-2*192] + 48;
1274  break;
1275  case 3:
1276  col = 48 + jnorm[ch-3*192]; row = 48 + inorm[ch-3*192];
1277  supmod = 24;
1278  break;
1279  case 4:
1280  col = 48 + jnorm[ch-4*192]; row = 24 + inorm[ch-4*192];
1281  supmod = 24;
1282  break;
1283  case 5:
1284  col = 9 - jnorm[ch-5*192] + 56; row = 49 - inorm[ch-5*192];
1285  supmod = 24;
1286  break;
1287  case 6:
1288  col = 9 - jnorm[ch-6*192] + 56; row = 73 - inorm[ch-6*192];
1289  supmod = 24;
1290  break;
1291  case 7:
1292  col = jnorm[ch-7*192] + 64; row = 48 + inorm[ch-7*192];
1293  supmod = 24;
1294  break;
1295  case 8:
1296  col = jnorm[ch-8*192] + 64; row = 24 + inorm[ch-8*192];
1297  supmod = 24;
1298  break;
1299  }
1300 }
1301 void StPmdGeom::ADC2Edep(Int_t ADC, Float_t& Edep)
1302 {
1303  const Float_t Coeff[4] = {-0.7802, 0.09678, -3.054e-05, 0.0};
1304  //const Float_t ErrCoeff[4] = {0.4971, 0.00381, 4.466e-06, 0.0};
1305 
1306  Edep = Coeff[0] + Coeff[1]*ADC + Coeff[2]*pow(Float_t(ADC),2) + Coeff[3]*pow(Float_t(ADC),3);
1307 }
1308 
1309 void StPmdGeom::readBoardDetail()
1310 {
1311 
1312  for(Int_t i=0;i<48;i++){
1313  // for(Int_t ib=0;ib<27;ib++){
1314  for(Int_t ib=0;ib<36;ib++){
1315  status[i][ib]=1;
1316  }
1317  }
1318 }
1319 
1320 void StPmdGeom::readBoardDetail(Int_t runno1)
1321 {
1322  // char runfile[20];
1323  // sprintf(runfile,"%d",runno1);
1324 
1325  //Initialise status array as 1 (good board)
1326  Int_t alive_stat[48];
1327  for(Int_t i=0;i<48;i++){alive_stat[i]=0;}
1328  for(Int_t i=0;i<48;i++){
1329  // for(Int_t ib=0;ib<27;ib++){
1330  for(Int_t ib=0;ib<36;ib++){
1331  status[i][ib]=1;
1332  if (ib>=27) {status[i][ib]=0;}
1333  alive_stat[i]=alive_stat[i]+status[i][ib];
1334  }
1335  // cout<<" In readBoardDetail for chain "<<i+1<<" before reading status="<<alive_stat[i]<<" # of alive boards"<<endl;
1336  // resetting alive_stat
1337  alive_stat[i]=0;
1338  }
1339  // Fetch from the run # the day
1340  /*
1341  char iRun[8];
1342  char iyear[8];
1343  for (Int_t ik=0; ik<3; ik++)
1344  {
1345  iRun[ik] = runfile[ik+1];
1346  }
1347  iyear[0] = runfile[0];
1348 
1349  Int_t rn =0;
1350  Int_t year =0;
1351  rn=atoi(iRun);
1352  year=atoi(iyear);
1353  */
1354  Int_t rn =0;
1355  Int_t year =0;
1356  GetRunYear(runno1,rn,year);
1357 
1358  // cout<<"runid="<<runno1<<" run#="<<rn<<" year="<<year<<endl;
1359 
1360  if(year==5){ // 2004 run
1361  // Once the day is known choose the mapping file
1362  // if( rn >=1 && rn <21)
1363  //Following are the configuration of FEE from 1st Jan'04 to 21st Jan'04
1364  //cout<<"picking old board status"<<endl;
1365  if( rn >=1)
1366  {
1367  //chain 0
1368  for(Int_t i=3;i<6;i++)status[0][i]=0;
1369  for(Int_t i=12;i<18;i++)status[0][i]=0;
1370  //chain 1
1371  status[1][19]=0;
1372  //chain 3
1373  status[3][22]=0; status[3][25]=0; status[3][26]=0;
1374  //chain 5
1375  status[5][1]=0;for(Int_t i=24;i<27;i++)status[5][i]=0;
1376  //chain 6
1377  status[6][24]=0;for(Int_t i=6;i<9;i++)status[6][i]=0;
1378  //chain 7
1379  for(Int_t i=0;i<27;i++)status[7][i]=0;
1380  //chain 8
1381  status[8][22]=0;
1382  //chain 9
1383  for(Int_t i=0;i<27;i++)status[9][i]=0;
1384  //chain10
1385  for(Int_t i=0;i<27;i++)status[10][i]=0;
1386  //chain11
1387  for(Int_t i=0;i<9;i++)status[11][i]=0;
1388  //chain12
1389  for(Int_t i=0;i<9;i++)status[12][i]=0;
1390  //chain13
1391  for(Int_t i=0;i<27;i++)status[13][i]=0;
1392  //chain14
1393  for(Int_t i=0;i<27;i++)status[14][i]=0;
1394  //chain15
1395  for(Int_t i=0;i<27;i++)status[15][i]=0;
1396  //chain16
1397  for(Int_t i=0;i<9;i++)status[16][i]=0;
1398  //chain17
1399  for(Int_t i=6;i<12;i++)status[17][i]=0;
1400  for(Int_t i=24;i<27;i++)status[17][i]=0;
1401  //chain19
1402  for(Int_t i=3;i<6;i++)status[19][i]=0;
1403  for(Int_t i=21;i<24;i++)status[19][i]=0;
1404  status[19][12]=0;
1405  //chain20
1406  status[20][18]=0;
1407  //chain21
1408  status[21][0]=0;
1409  //chain22
1410  status[22][0]=0;
1411  //chain23
1412  status[23][6]=0;status[23][24]=0;
1413  //chain25
1414  status[25][16]=0;
1415  //chain31
1416  status[31][8]=0;
1417  //chain38
1418  status[38][24]=0;status[38][25]=0;
1419  //chain39
1420  status[39][24]=0;
1421  //chain40
1422  status[40][7]=0;
1423  //chain44
1424  status[44][14]=0;
1425  //chain46
1426  status[46][16]=0;
1427 
1428  }
1429 
1430  if( rn >=21) //Following are the FEE config after 21st Jan'04 access
1431  {
1432  //chain30
1433  status[30][21]=0;
1434  //chain38
1435  status[38][5]=0;
1436  //chain43
1437  status[43][20]=0;
1438  //chain44
1439  for(Int_t i=18;i<27;i++)status[44][i]=0;
1440  //chain45
1441  for(Int_t i=3;i<6;i++)status[45][i]=0;
1442  for(Int_t i=9;i<27;i++)status[45][i]=0;
1443  }
1444 
1445  if( rn >=27) //Following are the FEE config after 27th Jan'04 access
1446  {
1447  //chain 24
1448  status[24][1]=0;
1449  status[24][25]=0;
1450  //chain35
1451  status[35][14]=0;
1452  //chain44
1453  for(Int_t i=18;i<27;i++)status[44][i]=1;
1454  //chain45
1455  status[45][6]=0;
1456  for(Int_t i=9;i<27;i++)status[45][i]=1;
1457  //chain46
1458  status[46][16]=0;
1459 
1460  }
1461 
1462  if( rn >=35) //Following are the FEE config after 4th Feb'04 access
1463  {
1464  //chain 0
1465  for(Int_t i=0;i<21;i++)status[0][i]=0;
1466  status[0][18]=1;
1467  //chain 1
1468  status[1][19]=1;status[1][9]=0;
1469  //chain 2
1470  status[2][3]=0;status[2][6]=0;
1471  status[2][7]=0;status[2][8]=0;
1472  status[2][10]=0;status[2][13]=0;
1473  //chain 3
1474  status[3][25]=1; status[3][26]=1;
1475  status[3][13]=0; status[3][15]=0;
1476  status[3][18]=0; status[3][19]=0;
1477  status[3][20]=0; status[3][22]=0;
1478  status[3][24]=0;
1479  //chain 4
1480  status[4][2]=0; status[4][17]=0;
1481  //chain 5
1482  status[5][1]=0;
1483  for(Int_t i=21;i<27;i++)status[5][i]=0;
1484  status[5][23]=1;
1485  //chain 6
1486  // for(Int_t i=6;i<9;i++)status[6][i]=0; //already assigned
1487  for(Int_t i=2;i<4;i++)status[6][i]=0;
1488  status[6][15]=0;
1489  for(Int_t i=17;i<21;i++)status[6][i]=0;
1490  // status[6][17]=0; status[6][18]=0;
1491  // status[6][19]=0; status[6][20]=0;
1492  status[6][24]=0;
1493  //chain 8
1494  status[8][9]=0; status[8][11]=0;
1495  //chain11
1496  status[11][14]=0; status[11][26]=0;
1497  //chain17
1498  for(Int_t i=5;i<13;i++)status[17][i]=0;
1499  status[17][14]=0; status[17][18]=0;
1500  status[17][21]=0; status[17][22]=0;
1501  for(Int_t i=24;i<27;i++)status[17][i]=0;
1502  //chain18
1503  status[18][1]=0; status[18][6]=0;
1504  status[18][18]=0;
1505  for(Int_t i=24;i<27;i++)status[18][i]=0;
1506  // status[18][24]=0;
1507  // status[18][25]=0; status[18][26]=0;
1508  //chain 20
1509  status[20][2]=0; status[20][8]=0;
1510  status[20][9]=0; status[20][18]=0;
1511  status[20][20]=0; status[20][24]=0;
1512  status[20][25]=0;
1513  //chain 24
1514  // status[24][1]=0; status[24][25]=0; //already assigned
1515  //chain 28
1516  status[28][23]=0; status[28][24]=0;
1517  //chain 36
1518  status[36][25]=0;
1519  //chain44
1520  // for(Int_t i=18;i<27;i++)status[44][i]=1; //already assigned
1521  status[44][3]=0; status[44][4]=0;
1522  status[44][14]=0;
1523  //chain45
1524  for(Int_t i=3;i<6;i++)status[45][i]=1;
1525  }
1526 
1527  // if( rn >=43 && rn <49)
1528  if( rn >=43) //One board replaced on 12th Feb'04
1529  {
1530  //chain33
1531  status[33][2]=0;
1532  }
1533 
1534  if( rn >=49 )//Following are the FEE config after 18th Feb'04 access
1535  {
1536  //chain 38
1537  // status[38][5]=0;
1538  status[38][19]=0;
1539  status[38][22]=0;
1540  // status[38][24]=0; //already assigned
1541  // status[38][25]=0;
1542  //chain 8
1543  // status[8][22]=0; //already assigned
1544  }
1545 
1546  if(rn>=63) //Following are the FEE config after 3rd Mar'04 access
1547  {
1548  //chain 24
1549  status[24][20]=0;
1550  //chain38
1551  status[38][14]=0;
1552  //chain46
1553  status[46][8] = 0;
1554  }
1555 
1556  if( rn >=78 )//Following are the FEE config after 18th Mar'04 access
1557  {
1558  //chain 25
1559  status[24][12]=0;
1560  //chain 30
1561  status[30][18]=0;
1562  //chain 32
1563  status[32][21]=0;
1564  //chain 35
1565  status[35][12]=0;
1566  //chain 36
1567  status[36][24]=0;
1568  //chain 38
1569  status[38][7]=0;
1570  //chain 42
1571  status[42][7]=0;
1572  //chain 45
1573  status[45][8]=0;
1574  //chain 44
1575  status[44][6]=0;status[44][11]=0;
1576  //chain 46
1577  status[46][8]=0;status[46][16]=0;
1578  //chain 47
1579  status[47][11]=0;status[47][19]=0;
1580  status[47][20]=0;
1581 
1582  }
1583  } // end of year==5
1584 
1585  //(Y2005, Rashmi's) Following are the configuration of FEE from 26th Nov'04 for pmd and 24th Dec'04 for cpv.
1586  if( rn >=1 && year==6)
1587  {
1588  //chain 1
1589  for(Int_t i=3;i<9;i++)status[0][i]=0;
1590  for(Int_t i=24;i<27;i++)status[0][i]=0;
1591  //chain 2
1592  // all alive
1593  //chain 3
1594  status[2][4]=0;status[2][6]=0;
1595  //chain 4
1596  status[3][4]=0;
1597  for(Int_t i=19;i<22;i++)status[3][i]=0;
1598  status[3][24]=0;
1599  //chain 5
1600  status[4][12]=0;
1601  //chain 6
1602  for(Int_t i=0;i<27;i++)status[5][i]=0;
1603  //chain 7
1604  status[6][0]=0;status[6][5]=0;
1605  for(Int_t i=12;i<14;i++)status[6][i]=0;
1606  for(Int_t i=21;i<23;i++)status[6][i]=0;
1607  //chain 8
1608  status[7][3]=0;status[7][23]=0;
1609  for(Int_t i=10;i<14;i++)status[7][i]=0;
1610  for(Int_t i=25;i<26;i++)status[7][i]=0;
1611  //chain 9
1612  status[8][0]=0;status[8][7]=0;
1613  status[8][19]=0;status[8][25]=0;status[8][26]=0;
1614  //chain 10
1615  status[9][5]=0; status[9][8]=0; status[9][22]=0;
1616  //chain 11
1617  status[10][0]=0;status[10][7]=0;
1618  for(Int_t i=12;i<14;i++)status[10][i]=0;
1619  for(Int_t i=22;i<27;i++)status[10][i]=0;
1620  //chain 12
1621  for(Int_t i=4;i<7;i++)status[11][i]=0;
1622  status[11][9]=0;
1623  for(Int_t i=12;i<14;i++)status[11][i]=0;
1624  for(Int_t i=18;i<27;i++)status[11][i]=0;
1625  //chain 13
1626  status[12][6]=0;
1627  for(Int_t i=10;i<12;i++)status[12][i]=0;
1628  status[12][15]=0;status[12][23]=0;status[12][24]=0;status[12][26]=0;
1629  //chain 14
1630  for(Int_t i=0;i<27;i++)status[13][i]=0;
1631  //chain 15
1632  for(Int_t i=18;i<27;i++)status[14][i]=0;
1633  //chain 16
1634  for(Int_t i=12;i<14;i++)status[15][i]=0;
1635  for(Int_t i=18;i<27;i++)status[15][i]=0;
1636  //chain 17
1637  status[16][0]=0; status[16][17]=0; status[16][19]=0;
1638  status[16][20]=0; status[16][25]=0;status[16][26]=0;
1639  //chain 18
1640  for(Int_t i=0;i<27;i++)status[17][i]=0;
1641  //chain 19
1642  status[18][1]=0; status[18][6]=0; status[18][12]=0;
1643  for(Int_t i=18;i<21;i++)status[18][i]=0;
1644  for(Int_t i=24;i<27;i++)status[18][i]=0;
1645  //chain 20
1646  for(Int_t i=0;i<27;i++)status[19][i]=0;
1647  //chain 21
1648  status[20][0]=0; status[20][6]=0; status[20][7]=0;
1649  for(Int_t i=10;i<16;i++)status[20][i]=0;
1650  status[20][20]=0; status[20][26]=0;
1651  //chain 22
1652  for(Int_t i=0;i<27;i++)status[21][i]=0;
1653  //chain 23
1654  for(Int_t i=1;i<3;i++)status[22][i]=0;
1655  status[22][15]=0;
1656  //chain 24
1657  for(Int_t i=6;i<8;i++)status[23][i]=0;
1658  status[23][17]=0;
1659  for(Int_t i=23;i<27;i++)status[23][i]=0;
1660  //chain 25
1661  for(Int_t i=5;i<7;i++)status[24][i]=0;
1662  for(Int_t i=11;i<14;i++)status[24][i]=0;
1663  for(Int_t i=15;i<17;i++)status[24][i]=0;
1664  status[24][20]=0;
1665  //chain 26
1666  for(Int_t i=15;i<18;i++)status[25][i]=0;
1667  //chain 27
1668  for(Int_t i=1;i<3;i++)status[26][i]=0;
1669  //chain 28
1670  status[27][18]=0;
1671  //chain 29
1672  status[28][10]=0;status[28][24]=0;
1673  //chain 30
1674  for(Int_t i=0;i<3;i++)status[29][i]=0;
1675  for(Int_t i=15;i<21;i++)status[29][i]=0;
1676  //chain 31
1677  for(Int_t i=18;i<23;i++)status[30][i]=0;
1678  //chain 32
1679  //chain 33
1680  for(Int_t i=10;i<12;i++)status[32][i]=0;
1681  for(Int_t i=17;i<19;i++)status[32][i]=0;
1682  for(Int_t i=24;i<27;i++)status[32][i]=0;
1683  //chain 34
1684  status[33][18]=0;
1685  //chain 35
1686  for(Int_t i=0;i<3;i++)status[34][i]=0;
1687  //chain 36
1688  status[35][23]=0;
1689  //chain 37
1690  status[36][2]=0; status[36][12]=0;
1691  for(Int_t i=6;i<8;i++)status[36][i]=0;
1692  for(Int_t i=15;i<17;i++)status[36][i]=0;
1693  //chain 38
1694  status[37][8]=0;
1695  for(Int_t i=20;i<22;i++)status[37][i]=0;
1696  //chain 39
1697  status[38][14]=0;
1698  //chain 40
1699  status[39][2]=0; status[39][10]=0; status[39][20]=0;
1700  for(Int_t i=6;i<8;i++)status[39][i]=0;
1701  for(Int_t i=24;i<27;i++)status[39][i]=0;
1702  //chain 41
1703  status[40][7]=0;
1704  for(Int_t i=9;i<11;i++)status[40][i]=0;
1705  for(Int_t i=13;i<15;i++)status[40][i]=0;
1706  //chain 42
1707  //chain 43
1708  status[42][7]=0;
1709  //chain 44
1710  //chain 45
1711  status[44][3]=0;status[44][6]=0;
1712  for(Int_t i=12;i<18;i++)status[44][i]=0;
1713  for(Int_t i=18;i<27;i++)status[44][i]=0;
1714  //chain 46
1715  for(Int_t i=9;i<27;i++)status[45][i]=0;
1716  //chain 47
1717  for(Int_t i=0;i<4;i++)status[46][i]=0;
1718  for(Int_t i=6;i<9;i++)status[46][i]=0;
1719  status[46][10]=0;status[46][15]=0;status[46][17]=0;status[46][24]=0;
1720  //chain 48
1721  status[47][0]=0;status[47][5]=0;status[47][11]=0;
1722  for(Int_t i=14;i<16;i++)status[47][i]=0;
1723  for(Int_t i=17;i<19;i++)status[47][i]=0;
1724  for(Int_t i=24;i<27;i++)status[47][i]=0;
1725  }
1726 
1727  if(rn >=1 && year==8){
1728  // RR 06/03/2007 Since some chains extend beyond 27 mapped boards
1729  // Setting status for boards beyond 27 for
1730  // all chains except 1,7,19,20,23,24 to status 0
1731  // beyond 27 board.
1732  for(Int_t i=0;i<48;i++){
1733  for(Int_t ib=27;ib<36;ib++){
1734  if (i==0 || i==6 || i==18 || i==19 || i==22 || i==23){
1735  status[i][ib]=1;
1736  }else {
1737  status[i][ib]=0;
1738  }
1739  }
1740  }
1741 
1742  //chain 1
1743  for(Int_t i=0;i<9;i++)status[0][i]=0;
1744  for(Int_t i=12;i<18;i++)status[0][i]=0;
1745  for(Int_t i=33;i<36;i++)status[0][i]=0;
1746  //chain 2
1747 
1748  //chain 3
1749  // For e.g. the following statements are for the 5th & 7th board
1750  status[2][4]=0;
1751  status[2][6]=0;
1752  //chain 4
1753  status[3][4]=0;
1754  for(Int_t i=19;i<22;i++)status[3][i]=0;
1755  status[3][24]=0;
1756  //chain 5
1757  status[4][12]=0;
1758  //chain 6
1759 
1760  //chain 7
1761  status[6][0]=0;
1762  status[6][5]=0;
1763  status[6][12]=0;
1764  status[6][13]=0;
1765  status[6][18]=0;
1766  for(Int_t i=22;i<32;i++)status[6][i]=0;
1767  //chain 8
1768  status[7][3]=0;
1769  for(Int_t i=10;i<14;i++)status[7][i]=0;
1770  status[7][23]=0;
1771  status[7][25]=0;
1772  status[7][26]=0;
1773  //chain 9
1774  status[8][0]=0;
1775  status[8][7]=0;
1776  status[8][19]=0;
1777  status[8][25]=0;
1778  status[8][26]=0;
1779  //chain 10
1780  status[9][5]=0;
1781  status[9][8]=0;
1782  status[9][22]=0;
1783  //chain 11
1784  status[10][0]=0;
1785  status[10][7]=0;
1786  status[10][12]=0;
1787  status[10][13]=0;
1788  for(Int_t i=22;i<27;i++)status[10][i]=0;
1789  //chain 12
1790  for(Int_t i=4;i<7;i++)status[11][i]=0;
1791  status[11][9]=0;
1792  status[11][12]=0;
1793  status[11][13]=0;
1794  for(Int_t i=18;i<27;i++)status[11][i]=0;
1795  //chain 13
1796  status[12][6]=0;
1797  status[12][10]=0;
1798  status[12][11]=0;
1799  status[12][15]=0;
1800  status[12][23]=0;
1801  status[12][24]=0;
1802  status[12][26]=0;
1803  //chain 14
1804 
1805  //chain 15
1806  for(Int_t i=24;i<27;i++)status[14][i]=0;
1807  //chain 16
1808  //chain 17
1809  //Does not exist
1810  //chain 18
1811  status[17][20]=0;
1812  //chain 19
1813  for(Int_t i=3;i<6;i++)status[18][i]=0;
1814  status[18][9]=0;
1815  for(Int_t i=15;i<18;i++)status[18][i]=0;
1816  status[18][34]=0;
1817  status[18][35]=0;
1818  //chain 20
1819  for(Int_t i=0;i<3;i++)status[19][i]=0;
1820  for(Int_t i=6;i<10;i++)status[19][i]=0;
1821  for(Int_t i=14;i<18;i++)status[19][i]=0;
1822  status[19][32]=0;
1823  status[19][33]=0;
1824 
1825  //chain 21
1826 
1827  //chain 22
1828 
1829  //chain 23
1830  for(Int_t i=18;i<25;i++)status[22][i]=0;
1831  status[22][29]=0;
1832  status[22][35]=0;
1833  //chain 24
1834  status[23][5]=0;
1835  status[23][6]=0;
1836  status[23][16]=0;
1837  for(Int_t i=22;i<30;i++)status[23][i]=0;
1838  //chain 25
1839  status[24][5]=0;
1840  status[24][6]=0;
1841  for(Int_t i=11;i<14;i++)status[24][i]=0;
1842  status[24][15]=0;
1843  status[24][16]=0;
1844  status[24][20]=0;
1845  //chain 26
1846 
1847  //chain 27
1848  status[26][1]=0;
1849  status[26][2]=0;
1850  //chain 28
1851 
1852  //chain 29
1853 
1854  //chain 30
1855  for(Int_t i=0;i<3;i++)status[29][i]=0;
1856  status[29][8]=0;
1857  for(Int_t i=15;i<21;i++)status[29][i]=0;
1858  //chain 31
1859  for(Int_t i=18;i<23;i++)status[30][i]=0;
1860  //chain 32
1861 
1862  //chain 33
1863  status[32][10]=0;
1864  status[32][11]=0;
1865  status[32][17]=0;
1866  status[32][18]=0;
1867  for(Int_t i=23;i<27;i++)status[32][i]=0;
1868  //chain 34
1869  status[33][18]=0;
1870  //chain 35
1871  status[34][2]=0;
1872  status[34][10]=0;
1873  //chain 36
1874  status[35][23]=0;
1875  //chain 37
1876  status[36][2]=0;
1877  for(Int_t i=6;i<9;i++)status[36][i]=0;
1878  status[36][12]=0;
1879  for(Int_t i=14;i<17;i++)status[36][i]=0;
1880  //chain 38
1881  status[37][7]=0;
1882  status[37][8]=0;
1883  status[37][20]=0;
1884  status[37][21]=0;
1885  //chain 39
1886  status[38][14]=0;
1887  //chain 40
1888  status[39][2]=0;
1889  status[39][6]=0;
1890  status[39][7]=0;
1891  status[39][10]=0;
1892  status[39][20]=0;
1893  for(Int_t i=24;i<27;i++)status[39][i]=0;
1894  //chain 41
1895  status[40][7]=0;
1896  status[40][9]=0;
1897  status[40][10]=0;
1898  status[40][13]=0;
1899  status[40][14]=0;
1900  //chain 42
1901 
1902  //chain 43
1903  status[42][7]=0;
1904  //chain 44
1905 
1906  //chain 45
1907  for(Int_t i=10;i<27;i++)status[44][i]=0;
1908  //chain 46
1909  //chain 47
1910  //chain 48
1911  }
1912  if(rn>87&&year==8){
1913  //chain 33 board 7
1914  status[32][6]=0;
1915  // chain 46 board 18,19
1916  status[45][17]=0;
1917  status[45][18]=0;
1918  }
1919  //access on 11April 2007
1920  if(rn>101&&year==8){
1921  //chain 25 FEE board 5
1922  status[24][4]=0;
1923  //chain 29 FEE board 7, 12, 26
1924  status[28][6]=0;
1925  status[28][11]=0;
1926  status[28][25]=0;
1927  //chain 33 FEE board 1, 5
1928  status[32][0]=0;
1929  status[32][4]=0;
1930  }
1931  //access on 26/04/06
1932  if(rn>114&&year==8){
1933  status[46][6]=0;
1934  }
1935 
1936 //access on 26/04/06
1937 // ZA wrote (mail on dec 6,07, in pmd list) following boards were removed:
1938 // chain 39: 1,4,5,6
1939 // chain26: 8,13
1940 // Chain 23: 1,4,5
1941 // Chain29: 7,12
1942 // Chan37: 10
1943 // Numbering is assumed to start from 1 and not from 0 , to be checked
1944 
1945  if(rn>300 && year==8){
1946  status[38][0]=0;
1947  status[38][3]=0;
1948  status[38][4]=0;
1949  status[38][5]=0;
1950  status[25][7]=0;
1951  status[25][12]=0;
1952  status[22][0]=0;
1953  status[22][3]=0;
1954  status[22][4]=0;
1955  status[28][6]=0;
1956  status[28][11]=0;
1957  status[36][9]=0;
1958  }
1959 
1960  if(rn >=1 && (year==10||year==11||year==12)){
1961  // RR 23/10/2009 Since some chains extend beyond 27 mapped boards
1962  // Setting status for boards beyond 27 for
1963  // all chains except 1,7,19,20,23,24 to status 0
1964  // beyond 27 board.
1965  for(Int_t i=0;i<48;i++){
1966  for(Int_t ib=27;ib<36;ib++){
1967  if (i==7 || i==11 || i==22 || i==23){
1968  status[i][ib]=1;
1969  }else {
1970  status[i][ib]=0;
1971  }
1972  }
1973  }
1974 
1975  // chain 1
1976  for(Int_t brd = 0;brd<=2;brd++){
1977  status[0][brd]=0;
1978  }
1979  for(Int_t brd = 6;brd<=8;brd++){
1980  status[0][brd]=0;
1981  }
1982  for(Int_t brd = 24;brd<=26;brd++){
1983  status[0][brd]=0;
1984  }
1985  // chain 2
1986  // chain 3
1987  status[2][4]=0;
1988  status[2][6]=0;
1989  status[2][20]=0;
1990  // chain 4
1991  status[3][4]=0;
1992  status[3][19]=0;
1993  status[3][20]=0;
1994  status[3][21]=0;
1995  status[3][24]=0;
1996  // chain 5
1997  status[4][12]=0;
1998  // chain 6
1999  // chain 7
2000  // chain 8
2001  status[7][14]=0;
2002  status[7][16]=0;
2003  status[7][17]=0;
2004  for(Int_t brd=19;brd<=22;brd++){
2005  status[7][brd]=0;
2006  }
2007  status[7][30]=0;
2008  // chain 9
2009  // chain 10
2010  status[9][2]=0;
2011  status[9][5]=0;
2012  status[9][13]=0;
2013  // chain 11
2014  status[10][16]=0;
2015  // chain 12
2016  status[11][1]=0;
2017  status[11][2]=0;
2018  status[11][6]=0;
2019  status[11][14]=0;
2020  status[11][15]=0;
2021  status[11][17]=0;
2022  for(Int_t brd=22;brd<=24;brd++){
2023  status[11][brd]=0;
2024  }
2025  status[11][27]=0;
2026  status[11][30]=0;
2027  status[11][31]=0;
2028  // chain 13
2029  // chain 14
2030  // chain 15
2031  for(Int_t brd=18;brd<=20;brd++){
2032  status[14][brd]=0;
2033  }
2034  // chain 16
2035  status[15][3]=0;
2036  // chain 17
2037  // chain 18
2038  status[17][20]=0;
2039  // chain 19
2040  // chain 20
2041  status[19][14]=0;
2042  status[19][15]=0;
2043  // chain 21
2044  // chain 22
2045  for(Int_t brd = 11;brd<=14;brd++){
2046  status[21][brd]=0;
2047  }
2048  // chain 23
2049  status[22][11]=0;
2050  status[22][12]=0;
2051  for(Int_t brd = 18;brd <=24;brd++){
2052  status[22][brd]=0;
2053  }
2054  status[22][29]=0;
2055  status[22][35]=0;
2056  // chain 24
2057  status[23][6]=0;
2058  status[23][7]=0;
2059  status[23][17]=0;
2060  for(Int_t i=23;i<=30;i++){status[23][i]=0;}
2061 
2062  /* status[23][11]=0;
2063  status[23][12]=0;
2064  for(Int_t brd = 18;brd<=24;brd++){
2065  status[23][brd]=0;
2066  }
2067  status[23][29]=0;
2068  status[23][35]=0;
2069  */
2070  //chain 25
2071  // chain 26
2072  for(Int_t brd = 3;brd<=5;brd++){
2073  status[25][brd]=0;
2074  }
2075  for(Int_t brd = 12;brd<=14;brd++){
2076  status[25][brd]=0;
2077  }
2078  for(Int_t brd = 21;brd<=23;brd++){
2079  status[25][brd]=0;
2080  }
2081  // chain 27
2082  // chain 28
2083  // chain 29
2084  // chain 30
2085  // chain 31
2086  // chain 32
2087  // chain 33
2088  // chain 34
2089  status[33][18]=0;
2090  // chain 35
2091  // chain 36
2092  // chain 37
2093  // chain 38
2094  status[37][7]=0;
2095  status[37][8]=0;
2096  status[37][20]=0;
2097  status[37][21]=0;
2098  // chain 39
2099  status[38][24]=0;
2100  // chain 40
2101  status[39][2]=0;
2102  status[39][6]=0;
2103  status[39][7]=0;
2104  status[39][10]=0;
2105  status[39][20]=0;
2106  for(Int_t brd=24;brd<=26;brd++){
2107  status[39][brd]=0;
2108  }
2109  // chain 41
2110  status[40][9]=0;
2111  status[40][10]=0;
2112  status[40][13]=0;
2113  status[40][14]=0;
2114  // chain 42
2115  // chain 43
2116  status[42][7]=0;
2117  // chain 44
2118  status[43][19]=0;
2119  // chain 45
2120  for(Int_t brd = 10;brd<=26;brd++){
2121  status[44][brd]=0;
2122  }
2123  // chain 46
2124  status[45][17]=0;
2125  status[45][20]=0;
2126  // chain 47
2127  status[46][6]=0;
2128  status[46][8]=0;
2129  status[46][9]=0;
2130  status[46][10]=0;
2131  status[46][26]=0;
2132  // chain 48
2133  }
2134  if(rn>48 && (year==10||year==11)){
2135  // chain 30 board 18 is removed AFTER run 11048019 as reported by Zubayer on 27Feb2010
2136  status[29][17]=0;
2137  }
2138 
2139  if(rn>84 && (year==10||year==11)){
2140  // chain 26 board 11 removed as reported by Prithwish on 25/3/2010
2141  // chain 26 board 26 brought back as reported by Prithwish on 25/3/2010
2142  status[25][10]=0;
2143  status[25][25]=1;
2144  }
2145  if(rn>96 && (year==10||year==11)){
2146  // chain 29 modified as reported by Zubayer on 8/4/2010
2147  // chain 26 modified as reported by Zubayer on 8/4/2010
2148  for(Int_t brd = 6;brd<12;brd++){
2149  status[29][brd]=0;
2150  }
2151  status[29][8]=1;
2152  status[29][24]=0;
2153  status[29][25]=0;
2154  status[29][26]=0;
2155  status[25][25]=0;
2156  }
2157 
2158 
2159  for(Int_t i=0;i<48;i++){
2160  for(Int_t ib=0;ib<36;ib++){
2161  alive_stat[i]=alive_stat[i]+status[i][ib];
2162  }
2163  // cout<<" In readBoardDetail for chain "<<i+1<<" after reading status="<<alive_stat[i]<<" # of alive boards"<<endl;
2164  }
2165 }
2166 
2167 // (Y2005, rashmi's code)Function used for mapping from Chain#, Channel# to Detector SM, Col, Row
2168 Int_t StPmdGeom::ChainMapping(Int_t& chainno,Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t&chmod,Int_t year)
2169 {
2170  //initialized to zero rr 27.1.2005
2171  // cout<<"In chain mapping"<<endl;
2172  supmod =0;
2173  col =0;
2174  row = 0;
2175 
2176  Int_t chain = chainno;
2177  Int_t chtemp=ch;
2178  Int_t brd=Int_t((ch)/64)+1;
2179  Int_t missing=0;
2180  Int_t brdCount=0;
2181  // cout<<" Going to get missing"<<endl;
2182  // for(Int_t ibrd=0;ibrd<27;ibrd++)
2183  for(Int_t ibrd=0;ibrd<36;ibrd++){
2184  if(brdCount<brd){
2185  if(status[chainno-1][ibrd]==0){missing++;}
2186  brdCount+=status[chainno-1][ibrd];
2187  }
2188  }
2189  chtemp=ch+missing*64;
2190  chmod=chtemp;
2191  // cout<<"year,chain,ch,chtemp,missing="<<year<<","<<chainno<<","<<ch<<","<<chtemp<<","<<missing<<endl;
2192 
2193  if(year==8){
2194  if(chain==1 || chain==7 || chain==19 || chain==20 || chain==23 || chain==24) {
2195  // if(chtemp>=2304) cout<<"ch,chtemp="<<ch<<","<<chtemp<<endl;
2196  if( chtemp>=2304){return kStWarn;}
2197  }else{
2198  // if(chtemp>=1728) cout<<"ch,chtemp="<<ch<<","<<chtemp<<endl;
2199  if(chtemp >=1728){
2200  // cout<<"returning kStWarn"<<endl;
2201  return kStWarn;
2202  }
2203  }
2204  // Non existent chains
2205  if(chain==6 || chain==17 || chain == 21 ){return kStWarn;}
2206  }else{
2207  if(year==10||year==11||year==12){
2208  // cout<<"year,chain,ch,chtemp,missing="<<year<<","<<chainno<<","<<ch<<","<<chtemp<<","<<missing<<endl;
2209  if(chain==8||chain==12||chain==23||chain==24){
2210  if(chtemp>=2304){return kStWarn;}
2211  }else{
2212  if(chtemp>=1728){return kStWarn;}
2213  }
2214  if(chain==6||chain==21){return kStWarn;}
2215  }else{
2216  // if(chtemp>=1728) cout<<"ch,chtemp="<<ch<<","<<chtemp<<endl;
2217  if(chtemp>=1728){ return kStWarn;}
2218  }
2219  }
2220  // cout<<"year,chain,ch,chtemp,missing="<<year<<","<<chainno<<","<<ch<<","<<chtemp<<","<<missing<<endl;
2221 
2222  switch(chain){
2223 
2224  case 1:
2225  chain1(chtemp,supmod,col,row,year);
2226  break;
2227  case 2:
2228  chain2(chtemp,supmod,col,row,year);
2229  break;
2230  case 3:
2231  chain3(chtemp,supmod,col,row,year);
2232  break;
2233  case 4:
2234  chain4(chtemp,supmod,col,row,year);
2235  break;
2236  case 5:
2237  chain5(chtemp,supmod,col,row,year);
2238  break;
2239  case 6:
2240  chain6(chtemp,supmod,col,row,year);
2241  break;
2242  case 7:
2243  chain7(chtemp,supmod,col,row,year);
2244  break;
2245  case 8:
2246  chain8(chtemp,supmod,col,row,year);
2247  break;
2248  case 9:
2249  chain9(chtemp,supmod,col,row,year);
2250  break;
2251  case 10:
2252  chain10(chtemp,supmod,col,row,year);
2253  break;
2254  case 11:
2255  chain11(chtemp,supmod,col,row,year);
2256  break;
2257  case 12:
2258  chain12(chtemp,supmod,col,row,year);
2259  break;
2260  case 13:
2261  chain13(chtemp,supmod,col,row,year);
2262  break;
2263  case 14:
2264  chain14(chtemp,supmod,col,row,year);
2265  break;
2266  case 15:
2267  chain15(chtemp,supmod,col,row,year);
2268  break;
2269  case 16:
2270  chain16(chtemp,supmod,col,row,year);
2271  break;
2272  case 17:
2273  chain17(chtemp,supmod,col,row,year);
2274  break;
2275  case 18:
2276  chain18(chtemp,supmod,col,row,year);
2277  break;
2278  case 19:
2279  chain19(chtemp,supmod,col,row,year);
2280  break;
2281  case 20:
2282  chain20(chtemp,supmod,col,row,year);
2283  break;
2284  case 21:
2285  chain21(chtemp,supmod,col,row,year);
2286  break;
2287  case 22:
2288  chain22(chtemp,supmod,col,row,year);
2289  break;
2290  case 23:
2291  chain23(chtemp,supmod,col,row,year);
2292  break;
2293  case 24:
2294  chain24(chtemp,supmod,col,row,year);
2295  break;
2296  case 25:
2297  chain25(chtemp,supmod,col,row,year);
2298  break;
2299  case 26:
2300  chain26(chtemp,supmod,col,row,year);
2301  break;
2302  case 27:
2303  chain27(chtemp,supmod,col,row,year);
2304  break;
2305  case 28:
2306  chain28(chtemp,supmod,col,row,year);
2307  break;
2308  case 29:
2309  chain29(chtemp,supmod,col,row,year);
2310  break;
2311  case 30:
2312  chain30(chtemp,supmod,col,row,year);
2313  break;
2314  case 31:
2315  chain31(chtemp,supmod,col,row,year);
2316  break;
2317  case 32:
2318  chain32(chtemp,supmod,col,row,year);
2319  break;
2320  case 33:
2321  chain33(chtemp,supmod,col,row,year);
2322  break;
2323  case 34:
2324  chain34(chtemp,supmod,col,row,year);
2325  break;
2326  case 35:
2327  chain35(chtemp,supmod,col,row,year);
2328  break;
2329  case 36:
2330  chain36(chtemp,supmod,col,row,year);
2331  break;
2332  case 37:
2333  chain37(chtemp,supmod,col,row,year);
2334  break;
2335  case 38:
2336  chain38(chtemp,supmod,col,row,year);
2337  break;
2338  case 39:
2339  chain39(chtemp,supmod,col,row,year);
2340  break;
2341  case 40:
2342  chain40(chtemp,supmod,col,row,year);
2343  break;
2344  case 41:
2345  chain41(chtemp,supmod,col,row,year);
2346  break;
2347  case 42:
2348  chain42(chtemp,supmod,col,row,year);
2349  break;
2350  case 43:
2351  chain43(chtemp,supmod,col,row,year);
2352  break;
2353  case 44:
2354  chain44(chtemp,supmod,col,row,year);
2355  break;
2356  case 45:
2357  chain45(chtemp,supmod,col,row,year);
2358  break;
2359  case 46:
2360  chain46(chtemp,supmod,col,row,year);
2361  break;
2362  case 47:
2363  chain47(chtemp,supmod,col,row,year);
2364  break;
2365  case 48:
2366  chain48(chtemp,supmod,col,row,year);
2367  break;
2368  }
2369  if(supmod<=0 || col<=0 || row<=0){
2370  // cout<<"chain = "<<chain<<" chtemp="<<chtemp<<" supmod="<<supmod<<" col="<<col<<" row="<<row<<endl;
2371  return kStWarn;
2372  }
2373 
2374  // cout<<"chain = "<<chain<<" chtemp="<<chtemp<<" supmod="<<supmod<<" row="<<row<<" col="<<col<<endl;
2375  return kStOk;
2376 }
2377 
2378 // The following chains [1-48] have been mapped for run05
2379 void StPmdGeom::chain1(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
2380 {
2381  Int_t zone = ch/192;
2382  switch(year){
2383  /*
2384  case 5: {
2385  supmod = 1;
2386  switch(zone){
2387  case 0:
2388  col = inorm[ch] + 24; row = jnorm[ch]; //old
2389  // col = 25 - inorm[ch]; row = 9 - jnorm[ch];
2390  break;
2391  case 1:
2392  col = inorm[ch-192]; row = jnorm[ch-192]; //old
2393  // col = 25 - inorm[ch-192]+ 24; row = 9 - jnorm[ch-192];
2394  break;
2395  case 2:
2396  col = 25 - inorm[ch-2*192]; row = 9 - jnorm[ch-2*192] + 8; //old
2397  //col = inorm[ch-2*192] + 24; row = jnorm[ch-2*192] + 8;
2398  break;
2399  case 3:
2400  col = 25 - inorm[ch-3*192] + 24; row = 9 - jnorm[ch-3*192] + 8; //old
2401  //col = inorm[ch-3*192]; row = jnorm[ch -3*192] + 8;
2402  break;
2403  case 4:
2404  col = inorm[ch-4*192] + 24; row = jnorm[ch - 4*192] + 16; //old
2405  //col = 25 - inorm[ch-4*192]; row = 9 - jnorm[ch-4*192] + 16;
2406  break;
2407  case 5:
2408  col = inorm[ch-5*192]; row = jnorm[ch-5*192] + 16; //old
2409  //col = 25 - inorm[ch-5*192]+ 24; row = 9 - jnorm[ch-5*192] + 16;
2410  break;
2411  case 6:
2412  col = inorm[ch-6*192]; row = jnorm[ch-6*192] + 24; //old
2413  //col = 25 - inorm[ch-6*192]; row = 9 - jnorm[ch-6*192] + 24;
2414  break;
2415  case 7:
2416  col = 25 - inorm[ch-7*192]; row = 9 - jnorm[ch-7*192] + 24 + 8; //old
2417  //col = inorm[ch-7*192]; row = jnorm[ch-7*192] + 24 + 8;
2418  break;
2419  case 8:
2420  col = inorm[ch-8*192]; row = jnorm[ch-8*192] + 24 + 16; //old
2421  //col = 25 - inorm[ch-8*192]; row = 9 - jnorm[ch-8*192] + 24 + 16;
2422  break;
2423  }
2424  }
2425  break;
2426  */
2427  case 6: {
2428 
2429  switch(zone){
2430  case 0:
2431  col = inorm[ch]; row = 8 + jnorm[ch];
2432  supmod = 1;
2433  break;
2434  case 1:
2435  col = 25 - inorm[ch-192]; row = 25 - jnorm[ch-192];
2436  supmod = 1;
2437  break;
2438  case 2:
2439  col = 49 - inorm[ch-2*192]; row = 25 - jnorm[ch-2*192];
2440  supmod = 1;
2441  break;
2442  case 3:
2443  col = 24 + inorm[ch-3*192]; row = 24 + jnorm[ch-3*192];
2444  supmod = 1;
2445  break;
2446  case 4:
2447  col = inorm[ch-4*192]; row = 24 + jnorm[ch-4*192];
2448  supmod = 1;
2449  break;
2450  case 5:
2451  col = 25 - inorm[ch-5*192]; row = 41 - jnorm[ch-5*192];
2452  supmod = 1;
2453  break;
2454  case 6:
2455  col = 49 - inorm[ch-6*192]; row = 41 - jnorm[ch-6*192];
2456  supmod = 1;
2457  break;
2458  case 7:
2459  col = 24 + inorm[ch-7*192]; row = 40 + jnorm[ch-7*192];
2460  supmod = 1;
2461  break;
2462  case 8:
2463  col = inorm[ch-8*192]; row = 40 + jnorm[ch-8*192];
2464  supmod = 1;
2465  break;
2466  }
2467  // The following instruction are for changing year to 2007
2468  break;
2469  }
2470  case 8: {
2471 
2472  switch(zone){
2473  case 0:
2474  col = 25 - inorm[ch]; row = 9 - jnorm[ch];
2475  supmod = 1;
2476  break;
2477  case 1:
2478  col = 49 - inorm[ch-192]; row = 9 - jnorm[ch-192];
2479  supmod = 1;
2480  break;
2481  case 2:
2482  col = 24 + inorm[ch-2*192]; row = 8 + jnorm[ch-2*192];
2483  supmod = 1;
2484  break;
2485  case 3:
2486  col = inorm[ch-3*192]; row = 8 + jnorm[ch-3*192];
2487  supmod = 1;
2488  break;
2489  case 4:
2490  col = 25 - inorm[ch-4*192]; row = 25 - jnorm[ch-4*192];
2491  supmod = 1;
2492  break;
2493  case 5:
2494  col = 49 - inorm[ch-5*192]; row = 25 - jnorm[ch-5*192];
2495  supmod = 1;
2496  break;
2497  case 6:
2498  col = 24 + inorm[ch-6*192]; row = 24 + jnorm[ch-6*192];
2499  supmod = 1;
2500  break;
2501  case 7:
2502  col = inorm[ch-7*192]; row = 24 + jnorm[ch-7*192];
2503  supmod = 1;
2504  break;
2505  case 8:
2506  col = 25 - inorm[ch-8*192]; row = 41 - jnorm[ch-8*192];
2507  supmod = 1;
2508  break;
2509  case 9:
2510  col = 49 - inorm[ch-9*192]; row = 41 - jnorm[ch-9*192];
2511  supmod = 1;
2512  break;
2513  case 10:
2514  col = 24 + inorm[ch-10*192]; row = 40 + jnorm[ch-10*192];
2515  supmod = 1;
2516  break;
2517  case 11:
2518  col = inorm[ch-11*192]; row = 40 + jnorm[ch-11*192];
2519  supmod = 1;
2520  break;
2521  }
2522  break;
2523  }
2524  case 10:
2525  case 11:
2526  case 12:
2527  switch(zone)
2528  {
2529  case 0:
2530  col = 25 - inorm[ch];
2531  row = 9 - jnorm[ch];
2532  supmod = 1;
2533  break;
2534  case 1:
2535  col = inorm[ch-192];
2536  row = 8 + jnorm[ch-192];
2537  supmod = 1;
2538  break;
2539  case 2:
2540  col = 25 - inorm[ch-2*192];
2541  row = 25 - jnorm[ch-2*192];
2542  supmod = 1;
2543  break;
2544  case 3:
2545  col = 25 - inorm[ch-3*192];
2546  row = 33 - jnorm[ch-3*192];
2547  supmod = 1;
2548  break;
2549  case 4:
2550  col = 49 - inorm[ch-4*192];
2551  row = 33 -jnorm[ch-4*192];
2552  supmod = 1;
2553  break;
2554  case 5:
2555  col = 24 + inorm[ch-5*192];
2556  row = 32 + jnorm[ch-5*192];
2557  supmod = 1;
2558  break;
2559  case 6:
2560  col = inorm[ch-6*192];
2561  row = 32 + jnorm[ch-6*192];
2562  supmod = 1;
2563  break;
2564  case 7:
2565  col = 25 - inorm[ch-7*192];
2566  row = 49 - jnorm[ch-7*192];
2567  supmod = 1;
2568  break;
2569  case 8:
2570  col = 49 - inorm[ch-8*192];
2571  row = 49 - jnorm[ch-8*192];
2572  supmod = 1;
2573  break;
2574  }
2575  break;
2576  }
2577 }
2578 
2579 void StPmdGeom::chain2(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
2580 {
2581  Int_t zone = ch/192;
2582  switch(year){
2583  case 6:
2584 
2585  switch(zone)
2586  {
2587  case 0:
2588  col = 48 + inorm[ch];
2589  row = jnorm[ch];
2590  supmod = 2;
2591  break;
2592  case 1:
2593  col = 24 + inorm[ch-192];
2594  row = jnorm[ch-192];
2595  supmod = 2;
2596  break;
2597  case 2:
2598  col = inorm[ch-2*192];
2599  row = jnorm[ch-2*192];
2600  supmod = 2;
2601  break;
2602  case 3:
2603  col = 25 - inorm[ch-3*192];
2604  row = 17 - jnorm[ch-3*192];
2605  supmod = 2;
2606  break;
2607  case 4:
2608  col = 49 - inorm[ch-4*192];
2609  row = 17 - jnorm[ch-4*192];
2610  supmod = 2;
2611  break;
2612  case 5:
2613  col = 73 - inorm[ch-5*192];
2614  row = 17 - jnorm[ch-5*192];
2615  supmod = 2;
2616  break;
2617  case 6:
2618  col = 48 + inorm[ch-6*192];
2619  row = 16 + jnorm[ch-6*192];
2620  supmod = 2;
2621  break;
2622  case 7:
2623  col = 24 + inorm[ch-7*192];
2624  row = 16 + jnorm[ch-7*192];
2625  supmod = 2;
2626  break;
2627  case 8:
2628  col = inorm[ch-8*192];
2629  row = 16 + jnorm[ch-8*192];
2630  supmod = 2;
2631  break;
2632  }
2633  break;
2634  case 8:
2635  case 10:
2636  case 11:
2637  case 12:
2638  switch(zone)
2639  {
2640  case 0:
2641  col = 48 + inorm[ch];
2642  row = jnorm[ch];
2643  supmod = 2;
2644  break;
2645  case 1:
2646  col = 24 + inorm[ch-192];
2647  row = jnorm[ch-192];
2648  supmod = 2;
2649  break;
2650  case 2:
2651  col = inorm[ch-2*192];
2652  row = jnorm[ch-2*192];
2653  supmod = 2;
2654  break;
2655  case 3:
2656  col = 25 - inorm[ch-3*192];
2657  row = 17 - jnorm[ch-3*192];
2658  supmod = 2;
2659  break;
2660  case 4:
2661  col = 49 - inorm[ch-4*192];
2662  row = 17 - jnorm[ch-4*192];
2663  supmod = 2;
2664  break;
2665  case 5:
2666  col = 73 - inorm[ch-5*192];
2667  row = 17 - jnorm[ch-5*192];
2668  supmod = 2;
2669  break;
2670  case 6:
2671  col = 48 + inorm[ch-6*192];
2672  row = 16 + jnorm[ch-6*192];
2673  supmod = 2;
2674  break;
2675  case 7:
2676  col = 24 + inorm[ch-7*192];
2677  row = 16 + jnorm[ch-7*192];
2678  supmod = 2;
2679  break;
2680  case 8:
2681  col = inorm[ch-8*192];
2682  row = 16 + jnorm[ch-8*192];
2683  supmod = 2;
2684  break;
2685  }
2686  break;
2687  }
2688 }
2689 
2690 void StPmdGeom::chain3(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
2691 {
2692  Int_t zone = ch/192;
2693  switch(year){
2694  case 6:
2695 
2696  switch(zone)
2697  {
2698  case 0:
2699  col = 16 + imirr[ch];
2700  row = jmirr[ch];
2701  supmod = 3;
2702  break;
2703  case 1:
2704  col = 16 + imirr[ch-192];
2705  row = 24 + jmirr[ch-192];
2706  supmod = 3;
2707  break;
2708  case 2:
2709  col = 16 + imirr[ch-2*192];
2710  row = 48 + jmirr[ch-2*192];
2711  supmod = 3;
2712  break;
2713  case 3:
2714  col = 17 - imirr[ch-3*192];
2715  row = 73 - jmirr[ch-3*192];
2716  supmod = 3;
2717  break;
2718  case 4:
2719  col = 17 - imirr[ch-4*192];
2720  row = 49 - jmirr[ch-4*192];
2721  supmod = 3;
2722  break;
2723  case 5:
2724  col = 17 - imirr[ch-5*192];
2725  row = 25 - jmirr[ch-5*192];
2726  supmod = 3;
2727  break;
2728  case 6:
2729  col = imirr[ch-6*192];
2730  row = jmirr[ch-6*192];
2731  supmod = 3;
2732  break;
2733  case 7:
2734  col = imirr[ch-7*192];
2735  row = 24 + jmirr[ch-7*192];
2736  supmod = 3;
2737  break;
2738  case 8:
2739  col = imirr[ch-8*192];
2740  row = 48 + jmirr[ch-8*192];
2741  supmod = 3;
2742  break;
2743  }
2744  break;
2745  case 8:
2746  case 10:
2747  case 11:
2748  case 12:
2749  switch(zone)
2750  {
2751  case 0:
2752  col = 16 + imirr[ch];
2753  row = jmirr[ch];
2754  supmod = 3;
2755  break;
2756  case 1:
2757  col = 16 + imirr[ch-192];
2758  row = 24 + jmirr[ch-192];
2759  supmod = 3;
2760  break;
2761  case 2:
2762  col = 16 + imirr[ch-2*192];
2763  row = 48 + jmirr[ch-2*192];
2764  supmod = 3;
2765  break;
2766  case 3:
2767  col = 17 - imirr[ch-3*192];
2768  row = 73 - jmirr[ch-3*192];
2769  supmod = 3;
2770  break;
2771  case 4:
2772  col = 17 - imirr[ch-4*192];
2773  row = 49 - jmirr[ch-4*192];
2774  supmod = 3;
2775  break;
2776  case 5:
2777  col = 17 - imirr[ch-5*192];
2778  row = 25 - jmirr[ch-5*192];
2779  supmod = 3;
2780  break;
2781  case 6:
2782  col = imirr[ch-6*192];
2783  row = jmirr[ch-6*192];
2784  supmod = 3;
2785  break;
2786  case 7:
2787  col = imirr[ch-7*192];
2788  row = 24 + jmirr[ch-7*192];
2789  supmod = 3;
2790  break;
2791  case 8:
2792  col = imirr[ch-8*192];
2793  row = 48 + jmirr[ch-8*192];
2794  supmod = 3;
2795  break;
2796  }
2797  break;
2798  }
2799 }
2800 void StPmdGeom::chain4(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
2801 {
2802 
2803  Int_t zone = ch/192;
2804  switch(year){
2805  case 6:
2806 
2807  switch(zone)
2808  {
2809  case 0:
2810  col = 48 + inorm[ch];
2811  row = 24 + jnorm[ch];
2812  supmod = 2;
2813  break;
2814  case 1:
2815  col = 24 + inorm[ch-192];
2816  row = 24 + jnorm[ch-192];
2817  supmod = 2;
2818  break;
2819  case 2:
2820  col = inorm[ch-2*192];
2821  row = 24 + jnorm[ch-2*192];
2822  supmod = 2;
2823  break;
2824  case 3:
2825  col = 25 - inorm[ch-3*192];
2826  row = 41 - jnorm[ch-3*192];
2827  supmod = 2;
2828  break;
2829  case 4:
2830  col = 49 - inorm[ch-4*192];
2831  row = 41 - jnorm[ch-4*192];
2832  supmod = 2;
2833  break;
2834  case 5:
2835  col = 73 - inorm[ch-5*192];
2836  row = 41 - jnorm[ch-5*192];
2837  supmod = 2;
2838  break;
2839  case 6:
2840  col = 48 + inorm[ch-6*192];
2841  row = 40 + jnorm[ch-6*192];
2842  supmod = 2;
2843  break;
2844  case 7:
2845  col = 24 + inorm[ch-7*192];
2846  row = 40 + jnorm[ch-7*192];
2847  supmod = 2;
2848  break;
2849  case 8:
2850  col = inorm[ch-8*192];
2851  row = 40 + jnorm[ch-8*192];
2852  supmod = 2;
2853  break;
2854  }
2855  break;
2856  case 8:
2857  case 10:
2858  case 11:
2859  case 12:
2860  switch(zone)
2861  {
2862  case 0:
2863  col = 48 + inorm[ch];
2864  row = 24 + jnorm[ch];
2865  supmod = 2;
2866  break;
2867  case 1:
2868  col = 24 + inorm[ch-192];
2869  row = 24 + jnorm[ch-192];
2870  supmod = 2;
2871  break;
2872  case 2:
2873  col = inorm[ch-2*192];
2874  row = 24 + jnorm[ch-2*192];
2875  supmod = 2;
2876  break;
2877  case 3:
2878  col = 25 - inorm[ch-3*192];
2879  row = 41 - jnorm[ch-3*192];
2880  supmod = 2;
2881  break;
2882  case 4:
2883  col = 49 - inorm[ch-4*192];
2884  row = 41 - jnorm[ch-4*192];
2885  supmod = 2;
2886  break;
2887  case 5:
2888  col = 73 - inorm[ch-5*192];
2889  row = 41 - jnorm[ch-5*192];
2890  supmod = 2;
2891  break;
2892  case 6:
2893  col = 48 + inorm[ch-6*192];
2894  row = 40 + jnorm[ch-6*192];
2895  supmod = 2;
2896  break;
2897  case 7:
2898  col = 24 + inorm[ch-7*192];
2899  row = 40 + jnorm[ch-7*192];
2900  supmod = 2;
2901  break;
2902  case 8:
2903  col = inorm[ch-8*192];
2904  row = 40 + jnorm[ch-8*192];
2905  supmod = 2;
2906  break;
2907  }
2908 
2909  }
2910 }
2911 void StPmdGeom::chain5(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
2912 {
2913  Int_t zone = ch/192;
2914  switch(year){
2915  case 6:
2916 
2917  switch(zone)
2918  {
2919  case 0:
2920  col = 40 + imirr[ch];
2921  row = jmirr[ch];
2922  supmod = 3;
2923  break;
2924  case 1:
2925  col = 40 + imirr[ch-192];
2926  row = 24 + jmirr[ch-192];
2927  supmod = 3;
2928  break;
2929  case 2:
2930  col = 40 + imirr[ch-2*192];
2931  row = 48 + jmirr[ch-2*192];
2932  supmod = 3;
2933  break;
2934  case 3:
2935  col = 41 - imirr[ch-3*192];
2936  row = 73 - jmirr[ch-3*192];
2937  supmod = 3;
2938  break;
2939  case 4:
2940  col = 41 - imirr[ch-4*192];
2941  row = 49 - jmirr[ch-4*192];
2942  supmod = 3;
2943  break;
2944  case 5:
2945  col = 41 - imirr[ch-5*192];
2946  row = 25 - jmirr[ch-5*192];
2947  supmod = 3;
2948  break;
2949  case 6:
2950  col = 24 + imirr[ch-6*192];
2951  row = jmirr[ch-6*192];
2952  supmod = 3;
2953  break;
2954  case 7:
2955  col = 24 + imirr[ch-7*192];
2956  row = 24 + jmirr[ch-7*192];
2957  supmod = 3;
2958  break;
2959  case 8:
2960  col = 24 + imirr[ch-8*192];
2961  row = 48 + jmirr[ch-8*192];
2962  supmod = 3;
2963  break;
2964  }
2965  break;
2966  case 8:
2967  case 10:
2968  case 11:
2969  case 12:
2970  switch(zone)
2971  {
2972  case 0:
2973  col = 40 + imirr[ch];
2974  row = jmirr[ch];
2975  supmod = 3;
2976  break;
2977  case 1:
2978  col = 40 + imirr[ch-192];
2979  row = 24 + jmirr[ch-192];
2980  supmod = 3;
2981  break;
2982  case 2:
2983  col = 40 + imirr[ch-2*192];
2984  row = 48 + jmirr[ch-2*192];
2985  supmod = 3;
2986  break;
2987  case 3:
2988  col = 41 - imirr[ch-3*192];
2989  row = 73 - jmirr[ch-3*192];
2990  supmod = 3;
2991  break;
2992  case 4:
2993  col = 41 - imirr[ch-4*192];
2994  row = 49 - jmirr[ch-4*192];
2995  supmod = 3;
2996  break;
2997  case 5:
2998  col = 41 - imirr[ch-5*192];
2999  row = 25 - jmirr[ch-5*192];
3000  supmod = 3;
3001  break;
3002  case 6:
3003  col = 24 + imirr[ch-6*192];
3004  row = jmirr[ch-6*192];
3005  supmod = 3;
3006  break;
3007  case 7:
3008  col = 24 + imirr[ch-7*192];
3009  row = 24 + jmirr[ch-7*192];
3010  supmod = 3;
3011  break;
3012  case 8:
3013  col = 24 + imirr[ch-8*192];
3014  row = 48 + jmirr[ch-8*192];
3015  supmod = 3;
3016  break;
3017  }
3018  break;
3019  }
3020 }
3021 void StPmdGeom::chain6(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3022 {
3023  supmod = 0;
3024  col = 0;
3025  row = 0;
3026 }
3027 void StPmdGeom::chain7(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3028 {
3029  Int_t zone = ch/192;
3030  switch(year){
3031  case 6:
3032 
3033  switch(zone)
3034  {
3035  case 0:
3036  col = 48 + inorm[ch];
3037  row = jnorm[ch];
3038  supmod = 4;
3039  break;
3040  case 1:
3041  col = 24 + inorm[ch-192];
3042  row = jnorm[ch-192];
3043  supmod = 4;
3044  break;
3045  case 2:
3046  col = inorm[ch-2*192];
3047  row = jnorm[ch-2*192];
3048  supmod = 4;
3049  break;
3050  case 3:
3051  col = 25 - inorm[ch-3*192];
3052  row = 17 - jnorm[ch-3*192];
3053  supmod = 4;
3054  break;
3055  case 4:
3056  col = 49 - inorm[ch-4*192];
3057  row = 17 - jnorm[ch-4*192];
3058  supmod = 4;
3059  break;
3060  case 5:
3061  col = 73 - inorm[ch-5*192];
3062  row = 17 - jnorm[ch-5*192];
3063  supmod = 4;
3064  break;
3065  case 6:
3066  col = 40 + inorm[ch-6*192];
3067  row = 16 + jnorm[ch-6*192];
3068  supmod = 4;
3069  break;
3070  case 7:
3071  col = 24 + inorm[ch-7*192];
3072  row = 24 + jnorm[ch-7*192];
3073  supmod = 4;
3074  break;
3075  case 8:
3076  col = inorm[ch-8*192];
3077  row = 24 + jnorm[ch-8*192];
3078  supmod = 4;
3079  break;
3080  }
3081  break;
3082  case 8:
3083 
3084  switch(zone)
3085  {
3086  case 0:
3087  col = 48 + inorm[ch];
3088  row = jnorm[ch];
3089  supmod = 4;
3090  break;
3091  case 1:
3092  col = 24 + inorm[ch-192];
3093  row = jnorm[ch-192];
3094  supmod = 4;
3095  break;
3096  case 2:
3097  col = inorm[ch-2*192];
3098  row = jnorm[ch-2*192];
3099  supmod = 4;
3100  break;
3101  case 3:
3102  col = 25 - inorm[ch-3*192];
3103  row = 17 - jnorm[ch-3*192];
3104  supmod = 4;
3105  break;
3106  case 4:
3107  col = 49 - inorm[ch-4*192];
3108  row = 17 - jnorm[ch-4*192];
3109  supmod = 4;
3110  break;
3111  case 5:
3112  col = 73 - inorm[ch-5*192];
3113  row = 17 - jnorm[ch-5*192];
3114  supmod = 4;
3115  break;
3116  case 6:
3117  col = 48 + inorm[ch-6*192];
3118  row = 16 + jnorm[ch-6*192];
3119  supmod = 4;
3120  break;
3121  case 7:
3122  col = 24 + inorm[ch-7*192];
3123  row = 16 + jnorm[ch-7*192];
3124  supmod = 4;
3125  break;
3126  case 8:
3127  col = inorm[ch-8*192];
3128  row = 16 + jnorm[ch-8*192];
3129  supmod = 4;
3130  break;
3131  case 9:
3132  col = 48 + inorm[ch-9*192];
3133  row = 24 + jnorm[ch-9*192];
3134  supmod = 4;
3135  break;
3136  case 10:
3137  col = 24 + inorm[ch-10*192];
3138  row = 24 + jnorm[ch-10*192];
3139  supmod = 4;
3140  break;
3141  case 11:
3142  col = inorm[ch-11*192];
3143  row = 24 + jnorm[ch-11*192];
3144  supmod = 4;
3145  break;
3146  }
3147  break;
3148  case 10:
3149  case 11:
3150  case 12:
3151  switch(zone)
3152  {
3153  case 0:
3154  col = 48 + inorm[ch];
3155  row = jnorm[ch];
3156  supmod = 4;
3157  break;
3158  case 1:
3159  col = 24 + inorm[ch-192];
3160  row = jnorm[ch-192];
3161  supmod = 4;
3162  break;
3163  case 2:
3164  col = inorm[ch-2*192];
3165  row = jnorm[ch-2*192];
3166  supmod = 4;
3167  break;
3168  case 3:
3169  col = 25 - inorm[ch-3*192];
3170  row = 17 - jnorm[ch-3*192];
3171  supmod = 4;
3172  break;
3173  case 4:
3174  col = 49 - inorm[ch-4*192];
3175  row = 17 - jnorm[ch-4*192];
3176  supmod = 4;
3177  break;
3178  case 5:
3179  col = 73 - inorm[ch-5*192];
3180  row = 17 - jnorm[ch-5*192];
3181  supmod = 4;
3182  break;
3183  case 6:
3184  col = 48 + inorm[ch-6*192];
3185  row = 16 + jnorm[ch-6*192];
3186  supmod = 4;
3187  break;
3188  case 7:
3189  col = 24 + inorm[ch-7*192];
3190  row = 16 + jnorm[ch-7*192];
3191  supmod = 4;
3192  break;
3193  case 8:
3194  col = inorm[ch-8*192];
3195  row = 16 + jnorm[ch-8*192];
3196  supmod = 4;
3197  break;
3198  }
3199  break;
3200  }
3201 }
3202 
3203 void StPmdGeom::chain8(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3204 {
3205  Int_t zone = ch/192;
3206  switch(year){
3207  case 6:
3208 
3209  switch(zone)
3210  {
3211  case 0:
3212  col = 48 + inorm[ch];
3213  row = jnorm[ch];
3214  supmod = 5;
3215  break;
3216  case 1:
3217  col = 24 + inorm[ch-192];
3218  row = jnorm[ch-192];
3219  supmod = 5;
3220  break;
3221  case 2:
3222  col = inorm[ch-2*192];
3223  row = jnorm[ch-2*192];
3224  supmod = 5;
3225  break;
3226  case 3:
3227  col = 25 - inorm[ch-3*192];
3228  row = 17 - jnorm[ch-3*192];
3229  supmod = 5;
3230  break;
3231  case 4:
3232  col = 49 - inorm[ch-4*192];
3233  row = 17 - jnorm[ch-4*192];
3234  supmod = 5;
3235  break;
3236  case 5:
3237  col = 73 - inorm[ch-5*192];
3238  row = 17 - jnorm[ch-5*192];
3239  supmod = 5;
3240  break;
3241  case 6:
3242  col = 48 + inorm[ch-6*192];
3243  row = 16 + jnorm[ch-6*192];
3244  supmod = 5;
3245  break;
3246  case 7:
3247  col = 24 + inorm[ch-7*192];
3248  row = 16 + jnorm[ch-7*192];
3249  supmod = 5;
3250  break;
3251  case 8:
3252  col = inorm[ch-8*192];
3253  row = 16 + jnorm[ch-8*192];
3254  supmod = 5;
3255  break;
3256  }
3257  break;
3258  case 8:
3259 
3260  switch(zone)
3261  {
3262  case 0:
3263  col = 48 + inorm[ch];
3264  row = jnorm[ch];
3265  supmod = 5;
3266  break;
3267  case 1:
3268  col = 24 + inorm[ch-192];
3269  row = jnorm[ch-192];
3270  supmod = 5;
3271  break;
3272  case 2:
3273  col = inorm[ch-2*192];
3274  row = jnorm[ch-2*192];
3275  supmod = 5;
3276  break;
3277  case 3:
3278  col = 25 - inorm[ch-3*192];
3279  row = 17 - jnorm[ch-3*192];
3280  supmod = 5;
3281  break;
3282  case 4:
3283  col = 49 - inorm[ch-4*192];
3284  row = 17 - jnorm[ch-4*192];
3285  supmod = 5;
3286  break;
3287  case 5:
3288  col = 73 - inorm[ch-5*192];
3289  row = 17 - jnorm[ch-5*192];
3290  supmod = 5;
3291  break;
3292  case 6:
3293  col = 48 + inorm[ch-6*192];
3294  row = 16 + jnorm[ch-6*192];
3295  supmod = 5;
3296  break;
3297  case 7:
3298  col = 24 + inorm[ch-7*192];
3299  row = 16 + jnorm[ch-7*192];
3300  supmod = 5;
3301  break;
3302  case 8:
3303  col = inorm[ch-8*192];
3304  row = 16 + jnorm[ch-8*192];
3305  supmod = 5;
3306  break;
3307  }
3308  break;
3309  case 10:
3310  case 11:
3311  case 12:
3312  switch(zone)
3313  {
3314  case 0:
3315  col = 48 + inorm[ch];
3316  row = 40 + jnorm[ch];
3317  supmod = 5;
3318  break;
3319  case 1:
3320  col = 73 - inorm[ch-192];
3321  row = 41 - jnorm[ch-192];
3322  supmod = 5;
3323  break;
3324  case 2:
3325  col = 48 + inorm[ch-2*192];
3326  row = 24 + jnorm[ch-2*192];
3327  supmod = 5;
3328  break;
3329  case 3:
3330  col = 48 + inorm[ch-3*192];
3331  row = 16 + jnorm[ch-3*192];
3332  supmod = 5;
3333  break;
3334  case 4:
3335  col = 24 + inorm[ch-4*192];
3336  row = 16 + jnorm[ch-4*192];
3337  supmod = 5;
3338  break;
3339  case 5:
3340  col = inorm[ch-5*192];
3341  row = 16 + jnorm[ch-5*192];
3342  supmod = 5;
3343  break;
3344  case 6:
3345  col = 25 - inorm[ch-6*192];
3346  row = 17 - jnorm[ch-6*192];
3347  supmod = 5;
3348  break;
3349  case 7:
3350  col = 49 - inorm[ch-7*192];
3351  row = 17 - jnorm[ch-7*192];
3352  supmod = 5;
3353  break;
3354  case 8:
3355  col = 73 - inorm[ch-8*192];
3356  row = 17 - jnorm[ch-8*192];
3357  supmod = 5;
3358  break;
3359  case 9:
3360  col = 48 + inorm[ch-9*192];
3361  row = jnorm[ch-9*192];
3362  supmod = 5;
3363  break;
3364  case 10:
3365  col = 24 + inorm[ch-10*192];
3366  row = jnorm[ch-10*192];
3367  supmod = 5;
3368  break;
3369  case 11:
3370  col = inorm[ch-11*192];
3371  row = jnorm[ch-11*192];
3372  supmod = 5;
3373  break;
3374  }
3375  break;
3376  }
3377 }
3378 
3379 void StPmdGeom::chain9(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3380 {
3381  Int_t zone = ch/192;
3382  switch(year){
3383  case 6:
3384 
3385  switch(zone)
3386  {
3387  case 0:
3388  col = 48 + inorm[ch];
3389  row = 48 + jnorm[ch];
3390  supmod = 4;
3391  break;
3392  case 1:
3393  col = 73 - inorm[ch-192];
3394  row = 65 - jnorm[ch-192];
3395  supmod = 4;
3396  break;
3397  case 2:
3398  col = 48 + inorm[ch-2*192];
3399  row = 64 + jnorm[ch-2*192];
3400  supmod = 4;
3401  break;
3402  case 3:
3403  col = 25 - inorm[ch-3*192];
3404  row = 25 - jnorm[ch-3*192];
3405  supmod = 6;
3406  break;
3407  case 4:
3408  col = 49 - inorm[ch-4*192];
3409  row = 25 - jnorm[ch-4*192];
3410  supmod = 6;
3411  break;
3412  case 5:
3413  col = 24 + inorm[ch-5*192];
3414  row = 8 + jnorm[ch-5*192];
3415  supmod = 6;
3416  break;
3417  case 6:
3418  col = inorm[ch-6*192];
3419  row = 8 + jnorm[ch-6*192];
3420  supmod = 6;
3421  break;
3422  case 7:
3423  col = 25 - inorm[ch-7*192];
3424  row = 9 - jnorm[ch-7*192];
3425  supmod = 6;
3426  break;
3427  case 8:
3428  col = 49 - inorm[ch-8*192];
3429  row = 9 - jnorm[ch-8*192];
3430  supmod = 6;
3431  break;
3432  }
3433  break;
3434  case 8:
3435 
3436  switch(zone)
3437  {
3438  case 0:
3439  col = 48 + inorm[ch];
3440  row = 48 + jnorm[ch];
3441  supmod = 4;
3442  break;
3443  case 1:
3444  col = 73 - inorm[ch-192];
3445  row = 65 - jnorm[ch-192];
3446  supmod = 4;
3447  break;
3448  case 2:
3449  col = 48 + inorm[ch-2*192];
3450  row = 64 + jnorm[ch-2*192];
3451  supmod = 4;
3452  break;
3453  case 3:
3454  col = 25 - inorm[ch-3*192];
3455  row = 25 - jnorm[ch-3*192];
3456  supmod = 6;
3457  break;
3458  case 4:
3459  col = 49 - inorm[ch-4*192];
3460  row = 25 - jnorm[ch-4*192];
3461  supmod = 6;
3462  break;
3463  case 5:
3464  col = 24 + inorm[ch-5*192];
3465  row = 8 + jnorm[ch-5*192];
3466  supmod = 6;
3467  break;
3468  case 6:
3469  col = inorm[ch-6*192];
3470  row = 8 + jnorm[ch-6*192];
3471  supmod = 6;
3472  break;
3473  case 7:
3474  col = 25 - inorm[ch-7*192];
3475  row = 9 - jnorm[ch-7*192];
3476  supmod = 6;
3477  break;
3478  case 8:
3479  col = 49 - inorm[ch-8*192];
3480  row = 9 - jnorm[ch-8*192];
3481  supmod = 6;
3482  break;
3483  }
3484  break;
3485  case 10:
3486  case 11:
3487  case 12:
3488  switch(zone){
3489  case 0:
3490  col = 48+inorm[ch];
3491  row = 40+jnorm[ch];
3492  supmod = 4;
3493  break;
3494  case 1:
3495  col = 24+inorm[ch-192];
3496  row = 40+jnorm[ch-192];
3497  supmod = 4;
3498  break;
3499  case 2:
3500  col = inorm[ch-2*192];
3501  row = 40+jnorm[ch-2*192];
3502  supmod = 4;
3503  break;
3504  case 3:
3505  col = 25 - inorm[ch-3*192];
3506  row = 41 - jnorm[ch-3*192];
3507  supmod = 4;
3508  break;
3509  case 4:
3510  col = 49 - inorm[ch-4*192];
3511  row = 41 - jnorm[ch-4*192];
3512  supmod = 4;
3513  break;
3514  case 5:
3515  col = 73 - inorm[ch-5*192];
3516  row = 41 - jnorm[ch-5*192];
3517  supmod = 4;
3518  break;
3519  case 6:
3520  col = 48+inorm[ch-6*192];
3521  row = 24+jnorm[ch-6*192];
3522  supmod = 4;
3523  break;
3524  case 7:
3525  col = 24+inorm[ch-7*192];
3526  row = 24+jnorm[ch-7*192];
3527  supmod = 4;
3528  break;
3529  case 8:
3530  col = inorm[ch-8*192];
3531  row = 24+jnorm[ch-8*192];
3532  supmod = 4;
3533  break;
3534  }
3535  break;
3536  }
3537 }
3538 
3539 void StPmdGeom::chain10(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3540 {
3541  Int_t zone = ch/192;
3542  switch(year){
3543  case 6:
3544 
3545  switch(zone)
3546  {
3547  case 0:
3548  col = 48 + inorm[ch];
3549  row = 24 + jnorm[ch];
3550  supmod = 5;
3551  break;
3552  case 1:
3553  col = 24 + inorm[ch-192];
3554  row = 24 + jnorm[ch-192];
3555  supmod = 5;
3556  break;
3557  case 2:
3558  col = inorm[ch-2*192];
3559  row = 24 + jnorm[ch-2*192];
3560  supmod = 5;
3561  break;
3562  case 3:
3563  col = 25 - inorm[ch-3*192];
3564  row = 41 - jnorm[ch-3*192];
3565  supmod = 5;
3566  break;
3567  case 4:
3568  col = 49 - inorm[ch-4*192];
3569  row = 41 - jnorm[ch-4*192];
3570  supmod = 5;
3571  break;
3572  case 5:
3573  col = 73 - inorm[ch-5*192];
3574  row = 41 - jnorm[ch-5*192];
3575  supmod = 5;
3576  break;
3577  case 6:
3578  col = 48 + inorm[ch-6*192];
3579  row = 40 + jnorm[ch-6*192];
3580  supmod = 5;
3581  break;
3582  case 7:
3583  col = 24 + inorm[ch-7*192];
3584  row = 40 + jnorm[ch-7*192];
3585  supmod = 5;
3586  break;
3587  case 8:
3588  col = inorm[ch-8*192];
3589  row = 40 + jnorm[ch-8*192];
3590  supmod = 5;
3591  break;
3592  }
3593  break;
3594  case 8:
3595 
3596  switch(zone)
3597  {
3598  case 0:
3599  col = 48 + inorm[ch];
3600  row = 24 + jnorm[ch];
3601  supmod = 5;
3602  break;
3603  case 1:
3604  col = 24 + inorm[ch-192];
3605  row = 24 + jnorm[ch-192];
3606  supmod = 5;
3607  break;
3608  case 2:
3609  col = inorm[ch-2*192];
3610  row = 24 + jnorm[ch-2*192];
3611  supmod = 5;
3612  break;
3613  case 3:
3614  col = 25 - inorm[ch-3*192];
3615  row = 41 - jnorm[ch-3*192];
3616  supmod = 5;
3617  break;
3618  case 4:
3619  col = 49 - inorm[ch-4*192];
3620  row = 41 - jnorm[ch-4*192];
3621  supmod = 5;
3622  break;
3623  case 5:
3624  col = 73 - inorm[ch-5*192];
3625  row = 41 - jnorm[ch-5*192];
3626  supmod = 5;
3627  break;
3628  case 6:
3629  col = 48 + inorm[ch-6*192];
3630  row = 40 + jnorm[ch-6*192];
3631  supmod = 5;
3632  break;
3633  case 7:
3634  col = 24 + inorm[ch-7*192];
3635  row = 40 + jnorm[ch-7*192];
3636  supmod = 5;
3637  break;
3638  case 8:
3639  col = inorm[ch-8*192];
3640  row = 40 + jnorm[ch-8*192];
3641  supmod = 5;
3642  break;
3643  }
3644  break;
3645  case 10:
3646  case 11:
3647  case 12:
3648  switch(zone)
3649  {
3650  case 0:
3651  col = 24 + inorm[ch];
3652  row = 24 + jnorm[ch];
3653  supmod = 5;
3654  break;
3655  case 1:
3656  col = inorm[ch-192];
3657  row = 24 + jnorm[ch-192];
3658  supmod = 5;
3659  break;
3660  case 2:
3661  col = 25 - inorm[ch-2*192];
3662  row = 41 - jnorm[ch-2*192];
3663  supmod = 5;
3664  break;
3665  case 3:
3666  col = 49 - inorm[ch-3*192];
3667  row = 41 - jnorm[ch-3*192];
3668  supmod = 5;
3669  break;
3670  case 4:
3671  col = 24 + inorm[ch-4*192];
3672  row = 40 + jnorm[ch-4*192];
3673  supmod = 5;
3674  break;
3675  case 5:
3676  col = inorm[ch-5*192];
3677  row = 40 + jnorm[ch-5*192];
3678  supmod = 5;
3679  break;
3680  case 6:
3681  col = 25 - inorm[ch-6*192];
3682  row = 9 - jnorm[ch-6*192];
3683  supmod = 6;
3684  break;
3685  case 7:
3686  col = inorm[ch-7*192];
3687  row = 8 + jnorm[ch-7*192];
3688  supmod = 6;
3689  break;
3690  case 8:
3691  col = 25 - inorm[ch-8*192];
3692  row = 25 - jnorm[ch-8*192];
3693  supmod = 6;
3694  break;
3695  }
3696  break;
3697  }
3698 }
3699 void StPmdGeom::chain11(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3700 {
3701  Int_t zone = ch/192;
3702  switch(year){
3703  case 6:
3704 
3705  switch(zone)
3706  {
3707  case 0:
3708  col = 24 + inorm[ch];
3709  row = 48 + jnorm[ch];
3710  supmod = 4;
3711  break;
3712  case 1:
3713  col = 49 - inorm[ch-192];
3714  row = 65 - jnorm[ch-192];
3715  supmod = 4;
3716  break;
3717  case 2:
3718  col = 24 + inorm[ch-2*192];
3719  row = 64 + jnorm[ch-2*192];
3720  supmod = 4;
3721  break;
3722  case 3:
3723  col = 25 - inorm[ch-3*192];
3724  row = 49 - jnorm[ch-3*192];
3725  supmod = 6;
3726  break;
3727  case 4:
3728  col = 49 - inorm[ch-4*192];
3729  row = 49 - jnorm[ch-4*192];
3730  supmod = 6;
3731  break;
3732  case 5:
3733  col = 24 + inorm[ch-5*192];
3734  row = 32 + jnorm[ch-5*192];
3735  supmod = 6;
3736  break;
3737  case 6:
3738  col = inorm[ch-6*192];
3739  row = 32 + jnorm[ch-6*192];
3740  supmod = 6;
3741  break;
3742  case 7:
3743  col = 25 - inorm[ch-7*192];
3744  row = 33 - jnorm[ch-7*192];
3745  supmod = 6;
3746  break;
3747  case 8:
3748  col = 49 - inorm[ch-8*192];
3749  row = 33 - jnorm[ch-8*192];
3750  supmod = 6;
3751  break;
3752  }
3753  break;
3754  case 8:
3755 
3756  switch(zone)
3757  {
3758  case 0:
3759  col = 24 + inorm[ch];
3760  row = 48 + jnorm[ch];
3761  supmod = 4;
3762  break;
3763  case 1:
3764  col = 49 - inorm[ch-192];
3765  row = 65 - jnorm[ch-192];
3766  supmod = 4;
3767  break;
3768  case 2:
3769  col = 24 + inorm[ch-2*192];
3770  row = 64 + jnorm[ch-2*192];
3771  supmod = 4;
3772  break;
3773  case 3:
3774  col = 25 - inorm[ch-3*192];
3775  row = 49 - jnorm[ch-3*192];
3776  supmod = 6;
3777  break;
3778  case 4:
3779  col = 49 - inorm[ch-4*192];
3780  row = 49 - jnorm[ch-4*192];
3781  supmod = 6;
3782  break;
3783  case 5:
3784  col = 24 + inorm[ch-5*192];
3785  row = 32 + jnorm[ch-5*192];
3786  supmod = 6;
3787  break;
3788  case 6:
3789  col = inorm[ch-6*192];
3790  row = 32 + jnorm[ch-6*192];
3791  supmod = 6;
3792  break;
3793  case 7:
3794  col = 25 - inorm[ch-7*192];
3795  row = 33 - jnorm[ch-7*192];
3796  supmod = 6;
3797  break;
3798  case 8:
3799  col = 49 - inorm[ch-8*192];
3800  row = 33 - jnorm[ch-8*192];
3801  supmod = 6;
3802  break;
3803  }
3804  break;
3805  case 10:
3806  case 11:
3807  case 12:
3808  switch(zone)
3809  {
3810  case 0:
3811  col = 48 + inorm[ch];
3812  row = 48 + jnorm[ch];
3813  supmod = 4;
3814  break;
3815  case 1:
3816  col = 24 + inorm[ch-192];
3817  row = 48 + jnorm[ch-192];
3818  supmod = 4;
3819  break;
3820  case 2:
3821  col = 49 - inorm[ch-2*192];
3822  row = 65 - jnorm[ch-2*192];
3823  supmod = 4;
3824  break;
3825  case 3:
3826  col = 73 - inorm[ch-3*192];
3827  row = 65 - jnorm[ch-3*192];
3828  supmod = 4;
3829  break;
3830  case 4:
3831  col = 48 + inorm[ch-4*192];
3832  row = 64 + jnorm[ch-4*192];
3833  supmod = 4;
3834  break;
3835  case 5:
3836  col = 24 + inorm[ch-5*192];
3837  row = 64 + jnorm[ch-5*192];
3838  supmod = 4;
3839  break;
3840  case 6:
3841  col = 25 - inorm[ch-6*192];
3842  row = 49 - jnorm[ch-6*192];
3843  supmod = 6;
3844  break;
3845  case 7:
3846  col = inorm[ch-7*192];
3847  row = 32 + jnorm[ch-7*192];
3848  supmod = 6;
3849  break;
3850  case 8:
3851  col = 25 - inorm[ch-8*192];
3852  row = 33 - jnorm[ch-8*192];
3853  supmod = 6;
3854  break;
3855  }
3856  break;
3857  }
3858 }
3859 
3860 void StPmdGeom::chain12(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
3861 {
3862  Int_t zone = ch/192;
3863  switch(year){
3864  case 6:
3865 
3866  switch(zone)
3867  {
3868  case 0:
3869  col = 25 - inorm[ch];
3870  row = 25 - jnorm[ch];
3871  supmod = 7;
3872  break;
3873  case 1:
3874  col = 49 - inorm[ch-192];
3875  row = 25 - jnorm[ch-192];
3876  supmod = 7;
3877  break;
3878  case 2:
3879  col = 24 + inorm[ch-2*192];
3880  row = 8 + jnorm[ch-2*192];
3881  supmod = 7;
3882  break;
3883  case 3:
3884  col = inorm[ch-3*192];
3885  row = 8 + jnorm[ch-3*192];
3886  supmod = 7;
3887  break;
3888  case 4:
3889  col = 25 - inorm[ch-4*192];
3890  row = 9 - jnorm[ch-4*192];
3891  supmod = 7;
3892  break;
3893  case 5:
3894  col = 49 - inorm[ch-5*192];
3895  row = 9 - jnorm[ch-5*192];
3896  supmod = 7;
3897  break;
3898  }
3899  break;
3900  case 8:
3901 
3902  switch(zone)
3903  {
3904  case 0:
3905  col = 25 - inorm[ch];
3906  row = 25 - jnorm[ch];
3907  supmod = 7;
3908  break;
3909  case 1:
3910  col = 49 - inorm[ch-192];
3911  row = 25 - jnorm[ch-192];
3912  supmod = 7;
3913  break;
3914  case 2:
3915  col = 24 + inorm[ch-2*192];
3916  row = 8 + jnorm[ch-2*192];
3917  supmod = 7;
3918  break;
3919  case 3:
3920  col = inorm[ch-3*192];
3921  row = 8 + jnorm[ch-3*192];
3922  supmod = 7;
3923  break;
3924  case 4:
3925  col = 25 - inorm[ch-4*192];
3926  row = 9 - jnorm[ch-4*192];
3927  supmod = 7;
3928  break;
3929  case 5:
3930  col = 49 - inorm[ch-5*192];
3931  row = 9 - jnorm[ch-5*192];
3932  supmod = 7;
3933  break;
3934  }
3935  break;
3936  case 10:
3937  case 11:
3938  case 12:
3939  switch(zone)
3940  {
3941  case 0:
3942  col = 25 - inorm[ch];
3943  row = 49 - jnorm[ch];
3944  supmod = 7;
3945  break;
3946  case 1:
3947  col = 49 - inorm[ch-192];
3948  row = 49 - jnorm[ch-192];
3949  supmod = 7;
3950  break;
3951  case 2:
3952  col = 24 + inorm[ch-2*192];
3953  row = 32 + jnorm[ch-2*192];
3954  supmod = 7;
3955  break;
3956  case 3:
3957  col = inorm[ch-3*192];
3958  row = 32 + jnorm[ch-3*192];
3959  supmod = 7;
3960  break;
3961  case 4:
3962  col = 25 - inorm[ch-4*192];
3963  row = 33 - jnorm[ch-4*192];
3964  supmod = 7;
3965  break;
3966  case 5:
3967  col = 49 - inorm[ch-5*192];
3968  row = 33 - jnorm[ch-5*192];
3969  supmod = 7;
3970  break;
3971  case 6:
3972  col = 25 - inorm[ch-6*192];
3973  row = 25 - jnorm[ch-6*192];
3974  supmod = 7;
3975  break;
3976  case 7:
3977  col = 49 - inorm[ch-7*192];
3978  row = 25 - jnorm[ch-7*192];
3979  supmod = 7;
3980  break;
3981  case 8:
3982  col = 24 + inorm[ch-8*192];
3983  row = 8 + jnorm[ch-8*192];
3984  supmod = 7;
3985  break;
3986  case 9:
3987  col = inorm[ch-9*192];
3988  row = 8 + jnorm[ch-9*192];
3989  supmod = 7;
3990  break;
3991  case 10:
3992  col = 25 -inorm[ch-10*192];
3993  row = 9 - jnorm[ch-10*192];
3994  supmod = 7;
3995  break;
3996  case 11:
3997  col = 49 -inorm[ch-11*192];
3998  row = 9 - jnorm[ch-11*192];
3999  supmod = 7;
4000  break;
4001  }
4002  break;
4003  }
4004 }
4005 
4006 void StPmdGeom::chain13(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4007 {
4008  Int_t zone = ch/192;
4009  switch(year){
4010  case 6:
4011 
4012  switch(zone)
4013  {
4014  case 0:
4015  col = 73 - inorm[ch];
4016  row = 9 - jnorm[ch];
4017  supmod = 6;
4018  break;
4019  case 1:
4020  col = 48 + inorm[ch-192];
4021  row = 8 + jnorm[ch-192];
4022  supmod = 6;
4023  break;
4024  case 2:
4025  col = 73 - inorm[ch-2*192];
4026  row = 25 - jnorm[ch-2*192];
4027  supmod = 6;
4028  break;
4029  case 3:
4030  col = 25 - inorm[ch-3*192];
4031  row = 49 - jnorm[ch-3*192];
4032  supmod = 7;
4033  break;
4034  case 4:
4035  col = 49 - inorm[ch-4*192];
4036  row = 49 - jnorm[ch-4*192];
4037  supmod = 7;
4038  break;
4039  case 5:
4040  col = 24 + inorm[ch-5*192];
4041  row = 32 + jnorm[ch-5*192];
4042  supmod = 7;
4043  break;
4044  case 6:
4045  col = inorm[ch-6*192];
4046  row = 32 + jnorm[ch-6*192];
4047  supmod = 7;
4048  break;
4049  case 7:
4050  col = 25 - inorm[ch-7*192];
4051  row = 33 - jnorm[ch-7*192];
4052  supmod = 7;
4053  break;
4054  case 8:
4055  col = 49 - inorm[ch-8*192];
4056  row = 33 - jnorm[ch-8*192];
4057  supmod = 7;
4058  break;
4059  }
4060  break;
4061  case 8:
4062 
4063  switch(zone)
4064  {
4065  case 0:
4066  col = 73 - inorm[ch];
4067  row = 9 - jnorm[ch];
4068  supmod = 6;
4069  break;
4070  case 1:
4071  col = 48 + inorm[ch-192];
4072  row = 8 + jnorm[ch-192];
4073  supmod = 6;
4074  break;
4075  case 2:
4076  col = 73 - inorm[ch-2*192];
4077  row = 25 - jnorm[ch-2*192];
4078  supmod = 6;
4079  break;
4080  case 3:
4081  col = 25 - inorm[ch-3*192];
4082  row = 49 - jnorm[ch-3*192];
4083  supmod = 7;
4084  break;
4085  case 4:
4086  col = 49 - inorm[ch-4*192];
4087  row = 49 - jnorm[ch-4*192];
4088  supmod = 7;
4089  break;
4090  case 5:
4091  col = 24 + inorm[ch-5*192];
4092  row = 32 + jnorm[ch-5*192];
4093  supmod = 7;
4094  break;
4095  case 6:
4096  col = inorm[ch-6*192];
4097  row = 32 + jnorm[ch-6*192];
4098  supmod = 7;
4099  break;
4100  case 7:
4101  col = 25 - inorm[ch-7*192];
4102  row = 33 - jnorm[ch-7*192];
4103  supmod = 7;
4104  break;
4105  case 8:
4106  col = 49 - inorm[ch-8*192];
4107  row = 33 - jnorm[ch-8*192];
4108  supmod = 7;
4109  break;
4110  }
4111  break;
4112  case 10:
4113  case 11:
4114  case 12:
4115  switch(zone)
4116  {
4117  case 0:
4118  col = 49 - inorm[ch];
4119  row = 49 - jnorm[ch];
4120  supmod = 6;
4121  break;
4122  case 1:
4123  col = 24 + inorm[ch-192];
4124  row = 32 + jnorm[ch-192];
4125  supmod = 6;
4126  break;
4127  case 2:
4128  col = 49 - inorm[ch-2*192];
4129  row = 33 - jnorm[ch-2*192];
4130  supmod = 6;
4131  break;
4132  case 3:
4133  col = 49 - inorm[ch-3*192];
4134  row = 25 - jnorm[ch-3*192];
4135  supmod = 6;
4136  break;
4137  case 4:
4138  col = 73 - inorm[ch-4*192];
4139  row = 25 - jnorm[ch-4*192];
4140  supmod = 6;
4141  break;
4142  case 5:
4143  col = 48 + inorm[ch-5*192];
4144  row = 8 + jnorm[ch-5*192];
4145  supmod = 6;
4146  break;
4147  case 6:
4148  col = 24 + inorm[ch-6*192];
4149  row = 8 + jnorm[ch-6*192];
4150  supmod = 6;
4151  break;
4152  case 7:
4153  col = 49 - inorm[ch-7*192];
4154  row = 9 - jnorm[ch-7*192];
4155  supmod = 6;
4156  break;
4157  case 8:
4158  col = 73 - inorm[ch-8*192];
4159  row = 9 - jnorm[ch-8*192];
4160  supmod = 6;
4161  break;
4162  }
4163  break;
4164  }
4165 }
4166 
4167 void StPmdGeom::chain14(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4168 {
4169  Int_t zone = ch/192;
4170  switch(year){
4171  case 6:
4172  supmod = 0;
4173  col = 0;
4174  row = 0;
4175  break;
4176  case 8:
4177  case 10:
4178  case 11:
4179  case 12:
4180  switch(zone)
4181  {
4182  case 0:
4183  col = 40 + imirr[ch];
4184  row = 73 - jmirr[ch];
4185  supmod = 8;
4186  break;
4187  case 1:
4188  col= 40 + imirr[ch-192];
4189  row= 49 - jmirr[ch-192];
4190  supmod = 8;
4191  break;
4192  case 2:
4193  col= 40 + imirr[ch-2*192];
4194  row= 25 - jmirr[ch-2*192];
4195  supmod = 8;
4196  break;
4197  case 3:
4198  col = 41 - imirr[ch-3*192];
4199  row = jmirr[ch-3*192];
4200  supmod = 8;
4201  break;
4202  case 4:
4203  col = 41 - imirr[ch-4*192];
4204  row = 24 + jmirr[ch-4*192];
4205  supmod = 8;
4206  break;
4207  case 5:
4208  col = 41 - imirr[ch-5*192];
4209  row = 48 + jmirr[ch-5*192];
4210  supmod = 8;
4211  break;
4212  case 6:
4213  col= 24 + imirr[ch-6*192];
4214  row= 73 - jmirr[ch-6*192];
4215  supmod = 8;
4216  break;
4217  case 7:
4218  col= 24 + imirr[ch-7*192];
4219  row= 49 - jmirr[ch-7*192];
4220  supmod = 8;
4221  break;
4222  case 8:
4223  col= 24 + imirr[ch-8*192];
4224  row= 25 - jmirr[ch-8*192];
4225  supmod = 8;
4226  break;
4227  }
4228  break;
4229  }
4230 }
4231 
4232 void StPmdGeom::chain15(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4233 {
4234  Int_t zone = ch/192;
4235  switch(year){
4236  case 6:
4237 
4238  switch(zone)
4239  {
4240  case 0:
4241  col = 40 + imirr[ch];
4242  row = jmirr[ch];
4243  supmod = 9;
4244  break;
4245  case 1:
4246  col = 40 + imirr[ch-192];
4247  row = 24 + jmirr[ch-192];
4248  supmod = 9;
4249  break;
4250  case 2:
4251  col = 41 - imirr[ch-2*192];
4252  row = 49 - jmirr[ch-2*192];
4253  supmod = 9;
4254  break;
4255  case 3:
4256  col = 41 - imirr[ch-3*192];
4257  row = 25 - jmirr[ch-3*192];
4258  supmod = 9;
4259  break;
4260  case 4:
4261  col = 24 + imirr[ch-4*192];
4262  row = jmirr[ch-4*192];
4263  supmod = 9;
4264  break;
4265  case 5:
4266  col = 24 + imirr[ch-5*192];
4267  row = 24 + jmirr[ch-5*192];
4268  supmod = 9;
4269  break;
4270  }
4271  break;
4272  case 8:
4273  case 10:
4274  case 11:
4275  case 12:
4276  switch(zone)
4277  {
4278  case 0:
4279  col = 40 + imirr[ch];
4280  row = jmirr[ch];
4281  supmod = 9;
4282  break;
4283  case 1:
4284  col = 40 + imirr[ch-192];
4285  row = 24 + jmirr[ch-192];
4286  supmod = 9;
4287  break;
4288  case 2:
4289  col = 41 - imirr[ch-2*192];
4290  row = 49 - jmirr[ch-2*192];
4291  supmod = 9;
4292  break;
4293  case 3:
4294  col = 41 - imirr[ch-3*192];
4295  row = 25 - jmirr[ch-3*192];
4296  supmod = 9;
4297  break;
4298  case 4:
4299  col = 24 + imirr[ch-4*192];
4300  row = jmirr[ch-4*192];
4301  supmod = 9;
4302  break;
4303  case 5:
4304  col = 24 + imirr[ch-5*192];
4305  row = 24 + jmirr[ch-5*192];
4306  supmod = 9;
4307  break;
4308  case 6:
4309  col = imirr[ch-6*192];
4310  row = jmirr[ch-6*192];
4311  supmod = 9;
4312  break;
4313  case 7:
4314  col = 8 + imirr[ch-7*192];
4315  row = 25 - jmirr[ch-7*192];
4316  supmod = 9;
4317  break;
4318  case 8:
4319  col = 16 + imirr[ch-8*192];
4320  row = jmirr[ch-8*192];
4321  supmod = 9;
4322  break;
4323  }
4324  break;
4325  }
4326 }
4327 
4328 void StPmdGeom::chain16(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4329 {
4330  Int_t zone = ch/192;
4331  switch(year){
4332  case 6:
4333 
4334  switch(zone)
4335  {
4336  case 0:
4337  col = 16 + imirr[ch];
4338  row = jmirr[ch];
4339  supmod = 9;
4340  break;
4341  case 1:
4342  col = 16 + imirr[ch-192];
4343  row = 24 + jmirr[ch-192];
4344  supmod = 9;
4345  break;
4346  case 2:
4347  col = 17 - imirr[ch-2*192];
4348  row = 49 - jmirr[ch-2*192];
4349  supmod = 9;
4350  break;
4351  case 3:
4352  col = 17 - imirr[ch-3*192];
4353  row = 25 - jmirr[ch-3*192];
4354  supmod = 9;
4355  break;
4356  case 4:
4357  col = imirr[ch-4*192];
4358  row = jmirr[ch-4*192];
4359  supmod = 9;
4360  break;
4361  case 5:
4362  col = imirr[ch-5*192];
4363  row = 24 + jmirr[ch-5*192];
4364  supmod = 9;
4365  break;
4366  }
4367  break;
4368  case 8:
4369  case 10:
4370  case 11:
4371  case 12:
4372  switch(zone)
4373  {
4374  case 0:
4375  col = 9 - imirr[ch];
4376  row = jmirr[ch];
4377  supmod = 8;
4378  break;
4379  case 1:
4380  col = 8 + imirr[ch-192];
4381  row = 25 - jmirr[ch-192];
4382  supmod = 8;
4383  break;
4384  case 2:
4385  col = 25 - imirr[ch-2*192];
4386  row = jmirr[ch-2*192];
4387  supmod = 8;
4388  break;
4389  case 3:
4390  col = 17 - imirr[ch-3*192];
4391  row = 24 + jmirr[ch-3*192];
4392  supmod = 8;
4393  break;
4394  case 4:
4395  col = 17 - imirr[ch-4*192];
4396  row = 48 + jmirr[ch-4*192];
4397  supmod = 8;
4398  break;
4399  case 5:
4400  col = 16 + imirr[ch-5*192];
4401  row = 73 - jmirr[ch-5*192];
4402  supmod = 8;
4403  break;
4404  case 6:
4405  col = 16 + imirr[ch-6*192];
4406  row = 49 - jmirr[ch-6*192];
4407  supmod = 8;
4408  break;
4409  case 7:
4410  col = imirr[ch-7*192];
4411  row = 73 - jmirr[ch-7*192];
4412  supmod = 8;
4413  break;
4414  case 8:
4415  col = imirr[ch-8*192];
4416  row = 49 - jmirr[ch-8*192];
4417  supmod = 8;
4418  break;
4419  }
4420  break;
4421  }
4422 }
4423 
4424 void StPmdGeom::chain17(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4425 {
4426  Int_t zone = ch/192;
4427  switch(year){
4428  case 6:
4429 
4430  switch(zone)
4431  {
4432  case 0:
4433  col = 48 + inorm[ch];
4434  row = 24 + jnorm[ch];
4435  supmod = 11;
4436  break;
4437  case 1:
4438  col = 24 + inorm[ch-192];
4439  row = 24 + jnorm[ch-192];
4440  supmod = 11;
4441  break;
4442  case 2:
4443  col = inorm[ch-2*192];
4444  row = 24 + jnorm[ch-2*192];
4445  supmod = 11;
4446  break;
4447  case 3:
4448  col = 25 - inorm[ch-3*192];
4449  row = 41 - jnorm[ch-3*192];
4450  supmod = 11;
4451  break;
4452  case 4:
4453  col = 49 - inorm[ch-4*192];
4454  row = 41 - jnorm[ch-4*192];
4455  supmod = 11;
4456  break;
4457  case 5:
4458  col = 73 - inorm[ch-5*192];
4459  row = 41 - jnorm[ch-5*192];
4460  supmod = 11;
4461  break;
4462  case 6:
4463  col = 48 + inorm[ch-6*192];
4464  row = 40 + jnorm[ch-6*192];
4465  supmod = 11;
4466  break;
4467  case 7:
4468  col = 24 + inorm[ch-7*192];
4469  row = 40 + jnorm[ch-7*192];
4470  supmod = 11;
4471  break;
4472  case 8:
4473  col = inorm[ch-8*192];
4474  row = 40 + jnorm[ch-8*192];
4475  supmod = 11;
4476  break;
4477  }
4478  break;
4479  case 8:
4480  supmod = 0;
4481  col = 0;
4482  row = 0;
4483  break;
4484  case 10:
4485  case 11:
4486  case 12:
4487  switch(zone)
4488  {
4489  case 0:
4490  col = 25 - inorm[ch];
4491  row = 33 - jnorm[ch];
4492  supmod = 11;
4493  break;
4494  case 1:
4495  col = 49 - inorm[ch-192];
4496  row = 33 - jnorm[ch-192];
4497  supmod = 11;
4498  break;
4499  case 2:
4500  col = 73 - inorm[ch-2*192];
4501  row = 33 - jnorm[ch-2*192];
4502  supmod = 11;
4503  break;
4504  case 3:
4505  col = 48 + inorm[ch-3*192];
4506  row = 32 + jnorm[ch-3*192];
4507  supmod = 11;
4508  break;
4509  case 4:
4510  col = 24 + inorm[ch-4*192];
4511  row = 32 + jnorm[ch-4*192];
4512  supmod = 11;
4513  break;
4514  case 5:
4515  col = inorm[ch-5*192];
4516  row = 32 + jnorm[ch-5*192];
4517  supmod = 11;
4518  break;
4519  case 6:
4520  col = 25 - inorm[ch-6*192];
4521  row = 49 - jnorm[ch-6*192];
4522  supmod = 11;
4523  break;
4524  case 7:
4525  col = 49 - inorm[ch-7*192];
4526  row = 49 - jnorm[ch-7*192];
4527  supmod = 11;
4528  break;
4529  case 8:
4530  col = 73 - inorm[ch-8*192];
4531  row = 49 - jnorm[ch-8*192];
4532  supmod = 11;
4533  break;
4534  }
4535  break;
4536  }
4537 }
4538 
4539 void StPmdGeom::chain18(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4540 {
4541  Int_t zone = ch/192;
4542 
4543  switch(year){
4544  case 6:
4545 
4546  supmod = 0;
4547  col = 0;
4548  row = 0;
4549  break;
4550  case 8:
4551  case 10:
4552  case 11:
4553  case 12:
4554  switch(zone)
4555  {
4556  case 0:
4557  col = 64 + imirr[ch];
4558  row = 48 + jmirr[ch];
4559  supmod = 10;
4560  break;
4561  case 1:
4562  col = 65 - imirr[ch-192];
4563  row = 73 - jmirr[ch-192];
4564  supmod = 10;
4565  break;
4566  case 2:
4567  col = 48 + imirr[ch-2*192];
4568  row = 48 + jmirr[ch-2*192];
4569  supmod = 10;
4570  break;
4571  case 3:
4572  col = 40 + imirr[ch-3*192];
4573  row = 24 + jmirr[ch-3*192];
4574  supmod = 10;
4575  break;
4576  case 4:
4577  col = 40 + imirr[ch-4*192];
4578  row = 48 + jmirr[ch-4*192];
4579  supmod = 10;
4580  break;
4581  case 5:
4582  col = 41 - imirr[ch-5*192];
4583  row = 73 - jmirr[ch-5*192];
4584  supmod = 10;
4585  break;
4586  case 6:
4587  col = 41 - imirr[ch-6*192];
4588  row = 49 - jmirr[ch-6*192];
4589  supmod = 10;
4590  break;
4591  case 7:
4592  col = 24 + imirr[ch-7*192];
4593  row = 24 + jmirr[ch-7*192];
4594  supmod = 10;
4595  break;
4596  case 8:
4597  col = 24 + imirr[ch-8*192];
4598  row = 48 + jmirr[ch-8*192];
4599  supmod = 10;
4600  break;
4601  }
4602  break;
4603  }
4604 }
4605 
4606 void StPmdGeom::chain19(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4607 {
4608  Int_t zone = ch/192;
4609  switch(year){
4610  case 6:
4611  switch(zone)
4612  {
4613  case 0:
4614  col = 48 + inorm[ch];
4615  row = jnorm[ch];
4616  supmod = 11;
4617  break;
4618  case 1:
4619  col = 24 + inorm[ch-192];
4620  row = jnorm[ch-192];
4621  supmod = 11;
4622  break;
4623  case 2:
4624  col = inorm[ch-2*192];
4625  row = jnorm[ch-2*192];
4626  supmod = 11;
4627  break;
4628  case 3:
4629  col = 25 - inorm[ch-3*192];
4630  row = 17 - jnorm[ch-3*192];
4631  supmod = 11;
4632  break;
4633  case 4:
4634  col = 49 - inorm[ch-4*192];
4635  row = 17 - jnorm[ch-4*192];
4636  supmod = 11;
4637  break;
4638  case 5:
4639  col = 73 - inorm[ch-5*192];
4640  row = 17 - jnorm[ch-5*192];
4641  supmod = 11;
4642  break;
4643  case 6:
4644  col = 48 + inorm[ch-6*192];
4645  row = 16 + jnorm[ch-6*192];
4646  supmod = 11;
4647  break;
4648  case 7:
4649  col = 24 + inorm[ch-7*192];
4650  row = 16 + jnorm[ch-7*192];
4651  supmod = 11;
4652  break;
4653  case 8:
4654  col = inorm[ch-8*192];
4655  row = 16 + jnorm[ch-8*192];
4656  supmod = 11;
4657  break;
4658  }
4659  break;
4660  case 8:
4661 
4662  switch(zone)
4663  {
4664  case 0:
4665  col = 24 + inorm[ch];
4666  row = jnorm[ch];
4667  supmod = 11;
4668  break;
4669  case 1:
4670  col = inorm[ch-192];
4671  row = jnorm[ch-192];
4672  supmod = 11;
4673  break;
4674  case 2:
4675  col = 25 - inorm[ch-2*192];
4676  row = 17 - jnorm[ch-2*192];
4677  supmod = 11;
4678  break;
4679  case 3:
4680  col = 49 - inorm[ch-3*192];
4681  row = 17 - jnorm[ch-3*192];
4682  supmod = 11;
4683  break;
4684  case 4:
4685  col = 24 + inorm[ch-4*192];
4686  row = 16 + jnorm[ch-4*192];
4687  supmod = 11;
4688  break;
4689  case 5:
4690  col = inorm[ch-5*192];
4691  row = 16 + jnorm[ch-5*192];
4692  supmod = 11;
4693  break;
4694  case 6:
4695  col = 24 + inorm[ch-6*192];
4696  row = 24 + jnorm[ch-6*192];
4697  supmod = 11;
4698  break;
4699  case 7:
4700  col = inorm[ch-7*192];
4701  row = 24 + jnorm[ch-7*192];
4702  supmod = 11;
4703  break;
4704  case 8:
4705  col= 25 - inorm[ch-8*192];
4706  row= 41 - jnorm[ch-8*192];
4707  supmod = 11;
4708  break;
4709  case 9:
4710  col= 49 - inorm[ch-9*192];
4711  row= 41 - jnorm[ch-9*192];
4712  supmod = 11;
4713  break;
4714  case 10:
4715  col = 24 + inorm[ch-10*192];
4716  row = 40 + jnorm[ch-10*192];
4717  supmod = 11;
4718  break;
4719  case 11:
4720  col = inorm[ch-11*192];
4721  row = 40 + jnorm[ch-11*192];
4722  supmod = 11;
4723  break;
4724  }
4725  break;
4726  case 10:
4727  case 11:
4728  case 12:
4729  switch(zone)
4730  {
4731  case 0:
4732  col = 25 -inorm[ch];
4733  row = 9 - jnorm[ch];
4734  supmod = 11;
4735  break;
4736  case 1:
4737  col = 49 -inorm[ch-192];
4738  row = 9 - jnorm[ch-192];
4739  supmod = 11;
4740  break;
4741  case 2:
4742  col = 73 -inorm[ch-2*192];
4743  row = 9 - jnorm[ch-2*192];
4744  supmod = 11;
4745  break;
4746  case 3:
4747  col = 48 + inorm[ch-3*192];
4748  row = 8+ jnorm[ch-3*192];
4749  supmod = 11;
4750  break;
4751  case 4:
4752  col = 24 + inorm[ch-4*192];
4753  row = 8+ jnorm[ch-4*192];
4754  supmod = 11;
4755  break;
4756  case 5:
4757  col = inorm[ch-5*192];
4758  row = 8+ jnorm[ch-5*192];
4759  supmod = 11;
4760  break;
4761  case 6:
4762  col = 25 - inorm[ch-6*192];
4763  row = 25 - jnorm[ch-6*192];
4764  supmod = 11;
4765  break;
4766  case 7:
4767  col = 49 - inorm[ch-7*192];
4768  row = 25 - jnorm[ch-7*192];
4769  supmod = 11;
4770  break;
4771  case 8:
4772  col = 73 - inorm[ch-8*192];
4773  row = 25 - jnorm[ch-8*192];
4774  supmod = 11;
4775  break;
4776  }
4777  break;
4778  }
4779 }
4780 
4781 void StPmdGeom::chain20(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4782 {
4783 
4784  Int_t zone = ch/192;
4785  switch(year){
4786  case 6:
4787 
4788  supmod = 0;
4789  col = 0;
4790  row = 0;
4791  break;
4792  case 8:
4793 
4794  switch(zone)
4795  {
4796  case 0:
4797  col = 48 + inorm[ch];
4798  row = jnorm[ch];
4799  supmod = 11;
4800  break;
4801  case 1:
4802  col = 73 - inorm[ch-192];
4803  row = 17 - jnorm[ch-192];
4804  supmod = 11;
4805  break;
4806  case 2:
4807  col = 48 + inorm[ch-2*192];
4808  row = 16 + jnorm[ch-2*192];
4809  supmod = 11;
4810  break;
4811  case 3:
4812  col = 48 + inorm[ch-3*192];
4813  row = 24 + jnorm[ch-3*192];
4814  supmod = 11;
4815  break;
4816  case 4:
4817  col = 73 - inorm[ch-4*192];
4818  row = 41 - jnorm[ch-4*192];
4819  supmod = 11;
4820  break;
4821  case 5:
4822  col = 48 + inorm[ch-5*192];
4823  row = 40 - jnorm[ch-5*192];
4824  supmod = 11;
4825  break;
4826  case 6:
4827  col = 64 + imirr[ch-6*192];
4828  row = jmirr[ch-6*192];
4829  supmod = 10;
4830  break;
4831  case 7:
4832  col = 64 + imirr[ch-7*192];
4833  row = 24 + jmirr[ch-7*192];
4834  supmod = 10;
4835  break;
4836  case 8:
4837  col = 65 - imirr[ch-8*192];
4838  row = 49 - jmirr[ch-8*192];
4839  supmod = 10;
4840  break;
4841  case 9:
4842  col = 65 - imirr[ch-9*192];
4843  row = 25 - jmirr[ch-9*192];
4844  supmod = 10;
4845  break;
4846  case 10:
4847  col = 48 + imirr[ch-10*192];
4848  row = jmirr[ch-10*192];
4849  supmod = 10;
4850  break;
4851  case 11:
4852  col = 48 + imirr[ch-11*192];
4853  row = 24 + jmirr[ch-11*192];
4854  supmod = 10;
4855  break;
4856  }
4857  break;
4858  case 10:
4859  case 11:
4860  case 12:
4861  switch(zone)
4862  {
4863  case 0:
4864  col = 64 + imirr[ch];
4865  row = jmirr[ch];
4866  supmod = 10;
4867  break;
4868  case 1:
4869  col = 64 + imirr[ch-192];
4870  row = 24 + jmirr[ch-192];
4871  supmod = 10;
4872  break;
4873  case 2:
4874  col = 65 - imirr[ch-2*192];
4875  row = 49 - jmirr[ch-2*192];
4876  supmod = 10;
4877  break;
4878  case 3:
4879  col = 65 - imirr[ch-3*192];
4880  row = 25 - jmirr[ch-3*192];
4881  supmod = 10;
4882  break;
4883  case 4:
4884  col = 48 + imirr[ch-4*192];
4885  row = jmirr[ch-4*192];
4886  supmod = 10;
4887  break;
4888  case 5:
4889  col = 48 + imirr[ch-5*192];
4890  row = 24 + jmirr[ch-5*192];
4891  supmod = 10;
4892  break;
4893  case 6:
4894  supmod = 0;
4895  col = 0;
4896  row = 0;
4897  break;
4898  case 7:
4899  supmod = 0;
4900  col = 0;
4901  row = 0;
4902  break;
4903  case 8:
4904  supmod = 0;
4905  col = 0;
4906  row = 0;
4907  break;
4908  }
4909  break;
4910  }
4911 }
4912 
4913 void StPmdGeom::chain21(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4914 {
4915  Int_t zone = ch/192;
4916  switch(year){
4917  case 6:{
4918 
4919  switch(zone)
4920  {
4921  case 0:
4922  col = 9 - imirr[ch];
4923  row = 73 - jmirr[ch];
4924  supmod = 12;
4925  break;
4926  case 1:
4927  col = 8 + imirr[ch-192];
4928  row = 48 + jmirr[ch-192];
4929  supmod = 12;
4930  break;
4931  case 2:
4932  col = 25 - imirr[ch-2*192];
4933  row = 73 - jmirr[ch-2*192];
4934  supmod = 12;
4935  break;
4936  case 3:
4937  col = 33 - imirr[ch-3*192];
4938  row = 73 - jmirr[ch-3*192];
4939  supmod = 12;
4940  break;
4941  case 4:
4942  col = 33 - imirr[ch-4*192];
4943  row = 49 - jmirr[ch-4*192];
4944  supmod = 12;
4945  break;
4946  case 5:
4947  col = 32 + imirr[ch-5*192];
4948  row = 24 + jmirr[ch-5*192];
4949  supmod = 12;
4950  break;
4951  case 6:
4952  col = 32 + imirr[ch-6*192];
4953  row = 48 + jmirr[ch-6*192];
4954  supmod = 12;
4955  break;
4956  case 7:
4957  col = 49 - imirr[ch-7*192];
4958  row = 73 - jmirr[ch-7*192];
4959  supmod = 12;
4960  break;
4961  case 8:
4962  col = 49 - imirr[ch-8*192];
4963  row = 49 - jmirr[ch-8*192];
4964  supmod = 12;
4965  break;
4966  }
4967  break;
4968  }
4969  case 8:
4970  case 10:
4971  case 11:
4972  case 12:
4973  {
4974  supmod = 0;
4975  col = 0;
4976  row = 0;
4977  break;
4978  }
4979  }
4980 }
4981 
4982 void StPmdGeom::chain22(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
4983 {
4984  Int_t zone = ch/192;
4985 
4986  switch(year){
4987  case 6:
4988 
4989  supmod = 0;
4990  col = 0;
4991  row = 0;
4992  break;
4993  case 8:
4994  switch(zone)
4995  {
4996  case 0:
4997  col = 40 + imirr[ch];
4998  row = 25 - jmirr[ch];
4999  supmod = 10;
5000  break;
5001  case 1:
5002  col = 41 - imirr[ch-192];
5003  row = jmirr[ch-192];
5004  supmod = 10;
5005  break;
5006  case 2:
5007  col = 24 + imirr[ch-2*192];
5008  row = 25 - jmirr[ch-2*192];
5009  supmod = 10;
5010  break;
5011  case 3:
5012  col = 25 - imirr[ch-3*192];
5013  row = 49 - jmirr[ch-3*192];
5014  supmod = 10;
5015  break;
5016  case 4:
5017  col = 25 - imirr[ch-4*192];
5018  row = 25 - jmirr[ch-4*192];
5019  supmod = 10;
5020  break;
5021  case 5:
5022  col = 8 + imirr[ch-5*192];
5023  row = jmirr[ch-5*192];
5024  supmod = 10;
5025  break;
5026  case 6:
5027  col = 8 + imirr[ch-6*192];
5028  row = 24 + jmirr[ch-6*192];
5029  supmod = 10;
5030  break;
5031  case 7:
5032  col = 9 - imirr[ch-7*192];
5033  row = 49 - jmirr[ch-7*192];
5034  supmod = 10;
5035  break;
5036  case 8:
5037  col = 9 - imirr[ch-8*192];
5038  row = 25 - jmirr[ch-8*192];
5039  supmod = 10;
5040  break;
5041  }
5042  break;
5043  case 10:
5044  case 11:
5045  case 12:
5046  switch(zone)
5047  {
5048  case 0:
5049  col = imirr[ch];
5050  row = jmirr[ch];
5051  supmod = 10;
5052  break;
5053  case 1:
5054  col = imirr[ch-1*192];
5055  row = 24 + jmirr[ch -1*192];
5056  supmod = 10;
5057  break;
5058  case 2:
5059  col = 17 - imirr[ch-2*192];
5060  row = 49 - jmirr[ch-2*192];
5061  supmod = 10;
5062  break;
5063  case 3:
5064  col = 17 - imirr[ch-3*192];
5065  row = 25 - jmirr[ch-3*192];
5066  supmod = 10;
5067  break;
5068  case 4:
5069  col = 16 + imirr[ch-4*192];
5070  row = jmirr[ch-4*192];
5071  supmod = 10;
5072  break;
5073  case 5:
5074  col = 16 + imirr[ch-5*192];
5075  row = 24 + jmirr[ch-5*192];
5076  supmod = 10;
5077  break;
5078  case 6:
5079  col = 24 + imirr[ch-6*192];
5080  row = jmirr[ch-6*192];
5081  supmod = 10;
5082  break;
5083  case 7:
5084  col = 41 - imirr[ch-7*192];
5085  row = 25 - jmirr[ch-7*192];
5086  supmod = 10;
5087  break;
5088  case 8:
5089  col = 40 + imirr[ch-8*192];
5090  row = jmirr[ch-8*192];
5091  supmod = 10;
5092  break;
5093 
5094  }
5095  break;
5096  }
5097 }
5098 
5099 void StPmdGeom::chain23(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5100 {
5101  Int_t zone = ch/192;
5102 
5103  switch(year){
5104  case 6:
5105 
5106  switch(zone)
5107  {
5108  case 0:
5109  col = 57 - imirr[ch];
5110  row = 73 - jmirr[ch];
5111  supmod = 12;
5112  break;
5113  case 1:
5114  col = 57 - imirr[ch-192];
5115  row = 49 - jmirr[ch-192];
5116  supmod = 12;
5117  break;
5118  case 2:
5119  col = 57 - imirr[ch-2*192];
5120  row = 25 - jmirr[ch-2*192];
5121  supmod = 12;
5122  break;
5123  case 3:
5124  col = 56 + imirr[ch-3*192];
5125  row = jmirr[ch-3*192];
5126  supmod = 12;
5127  break;
5128  case 4:
5129  col = 56 + imirr[ch-4*192];
5130  row = 24 + jmirr[ch-4*192];
5131  supmod = 12;
5132  break;
5133  case 5:
5134  col = 56 + imirr[ch-5*192];
5135  row = 48 + jmirr[ch-5*192];
5136  supmod = 12;
5137  break;
5138  case 6:
5139  col = 73 - imirr[ch-6*192];
5140  row = 73 - jmirr[ch-6*192];
5141  supmod = 12;
5142  break;
5143  case 7:
5144  col = 73 - imirr[ch-7*192];
5145  row = 49 - jmirr[ch-7*192];
5146  supmod = 12;
5147  break;
5148  case 8:
5149  col = 73 - imirr[ch-8*192];
5150  row = 25 - jmirr[ch-8*192];
5151  supmod = 12;
5152  break;
5153  }
5154  break;
5155  case 8:
5156  case 10:
5157  case 11:
5158  case 12:
5159  switch(zone)
5160  {
5161  case 0:
5162  col = 73 - imirr[ch];
5163  row = 49 - jmirr[ch];
5164  supmod = 12;
5165  break;
5166  case 1:
5167  col = 73 - imirr[ch-192];
5168  row = 25 - jmirr[ch-192];
5169  supmod = 12;
5170  break;
5171  case 2:
5172  col = 56 + imirr[ch-2*192];
5173  row = jmirr[ch-2*192];
5174  supmod = 12;
5175  break;
5176  case 3:
5177  col = 56 + imirr[ch-3*192];
5178  row = 24 + jmirr[ch-3*192];
5179  supmod = 12;
5180  break;
5181  case 4:
5182  col = 57 - imirr[ch-4*192];
5183  row = 49 - jmirr[ch-4*192];
5184  supmod = 12;
5185  break;
5186  case 5:
5187  col = 57 - imirr[ch-5*192];
5188  row = 25 - jmirr[ch-5*192];
5189  supmod = 12;
5190  break;
5191  case 6:
5192  col = 33 - imirr[ch-6*192];
5193  row = 73 - jmirr[ch-6*192];
5194  supmod = 12;
5195  break;
5196  case 7:
5197  col = 33 - imirr[ch-7*192];
5198  row = 49 - jmirr[ch-7*192];
5199  supmod = 12;
5200  break;
5201  case 8:
5202  col = 32 + imirr[ch-8*192];
5203  row = 24 + jmirr[ch-8*192];
5204  supmod = 12;
5205  break;
5206  case 9:
5207  col = 32 + imirr[ch-9*192];
5208  row = 48 + jmirr[ch-9*192];
5209  supmod = 12;
5210  break;
5211  case 10:
5212  col = 49 - imirr[ch-10*192];
5213  row = 73 - jmirr[ch-10*192];
5214  supmod = 12;
5215  break;
5216  case 11:
5217  col = 49 - imirr[ch-11*192];
5218  row = 49 - jmirr[ch-11*192];
5219  supmod = 12;
5220  break;
5221  }
5222  break;
5223  }
5224 }
5225 void StPmdGeom::chain24(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5226 {
5227  Int_t zone = ch/192;
5228  switch(year){
5229  case 6:
5230 
5231  switch(zone)
5232  {
5233  case 0:
5234  col = 97 - imirr[ch];
5235  row = 73 - jmirr[ch];
5236  supmod = 12;
5237  break;
5238  case 1:
5239  col = 97 - imirr[ch-192];
5240  row = 49 - jmirr[ch-192];
5241  supmod = 12;
5242  break;
5243  case 2:
5244  col = 97 - imirr[ch-2*192];
5245  row = 25 - jmirr[ch-2*192];
5246  supmod = 12;
5247  break;
5248  case 3:
5249  col = 80 + imirr[ch-3*192];
5250  row = jmirr[ch-3*192];
5251  supmod = 12;
5252  break;
5253  case 4:
5254  col = 80 + imirr[ch-4*192];
5255  row = 24 + jmirr[ch-4*192];
5256  supmod = 12;
5257  break;
5258  case 5:
5259  col = 80 + imirr[ch-5*192];
5260  row = 48 + jmirr[ch-5*192];
5261  supmod = 12;
5262  break;
5263  case 6:
5264  col = 81 - imirr[ch-6*192];
5265  row = 73 - jmirr[ch-6*192];
5266  supmod = 12;
5267  break;
5268  case 7:
5269  col = 81 - imirr[ch-7*192];
5270  row = 49 - jmirr[ch-7*192];
5271  supmod = 12;
5272  break;
5273  case 8:
5274  col = 81 - imirr[ch-8*192];
5275  row = 25 - jmirr[ch-8*192];
5276  supmod = 12;
5277  break;
5278  }
5279  break;
5280  case 8:
5281  case 10:
5282  case 11:
5283  case 12:
5284  switch(zone)
5285  {
5286  case 0:
5287  col = 97 - imirr[ch];
5288  row = 73 - jmirr[ch];
5289  supmod = 12;
5290  break;
5291  case 1:
5292  col = 97 - imirr[ch-192];
5293  row = 49 - jmirr[ch-192];
5294  supmod = 12;
5295  break;
5296  case 2:
5297  col = 97 - imirr[ch-2*192];
5298  row = 25 - jmirr[ch-2*192];
5299  supmod = 12;
5300  break;
5301  case 3:
5302  col = 80 + imirr[ch-3*192];
5303  row = jmirr[ch-3*192];
5304  supmod = 12;
5305  break;
5306  case 4:
5307  col = 80 + imirr[ch-4*192];
5308  row = 24 + jmirr[ch-4*192];
5309  supmod = 12;
5310  break;
5311  case 5:
5312  col = 80 + imirr[ch-5*192];
5313  row = 48 + jmirr[ch-5*192];
5314  supmod = 12;
5315  break;
5316  case 6:
5317  col = 81 - imirr[ch-6*192];
5318  row = 73 - jmirr[ch-6*192];
5319  supmod = 12;
5320  break;
5321  case 7:
5322  col = 81 - imirr[ch-7*192];
5323  row = 49 - jmirr[ch-7*192];
5324  supmod = 12;
5325  break;
5326  case 8:
5327  col = 81 - imirr[ch-8*192];
5328  row = 48 + jmirr[ch-8*192];
5329  supmod = 12;
5330  break;
5331  case 9:
5332  col = 57 - imirr[ch-9*192];
5333  row = 73 - jmirr[ch-9*192];
5334  supmod = 12;
5335  break;
5336  case 10:
5337  col = 56 + imirr[ch-10*192];
5338  row = 48 + jmirr[ch-10*192];
5339  supmod = 12;
5340  break;
5341  case 11:
5342  col = 73 - imirr[ch-11*192];
5343  row = 73 - jmirr[ch-11*192];
5344  supmod = 12;
5345  break;
5346  }
5347  break;
5348  }
5349 }
5350 
5351 void StPmdGeom::chain25(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5352 {
5353  Int_t zone = ch/192;
5354  switch(zone)
5355  {
5356  case 0:
5357  col = 49 - jmirr[ch];
5358  row = 9 - imirr[ch];
5359  supmod = 1+12;
5360  break;
5361  case 1:
5362  col = 25 - jmirr[ch-192];
5363  row = 9 - imirr[ch-192];
5364  supmod = 1+12;
5365  break;
5366  case 2:
5367  col = jmirr[ch-2*192];
5368  row = 8 + imirr[ch-2*192];
5369  supmod = 1+12;
5370  break;
5371  case 3:
5372  col = 24 + jmirr[ch-3*192];
5373  row = 8 + imirr[ch-3*192];
5374  supmod = 1+12;
5375  break;
5376  case 4:
5377  col = 49 - jmirr[ch-4*192];
5378  row = 25 - imirr[ch-4*192];
5379  supmod = 1+12;
5380  break;
5381  case 5:
5382  col = 25 - jmirr[ch-5*192];
5383  row = 25 - imirr[ch-5*192];
5384  supmod = 1+12;
5385  break;
5386  case 6:
5387  col = 25 - jmirr[ch-6*192];
5388  row = 33 - imirr[ch-6*192];
5389  supmod = 1+12;
5390  break;
5391  case 7:
5392  col = jmirr[ch-7*192];
5393  row = 32 + imirr[ch-7*192];
5394  supmod = 1+12;
5395  break;
5396  case 8:
5397  col = 25 - jmirr[ch-8*192];
5398  row = 49 - imirr[ch-8*192];
5399  supmod = 1+12;
5400  break;
5401  }
5402 }
5403 
5404 void StPmdGeom::chain26(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5405 {
5406  Int_t zone = ch/192;
5407  switch(zone)
5408  {
5409  case 0:
5410  col = 73 - jmirr[ch];
5411  row = 9 - imirr[ch];
5412  supmod = 2+12;
5413  break;
5414  case 1:
5415  col = 49 - jmirr[ch-192];
5416  row = 9 - imirr[ch-192];
5417  supmod = 2+12;
5418  break;
5419  case 2:
5420  col = 25 - jmirr[ch-2*192];
5421  row = 9 - imirr[ch-2*192];
5422  supmod = 2+12;
5423  break;
5424  case 3:
5425  col = jmirr[ch-3*192];
5426  row = 8 + imirr[ch-3*192];
5427  supmod = 2+12;
5428  break;
5429  case 4:
5430  col = 24 + jmirr[ch-4*192];
5431  row = 8 + imirr[ch-4*192];
5432  supmod = 2+12;
5433  break;
5434  case 5:
5435  col = 48 + jmirr[ch-5*192];
5436  row = 8 + imirr[ch-5*192];
5437  supmod = 2+12;
5438  break;
5439  case 6:
5440  col = 73 - jmirr[ch-6*192];
5441  row = 25 - imirr[ch-6*192];
5442  supmod = 2+12;
5443  break;
5444  case 7:
5445  col = 49 - jmirr[ch-7*192];
5446  row = 25 - imirr[ch-7*192];
5447  supmod = 2+12;
5448  break;
5449  case 8:
5450  col = 25 - jmirr[ch-8*192];
5451  row = 25 - imirr[ch-8*192];
5452  supmod = 2+12;
5453  break;
5454  }
5455 }
5456 void StPmdGeom::chain27(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5457 {
5458  Int_t zone = ch/192;
5459  switch(zone)
5460  {
5461  case 0:
5462  col = 49 - jmirr[ch];
5463  row = 49 - 16 - imirr[ch];
5464  supmod = 1+12;
5465  break;
5466  case 1:
5467  col = 24 + jmirr[ch-192];
5468  row = 32 + imirr[ch-192];
5469  supmod = 1+12;
5470  break;
5471  case 2:
5472  col = 49 - jmirr[ch-2*192];
5473  row = 49- imirr[ch-2*192];
5474  supmod = 1+12;
5475  break;
5476  case 3:
5477  col = 25-jnorm[ch-3*192];
5478  row = 25-inorm[ch-3*192];
5479  supmod = 3+12;
5480  break;
5481  case 4:
5482  col = 25-jnorm[ch-4*192];
5483  row = 49-inorm[ch-4*192];
5484  supmod = 3+12;
5485  break;
5486  case 5:
5487  col = 8+jnorm[ch-5*192];
5488  row = 24+inorm[ch-5*192];
5489  supmod = 3+12;
5490  break;
5491  case 6:
5492  col = 8+jnorm[ch-6*192];
5493  row = inorm[ch-6*192];
5494  supmod = 3+12;
5495  break;
5496  case 7:
5497  col = 9-jnorm[ch-7*192];
5498  row = 25-inorm[ch-7*192];
5499  supmod = 3+12;
5500  break;
5501  case 8:
5502  col = 9-jnorm[ch-8*192];
5503  row = 49-inorm[ch-8*192];
5504  supmod = 3+12;
5505  break;
5506  }
5507 }
5508 
5509 void StPmdGeom::chain28(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5510 {
5511  Int_t zone = ch/192;
5512  switch(zone)
5513  {
5514  case 0:
5515  col = 73 - jmirr[ch];
5516  row = 33 - imirr[ch];
5517  supmod = 2+12;
5518  break;
5519  case 1:
5520  col = 49 - jmirr[ch-192];
5521  row = 33 - imirr[ch-192];
5522  supmod = 2+12;
5523  break;
5524  case 2:
5525  col = 25 - jmirr[ch-2*192];
5526  row = 33 - imirr[ch-2*192];
5527  supmod = 2+12;
5528  break;
5529  case 3:
5530  col = jmirr[ch-3*192];
5531  row = 32 + imirr[ch-3*192];
5532  supmod = 2+12;
5533  break;
5534  case 4:
5535  col = 24 + jmirr[ch-4*192];
5536  row = 32 + imirr[ch-4*192];
5537  supmod = 2+12;
5538  break;
5539  case 5:
5540  col = 48 + jmirr[ch-5*192];
5541  row = 32 + imirr[ch-5*192];
5542  supmod = 2+12;
5543  break;
5544  case 6:
5545  col = 73 - jmirr[ch-6*192];
5546  row = 49 - imirr[ch-6*192];
5547  supmod = 2+12;
5548  break;
5549  case 7:
5550  col = 49 - jmirr[ch-7*192];
5551  row = 49 - imirr[ch-7*192];
5552  supmod = 2+12;
5553  break;
5554  case 8:
5555  col = 25 - jmirr[ch-8*192];
5556  row = 49 - imirr[ch-8*192];
5557  supmod = 2+12;
5558  break;
5559  }
5560 }
5561 
5562 void StPmdGeom::chain29(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5563 {
5564  Int_t zone = ch/192;
5565  switch(zone)
5566  {
5567  case 0:
5568  col = 49 - jnorm[ch];
5569  row = 25 - inorm[ch];
5570  supmod = 3+12;
5571  break;
5572  case 1:
5573  col = 49 - jnorm[ch-192];
5574  row = 49 - inorm[ch-192];
5575  supmod = 3+12;
5576  break;
5577  case 2:
5578  col = 49 - jnorm[ch-2*192];
5579  row = 73 - inorm[ch-2*192];
5580  supmod = 3+12;
5581  break;
5582  case 3:
5583  col = 32 + jnorm[ch-3*192];
5584  row = 48 + inorm[ch-3*192];
5585  supmod = 3+12;
5586  break;
5587  case 4:
5588  col = 32 + jnorm[ch-4*192];
5589  row = 24 + inorm[ch-4*192];
5590  supmod = 3+12;
5591  break;
5592  case 5:
5593  col = 32 + jnorm[ch-5*192];
5594  row = inorm[ch-5*192];
5595  supmod = 3+12;
5596  break;
5597  case 6:
5598  col = 33 - jnorm[ch-6*192];
5599  row = 25 - inorm[ch-6*192];
5600  supmod = 3+12;
5601  break;
5602  case 7:
5603  col = 33 - jnorm[ch-7*192];
5604  row = 49 - inorm[ch-7*192];
5605  supmod = 3+12;
5606  break;
5607  case 8:
5608  col = 33 - jnorm[ch-8*192];
5609  row = 73 - inorm[ch-8*192];
5610  supmod = 3+12;
5611  break;
5612  }
5613 }
5614 void StPmdGeom::chain30(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5615 {
5616  Int_t zone = ch/192;
5617  switch(zone)
5618  {
5619  case 0:
5620  col = 73 - jmirr[ch];
5621  row = 9 - imirr[ch];
5622  supmod = 4+12;
5623  break;
5624  case 1:
5625  col = 49 - jmirr[ch-192];
5626  row = 9 - imirr[ch-192];
5627  supmod = 4+12;
5628  break;
5629  case 2:
5630  col = 25 - jmirr[ch-2*192];
5631  row = 9 - imirr[ch-2*192];
5632  supmod = 4+12;
5633  break;
5634  case 3:
5635  col = jmirr[ch-3*192];
5636  row = 8 + imirr[ch-3*192];
5637  supmod = 4+12;
5638  break;
5639  case 4:
5640  col = 24 + jmirr[ch-4*192];
5641  row = 8 + imirr[ch-4*192];
5642  supmod = 4+12;
5643  break;
5644  case 5:
5645  col = 48 + jmirr[ch-5*192];
5646  row = 8 + imirr[ch-5*192];
5647  supmod = 4+12;
5648  break;
5649 
5650  case 6:
5651  col = 73 - jmirr[ch-6*192];
5652  row = 25 - imirr[ch-6*192];
5653  supmod = 4+12;
5654  break;
5655  case 7:
5656  col = 49 - jmirr[ch-7*192];
5657  row = 25 - imirr[ch-7*192];
5658  supmod = 4+12;
5659  break;
5660  case 8:
5661  col = 25 - jmirr[ch-8*192];
5662  row = 25 - imirr[ch-8*192];
5663  supmod = 4+12;
5664  break;
5665  }
5666 }
5667 
5668 void StPmdGeom::chain31(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5669 {
5670  Int_t zone = ch/192;
5671  switch(zone)
5672  {
5673  case 0:
5674  col = 73 - jmirr[ch];
5675  row = 33 - imirr[ch];
5676  supmod = 4+12;
5677  break;
5678  case 1:
5679  col = 49 - jmirr[ch-192];
5680  row = 33 - imirr[ch-192];
5681  supmod = 4+12;
5682  break;
5683  case 2:
5684  col = 25 - jmirr[ch-2*192];
5685  row = 33 - imirr[ch-2*192];
5686  supmod = 4+12;
5687  break;
5688  case 3:
5689  col = jmirr[ch-3*192];
5690  row = 32 + imirr[ch-3*192];
5691  supmod = 4+12;
5692  break;
5693  case 4:
5694  col = 24 + jmirr[ch-4*192];
5695  row = 32 + imirr[ch-4*192];
5696  supmod = 4+12;
5697  break;
5698  case 5:
5699  col = 48 + jmirr[ch-5*192];
5700  row = 32 + imirr[ch-5*192];
5701  supmod = 4+12;
5702  break;
5703  case 6:
5704  col = 73 - jmirr[ch-6*192];
5705  row = 49 - imirr[ch-6*192];
5706  supmod = 4+12;
5707  break;
5708  case 7:
5709  col = 49 - jmirr[ch-7*192];
5710  row = 49 - imirr[ch-7*192];
5711  supmod = 4+12;
5712  break;
5713  case 8:
5714  col = 25 - jmirr[ch-8*192];
5715  row = 49 - imirr[ch-8*192];
5716  supmod = 4+12;
5717  break;
5718  }
5719 
5720 }
5721 
5722 
5723 void StPmdGeom::chain32(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5724 {
5725  Int_t zone = ch/192;
5726  switch(zone)
5727  {
5728  case 0:
5729  col = jmirr[ch];
5730  row = 16 + imirr[ch];
5731  supmod = 5+12;
5732  break;
5733  case 1:
5734  col = 24 + jmirr[ch-192];
5735  row = 16 + imirr[ch-192];
5736  supmod = 5+12;
5737  break;
5738  case 2:
5739  col = 48 + jmirr[ch-2*192];
5740  row = 16 + imirr[ch-2*192];
5741  supmod = 5+12;
5742  break;
5743  case 3:
5744  col = 73 - jmirr[ch-3*192];
5745  row = 17 - imirr[ch-3*192];
5746  supmod = 5+12;
5747  break;
5748  case 4:
5749  col = 49 - jmirr[ch-4*192];
5750  row = 17 - imirr[ch-4*192];
5751  supmod = 5+12;
5752  break;
5753  case 5:
5754  col = 25 - jmirr[ch-5*192];
5755  row = 17 - imirr[ch-5*192];
5756  supmod = 5+12;
5757  break;
5758  case 6:
5759  col = jmirr[ch-6*192];
5760  row = imirr[ch-6*192];
5761  supmod = 5+12;
5762  break;
5763  case 7:
5764  col = 24 + jmirr[ch-7*192];
5765  row = imirr[ch-7*192];
5766  supmod = 5+12;
5767  break;
5768  case 8:
5769  col = 48 + jmirr[ch-8*192];
5770  row = imirr[ch-8*192];
5771  supmod = 5+12;
5772  break;
5773  }
5774 }
5775 
5776 
5777 
5778 
5779 
5780 void StPmdGeom::chain33(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5781 {
5782  Int_t zone = ch/192;
5783  switch(zone)
5784  {
5785  case 0:
5786  col = 25 - jnorm[ch];
5787  row = 73 - inorm[ch];
5788  supmod = 3+12;
5789  break;
5790  case 1:
5791  col = 8 + jnorm[ch-192];
5792  row = 48 + inorm[ch-192];
5793  supmod = 3+12;
5794  break;
5795  case 2:
5796  col = 9 - jnorm[ch-2*192];
5797  row = 73 - inorm[ch-2*192];
5798  supmod = 3+12;
5799  break;
5800  case 3:
5801  col = 73 - jmirr[ch-3*192];
5802  row = 57 - imirr[ch-3*192];
5803  supmod = 4+12;
5804  break;
5805  case 4:
5806  col = 49 - jmirr[ch-4*192];
5807  row = 57 - imirr[ch-4*192];
5808  supmod = 4+12;
5809  break;
5810  case 5:
5811  col = 24 + jmirr[ch-5*192];
5812  row = 56 + imirr[ch-5*192];
5813  supmod = 4+12;
5814  break;
5815  case 6:
5816  col = 48 + jmirr[ch-6*192];
5817  row = 56 + imirr[ch-6*192];
5818  supmod = 4+12;
5819  break;
5820  case 7:
5821  col = 73 - jmirr[ch-7*192];
5822  row = 73 - imirr[ch-7*192];
5823  supmod = 4+12;
5824  break;
5825  case 8:
5826  col = 49 - jmirr[ch-8*192];
5827  row = 73 - imirr[ch-8*192];
5828  supmod = 4+12;
5829  break;
5830  }
5831 }
5832 
5833 void StPmdGeom::chain34(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5834 {
5835  Int_t zone = ch/192;
5836  switch(zone)
5837  {
5838  case 0:
5839  col = jmirr[ch];
5840  row = 40 + imirr[ch];
5841  supmod = 5+12;
5842  break;
5843  case 1:
5844  col = 24 + jmirr[ch-192];
5845  row = 40 + imirr[ch-192];
5846  supmod = 5+12;
5847  break;
5848  case 2:
5849  col = 48 + jmirr[ch - 2*192];
5850  row = 40 + imirr[ch - 2*192];
5851  supmod = 5+12;
5852  break;
5853  case 3:
5854  col = 73 - jmirr[ch - 3*192];
5855  row = 41 - imirr[ch - 3*192];
5856  supmod = 5+12;
5857  break;
5858  case 4:
5859  col = 49 - jmirr[ch-4*192];
5860  row = 41 - imirr[ch-4*192];
5861  supmod = 5+12;
5862  break;
5863  case 5:
5864  col = 25 - jmirr[ch-5*192];
5865  row = 41 - imirr[ch-5*192];
5866  supmod = 5+12;
5867  break;
5868  case 6:
5869  col = jmirr[ch-6*192];
5870  row = 24 + imirr[ch-6*192];
5871  supmod = 5+12;
5872  break;
5873  case 7:
5874  col = 24 + jmirr[ch-7*192];
5875  row = 24 + imirr[ch-7*192];
5876  supmod = 5+12;
5877  break;
5878  case 8:
5879  col = 48 + jmirr[ch-8*192];
5880  row = 24 + imirr[ch-8*192];
5881  supmod = 5+12;
5882  break;
5883  }
5884 }
5885 void StPmdGeom::chain35(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5886 {
5887  Int_t zone = ch/192;
5888  switch(zone)
5889  {
5890  case 0:
5891  col = jmirr[ch];
5892  row = 40 + imirr[ch];
5893  supmod = 6+12;
5894  break;
5895  case 1:
5896  col = 25 - jmirr[ch-192];
5897  row = 41 - imirr[ch-192];
5898  supmod = 6+12;
5899  break;
5900  case 2:
5901  col = jmirr[ch-2*192];
5902  row = 24 + imirr[ch-2*192];
5903  supmod = 6+12;
5904  break;
5905  case 3:
5906  col = jmirr[ch-3*192];
5907  row = 16 + imirr[ch-3*192];
5908  supmod = 6+12;
5909  break;
5910  case 4:
5911  col = 24 + jmirr[ch-4*192];
5912  row = 16 + imirr[ch-4*192];
5913  supmod = 6+12;
5914  break;
5915  case 5:
5916  col = 49 - jmirr[ch-5*192];
5917  row = 17 - imirr[ch-5*192];
5918  supmod = 6+12;
5919  break;
5920  case 6:
5921  col = 25 - jmirr[ch-6*192];
5922  row = 17 - imirr[ch-6*192];
5923  supmod = 6+12;
5924  break;
5925  case 7:
5926  col = jmirr[ch-7*192];
5927  row = imirr[ch-7*192];
5928  supmod = 6+12;
5929  break;
5930  case 8:
5931  col = 24 + jmirr[ch-8*192];
5932  row = imirr[ch-8*192];
5933  supmod = 6+12;
5934  break;
5935  }
5936 }
5937 
5938 void StPmdGeom::chain36(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5939 {
5940  Int_t zone = ch/192;
5941  switch(zone)
5942  {
5943  case 0:
5944  col = 24 + jmirr[ch];
5945  row = 40 + imirr[ch];
5946  supmod = 6+12;
5947  break;
5948  case 1:
5949  col = 49 - jmirr[ch-192];
5950  row = 41 - imirr[ch-192];
5951  supmod = 6+12;
5952  break;
5953  case 2:
5954  col = 24 + jmirr[ch-2*192];
5955  row = 24 + imirr[ch-2*192];
5956  supmod = 6+12;
5957  break;
5958  case 3:
5959  col = 48 + jmirr[ch-3*192];
5960  row = 16 + imirr[ch-3*192];
5961  supmod = 6+12;
5962  break;
5963  case 4:
5964  col = 73 - jmirr[ch-4*192];
5965  row = 17 - imirr[ch-4*192];
5966  supmod = 6+12;
5967  break;
5968  case 5:
5969  col = 48 + jmirr[ch-5*192];
5970  row = imirr[ch-5*192];
5971  supmod = 6+12;
5972  break;
5973  case 6:
5974  col = jmirr[ch-6*192];
5975  row = 40 + imirr[ch-6*192];
5976  supmod = 7+12;
5977  break;
5978  case 7:
5979  col = 25 - jmirr[ch-7*192];
5980  row = 41 - imirr[ch-7*192];
5981  supmod = 7+12;
5982  break;
5983  case 8:
5984  col = jmirr[ch-8*192];
5985  row = 24 + imirr[ch-8*192];
5986  supmod = 7+12;
5987  break;
5988  }
5989 }
5990 void StPmdGeom::chain37(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
5991 {
5992  Int_t zone = ch/192;
5993  switch(year){
5994  case 6:
5995  case 8:
5996  switch(zone)
5997  {
5998  case 0:
5999  col = 24 + jmirr[ch];
6000  row = 40 + imirr[ch];
6001  supmod = 7+12;
6002  break;
6003  case 1:
6004  col = 49 - jmirr[ch-192];
6005  row = 41 - imirr[ch-192];
6006  supmod = 7+12;
6007  break;
6008  case 2:
6009  col = 24 + jmirr[ch-2*192];
6010  row = 24 + imirr[ch-2*192];
6011  supmod = 7+12;
6012  break;
6013  case 3:
6014  col = jmirr[ch-3*192];
6015  row = 16 + imirr[ch-3*192];
6016  supmod = 7+12;
6017  break;
6018  case 4:
6019  col = 24 + jmirr[ch-4*192];
6020  row = 16 + imirr[ch-4*192];
6021  supmod = 7+12;
6022  break;
6023  case 5:
6024  col = 49 - jmirr[ch-5*192];
6025  row = 17 - imirr[ch-5*192];
6026  supmod = 7+12;
6027  break;
6028  case 6:
6029  col = 25 - jmirr[ch-6*192];
6030  row = 17 - imirr[ch-6*192];
6031  supmod = 7+12;
6032  break;
6033  case 7:
6034  col = jmirr[ch-7*192];
6035  row = imirr[ch-7*192];
6036  supmod = 7+12;
6037  break;
6038  case 8:
6039  col = 24 + jmirr[ch-8*192];
6040  row = imirr[ch-8*192];
6041  supmod = 7+12;
6042  break;
6043  }
6044  case 10:
6045  case 11:
6046  case 12:
6047  switch(zone)
6048  {
6049  case 0:
6050  col = jmirr[ch];
6051  row = imirr[ch];
6052  supmod = 7+12;
6053  break;
6054  case 1:
6055  col = 24 + jmirr[ch-192];
6056  row = imirr[ch-192];
6057  supmod = 7 + 12;
6058  break;
6059  case 2:
6060  col = 49 - jmirr[ch-2*192];
6061  row = 17 - imirr[ch-2*192];
6062  supmod = 7 + 12;
6063  break;
6064  case 3:
6065  col = 25 - jmirr[ch-3*192];
6066  row = 17 - imirr[ch-3*192];
6067  supmod = 7 + 12;
6068  break;
6069  case 4:
6070  col = jmirr[ch-4*192];
6071  row = 16 + imirr[ch-4*192];
6072  supmod = 7 + 12;
6073  break;
6074  case 5:
6075  col = 24 + jmirr[ch-5*192];
6076  row = 16 + imirr[ch-5*192];
6077  supmod = 7 + 12;
6078  break;
6079  case 6:
6080  col = 24 + jmirr[ch-6*192];
6081  row = 24 + imirr[ch-6*192];
6082  supmod = 7 + 12;
6083  break;
6084  case 7:
6085  col = 49 - jmirr[ch-7*192];
6086  row = 41 - imirr[ch-7*192];
6087  supmod = 7 + 12;
6088  break;
6089  case 8:
6090  col = 24 + jmirr[ch-8*192];
6091  row = 40 + imirr[ch-8*192];
6092  supmod = 7 + 12;
6093  break;
6094  }
6095  break;
6096  }
6097 }
6098 void StPmdGeom::chain38(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6099 {
6100  Int_t zone = ch/192;
6101  switch(zone)
6102  {
6103  case 0:
6104  col = 49 - jnorm[ch];
6105  row = 25 - inorm[ch];
6106  supmod = 8+12;
6107  break;
6108  case 1:
6109  col = 49 - jnorm[ch-192];
6110  row = 49 - inorm[ch-192];
6111  supmod = 8+12;
6112  break;
6113  case 2:
6114  col = 49 - jnorm[ch-2*192];
6115  row = 73 - inorm[ch-2*192];
6116  supmod = 8+12;
6117  break;
6118  case 3:
6119  col = 32 + jnorm[ch-3*192];
6120  row = 48 + inorm[ch-3*192];
6121  supmod = 8+12;
6122  break;
6123  case 4:
6124  col = 32 + jnorm[ch-4*192];
6125  row = 24 + inorm[ch-4*192];
6126  supmod = 8+12;
6127  break;
6128  case 5:
6129  col = 32 + jnorm[ch-5*192];
6130  row = inorm[ch-5*192];
6131  supmod = 8+12;
6132  break;
6133  case 6:
6134  col = 33 - jnorm[ch-6*192];
6135  row = 25 - inorm[ch-6*192];
6136  supmod = 8+12;
6137  break;
6138  case 7:
6139  col = 33 - jnorm[ch-7*192];
6140  row = 49 - inorm[ch-7*192];
6141  supmod = 8+12;
6142  break;
6143  case 8:
6144  col = 33 - jnorm[ch-8*192];
6145  row = 73 - inorm[ch-8*192];
6146  supmod = 8+12;
6147  break;
6148  }
6149 }
6150 
6151 void StPmdGeom::chain39(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6152 {
6153  Int_t zone = ch/192;
6154  switch(zone)
6155  {
6156  case 0:
6157  col = 49 - jnorm[ch];
6158  row = 25 - inorm[ch];
6159  supmod = 9+12;
6160  break;
6161  case 1:
6162  col = 49 - jnorm[ch-192];
6163  row = 49 - inorm[ch-192];
6164  supmod = 9+12;
6165  break;
6166  case 2:
6167  col = 32 + jnorm[ch-2*192];
6168  row = 24 + inorm[ch-2*192];
6169  supmod = 9+12;
6170  break;
6171  case 3:
6172  col = 32 + jnorm[ch-3*192];
6173  row = inorm[ch-3*192];
6174  supmod = 9+12;
6175  break;
6176  case 4:
6177  col = 33 - jnorm[ch-4*192];
6178  row = 25 - inorm[ch-4*192];
6179  supmod = 9+12;
6180  break;
6181  case 5:
6182  col = 33 - jnorm[ch-5*192];
6183  row = 49 - inorm[ch-5*192];
6184  supmod = 9+12;
6185  break;
6186  case 6:
6187  col = 25 - jnorm[ch-6*192];
6188  row = 49 - inorm[ch-6*192];
6189  supmod = 9+12;
6190  break;
6191  case 7:
6192  col = 8 + jnorm[ch-7*192];
6193  row = 24 + inorm[ch-7*192];
6194  supmod = 9+12;
6195  break;
6196  case 8:
6197  col = 9 - jnorm[ch-8*192];
6198  row = 49 - inorm[ch-8*192];
6199  supmod = 9+12;
6200  break;
6201  }
6202 }
6203 void StPmdGeom::chain40(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6204 {
6205  Int_t zone = ch/192;
6206  switch(zone)
6207  {
6208  case 0:
6209  col = 25 - jnorm[ch];
6210  row = 25 - inorm[ch];
6211  supmod = 8+12;
6212  break;
6213  case 1:
6214  col = 25 - jnorm[ch-192];
6215  row = 49 - inorm[ch-192];
6216  supmod = 8+12;
6217  break;
6218  case 2:
6219  col = 25 - jnorm[ch-2*192];
6220  row = 73 - inorm[ch-2*192];
6221  supmod = 8+12;
6222  break;
6223  case 3:
6224  col = 8 + jnorm[ch-3*192];
6225  row = 48 + inorm[ch-3*192];
6226  supmod = 8+12;
6227  break;
6228  case 4:
6229  col = 8 + jnorm[ch-4*192];
6230  row = 24 + inorm[ch-4*192];
6231  supmod = 8+12;
6232  break;
6233  case 5:
6234  col = 8 + jnorm[ch-5*192];
6235  row = inorm[ch-5*192];
6236  supmod = 8+12;
6237  break;
6238  case 6:
6239  col = 9 - jnorm[ch-6*192];
6240  row = 25 - inorm[ch-6*192];
6241  supmod = 8+12;
6242  break;
6243  case 7:
6244  col = 9 - jnorm[ch-7*192];
6245  row = 49 - inorm[ch-7*192];
6246  supmod = 8+12;
6247  break;
6248  case 8:
6249  col = 9 - jnorm[ch-8*192];
6250  row = 73 - inorm[ch-8*192];
6251  supmod = 8+12;
6252  break;
6253  }
6254 }
6255 
6256 void StPmdGeom::chain41(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6257 {
6258  Int_t zone = ch/192;
6259  switch(zone)
6260  {
6261  case 0:
6262  col = 25 - jnorm[ch];
6263  row = 25 - inorm[ch];
6264  supmod = 9+12;
6265  break;
6266  case 1:
6267  col = 8 + jnorm[ch-192];
6268  row = inorm[ch-192];
6269  supmod = 9+12;
6270  break;
6271  case 2:
6272  col = 9 - jnorm[ch-2*192];
6273  row = 25 - inorm[ch-2*192];
6274  supmod = 9+12;
6275  break;
6276  case 3:
6277  col = 73 - jmirr[ch-3*192];
6278  row = 33 - imirr[ch-3*192];
6279  supmod = 11+12;
6280  break;
6281  case 4:
6282  col = 49 - jmirr[ch-4*192];
6283  row = 33 - imirr[ch-4*192];
6284  supmod = 11+12;
6285  break;
6286  case 5:
6287  col = 24 + jmirr[ch-5*192];
6288  row = 32 + imirr[ch-5*192];
6289  supmod = 11+12;
6290  break;
6291  case 6:
6292  col = 48 + jmirr[ch-6*192];
6293  row = 32 + imirr[ch-6*192];
6294  supmod = 11+12;
6295  break;
6296  case 7:
6297  col = 73 - jmirr[ch-7*192];
6298  row = 49 - imirr[ch-7*192];
6299  supmod = 11+12;
6300  break;
6301  case 8:
6302  col = 49 - jmirr[ch-8*192];
6303  row = 49 - imirr[ch-8*192];
6304  supmod = 11+12;
6305  break;
6306  }
6307 }
6308 void StPmdGeom::chain42(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6309 {
6310  Int_t zone = ch/192;
6311  switch(zone)
6312  {
6313  case 0:
6314  col = 73 - jnorm[ch];
6315  row = 25 - inorm[ch];
6316  supmod = 10+12;
6317  break;
6318  case 1:
6319  col = 73 - jnorm[ch-192];
6320  row = 49 - inorm[ch-192];
6321  supmod = 10+12;
6322  break;
6323  case 2:
6324  col = 73 - jnorm[ch-2*192];
6325  row = 73 - inorm[ch-2*192];
6326  supmod = 10+12;
6327  break;
6328  case 3:
6329  col = 56 + jnorm[ch-3*192];
6330  row = 48 + inorm[ch-3*192];
6331  supmod = 10+12;
6332  break;
6333  case 4:
6334  col = 56 + jnorm[ch-4*192];
6335  row = 24 + inorm[ch-4*192];
6336  supmod = 10+12;
6337  break;
6338  case 5:
6339  col = 56 + jnorm[ch-5*192];
6340  row = inorm[ch-5*192];
6341  supmod = 10+12;
6342  break;
6343  case 6:
6344  col = 57 - jnorm[ch-6*192];
6345  row = 25 - inorm[ch-6*192];
6346  supmod = 10+12;
6347  break;
6348  case 7:
6349  col = 57 - jnorm[ch-7*192];
6350  row = 49 - inorm[ch-7*192];
6351  supmod = 10+12;
6352  break;
6353  case 8:
6354  col = 57 - jnorm[ch-8*192];
6355  row = 73 - inorm[ch-8*192];
6356  supmod = 10+12;
6357  break;
6358  }
6359 }
6360 void StPmdGeom::chain43(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6361 {
6362  Int_t zone = ch/192;
6363  switch(zone)
6364  {
6365  case 0:
6366  col = 73 - jmirr[ch];
6367  row = 9 - imirr[ch];
6368  supmod = 11+12;
6369  break;
6370  case 1:
6371  col = 49 - jmirr[ch-192];
6372  row = 9 - imirr[ch-192];
6373  supmod = 11+12;
6374  break;
6375  case 2:
6376  col = 25 - jmirr[ch-2*192];
6377  row = 9 - imirr[ch-2*192];
6378  supmod = 11+12;
6379  break;
6380  case 3:
6381  col = jmirr[ch-3*192];
6382  row = 8 + imirr[ch-3*192];
6383  supmod = 11+12;
6384  break;
6385  case 4:
6386  col = 24 + jmirr[ch-4*192];
6387  row = 8 + imirr[ch-4*192];
6388  supmod = 11+12;
6389  break;
6390  case 5:
6391  col = 48 + jmirr[ch-5*192];
6392  row = 8 + imirr[ch-5*192];
6393  supmod = 11+12;
6394  break;
6395  case 6:
6396  col = 73 - jmirr[ch-6*192];
6397  row = 25 - imirr[ch-6*192];
6398  supmod = 11+12;
6399  break;
6400  case 7:
6401  col = 49 - jmirr[ch-7*192];
6402  row = 25 - imirr[ch-7*192];
6403  supmod = 11+12;
6404  break;
6405  case 8:
6406  col = 25 - jmirr[ch-8*192];
6407  row = 25 - imirr[ch-8*192];
6408  supmod = 11+12;
6409  break;
6410  }
6411 }
6412 void StPmdGeom::chain44(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6413 {
6414  Int_t zone = ch/192;
6415  switch(zone)
6416  {
6417  case 0:
6418  col = 49 - jnorm[ch];
6419  row = 25 - inorm[ch];
6420  supmod = 10+12;
6421  break;
6422  case 1:
6423  col = 49 - jnorm[ch-192];
6424  row = 49 - inorm[ch-192];
6425  supmod = 10+12;
6426  break;
6427  case 2:
6428  col = 49 - jnorm[ch-2*192];
6429  row = 73 - inorm[ch-2*192];
6430  supmod = 10+12;
6431  break;
6432  case 3:
6433  col = 32 + jnorm[ch-3*192];
6434  row = 48 + inorm[ch-3*192];
6435  supmod = 10+12;
6436  break;
6437  case 4:
6438  col = 32 + jnorm[ch-4*192];
6439  row = 24 + inorm[ch-4*192];
6440  supmod = 10+12;
6441  break;
6442  case 5:
6443  col = 32 + jnorm[ch-5*192];
6444  row = inorm[ch-5*192];
6445  supmod = 10+12;
6446  break;
6447  case 6:
6448  col =33 - jnorm[ch-6*192];
6449  row =25 - inorm[ch-6*192];
6450  supmod = 10+12;
6451  break;
6452  case 7:
6453  col =33 - jnorm[ch-7*192];
6454  row =49 - inorm[ch-7*192];
6455  supmod = 10+12;
6456  break;
6457  case 8:
6458  col =33 - jnorm[ch-8*192];
6459  row =73 - inorm[ch-8*192];
6460  supmod = 10+12;
6461  break;
6462  }
6463 }
6464 void StPmdGeom::chain45(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6465 {
6466  Int_t zone = ch/192;
6467  switch(year){
6468  case 6:
6469 
6470  switch(zone)
6471  {
6472  case 0:
6473  col = 25 - jnorm[ch];
6474  row = 25 - inorm[ch];
6475  supmod = 10+12;
6476  break;
6477  case 1:
6478  col = 25 - jnorm[ch-192];
6479  row = 49 - inorm[ch-192];
6480  supmod = 10+12;
6481  break;
6482  case 2:
6483  col = 8 + jnorm[ch-2*192];
6484  row = 24 + inorm[ch-2*192];
6485  supmod = 10+12;
6486  break;
6487  case 3:
6488  col = 8 + jnorm[ch-3*192];
6489  row = inorm[ch-3*192];
6490  supmod = 10+12;
6491  break;
6492  case 4:
6493  col = 9 - jnorm[ch-4*192];
6494  row = 25 - inorm[ch-4*192];
6495  supmod = 10+12;
6496  break;
6497  case 5:
6498  col = 9 - jnorm[ch-5*192];
6499  row = 49 - inorm[ch-5*192];
6500  supmod = 10+12;
6501  break;
6502  }
6503  break;
6504  case 8:
6505  case 10:
6506  case 11:
6507  case 12:
6508  switch(zone)
6509  {
6510  case 0:
6511  col = 25 - jmirr[ch];
6512  row = 33 - imirr[ch];
6513  supmod = 11+12;
6514  break;
6515  case 1:
6516  col = jmirr[ch-192];
6517  row = 32 + imirr[ch-192];
6518  supmod = 11+12;
6519  break;
6520  case 2:
6521  col = 25 - jmirr[ch-2*192];
6522  row = 49- imirr[ch-2*192];
6523  supmod = 11+12;
6524  break;
6525  case 3:
6526  col = 25 - jnorm[ch-3*192];
6527  row = 25 - inorm[ch-3*192];
6528  supmod = 10+12;
6529  break;
6530  case 4:
6531  col = 25 - jnorm[ch-4*192];
6532  row = 49 - inorm[ch-4*192];
6533  supmod = 10+12;
6534  break;
6535  case 5:
6536  col = 8 + jnorm[ch-5*192];
6537  row = 24 + inorm[ch-5*192];
6538  supmod = 10+12;
6539  break;
6540  case 6:
6541  col = 8 + jnorm[ch-6*192];
6542  row = inorm[ch-6*192];
6543  supmod = 10+12;
6544  break;
6545  case 7:
6546  col = 9 - jnorm[ch-7*192];
6547  row = 25 - inorm[ch-7*192];
6548  supmod = 10+12;
6549  break;
6550  case 8:
6551  col = 9 - jnorm[ch-8*192];
6552  row = 49 - inorm[ch-8*192];
6553  supmod = 10+12;
6554  break;
6555  }
6556  break;
6557  }
6558 }
6559 
6560 void StPmdGeom::chain46(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6561 {
6562  Int_t zone = ch/192;
6563  switch(year){
6564  case 6:
6565 
6566  switch(zone)
6567  {
6568  case 0:
6569  col = 25 - jmirr[ch];
6570  row = 33 - imirr[ch];
6571  supmod = 11+12;
6572  break;
6573  case 1:
6574  col = jmirr[ch-192];
6575  row = 32 + imirr[ch-192];
6576  supmod = 11+12;
6577  break;
6578  case 2:
6579  col = 25 - jmirr[ch-2*192];
6580  row = 49- imirr[ch-2*192];
6581  supmod = 11+12;
6582  break;
6583  }
6584  break;
6585  case 8:
6586  case 10:
6587  case 11:
6588  case 12:
6589  switch(zone)
6590  {
6591  case 0:
6592  col = jnorm[ch];
6593  row = 48 + inorm[ch];
6594  supmod = 12 + 12;
6595  break;
6596  case 1:
6597  col = 17 - jnorm[ch-192];
6598  row = 73 - inorm[ch-192];
6599  supmod = 12 + 12;
6600  break;
6601  case 2:
6602  col = 16 + jnorm[ch-2*192];
6603  row = 48 + inorm[ch-2*192];
6604  supmod = 12 + 12;
6605  break;
6606  case 3:
6607  col = 24 + jnorm[ch-3*192];
6608  row = 48 + inorm[ch-3*192];
6609  supmod = 12+12;
6610  break;
6611  case 4:
6612  col = 24 + jnorm[ch-4*192];
6613  row = 24 + inorm[ch-4*192];
6614  supmod = 12+12;
6615  break;
6616  case 5:
6617  col = 41 - jnorm[ch-5*192];
6618  row = 49 - inorm[ch-5*192];
6619  supmod = 12+12;
6620  break;
6621  case 6:
6622  col = 41 - jnorm[ch-6*192];
6623  row = 73 - inorm[ch-6*192];
6624  supmod = 12+12;
6625  break;
6626  case 7:
6627  col = 40 + jnorm[ch-7*192];
6628  row = 48 + inorm[ch-7*192];
6629  supmod = 12+12;
6630  break;
6631  case 8:
6632  col = 40 + jnorm[ch-8*192];
6633  row = 24 + inorm[ch-8*192];
6634  supmod = 12+12;
6635  break;
6636  }
6637  break;
6638  }
6639 }
6640 
6641 void StPmdGeom::chain47(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6642 {
6643  Int_t zone = ch/192;
6644  switch(year){
6645  case 6:
6646 
6647  switch(zone)
6648  {
6649  case 0:
6650  col = 24 + jnorm[ch];
6651  row = 48 + inorm[ch];
6652  supmod = 12+12;
6653  break;
6654  case 1:
6655  col = 24 + jnorm[ch-192];
6656  row = 24 + inorm[ch-192];
6657  supmod = 12+12;
6658  break;
6659  case 2:
6660  col = 41 - jnorm[ch-2*192];
6661  row = 49 - inorm[ch-2*192];
6662  supmod = 12+12;
6663  break;
6664  case 3:
6665  col = 41 - jnorm[ch-3*192];
6666  row = 73 - inorm[ch-3*192];
6667  supmod = 12+12;
6668  break;
6669  case 4:
6670  col = 40 + jnorm[ch-4*192];
6671  row = 48 + inorm[ch-4*192];
6672  supmod = 12+12;
6673  break;
6674  case 5:
6675  col = 40 + jnorm[ch-5*192];
6676  row = 24 + inorm[ch-5*192];
6677  supmod = 12+12;
6678  break;
6679  case 6:
6680  col = 48 + jnorm[ch-6*192];
6681  row = inorm[ch-6*192];
6682  supmod = 12+12;
6683  break;
6684  case 7:
6685  col = 65 - jnorm[ch-7*192];
6686  row = 25 - inorm[ch-7*192];
6687  supmod = 12+12;
6688  break;
6689  case 8:
6690  col = 64 + jnorm[ch-8*192];
6691  row = inorm[ch-8*192];
6692  supmod = 12+12;
6693  break;
6694  }
6695  break;
6696  case 8:
6697  case 10:
6698  case 11:
6699  case 12:
6700  switch(zone)
6701  {
6702  case 0:
6703  col = 48 + jnorm[ch];
6704  row = 48 + inorm[ch];
6705  supmod = 12+12;
6706  break;
6707  case 1:
6708  col = 48 + jnorm[ch-192];
6709  row = 24 + inorm[ch-192];
6710  supmod = 12 + 12;
6711  break;
6712  case 2:
6713  col = 48 + jnorm[ch-2*192];
6714  row = inorm[ch-2*192];
6715  supmod = 12 + 12;
6716  break;
6717  case 3:
6718  col = 65 - jnorm[ch-3*192];
6719  row = 25 - inorm[ch-3*192];
6720  supmod = 12+12;
6721  break;
6722  case 4:
6723  col = 65 - jnorm[ch-4*192];
6724  row = 49 - inorm[ch-4*192];
6725  supmod = 12+12;
6726  break;
6727  case 5:
6728  col = 65 - jnorm[ch-5*192];
6729  row = 73 - inorm[ch-5*192];
6730  supmod = 12+12;
6731  break;
6732  case 6:
6733  col = 64 + jnorm[ch-6*192];
6734  row = 48 + inorm[ch-6*192];
6735  supmod = 12+12;
6736  break;
6737  case 7:
6738  col = 64 + jnorm[ch-7*192];
6739  row = 24 + inorm[ch-7*192];
6740  supmod = 12+12;
6741  break;
6742  case 8:
6743  col = 64 + jnorm[ch-8*192];
6744  row = inorm[ch-8*192];
6745  supmod = 12+12;
6746  break;
6747  }
6748  break;
6749  }
6750 }
6751 void StPmdGeom::chain48(Int_t& ch,Int_t& supmod,Int_t& col,Int_t& row,Int_t year)
6752 {
6753  Int_t zone = ch/192;
6754  switch(year){
6755  case 6:
6756 
6757  switch(zone)
6758  {
6759  case 0:
6760  col = 48 + jnorm[ch];
6761  row = 48 + inorm[ch];
6762  supmod = 12+12;
6763  break;
6764  case 1:
6765  col = 65 - jnorm[ch-192];
6766  row = 73 - inorm[ch-192];
6767  supmod = 12+12;
6768  break;
6769  case 2:
6770  col = 64 + jnorm[ch-2*192];
6771  row = 48 + inorm[ch-2*192];
6772  supmod = 12+12;
6773  break;
6774  case 3:
6775  col = 72 + jnorm[ch-3*192];
6776  row = 48 + inorm[ch-3*192];
6777  supmod = 12+12;
6778  break;
6779  case 4:
6780  col = 72 + jnorm[ch-4*192];
6781  row = 24 + inorm[ch-4*192];
6782  supmod = 12+12;
6783  break;
6784  case 5:
6785  col = 89 - jnorm[ch-5*192];
6786  row = 49 - inorm[ch-5*192];
6787  supmod = 12+12;
6788  break;
6789  case 6:
6790  col = 89 - jnorm[ch-6*192];
6791  row = 73 - inorm[ch-6*192];
6792  supmod = 12+12;
6793  break;
6794  case 7:
6795  col = 88 + jnorm[ch-7*192];
6796  row = 48 + inorm[ch-7*192];
6797  supmod = 12+12;
6798  break;
6799  case 8:
6800  col = 88 + jnorm[ch-8*192];
6801  row = 24 + inorm[ch-8*192];
6802  supmod = 12+12;
6803  break;
6804  }
6805  break;
6806  case 8:
6807  case 10:
6808  case 11:
6809  case 12:
6810  switch(zone)
6811  {
6812  case 0:
6813  col = 72 + jnorm[ch];
6814  row = 48 + inorm[ch];
6815  supmod = 12+12;
6816  break;
6817  case 1:
6818  col = 72 + jnorm[ch-192];
6819  row = 24 + inorm[ch-192];
6820  supmod = 12 + 12;
6821  break;
6822  case 2:
6823  col = 72 + jnorm[ch-2*192];
6824  row = inorm[ch-2*192];
6825  supmod = 12 + 12;
6826  break;
6827  case 3:
6828  col = 89 - jnorm[ch-3*192];
6829  row = 25 - inorm[ch-3*192];
6830  supmod = 12+12;
6831  break;
6832  case 4:
6833  col = 89 - jnorm[ch-4*192];
6834  row = 49 - inorm[ch-4*192];
6835  supmod = 12+12;
6836  break;
6837  case 5:
6838  col = 89 - jnorm[ch-5*192];
6839  row = 73 - inorm[ch-5*192];
6840  supmod = 12+12;
6841  break;
6842  case 6:
6843  col = 88 + jnorm[ch-6*192];
6844  row = 48 + inorm[ch-6*192];
6845  supmod = 12+12;
6846  break;
6847  case 7:
6848  col = 88 + jnorm[ch-7*192];
6849  row = 24 + inorm[ch-7*192];
6850  supmod = 12+12;
6851  break;
6852  case 8:
6853  col = 88 + jnorm[ch-8*192];
6854  row = inorm[ch-8*192];
6855  supmod = 12+12;
6856  break;
6857  }
6858  break;
6859  }
6860 }
6861 
6862 void StPmdGeom::drawPMDXY(Int_t firstchain,Int_t lastchain, Int_t runno){
6864  readBoardDetail(runno);
6865 
6866  Int_t rn=0,year=0;
6867  GetRunYear(runno,rn,year);
6868  cout<<"runnumber = "<<rn<<" year="<<year<<endl;
6869 
6870  char histname[20];
6871  char gifname[20];
6872  if (firstchain<25){
6873  sprintf(histname,"CPVXY%d",runno);
6874  sprintf(gifname,"CPVXY%d.gif",runno);
6875  }else{
6876  sprintf(histname,"PMDXY%d",runno);
6877  sprintf(gifname,"PMDXY%d.gif",runno);
6878  }
6879  TH2F * hpmdXY = new TH2F("hpmdXY",histname,100,-135,135,100,-135,135);
6880  TCanvas *pmdC2 = new TCanvas("pmdC2","PMDXY canvas",800,800);
6881  hpmdXY->SetStats(kFALSE);
6882  pmdC2->cd(1);
6883  hpmdXY->Draw("pmdC2");
6884 
6885  Int_t sm=0,row=0,col=0,chmod=-1;
6886  Int_t bmax[49];
6887  for(Int_t chain=1;chain<49;chain++){
6888  bmax[chain]=27;
6889 
6890  if (year==8){
6891  if(chain==1 || chain==7 || chain==19 || chain==20 ||
6892  chain==23 || chain==24)
6893  {bmax[chain]=36;}
6894  }
6895  if(year==10||year==11||year==12){
6896  if(chain==8||chain==12||chain==23||chain==24){bmax[chain]=36;}
6897  }
6898  }
6899  for (Int_t chain=firstchain;chain<=lastchain;chain++){
6900  // cout<<"Drawing chain="<<chain<<" with "<<bmax[chain]<<" mapped boards"<<endl;
6901  // Int_t workingchannel = 0;
6902  for(Int_t chan = 0;chan<27*64;chan++){
6903  Int_t mapcheck;
6904  if (year==5){
6905  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod);
6906  }else{
6907  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod,year);
6908  }
6909 
6910  if(mapcheck==kStOK && sm>0){
6911  Float_t xreal = 0, yreal =0, eta=0,phi=0;
6912  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
6913  // cout<<"chain,chan,sm,chmod,mapcheck="<<chain<<","<<chan<<","<<sm<<","<<chmod<<","<<mapcheck<<" "<<xreal<<" / "<<yreal<<" "<<eta<<" / "<<phi<<endl;
6914  hpmdXY->Fill(xreal,yreal);
6915  }
6916  }
6917  }
6918  pmdC2->Print(gifname,"gif");
6919 }
6920 
6921 void StPmdGeom::drawPMDetaphi(Int_t firstchain,Int_t lastchain, Int_t runno){
6923  readBoardDetail(runno);
6924 
6925  Int_t rn=0,year=0;
6926  GetRunYear(runno,rn,year);
6927  cout<<"runnumber = "<<rn<<" year="<<year<<endl;
6928 
6929  char histname[20];
6930  char gifname[20];
6931  if (firstchain<25){
6932  sprintf(histname,"CPVetaphi%d",runno);
6933  sprintf(gifname,"CPVetaphi%d.gif",runno);
6934  }else{
6935  sprintf(histname,"PMDetaphi%d",runno);
6936  sprintf(gifname,"PMDetaphi%d.gif",runno);
6937  }
6938  TH2F * hpmdetaphi = new TH2F("hpmdetaphi",histname,40,-4.0,-2.0,180,-1.0*TMath::Pi(),TMath::Pi());
6939  TCanvas *pmdC3 = new TCanvas("pmdC3","PMDetaphi canvas",800,800);
6940  hpmdetaphi->SetStats(kFALSE);
6941  pmdC3->cd(1);
6942  hpmdetaphi->Draw("pmdC3");
6943 
6944  Int_t sm,row,col,chmod;
6945  Int_t bmax[49];
6946  for(Int_t chain=1;chain<49;chain++){
6947  bmax[chain]=27;
6948 
6949  if (year==8){
6950  if(chain==1 || chain==7 || chain==19 || chain==20 ||
6951  chain==23 || chain==24)
6952  {bmax[chain]=36;}
6953  }
6954  if(year==10||year==11||year==12){
6955  if(chain==8||chain==12||chain==23||chain==24){bmax[chain]=36;}
6956  }
6957  }
6958  for (Int_t chain=firstchain;chain<=lastchain;chain++){
6959  // cout<<"Drawing chain="<<chain<<" with "<<bmax[chain]<<" mapped boards"<<endl;
6960  // Int_t workingchannel = 0;
6961  for(Int_t chan = 0;chan<27*64;chan++){
6962  Int_t mapcheck;
6963  if (year==5){
6964  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod);
6965  }else{
6966  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod,year);
6967  }
6968 
6969  if(mapcheck==kStOK && sm>0){
6970  Float_t xreal = 0, yreal =0, eta=0,phi=0;
6971  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
6972  // cout<<"chain,chan,sm,chmod,mapcheck="<<chain<<","<<chan<<","<<sm<<","<<chmod<<","<<mapcheck<<" "<<xreal<<" / "<<yreal<<" "<<eta<<" / "<<phi<<endl;
6973  hpmdetaphi->Fill(eta,phi);
6974  }
6975  }
6976  }
6977  pmdC3->Print(gifname,"gif");
6978 }
6979 
6980 void StPmdGeom::drawPMD(Int_t firstchain,Int_t lastchain, Int_t runno){
6982  readBoardDetail(runno);
6983 
6984  Int_t rn=0,year=0;
6985  GetRunYear(runno,rn,year);
6986  // cout<<"runnumber = "<<rn<<" year="<<year<<endl;
6987 
6988  char histname[20];
6989  char gifname[20];
6990  if (firstchain<25){
6991  sprintf(histname,"CPV%d",runno);
6992  sprintf(gifname,"CPV%d.gif",runno);
6993  }else{
6994  sprintf(histname,"PMD%d",runno);
6995  sprintf(gifname,"PMD%d.gif",runno);
6996  }
6997  // TH2F *hpmdxy = new TH2F("hpmdxy","NEW CPV CHAINS ",100,-135,135,100,-135,135);
6998  TH2F * hpmdxy = new TH2F("hpmdxy",histname,100,-135,135,100,-135,135);
6999  TCanvas *pmdC = new TCanvas("pmdC","PMD canvas",800,800);
7000  hpmdxy->SetStats(kFALSE);
7001  pmdC->cd(1);
7002  hpmdxy->Draw("pmdC");
7003  Int_t sm,row,col,chmod;
7004  Float_t xcon[5],ycon[5];
7005  Int_t icorner=0;
7006  Int_t bmax[49];
7007  for(Int_t chain=1;chain<49;chain++){
7008  bmax[chain]=27;
7009 
7010  if (year==8){
7011  if(chain==1 || chain==7 || chain==19 || chain==20 ||
7012  chain==23 || chain==24)
7013  {bmax[chain]=36;}
7014  }
7015  if(year==10||year==11||year==12){
7016  if(chain==8||chain==12||chain==23||chain==24){bmax[chain]=36;}
7017  }
7018  }
7019  for (Int_t chain=firstchain;chain<=lastchain;chain++){
7020  // cout<<"Drawing chain="<<chain<<" with "<<bmax[chain]<<" mapped boards"<<endl;
7021  Int_t workingboard = 0;
7022  Float_t xboard[27],yboard[27];
7023  Int_t workingchannel = 0;
7024  // for(Int_t chan = 0;chan<bmax[chain]*64;chan++){
7025  for(Int_t chan = 0;chan<27*64;chan++){
7026  Int_t mapcheck;
7027  if (year==5){
7028  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod);
7029  }else{
7030  mapcheck = ChainMapping(chain,chan,sm,col,row,chmod,year);
7031  }
7032 
7033  // cout<<"chain,chan,sm,chmod,mapcheck="<<chain<<","<<chan<<","<<sm<<","<<chmod<<","<<mapcheck<<endl;
7034  if(mapcheck==kStOk && sm > 0){
7035  // cout<<chain<<","<<chan<<","<<sm<<","<<row<<","<<col<<","<<icorner<<endl;
7036  DrawRhombus(chain,chan,sm,row,col,icorner,xcon,ycon);
7037  if(icorner==4){
7038  xboard[workingboard]=0;
7039  yboard[workingboard]=0;
7040  for(Int_t i=0;i<4;i++){
7041  xboard[workingboard]=xboard[workingboard]+xcon[i];
7042  yboard[workingboard]=yboard[workingboard]+ycon[i];
7043  // if(chain==24) cout<<"chain24,xycon="<<xcon[i]<<","<<ycon[i]<<endl;
7044  }
7045  xboard[workingboard]=xboard[workingboard]/4;
7046  yboard[workingboard]=yboard[workingboard]/4;
7047  // cout<<"board# = "<<workingboard<<" x,y="<<xboard[workingboard]<<","<<yboard[workingboard]<<endl;
7048  workingboard++;
7049  icorner = 0;
7050  }
7051  // if (icorner>0) cout<<"icorner="<<icorner<<endl;
7052  workingchannel++;
7053  }
7054  // if(chan==(bmax[chain]*192-1))cout<<"working channels are "<<workingchannel<<endl;
7055  }
7056  if(workingboard>0){
7057  //chmod==(bmax[chain]*192-1)){
7058  cout<<"working channels are "<<workingchannel<<endl;
7059  cout<<"working boards are "<<workingboard<<endl;
7060  // TPolyLine * dchain = new TPolyLine(workingboard,xboard,yboard);
7061  TPolyLine * dchain;
7062  if (chain>24){
7063  Float_t xmboard[27];
7064  for(Int_t ib=0;ib<27;ib++){xmboard[ib]=-1*xboard[ib];}
7065  dchain = new TPolyLine(workingboard,xmboard,yboard);
7066  }else{
7067  dchain = new TPolyLine(workingboard,xboard,yboard);
7068  }
7069  dchain->SetLineWidth(2);
7070  dchain->SetLineColor(2);
7071  dchain->Draw();
7072  char chainnum[3];
7073  sprintf(chainnum,"%d",chain);
7074  if (chain>24){
7075  TLatex* chainno = new TLatex(-xboard[0]+1,yboard[0]+1,chainnum);
7076  TMarker * startchain = new TMarker(-xboard[0],yboard[0],20);
7077  startchain->SetMarkerColor(2);
7078  startchain->Draw();
7079  chainno->SetTextSize(0.04);
7080  chainno->Draw();
7081  }else{
7082  TLatex* chainno = new TLatex(xboard[0]+1,yboard[0]+1,chainnum);
7083  TMarker * startchain = new TMarker(xboard[0],yboard[0],20);
7084  startchain->SetMarkerColor(2);
7085  startchain->Draw();
7086  chainno->SetTextSize(0.05);
7087  chainno->Draw();
7088  }
7089  }
7090  }
7091  pmdC->Print(gifname,"gif");
7092 
7093 }
7094 
7095 void StPmdGeom::DrawRhombus(Int_t chain,Int_t chan,Int_t sm, Int_t row, Int_t col, Int_t& icorner,Float_t* xcon,Float_t* ycon)
7096 {
7097  Float_t xreal,yreal,eta,phi;
7098  if(row%8==1 && col%8==1){
7099  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
7100  xcon[0]=xreal;ycon[0]=yreal;
7101  xcon[4]=xreal;ycon[4]=yreal;
7102  icorner++;
7103  }
7104  if(row%8==1 && col%8==0){
7105  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
7106  xcon[1]=xreal;ycon[1]=yreal;
7107  icorner++;
7108  }
7109  if(row%8==0 && col%8==0){
7110  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
7111  xcon[2]=xreal;ycon[2]=yreal;
7112  icorner++;
7113  }
7114  if(row%8==0 && col%8==1){
7115  IntDetCell_xy(sm,row,col,xreal,yreal,eta,phi);
7116  xcon[3]=xreal; ycon[3]=yreal;
7117  icorner++;
7118  }
7119  if(icorner==4){
7120  // Int_t brd=int((chan)/64)+1;
7121  // TPolyLine * rhombus = new TPolyLine(5,xcon,ycon);
7122  //--------------------------
7123  // To draw a mirror image of PMD if chain>24 so that the image is
7124  // as seen from the tunnel and not from the vertex.
7125  // This leaves the image of CPV unchanged
7126  Float_t xrhomb[5];
7127  TPolyLine * rhombus;
7128  if (chain>24){
7129  for(Int_t rh=0;rh<=5;rh++){xrhomb[rh]=-1*xcon[rh];}
7130  rhombus = new TPolyLine(5,xrhomb,ycon);
7131  }else{
7132  rhombus = new TPolyLine(5,xcon,ycon);
7133  }
7134  //----------------------------
7135  rhombus->SetLineWidth(1);
7136  rhombus->SetLineColor(1);
7137  // cout<<"chain="<<chain<<" brd="<<brd<<" status="<<status[chain-1][brd]<<endl;
7138  /*
7139  if (status[chain-1][brd]==0)
7140  {
7141  rhombus->SetLineColor(43);
7142  rhombus->SetLineWidth(1);
7143  }
7144  */
7145  rhombus->Draw();
7146  // icorner=0;
7147  }
7148 }
7149 
7150 void StPmdGeom::GetRunYear(Int_t runno,Int_t&rn,Int_t&year){
7151 
7152  // returns the year number(year) and the day number(rn)
7153 
7154  year = Int_t(runno/1000000);
7155  Int_t rest = runno-year*1000000;
7156  rn = Int_t(rest/1000);
7157 
7158  // cout<<"rn="<<rn<<" year="<<year<<endl;
7159 }
7160 
7161 Int_t StPmdGeom::GetNBoardsChain(Int_t chain){
7162 
7163  Int_t aliveboard = 0;
7164  for(Int_t i=0;i<36;i++){
7165  if (status[chain-1][i]==1) aliveboard++;
7166  }
7167  // cout<<"aliveboards in chain "<<chain<<" are "<<aliveboard<<endl;
7168  return aliveboard;
7169 
7170 }
7171 
7172 void StPmdGeom::GetNBoardsSM(Int_t year , Int_t * aliveboard){
7173 
7174  Int_t channel;
7175  // Int_t aliveboard[24];
7176  for(Int_t i=0;i<24;i++){
7177  aliveboard[i] = 0;
7178  }
7179 
7180  for(Int_t chain = 1;chain<=48;chain++){
7181  for(Int_t brd = 0;brd<27;brd++){
7182  channel = brd*64 + 10; // 10th channel of every board is studied
7183  Int_t supmod,col,row,chmod;
7184  Int_t mapcheck;
7185  if (year==5){
7186  mapcheck = ChainMapping(chain,channel,supmod,col,row,chmod);
7187  }else{
7188  mapcheck = ChainMapping(chain,channel,supmod,col,row,chmod,year);
7189  }
7190  if(mapcheck==kStOk && supmod > 0) {
7191  aliveboard[supmod-1]++;
7192  }
7193  }
7194  }
7195  // return aliveboard;
7196 }
void drawPMDetaphi(Int_t, Int_t, Int_t)
Definition: StPmdGeom.cxx:6921
virtual ~StPmdGeom()
A constructor.
Definition: StPmdGeom.cxx:196
void Sim2Detmap(Int_t &, Int_t &, Int_t &)
function for convering supermodule,row,col (from GEANT) to supermodule,row,col as in hardware...
Definition: StPmdGeom.cxx:300
void Cell_eta_phi(Float_t, Float_t, Float_t &, Float_t &)
function for calculating eta,phi from x, y
Definition: StPmdGeom.cxx:285
void DetCell_xy(Int_t, Float_t, Float_t, Float_t &, Float_t &, Float_t &, Float_t &)
function for converting supermodule,row,col to x,y,eta,phi after conversionfrom 17 to 12 supermodule ...
Definition: StPmdGeom.cxx:227
StPmdGeom()
A constructor.
Definition: StPmdGeom.cxx:189
void Cell_xy(Int_t, Int_t, Int_t, Float_t &, Float_t &, Float_t &, Float_t &)
function for converting supermodule,row,col to x,y position,eta and phi values of the cell ...
Definition: StPmdGeom.cxx:205
Int_t NModule(Int_t, Int_t, Int_t &)
A destructor.
Definition: StPmdGeom.cxx:199
Definition: Stypes.h:42
Definition: Stypes.h:40
void drawPMDXY(Int_t, Int_t, Int_t)
Definition: StPmdGeom.cxx:6862
Definition: Stypes.h:41
void drawPMD(Int_t, Int_t, Int_t)
Definition: StPmdGeom.cxx:6980
void IntDetCell_xy(Int_t, Int_t, Int_t, Float_t &, Float_t &, Float_t &, Float_t &)
function for converting supermodule,row,col to x,y,eta,phi after conversionfrom 17 to 12 supermodule ...
Definition: StPmdGeom.cxx:254