CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Alignment/MuonAlignmentAlgorithms/src/ReadPGInfo.cc

Go to the documentation of this file.
00001 #include "Alignment/MuonAlignmentAlgorithms/interface/ReadPGInfo.h"
00002 
00003 /*
00004 static char mapping[][2][20] = {
00005   {"351010100300001", "351010100300001"},
00006   {"351010100300002", "351010100300002"},
00007   {"351010100300003", "351010100400003"},
00008   {"351010100300004", "351010100400004"},
00009   {"351010100300005", "351010100300005"},
00010   {"351010100300006", "351010100400006"},
00011   {"351010100300024", "351010100300024"},
00012   {"351010100300027", "351010100400027"},
00013   {"351010100300039", "351010100300039"},
00014   {"351010100300040", "351010100400040"},
00015   {"351010100300041", "351010100400041"},
00016   {"351010100300042", "351010100400042"},
00017   {"351010100300043", "351010100400043"},
00018   {"351010100300045", "351010100300045"},
00019   {"351010100300054", "351010100400054"},
00020   {"351010100300055", "351010100400055"},
00021   {"351010100300056", "351010100300056"},
00022   {"351010100300057", "351010100300057"},
00023   {"351010100300058", "351010100300058"},
00024   {"351010100300059", "351010100300059"},
00025   {"351010100300060", "351010100400060"},
00026   {"351010100300061", "351010100300061"},
00027   {"351010100300062", "351010100300062"},
00028   {"351010100300063", "351010100400063"},
00029   {"351010100300064", "351010100400064"},
00030   {"351010100300065", "351010100300065"},
00031   {"351010100300066", "351010100400066"},
00032   {"351010100300068", "351010100300068"},
00033   {"351010100300073", "351010100300073"},
00034   {"351010100300074", "351010100400074"},
00035   {"351010100100007", "351010100100007"},
00036   {"351010100100008", "351010100200008"},
00037   {"351010100100009", "351010100100009"},
00038   {"351010100100010", "351010100200010"},
00039   {"351010100100011", "351010100100011"},
00040   {"351010100100012", "351010100100012"},
00041   {"351010100100013", "351010100200013"},
00042   {"351010100100014", "351010100100014"},
00043   {"351010100100015", "351010100200015"},
00044   {"351010100100016", "351010100100016"},
00045   {"351010100100017", "351010100100017"},
00046   {"351010100100018", "351010100100018"},
00047   {"351010100100019", "351010100200019"},
00048   {"351010100100020", "351010100200020"},
00049   {"351010100100021", "351010100100021"},
00050   {"351010100100022", "351010100200022"},
00051   {"351010100100023", "351010100100023"},
00052   {"351010100100025", "351010100200025"},
00053   {"351010100100028", "351010100200028"},
00054   {"351010100100035", "351010100100035"},
00055   {"351010100100037", "351010100200037"},
00056   {"351010100100038", "351010100100038"},
00057   {"351010100100044", "351010100200044"},
00058   {"351010100100053", "351010100200053"},
00059   {"351010100100067", "351010100100067"},
00060   {"351010100100069", "351010100200069"},
00061   {"351010100100070", "351010100200070"},
00062   {"351010100100072", "351010100100072"},
00063   {"351010101500051", "351010101300051"},
00064   {"351010101500052", "351010101500052"},
00065   {"351010103500029", "351010103500029"},
00066   {"351010103500030", "351010103500030"},
00067   {"351010103500031", "351010103600031"},
00068   {"351010103500032", "351010103600032"},
00069   {"351010103500033", "351010103600033"},
00070   {"351010103500046", "351010103600046"},
00071   {"351010103500047", "351010103500047"},
00072   {"351010103500048", "351010103500048"},
00073   {"351010103500049", "351010103600049"},
00074   {"351010103500050", "351010103500050"},
00075   {"351010103500075", "351010103600075"},
00076   {"351030101700054", "351030101700054"},
00077   {"351030101900053", "351030101900053"},
00078   {"351030100700009", "351030100800009"},
00079   {"351030100700010", "351030100700010"},
00080   {"351030100700011", "351030100700011"},
00081   {"351030100700013", "351030100700013"},
00082   {"351030100700016", "351030100700016"},
00083   {"351030100700028", "351030100700028"},
00084   {"351030100700042", "351030100700042"},
00085   {"351030100700043", "351030100700043"},
00086   {"351030100700060", "351030100800060"},
00087   {"351030100700065", "351030100700065"},
00088   {"351030100700067", "351030100700067"},
00089   {"351030100700068", "351030100700068"},
00090   {"351030100700069", "351030100700069"},
00091   {"351030100700072", "351030100800072"},
00092   {"351030100700073", "351030100800073"},
00093   {"351030100700074", "351030100800074"},
00094   {"351030100800012", "351030100800012"},
00095   {"351030100800014", "351030100700014"},
00096   {"351030100800015", "351030100800015"},
00097   {"351030100800027", "351030100800027"},
00098   {"351030100800041", "351030100800041"},
00099   {"351030100800044", "351030100800044"},
00100   {"351030100800051", "351030100800051"},
00101   {"351030100800059", "351030100800059"},
00102   {"351030100800062", "351030100800062"},
00103   {"351030100800066", "351030100800066"},
00104   {"351030100800070", "351030100800070"},
00105   {"351030100800071", "351030100800071"},
00106   {"351030100500001", "351030100500001"},
00107   {"351030100500002", "351030100500002"},
00108   {"351030100500004", "351030100500004"},
00109   {"351030100500005", "351030100500005"},
00110   {"351030100500006", "351030100600006"},
00111   {"351030100500007", "351030100500007"},
00112   {"351030100500017", "351030100500017"},
00113   {"351030100500019", "351030100500019"},
00114   {"351030100500021", "351030100500021"},
00115   {"351030100500023", "351030100500023"},
00116   {"351030100500025", "351030100500025"},
00117   {"351030100500039", "351030100500039"},
00118   {"351030100500040", "351030100500040"},
00119   {"351030100500063", "351030100600063"},
00120   {"351030100500064", "351030100600064"},
00121   {"351030100600003", "351030100600003"},
00122   {"351030100600008", "351030100600008"},
00123   {"351030100600018", "351030100600018"},
00124   {"351030100600020", "351030100600020"},
00125   {"351030100600022", "351030100600022"},
00126   {"351030100600024", "351030100600024"},
00127   {"351030100600026", "351030100600026"},
00128   {"351030100600035", "351030100600035"},
00129   {"351030100600036", "351030100600036"},
00130   {"351030100600049", "351030100600049"},
00131   {"351030103700033", "351030103700033"},
00132   {"351030103800032", "351030103800032"},
00133   {"351030103800034", "351030103800034"},
00134   {"351030103800057", "351030103800057"},
00135   {"351030103900058", "351030103700058"},
00136   {"351030103700056", "351030103900056"},
00137   {"351030103900031", "351030103900031"},
00138   {"351030104000029", "351030104000029"},
00139   {"351030104000030", "351030104000030"},
00140   {"351030104000055", "351030104000055"},
00141   {"35102010xx00008", "351020101000008"},
00142   {"35102010xx00009", "351020101200009"},
00143   {"35102010yy00001", "351020101200001"},
00144   {"35102010yy00002", "351020100900002"},
00145   {"35102010yy00003", "351020101200003"},
00146   {"35102010yy00004", "351020101200004"},
00147   {"35102010yy00005", "351020101100005"},
00148   {"35102010yy00006", "351020101000006"},
00149   {"35102010yy00007", "351020101100007"},
00150   {"35102010yy00010", "351020100900010"},
00151   {"35102010yy00011", "351020101100011"},
00152   {"35102010yy00012", "351020101000012"},
00153   {"35102010yy00013", "351020101100013"},
00154   {"35102010yy00014", "351020100900014"},
00155   {"35102010yy00015", "351020101200015"},
00156   {"35102010yy00017", "351020101100017"},
00157   {"35102010yy00018", "351020101000018"},
00158   {"35102010yy00020", "351020101000020"},
00159   {"35102010yy00021", "351020101200021"},
00160   {"35102010yy00022", "351020100900022"},
00161   {"35102010yy00023", "351020101200023"},
00162   {"35102010yy00024", "351020100900024"},
00163   {"35102010yy00025", "351020101100025"},
00164   {"35102010yy00026", "351020101000026"},
00165   {"35102010yy00027", "351020101100027"},
00166   {"35102010yy00028", "351020100900028"},
00167   {"35102010yy00029", "351020101200029"},
00168   {"35102010yy00030", "351020100900030"},
00169   {"35102010yy00031", "351020101100031"},
00170   {"35102010yy00032", "351020101000032"},
00171   {"35102010yy00033", "351020101200033"},
00172   {"35102010yy00034", "351020100900034"},
00173   {"35102010yy00035", "351020101100035"},
00174   {"35102010yy00036", "351020101000036"},
00175   {"35102010yy00037", "351020101200037"},
00176   {"35102010yy00038", "351020100900038"},
00177   {"35102010yy00039", "351020101200039"},
00178   {"35102010yy00040", "351020100900040"},
00179   {"35102010yy00041", "351020101100041"},
00180   {"35102010yy00042", "351020101000042"},
00181   {"35102010yy00043", "351020101200043"},
00182   {"35102010yy00044", "351020101000044"},
00183   {"35102010yy00045", "351020101100045"},
00184   {"35102010yy00046", "351020100900046"},
00185   {"35102010yy00047", "351020101100047"},
00186   {"35102010yy00048", "351020100900048"},
00187   {"35102010yy00049", "351020101200049"},
00188   {"35102010yy00050", "351020101000050"},
00189   {"35102010yy00051", "351020101100051"},
00190   {"35102010yy00052", "351020100900052"},
00191   {"35102010yy00053", "351020101200053"},
00192   {"35102010yy00055", "351020101200055"},
00193   {"35102010yy00056", "351020101000056"},
00194   {"35102010yy00057", "351020101100057"},
00195   {"35102010yy00058", "351020101000058"},
00196   {"35102010yy00059", "351020101200059"},
00197   {"35102010yy00060", "351020100900060"},
00198   {"351040102500003", "351040102500003"},
00199   {"351040102500006", "351040102500006"},
00200   {"351040102500015", "351040102700015"},
00201   {"351040102500016", "351040102500016"},
00202   {"351040102500021", "351040102500021"},
00203   {"351040102500023", "351040102500023"},
00204   {"351040102500025", "351040102500025"},
00205   {"351040102600004", "351040102600004"},
00206   {"351040102600008", "351040102600008"},
00207   {"351040102600010", "351040102600010"},
00208   {"351040102600011", "351040102600011"},
00209   {"351040102600014", "351040102600014"},
00210   {"351040102600018", "351040102600018"},
00211   {"351040102600019", "351040102600019"},
00212   {"351040102600028", "351040102600028"},
00213   {"351040102600030", "351040102600030"},
00214   {"351040102700002", "351040102700002"},
00215   {"351040102700005", "351040102700005"},
00216   {"351040102700013", "351040102700013"},
00217   {"351040102700020", "351040102700020"},
00218   {"351040102700026", "351040102700026"},
00219   {"351040102700027", "351040102700027"},
00220   {"351040102700031", "351040102700031"},
00221   {"351040102800001", "351040102800001"},
00222   {"351040102800007", "351040102800007"},
00223   {"351040102800009", "351040102800009"},
00224   {"351040102800012", "351040102800012"},
00225   {"351040102800017", "351040102800017"},
00226   {"351040102800022", "351040102800022"},
00227   {"351040102800024", "351040102800024"},
00228   {"351040102800029", "351040102800029"},
00229   {"351040103100004", "351040103100004"},
00230   {"351040103100006", "351040103100006"},
00231   {"351040103100009", "351040103000009"},
00232   {"351040103100010", "351040103100010"},
00233   {"351040103200001", "351040103200001"},
00234   {"351040103200008", "351040103200008"},
00235   {"351040103300003", "351040103300003"},
00236   {"351040103300005", "351040103300005"},
00237   {"351040103400002", "351040103400002"},
00238   {"351040103400007", "351040103400007"},
00239   {"351040104100001", "351040104100001"}};
00240 
00241 */
00242 
00243 static char chambers[TOTALCHAMBERS][20] = {
00244   "351010100100009",
00245   "351010100100016",
00246   "351010100100014",
00247   "351010100100017",
00248   "351010100100011",
00249   "351010100100038",
00250   "351010100100035",
00251   "351010100100023",
00252   "351010100100036",
00253   "351010100100072",
00254   "351010100200013",
00255   "351010100200015",
00256   "351010100200020",
00257   "351010100200019",
00258   "351010100200010",
00259   "351010100200025",
00260   "351010100200037",
00261   "351010100200028",
00262   "351010100200034",
00263   "351010100200022",
00264   "351010100200070",
00265   "351010100300002",
00266   "351010100300061",
00267   "351030100500025",
00268   "351030100500019",
00269   "351030100500017",
00270   "351030100500021",
00271   "351030100500023",
00272   "351030100500038",
00273   "351030100500039",
00274   "351030100500047",
00275   "351030100500040",
00276   "351030100500001",
00277   "351030100600020",
00278   "351030100600026",
00279   "351030100600006",
00280   "351030100600024",
00281   "351030100600022",
00282   "351030100600018",
00283   "351030100600036",
00284   "351030100600035",
00285   "351030100600049",
00286   "351030100600046",
00287   "351030100600048",
00288   "351030100700014",
00289   "351030100710065",
00290   "351030100800009",
00291   "351020100900010",
00292   "351020100900014",
00293   "351020100900028",
00294   "351020100900030",
00295   "351020100900024",
00296   "351020100900022",
00297   "351020100900034",
00298   "351020100900040",
00299   "351020100900046",
00300   "351020101000018",
00301   "351020101000016",
00302   "351020101000008",
00303   "351020101000006",
00304   "351020101000012",
00305   "351020101000004",
00306   "351020101000032",
00307   "351020101000020",
00308   "351020101000026",
00309   "351020101000042",
00310   "351020101200001",
00311   "351010101300051",
00312   "351030101700054",
00313   "351020102100002",
00314   "351040102500003",
00315   "351040102500006",
00316   "351040102600004",
00317   "351040102600010",
00318   "351040102600030",
00319   "351040102700002",
00320   "351040102700005",
00321   "351040102700031",
00322   "351040102800001",
00323   "351040102800007",
00324   "351020103000004",
00325   "351020103000003",
00326   "351020103000009",
00327   "351040103100004",
00328   "351040103200001",
00329   "351040103300003",
00330   "351040103400002",
00331   "351010103600075",
00332   "351030103700033",
00333   "351030103800034",
00334   "351030103900031",
00335   "351030104000030",
00336   "351020104200001",
00337   "351020104200002",
00338   "351010100100018",
00339   "351010100100012",
00340   "351010100100007",
00341   "351010100100021",
00342   "351010100100067",
00343   "351010100200008",
00344   "351010100200053",
00345   "351010100200044",
00346   "351010100200069",
00347   "351010100200071",
00348   "351010100300005",
00349   "351010100300001",
00350   "351010100300024",
00351   "351010100300039",
00352   "351010100300045",
00353   "351010100300042",
00354   "351010100300056",
00355   "351010100300058",
00356   "351010100300059",
00357   "351010100300062",
00358   "351010100300065",
00359   "351010100300068",
00360   "351010100300073",
00361   "351010100300057",
00362   "351010100400003",
00363   "351010100400004",
00364   "351010100400006",
00365   "351010100400027",
00366   "351010100400026",
00367   "351010100400043",
00368   "351010100400041",
00369   "351010100400040",
00370   "351010100400055",
00371   "351010100400064",
00372   "351010100400060",
00373   "351010100400063",
00374   "351010100400054",
00375   "351010100400066",
00376   "351010100400074",
00377   "351030100500007",
00378   "351030100500005",
00379   "351030100500002",
00380   "351030100500004",
00381   "351030100500045",
00382   "351030100600008",
00383   "351030100600037",
00384   "351030100600003",
00385   "351030100600064",
00386   "351030100600063",
00387   "351030100700016",
00388   "351030100700028",
00389   "351030100700013",
00390   "351030100700010",
00391   "351030100700011",
00392   "351030100700042",
00393   "351030100700043",
00394   "351030100700050",
00395   "351030100700052",
00396   "351030100700061",
00397   "351030100700067",
00398   "351030100700068",
00399   "351030100700069",
00400   "351030100700065",
00401   "351030100800015",
00402   "351030100800027",
00403   "351030100800012",
00404   "351030100800041",
00405   "351030100800044",
00406   "351030100800051",
00407   "351030100800059",
00408   "351030100800060",
00409   "351030100800062",
00410   "351030100800066",
00411   "351030100800072",
00412   "351030100800073",
00413   "351030100800071",
00414   "351030100800074",
00415   "351030100800070",
00416   "351020100900002",
00417   "351020100900038",
00418   "351020100900048",
00419   "351020100900052",
00420   "351020100900060",
00421   "351020101000044",
00422   "351020101000036",
00423   "351020101000050",
00424   "351020101000056",
00425   "351020101000058",
00426   "351020101100005",
00427   "351020101100007",
00428   "351020101100011",
00429   "351020101100017",
00430   "351020101100013",
00431   "351020101100025",
00432   "351020101100027",
00433   "351020101100031",
00434   "351020101100035",
00435   "351020101100041",
00436   "351020101100045",
00437   "351020101100047",
00438   "351020101100051",
00439   "351020101100057",
00440   "351020101200009",
00441   "351020101200003",
00442   "351020101200021",
00443   "351020101200015",
00444   "351020101200023",
00445   "351020101200019",
00446   "351020101200033",
00447   "351020101200029",
00448   "351020101200037",
00449   "351020101200039",
00450   "351020101200049",
00451   "351020101200053",
00452   "351020101200055",
00453   "351020101200043",
00454   "351020101200059",
00455   "351010101500052",
00456   "351030101900053",
00457   "351020102300001",
00458   "351040102500016",
00459   "351040102500023",
00460   "351040102500021",
00461   "351040102500025",
00462   "351040102600008",
00463   "351040102600011",
00464   "351040102600014",
00465   "351040102600018",
00466   "351040102600019",
00467   "351040102600028",
00468   "351040102700013",
00469   "351040102700015",
00470   "351040102700026",
00471   "351040102700020",
00472   "351040102700027",
00473   "351040102800009",
00474   "351040102800012",
00475   "351040102800017",
00476   "351040102800024",
00477   "351040102800022",
00478   "351040102800029",
00479   "351020102900002",
00480   "351020102900001",
00481   "351020102900005",
00482   "351020102900006",
00483   "351020103000008",
00484   "351020103000007",
00485   "351040103100006",
00486   "351040103100010",
00487   "351040103200008",
00488   "351040103300005",
00489   "351040103300009",
00490   "351040103400007",
00491   "351010103500030",
00492   "351010103500029",
00493   "351010103500048",
00494   "351010103500050",
00495   "351010103500047",
00496   "351010103600031",
00497   "351010103600032",
00498   "351010103600033",
00499   "351010103600049",
00500   "351010103600046",
00501   "351030103700058",
00502   "351030103800032",
00503   "351030103800057",
00504   "351030103900056",
00505   "351030104000029",
00506   "351030104000055",
00507   "351040104100001"};
00508 
00509 static int position[TOTALCHAMBERS][3] = {
00510   {2, 3, 1},
00511   {2, 5, 1},
00512   {2, 9, 1},
00513   {2, 11, 1},
00514   {1, 2, 1},
00515   {1, 6, 1},
00516   {1, 12, 1},
00517   {1, 10, 1},
00518   {1, 8, 1},
00519   {0, 0, 0},
00520   {2, 6, 1},
00521   {2, 10, 1},
00522   {2, 12, 1},
00523   {1, 5, 1},
00524   {2, 8, 1},
00525   {1, 11, 1},
00526   {1, 3, 1},
00527   {2, 2, 1},
00528   {2, 4, 1},
00529   {1, 9, 1},
00530   {0, 0, 0},
00531   {0, 0, 0},
00532   {0, 0, 0},
00533   {1, 8, 2},
00534   {2, 5, 2},
00535   {2, 11, 2},
00536   {1, 12, 2},
00537   {2, 9, 2},
00538   {1, 6, 2},
00539   {1, 2, 2},
00540   {2, 3, 2},
00541   {1, 10, 2},
00542   {0, 0, 0},
00543   {1, 9, 2},
00544   {2, 12, 2},
00545   {0, 0, 0},
00546   {2, 10, 2},
00547   {2, 8, 2},
00548   {1, 11, 2},
00549   {1, 5, 2},
00550   {1, 3, 2},
00551   {2, 6, 2},
00552   {2, 2, 2},
00553   {2, 4, 2},
00554   {0, 0, 0},
00555   {0, 0, 0},
00556   {0, 0, 0},
00557   {1, 10, 3},
00558   {2, 5, 3},
00559   {1, 6, 3},
00560   {2, 3, 3},
00561   {2, 11, 3},
00562   {1, 2, 3},
00563   {2, 9, 3},
00564   {1, 8, 3},
00565   {1, 12, 3},
00566   {2, 2, 3},
00567   {2, 12, 3},
00568   {2, 8, 3},
00569   {1, 5, 3},
00570   {2, 10, 3},
00571   {2, 6, 3},
00572   {2, 4, 3},
00573   {1, 11, 3},
00574   {1, 9, 3},
00575   {1, 3, 3},
00576   {0, 0, 0},
00577   {1, 4, 1},
00578   {1, 4, 2},
00579   {1, 4, 3},
00580   {2, 5, 4},
00581   {1, 6, 4},
00582   {2, 6, 4},
00583   {1, 5, 4},
00584   {0, 0, 0},
00585   {2, 3, 4},
00586   {1, 2, 4},
00587   {0, 0, 0},
00588   {2, 2, 4},
00589   {1, 3, 4},
00590   {2, 4, 4},
00591   {2, 13, 4},
00592   {0, 0, 0},
00593   {1, 8, 4},
00594   {2, 8, 4},
00595   {1, 12, 4},
00596   {2, 12, 4},
00597   {0, 0, 0},
00598   {1, 10, 4},
00599   {2, 10, 4},
00600   {1, 14, 4},
00601   {2, 14, 4},
00602   {1, 13, 4},
00603   {1, 4, 4},
00604   {2, 7, 1},
00605   {0, 11, 1},
00606   {2, 1, 1},
00607   {0, 3, 1},
00608   {0, 7, 1},
00609   {0, 2, 1},
00610   {0, 10, 1},
00611   {0, 6, 1},
00612   {1, 1, 1},
00613   {1, 7, 1},
00614   {0, 4, 1},
00615   {-2, 8, 1},
00616   {0, 8, 1},
00617   {0, 12, 1},
00618   {-1, 11, 1},
00619   {-2, 10, 1},
00620   {-1, 9, 1},
00621   {-2, 2, 1},
00622   {-1, 5, 1},
00623   {-2, 4, 1},
00624   {-2, 6, 1},
00625   {-1, 1, 1},
00626   {-1, 7, 1},
00627   {-2, 12, 1},
00628   {-1, 6, 1},
00629   {-1, 4, 1},
00630   {-1, 2, 1},
00631   {-1, 8, 1},
00632   {-2, 9, 1},
00633   {-1, 10, 1},
00634   {-2, 11, 1},
00635   {-1, 12, 1},
00636   {0, 9, 1},
00637   {0, 5, 1},
00638   {-2, 7, 1},
00639   {-2, 5, 1},
00640   {-2, 3, 1},
00641   {0, 1, 1},
00642   {-2, 1, 1},
00643   {0, 3, 2},
00644   {0, 7, 2},
00645   {2, 7, 2},
00646   {2, 1, 2},
00647   {0, 11, 2},
00648   {0, 2, 2},
00649   {0, 10, 2},
00650   {0, 6, 2},
00651   {1, 7, 2},
00652   {1, 1, 2},
00653   {0, 4, 2},
00654   {-1, 11, 2},
00655   {-2, 10, 2},
00656   {-1, 5, 2},
00657   {-2, 8, 2},
00658   {0, 8, 2},
00659   {0, 12, 2},
00660   {-1, 9, 2},
00661   {-2, 12, 2},
00662   {-2, 2, 2},
00663   {-2, 6, 2},
00664   {-1, 1, 2},
00665   {-1, 7, 2},
00666   {-2, 4, 2},
00667   {-1, 10, 2},
00668   {-2, 11, 2},
00669   {-1, 2, 2},
00670   {0, 5, 2},
00671   {0, 9, 2},
00672   {-1, 8, 2},
00673   {-1, 4, 2},
00674   {-1, 12, 2},
00675   {-1, 6, 2},
00676   {-2, 5, 2},
00677   {-2, 1, 2},
00678   {-2, 7, 2},
00679   {-2, 3, 2},
00680   {0, 1, 2},
00681   {-2, 9, 2},
00682   {2, 1, 3},
00683   {0, 3, 3},
00684   {0, 11, 3},
00685   {2, 7, 3},
00686   {0, 7, 3},
00687   {0, 10, 3},
00688   {0, 2, 3},
00689   {0, 6, 3},
00690   {1, 1, 3},
00691   {1, 7, 3},
00692   {-1, 5, 3},
00693   {-2, 8, 3},
00694   {-1, 9, 3},
00695   {0, 4, 3},
00696   {-1, 1, 3},
00697   {0, 8, 3},
00698   {-2, 10, 3},
00699   {-1, 11, 3},
00700   {0, 12, 3},
00701   {-2, 12, 3},
00702   {-2, 2, 3},
00703   {-2, 4, 3},
00704   {-2, 6, 3},
00705   {-1, 7, 3},
00706   {-1, 8, 3},
00707   {-1, 4, 3},
00708   {-1, 2, 3},
00709   {-1, 6, 3},
00710   {0, 5, 3},
00711   {-1, 12, 3},
00712   {-1, 10, 3},
00713   {-2, 11, 3},
00714   {0, 9, 3},
00715   {-2, 9, 3},
00716   {-2, 5, 3},
00717   {0, 1, 3},
00718   {-2, 1, 3},
00719   {-2, 3, 3},
00720   {-2, 7, 3},
00721   {-1, 3, 1},
00722   {-1, 3, 2},
00723   {-1, 3, 3},
00724   {2, 7, 4},
00725   {-2, 2, 4},
00726   {0, 7, 4},
00727   {-1, 1, 4},
00728   {-2, 3, 4},
00729   {0, 6, 4},
00730   {-1, 2, 4},
00731   {1, 7, 4},
00732   {0, 1, 4},
00733   {-2, 1, 4},
00734   {0, 3, 4},
00735   {2, 1, 4},
00736   {-2, 6, 4},
00737   {-1, 5, 4},
00738   {-1, 7, 4},
00739   {0, 2, 4},
00740   {0, 5, 4},
00741   {1, 1, 4},
00742   {-2, 5, 4},
00743   {-1, 6, 4},
00744   {-2, 7, 4},
00745   {0, 13, 4},
00746   {0, 4, 4},
00747   {-2, 13, 4},
00748   {-2, 4, 4},
00749   {-1, 13, 4},
00750   {-1, 4, 4},
00751   {0, 12, 4},
00752   {-2, 12, 4},
00753   {-1, 12, 4},
00754   {0, 8, 4},
00755   {-2, 8, 4},
00756   {-1, 8, 4},
00757   {2, 11, 4},
00758   {2, 9, 4},
00759   {-1, 11, 4},
00760   {0, 11, 4},
00761   {-1, 9, 4},
00762   {-2, 9, 4},
00763   {1, 9, 4},
00764   {1, 11, 4},
00765   {-2, 11, 4},
00766   {0, 9, 4},
00767   {-2, 14, 4},
00768   {0, 10, 4},
00769   {-1, 14, 4},
00770   {-2, 10, 4},
00771   {0, 14, 4},
00772   {-1, 10, 4},
00773   {-1, 3, 4}};
00774 
00775 ReadPGInfo::ReadPGInfo(const char *name) {
00776   TDirectory * dirSave = gDirectory;
00777   rootFile = new TFile(name);
00778   dirSave->cd();
00779 }
00780 
00781 ReadPGInfo::~ReadPGInfo(){delete rootFile;}
00782 
00783 char * ReadPGInfo::getId(int wheel, int station, int sector) {
00784   for(int counter = 0; counter < TOTALCHAMBERS; ++counter) {
00785     if(wheel == position[counter][0] && sector == position[counter][1] && station == position[counter][2])
00786       return chambers[counter];
00787   }
00788   return NULL;
00789 }
00790 
00791 
00792 TMatrixD ReadPGInfo::giveR(int wheel, int station, int sector) {
00793   TMatrixD *empty = new TMatrixD(0,0);
00794   char *id = getId(wheel, station, sector);
00795   if(id == NULL) return *empty;
00796   TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
00797   TDirectoryFile *myR = (TDirectoryFile *)myDir->Get("R");
00798   TMatrixD *R = (TMatrixD *)myR->Get("matrix");
00799   return *R;
00800 }
00801     
00802 
00803 TMatrixD ReadPGInfo::giveQCCal(int wheel, int station, int sector) {
00804   TMatrixD *mat = new TMatrixD(0,0);
00805   TMatrixD qc = giveQC(wheel, station, sector);
00806   if(qc.GetNrows() == 0) return *mat;
00807   mat->ResizeTo(12,2);
00808   int maxCount = 12;
00809   if(station == 4) maxCount = 8;
00810   for(int c = 0; c < maxCount; ++c) {
00811     float error;
00812     if(qc(c,1) == 0 || qc(c,3) == 0) {
00813       (*mat)(c,0) = (qc(c,0)+qc(c,2)) /2.0;
00814       (*mat)(c,1) = 500;
00815     } else {  
00816       error = 1.0/(1.0/(qc(c,1)*qc(c,1))+1.0/(qc(c,3)*qc(c,3)));
00817      (*mat)(c, 0) = (qc(c,0)/(qc(c,1)*qc(c,1))+qc(c,2)/(qc(c,3)*qc(c,3)))*error;
00818      (*mat)(c, 1) = TMath::Sqrt(error);
00819     }
00820   }
00821   return *mat;
00822 }
00823 
00824 TMatrixD ReadPGInfo::giveQC(int wheel, int station, int sector) {
00825   TMatrixD *empty = new TMatrixD(0,0);
00826   char *id = getId(wheel, station, sector);
00827   if(id == NULL) return *empty;
00828   TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
00829   TDirectoryFile *myQC = (TDirectoryFile *)myDir->Get("QCW");
00830   TMatrixD *QC;
00831   if(myQC == NULL) {
00832     QC = new TMatrixD(0,0);
00833   } else {
00834     QC = (TMatrixD *)myQC->Get("matrix");
00835   }
00836   return *QC;
00837 }
00838 
00839 
00840 TMatrixD ReadPGInfo::giveSurvey(int wheel, int station, int sector) {
00841   TMatrixD *empty = new TMatrixD(0,0);
00842   char *id = getId(wheel, station, sector);
00843   if(id == NULL) return *empty;
00844   TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
00845   TDirectoryFile *mySur = (TDirectoryFile *)myDir->Get("Survey");
00846   TMatrixD *Survey = (TMatrixD *)mySur->Get("matrix_layer");
00847   return *Survey;
00848 }
00849 
00850 
00851 
00852 
00853