void plot_xres(double minTheta, double maxTheta, TString name,TTree* tree,int nentries) { TString canvname="c_"; canvname+=name.ReplaceAll(" ","_"); TCanvas* c= new TCanvas(canvname,name.Data(),1500,700); c->Divide(2,1); TString cut="CutCosmics._theta>"; cut+=minTheta; cut+="&&CutCosmics._theta<"; cut+=maxTheta; TString hname="h_"; hname+=name.ReplaceAll(" ","_"); TString htit="ResX "; htit+=name; TH2D* hist= new TH2D(hname.Data(),htit.Data(),75,0,75,200,-0.5,0.5); tree->Project(hist->GetName(),"CutCosmics._TpcResX:CutCosmics._TpcPosZ",cut.Data(),"",nentries,0); c->cd(1); hist->Draw("colz"); hist->FitSlicesY(0,0,-1,0,"QNRG3S"); TString slicename=hist->GetName(); slicename+="_2"; TH2D* slices=gDirectory->Get(slicename.Data()); c->cd(2); slices->Draw(); } void makeResHist(TString outfname, TTree* tree) { //TFile outfile=TFile(outfname.Data(),"recreate"); TFile outfile=TFile(outfname.Data(),"update"); int resbin=100; TH2D* hresX=new TH2D("hresX","residual X",75,0,75,resbin,-2000,2000); std::cout<<"projecting resX\n"; tree->Project(hresX->GetName(),"CutCosmics._TpcResX*10000:CutCosmics._TpcProj.Z()","CutCosmics._phi<-80&&CutCosmics._phi>-110","",tree->GetEntries(),0); TH2D* hresXRCut=new TH2D("hresXRCut","residual X R-Cut",75,0,75,resbin,-2000,2000); std::cout<<"projecting resX r-cut\n"; tree->Project(hresXRCut->GetName(),"CutCosmics._TpcResX*10000:CutCosmics._TpcProj.Z()","CutCosmics._phi<-80&&CutCosmics._phi>-110&&CutCosmics._TpcPosR<13&&CutCosmics._TpcPosR>7","",tree->GetEntries(),0); TH2D* hresZ=new TH2D("hresZ","residual Z",75,0,75,resbin,-2000,2000); std::cout<<"projecting resZ\n"; tree->Project(hresZ->GetName(),"CutCosmics._TpcResZ*10000:CutCosmics._TpcProj.Z()","CutCosmics._theta>80&&CutCosmics._theta<110","",tree->GetEntries(),0); TH2D* hresZRCut=new TH2D("hresZRCut","residual Z R-Cut",75,0,75,resbin,-2000,2000); std::cout<<"projecting resZ r-cut\n"; tree->Project(hresZRCut->GetName(),"CutCosmics._TpcResZ*10000:CutCosmics._TpcProj.Z()","CutCosmics._theta>80&&CutCosmics._theta<110&&CutCosmics._TpcPosR<13&&CutCosmics._TpcPosR>7","",tree->GetEntries(),0); TH2D* hresU=new TH2D("hresU","residual U",75,0,75,resbin,-2000,2000); std::cout<<"projecting resU\n"; tree->Project(hresU->GetName(),"CutCosmics._TpcResU*10000:CutCosmics._TpcProj.Z()","","",tree->GetEntries(),0); TH2D* hresURCut=new TH2D("hresURCut","residual U R-Cut",75,0,75,resbin,-2000,2000); std::cout<<"projecting resU r-cut\n"; tree->Project(hresURCut->GetName(),"CutCosmics._TpcResU*10000:CutCosmics._TpcProj.Z()","CutCosmics._TpcPosR<13&&CutCosmics._TpcPosR>7","",tree->GetEntries(),0); TH2D* hresV=new TH2D("hresV","residual V",75,0,75,resbin,-2000,2000); std::cout<<"projecting resV\n"; tree->Project(hresV->GetName(),"CutCosmics._TpcResV*10000:CutCosmics._TpcProj.Z()","","",tree->GetEntries(),0); TH2D* hresVRCut=new TH2D("hresVRCut","residual V R-Cut",75,0,75,resbin,-2000,2000); std::cout<<"projecting resV r-cut\n"; tree->Project(hresVRCut->GetName(),"CutCosmics._TpcResV*10000:CutCosmics._TpcProj.Z()","CutCosmics._TpcPosR<13&&CutCosmics._TpcPosR>7","",tree->GetEntries(),0); outfile.mkdir("/reshists"); outfile.cd("/reshists"); hresX ->Write(); hresXRCut->Write(); hresZ ->Write(); hresZRCut->Write(); hresU ->Write(); hresURCut->Write(); hresV ->Write(); hresVRCut->Write(); outfile.Close(); } void makeAllResHist() { //Data: //TTree* tree1=openChain("3883-3901","outfiles_e12/Data/Cosmics/","86_ArCO2_85_planeErr_rev28601_paramRev28591_thirdIter.reco"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/runC_86_ArCO2_85_planeErr_rev28601_paramRev28591_thirdIter.resHists.root",tree1); //TTree* tree2=openChain("3883-3901","outfiles_e12/Data/Cosmics/","86_ArCO2_85_recl_planeErr_rev28601_paramRev28591_thirdIter.reco"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/runC_86_ArCO2_85_recl_planeErr_rev28601_paramRev28591_thirdIter.resHists.root",tree2); //TTree* tree3=openChain("3883-3901","outfiles_e12/Data/Cosmics/","86_ArCO2_85_clcorr_planeErr_rev28618_paramRev28604_fourthIter.reco"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/runC_86_ArCO2_85_clcorr_planeErr_rev28618_paramRev28604_fourthIter.resHists.root",tree3); //TTree* tree4=openChain("3883-3901","outfiles_e12/Data/Cosmics/","recl_clcorr_planeErr_rev28618_paramRev28604_fourthIter.reco"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/runC_86_ArCO2_85_recl_clcorr_planeErr_rev28618_paramRev28604_fourthIter.resHists.root",tree4); //TTree* tree5=openChain("3883-3901","outfiles_e12/Data/Cosmics/","86_ArCO2_85_recl_clcorr_stdErr_rev28576_.reco"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/runC_86_ArCO2_85_recl_clcorr_stdErr_rev28576.resHists.root",tree5); //SIM: //std::cout<<"doing file: outfiles_e12/MC/cosmics_1M/drift_86.0/new_error/partsnoDev_rev28663_paramRev28591_recl\n"; //TTree* tree1=openMCChain("outfiles_e12/MC/cosmics_1M/drift_86.0/new_error/partsnoDev_rev28663_paramRev28591_recl/"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/Cosmics_86_ArCO2_85_planeErr_noDev_rev28663_paramRev28591_recl.resHists.root",tree1); //std::cout<<"doing file: utfiles_e12/MC/cosmics_1M/drift_86.0/new_error/parts_rev28663_paramRev28591_recl_clcorr\n"; //TTree* tree2=openMCChain("outfiles_e12/MC/cosmics_1M/drift_86.0/new_error/parts_rev28663_paramRev28591_recl_clcorr/"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/Cosmics_86_ArCO2_85_planeErr_rev28663_paramRev28591_recl_clcorr.resHists.root",tree2); //std::cout<<"doing file: outfiles_e12/MC/cosmics_1M/drift_86.0/new_error/parts_rev28663_paramRev28591_recl\n"; //TTree* tree3=openMCChain("outfiles_e12/MC/cosmics_1M/drift_86.0/new_error/parts_rev28663_paramRev28591_recl/"); //makeResHist("/home/mberger/gurkensalat/images/chap_Results/sec_Resolution/Cosmics_86_ArCO2_85_planeErr_rev28663_paramRev28591_recl.resHists.root",tree3); //All Data: std::cout<<"Doing 86 argon 81\n"; TTree * tree1=openChain("3980-4009","outfiles_e12/Data/Cosmics/","81_recl_clcorr_planeErr_rev28931_secondIteration.reco"); makeResHist("outfiles_e12/Data/Cosmics/runC_86_ArCO2_81_recl_clcorr_planeErr_rev28931_secondIteration.hists.root",tree1); std::cout<<"done\n"; }