Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:55

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  char hname [100];
0007  sprintf(hname, "%s%sd",calo,part/*,pz[i]*/);
0008  TH1F *h1 = new TH1F(hname, hname, 100, 0, 10);
0009   for (int i=0; i<3; i++)
0010 {
0011   //x[i] = pz[i];
0012   sprintf(infile, "/sphenix/user/jpinkenburg/ShowerSize/ntuple/%s_eta0_4GeV.root",part/*, pz[i]*/);
0013           char hname [100];
0014           // sprintf(hname, "%s%s12GeV",calo,part,pz[i]);
0015           //TH1F *h1 = new TH1F(hname, "", 100, 0, 1);
0016           TFile *f = TFile::Open(infile);
0017           gROOT->cd();
0018           TNtuple *nt = (TNtuple *)f->Get("de");
0019           char calid [100];
0020           sprintf(calid, "ID==%s", i); 
0021           nt->Project(hname,"edep",calid);
0022           // char cal [100];
0023           // sprintf(cal,"%s",calo);
0024           /*
0025           if (calo == "HO")
0026         {
0027           nt->Project(hname,"edep","ID==2");
0028         }
0029           else if(calo == "HI")
0030         { 
0031           nt->Project(hname,"edep","ID==1");
0032         } 
0033           else if(calo == "E")
0034         { 
0035           nt->Project(hname,"edep","ID==0");
0036         }
0037           else if (calo == "MAG") 
0038         {
0039           nt->Project(hname,"(MAG)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0040         }
0041           else if (calo == "BH")
0042         {
0043       nt->Project(hname,"(BH)/(EA+ES+HIA+HIS+HOA+HOS+BH+MAG)");
0044         }
0045           else 
0046         {
0047           cout << "ERROR" << endl;
0048           }*/
0049           f->Close();
0050           h1->Draw();
0051           char fname [100];
0052           sprintf(fname, "%sShowerPercent.root",part);
0053           TFile *fout = TFile::Open(fname,"UPDATE");
0054           h1->Write();
0055           fout->Write();
0056           cout << h1->Integral() << " "  <<  hname << " " /*<< pz[i] <<*/ endl;
0057           //fout->Write();
0058           fout->Close();
0059   }
0060 }
0061 void EdepSmall(const char *calo="HOe", const char *part = "e")
0062 {
0063    int pz[9] = {1,2,4,8,12,16,32,40,50};
0064    double x[9];
0065    double y[9];
0066    double xer[9] = {0};
0067    double yer[9];
0068    char hname[100];
0069    char fname[100];
0070    sprintf(fname,"%spercent.root",part);
0071    char area[100];
0072    sprintf(area,"%s",calo);
0073   TFile *fin = TFile::Open(fname);
0074   gROOT->cd();
0075    for (int i=0; i<9; i++)
0076      {
0077        x[i] = pz[i];
0078        sprintf(hname,"%s%s%dd",calo,part,pz[i]);
0079 TH1 *h1 = (TH1F *) fin->Get(hname);
0080      y[i] = h1->GetMean(1);
0081    yer[i] = h1->GetRMS(1);
0082      }
0083    gr = new TGraphErrors(9,x,y,xer,yer);
0084    gr->SetTitle(area);
0085    gr->Draw("ALP");
0086    gr->SetMarkerStyle(20);
0087    gr->SetMarkerColor(2);
0088    fin->Close();
0089 }