StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SeeEpdBbcCosmics.C
1 //
2 // This macro assumes that there is a file containing TH2Ds with the name like:
3 // Epd_X_WhenBbc_Y_Pmt_Z_fires where _X_ is East or West. _Y_ is East or West. _Z_ is the phototube number
4 // EpdEastWhenBbcEastPmt7fires
5 // That file is produced by analyzing STAR datafiles
6 
7 // you might need this "R__LOAD_LIBRARY" line if you are running on your laptop with root6
8 // otherwise the damned thing won't even *try*
9 // I guess it's some kind of "super-pre-compiler directive" or something...
10 //R__LOAD_LIBRARY(StEpdUtil/StEpdUtil.so)
11 
12 class StEpdGeom;
13 class StBbcGeom;
14 
15 void DrawBbcOutline(unsigned short ipmt, short iew);
16 
17 //---------------------------------------------------------------
18 void SeeEpdBbcCosmics(TString filein){
19 
20  gSystem->Load("StEpdUtil"); // this is what you will want at RCF. On my laptop, root says not found but there is no problem.
21 
22  TFile* tfin = new TFile(filein.Data(),"READ");
23 
24  TCanvas* tc = new TCanvas("EpdBbcCorrel","EpdBbcCorrel",1200,700);
25  tc->SaveAs("EpdBbcCorrel.pdf[");
26  tc->Divide(2,1);
27  for (short iewBBC=0; iewBBC<2; iewBBC++){
28  TString ewb = (iewBBC==0)?"East":"West";
29  for (unsigned short ipmt=1; ipmt<17; ipmt++){
30  TH2D* EpdEast = (TH2D*)tfin->Get(Form("EpdEastWhenBbc%sPmt%dfires",ewb.Data(),ipmt));
31  tc->cd(1); EpdEast->Draw();
32  if (iewBBC==0) DrawBbcOutline(ipmt,iewBBC);
33  TH2D* EpdWest = (TH2D*)tfin->Get(Form("EpdWestWhenBbc%sPmt%dfires",ewb.Data(),ipmt));
34  tc->cd(2); EpdWest->Draw();
35  if (iewBBC==1) DrawBbcOutline(ipmt,iewBBC);
36  tc->SaveAs("EpdBbcCorrel.pdf");
37  }
38  }
39  tc->SaveAs("EpdBbcCorrel.pdf)");
40 }
41 
42 //---------------------------------------------------------------
43 void DrawBbcOutline(unsigned short ipmt, short iew){
44 
45  StBbcGeom g;
46  unsigned short ntiles,tiles[2];
47 
48  g.GetTilesOfPmt(ipmt,&ntiles,tiles);
49  for (int i=0; i<ntiles; i++){
50  double x[7],y[7];
51  g.GetCorners(tiles[i],iew,x,y);
52  x[6]=x[0]; y[6]=y[0]; // must make a closed shape
53  TPolyLine* pline = new TPolyLine(7,x,y);
54  pline->SetLineColor(kRed);
55  pline->Draw();
56  }
57 }
58 
59 
60 
void GetTilesOfPmt(unsigned short pmtNumber, unsigned short *nTiles, unsigned short *tileNumbers)
Definition: StBbcGeom.cxx:97
void GetCorners(short tileId, double *x, double *y)
Definition: StBbcGeom.cxx:121