Float_t binfit_h[maxbin_h]; Float_t binfit_m2s3[maxbin_m2s3]; TH3F *h31; TH3F *h3m2s3; walkcorrdata->GetObject("h32",h32); // Station2(h)_diff air vs totM2, totS2 walkcorrdata->GetObject("h3m2s3",h3m2s3); // MCP2-SciTil3_diff air vs totM2, totS3 static const Int_t maxbin_h = (h32->GetNbinsX() + 2) * (h32->GetNbinsY() + 2); static const Int_t maxbin_m2s3 = (h3m2s3->GetNbinsX() + 2) * (h3m2s3->GetNbinsY() + 2); Double_t h_m = gauss_hinten->GetParameter(1); Double_t m2s3_m = (gauss_m2s3->GetParameter(1) + gauss_m2s3->GetParameter(4))/2. ; if (valid[mcp_2]){ if (valid[s_3_L] && valid[s_3_R]){ Int_t getbin_m2s3 = h3m2s3->FindBin( tot[s_3_L]+tot[s_3_R] - st3_m, tot[mcp_2] - mt2_m, -100); if(binfit_m2s3[getbin_m2s3] == 0){ Int_t getbinx_m2s3, getbiny_m2s3, getbinz_m2s3; h3m2s3->GetBinXYZ(getbin_m2s3, getbinx_m2s3, getbiny_m2s3, getbinz_m2s3); TH1D *h3m2s3_pz = h3m2s3->ProjectionZ("h3m2s3_pz",getbinx_m2s3,getbinx_m2s3,getbiny_m2s3,getbiny_m2s3,""); if(h3m2s3_pz->GetEntries() > 200){ Int_t m2s3cmax = h3m2s3_pz->GetMaximumBin(); TF1 *gauss_m2s3c = new TF1("gauss_m2s3c","gaus(0)"); gauss_m2s3c->SetParameters(h3m2s3_pz->GetBinContent(m2s3cmax), gauss_m2s3->GetParameter(1) - m2s3_m, gauss_m2s3->GetParameter(2)); if(doFitCorrection){ Int_t fitResult_gauss_m2s3c = h3m2s3_pz->Fit("gauss_m2s3c","Q"); if(fitResult_gauss_m2s3c == 0){ binfit_m2s3[getbin_m2s3] = gauss_m2s3c->GetParameter(1) + 50. ; fitted++; }else{ binfit_m2s3[getbin_m2s3] = -1. ; fitfailed++; } }else{ ProjectionCorrection[4] = h3m2s3P->GetBinContent(getbinx_m2s3, getbiny_m2s3) + 50; binfit_m2s3[getbin_m2s3] = 1.; } h3m2s3_pz->Delete(); gauss_m2s3c->Delete(); }else{ binfit_m2s3[getbin_m2s3] = -1.; skipped++; } }else{ reused++; } if(binfit_m2s3[getbin_m2s3] > 0){ if(doFitCorrection){ temp = (lead[s_3_L]+lead[s_3_R])/2. - lead[mcp_2] - binfit_m2s3[getbin_m2s3] - m2s3_m + 50.; }else{ temp = (lead[s_3_L]+lead[s_3_R])/2. - lead[mcp_2] - ProjectionCorrection[4] - m2s3_m + 50.; } h1m2s3c->Fill(temp); } } } if (valid[mcp_1] ){ if (valid[s_1_L] && valid[s_1_R]){ Int_t getbin_v = h31->FindBin(tot[mcp_1] - mt1_m, tot[s_1_L]+tot[s_1_R] - st1_m,-100); if(binfit_v[getbin_v] == 0){ Int_t getbinx_v, getbiny_v, getbinz_v; h31->GetBinXYZ(getbin_v, getbinx_v, getbiny_v, getbinz_v); TH1D *h31_pz = h31->ProjectionZ("h31_pz",getbinx_v,getbinx_v,getbiny_v,getbiny_v,""); if(h31_pz->GetEntries() > 200){ Int_t vcmax = h31_pz->GetMaximumBin(); TF1 *gauss_vc = new TF1("gauss_vc","[0]*exp(-0.5*((x-[1])/[2])**2)"); gauss_vc->SetParameters(h31_pz->GetBinContent(vcmax), gauss_vorne->GetParameter(1) - v_m, gauss_vorne->GetParameter(2)); if(doFitCorrection){ Int_t fitResult_gauss_vc = h31_pz->Fit("gauss_vc","Q"); if(fitResult_gauss_vc == 0){ binfit_v[getbin_v] = gauss_vc->GetParameter(1) + 50. ; fitted++; }else{ binfit_v[getbin_v] = -1. ; fitfailed++; } }else{ ProjectionCorrection[4] = h31P->GetBinContent(getbinx_v, getbiny_v) + 50; binfit_v[getbin_v] = 1.; } h31_pz->Delete(); gauss_vc->Delete(); }else{ binfit_v[getbin_v] = -1.; skipped++; } }else{ reused++; } if(binfit_v[getbin_v] > 0){ if(doFitCorrection){ temp = (lead[s_1_L]+lead[s_1_R])/2. - lead[mcp_1] - binfit_v[getbin_v] - v_m + 50.; }else{ temp = (lead[s_1_L]+lead[s_1_R])/2. - lead[mcp_1] - ProjectionCorrection[4] - v_m + 50.; } h1vc->Fill(temp); } } }