7 #include <TGraphErrors.h>
9 #include "SaveCanvas.C"
10 #include "SetOKStyle.C"
27 gSystem->Load(
"libg4eval.so");
28 gSystem->Load(
"libqa_modules.so");
29 gSystem->Load(
"libPrototype3.so");
31 gStyle->SetOptStat(0);
41 int XBins =(Xmax - Xmin)/inteval;
42 int YBins = (Ymax - Ymin)/inteval;
51 int num = (Final - Ini)/step;
53 cout <<
"num = " << num << endl;
57 const int NTotal = N *
N;
88 for(
int i =0;
i < num;
i ++)
93 gStyle->SetOptStat(0);
95 TCanvas *c1 =
new TCanvas(
"c1",
"c1",0,0,800,600);
99 cout <<
" i = " <<
i << endl;
105 cout <<
" j = " << j << endl;
107 if(j != 3416 && j != 3418 && j != 3420 && j != 3421 && j != 3426)
112 sprintf(inputfile,
"/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2017/Production_0130_WithEMCalCalib/beam_0000%d-0000_DSTReader.root",j);
115 cout <<
"Infile name = " << inputfile << endl;
117 ifstream ifile(inputfile);
123 TFile *fin =
new TFile(inputfile);
127 TTree *
t = (TTree *)fin->Get(
"T");
129 t->SetAlias(
"C2_Inner_e",
"1*abs(TOWER_RAW_C2[2].energy)");
130 t->SetAlias(
"C2_Outer_e",
"1*abs(TOWER_RAW_C2[3].energy)");
131 t->SetAlias(
"Average_column",
"Sum$(TOWER_CALIB_CEMC.get_column() * TOWER_CALIB_CEMC.get_energy())/Sum$(TOWER_CALIB_CEMC.get_energy())");
132 t->SetAlias(
"Average_HODO_HORIZONTAL",
"Sum$(TOWER_CALIB_HODO_HORIZONTAL.towerid * (abs(TOWER_CALIB_HODO_HORIZONTAL.energy)>30) * abs(TOWER_CALIB_HODO_HORIZONTAL.energy))/Sum$((abs(TOWER_CALIB_HODO_HORIZONTAL.energy)>30) * abs(TOWER_CALIB_HODO_HORIZONTAL.energy))");
133 t->SetAlias(
"Valid_HODO_HORIZONTAL",
"Sum$(abs(TOWER_CALIB_HODO_HORIZONTAL.energy)>30) > 0");
134 t->SetAlias(
"No_Triger_VETO",
"Sum$(abs(TOWER_RAW_TRIGGER_VETO.energy)>15)==0");
135 t->SetAlias(
"Valid_HODO_VERTICAL",
"Sum$(abs(TOWER_CALIB_HODO_VERTICAL.energy)>30) > 0");
136 t->SetAlias(
"C2_Sum_e",
"C2_Inner_e + C2_Outer_e");
137 t->SetAlias(
"Average_HODO_VERTICAL",
"Sum$(TOWER_CALIB_HODO_VERTICAL.towerid * (abs(TOWER_CALIB_HODO_VERTICAL.energy)>30) * abs(TOWER_CALIB_HODO_VERTICAL.energy))/Sum$((abs(TOWER_CALIB_HODO_VERTICAL.energy)>30) * abs(TOWER_CALIB_HODO_VERTICAL.energy))");
139 t->SetAlias(
"Energy_Sum_CEMC",
"1*Sum$(TOWER_CALIB_CEMC.get_energy())");
144 TCut
event_sel =
"Valid_HODO_HORIZONTAL && Valid_HODO_VERTICAL && No_Triger_VETO && C2_Sum_e > 200";
146 t->Draw(
">>EventList", event_sel);
148 TEventList * elist = gDirectory->GetObjectChecked(
"EventList",
"TEventList");
152 cout << elist->GetN() <<
" / " <<
T->GetEntriesFast() <<
" events selected" << endl;
154 t->SetEventList(elist);
157 TH1D *h5=
new TH1D(
"h5",
"",200, -1, 10);
173 sprintf(Filename,
"Hisfiles130/His%d.root",
i);
175 TFile *
fout =
new TFile(Filename,
"RECREATE");
177 t->SetAlias(
"XPos",
"beam_2CH_mm - 5* int( Average_HODO_HORIZONTAL + 0.5)");
178 t->SetAlias(
"YPos",
"beam_2CV_mm + 5* int(Average_HODO_VERTICAL + 0.5)");
185 TH3F *Energyhis =
new TH3F(
"Energyhis",
"",200,0,20,YBins,Ymin,Ymax,XBins,Xmin,Xmax);
189 t->Draw(
"XPos:YPos:Energy_Sum_CEMC>>Energyhis");
292 cout <<
"File " <<
i <<
"does not exist" << endl;