MCNNpid Class Reference

#include <MCNNpid.h>

List of all members.

Public Member Functions

 MCNNpid ()
 MCNNpid (const Char_t *pdffilename)
 MCNNpid (Char_t mode_in[], const Char_t *pdffilename)
 ~MCNNpid ()
Double_t GetMCNNpid (NueAnaReader *nueana)
Double_t GetMCNNpid_value (NueRecord *nuerec)
void Setycut (Float_t y_cut_in)
Double_t GetMCNNpid (NueRecord *nuerec)
Double_t GetMCNNpid_NoMny (NueRecord *nuerec)
Double_t GetMCNNpid_NoMfqm (NueRecord *nuerec)
Double_t GetMCNNpid_NoFcc (NueRecord *nuerec)
Double_t GetMCNNpid_FCC (NueRecord *nuerec)

Private Attributes

PDFReaderpdfreader
Bool_t Dof
Bool_t Doq
Bool_t Doy
Bool_t Domfqm
Int_t minbestmatches

Detailed Description

Definition at line 27 of file MCNNpid.h.


Constructor & Destructor Documentation

MCNNpid::MCNNpid (  ) 

Definition at line 28 of file MCNNpid.cxx.

References minbestmatches, and pdfreader.

00028                 {
00029 
00030   //Default mode
00031   //Dof=true;
00032   //Doq=false;
00033   //Doy=true;
00034   //Domfqm=true;
00035 
00036   //since pdfreader not set it won't even attempt to calculate pid; will just return -1 in GetMCNNpid method
00037   pdfreader=NULL;
00038   minbestmatches=50;
00039 
00040 }

MCNNpid::MCNNpid ( const Char_t *  pdffilename  ) 

Definition at line 42 of file MCNNpid.cxx.

References pdfreader.

00042                                          {
00043   
00044   //Default mode
00045   //Dof=true;
00046   //Doq=false;
00047   //Doy=true;
00048   //Domfqm=true;
00049 
00050   //-->file
00051   pdfreader = new PDFReader(pdffilename);
00052 
00053 }

MCNNpid::MCNNpid ( Char_t  mode_in[],
const Char_t *  pdffilename 
)

Definition at line 55 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, mode, and pdfreader.

00055                                                           {
00056 
00057   string mode=mode_in;
00058   if(mode.find("f")!=string::npos){
00059     Dof=true;
00060   }
00061   if(mode.find("q")!=string::npos){
00062     Doq=true;
00063   }
00064   if(mode.find("y")!=string::npos){
00065     Doy=true;
00066   }
00067   if(mode.find("m")!=string::npos){
00068     Domfqm=true;
00069   }
00070 
00071   //Default file
00072   pdfreader = new PDFReader(pdffilename);
00073 
00074 }

MCNNpid::~MCNNpid (  ) 

Definition at line 76 of file MCNNpid.cxx.

00076 {}


Member Function Documentation

Double_t MCNNpid::GetMCNNpid ( NueRecord nuerec  ) 

Definition at line 205 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, and GetMCNNpid_value().

00205                                              {
00206   Dof=true;
00207   Doq=false;
00208   Domfqm=true;
00209   Doy=true;
00210 
00211   Double_t mcnnpid=-1;
00212   mcnnpid = GetMCNNpid_value(nuerec);
00213   return mcnnpid;
00214 }

Double_t MCNNpid::GetMCNNpid ( NueAnaReader nueana  ) 

Definition at line 274 of file MCNNpid.cxx.

References NueAnaReader::nuerecord.

00274                                                 {
00275 
00276   //New version of function just calls earlier NueRecord version;
00277   //for older version, see below.
00278 
00279   Double_t mcnnpid=-1;
00280 
00281   mcnnpid = this->GetMCNNpid(nueana->nuerecord);
00282 
00283   return mcnnpid;
00284 }

Double_t MCNNpid::GetMCNNpid_FCC ( NueRecord nuerec  ) 

Definition at line 250 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, and GetMCNNpid_value().

00250                                                  {
00251    Dof=true;
00252    Doq=false;
00253    Domfqm=false;
00254    Doy=false;
00255 
00256    Double_t mcnnpid=-1;
00257    mcnnpid = GetMCNNpid_value(nuerec);
00258    return mcnnpid;
00259 }

Double_t MCNNpid::GetMCNNpid_NoFcc ( NueRecord nuerec  ) 

Definition at line 239 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, and GetMCNNpid_value().

00239                                                    {
00240    Dof=false;
00241    Doq=false;
00242    Domfqm=true;
00243    Doy=true;
00244 
00245    Double_t mcnnpid=-1;
00246    mcnnpid = GetMCNNpid_value(nuerec);
00247    return mcnnpid;
00248 }

Double_t MCNNpid::GetMCNNpid_NoMfqm ( NueRecord nuerec  ) 

Definition at line 228 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, and GetMCNNpid_value().

00228                                                     {
00229    Dof=true;
00230    Doq=false;
00231    Domfqm=false;
00232    Doy=true;
00233 
00234    Double_t mcnnpid=-1;
00235    mcnnpid = GetMCNNpid_value(nuerec);
00236    return mcnnpid;
00237 }

Double_t MCNNpid::GetMCNNpid_NoMny ( NueRecord nuerec  ) 

Definition at line 217 of file MCNNpid.cxx.

References Dof, Domfqm, Doq, Doy, and GetMCNNpid_value().

00217                                                    {
00218    Dof=true;
00219    Doq=false;
00220    Domfqm=true;
00221    Doy=false;
00222 
00223    Double_t mcnnpid=-1;
00224    mcnnpid = GetMCNNpid_value(nuerec);
00225    return mcnnpid;
00226 }

Double_t MCNNpid::GetMCNNpid_value ( NueRecord nuerec  ) 

Definition at line 81 of file MCNNpid.cxx.

References MCNNVars::bestmatches, Dof, Domfqm, Doq, Doy, PDFReader::GetInt_f_bg(), PDFReader::GetInt_f_sig(), PDFReader::GetProb_f_bg(), PDFReader::GetProb_f_sig(), PDFReader::GetProb_mfqm_bg(), PDFReader::GetProb_mfqm_sig(), PDFReader::GetProb_q_bg(), PDFReader::GetProb_q_sig(), PDFReader::GetProb_y_bg(), PDFReader::GetProb_y_sig(), NueRecord::mcnnv, and pdfreader.

Referenced by GetMCNNpid(), GetMCNNpid_FCC(), GetMCNNpid_NoFcc(), GetMCNNpid_NoMfqm(), and GetMCNNpid_NoMny().

00081                                                    {
00082 
00083   Double_t prob_f_sig = 1.;
00084   Double_t prob_f_bg = 1.;
00085   Double_t prob_q_sig = 1.;
00086   Double_t prob_q_bg = 1.;
00087   Double_t prob_y_sig = 1.;
00088   Double_t prob_y_bg = 1.;
00089   Double_t prob_mfqm_sig = 1.;
00090   Double_t prob_mfqm_bg = 1.;
00091 
00092   Double_t int_f_sig = 1.;
00093   Double_t int_f_bg = 1.;
00094   //Double_t int_q_sig = 1.;
00095   //Double_t int_q_bg = 1.;
00096   //Double_t int_y_sig = 1.;
00097   //Double_t int_y_bg = 1.;
00098   //Double_t int_mfqm_sig = 1.;
00099   //Double_t int_mfqm_bg = 1.;
00100 
00101   Double_t mcnnpid=-1;
00102 
00103   if(pdfreader!=NULL && nuerec->mcnnv.bestmatches>0){
00104 
00105     //RBT:Pedro only made this function, so we'll set this for all variables...
00106     //The value should be the same for all of the functions, if the pdf files
00107     // were made correctly
00108     int_f_sig=pdfreader->GetInt_f_sig(nuerec);
00109     int_f_bg=pdfreader->GetInt_f_bg(nuerec);
00110 
00111     if(Dof==true){
00112 
00113       //Get probability
00114       prob_f_sig = pdfreader->GetProb_f_sig(nuerec);
00115       prob_f_bg = pdfreader->GetProb_f_bg(nuerec);
00116 
00117       //Integration factor (set above)
00118       //int_f_sig=pdfreader->GetInt_f_sig(nuerec);
00119       //int_f_bg=pdfreader->GetInt_f_bg(nuerec);
00120 
00121       //Normalize
00122       prob_f_sig=(int_f_sig)?prob_f_sig*(1./int_f_sig):0;
00123       prob_f_bg=(int_f_bg)?prob_f_bg*(1./int_f_bg):0;
00124     }
00125 
00126     if(Doq==true){
00127 
00128       //Get probability
00129       prob_q_sig = pdfreader->GetProb_q_sig(nuerec);
00130       prob_q_bg = pdfreader->GetProb_q_bg(nuerec);
00131 
00132       //(Functions do not exist)
00133       //int_q_sig=pdfreader->GetInt_q_sig(nuerec);
00134       //int_q_bg=pdfreader->GetInt_q_bg(nuerec);
00135 
00136       //Normalize
00137       prob_q_sig=(int_f_sig)?prob_q_sig*(1./int_f_sig):0;
00138       prob_q_bg=(int_f_bg)?prob_q_bg*(1./int_f_bg):0;
00139     }
00140 
00141     if(Doy==true){
00142 
00143       //Get probability
00144       prob_y_sig = pdfreader->GetProb_y_sig(nuerec);
00145       prob_y_bg = pdfreader->GetProb_y_bg(nuerec);
00146 
00147       //(Functions do not exist)
00148       //int_y_sig=pdfreader->GetInt_y_sig(nuerec);
00149       //int_y_bg=pdfreader->GetInt_y_bg(nuerec);
00150 
00151       //Normalize
00152       prob_y_sig=(int_f_sig)?prob_y_sig*(1./int_f_sig):0;
00153       prob_y_bg=(int_f_bg)?prob_y_bg*(1./int_f_bg):0;
00154     }
00155 
00156     if(Domfqm==true){
00157 
00158       //Get probability
00159       prob_mfqm_sig = pdfreader->GetProb_mfqm_sig(nuerec);
00160       prob_mfqm_bg = pdfreader->GetProb_mfqm_bg(nuerec);
00161      
00162       //(Functions do not exist)
00163       //int_mfqm_sig=pdfreader->GetInt_mfqm_sig(nuerec);
00164       //int_mfqm_bg=pdfreader->GetInt_mfqm_bg(nuerec);
00165 
00166       //Normalize
00167       prob_mfqm_sig=(int_f_sig)?prob_mfqm_sig*(1./int_f_sig):0;
00168       prob_mfqm_bg=(int_f_bg)?prob_mfqm_bg*(1./int_f_bg):0;
00169 
00170     }
00171     
00172     //Product of probabilities
00173     Double_t prob_sig=prob_f_sig*prob_q_sig*prob_y_sig*prob_mfqm_sig;
00174     Double_t prob_bg=prob_f_bg*prob_q_bg*prob_y_bg*prob_mfqm_bg;
00175     //Double_t int_sig=pdfreader->GetInt_f_sig(nuerec);
00176     //Double_t int_bg=pdfreader->GetInt_f_bg(nuerec);
00177     
00178     Bool_t not_in_bound=false;//<--when the energy is out of range of the PDFs we will return default value (-1)
00179     
00180     //(if Energy is in bounds)
00181     if(int_f_sig>0){
00182       prob_sig=prob_sig*int_f_sig; //multiply by norm factor to get correct
00183     } else not_in_bound=true; // (Not in bounds)
00184 
00185     //(If energy is in bounds)
00186     if(int_f_bg>0){
00187       prob_bg=prob_bg*int_f_bg; //multiply by norm factor to get correct
00188     } else not_in_bound=true; //(Not in bounds)
00189     
00190     //If everything was in bounds, calculate the PID!
00191     Bool_t empty_bins=false;
00192     if (prob_sig==0&&prob_bg==0) empty_bins=true;
00193 
00194     if(not_in_bound==false&&empty_bins==false){
00195       mcnnpid=prob_sig/(prob_sig+prob_bg);
00196     }
00197   }
00198 
00199   return mcnnpid;
00200 
00201 }

void MCNNpid::Setycut ( Float_t  y_cut_in  ) 

Definition at line 265 of file MCNNpid.cxx.

References pdfreader, and PDFReader::Setycut().

Referenced by MCNNFiller::Setycut().

00265                                      {
00266   //Sets y cut which used by pdf reader.
00267 
00268   if(pdfreader!=NULL){
00269     pdfreader->Setycut(y_cut_in);
00270   }
00271 
00272 }


Member Data Documentation

Bool_t MCNNpid::Dof [private]
Bool_t MCNNpid::Domfqm [private]
Bool_t MCNNpid::Doq [private]
Bool_t MCNNpid::Doy [private]
Int_t MCNNpid::minbestmatches [private]

Definition at line 59 of file MCNNpid.h.

Referenced by MCNNpid().

Definition at line 54 of file MCNNpid.h.

Referenced by GetMCNNpid_value(), MCNNpid(), and Setycut().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1