Example #1
0
TF1* checkTotalResolution( const std::string& outputdir, TTree* tree ) {

  std::string histoName("h1_tot");
  TH1D* h1 = new TH1D(histoName.c_str(), "", 500, 0., 12000.);
  tree->Project( histoName.c_str(), "cef3_corr[0]+cef3_corr[1]+cef3_corr[2]+cef3_corr[3]", "(nHodoFibersCorrX==1 && nHodoFibersCorrY==1)");

  TF1* f1 = new TF1("gaus_tot", "gaus", 1600., 4800.);
  f1->SetParameter(0, 3000.);
  f1->SetParameter(1, 3000.);
  f1->SetParameter(2, 600.);

  doSingleFit( h1, f1, outputdir, "tot" );

  std::cout << std::endl;
  std::cout << std::endl;
  float mean  = f1->GetParameter(1);
  float sigma = f1->GetParameter(2);
  float reso = sigma/mean;
  std::cout << "Total " << std::endl;
  std::cout << "  Mean       : " << mean << std::endl;
  std::cout << "  Sigma      : " << sigma << std::endl;
  std::cout << "  Resolution : " << sigma/mean << std::endl;
  std::cout << "Corresponds to a stochastic term of: " << 100.*reso*sqrt(0.5) << " %" << std::endl;

  return f1;

}
Example #2
0
TF1* checkTotalResolution( const std::string& outputdir, TTree* tree ) {

  std::string histoName("h1_tot");
  TH1D* h1 = new TH1D(histoName.c_str(), "", 2000, 20000.,900000.);
  //TH1D* h1 = new TH1D(histoName.c_str(), "", 200, 0.,4000.);
  //tree->Project( histoName.c_str(), "cef3_maxAmpl[0]+cef3_maxAmpl[1]+cef3_maxAmpl[2]+cef3_maxAmpl[3]", "");
 tree->Project( histoName.c_str(), "cef3_chaInt[0]+cef3_chaInt[1]+cef3_chaInt[2]+cef3_chaInt[3]", "");
  //  tree->Project( histoName.c_str(), "cef3_corr[0]+cef3_corr[1]+cef3_corr[2]+cef3_corr[3]", "nClusters_hodoX==1 && nClusters_hodoY==1 && pos_corr_hodoX1<5 && pos_corr_hodoX1>-5 && pos_corr_hodoY1<5 && pos_corr_hodoY1>-5");


  //TF1* f1 = new TF1("gaus_tot", "gaus", 100., 4000.);
  TF1* f1 = new TF1("gaus_tot", "gaus", 20000.,900000. );
  // f1->SetParameter(0, 3000000.);
  //f1->SetParameter(1, 3000000.);
  //f1->SetParameter(2, 60000.);

  f1->SetLineColor(kRed);

  doSingleFit( h1, f1, outputdir, "tot" );

  std::cout << std::endl;
  std::cout << std::endl;
  float mean  = f1->GetParameter(1);
  float sigma = f1->GetParameter(2);
  float reso = sigma/mean;
  std::cout << "Total " << std::endl;
  std::cout << "  Mean       : " << mean << std::endl;
  std::cout << "  Sigma      : " << sigma << std::endl;
  std::cout << "  Resolution : " << sigma/mean << std::endl;
  std::cout << "Corresponds to a stochastic term of: " << 100.*reso*sqrt(0.5) << " %" << std::endl;

  return f1;

}
Example #3
0
TF1* fitSingleElectronPeak( const std::string& outputdir, int i, TTree* tree ) {

    gStyle->SetOptFit(1);
  std::string histoName(Form("h1_%d", i));
  //TH1D* h1 = new TH1D(histoName.c_str(), "", 120, 40., 1000.);
   TH1D* h1 = new TH1D(histoName.c_str(), "", 1000, 0., 250000.);
  //tree->Project( histoName.c_str(), Form("cef3_corr[%d]", i), "");

  // tree->Project( histoName.c_str(), Form("cef3[%d]", i),  "nClusters_hodoSmallX==1 && nClusters_hodoSmallY==1 && pos_corr_hodoSmallX<5 && pos_corr_hodoSmallX>-5 && pos_corr_hodoSmallY<5 && pos_corr_hodoSmallY>-5");
  //tree->Project( histoName.c_str(), Form("cef3_maxAmpl[%d]", i),  "abs(cluster_pos_hodoX2)<5 ");
  tree->Project( histoName.c_str(), Form("cef3_chaInt_corr[%d]", i),  "abs(cluster_pos_hodoX2)<2&& abs(cluster_pos_hodoY2)<2 ");
  //tree->Project( histoName.c_str(), Form("cef3_maxAmpl_corr[%d]", i),  "abs(cluster_pos_hodoX2)<5&& abs(cluster_pos_hodoY2)<5 ");


  //  TF1* f1 = new TF1( Form("gaus_%d", i), "gaus", 5., 1000.);
    TF1* f1 = new TF1( Form("gaus_%d", i), "gaus", 400., 250000.);
    f1->SetParameter(0, 300000.);
    f1->SetParameter(1, 250000.);
    f1->SetParameter(2, 15000.);


  f1->SetLineColor(kRed);

  doSingleFit( h1, f1, outputdir, Form("%d", i) );

  return f1;

}
Example #4
0
TF1* fitSingleElectronPeak( const std::string& outputdir, int i, TTree* tree ) {

  std::string histoName(Form("h1_%d", i));
  TH1D* h1 = new TH1D(histoName.c_str(), "", 100, 0., 3000.);
  tree->Project( histoName.c_str(), Form("cef3_corr[%d]", i), "(nHodoFibersCorrX==1 && nHodoFibersCorrY==1)");

  TF1* f1 = new TF1( Form("gaus_%d", i), "gaus", 400., 1200.);
  f1->SetParameter(0, 3000.);
  f1->SetParameter(1, 800.);
  f1->SetParameter(2, 150.);

  doSingleFit( h1, f1, outputdir, Form("%d", i) );

  return f1;

}