00001
00002
00003
00004
00005 #if !defined(__CINT__)
00006 #include <TROOT.h>
00007 #include <TSystem.h>
00008 #include "StEmcUtil/StEmcGeom.h"
00009 #endif
00010
00011 void tgeom(const Int_t det=1);
00012 Int_t tg1(const Int_t id);
00013 Int_t tg2(const Int_t det=1, const Int_t id=0);
00014 void tg3();
00015 void tg4(const Int_t det=1, const Int_t m1=1,const Int_t m2=120);
00016
00017
00018 class StEmcGeom; StEmcGeom *geom = 0;
00019 Int_t m,e,s;
00020
00021 void
00022 tgeom(const Int_t det)
00023 {
00024 if(strlen(gSystem->GetLibraries("*StEmcUtil.so","D")) == 0){
00025 gROOT->ProcessLine(".x Load.C");
00026 gSystem->Load("StEmcUtil.so");
00027 }
00028 if(det>=1&&det<=4) {
00029
00030 geom = new StEmcGeom(det);
00031 }
00032 }
00033
00034 Int_t
00035 tg1(const Int_t id)
00036 {
00037 tgeom();
00038
00039 Int_t ret;
00040 ret = geom->getBin(id,m,e,s);
00041
00042 if(ret == 0) {
00043 printf(" id %4i => m %3i e %2i s %i \n", id, m, e, s);
00044 return ret;
00045 }
00046 else return 1;
00047 }
00048
00049 Int_t
00050 tg2(const Int_t det, const Int_t id)
00051 {
00052
00053 tgeom(det);
00054
00055 Int_t m,e,s, idW, id1, id2;
00056
00057
00058 id1 = id; id2=id;
00059 if(id == 0) {
00060 switch (det){
00061 case 1:
00062 case 2: {id1=1; id2=4800; break;}
00063 case 3:
00064 case 4: {id1=1; id2=18000; break;}
00065 default: return 0;
00066 }
00067 }
00068
00069 Int_t ibad = 0;
00070 for(Int_t i=id1; i<=id2; i++){
00071 Int_t ret = geom->getBin(i,m,e,s);
00072 if(ret == 0) {
00073 Int_t retW = geom->getId(m,e,s,idW);
00074 if(retW == 0){
00075 if(i != idW) {
00076 ibad++;
00077 printf(" bad case %i | id %4i : %4i => m %3i e %2i s %i \n"
00078 ,ibad, i, idW, m, e, s);
00079 }
00080 }
00081 else {printf(" Something wrong \n"); return 0;}
00082 }
00083 else return 1;
00084 }
00085
00086 if(ibad) printf(" Detector %i Bad case %i \n", det, ibad);
00087 else printf(" Detector %i => No Errors \n", det);
00088
00089 return 10;
00090 }
00091
00092 void
00093 tg3()
00094 {
00095
00096 tgeom(0);
00097 Int_t det, id=1;
00098 for(det=1; det<=4; det++){
00099 geom = new StEmcGeom(det);
00100 Int_t ret = geom->getBin(id,m,e,s);
00101 if(ret == 0) printf(" det %i id %i => m %i e %i s %i \n",
00102 det,id, m,e,s);
00103 }
00104 }
00105
00106 void
00107 tg4(const Int_t det,const Int_t m1, const Int_t m2)
00108 {
00109
00110
00111
00112 tgeom(det);
00113 Float_t phi,eta;
00114 Int_t mw, ew, sw, ier1=0, ier2=0;
00115
00116 for(Int_t m=m1; m<=m2; m++){
00117 for(Int_t e=1; e<=geom->NEta(); e++){
00118 for(Int_t s=1; s<=geom->NSub(); s++){
00119 if(geom->getEta(m,e,eta)==0&&geom->getPhi(m,s,phi)==0){
00120 geom->getBin(phi,eta, mw,ew,sw);
00121 if(m!=mw || e!=ew || s!=sw) {
00122 ier2++;
00123 printf("<E> %5i | m %i=>%i e %i=>%i s %i=>%i phi %f eta %f \n",
00124 ier2, m,mw, e,ew, s,sw, phi,eta);
00125 }
00126 }
00127 else {
00128 ier1++;
00129 printf("<E> %5i | something wrong m %i e %i s %i\n", ier1, m,e,s);
00130 }
00131 }
00132 }
00133 }
00134 printf(" For Detector %i ",det);
00135 if(ier1==0 && ier2==0) printf(" => No Errors \n");
00136 else printf(" #Error1 %i #Error2 %i\n", ier1, ier2);
00137 }
00138