Skip to content
Snippets Groups Projects
check_gamma.C 3.67 KiB
Newer Older
TChain* chain;
void LoadRootFiles();
void LoadCuts();

TCutG* cut44;
TCutG* cut40;

double Exo_EDC_vamos;
int FPMW_Section;
double FF_Mass;
double FF_DE;
double FF_Eres;


///////////////////////////////////////////
void LoadRootFiles()
{
  chain = new TChain("PhysicsTree");
  chain->Add("../../root/analysis/run_28.root");
  chain->Add("../../root/analysis/run_29.root");
  chain->Add("../../root/analysis/run_30.root");
  chain->Add("../../root/analysis/run_31.root");
  chain->Add("../../root/analysis/run_32.root");
  chain->Add("../../root/analysis/run_36.root");
  chain->Add("../../root/analysis/run_37.root");
  chain->Add("../../root/analysis/run_39.root");
  chain->Add("../../root/analysis/run_41.root");
  chain->Add("../../root/analysis/run_42.root");
  chain->Add("../../root/analysis/run_43.root");
  chain->Add("../../root/analysis/run_44.root");
  chain->Add("../../root/analysis/run_45.root");
  chain->Add("../../root/analysis/run_46.root");
  chain->Add("../../root/analysis/run_48.root");
  chain->Add("../../root/analysis/run_49.root");
  chain->Add("../../root/analysis/run_50.root");
  chain->Add("../../root/analysis/run_51.root");
  chain->Add("../../root/analysis/run_52.root");
  chain->Add("../../root/analysis/run_53.root");
  chain->Add("../../root/analysis/run_69.root");
}

///////////////////////////////////////////
void LoadCuts()
{
  TFile* ifile = new TFile("cut44.root");
  cut44 = (TCutG*) ifile->FindObjectAny("cut44");
  ifile->Close();

  ifile = new TFile("cut40.root");
  cut40 = (TCutG*) ifile->FindObjectAny("cut40");
  ifile->Close();
}

///////////////////////////////////////////
void check_gamma()
{
  LoadCuts();
  LoadRootFiles();

  TFile* ofile  = new TFile("mass_check.root","recreate");
  TH2F* hmass44 = new TH2F("hmass44","hmass44",20,0,20,1000,60,160);
  TH2F* h108    = new TH2F("h108","h108",20,0,20,500,0,2000);
  TH2F* h106    = new TH2F("h106","h106",20,0,20,500,0,2000);
  TH2F* h100    = new TH2F("h100","h100",20,0,20,500,0,2000);
  TH2F* h98     = new TH2F("h98","h98",20,0,20,500,0,2000);
 
  TH1F* hg108   = new TH1F("hg108","hg108",500,0,2000);
  TH1F* hg106   = new TH1F("hg106","hg106",500,0,2000);
  TH1F* hg100   = new TH1F("hg100","hg100",500,0,2000);
  TH1F* hg98    = new TH1F("hg98","hg98",500,0,2000);

  chain->SetBranchStatus("Exo_EDC_vamos",true);
  chain->SetBranchAddress("Exo_EDC_vamos",&Exo_EDC_vamos);
  chain->SetBranchStatus("FPMW_Section",true);
  chain->SetBranchAddress("FPMW_Section",&FPMW_Section);
  chain->SetBranchStatus("FF_Mass13",true);
  chain->SetBranchAddress("FF_Mass13",&FF_Mass);
  chain->SetBranchStatus("FF_DE",true);
  chain->SetBranchAddress("FF_DE",&FF_DE);
  chain->SetBranchStatus("FF_Eres",true);
  chain->SetBranchAddress("FF_Eres",&FF_Eres);

  int nentries = chain->GetEntries();
  
  for(int i=0; i<nentries; i++){
    if(i%100000==0) cout << i*100./nentries << "% \r" << flush;
    chain->GetEntry(i);
    if(cut44->IsInside(FF_Eres,FF_DE)){
      hmass44->Fill(FPMW_Section,FF_Mass);
      if(abs(FF_Mass-108)<0.5){
        h108->Fill(FPMW_Section,Exo_EDC_vamos);
        hg108->Fill(Exo_EDC_vamos);
      }
      else if(abs(FF_Mass-106)<0.5){
        h106->Fill(FPMW_Section,Exo_EDC_vamos);
        hg106->Fill(Exo_EDC_vamos);
      }
    }

    else if(cut40->IsInside(FF_Eres,FF_DE)){
      if(abs(FF_Mass-100)<0.5){
        h100->Fill(FPMW_Section,Exo_EDC_vamos);
        hg100->Fill(Exo_EDC_vamos);
      }
      else if(abs(FF_Mass-98)<0.5){
        h98->Fill(FPMW_Section,Exo_EDC_vamos);
        hg98->Fill(Exo_EDC_vamos);
      }
    }
  }

  hmass44->Write();
  h108->Write();
  h106->Write();
  h100->Write();
  h98->Write();

  hg108->Write();
  hg106->Write();
  hg100->Write();
  hg98->Write();

  ofile->Close();
}