alpgen_spec.cc

Go to the documentation of this file.
00001 #include "alpgen_spec.h"
00002 
00003 void fill_eweight(HepMC::GenEvent* evt)
00004 {
00005   //fill some info into weights: 
00006   //int unwev; 
00007   //double maxwgt, avgwgt, errwgt, totlum;
00008   // evt->weights()["N_ev"]=ahwgts_.unwev;
00009   //evt->weights()["input_xs"]=ahwgts_.avgwgt;
00010   //evt->weights()["input_xs_error"]=ahwgts_.errwgt;
00011   evt->weights()["lumi"]=ahwgts_.totlum;
00012 }
00013 
00014 void fill_exsec(HepMC::GenEvent* evt)
00015 {
00016   //needs HepMC 2.05.00 or greater; 
00017   //the x-section information can be filled in weights for earlier versions
00018   HepMC::GenCrossSection Hep_cross_section; 
00019   evstat_.nvpass=evstat_.nvcall-evstat_.nvfail;
00020   double meff_est=(evstat_.nvpass*1.)/evstat_.nvcall;
00021   //current estimation of the physical x-section:
00022   double phys_xsec=meff_est*ahwgts_.avgwgt;
00023   //error of the x-section estimation:
00024   //phys_xsec=ahwgts_.avgwgt*meff_est
00025   //error of the efficiency estimation
00026   double meff_est_err=sqrt(meff_est*(1-meff_est)/evstat_.nvcall);
00027   //add relative errors of eff. and input x-section in quadrature
00028   double mrelxs_est_err_2;
00029   if (meff_est==0.) mrelxs_est_err_2=99999.9;
00030   else mrelxs_est_err_2=std::min(((meff_est_err/meff_est)*(meff_est_err/meff_est)+(ahwgts_.errwgt/ahwgts_.avgwgt)*(ahwgts_.errwgt/ahwgts_.avgwgt)),99999.9);
00031   // fill x-section and the absolute error:
00032   Hep_cross_section.set_cross_section(phys_xsec,sqrt( mrelxs_est_err_2)*phys_xsec);
00033   evt->set_cross_section(Hep_cross_section);
00034   /*std::cout<<"debug : "<<std::endl;
00035   std::cout<<"nvpass, nvfail, nvcall"<<evstat_.nvpass<<" , "<<evstat_.nvcall<<" , "<<evstat_.nvfail<<std::endl;
00036   std::cout<<"meff_est, meff_est_err: "<<meff_est <<" , "<<meff_est_err<<std::endl;
00037   std::cout<<" ahwgts_.avgwgt : "<< ahwgts_.avgwgt<<std::endl;
00038   evt->write_cross_section();*/
00039 
00040 }
00041 

Generated on Wed Aug 31 09:44:47 2011 for HepMCAnalysis by  doxygen 1.4.7