ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/StudyModule.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/StudyModule.C (file contents):
Revision 1.1 by buchmann, Mon Jan 30 14:46:26 2012 UTC vs.
Revision 1.2 by buchmann, Mon Feb 13 13:56:21 2012 UTC

# Line 757 | Line 757 | void kinematic_dist_of_pred_and_obs() {/
757    make_double_plot("pfJetGoodNum",8,0.5,8.5,20,nolog,"nJets","nJets_MC",observed,predictedMC,mc);
758  
759   }
760 +
761 +
762 + void jzb_negative_generator_study() {
763 +  write_warning(__FUNCTION__,"We are going to use a t5zz scan file, and \033[1;31m WON'T \033[1;35m cut on MassGlu/MassLSP in order to improve statistics. This is ok for small studies, for a real study you'll need to look at points individually ...");
764 +
765 +
766 +  scansample.AddSample("/scratch/buchmann/ntuples/GeneratorInformationInJZB___JZBplusSamples_TestingSMS_v7/SMS-T5zz_x-05_Mgluino-150to1200_mLSP-50to1150_7TeV-Pythia6Z__Summer11-PU_START42_V11_FastSim-v2__AODSIM___inclindex_v2.root","SMST5zz",1,1,false,false,0,kRed);
767 +  TCanvas *jcan = new TCanvas("jcan","jcan");
768 +  scansample.collection[scansample.collection.size()-1].events->Draw("(LSP1pt/LSP1Mopt):pureGeneratorJZB","genNjets>2","PROF");
769 +  TH1F *h = new TH1F("h","h",100,-500,500);
770 +  h->SetLineColor(kBlack);
771 +  TProfile *p = (TProfile*)jcan->GetPrimitive("htemp");
772 +  p->GetXaxis()->SetTitle("Generator JZB");
773 +  p->GetXaxis()->CenterTitle();
774 +  p->GetYaxis()->SetTitle("( LSP p_{T} ) / ( LSP mother p_{T} )");
775 +  p->GetYaxis()->CenterTitle();
776 +  p->SetLineColor(kBlue);
777 +  TLegend* leg = make_legend("", 0.45, 0.75, false);
778 +  leg->AddEntry(p,"LSP1 pt / LSP1 Mother pt","l");
779 +  leg->AddEntry(h,"Z pt / Z Mother pt","l");
780 +  leg->Draw();
781 +  TText *title = write_title("JZB as a function of the first LSP's momentum transfer");
782 +  title->Draw();
783 +  scansample.collection[scansample.collection.size()-1].events->Draw("(genZPt/LSP1Mopt):pureGeneratorJZB","genNjets>2","PROF,same");
784 +
785 +  CompleteSave(jcan,"NegativeJZBStudy/LSPpt_LSPMopt");
786 +
787 +  scansample.collection[scansample.collection.size()-1].events->Draw("angleLSPLSP:pureGeneratorJZB","genNjets>2","PROF");
788 +  TProfile *p1 = (TProfile*)jcan->GetPrimitive("htemp");
789 +  p1->GetXaxis()->SetTitle("Generator JZB");
790 +  p1->GetXaxis()->CenterTitle();
791 +  p1->GetYaxis()->SetTitle("#angle(LSP1,LSP2)");
792 +  p1->GetYaxis()->CenterTitle();
793 +  TText *title1 = write_title("JZB as a function of the angle between the two LSPs");
794 +  title1->Draw();
795 +  CompleteSave(jcan,"NegativeJZBStudy/AngleLSPLSP");
796 +
797 +  TH1F *jzbdistributionvsz[5];
798 +  THStack zstack;
799 +  jcan->SetLogy(1);
800 +  TLegend* leg2 = make_legend("", 0.11, 0.75, false);
801 +  TLegend* leg3 = make_legend("", 0.11, 0.75, false);
802 +  for(int z=0;z<5;z++) {
803 +   stringstream specialcut;
804 +   if(z<4) specialcut << "genNjets>2&&(LSP1pt/LSP1Mopt)>" << z*0.2 << "&&(LSP1pt/LSP1Mopt)<" << (z+1)*0.2;
805 +   else specialcut << "genNjets>2&&(LSP1pt/LSP1Mopt)>" << z*0.2;
806 +   stringstream histtitle;
807 +   histtitle << "splitup_" << z;
808 +   stringstream ntitle;
809 +   if(z<4) ntitle << z*0.2 << " < z < " << (z+1)*0.2;
810 +   else ntitle << z*0.2 << " < z";
811 +   jzbdistributionvsz[z] = scansample.Draw(histtitle.str().c_str(),"pureGeneratorJZB",100,-500,500, "generator JZB (GeV)", "events",specialcut.str().c_str(),mc,1.0);
812 +   jzbdistributionvsz[z]->SetLineColor(z+1);
813 +   jzbdistributionvsz[z]->SetMarkerSize(0);
814 +   zstack.Add(jzbdistributionvsz[z]);
815 +   leg2->AddEntry(jzbdistributionvsz[z],ntitle.str().c_str(),"l");
816 +   leg3->AddEntry(jzbdistributionvsz[z],ntitle.str().c_str(),"f");
817 +  }
818 +
819 +  jzbdistributionvsz[0]->GetYaxis()->SetRangeUser(2,800);
820 +  jzbdistributionvsz[0]->DrawNormalized("histo");
821 +  for(int z=0;z<5;z++) {
822 +   jzbdistributionvsz[z]->DrawNormalized("histo,same");
823 +  }
824 +
825 + //  zstack.Draw("nostack,histo");
826 +  leg2->Draw("same");
827 +  CompleteSave(jcan,"NegativeJZBStudy/StackedAccordingToMomentumFractionIndividual");
828 +
829 +  for(int z=0;z<5;z++) {
830 +   jzbdistributionvsz[z]->SetFillColor(z+1);
831 +  }
832 +
833 +  zstack.Draw("histo");
834 +  CompleteSave(jcan,"NegativeJZBStudy/StackedAccordingToMomentumFractionStacked");
835 +
836 + //varangle vasysyn
837 +
838 + //  scansample.collection[scansample.collection.size()-1].events->Draw("(LSPPromptnessLevel[0]/4.0)*angleLSPLSP/(LSP1pt/LSP1Mopt):pureGeneratorJZB","genNjets>2","PROF");
839 +
840 +
841 +
842 + }
843 +
844 + string ReplaceCharacter(string originalstring,string replacethis,string replacewiththis)
845 + {
846 +        int pos = originalstring.find(replacethis);
847 +        if(pos == -1) return originalstring;
848 +        originalstring.replace(pos, replacewiththis.length(), replacewiththis);
849 +        return originalstring;
850 + }
851 + string removefunnystring(string name) {
852 +  name=ReplaceCharacter(name,"[","_");
853 +  name=ReplaceCharacter(name,"]","_");
854 +  name=ReplaceCharacter(name,"{","_");
855 +  name=ReplaceCharacter(name,"}","_");
856 +  name=ReplaceCharacter(name,".","_");
857 +  name=ReplaceCharacter(name,",","_");
858 +  name=ReplaceCharacter(name,";","_");
859 +  name=ReplaceCharacter(name,":","_");
860 +  name=ReplaceCharacter(name,"'","_");
861 +  name=ReplaceCharacter(name,"$","_");
862 +  name=ReplaceCharacter(name,"@","_");
863 +  return name;
864 + }
865 +
866 + void compare_lm4_sms_variable(TTree *eventsLM4, TTree *eventsSMS, string variable, int nbins, float xmin, float xmax, TCut cut, string saveas, bool dology=false) {
867 +  TCanvas *can = new TCanvas("can","can");
868 +  can->SetLogy(dology);
869 +  TH1F *hlm4 = new TH1F("hlm4","hlm4",nbins,xmin,xmax);
870 +  TH1F *hsms = new TH1F("hsms","hsms",nbins,xmin,xmax);
871 +  eventsLM4->Draw((variable+">>hlm4").c_str(),cut,"goff");
872 +  eventsSMS->Draw((variable+">>hsms").c_str(),cut,"goff");
873 +  hlm4->SetLineColor(kBlue);
874 +  hsms->SetLineColor(kRed);
875 +
876 +  if(hlm4->Integral()>0) hlm4->Scale(1.0/hlm4->Integral());
877 +  else write_warning(__FUNCTION__,"Watch out, LM4 histo is empty!");
878 +  if(hsms->Integral()>0) hsms->Scale(1.0/hsms->Integral());
879 +  else write_warning(__FUNCTION__,"Watch out, SMS histo is empty!");
880 +
881 +  float min=get_nonzero_minimum(hlm4);
882 +  float max=hlm4->GetMaximum();
883 +  if(get_nonzero_minimum(hsms)<min) min=get_nonzero_minimum(hsms);
884 +  if(hsms->GetMaximum()>max) max=hsms->GetMaximum();
885 +  if(dology) max*=5;
886 +  else max*=2;
887 +
888 +  hlm4->GetYaxis()->SetRangeUser(min,max);
889 +  hlm4->GetXaxis()->SetTitle(variable.c_str());
890 +  hlm4->GetXaxis()->CenterTitle();
891 +  hlm4->Draw("histo");
892 +  hsms->Draw("histo,same");
893 +  TLegend *leg = make_legend("",0.2,0.98,false);
894 +  leg->SetY2(1.0);
895 +  leg->SetNColumns(2);
896 +  leg->AddEntry(hlm4,"LM4","l");
897 +  leg->AddEntry(hsms,"\"LM4\" SMS","l");
898 +  leg->Draw();
899 +  stringstream saveas2;
900 +  saveas2 << "ComparingLM4_SMS/" << removefunnystring(saveas);
901 +  CompleteSave(can,saveas2.str());
902 +  delete can;
903 +  delete hlm4;
904 +  delete hsms;
905 + }
906 +
907 +
908 + void compare_LM4_and_SMS() {
909 +  TFile *f1 = new TFile("/shome/lbaeni/jzb/LM4_SMS/SMS_LM4_JZB.root");
910 +  TTree *LM4events = (TTree*)f1->Get("events");
911 +  TFile *f2 = new TFile("/shome/buchmann/ntuples/MC/NewSelectionForPaper/CorrectFull2011PileUp/LM4_SUSY_sftsht_7TeV-pythia6.root");
912 +  TTree *SMSevents = (TTree*)f2->Get("events");
913 +  
914 +  compare_lm4_sms_variable(LM4events, SMSevents, "mll",100,50,150,cutOSSF&&cutnJets&&basiccut,"mll",true);
915 +  compare_lm4_sms_variable(LM4events, SMSevents, "jzb[1]+0.04*pt-2.32212",100,-300,700,cutmass&&cutOSSF&&cutnJets&&basiccut,"jzb",true);
916 +  compare_lm4_sms_variable(LM4events, SMSevents, "pfJetGoodNum",10,-0.5,9.5,cutmass&&cutOSSF&&basiccut,"pfJetGoodNum",true);
917 +  compare_lm4_sms_variable(LM4events, SMSevents, "pt",100,15.0,200.0,cutOSSF&&basiccut,"pt",false);
918 +  compare_lm4_sms_variable(LM4events, SMSevents, "pt1",100,15.0,100.0,cutOSSF&&basiccut,"pt1",false);
919 +  compare_lm4_sms_variable(LM4events, SMSevents, "pt2",100,15.0,100.0,cutOSSF&&basiccut,"pt2",false);
920 +  compare_lm4_sms_variable(LM4events, SMSevents, "met[4]",100,0.0,600.0,cutOSSF&&basiccut,"met",false);
921 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines