StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tEmcMath.C
1 //
2 // 9-mar-2001 for testing StEmcMath
3 // 24-may - added testing for StEmcOnlineUtil
4 //
5 //.include "$STAR/StRoot"
6 //gDebug=5
7 #if !defined(__CINT__)
8 #include <TROOT.h>
9 #include <TSystem.h>
10 #include "StarClassLibrary/StThreeVectorF.hh"
11 #include "StEvent/StMeasuredPoint.h"
12 #include "StEvent/StHit.h"
13 #include "StEmcUtil/StEmcMath.h"
14 #include "StEmcUtil/StSmdDaqUtil.h"
15 #endif
16 #include "StEmcUtil/emcInternalDef.h"
17 #include "StDetectorId.h"
18 
19 void tEmcLoad();
20 void tEmcMath();
21 void tEmcId();
22 
23 class StMeasuredPoint; StMeasuredPoint *hit1, *hit2;
24 
25 void tEmcLoad()
26 {
27  if(strlen(gSystem->GetLibraries("*StEmcUtil.so","D")) == 0){
28  gROOT->ProcessLine(".x Load.C");
29  gSystem->Load("StEmcUtil.so");
30  }
31 }
32 
33 void tEmcMath()
34 {
35  tEmcLoad();
36 
37  StThreeVectorF v1(230., 0.0, 0.0);
38  StThreeVectorF ve(2,2,2); // always the same
39  printf(" For vector => eta %f phi %f\n",v1.pseudoRapidity(),v1.phi());
40  hit1 = new StHit(v1,ve,0,0,0);
41 
42  Double_t eta,phi;
43  for(Int_t z=-50; z<=50; z+=10){
44  StThreeVectorF vzero(0,0,z);
45  hit2 = new StHit(vzero,ve,0,0,0);
46  Bool_t tmp = StEmcMath::etaPhi(hit1,hit2, eta,phi);
47  printf(" For StEmcMath : z %5.1f eta %f phi %f => %i \n", z, eta, phi,tmp);
48  delete hit2;
49  }
50 }
51 
52 void tEmcId()
53 {
54  tEmcLoad();
55  UInt_t id, idw; StDetectorId stId=0;
56  cout<<" Check local to STAR \n";
57  for(id=0; id<=9; id++){
58  stId = StEmcMath::detectorId(id);
59  if(stId) cout<<" Local Emc Id "<<id<<" => Star Id "<<UInt_t(stId)<<endl;
60  else cout<<" Wrong local Emc Id "<<id<<endl;
61  }
62 
63  cout<<"\n Check STAR to local\n";
64  for(idw=7; idw<=17; idw++){
65  stId = StDetectorId(idw);
66  id = StEmcMath::detectorId(stId);
67  if(id) cout<<" Star Id "<<UInt_t(stId)<<" => Local Emc Id "<<id<<endl;
68  else cout<<" Wrong Star Id "<<UInt_t(stId)<<endl;
69  }
70 }
71 
72 // =======================================================
73 
74 void tDaqUtil()
75 {
76  Int_t e, s;
77  tEmcLoad();
78  for(Int_t con=1; con<=3; con++){
79  for(Int_t pin=1; pin<=50; pin++){
80  if(StSmdDaqUtil::getBsmdeCell(con,pin,e)){
81  printf(" Bsmde con %1i pin %2i => e %3i ",con,pin,e);
82  if(StSmdDaqUtil::getBsmdpCell(con,pin,e,s))
83  printf(" Bsmdp => e %2i s %2i\n",e,s);
84  else printf("\n");
85  }
86  }
87  printf("==\n");
88  }
89 }
Definition: StHit.h:125