File indexing completed on 2025-08-06 08:11:56
0001 void EdepPercentSmall (const char *calo="HO", const char *part="e")
0002 {
0003 char infile[100];
0004 int pz[9] = {1,2,4,8,12,16,32,40,50};
0005 double x[9];
0006
0007 for (int i=0; i<9; i++)
0008 {
0009
0010 sprintf(infile, "%s%dout.root",part, pz[i]);
0011 char hname [100];
0012 sprintf(hname, "%s%s%dd",calo,part,pz[i]);
0013 TH1F *h1 = new TH1F(hname, "", 100, 0, 1);
0014 TFile *f = TFile::Open(infile);
0015 gROOT->cd();
0016 TNtuple *nt = (TNtuple *)f->Get("ed");
0017
0018
0019 if (calo == "HO")
0020 {
0021 nt->Project(hname,"(HOA+HOS)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0022 }
0023 else if(calo == "HI")
0024 {
0025 nt->Project(hname,"(HIA+HIS)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0026 }
0027 else if(calo == "E")
0028 {
0029 nt->Project(hname,"(EA+ES)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0030 }
0031 else if (calo == "MAG")
0032 {
0033 nt->Project(hname,"(MAG)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0034 }
0035 else if (calo == "BH")
0036 {
0037 nt->Project(hname,"(BH)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0038 }
0039 else
0040 {
0041 cout << "ERROR" << endl;
0042 }
0043 f->Close();
0044 h1->Draw();
0045 char fname [100];
0046 sprintf(fname, "%spercent.root",part);
0047 TFile *fout = TFile::Open(fname,"UPDATE");
0048 h1->Write();
0049 fout->Write();
0050 cout << h1->Integral() << " " << hname << " " << pz[i] << endl;
0051
0052 fout->Close();
0053 }
0054 }
0055 void EdepSmall(const char *calo="HOe", const char *part = "e")
0056 {
0057 int pz[9] = {1,2,4,8,12,16,32,40,50};
0058 double x[9];
0059 double y[9];
0060 double xer[9] = {0};
0061 double yer[9];
0062 char hname[100];
0063 char fname[100];
0064 sprintf(fname,"%spercent.root",part);
0065 char area[100];
0066 sprintf(area,"%s",calo);
0067 TFile *fin = TFile::Open(fname);
0068 gROOT->cd();
0069 for (int i=0; i<9; i++)
0070 {
0071 x[i] = pz[i];
0072 sprintf(hname,"%s%s%dd",calo,part,pz[i]);
0073 TH1 *h1 = (TH1F *) fin->Get(hname);
0074 y[i] = h1->GetMean(1);
0075 yer[i] = h1->GetRMS(1);
0076 }
0077 gr = new TGraphErrors(9,x,y,xer,yer);
0078 gr->SetTitle(area);
0079 gr->Draw("ALP");
0080 gr->SetMarkerStyle(20);
0081 gr->SetMarkerColor(2);
0082 fin->Close();
0083 }