13 cf=
new TFile(
"/opt/fairroot/pandaroot/macro/params/gamma_en_th_corr_TGeant3.root");
14 TH2F *HistClusterEnergyCorrectionFactor_johan = (TH2F*)hisEnergyDelta->Clone();
15 HistClusterEnergyCorrectionFactor_johan->SetName(
"HistClusterEnergyCorrectionFactor_johan");
16 for (
int i=1;
i<=26;
i++)
17 for (
int j=1; j<=61; j++)
18 HistClusterEnergyCorrectionFactor_johan->SetBinContent(
i,j,0);
20 TH2F *HistClusterEnergyCorrectionFactor_johan_original = (TH2F*)hisEnergyDelta->Clone();
21 HistClusterEnergyCorrectionFactor_johan_original->SetName(
"HistClusterEnergyCorrectionFactor_johan_original");
22 for (
int i=1;
i<=26;
i++)
23 for (
int j=1; j<=61; j++)
24 HistClusterEnergyCorrectionFactor_johan_original->SetBinContent(
i,j,0);
26 TH2F *HistClusterEnergyCorrectionFactor_johan_count = (TH2F*)hisEnergyDelta->Clone();
27 HistClusterEnergyCorrectionFactor_johan_count->SetName(
"HistClusterEnergyCorrectionFactor_johan_count");
28 for (
int i=1;
i<=26;
i++)
29 for (
int j=1; j<=61; j++)
30 HistClusterEnergyCorrectionFactor_johan_count->SetBinContent(
i,j,0);
33 Float_t xlowarray[36] = {0, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 1.,
34 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5.};
35 Float_t ylowarray[54] = {0, 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 20., 21., 22., 23., 24., 25., 30., 35., 40., 45., 50., 55., 60.,
36 65., 70., 75., 80., 85., 90., 95., 100., 105., 110., 115., 120., 125., 130., 135., 140., 142., 147., 152.,
37 154., 156., 158., 161., 165., 171.};
38 TH2F *HistClusterEnergyCorrectionFactor_Hossein =
new TH2F(
"HistClusterEnergyCorrectionFactor_Hossein",
"", 35, xlowarray, 53, ylowarray);
39 TH2F *HistClusterEnergyCorrectionFactor_Hossein_original =
new TH2F(
"HistClusterEnergyCorrectionFactor_Hossein_original",
"", 35, xlowarray, 53, ylowarray);
40 TH2F *HistClusterEnergyCorrectionFactor_Hossein_count =
new TH2F(
"HistClusterEnergyCorrectionFactor_Hossein_count",
"", 35, xlowarray, 53, ylowarray);
42 TH1I *HISTnumberOfClusters_thresholdPassed =
new TH1I(
"HISTnumberOfClusters_thresholdPassed",
"Total number of clusters per event satisfying cluster threshold",140,0,70);
44 TH2F *HistClusterEnergyCorrectionFactor_original =
new TH2F(
"HistClusterEnergyCorrectionFactor_original",
"cluster energy correction factor",180, 0, 180, 360, -180, 180);
45 TH2F *HistClusterEnergyCorrectionFactor_count =
new TH2F(
"HistClusterEnergyCorrectionFactor_count",
"cluster energy correction factor (bin content container)",180, 0, 180, 360, -180, 180);
46 TH2F *HistClusterEnergyCorrectionFactor =
new TH2F(
"HistClusterEnergyCorrectionFactor",
"cluster energy correction factor (normalized)",180, 0, 180, 360, -180, 180);
48 TH2F *HistClusterEnergyCorrectionFactor_theta_Egamma_original =
new TH2F(
"HistClusterEnergyCorrectionFactor_theta_Egamma_original",
"cluster energy correction factor (normalized)",500, 0, 5., 80, 0, 180);
49 TH2F *HistClusterEnergyCorrectionFactor_theta_Egamma_count =
new TH2F(
"HistClusterEnergyCorrectionFactor_theta_Egamma_count",
"cluster energy correction factor (bin content container)",500, 0, 5., 80, 0, 180);
50 TH2F *HistClusterEnergyCorrectionFactor_theta_Egamma =
new TH2F(
"HistClusterEnergyCorrectionFactor_theta_Egamma",
"cluster energy correction factor (normalized)",500, 0, 5., 80, 0, 180);
53 TString inputfile(
"./energyCorrectionFactors_30MeVthreshold_cond2_Ntuple_10MillionEvt.root");
54 TString outputfile(
"./energyCorrectionFactors_30MeVthreshold_cond2_Ntuple_10MillionEvt_supplement.root");
56 TChain *chain =
new TChain(
"EventParams");
57 chain->Add(inputfile);
61 float eMc, eCluster, ClustEnCorrFactor, clustTheta, clustPhi;
63 chain->SetBranchAddress(
"eMc", &eMc);
64 chain->SetBranchAddress(
"eCluster", &eCluster);
65 chain->SetBranchAddress(
"ClustEnCorrFactor", &ClustEnCorrFactor);
66 chain->SetBranchAddress(
"clustTheta", &clustTheta);
67 chain->SetBranchAddress(
"clustPhi", &clustPhi);
69 Int_t
ncounts = chain->GetEntries();
70 cout <<
"Number of events = " << ncounts<< endl;
73 for (
int j = 0; j <
ncounts; j++)
76 HistClusterEnergyCorrectionFactor_original->Fill(clustTheta, clustPhi, ClustEnCorrFactor);
77 HistClusterEnergyCorrectionFactor_count->Fill(clustTheta, clustPhi);
78 HistClusterEnergyCorrectionFactor_theta_Egamma_original->Fill(eCluster, clustTheta, ClustEnCorrFactor);
79 HistClusterEnergyCorrectionFactor_theta_Egamma_count->Fill(eCluster, clustTheta);
80 HistClusterEnergyCorrectionFactor_johan_original->Fill(eCluster, clustTheta, ClustEnCorrFactor);
81 HistClusterEnergyCorrectionFactor_johan_count->Fill(eCluster, clustTheta);
82 HistClusterEnergyCorrectionFactor_Hossein_original->Fill(eCluster, clustTheta, ClustEnCorrFactor);
83 HistClusterEnergyCorrectionFactor_Hossein_count->Fill(eCluster, clustTheta);
87 cout<<
"Evt. No. "<< j <<endl;
92 for (
int i=1;
i<=180;
i++)
93 for (
int j=1; j<=360; j++)
94 if (HistClusterEnergyCorrectionFactor_count->GetBinContent(
i,j) != 0)
95 HistClusterEnergyCorrectionFactor->SetBinContent(
i,j,(HistClusterEnergyCorrectionFactor_original->GetBinContent(
i,j))/(HistClusterEnergyCorrectionFactor_count->GetBinContent(
i,j)));
97 HistClusterEnergyCorrectionFactor->SetBinContent(
i,j,0);
99 for (
int i=1;
i<=500;
i++)
100 for (
int j=1; j<=80; j++)
101 if (HistClusterEnergyCorrectionFactor_theta_Egamma_count->GetBinContent(
i,j) != 0)
102 HistClusterEnergyCorrectionFactor_theta_Egamma->SetBinContent(
i,j,(HistClusterEnergyCorrectionFactor_theta_Egamma_original->GetBinContent(
i,j))/(HistClusterEnergyCorrectionFactor_theta_Egamma_count->GetBinContent(
i,j)));
104 HistClusterEnergyCorrectionFactor_theta_Egamma->SetBinContent(
i,j,0);
107 for (
int i=1;
i<=26;
i++)
108 for (
int j=1; j<=61; j++)
109 if (HistClusterEnergyCorrectionFactor_johan_count->GetBinContent(
i,j) != 0)
110 HistClusterEnergyCorrectionFactor_johan->SetBinContent(
i,j,(HistClusterEnergyCorrectionFactor_johan_original->GetBinContent(
i,j))/(HistClusterEnergyCorrectionFactor_johan_count->GetBinContent(
i,j)));
112 HistClusterEnergyCorrectionFactor_johan->SetBinContent(
i,j,0);
115 for (
int i=1;
i<=35;
i++)
116 for (
int j=1; j<=53; j++)
117 if (HistClusterEnergyCorrectionFactor_Hossein_count->GetBinContent(
i,j) != 0)
118 HistClusterEnergyCorrectionFactor_Hossein->SetBinContent(
i,j,(HistClusterEnergyCorrectionFactor_Hossein_original->GetBinContent(
i,j))/(HistClusterEnergyCorrectionFactor_Hossein_count->GetBinContent(
i,j)));
120 HistClusterEnergyCorrectionFactor_Hossein->SetBinContent(
i,j,0);
124 TFile* file_out =
new TFile(outputfile,
"RECREATE");
126 HISTnumberOfClusters_thresholdPassed->Write();
127 HistClusterEnergyCorrectionFactor_original->Write();
128 HistClusterEnergyCorrectionFactor_count->Write();
129 HistClusterEnergyCorrectionFactor->Write();
130 HistClusterEnergyCorrectionFactor_theta_Egamma_original->Write();
131 HistClusterEnergyCorrectionFactor_theta_Egamma_count->Write();
132 HistClusterEnergyCorrectionFactor_theta_Egamma->Write();
133 HistClusterEnergyCorrectionFactor_johan_original->Write();
134 HistClusterEnergyCorrectionFactor_johan_count->Write();
135 HistClusterEnergyCorrectionFactor_johan->Write();
136 HistClusterEnergyCorrectionFactor_Hossein_original->Write();
137 HistClusterEnergyCorrectionFactor_Hossein_count->Write();
138 HistClusterEnergyCorrectionFactor_Hossein->Write();
143 gStyle->SetPalette(1);
144 TCanvas*
c1 =
new TCanvas(
"c1",
"", 100, 100, 1200, 800);
145 HistClusterEnergyCorrectionFactor_johan->Draw(
"surf4");
146 HistClusterEnergyCorrectionFactor_johan->GetZaxis()->SetRangeUser(1,1.4);
147 HistClusterEnergyCorrectionFactor_johan->GetXaxis()->SetRangeUser(0,5.1);
153 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)