544 {
545
546
547 gErrorIgnoreLevel = kWarning;
548
550
552 if( particle ==
"pion" )
mass = Widget::mpion;
553 else if( particle ==
"kaon" )
mass = Widget::mkaon;
554 else if( particle ==
"proton" )
mass = Widget::mproton;
555 else if( particle ==
"muon" )
mass = Widget::mmuon;
556 else if( particle ==
"electron" )
mass = Widget::melectron;
557 if(
mass == 0.0 ) exit(1);
558
559 TFile* infile = new TFile(m_filename);
560 TTree* hadron = (TTree*)infile->Get("track");
561
562 std::cout << "HadronPrep: reading in file " << m_filename << std::endl;
563 std::cout << "\t beta-gamma range: " << m_lowerbg << " to " << m_upperbg << std::endl;
564
565
566
567
568
569 double dedxpub;
570 double dedx;
571 double p;
573 double costh;
574 double db;
575 double dz;
576 double chiPi;
577 double eop;
578
579
580 int b2nhit;
581
582
583 double b3nhit;
584
585 hadron->SetBranchAddress("dedx", &dedxpub);
586 hadron->SetBranchAddress("dedxsat", &dedx);
587 hadron->SetBranchAddress("pF", &p);
588 hadron->SetBranchAddress("costh", &costh);
589 hadron->SetBranchAddress("db", &db);
590 hadron->SetBranchAddress("dz", &dz);
591 hadron->SetBranchAddress("chiPi", &chiPi);
592 hadron->SetBranchAddress("eopst", &eop);
593
594 if( m_type == 0 )
595 hadron->SetBranchAddress("numGoodHits", &b3nhit);
596 else if( m_type == 1 )
597 hadron->SetBranchAddress("lNHitsUsed", &b2nhit);
598
599
600 double bgstep = (m_upperbg-m_lowerbg)/m_bgbins;
601
602
603 TH1F* hdedx_bg[m_bgbins];
604 TH1F* hdedx_bg_pub[m_bgbins];
605 TH1F* hchi_bg[m_bgbins];
606 TH1F* hchi_bg_pub[m_bgbins];
607 TH1F* hsigma_bg[m_bgbins];
608
609
610 for( int i = 0; i < m_bgbins; ++i ){
611 char histname[100], histname2[100], histname3[100];
612 char histname4[100], histname5[100], histname6[100];
613 sprintf(histname,
"dedx_bg_%d",i);
614 sprintf(histname2,
"chi_bg_%d",i);
615 sprintf(histname3,
"chipub_bg_%d",i);
616 sprintf(histname4,
"dedxpub_bg_%d",i);
617 sprintf(histname5,
"dedxnew_bg_%d",i);
618 sprintf(histname6,
"sigma_bg_%d",i);
619
620 if( particle == "electron" ){
621 hdedx_bg[i] = new TH1F(histname,histname,200,0,2);
622 hchi_bg[i] = new TH1F(histname2,histname2,200,-2,2);
623 hchi_bg_pub[i] = new TH1F(histname3,histname3,200,-5,5);
624 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,2);
625 }
626 else if( particle == "proton" ){
627 if( i < 5 ){
628 hdedx_bg[i] = new TH1F(histname,histname,200,0,6);
629 hchi_bg[i] = new TH1F(histname2,histname2,200,-30,30);
630 hchi_bg_pub[i] = new TH1F(histname3,histname3,200,0,40);
631 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,6);
632 }
633 else if( i < 9 ){
634 hdedx_bg[i] = new TH1F(histname,histname,200,0,4);
635 hchi_bg[i] = new TH1F(histname2,histname2,200,-5,5);
636 hchi_bg_pub[i] = new TH1F(histname3,histname3,200,-20,20);
637 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,4);
638 }
639 else{
640 hdedx_bg[i] = new TH1F(histname,histname,200,0,2);
641 hchi_bg[i] = new TH1F(histname2,histname2,200,-5,5);
642 hchi_bg_pub[i] = new TH1F(histname3,histname3,200,-5,5);
643 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,2);
644 }
645 }
646 else if( i < 2 ){
647 hdedx_bg[i] = new TH1F(histname,histname,200,0,4);
648 hchi_bg[i] = new TH1F(histname2,histname2,200,-5,5);
649 hchi_bg_pub[i] = new TH1F(histname3,histname3,200,-20,20);
650 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,4);
651 }
652 else{
653 hdedx_bg[i] = new TH1F(histname,histname,200,0,2);
654 hchi_bg[i] = new TH1F(histname2,histname2,200,-5,5);
655 hchi_bg_pub[i] = new TH1F(histname3,histname3,100,-5,5);
656 hdedx_bg_pub[i] = new TH1F(histname4,histname4,200,0,2);
657 }
658 hsigma_bg[i] = new TH1F(histname6,histname6,100,-3,3);
659 }
660
661
662 double sumcos[m_bgbins];
663 double sumsin[m_bgbins];
664 double sumbg[m_bgbins];
665 double sumressq[m_bgbins];
666 int sumsize[m_bgbins];
667 for( int i = 0; i < m_bgbins; ++i ){
668 sumcos[i] = 0;
669 sumsin[i] = 0;
670 sumbg[i] = 0;
671 sumressq[i] = 0;
672 sumsize[i] = 0;
673 }
674
675
676 double means[m_bgbins];
677 double errors[m_bgbins];
678 double widths[m_bgbins];
679 for( int i = 0; i < m_bgbins; ++i ){
680 means[i] = 0;
681 errors[i] = 0;
682 widths[i] = 0;
683 }
684
685
686 const int cosbins = 20;
687 const double cosstep = 2.0 / cosbins;
688 double cosArray[cosbins], cosArrayErr[cosbins];
689 for( int i = 0; i < cosbins; ++i ){
690 cosArray[i] = -1 + (i*cosstep + cosstep/2.0);
691 cosArrayErr[i] = 0.0;
692 }
693
694 TH1F* hchi_costh_all[2][cosbins];
695 TH1F* hchi_costh_0[2][cosbins];
696 TH1F* hchi_costh_1[2][cosbins];
697 TH1F* hchi_costh_2[2][cosbins];
698
699 for( int i = 0; i < cosbins; ++i ){
700 char histname[100], histname0[100], histname1[100], histname2[100];
701 sprintf(histname,
"chi_costh_pos_%d",i);
702 sprintf(histname0,
"chi_costh0_pos_%d",i);
703 sprintf(histname1,
"chi_costh1_pos_%d",i);
704 sprintf(histname2,
"chi_costh2_pos_%d",i);
705
706 hchi_costh_all[0][i] = new TH1F(histname,histname,100,-5,5);
707 hchi_costh_0[0][i] = new TH1F(histname0,histname0,100,-5,5);
708 hchi_costh_1[0][i] = new TH1F(histname1,histname1,100,-5,5);
709 hchi_costh_2[0][i] = new TH1F(histname2,histname2,100,-5,5);
710
711 sprintf(histname,
"chi_costh_neg_%d",i);
712 sprintf(histname0,
"chi_costh0_neg_%d",i);
713 sprintf(histname1,
"chi_costh1_neg_%d",i);
714 sprintf(histname2,
"chi_costh2_neg_%d",i);
715
716 hchi_costh_all[1][i] = new TH1F(histname,histname,100,-5,5);
717 hchi_costh_0[1][i] = new TH1F(histname0,histname0,100,-5,5);
718 hchi_costh_1[1][i] = new TH1F(histname1,histname1,100,-5,5);
719 hchi_costh_2[1][i] = new TH1F(histname2,histname2,100,-5,5);
720 }
721
722
723
725
726
727
728
729
730
731 for( unsigned int index = 0; index < hadron->GetEntries(); ++index ){
732 hadron->GetEvent(index);
733
734 int charge = (p < 0)? 1 : 0;
736
737 int nhit;
738 if( m_type == 0 )
739 nhit = std::floor(b3nhit);
740 else if( m_type == 1 )
741 nhit = b2nhit;
742
743
744 if( nhit < 0 || nhit > 100 || dedx <= 0 || costh != costh ||
746 continue;
747
748
749 if( particle == "pion" && eop > 0.75 ) continue;
750
751
752 if( particle == "proton" && (dedxpub < 0 || dedxpub > 100 || dedxpub < 0.85/fabs(p)) )
753 continue;
754 if( particle == "kaon" && dedxpub < 0.4/fabs(p) )
755 continue;
756
757 int bgBin = (int)((
bg-m_lowerbg)/(m_upperbg-m_lowerbg) * m_bgbins);
758
759 double dedx_pre = dedx;
760 double dedx_new = dedx_pre;
761 if( !m_mcFlag ) dedx_new = m_hadsat.
D2I(costh,m_hadsat.
I2D(costh,1.0)*dedx);
763 double dedx_res = m_gpar.
sigmaPrediction(dedx_cur,nhit,sqrt(1-costh*costh));
764
765 double chi_new = (dedx_new-dedx_cur)/dedx_res;
766 if( particle == "electron" ) chi_new = (dedx_new-1)/dedx_res;
767 double res_cor = m_gpar.
resPrediction(nhit,sqrt(1-costh*costh));
768 int i = (int) ( (fabs(
bg)-m_lowerbg)/bgstep );
769 hsigma_bg[i]->Fill((dedx_new-dedx_cur)/res_cor);
770
771 if( correct ) hdedx_bg[bgBin]->Fill(dedx_new);
772 else hdedx_bg[bgBin]->Fill(dedx_pre);
773 hdedx_bg_pub[bgBin]->Fill(dedxpub);
774 if( correct ) hchi_bg[bgBin]->Fill(chi_new);
775 hchi_bg_pub[bgBin]->Fill(chiPi);
776
777 sumcos[bgBin] += costh;
778 sumsin[bgBin] += sqrt(1-costh*costh);
780 sumressq[bgBin] += pow(dedx_res,2);
781 sumsize[bgBin] += 1;
782
783
784 int icos = (int)((costh+1)/cosstep);
785 hchi_costh_all[
charge][icos]->Fill(chi_new);
786 if( bgBin < int(m_bgbins/3) )
787 hchi_costh_0[
charge][icos]->Fill(chi_new);
788 else if( bgBin < 2*int(m_bgbins/3) )
789 hchi_costh_1[
charge][icos]->Fill(chi_new);
790 else
791 hchi_costh_2[
charge][icos]->Fill(chi_new);
792
793 }
794
795
796
797
798
799
800
801 TTree* satTree = new TTree(particle,"dE/dx means and errors");
802
803 double satbg;
804 double satcosth;
805 double satdedx;
806 double saterror;
807 double satbg_avg;
808 double satcosth_avg;
809 double satsinth_avg;
810 double satdedxres_avg;
811 double satpubdedx;
812 double satpuberror;
813 double satpubwidth;
814 double satchi;
815 double satchierr;
816 double satchiwidth;
817 double satchipub;
818 double satchipuberr;
819 double satchipubwidth;
820 double ratio;
821
822 satTree->Branch("bg",&satbg,"bg/D");
823 satTree->Branch("costh",&satcosth,"costh/D");
824 satTree->Branch("dedx",&satdedx,"dedx/D");
825 satTree->Branch("error",&saterror,"error/D");
826 satTree->Branch("bg_avg",&satbg_avg,"bg_avg/D");
827 satTree->Branch("costh_avg",&satcosth_avg,"costh_avg/D");
828 satTree->Branch("sinth_avg",&satsinth_avg,"sinth_avg/D");
829 satTree->Branch("dedxres_avg",&satdedxres_avg,"dedxres_avg/D");
830 satTree->Branch("dedx_pub",&satpubdedx,"dedx_pub/D");
831 satTree->Branch("dedxerr_pub",&satpuberror,"dedxerr_pub/D");
832 satTree->Branch("chi",&satchi,"chi/D");
833 satTree->Branch("chi_pub",&satchipub,"chi_pub/D");
834 satTree->Branch("sigma",&satchiwidth,"sigma/D");
835 satTree->Branch("sigma_pub",&satchipubwidth,"sigma_pub/D");
836 satTree->Branch("ratio",&ratio,"ratio/D");
837
838
839 for( int i = 0; i < m_bgbins; ++i ){
840
841
842 satbg = m_lowerbg+0.5*bgstep+i*bgstep;
843
844 satbg_avg = sumbg[i]/sumsize[i];
845 satcosth_avg = sumcos[i]/sumsize[i];
846 satsinth_avg = sumsin[i]/sumsize[i];
847
848
849 hsigma_bg[i]->Fit("gaus","ql");
850 satdedxres_avg = hsigma_bg[i]->GetFunction("gaus")->GetParameter(2);
851
853
854
855 fs = hdedx_bg[i]->Fit(
"gaus",
"ql");
856 if(
fs != 0 ) std::cout <<
"\t\t" <<
"MEAN FIT STATUS " <<
fs << std::endl;
857 double mean = hdedx_bg[i]->GetFunction("gaus")->GetParameter(1);
858 double width = hdedx_bg[i]->GetFunction("gaus")->GetParameter(2);
859 fs = hdedx_bg[i]->Fit(
"gaus",
"ql",
"",mean-2.5*width,mean+2.5*width);
860 if(
fs != 0 ) std::cout <<
"\t\t" <<
"MEAN FIT STATUS " <<
fs << std::endl;
861
862 satdedx = hdedx_bg[i]->GetFunction("gaus")->GetParameter(1);
863 saterror = hdedx_bg[i]->GetFunction("gaus")->GetParError(1);
864 means[i] = satdedx;
865 errors[i] = saterror;
866 widths[i] = hdedx_bg[i]->GetFunction("gaus")->GetParameter(2);
867
868
869
870 fs = hdedx_bg_pub[i]->Fit(
"gaus",
"ql");
871 if(
fs != 0 ) std::cout <<
"\t\t" <<
"MEAN PUB FIT STATUS " <<
fs << std::endl;
872 mean = hdedx_bg_pub[i]->GetFunction("gaus")->GetParameter(1);
873 width = hdedx_bg_pub[i]->GetFunction("gaus")->GetParameter(2);
874 fs = hdedx_bg_pub[i]->Fit(
"gaus",
"ql",
"",mean-2.5*width,mean+2.5*width);
875 if(
fs != 0 ) std::cout <<
"\t\t" <<
"MEAN PUB FIT STATUS " <<
fs << std::endl;
876
877 satpubdedx = hdedx_bg_pub[i]->GetFunction("gaus")->GetParameter(1);
878 satpuberror = hdedx_bg_pub[i]->GetFunction("gaus")->GetParError(1);
879 satpubwidth = hdedx_bg_pub[i]->GetFunction("gaus")->GetParameter(2);
880
881
882
883 fs = hchi_bg[i]->Fit(
"gaus",
"ql");
884 if(
fs != 0 ) std::cout <<
"\t\t" <<
"CHI FIT STATUS " <<
fs << std::endl;
885 mean = hchi_bg[i]->GetFunction("gaus")->GetParameter(1);
886 width = hchi_bg[i]->GetFunction("gaus")->GetParameter(2);
887 fs = hchi_bg[i]->Fit(
"gaus",
"ql",
"",mean-2.5*width,mean+2.5*width);
888 if(
fs != 0 ) std::cout <<
"\t\t" <<
"CHI FIT STATUS " <<
fs << std::endl;
889
890 satchi = hchi_bg[i]->GetFunction("gaus")->GetParameter(1);
891 satchierr = hchi_bg[i]->GetFunction("gaus")->GetParError(1);
892 satchiwidth = hchi_bg[i]->GetFunction("gaus")->GetParameter(2);
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
911
912
913 satTree->Fill();
914 }
915
916 std::string corname("uncorrected");
917 if( correct == true ) corname = "corrected";
918
919
920 TCanvas* ctmp = new TCanvas("tmp","tmp",900,900);
921 ctmp->Divide(3,3);
922 std::stringstream psname; psname << "plots/dedx_" << particle << "_" << corname << ".ps[";
923 ctmp->Print(psname.str().c_str());
924 psname.str(""); psname << "plots/dedx_" << particle << "_" << corname << ".ps";
925 for( int i = 0 ; i < m_bgbins; ++i ){
926 ctmp->cd(i%9+1);
927 hdedx_bg[i]->Draw();
928 if((i+1)%9==0)
929 ctmp->Print(psname.str().c_str());
930 }
931 psname.str(""); psname << "plots/dedx_" << particle << "_" << corname << ".ps]";
932 ctmp->Print(psname.str().c_str());
933 delete ctmp;
934
935 std::cout << "HadronPrep: saving output to " << outfile->GetName() << std::endl;
936
937
938 outfile->cd();
939 satTree->Write();
940
941 std::cout << "making validation plots..." << std::endl;
942
943
944
945
946
947 double chicos[2][cosbins], sigmacos[2][cosbins];
948 double chicoserr[2][cosbins], sigmacoserr[2][cosbins];
949
950 double chicos0[2][cosbins], sigmacos0[2][cosbins];
951 double chicos0err[2][cosbins], sigmacos0err[2][cosbins];
952
953 double chicos1[2][cosbins], sigmacos1[2][cosbins];
954 double chicos1err[2][cosbins], sigmacos1err[2][cosbins];
955
956 double chicos2[2][cosbins], sigmacos2[2][cosbins];
957 double chicos2err[2][cosbins], sigmacos2err[2][cosbins];
958
959 for( int c = 0; c < 2; ++c ){
960 for( int i = 0; i < cosbins; ++i ){
961 if( hchi_costh_all[c][i]->Integral(1,100) == 0 ) continue;
962 hchi_costh_all[c][i]->Fit("gaus","ql");
963 chicos[c][i] = hchi_costh_all[c][i]->GetFunction("gaus")->GetParameter(1);
964 chicoserr[c][i] = hchi_costh_all[c][i]->GetFunction("gaus")->GetParError(1);
965 sigmacos[c][i] = hchi_costh_all[c][i]->GetFunction("gaus")->GetParameter(2);
966 sigmacoserr[c][i] = hchi_costh_all[c][i]->GetFunction("gaus")->GetParError(2);
967 }
968 for( int i = 0; i < cosbins; ++i ){
969 if( hchi_costh_0[c][i]->Integral(1,100) == 0 ) continue;
970 hchi_costh_0[c][i]->Fit("gaus","ql");
971 chicos0[c][i] = hchi_costh_0[c][i]->GetFunction("gaus")->GetParameter(1);
972 chicos0err[c][i] = hchi_costh_0[c][i]->GetFunction("gaus")->GetParError(1);
973 sigmacos0[c][i] = hchi_costh_0[c][i]->GetFunction("gaus")->GetParameter(2);
974 sigmacos0err[c][i] = hchi_costh_0[c][i]->GetFunction("gaus")->GetParError(2);
975 }
976 for( int i = 0; i < cosbins; ++i ){
977 if( hchi_costh_1[c][i]->Integral(1,100) == 0 ) continue;
978 hchi_costh_1[c][i]->Fit("gaus","ql");
979 chicos1[c][i] = hchi_costh_1[c][i]->GetFunction("gaus")->GetParameter(1);
980 chicos1err[c][i] = hchi_costh_1[c][i]->GetFunction("gaus")->GetParError(1);
981 sigmacos1[c][i] = hchi_costh_1[c][i]->GetFunction("gaus")->GetParameter(2);
982 sigmacos1err[c][i] = hchi_costh_1[c][i]->GetFunction("gaus")->GetParError(2);
983 }
984 for( int i = 0; i < cosbins; ++i ){
985 if( hchi_costh_2[c][i]->Integral(1,100) == 0 ) continue;
986 hchi_costh_2[c][i]->Fit("gaus","ql");
987 chicos2[c][i] = hchi_costh_2[c][i]->GetFunction("gaus")->GetParameter(1);
988 chicos2err[c][i] = hchi_costh_2[c][i]->GetFunction("gaus")->GetParError(1);
989 sigmacos2[c][i] = hchi_costh_2[c][i]->GetFunction("gaus")->GetParameter(2);
990 sigmacos2err[c][i] = hchi_costh_2[c][i]->GetFunction("gaus")->GetParError(2);
991 }
992 }
993
994
995 TCanvas* ctmp2 = new TCanvas("tmp2","tmp2",900,900);
996 ctmp2->Divide(3,3);
997 psname.str(""); psname << "plots/chivscos_fits_" << particle << ".ps[";
998 ctmp2->Print(psname.str().c_str());
999 psname.str(""); psname << "plots/chivscos_fits_" << particle << ".ps";
1000 for( int i = 0 ; i < cosbins; ++i ){
1001 ctmp2->cd(i%9+1);
1002 hchi_costh_all[0][i]->Draw();
1003 hchi_costh_all[1][i]->SetMarkerColor(kRed);
1004 hchi_costh_all[1][i]->Draw("same");
1005 if((i+1)%9==0)
1006 ctmp2->Print(psname.str().c_str());
1007 }
1008 psname.str(""); psname << "plots/chivscos_fits_" << particle << ".ps]";
1009 ctmp2->Print(psname.str().c_str());
1010 delete ctmp2;
1011
1012 TGraphErrors* grchicos = new TGraphErrors(cosbins,cosArray,chicos[0],cosArrayErr,chicoserr[0]);
1013 TGraphErrors* grchicos0 = new TGraphErrors(cosbins,cosArray,chicos0[0],cosArrayErr,chicos0err[0]);
1014 TGraphErrors* grchicos1 = new TGraphErrors(cosbins,cosArray,chicos1[0],cosArrayErr,chicos1err[0]);
1015 TGraphErrors* grchicos2 = new TGraphErrors(cosbins,cosArray,chicos2[0],cosArrayErr,chicos2err[0]);
1016
1017 TGraphErrors* grchicosn = new TGraphErrors(cosbins,cosArray,chicos[1],cosArrayErr,chicoserr[1]);
1018 TGraphErrors* grchicos0n = new TGraphErrors(cosbins,cosArray,chicos0[1],cosArrayErr,chicos0err[1]);
1019 TGraphErrors* grchicos1n = new TGraphErrors(cosbins,cosArray,chicos1[1],cosArrayErr,chicos1err[1]);
1020 TGraphErrors* grchicos2n = new TGraphErrors(cosbins,cosArray,chicos2[1],cosArrayErr,chicos2err[1]);
1021
1022 TGraphErrors* grsigmacos = new TGraphErrors(cosbins,cosArray,sigmacos[0],cosArrayErr,sigmacoserr[0]);
1023 TGraphErrors* grsigmacos0 = new TGraphErrors(cosbins,cosArray,sigmacos0[0],cosArrayErr,sigmacos0err[0]);
1024 TGraphErrors* grsigmacos1 = new TGraphErrors(cosbins,cosArray,sigmacos1[0],cosArrayErr,sigmacos1err[0]);
1025 TGraphErrors* grsigmacos2 = new TGraphErrors(cosbins,cosArray,sigmacos2[0],cosArrayErr,sigmacos2err[0]);
1026
1027 TGraphErrors* grsigmacosn = new TGraphErrors(cosbins,cosArray,sigmacos[1],cosArrayErr,sigmacoserr[1]);
1028 TGraphErrors* grsigmacos0n = new TGraphErrors(cosbins,cosArray,sigmacos0[1],cosArrayErr,sigmacos0err[1]);
1029 TGraphErrors* grsigmacos1n = new TGraphErrors(cosbins,cosArray,sigmacos1[1],cosArrayErr,sigmacos1err[1]);
1030 TGraphErrors* grsigmacos2n = new TGraphErrors(cosbins,cosArray,sigmacos2[1],cosArrayErr,sigmacos2err[1]);
1031
1032 TLine* line0 = new TLine(-1,0,1,0);
1033 line0->SetLineStyle(kDashed);
1034 line0->SetLineColor(kRed);
1035 TLine* line1 = new TLine(-1,1,1,1);
1036 line1->SetLineStyle(kDashed);
1037 line1->SetLineColor(kRed);
1038
1040 if( particle ==
"pion" )
ptype +=
"#pi";
1041 else if( particle ==
"kaon" )
ptype +=
"K";
1042 else if( particle ==
"proton" )
ptype +=
"p";
1043 else if( particle ==
"muon" )
ptype +=
"#mu";
1044 else if( particle ==
"electron" )
ptype +=
"e";
1045
1046 TLegend* lchi = new TLegend(0.6,0.75,0.8,0.85);
1047 lchi->SetBorderSize(0);
1048 lchi->SetFillColor(0);
1049 lchi->AddEntry(grchicos,
ptype+
"^{+}",
"p");
1050 lchi->AddEntry(grchicosn,
ptype+
"^{-}",
"p");
1051 TCanvas* cchi = new TCanvas("cchi","cchi",700,600);
1052
1055 grchicos->Draw("AP");
1056 grchicosn->Draw("P,same");
1057 line0->Draw("same");
1058 lchi->Draw("same");
1059 cchi->SaveAs("plots/chiall"+particle+".eps");
1060
1063 grchicos0->Draw("AP");
1064 grchicos0n->Draw("P,same");
1065 line0->Draw("same");
1066 lchi->Draw("same");
1067 cchi->SaveAs("plots/chi0"+particle+".eps");
1068
1071 grchicos1->Draw("AP");
1072 grchicos1n->Draw("P,same");
1073 line0->Draw("same");
1074 lchi->Draw("same");
1075 cchi->SaveAs("plots/chi1"+particle+".eps");
1076
1079 grchicos2->Draw("AP");
1080 grchicos2n->Draw("P,same");
1081 line0->Draw("same");
1082 lchi->Draw("same");
1083 cchi->SaveAs("plots/chi2"+particle+".eps");
1084
1087 grsigmacos->Draw("AP");
1088 grsigmacosn->Draw("P,same");
1089 line1->Draw("same");
1090 lchi->Draw("same");
1091 cchi->SaveAs("plots/sigmaall"+particle+".eps");
1092
1095 grsigmacos0->Draw("AP");
1096 grsigmacos0n->Draw("P,same");
1097 line1->Draw("same");
1098 lchi->Draw("same");
1099 cchi->SaveAs("plots/sigma0"+particle+".eps");
1100
1103 grsigmacos1->Draw("AP");
1104 grsigmacos1n->Draw("P,same");
1105 line1->Draw("same");
1106 lchi->Draw("same");
1107 cchi->SaveAs("plots/sigma1"+particle+".eps");
1108
1111 grsigmacos2->Draw("AP");
1112 grsigmacos2n->Draw("P,same");
1113 line1->Draw("same");
1114 lchi->Draw("same");
1115 cchi->SaveAs("plots/sigma2"+particle+".eps");
1116
1117 for( int i = 0; i < 2; ++i ){
1118 for( int j = 0; j < cosbins; ++j ){
1119 delete hchi_costh_all[i][j];
1120 delete hchi_costh_0[i][j];
1121 delete hchi_costh_1[i][j];
1122 delete hchi_costh_2[i][j];
1123 }
1124 }
1125
1126 delete grchicos;
1127 delete grchicos0;
1128 delete grchicos1;
1129 delete grchicos2;
1130
1131 delete grchicosn;
1132 delete grchicos0n;
1133 delete grchicos1n;
1134 delete grchicos2n;
1135
1136 delete grsigmacos;
1137 delete grsigmacos0;
1138 delete grsigmacos1;
1139 delete grsigmacos2;
1140
1141 delete grsigmacosn;
1142 delete grsigmacos0n;
1143 delete grsigmacos1n;
1144 delete grsigmacos2n;
1145
1146 delete line0;
1147 delete line1;
1148
1149 delete lchi;
1150 delete cchi;
1151}
string::const_iterator ptype
void FormatGraph(TGraphErrors *gr, int flag)