예제 #1
0
파일: ana_Match.C 프로젝트: marrbnl/STAR
//================================================
void fitDzInMod(const int save = 0)
{
  TFile *fin = TFile::Open(Form("Rootfiles/%s%s.TrkMthResidual.root",run_cfg_name.Data(),run_type));
  TH2F *hDzVsModBL = (TH2F*)fin->Get(Form("hTrkDzVsModBL_%s",trigName[kTrigType]));
  c = draw2D(hDzVsModBL,Form("%s: #Deltaz of matched track-hit pairs;module;#Deltaz (cm)",trigName[kTrigType]));
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_ModInBL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_ModInBL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  TCanvas *canvas[3];
  for(int i=0; i<3; i++)
    {
      canvas[i] = new TCanvas(Form("canvas_%d",i),Form("canvas_%d",i),1100,800);
      canvas[i]->Divide(5,5);
    }

  Int_t counter=0;
  TH1F *hDz[30][5];
  TH1F *hDzMean[5];
  TH1F *hDzSigma[5];
  for(int j=0; j<5; j++)
    {
      hDzMean[j] = new TH1F(Form("hTrkDzMean_Mod%d_%s",j+1,trigName[kTrigType]),Form("%s: mean of #Deltaz from fit;module;<#Deltaz> (cm)",trigName[kTrigType]),150,0,150);
      hDzSigma[j] = new TH1F(Form("hDzSigma_Mod%d_%s",j+1,trigName[kTrigType]),Form("%s: sigma of #Deltaz from fit;module;#sigma(#Deltaz) (cm)",trigName[kTrigType]),150,0,150);
    }

  for(int i=0; i<30; i++)
    {
      for(int j=0; j<5; j++)
	{
	  hDz[i][j] = (TH1F*)fin->Get(Form("hTrkDz_BL%d_Mod%d_%s",i+1,j+1,trigName[kTrigType]));
	  if(i==6 && j==4) counter++;
	  if(hDz[i][j]->GetEntries()<=0) continue;
	  canvas[counter/25]->cd(counter%25+1);
	  hDz[i][j]->GetXaxis()->SetRangeUser(-60,100);
	  hDz[i][j]->SetTitle("");
	  hDz[i][j]->SetLineColor(1);
	  hDz[i][j]->SetLineWidth(2);
	  hDz[i][j]->Draw();
	  TF1 *func = new TF1(Form("Fit_%s",hDz[i][j]->GetName()),"gaus",-20,25);
	  hDz[i][j]->Fit(func,"IRQ0");
	  func->SetLineColor(2);
	  func->SetLineStyle(2);
	  func->Draw("sames");
	  TPaveText *t1 = GetPaveText(0.15,0.35,0.6,0.8,0.1);
	  t1->AddText(Form("BL %d",i+1));
	  t1->AddText(Form("Mod %d",j+1));
	  t1->Draw();
	  counter++;

	  hDzMean[j]->SetBinContent(i*5+j+1,func->GetParameter(1));
	  hDzMean[j]->SetBinError(i*5+j+1,func->GetParError(1));
	  hDzSigma[j]->SetBinContent(i*5+j+1,func->GetParameter(2));
	  hDzSigma[j]->SetBinError(i*5+j+1,func->GetParError(2));
	}
    }

  if(save) 
    {
      for(int i=0; i<3; i++)
	{
	  canvas[i]->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDz_vs_Mod_%d_%s.pdf",run_type,run_cfg_name.Data(),i,trigName[kTrigType]));
	  canvas[i]->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDz_vs_Mod_%d_%s.png",run_type,run_cfg_name.Data(),i,trigName[kTrigType]));
	}
    }

  TList *list = new TList;
  list->Clear();
  TString legName[5];
  for(Int_t j=0; j<5; j++)
    {
      legName[j] = Form("Module %d",j+1);
      list->Add(hDzMean[j]);
    }
  c = drawHistos(list,"TrkDzMean","",kTRUE,0,150,kTRUE,-4,14,kFALSE,kTRUE,legName,kTRUE,"",0.45,0.6,0.6,0.88,kTRUE);
  TLine *line = GetLine(0,0,150,0,1);
  line->Draw();
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzMean_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzMean_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  list->Clear();
  for(Int_t j=0; j<5; j++)
    {
      list->Add(hDzSigma[j]);
    }
  c = drawHistos(list,"TrkDzSigma","",kTRUE,0,150,kTRUE,6,19,kFALSE,kTRUE,legName,kTRUE,"",0.2,0.35,0.18,0.42,kTRUE);
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzSigma_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sFitDzSigma_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }
}
예제 #2
0
파일: qa_dTof.C 프로젝트: marrbnl/STAR
//================================================
void embed(int save = 0)
{
  char *run_config = "Embed.fix.";
  
  TString fileName;
  if(year==2013) fileName = Form("Run13.pp500.jpsi.%sroot",run_config);

  f = TFile::Open(Form("./output/%s",fileName.Data()),"read");
  THnSparseF *hnDtof = (THnSparseF*)f->Get("mhMcTofQA_di_mu");

  // dtof vs pt
  TH2F *hTofVsPt = (TH2F*)hnDtof->Projection(0,3);
  hTofVsPt->SetName("Embed_dTof_vs_pt");
  hTofVsPt->SetTitle("Embedding: tof_{mc} - tof_{exp} vs p_{T}");
  hTofVsPt->GetXaxis()->SetRangeUser(0,12);
  hTofVsPt->GetYaxis()->SetRangeUser(-1,1);
  c = draw2D(hTofVsPt);
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_pt.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_pt.png",run_type,run_config));
    }

  // dtof vs mctof
  TH2F *hTofVsMcTof = (TH2F*)hnDtof->Projection(0,1);
  hTofVsMcTof->SetName("Embed_dTof_vs_mc_tof");
  hTofVsMcTof->SetTitle("Embedding: tof_{mc} - tof_{exp} vs tof_{mc}");
  hTofVsMcTof->GetXaxis()->SetRangeUser(13,17);
  hTofVsMcTof->GetYaxis()->SetRangeUser(-1,1);
  c = draw2D(hTofVsMcTof);
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_mctof.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_mctof.png",run_type,run_config));
    }

  // dtof vs exptof
  TH2F *hTofVsExpTof = (TH2F*)hnDtof->Projection(0,2);
  hTofVsExpTof->SetName("Embed_dTof_vs_exp_tof");
  hTofVsExpTof->SetTitle("Embedding: tof_{mc} - tof_{exp} vs tof_{exp}");
  hTofVsExpTof->GetXaxis()->SetRangeUser(13,17);
  hTofVsExpTof->GetYaxis()->SetRangeUser(-1,1);
  c = draw2D(hTofVsExpTof);
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_exptof.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_exptof.png",run_type,run_config));
    }

  // dtof vs module
  TH2F *hTofVsMod = (TH2F*)hnDtof->Projection(0,4);
  hTofVsMod->SetName("Embed_dTof_vs_module");
  hTofVsMod->SetTitle("Embedding: tof_{mc} - tof_{exp} vs backleg");
  hTofVsMod->GetYaxis()->SetRangeUser(-1,1);
  c = draw2D(hTofVsMod);
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_backleg.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_vs_backleg.png",run_type,run_config));
    }

  // dtof intervals
  TList *list = new TList;
  TString legName[3];
  TH1F *histo[3][3];
  double low_bounds[3] = {-5, 0.15, -0.16};
  double up_bounds[3] = {5, 0.16, -0.15};
  char *name[3] = {"mc_tof","exp_tof","pt"};
  double scale[3] = {2,2.5,1.5};
  double min[3] = {12,12,0};
  double max[3]= {18,18,12};
  for(int i=0; i<3; i++)
    {
      list->Clear();
      for(int j=0; j<3; j++)
	{
	  hnDtof->GetAxis(0)->SetRangeUser(low_bounds[j]+0.001,up_bounds[j]-0.001);
	  histo[i][j] = (TH1F*)hnDtof->Projection(i+1);
	  histo[i][j]->SetName(Form("%s_dTofBin%d",name[i],j));
	  histo[i][j]->Scale(1./histo[i][j]->Integral());
	  histo[i][j]->SetLineWidth(2);
	  histo[i][j]->SetMaximum(scale[i]*histo[i][j]->GetMaximum());
	  legName[j] = Form("%2.2f #leq #Deltatof #leq %2.2f ns",low_bounds[j],up_bounds[j]);
	  list->Add(histo[i][j]);
	}
      c = drawHistos(list,name[i],Form("Embedding: %s distributions",name[i]),kTRUE,min[i],max[i],kFALSE,0.1,10,kFALSE,kTRUE,legName,kTRUE,"",0.5,0.7,0.6,0.85,kFALSE);
      if(save)
	{
	  c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%s%s_in_dTofBin.pdf",run_type,run_config,name[i]));
	  c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%s%s_in_dTofBin.png",run_type,run_config,name[i]));
	}
    }
  hnDtof->GetAxis(0)->SetRange(0,-1);

  // dtof in module
  TH1F *hTofInMod[5];
  TH2F *hTofVsProjMod[5];
  for(int i=0; i<5; i++)
    {
      hnDtof->GetAxis(5)->SetRange(i+1,i+1);
      hTofInMod[i] = (TH1F*)hnDtof->Projection(0);
      hTofInMod[i]->SetName(Form("hTof_Mod%d",i+1));
      hTofVsProjMod[i] = (TH2F*)hnDtof->Projection(0,6);
      hTofVsProjMod[i]->SetName(Form("hTofVsProjMod_Mod%d",i+1));
    }
  hnDtof->GetAxis(5)->SetRange(0,-1);
  TCanvas *c = new TCanvas("hTof_in_mod","hTof_in_mod",1100,750);
  c->Divide(3,2);
  for(int i=0; i<5; i++)
    {
      c->cd(i+1);
      gPad->SetLogy();
      hTofInMod[i]->Draw();
      hTofInMod[i]->SetTitle("");
      hTofInMod[i]->GetXaxis()->SetRangeUser(-1,2);
      TPaveText *t1 = GetTitleText(Form("Module %d",i+1),0.05);
      t1->Draw();
    }
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_in_module.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTof_in_module.png",run_type,run_config));
    }

  TCanvas *c = new TCanvas("hTofVsProjMod_in_mod","hTofVsProjMod_in_mod",1100,750);
  c->Divide(3,2);
  for(int i=0; i<5; i++)
    {
      c->cd(i+1);
      gPad->SetLogz();
      hTofVsProjMod[i]->SetTitle(";track module");
      hTofVsProjMod[i]->GetYaxis()->SetRangeUser(-0.5,0.5);
      hTofVsProjMod[i]->Draw("colz");
      TPaveText *t1 = GetTitleText(Form("Hit in module %d",i+1),0.05);
      t1->Draw();

    }
  if(save)
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTofVsProjMod_in_module.pdf",run_type,run_config));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/qa_dTof/%sdTofVsProjMod_in_module.png",run_type,run_config));
    }

}
예제 #3
0
파일: ana_Match.C 프로젝트: marrbnl/STAR
//================================================
void DeltaZVsPos(const Int_t save = 0)
{
  THnSparseF *hn = (THnSparseF*)f->Get(Form("mhTrkDzDy_%s",trigName[kTrigType]));
  TList *list = new TList;

  // dz vs BL
  TH2F *hTrkDzVsBL = (TH2F*)hn->Projection(1,3);
  c = draw2D(hTrkDzVsBL,Form("%s: #Deltaz of matched track-hit pairs",trigName[kTrigType]));
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_BL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_BL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  list->Clear();
  TString legName[30];
  TH1F *hTrkDzInBL[30];
  Int_t counter = 0;
  for(Int_t i=0; i<30; i++)
    {
      hTrkDzInBL[i] = (TH1F*)hTrkDzVsBL->ProjectionY(Form("hDeltaZ_BL%d",i+1),i+1,i+1);
      if(hTrkDzInBL[i]->GetEntries()>0)
	{
	  legName[counter] = Form("Module %d",i+1);
	  hTrkDzInBL[i]->SetLineColor(color[counter]);
	  list->Add(hTrkDzInBL[i]);
	  counter ++;
	}
    }
  c = drawHistos(list,"TrkDzInBL",Form("%s: #Deltaz of matched track-hit pairs in backleg;#Deltaz (cm)",trigName[kTrigType]),kTRUE,-100,100,kTRUE,0,1.2*hTrkDzInBL[1]->GetMaximum(),kFALSE,kTRUE,legName,kTRUE,"",0.15,0.25,0.2,0.88,kFALSE,0.04,0.04,kFALSE,1,kTRUE,kFALSE);
  TLine *line = GetLine(0,0,0,1.1*hTrkDzInBL[1]->GetMaximum(),1);
  line->Draw();
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_BL_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_BL_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  // dz vs Mod
  TH2F *hTrkDzVsMod = (TH2F*)hn->Projection(1,4);
  c = draw2D(hTrkDzVsMod,Form("%s: #Deltaz of matched track-hit pairs",trigName[kTrigType]));
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_vs_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  TH1F *hMthMod = (TH1F*)hTrkDzVsMod->ProjectionX("hMthMod");
  hMthMod->Sumw2();
  hMthMod->Scale(1./hMthMod->Integral());
  TH2F *hMtdHitMap = (TH2F*)f->Get(Form("mhMtdHitMap_%s",trigName[kTrigType]));
  TH1F *htmp = (TH1F*)hMtdHitMap->ProjectionY("hHitMod_finebin");
  htmp->Rebin(12);
  TH1F *hMtdHitMod = new TH1F(Form("hMtdHitMod_%s",trigName[kTrigType]),"# of MTD hits per module;module",5,1,6);
  for(int i=0; i<hMtdHitMod->GetNbinsX(); i++)
    {
      hMtdHitMod->SetBinContent(i+1,htmp->GetBinContent(i+1));
      hMtdHitMod->SetBinError(i+1,htmp->GetBinError(i+1));
    }
  hMtdHitMod->Scale(1./hMtdHitMod->Integral());
  list->Clear();
  list->Add(hMthMod);
  list->Add(hMtdHitMod);
  TString legName3[2] = {"Matched good hits","All good hits"};
  c = drawHistos(list,"MtdHitMod",Form("%s: MTD hits per module;module;probability",trigName[kTrigType]),kFALSE,0,5,kTRUE,0,0.5,kFALSE,kTRUE,legName3,kTRUE,"",0.15,0.25,0.6,0.88,kTRUE);
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sCompMtdHitMod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sCompMtdHitMod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }

  list->Clear();
  TString legName2[5];
  TH1F *hTrkDzInMod[5];
  for(Int_t i=0; i<5; i++)
    {
      hTrkDzInMod[i] = (TH1F*)hTrkDzVsMod->ProjectionY(Form("hDeltaZ_Mod%d",i+1),i+1,i+1);
      legName2[i] = Form("Module %d",i+1);
      list->Add(hTrkDzInMod[i]);
    }
  c = drawHistos(list,"TrkDzInMod",Form("%s: #Deltaz of matched track-hit pairs in module;#Deltaz (cm)",trigName[kTrigType]),kTRUE,-100,100,kTRUE,0,1.2*hTrkDzInMod[3]->GetMaximum(),kFALSE,kTRUE,legName2,kTRUE,"",0.15,0.25,0.6,0.88,kTRUE);
  TLine *line = GetLine(0,0,0,hTrkDzInMod[3]->GetMaximum()*1.05,1);
  line->Draw();
  if(save) 
    {
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_Mod_%s.pdf",run_type,run_cfg_name.Data(),trigName[kTrigType]));
      c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_Match/%sDeltaZ_in_Mod_%s.png",run_type,run_cfg_name.Data(),trigName[kTrigType]));
    }
}
예제 #4
0
int main() {


  DrawTools::setStyle();

  std::vector<std::string> runs;
  runs.push_back( "BTF_229_20140501-155939_beam" ); // 0
  runs.push_back( "BTF_231_20140501-163742_beam" ); // 1
  runs.push_back( "BTF_233_20140501-171741_beam" ); // 2
  runs.push_back( "BTF_237_20140501-183950_beam" ); // 3
  runs.push_back( "BTF_235_20140501-175948_beam" ); // 4
  runs.push_back( "BTF_239_20140501-191908_beam" ); // 5
  runs.push_back( "BTF_241_20140501-200053_beam" ); // 6
  runs.push_back( "BTF_243_20140501-203838_beam" ); // 7


  std::string outputdir = "BGOCalibration/";
  std::string mkdir_command = "mkdir -p " + outputdir;
  system(mkdir_command.c_str());


  std::vector<TH1D*> rawHistos;
  std::vector<TH1D*> calibHistos;
  std::vector<float> calibConstants;
  float yMax = 0.;

  for( unsigned i=0; i<runs.size(); ++i ) {
    TH1D* h1_raw = fitSingleChannelBGO( outputdir, "raw", runs[i], i, 1. );
    rawHistos.push_back(h1_raw);
    TF1* thisFunc = (TF1*)(h1_raw->GetListOfFunctions()->FindObject(Form("gaussian_%s", runs[i].c_str())));
    calibConstants.push_back(thisFunc->GetParameter(1));
    float thisMax = h1_raw->GetMaximum()/h1_raw->Integral();
    if( thisMax>yMax )
      yMax = thisMax;
  }


  float calibAve = sumVector(calibConstants)/calibConstants.size();


  std::string constantsFileName = outputdir + "/constants.txt";
  ofstream ofs(constantsFileName.c_str());

  for( unsigned i=0; i<runs.size(); ++i ) {
    float thisCalib = calibAve/calibConstants[i];
    calibHistos.push_back(fitSingleChannelBGO( outputdir, "calib", runs[i], i, thisCalib ));
    ofs << i << "\t" << thisCalib << std::endl;
  }

  ofs.close();

  drawHistos( outputdir, rawHistos,   "rawSpectra"  , yMax );
  drawHistos( outputdir, calibHistos, "calibSpectra", yMax );


  std::cout << std::endl;
  std::cout << "-> Calibration constants saved in: " << constantsFileName << std::endl;

  std::cout << "Calibration average for BGO: " << calibAve << std::endl;


  std::string run_cef3 = "BTF_227_20140501-151233_beam";
  TH1D* h1_cef3 = fitCeF3( outputdir, "cef3_raw", run_cef3 );
  TF1* f1_cef3 = (TF1*)(h1_cef3->GetListOfFunctions()->FindObject(Form("gaussian_%s", run_cef3.c_str())));

  std::cout << "BGO/CeF3 relative calibration: " << calibAve/f1_cef3->GetParameter(1) << std::endl;
  
  return 0;

}
예제 #5
0
파일: comp_All.C 프로젝트: marrbnl/STAR
//================================================
void All(const int compCount = 1, const int compEff = 1, const int compRef = 1, const int savePlot = 1)
{
  const char* dataType[2] = {"New","Old"};
  // Jpsi efficiency vs. pT
  const int nPtBins         = nPtBins_pt;
  const double* ptBins_low  = ptBins_low_pt;
  const double* ptBins_high = ptBins_high_pt;
  const char** ptName       = pt_Name_pt;
  const int nCentBins       = nCentBins_pt; 
  const int* centBins_low   = centBins_low_pt;
  const int* centBins_high  = centBins_high_pt;
  const char** cent_Name    = cent_Name_pt;
  const char** cent_Title   = cent_Title_pt;
  const int kNCent = nCentBins_npart[0];

  const int nbins = nPtBins -1;
  double xbins[nbins+1];
  for(int i=0; i<nbins; i++)
    xbins[i] = ptBins_low[i+1];
  xbins[nbins] = ptBins_high[nbins];

  TList *list = new TList;

  if(compCount)
    {
      TFile *fSig[2];
      fSig[0] = TFile::Open(Form("Rootfiles/%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      fSig[1] = TFile::Open(Form("Rootfiles/old.%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      TH1F *hJpsiCounts[2][7];
      TCanvas *c = new TCanvas("comp_JpsiCounts", "comp_JpsiCounts", 1100, 500);
      c->Divide(4,2);
      TLegend *leg = new TLegend(0.3,0.3,0.6,0.6);
      leg->SetBorderSize(0);
      leg->SetFillColor(0);
      leg->SetTextFont(62);
      leg->SetTextSize(0.08);
      for(int k=0; k<7; k++)
	{
	  for(int j=0; j<2; j++)
	    {
	      if(k<5) hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_cent%s_weight",cent_Title[k]));
	      else    hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_pt%s_weight",pt_Name_npart[k-5]));
	      hJpsiCounts[j][k]->SetName(Form("%s_%d",hJpsiCounts[j][k]->GetName(),j));
	      hJpsiCounts[j][k]->SetMarkerStyle(21+j*4);
	      hJpsiCounts[j][k]->SetMarkerColor(j+1);
	      hJpsiCounts[j][k]->SetLineColor(j+1);

	      c->cd(k+1);
	      gPad->SetLogy();
	      if(k==2 || k==3) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,10);
	      if(k==4) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,6);
	      hJpsiCounts[j][k]->SetTitle(";;Counts");
	      if(k<5) hJpsiCounts[j][k]->SetXTitle("p_{T} [GeV/c]");
	      if(j==0) hJpsiCounts[j][k]->Draw();
	      else     hJpsiCounts[j][k]->Draw("sames");
	      if(k==0) leg->AddEntry(hJpsiCounts[j][k], dataType[j], "P");
	    }
	  if(k<5) TPaveText *t1 = GetTitleText(Form("%s: %s%%",run_type,cent_Name[k]),0.06);
	  else    TPaveText *t1 = GetTitleText(Form("%s: %s",run_type,pt_Title_npart[k-5]),0.06);
	  t1->Draw();
	}
      c->cd(8);
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiCounts.pdf",run_type));
    }
  if(compEff)
    {
      const char *trkEffType[6] = {"MC","Tpc","MtdMth","MuonPid","MtdTrig","TrigUnit"};
      TFile *fEff[2];
      fEff[0] = TFile::Open(Form("Rootfiles/%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      fEff[1] = TFile::Open(Form("Rootfiles/old.%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");

      const int nHistos = 6;
      TH1F *hJpsiPt[2][nHistos][nCentBins];
      TH1F *hJpsiPtEffs[2][nHistos][nCentBins];
      for(int j=0; j<2; j++)
	{
	  for(int i=0; i<nHistos; i++)
	    {
	      for(int k=0; k<nCentBins; k++)
		{
		  hJpsiPt[j][i][k] = (TH1F*)fEff[j]->Get(Form("hJpsiPt_%s_cent%s",trkEffType[i],cent_Title[k]));
		  hJpsiPt[j][i][k]->SetName(Form("%s_file%d",hJpsiPt[j][i][k]->GetName(),j));
		  hJpsiPt[j][i][k]->Rebin(4);
		  int index = i-1;
		  if(i==0) index = 0;
		  hJpsiPtEffs[j][i][k] = DivideTH1ForEff(hJpsiPt[j][i][k],hJpsiPt[j][index][k],Form("hJpsiPtEff_%s_cent%s_file%d",trkEffType[i],cent_Title[k],j));
		}
	    }
	}

      // various efficiency
      const int kcent = 0;
      for(int i=1; i<nHistos; i++)
	{
	  hJpsiPtEffs[0][i][kcent]->Divide(hJpsiPtEffs[1][i][kcent]);
	  list->Add(hJpsiPtEffs[0][i][kcent]);
	}
      TString legName2[5] = {"TPC tracking + p_{T,#mu} cut","MTD acceptance & response","Muon PID","MTD triggering","Trigger unit"};
      c = drawHistos(list,"JpsiEff_AllEffs",Form("%s: efficiencies for J/#psi ;p_{T} (GeV/c);New/Old",run_type),true,0,15,true,0.8,1.2,false,kTRUE,legName2,true,Form("%s%%",cent_Name[kcent]),0.2,0.4,0.63,0.88,kTRUE,0.04,0.035);
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiEff_AllTypes.pdf",run_type));
      list->Clear();
    }

  if(compRef)
    {
      TFile *fpp[2];
      fpp[0] = TFile::Open(Form("Rootfiles/Paper.%s.Jpsi.root",run_type),"read");
      fpp[1] = TFile::Open(Form("Rootfiles/Comb2.Paper.%s.Jpsi.root",run_type),"read");
      TGraphAsymmErrors	*hppJpsiVsPt[2];
      TGraphAsymmErrors	*hppJpsiVsCent[2];
      double x, y, x1, y1;
      for(int j=0; j<2; j++)
	{
	  hppJpsiVsPt[j]   = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsPtFinalSys");
	  hppJpsiVsPt[j]->SetName(Form("%s_%d",hppJpsiVsPt[j]->GetName(),j));
	  hppJpsiVsPt[j]->SetMarkerStyle(21+j*4);
	  hppJpsiVsPt[j]->SetMarkerColor(j+1);
	  hppJpsiVsPt[j]->SetLineColor(j+1);
	  offset_x(hppJpsiVsPt[j], 0.1*j);
	  hppJpsiVsCent[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsCentFinalSys");
	  hppJpsiVsCent[j]->SetName(Form("%s_%d",hppJpsiVsCent[j]->GetName(),j));
	  hppJpsiVsCent[j]->SetMarkerStyle(21+j*4);
	  hppJpsiVsCent[j]->SetMarkerColor(j+1);
	  hppJpsiVsCent[j]->SetLineColor(j+1);
	  offset_x(hppJpsiVsCent[j], 0.1*j);
	}

      for(int j=0; j<2; j++)
	{
	  for(int ipoint=0; ipoint<hppJpsiVsPt[j]->GetN(); ipoint++)
	    {
	      hppJpsiVsPt[1]->GetPoint(ipoint, x, y);
	      hppJpsiVsPt[j]->GetPoint(ipoint, x1, y1);
	      hppJpsiVsPt[j]->SetPoint(ipoint, x1, y1/y);
	      hppJpsiVsPt[j]->SetPointError(ipoint, hppJpsiVsPt[j]->GetErrorXlow(ipoint), hppJpsiVsPt[j]->GetErrorXhigh(ipoint),
					    hppJpsiVsPt[j]->GetErrorYlow(ipoint)/y, hppJpsiVsPt[j]->GetErrorYhigh(ipoint)/y);
	    }

	  for(int ipoint=0; ipoint<hppJpsiVsCent[j]->GetN(); ipoint++)
	    {
	      hppJpsiVsCent[1]->GetPoint(ipoint, x, y);
	      hppJpsiVsCent[j]->GetPoint(ipoint, x1, y1);
	      hppJpsiVsCent[j]->SetPoint(ipoint, x1, y1/y);
	      hppJpsiVsCent[j]->SetPointError(ipoint, hppJpsiVsCent[j]->GetErrorXlow(ipoint), hppJpsiVsCent[j]->GetErrorXhigh(ipoint),
					    hppJpsiVsCent[j]->GetErrorYlow(ipoint)/y, hppJpsiVsCent[j]->GetErrorYhigh(ipoint)/y);
	    }
	}
      hppJpsiVsPt[1]->GetYaxis()->SetRangeUser(0.5,1.5);
      c = drawGraph(hppJpsiVsPt[1],"Ratio of pp reference;p_{T} [GeV/c];Ratio");
      hppJpsiVsPt[0]->Draw("samesPEZ");
      TLegend *leg = new TLegend(0.6,0.7,0.8,0.85);
      leg->SetBorderSize(0);
      leg->SetFillColor(0);
      leg->SetTextFont(62);
      leg->SetTextSize(0.035);
      leg->AddEntry(hppJpsiVsPt[0], "(STAR+PHENIX)/STAR", "P");
      leg->AddEntry(hppJpsiVsPt[1], "STAR/STAR", "P");
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsPt.pdf",run_type));

      hppJpsiVsCent[1]->GetXaxis()->SetRangeUser(-0.5,6.5);
      hppJpsiVsCent[1]->GetYaxis()->SetRangeUser(0.5,1.5);
      c = drawGraph(hppJpsiVsCent[1],"Ratio of pp reference;;Ratio");
      hppJpsiVsCent[0]->Draw("samesPEZ");
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsCent.pdf",run_type));
    }
}
예제 #6
0
파일: comp_All.C 프로젝트: marrbnl/STAR
//================================================
void SignalShape(const int savePlot = 1)
{
  const int icent = 0;
  const int nfiles = 2;
  const char *filename[nfiles] = {"Pico.Run13.pp500.jpsi.pt1.5.pt1.0.yield.root","Pico.Run13.pp500.jpsi.VtxCut.pt1.5.pt1.0.yield.root"};
  const TString legName[nfiles] = {"W/o vtx cut","W/ vtx cut"};
  const char *saveTitle = "Run13_VtxCut";

  TFile *file[nfiles];
  TH1F *hInvMass[nfiles][nPtBins];
  TH1F *hMean[nfiles];
  TH1F *hSigma[nfiles];  
  TH1F *hYield[nfiles];

  for(int i=0; i<nfiles; i++)
    {
      file[i] = TFile::Open(Form("Rootfiles/%s",filename[i]),"read");

      hMean[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitMean_cent%s",cent_Title[icent]));
      hMean[i]->SetName(Form("%s_%d",hMean[i]->GetName(),i));

      hSigma[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitSigma_cent%s",cent_Title[icent]));
      hSigma[i]->SetName(Form("%s_%d",hSigma[i]->GetName(),i));

      hYield[i] = (TH1F*)file[i]->Get(Form("Jpsi_BinCountYield_cent%s",cent_Title[icent]));
      hYield[i]->SetName(Form("%s_%d",hYield[i]->GetName(),i));

      for(int ipt=0; ipt<nPtBins; ipt++)
	{
	  hInvMass[i][ipt] = (TH1F*)file[i]->Get(Form("Jpsi_Signal_cent%s_pt%s_save",cent_Title[icent],pt_Name[ipt]));
	  hInvMass[i][ipt]->SetName(Form("%s_%d",hInvMass[i][ipt]->GetName(),i));
	}
    }

  // invariant mass distribution
  TCanvas *c = new TCanvas("InvMass","InvMass",1200,700);
  c->Divide(nPtBins/2+nPtBins%2,2);
  TLegend *leg = new TLegend(0.6,0.65,0.85,0.85);
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->SetTextSize(0.05);
  for(int ipt=0; ipt<nPtBins; ipt++)
    {
      c->cd(ipt+1);
      SetPadMargin(gPad,0.13, 0.13, 0.03, 0.1);
      for(int i=0; i<nfiles; i++)
	{
	  int bin = hInvMass[i][ipt]->FindFixBin(3.09);
	  hInvMass[i][ipt]->Scale(1./hInvMass[i][ipt]->GetBinContent(bin));
	  hInvMass[i][ipt]->SetMaximum(1.5);
	  hInvMass[i][ipt]->SetMarkerStyle(21+i*4);
	  hInvMass[i][ipt]->SetMarkerColor(color[i]);
	  hInvMass[i][ipt]->SetLineColor(color[i]);
	  hInvMass[i][ipt]->SetYTitle("a.u.");
	  ScaleHistoTitle(hInvMass[i][ipt],0.05,1,0.035,0.05,1.4,0.035,62);
	  if(i==0) hInvMass[i][ipt]->Draw();
	  else     hInvMass[i][ipt]->Draw("sames");
	  if(ipt==0) leg->AddEntry(hInvMass[i][ipt],legName[i].Data(),"PL");
	}
      TPaveText *t1 = GetTitleText(Form("%1.0f < p_{T,#mu#mu} < %1.0f GeV/c",ptBins_low[ipt],ptBins_high[ipt]),0.06);
      t1->Draw();
    }
  c->cd(1);
  leg->Draw();
  if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_InvMass_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));

  // mean & sigma
  TList *list = new TList;
  for(int i=0; i<nfiles; i++)
    {
      hMean[i]->SetMarkerStyle(21+i*4);
      hMean[i]->SetMarkerColor(color[i]);
      hMean[i]->SetLineColor(color[i]);
      list->Add(hMean[i]);
    }
  c = drawHistos(list,"mean","Mean of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.5,0.7,0.3,0.5,true,0.04,0.04,false,1,false,false);
  if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiMean_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));

  list->Clear();
  for(int i=0; i<nfiles; i++)
    {
      hSigma[i]->SetMarkerStyle(21+i*4);
      hSigma[i]->SetMarkerColor(color[i]);
      hSigma[i]->SetLineColor(color[i]);
      list->Add(hSigma[i]);
    }
  c = drawHistos(list,"sigma","Width of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.55,0.75,0.2,0.4,true,0.04,0.04,false,1,false,false);
  if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiSigma_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));

  list->Clear();
  for(int i=0; i<nfiles; i++)
    {
      hYield[i]->Scale(1./hYield[i]->Integral());
      hYield[i]->SetMarkerStyle(21+i*4);
      hYield[i]->SetMarkerColor(color[i]);
      hYield[i]->SetLineColor(color[i]);
      list->Add(hYield[i]);
    }
  c = drawHistos(list,"yield","Raw distribution of J/#Psi signal;p_{T} (GeV/c);Prob.",false,0,10,true,0,0.4,false,true,legName,true,"",0.55,0.75,0.6,0.8,true,0.04,0.04,false,1,false,false);
  if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_RawCounts_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));
}
void compareSync(TString myGroup,TString myPath,TString myRootFile, TString myTree, TString group, TString groupPath, TString groupRootFile, TString groupTree,TString mySel="1",TString groupSel="1"){

//   TFile Fmine("/afs/cern.ch/user/b/benitezj/public/HTTSync/July28/eTau2012_VBFSync.root");
//   TTree*Tmine=(TTree*)Fmine.Get("TauCheck");
//   TFile Fother("/afs/cern.ch/user/s/swanson/public/Sync52XEleTau/eleTauPreselection.root");
//   TTree*Tother=(TTree*)Fother.Get("eventTree");

  TFile Fmine(myPath+"/"+myRootFile+".root");
  TTree*Tmine=(TTree*)Fmine.Get(myTree.Data());
  TFile Fother(groupPath+"/"+groupRootFile+".root");
  TTree*Tother=(TTree*)Fother.Get(groupTree.Data());

  
  ////////////////

  cout<<"Mine: "<<Fmine.GetName()<<endl;
  cout<<"Other: "<<Fother.GetName()<<endl;
  TCanvas C;

  TString filename=myGroup+"_"+myRootFile+"_"+group+"_"+groupRootFile+"_diff.pdf";
  C.Print(filename+"[");  


  //inclusive
  TString selection="1";
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"run",140,190000,204000,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"npu",50,0,50,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"npv",50,0,50,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"pt_1",100,0,200,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"eta_1",60,-3,3,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"iso_1",60,-.02,0.12,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"pt_2",100,0,200,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"eta_2",60,-3,3,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"m_1",40,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"m_2",40,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mt_1",50,0,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mt_2",50,0,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"decayModeFinding_1",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"decayModeFinding_2",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"decayModeFindingNewDMs_1",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"decayModeFindingNewDMs_2",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"byCombinedIsolationDeltaBetaCorrRaw3Hits_1",200,0,10,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"byCombinedIsolationDeltaBetaCorrRaw3Hits_2",200,0,10,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"againstElectronTightMVA5_1",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"againstElectronTightMVA5_2",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"againstMuonTight3_1",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"againstMuonTight3_2",10,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"met",20,0,200,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"metphi",30,-3.5,3.5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvamet",50,0,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvametphi",35,-3.5,3.5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvacov00",50,0,2500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvacov01",50,0,2500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvacov10",50,0,2500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"mvacov11",50,0,2500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"uPerp",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"uParl",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metParl",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metPerp",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metSigmaParl",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metSigmaPerp",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metPullParl",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"metPullPerp",200,-100,100,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"m_sv",60,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"extraelec_veto",2,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,"inclusive",Tmine,Tother,"extramuon_veto",2,0,2,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);

  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"puweight",25,-.1,0.9,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"effweight",80,.7,1.3,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,"inclusive",Tmine,Tother,"eventweight",50,0,5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);

  ///Jets
  selection="(njets>=1)";
  drawHistos(&C,filename,selection,Tmine,Tother,"jpt_1",100,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"jeta_1",100,-5,5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //
  selection="(njets>=2)";
  drawHistos(&C,filename,selection,Tmine,Tother,"jpt_2",100,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"jeta_2",100,-5,5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"mjj",100,0,3000,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"jdeta",100,0,10,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"visjeteta",100,0,10,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"ptvis",100,0,500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"njetingap",4,-0.5,3.5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"jdphi",100,0,3.5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"dijetpt",100,0,500,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"hdijetphi",100,0,3.5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  //drawHistos(&C,filename,selection,Tmine,Tother,"mva",40,-1,1.001,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);


  /////b-jets
  selection="(nbtag>=1)";
  drawHistos(&C,filename,selection,Tmine,Tother,"bpt_1",100,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  drawHistos(&C,filename,selection,Tmine,Tother,"beta_1",100,-5,5,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);

  /*
  ///////////////////categories
  TString vbfcut="(njets>=2&&njetingap==0&&mjj>500&&abs(jdeta)>3.5)";
  TString notvbfcut=TString("(!")+vbfcut+")";
  TString boostcut="(njets>=1&&nbtag==0)";
  TString notboostcut=TString("(!")+boostcut+")";
  TString bjetcut="(njets<2&&nbtag>=1)";
  TString notbjetcut=TString("(!")+bjetcut+")";
  TString SMcut[7];
  SMcut[0]="(njets==0&&nbtag==0)";
  SMcut[2]=notvbfcut+"*"+boostcut;
  SMcut[4]=vbfcut;
  SMcut[5]=notvbfcut+"*"+notboostcut+"*"+bjetcut;
  
  selection=SMcut[0];
  drawHistos(&C,filename,TString("0-jet : ")+selection,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[2];
  drawHistos(&C,filename,"Boosted",Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[4];
  drawHistos(&C,filename,TString("VBF : ")+selection,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[5];
  drawHistos(&C,filename,"B-jet",Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);


  //with puweight
  TString weight="(puweight)";
  selection=SMcut[0]+"*"+weight;
  drawHistos(&C,filename,TString("0-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[2]+"*"+weight;
  drawHistos(&C,filename,TString("Boosted ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[4]+"*"+weight;
  drawHistos(&C,filename,TString("VBF ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[5]+"*"+weight;
  drawHistos(&C,filename,TString("B-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);

  //with trigger weight
  TString weight="(puweight*effweight)";
  selection=SMcut[0]+"*"+weight;
  drawHistos(&C,filename,TString("0-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[2]+"*"+weight;
  drawHistos(&C,filename,TString("Boosted ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[4]+"*"+weight;
  drawHistos(&C,filename,TString("VBF ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[5]+"*"+weight;
  drawHistos(&C,filename,TString("B-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);

  //with trigger weight and mT cut
  TString weight="(puweight*effweight)*(mt_1<20.)";
  selection=SMcut[0]+"*"+weight;
  drawHistos(&C,filename,TString("0-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[2]+"*"+weight;
  drawHistos(&C,filename,TString("Boosted ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[4]+"*"+weight;
  drawHistos(&C,filename,TString("VBF ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  selection=SMcut[5]+"*"+weight;
  drawHistos(&C,filename,TString("B-jet ")+weight,Tmine,Tother,"m_sv",30,0,300,selection,myGroup,myRootFile,group,groupRootFile,mySel,groupSel);
  */

  C.Print(filename+"]");
  gROOT->ProcessLine(".q");
}