StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
evalFills.C
1 TFile *outH;
2 TH1F *hs[6];
3 
4 
5 evalFills(char *fillL="F2201", TString wrkDir="./") {
6  wrkDir="/star/data04/sim/balewski/LcpRun2/maxEta1.4/";
7  //fillL=" F2053 F2075 F2076 F2083 ";
8 
9  fillL=" F2053 F2075 F2076 F2083 F2095 F2102 F2105 F2110 F2116 F2127 F2132 F2134 F2135 F2136 F2147 F2153 F2161 F2162 F2175 F2178 F2181 F2185 F2187 F2192 F2193 F2196 F2201 F2207 F2208 F2212 F2216 F2222 F2235 F2246 F2251 F2257 F2258 F2266 F2269 F2275 F2277 F2281 F2289 F2290 F2301 F2303 F2304";
10 
11  gStyle->SetPalette(1,0);
12  gStyle->SetOptStat(1000110);
13  gROOT->LoadMacro("getPol.C");
14 
15  createHist("asyVer1.hist.root");
16 
17  outH->ls();
18 
19  char *fill=strtok(fillL," "); // init 'strtok'
20  int nFill=0;
21  do {
22  printf("\n\n process fill %02d '%s' \n",nFill,fill);
23  int xFill=atoi(fill+1);
24  assert(xFill);
25  if(xFill<2189) continue;
26 
27  //.................. access R1-All histos
28  TString fname=wrkDir+"r"+fill+".hist.root";
29  TFile * inpH=new TFile(fname);
30  assert(inpH->IsOpen());
31  if(!inpH->IsOpen()) {
32  printf("#fail %s does not open, skip\n",fname.Data());
33  continue;
34  }
35  //inpH->ls();
36  nFill++;
37  projectYield(inpH,xFill);
38  inpH->Close();
39 
40  }while(fill=strtok(0," "));
41 
42  char *cut="evalFill";
43  c=new TCanvas(cut,cut,400,500);
44  //c=new TCanvas();
45  c->Divide(1,3);
46 
47  c->cd(1);
48  plotPair(hs[1],hs[0]);
49  //return;
50 
51  c->cd(2);
52  plotPair(hs[3],hs[2]);
53 
54  c->cd(3);
55  plotPair(hs[5],hs[4]);
56 
57 
58  // outH->Write();
59  //outH->ls();
60 
61  return;
62 }
63 
64 
65 //==========================================
66 //==========================================
67 void projectYield(TFile *inp,int xFill){
68  assert(inp->IsOpen());
69 
70  float P,Q,eP,eQ;
71  getPol(xFill,P,Q,eP,eQ);
72  float PQ, ePQ;
73  PQ=P*Q;
74  ePQ=PQ*sqrt(eP*eP/P/P +eQ*eQ/Q/Q);
75  printf("%d--> P*Q=%f /- %f\n",xFill,PQ,ePQ);
76 
77  TH1F * h=(TH1F *)inp->Get("r1*All");
78  assert(h);
79 
80  char *tit=h->GetTitle();
81  int nEve=atoi(strstr(tit,"Neve=")+5);
82  printf("tit='%s' %d\n",tit,nEve);
83 
84  // take module
85  P=fabs(P);
86  Q=fabs(Q);
87  PQ=fabs(PQ);
88 
89  hs[0]->Fill(P,nEve);
90  hs[1]->Fill(P,nEve*P*P);
91 
92  hs[2]->Fill(Q,nEve);
93  hs[3]->Fill(Q,nEve*Q*Q);
94 
95  hs[4]->Fill(PQ,nEve);
96  hs[5]->Fill(PQ,nEve*PQ*PQ);
97 
98  float minPol=0.07, minPol2=0.01;
99 
100  printf("#fill F%d %d %d %d %d\n",xFill,nEve, P>minPol, Q>minPol,PQ>minPol2);
101 }
102 
103 
104 //==========================================
105 //==========================================
106 void createHist(TString fname) {
107  outH=new TFile(fname,"RECREATE");
108  assert(outH->IsOpen());
109  printf("save outH -->%s\n", fname.Data());
110 
111  //.......... N*P
112  hs[0]=new TH1F("NvP","yiled vs. P",30,0,0.3);
113  hs[0]->SetLineColor(kBlue);
114  hs[0]->SetLineStyle(2);
115 
116  hs[1]=new TH1F("NPPvP","",30,0,0.3);
117  hs[1]->SetXTitle("Magnitude of Polarization in Blue");
118  hs[1]->SetYTitle("FOM = LCP yield * P * P");
119 
120  //........... N*Q
121  hs[2]=new TH1F("NvQ","yield vs. Q",30,0,0.3);
122  hs[2]->SetLineColor(kMagenta);
123  hs[2]->SetLineStyle(2);
124 
125  hs[3]=new TH1F("NQQvQ","",30,0,0.3);
126  hs[3]->SetXTitle("Magnitude of Polarization in Yellow");
127  hs[3]->SetYTitle("FOM = LCP yield * Q * Q");
128 
129  //........... N*PQ
130  hs[4]=new TH1F("NvPQ","yield vs. P*Q",30,0,0.06);
131  hs[4]->SetLineColor(kGreen);
132  hs[4]->SetLineStyle(2);
133 
134  hs[5]=new TH1F("NPPQQvPQ","",30,0,0.06);
135  hs[5]->SetXTitle("Magnitude of Polarization Product Blue*Yellow");
136  hs[5]->SetYTitle("FOM = LCP yield * P * P * Q * Q");
137  }
138 
139 
140 //==========================================
141 //==========================================
142 void plotPair(TH1F *h1,TH1F *h0 ) {
143  h1->Draw();
144 
145  // edit fonts/sizes
146  TAxis *ax =h1->GetYaxis();
147  float ss=ax->GetTitleSize();
148  //printf("ss=%f\n",ss);
149  ax->SetTitleSize(2*ss);
150  ax->SetTitleOffset(0.5);
151  ax =h1->GetXaxis();
152  ax->SetTitleSize(1.5*ss);
153  ax->SetLabelSize(1.5*ss);
154  ax->SetTitleOffset(0.7);
155 
156 
157  // edit fonts/sizes DONE
158 
159 
160 
161  gPad->Update();
162  //scale hint1 to the pad coordinates
163  Float_t rightmax = 1.1*h0->GetMaximum();
164  Float_t scale = gPad->GetUymax()/rightmax;
165  h0->Scale(scale);
166  h0->Draw("same");
167 
168  //draw an axis on the right side
169  TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
170  gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"-R");
171  int col=h0->GetLineColor();
172  axis->SetLineColor(col);
173 
174  axis->SetTextColor(col);
175  axis->SetLabelColor(col);
176  axis ->SetTitle("LCP yield");
177  axis->SetTitleSize(2*ss);
178  axis->SetTitleOffset(.5);
179 
180  axis->Draw();
181 
182 
183  TPaveStats *st =( TPaveStats *)gPad->GetPrimitive("stats");
184  st->SetX1NDC(0.35);
185  st->SetX2NDC(0.5);
186  st->SetY1NDC(0.7);
187  st->SetY2NDC(1.);
188 }
189 
190 
191 
192 
193