Kfluk Class Reference

#include <Kfluk.h>

List of all members.

Public Member Functions

 Kfluk (const char *pathname="")
 ~Kfluk ()
double GetWeight (int ndecay, float Ecm)
double GetWeight (NtpMCFluxInfo *fluxinfo)

Private Attributes

std::vector< double > ELO
std::vector< double > EHI
std::vector< double > CK0E3
std::vector< double > CK0M3
std::vector< double > CKE3
std::vector< double > CKM3

Detailed Description

Definition at line 7 of file Kfluk.h.


Constructor & Destructor Documentation

Kfluk::Kfluk ( const char *  pathname = ""  ) 

Definition at line 15 of file Kfluk.cxx.

References base, CK0E3, CK0M3, CKE3, CKM3, EHI, ELO, gSystem(), Msg::kDebug, Msg::kError, Msg::kFatal, and MSG.

00015                                 :
00016   ELO(),
00017   EHI(),
00018   CK0E3(),
00019   CK0M3(),
00020   CKE3(),
00021   CKM3()
00022 {
00023 
00024   //initialize vectors by reading in vector files
00025   //copied code from Zbeam
00026   std::string topDir=pathname; // user may set location of input data
00027   if(topDir=="") { // by default, this code looks in a standard place
00028     topDir="MCReweight/data";
00029     std::string base="";
00030     base=getenv("SRT_PRIVATE_CONTEXT");
00031     if (base!="" && base!="."){
00032       // check if directory exists in SRT_PRIVATE_CONTEXT
00033       std::string path = base + "/" + topDir;
00034       void *dir_ptr = gSystem -> OpenDirectory(path.c_str());
00035       if(!dir_ptr){
00036         base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
00037       }
00038     }
00039     else{
00040       base=getenv("SRT_PUBLIC_CONTEXT");
00041     }
00042 
00043     //if after all those shenanigans, it still can't find the file, give up
00044     if(base=="") {
00045       MSG("MCReweight",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set"<<std::endl;
00046       assert(false);
00047     }
00048     topDir = base+ "/" + topDir;
00049   }
00050 
00051   MSG("Kfluk",Msg::kDebug) <<"Kfluk reading files from: "<<topDir<<std::endl;
00052 
00053   float low, high, val;
00054   ifstream in1((topDir+"/k0m3.vec").c_str());
00055   if(in1.is_open()){
00056     in1>>low;
00057     while(!in1.eof()){
00058       in1>>high>>val;
00059       ELO.push_back(low);
00060       EHI.push_back(high);
00061       CK0M3.push_back(val);
00062       //      cout<<"high "<<high<<" low "<<low<<" val "<<val<<endl;
00063       in1>>low;
00064     }
00065     in1.close();
00066   }
00067   else{
00068     MSG("Kfluk",Msg::kError)<<"Could not open "<<topDir+"/k0m3.vec"<<endl;
00069   }
00070 
00071   ifstream in2((topDir+"/k0e3.vec").c_str());
00072   if(in2.is_open()){
00073     in2>>low;
00074     while(!in2.eof()){
00075       in2>>high>>val;
00076       CK0E3.push_back(val);
00077       in2>>low;
00078     }
00079     in2.close();
00080   }
00081   else{
00082     MSG("Kfluk",Msg::kError)<<"Could not open "<<topDir+"/k0e3.vec"<<endl;
00083   }
00084 
00085   ifstream in3((topDir+"/km3.vec").c_str());
00086   if(in3.is_open()){
00087     in3>>low;
00088     while(!in3.eof()){
00089       in3>>high>>val;
00090       CKM3.push_back(val);
00091       in3>>low;
00092     }
00093     in3.close();
00094   }
00095   else{
00096     MSG("Kfluk",Msg::kError)<<"Could not open "<<topDir+"/km3.vec"<<endl;
00097   }
00098 
00099 
00100   ifstream in4((topDir+"/ke3.vec").c_str());
00101   if(in4.is_open()){
00102     in4>>low;
00103     while(!in4.eof()){
00104       in4>>high>>val;
00105       CKE3.push_back(val);
00106       in4>>low;
00107     }
00108     in4.close();
00109   }
00110   else{
00111     MSG("Kfluk",Msg::kError)<<"Could not open "<<topDir+"/ke3.vec"<<endl;
00112   }
00113 
00114   bool sizematch=true;
00115   if(ELO.size()!=EHI.size()) sizematch=false;
00116   if(ELO.size()!=CK0E3.size()) sizematch=false;
00117   if(ELO.size()!=CK0M3.size()) sizematch=false;
00118   if(ELO.size()!=CKE3.size()) sizematch=false;
00119   if(ELO.size()!=CKM3.size()) sizematch=false;
00120 
00121   if(!sizematch){
00122     MSG("Kfluk",Msg::kError) <<"Sizes of vectors do not match!"
00123                              <<"Can not continue"<<std::endl;
00124     assert(false);
00125   }
00126 
00127 }

Kfluk::~Kfluk (  ) 

Definition at line 129 of file Kfluk.cxx.

00130 {}


Member Function Documentation

double Kfluk::GetWeight ( NtpMCFluxInfo fluxinfo  ) 

Definition at line 132 of file Kfluk.cxx.

References GetWeight(), NtpMCFluxInfo::ndecay, and NtpMCFluxInfo::necm.

00133 {
00134   return GetWeight(fluxinfo->ndecay,fluxinfo->necm);
00135 }

double Kfluk::GetWeight ( int  ndecay,
float  Ecm 
)

Definition at line 137 of file Kfluk.cxx.

References CK0E3, CK0M3, CKE3, CKM3, and EHI.

Referenced by GetWeight().

00138 {
00139   //C implementation of D. Jaffe's correction to kl3 decays
00140   //an approximation of the real fix that is going into gnumi
00141   //as of April, 2006.  This function is meant to be a stop gap measure.
00142 
00143   // correction factor for kl3 decays to take
00144   // matrix element into account (approximately)
00145   // see relflux#k3corr 27mar06
00146   //
00147   // 28mar06 add correction factors for BR(recent)/BR(gnumi)
00148   //        for the 2 Ke3 decays
00149   // KL: PRL93 (2004) 181802
00150   // K+: PRL91 (2003) 261802
00151 
00152   double corrk3 = 1.;
00153   if(ndecay==5) return corrk3;  //Km2 +
00154   if(ndecay==8) return corrk3;  //Km2 -
00155   if(ndecay>=11) return corrk3; //mu,pi decays
00156                                                         
00157   unsigned int i = 0;
00158   while(ecm>EHI[i]&&i<EHI.size()){
00159     i = i+1;
00160   }
00161   if(i>=EHI.size()){
00162     i = EHI.size()-1;
00163   }
00164   //  cout<<"Will look in "<<i<<"bin"<<endl;
00165   //  cout<<" factors are: "<<CK0E3[i]<<" "<<CK0M3[i]<<" "<<CKE3[i]<<" "<<CKM3[i]<<endl;
00166 
00167   if(ndecay==1||ndecay==2){
00168     corrk3 = CK0E3[i]*(40.67/38.70);
00169   }
00170   else if(ndecay==3||ndecay==4){
00171     corrk3 = CK0M3[i];
00172   }
00173   else if(ndecay==6||ndecay==9){
00174     corrk3 = CKE3[i]*(5.13/4.82);
00175   }
00176   else if(ndecay==7||ndecay==10){
00177     corrk3 = CKM3[i];
00178   }
00179 
00180   return corrk3;
00181 
00182 }


Member Data Documentation

std::vector<double> Kfluk::CK0E3 [private]

Definition at line 20 of file Kfluk.h.

Referenced by GetWeight(), and Kfluk().

std::vector<double> Kfluk::CK0M3 [private]

Definition at line 21 of file Kfluk.h.

Referenced by GetWeight(), and Kfluk().

std::vector<double> Kfluk::CKE3 [private]

Definition at line 22 of file Kfluk.h.

Referenced by GetWeight(), and Kfluk().

std::vector<double> Kfluk::CKM3 [private]

Definition at line 23 of file Kfluk.h.

Referenced by GetWeight(), and Kfluk().

std::vector<double> Kfluk::EHI [private]

Definition at line 19 of file Kfluk.h.

Referenced by GetWeight(), and Kfluk().

std::vector<double> Kfluk::ELO [private]

Definition at line 18 of file Kfluk.h.

Referenced by Kfluk().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1