1 plTw(
int pid=14,
char *name=
"deT+S") {
5 int nH=InitGraph(hg,ng);
6 printf(
"%d graphs initialized\n",nH);
8 for(i=0;i<ng;i++) printf(
"i=%d, add=%0x\n",i,hg[i]);
10 gStyle->SetOptStat(111111);
11 gStyle->SetOptFit(111111);
14 float pt[]={0.5,1,2,3,4,5,10,20,30,40,50};
int npt=11;
18 float eta[]={1.2,1.75};
26 float Etot=pt[i]*cosh(eta[k]);
28 sprintf(fname,
"/star/data22/MC/balewski/eemc/sim2002/f/mc_pid%d_pt%.1f_eta%4.2f",pid,pt[i],eta[k]);
31 doJob(fname,hg,Etot,k,pid,name);
40 sprintf(tit,
"%s-pid%d",name,pid);
44 TCanvas *can =
new TCanvas(tit,tit,600,400+400*kkk);
45 if(kkk) { can->Divide(1,2); can->cd(1);}
49 hgDrawSE(hg+2,pid,name);
59 void doJob(
char *fname0,TGraphErrors **hg,
float Etot,
int ieta,
int pid,
char *hname) {
60 printf(
"job--> %s Etot=%f ieta=%d hist=%s\n",fname0,Etot,ieta,hname);
61 assert(ieta>=0 && ieta<=1);
64 TFile *dir=
new TFile(fname+
".hist.root");
67 if(!dir->IsOpen()){ printf(
"Open failed, take next\n");
return;}
73 h1=(TH1F*) dir->Get(hname);
76 TF1 *ff=h1->GetFunction(
"gaus"); assert(ff);
82 y=ff->GetParameter(1)/Etot;
83 ey=ff->GetParError(1)/Etot;
92 TGraphErrors *gr=hg[0+ieta];
95 gr->SetPointError(n,0.,ey);
101 y=ff->GetParameter(2)/Etot;
102 ey=ff->GetParError(2)/Etot;
103 printf(
"Etot=%f x=%f y=%f ey=%g\n",Etot,x,y);
105 TGraphErrors *gr=hg[2+ieta];
108 gr->SetPointError(n,0.,ey);
117 int InitGraph( TGraphErrors **hg,
int ng){
118 char *name[]={
"reco E or E/E, eta=1.20"
119 ,
"reco E or E/E, eta=1.75"
120 ,
"reco sigE , eta=1.20"
121 ,
"reco sigE , eta=1.75"
126 {
int j;
for(j=0;j<ng;j++) hg[j]=0; }
131 TGraphErrors *gr=
new TGraphErrors();
133 gr->SetMarkerStyle(28);
134 gr->SetMarkerColor(kGreen);
135 gr->SetName(name[i]);
136 int icol=kBlue, isym=28;
140 if(j%2==0) icol=kRed;
141 if(j%2==1) icol=kGreen;
143 gr->SetMarkerStyle(isym);
144 gr->SetMarkerColor(icol);
145 gr->SetLineColor(icol);
148 printf(
"Initialized %d Graphs\n",kk);
158 hgDrawE(TGraphErrors **hg,
int pid,
char *name) {
159 char *pname[]={
"gamma",
"xx",
"electron",
"xx",
"xx",
"muon",
"xx",
"xx",
"pion-",
"xx",
"xx",
"xx",
"xx",
"proton"};
166 if(pid>4 && strstr(name,
"deT+S")){
167 titHead=
"mean #pm RMS E_{TOWER+SMD} (GeV)";
168 gr->SetMinimum( -0.2);
170 if(pid>4 && strstr(name,
"deTw")){
171 titHead=
"mean #pm RMS E_{TOWER only} (GeV)";
172 gr->SetMinimum( -0.2);
175 if(pid<4 && strstr(name,
"deT+S")) {
176 gr->SetMaximum( 0.054); gr->SetMinimum( 0.048);
177 titHead=
"Gauss E_{REC}/E_{INC} #pm #sigma/E_{INC} for TOWER+SMD ";
179 if(pid<4 && strstr(name,
"deTw")) {
180 gr->SetMaximum( 0.042); gr->SetMinimum( 0.037);
181 titHead=
"Gauss E_{REC}/E_{INC} #pm #sigma/E_{INC} for TOWER only ";
185 gr->GetXaxis()->SetLimits(0.7,170.);
186 gr->GetXaxis()->SetTitle(
"Incident Energy (GeV)");
189 sprintf(tit,
" %s; PID=%d\n",titHead.Data(),pid);
193 lg=
new TLegend(0.3,0.65,0.55,0.8);
194 TString head=
"Incident ";
197 lg->AddEntry(hg[0],
" #eta=1.20",
"LP");
198 lg->AddEntry(hg[1],
" #eta=1.75",
"LP");
208 hgDrawSE(TGraphErrors **hg,
int pid,
char *name) {
209 char *pname[]={
"gamma",
"xx",
"electron",
"xx",
"xx",
"muon",
"xx",
"xx",
"pion-",
"xx",
"xx",
"xx",
"xx",
"proton"};
217 if(strstr(name,
"deT+S")) titHead=
" #sigma/ E_{INC} for TOWER+SMD";
218 if(strstr(name,
"deTw")) titHead=
" #sigma/ E_{INC} for TOWER only";
220 gr->SetMinimum( 0.0);
223 gr->SetMaximum( 0.004);
227 gr->SetMaximum( 0.01);
230 gr->GetXaxis()->SetTitle(
"1 / #sqrt{E_{INC}/GeV}");
233 sprintf(tit,
"Gauss %s; PID=%d\n",titHead.Data(),pid);
239 lg=
new TLegend(0.6,0.15,0.85,0.3);
240 TString head=
"Incident ";
243 lg->AddEntry(hg[0],
" #eta=1.20 +FIT",
"LP");
244 lg->AddEntry(hg[1],
" #eta=1.75",
"LP");