00001
00002
00003
00004
00005
00006
00007 #if !defined(__CINT__)
00008 #include <TROOT.h>
00009 #include <TSystem.h>
00010 #include "StarClassLibrary/StThreeVectorF.hh"
00011 #include "StEvent/StMeasuredPoint.h"
00012 #include "StEvent/StHit.h"
00013 #include "StEmcUtil/StEmcMath.h"
00014 #include "StEmcUtil/StSmdDaqUtil.h"
00015 #endif
00016 #include "StEmcUtil/emcInternalDef.h"
00017 #include "StDetectorId.h"
00018
00019 void tEmcLoad();
00020 void tEmcMath();
00021 void tEmcId();
00022
00023 class StMeasuredPoint; StMeasuredPoint *hit1, *hit2;
00024
00025 void tEmcLoad()
00026 {
00027 if(strlen(gSystem->GetLibraries("*StEmcUtil.so","D")) == 0){
00028 gROOT->ProcessLine(".x Load.C");
00029 gSystem->Load("StEmcUtil.so");
00030 }
00031 }
00032
00033 void tEmcMath()
00034 {
00035 tEmcLoad();
00036
00037 StThreeVectorF v1(230., 0.0, 0.0);
00038 StThreeVectorF ve(2,2,2);
00039 printf(" For vector => eta %f phi %f\n",v1.pseudoRapidity(),v1.phi());
00040 hit1 = new StHit(v1,ve,0,0,0);
00041
00042 Double_t eta,phi;
00043 for(Int_t z=-50; z<=50; z+=10){
00044 StThreeVectorF vzero(0,0,z);
00045 hit2 = new StHit(vzero,ve,0,0,0);
00046 Bool_t tmp = StEmcMath::etaPhi(hit1,hit2, eta,phi);
00047 printf(" For StEmcMath : z %5.1f eta %f phi %f => %i \n", z, eta, phi,tmp);
00048 delete hit2;
00049 }
00050 }
00051
00052 void tEmcId()
00053 {
00054 tEmcLoad();
00055 UInt_t id, idw; StDetectorId stId=0;
00056 cout<<" Check local to STAR \n";
00057 for(id=0; id<=9; id++){
00058 stId = StEmcMath::detectorId(id);
00059 if(stId) cout<<" Local Emc Id "<<id<<" => Star Id "<<UInt_t(stId)<<endl;
00060 else cout<<" Wrong local Emc Id "<<id<<endl;
00061 }
00062
00063 cout<<"\n Check STAR to local\n";
00064 for(idw=7; idw<=17; idw++){
00065 stId = StDetectorId(idw);
00066 id = StEmcMath::detectorId(stId);
00067 if(id) cout<<" Star Id "<<UInt_t(stId)<<" => Local Emc Id "<<id<<endl;
00068 else cout<<" Wrong Star Id "<<UInt_t(stId)<<endl;
00069 }
00070 }
00071
00072
00073
00074 void tDaqUtil()
00075 {
00076 Int_t e, s;
00077 tEmcLoad();
00078 for(Int_t con=1; con<=3; con++){
00079 for(Int_t pin=1; pin<=50; pin++){
00080 if(StSmdDaqUtil::getBsmdeCell(con,pin,e)){
00081 printf(" Bsmde con %1i pin %2i => e %3i ",con,pin,e);
00082 if(StSmdDaqUtil::getBsmdpCell(con,pin,e,s))
00083 printf(" Bsmdp => e %2i s %2i\n",e,s);
00084 else printf("\n");
00085 }
00086 }
00087 printf("==\n");
00088 }
00089 }