Dear experts below is the part of the code in which i am studying energy depositions in crystal cells. I need to see coordinates of the hottest crystal cell and its energy distribution and also distributions for several near by cells.
here cells are bins Please help in this regard.
`
Please read tips for efficient and successful posting and posting code
___` map<string,TH3*> h3;
float xmin = -50;
float xmax = 50;
int nx = 100;
float ymin = -50;
float ymax = 50;
int ny = 100;
float zmin = 66000;
float zmax = 66300;
int nz = 300;
h3["energy"] = new TH3F("energy", "Total Energy Deposit;x;y;z", nx, xmin, xmax, ny, ymin, ymax, nz, 0, zmax - zmin);
// TRandom3 *rndm = new TRandom3();
int nev = 0;
vector<int> nphoton;
float xxx = 0;
float yyy = 0;
float zzz = 0;
float emax = 0;
double binx= 0;
double biny= 0;
double binz= 0;
while (myReader.Next())
{
nev++;
cout << "Event: " << nev << endl;
nphoton.push_back(0);
float tot_e = 0;
for (int i = 0; i < energy.GetSize(); i++)
{
nphoton.back()++;
tot_e += energy[i];
h3["energy"]->Fill(x[i],y[i],abs(z[i]) - zmin,energy[i]);
//h3["energy"]->Fill(x[i]+rndm->Gaus(0,1) ,y[i] + rndm->Gaus(0,1) , abs(z[i]) - zmin,energy[i] );
xxx = max(abs(x[i]), xxx);
yyy = max(abs(y[i]), yyy);
zzz = max(abs(z[i]), zzz);
}
}
cout << "Max-X: " << xxx << endl;
cout << "Max-Y: " << yyy << endl;
cout << "Max-Z: " << zzz << endl;
//cout << "Energy: " << energy << "GeV" <<endl;
// Fill Histograms
// *************************************************************************
// *************************************************************************
// Draw Histograms
for (map<string,TH3*>::const_iterator itr = h3.begin(); itr != h3.end(); itr++)
{
//gStyle->SetOptStat(0);
string hname = itr->first;
TH3* h = (TH3*)itr->second->Clone();
h->Scale(1.0/float(h->Integral()));
TH2* h2yx = (TH2*)h->Project3D("yx")->Clone();
TH2* h2zx = (TH2*)h->Project3D("zx")->Clone();
TH2* h2zy = (TH2*)h->Project3D("zy")->Clone();
TH1* h1x = (TH2*)h->Project3D("x")->Clone();
TH1* h1y = (TH2*)h->Project3D("y")->Clone();
TH1* h1z = (TH2*)h->Project3D("z")->Clone();
TH1* h1E = (TH2*)h->Project3D("energy")->Clone();
TH3* h3xyz = (TH3*)h->Project3D("xyz")->Clone();
c[0]->cd();
h2yx->GetXaxis()->SetTitle("x (mm)");
h2yx->GetYaxis()->SetTitle("y (mm)");
gPad->SetLogx(0); gPad->SetLogy(0); gPad->SetLogz(0);
h2yx->Draw("colz");
cout << "Bin Max XY:" << h2yx->GetMaximumBin() <<endl;
cout << "Energy XY" << h2yx->GetMaximum() <<endl;
//ss.str(""); ss << "test2D_yx_" << hname << ".png";
//c->SaveAs(TString(ss.str()));
c[1]->cd();
h2zx->GetXaxis()->SetTitle("x (mm)");
h2zx->GetYaxis()->SetTitle("z (mm)");
gPad->SetLogx(0); gPad->SetLogy(0); gPad->SetLogz(0);
h2zx->Draw("colz");
c[2]->cd();
h2zy->GetXaxis()->SetTitle("y (mm)");
h2zy->GetYaxis()->SetTitle("z (mm)");
gPad->SetLogx(0); gPad->SetLogy(0); gPad->SetLogz(0);
h2zy->Draw("colz");
c[3]->cd();
h1x->GetXaxis()->SetTitle("x (mm)");
gPad->SetLogx(0); gPad->SetLogy(1); gPad->SetLogz(0);
h1x->Draw("colz");
c[4]->cd();
h1y->GetXaxis()->SetTitle("y (mm)");
gPad->SetLogx(0); gPad->SetLogy(1); gPad->SetLogz(0);
h1y->Draw("colz");
c[5]->cd();
h1z->Draw("colz");
h1z->GetXaxis()->SetTitle("z (mm)");
h1z->GetXaxis()->SetRangeUser(0., 200);
h1z->SetTitle("Energy distribution");
h1z->GetYaxis()->SetTitle("#Delta E/#Delta X (GeV/mm)");
gPad->SetLogx(0); gPad->SetLogy(0); gPad->SetLogz(0);
c[6]->cd();
h3xyz->Draw("LEGO2");
h3xyz->SetTitle("");
h3xyz->GetXaxis()->SetTitle("X (mm)");
h3xyz->GetYaxis()->SetTitle("Y (mm)");
h3xyz->GetZaxis()->SetTitle("Z (mm)");
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided