NNReader Class Reference

#include <NNReader.h>

List of all members.

Public Member Functions

 NNReader ()
 NNReader (const char *name, Bool_t isMC_in)
 NNReader (const char *name, const char *name2, Bool_t isMC_in)
 ~NNReader ()
Int_t Add (const char *namefile_in)
Bool_t GetEntry (Int_t srCtr_in)
Int_t GetEntries ()
void SetBranches ()
void SetDefaults ()
Float_t CalculatePOT (Int_t filenum, Int_t filetype)
Float_t CalculatePOT ()
Float_t GetfracCC ()
Float_t GetfracCCy (Float_t y_cut)
Int_t GetNnue ()
Int_t GetNnuey (Float_t y_cut)
Float_t Getymean ()
Float_t GetNCymean ()
Int_t GetNumBestMatches ()
void SetMaxNumBestMatches (Int_t nbm_in)
void SetMaxRunNC (Int_t run_in)
void SetMaxRunNue (Int_t run_in)
Float_t GetMeanFracQMatched ()
Float_t GetNCMeanFracQMatched ()
MinosCompactEventGetInputCCE ()
MinosAnalysisResultGetMinosAnalysisResult ()
MCNNBestMatchGetBestMatch (Int_t entry_in)
void Reset ()
void SetFracNue (Float_t frac_in)
void SetFracNC (Float_t frac_in)
Float_t GetWeightedfracCCy (Float_t y_cut)
Float_t GetWeightedMeanFracQMatched ()

Public Attributes

Bool_t isMC
Int_t num_best_matches
Int_t max_run_nc
Int_t max_run_nue
Int_t run
Int_t snarl
Int_t evt
Int_t nuid
Int_t nuidnoosc
Int_t action
Float_t nue
Float_t nuenoosc
Float_t reco_nue
Float_t y
Float_t emfrac
Int_t ires
Float_t qtot
Float_t vtxx
Float_t vtxy
Float_t vtxz
Float_t vtxu
Float_t vtxv
Float_t tvtxx
Float_t tvtxy
Float_t tvtxz
Int_t tptype
Float_t tpx
Float_t tpy
Float_t tpz
Int_t npln
Int_t nplnu
Int_t nplnv
Int_t nstp
Int_t mcpresel
Int_t datapresel
Int_t nxtalk
Int_t nxtalk_tagged
Int_t nxtalk_mistagged
Int_t nphysics
Float_t w2
Float_t totpt
Float_t good_pot
Float_t total_pot
Int_t good_snarl
Float_t snarl_pot
Int_t BM_run
Int_t BM_snarl
Float_t BM_true_enu
Float_t BM_true_y
Int_t BM_interactionType
Int_t BM_resonanceCode
Int_t BM_nuFlavor
Float_t BM_dlnL
MinosAnalysisResultmar
MinosCompactEventcce
Int_t current_entry

Private Attributes

TChain * chain
TChain * chain_pot
Int_t usingboth
TH1F * h_frac_nue
TH1F * h_frac_nc
Float_t weightedmeanfracQmatched
Bool_t branchesset
MCNNBestMatchbmatch

Static Private Attributes

static const Float_t POT_file_carrot_FD = 2.91*1e20
static const Float_t POT_file_daikon_FD = 6.5*1e20
static const Float_t POT_file_carrot_ND = 1.0024*1e16
static const Float_t POT_file_daikon_ND = 1.936*1e16

Detailed Description

Definition at line 12 of file NNReader.h.


Constructor & Destructor Documentation

NNReader::NNReader (  ) 

Definition at line 17 of file NNReader.cxx.

References bmatch, cce, chain, current_entry, h_frac_nc, h_frac_nue, isMC, mar, max_run_nc, max_run_nue, num_best_matches, SetDefaults(), and usingboth.

00017                   {
00018 
00019   isMC=true;
00020   chain = new TChain("nn");
00021   num_best_matches=20;
00022   usingboth=0;
00023   current_entry=0;
00024   cce = new MinosCompactEvent();
00025   mar = new MinosAnalysisResult();
00026   bmatch = new MCNNBestMatch();
00027   max_run_nc = 30000000;
00028   max_run_nue = 30000000;
00029   cout << "Assuming name of tree is \"nn\"" << endl;
00030   SetDefaults();
00031   h_frac_nue = new TH1F("h_frac_nue","",20,-0.5,1.5);
00032   h_frac_nc = new TH1F("h_frac_nc","",20,-0.5,1.5);
00033 
00034 }

NNReader::NNReader ( const char *  name,
Bool_t  isMC_in 
)

Definition at line 36 of file NNReader.cxx.

References bmatch, cce, chain, current_entry, h_frac_nc, h_frac_nue, isMC, mar, max_run_nc, max_run_nue, num_best_matches, SetDefaults(), and usingboth.

00036                                                   {
00037 
00038   isMC=isMC_in;
00039   chain = new TChain(name);
00040   num_best_matches=20;  
00041   usingboth=0;
00042   current_entry =0;
00043   cce = new MinosCompactEvent();
00044   mar = new MinosAnalysisResult();
00045   bmatch = new MCNNBestMatch();
00046   max_run_nc = 30000000;
00047   max_run_nue = 30000000;
00048   SetDefaults();
00049   h_frac_nue = new TH1F("h_frac_nue","",20,-0.5,1.5);
00050   h_frac_nc = new TH1F("h_frac_nc","",20,-0.5,1.5);
00051 
00052 }

NNReader::NNReader ( const char *  name,
const char *  name2,
Bool_t  isMC_in 
)

Definition at line 54 of file NNReader.cxx.

References bmatch, cce, chain, chain_pot, current_entry, h_frac_nc, h_frac_nue, isMC, mar, max_run_nc, max_run_nue, num_best_matches, SetDefaults(), and usingboth.

00054                                                                      {
00055 
00056   isMC=isMC_in;
00057   chain = new TChain(name);
00058   chain_pot = new TChain(name2);
00059   num_best_matches=20;  
00060   usingboth=1;
00061   current_entry=0;
00062   cce = new MinosCompactEvent();
00063   mar = new MinosAnalysisResult();
00064   bmatch = new MCNNBestMatch();
00065   max_run_nc = 30000000;
00066   max_run_nue = 30000000;
00067   SetDefaults();
00068   h_frac_nue = new TH1F("h_frac_nue","",20,-0.5,1.5);
00069   h_frac_nc = new TH1F("h_frac_nc","",20,-0.5,1.5);
00070 
00071 }

NNReader::~NNReader (  ) 

Definition at line 73 of file NNReader.cxx.

References h_frac_nc, and h_frac_nue.

00073                    {
00074 
00075   delete h_frac_nue;
00076   delete h_frac_nc;
00077 }


Member Function Documentation

Int_t NNReader::Add ( const char *  namefile_in  ) 

Definition at line 287 of file NNReader.cxx.

References chain, chain_pot, and usingboth.

Referenced by MCNNMergeModule::BeginJob(), and FileLumper::FileLumper().

00287                                           {
00288 
00289   Int_t outcome=chain->Add(namefile_in);
00290   Int_t outcome2=0;
00291   if(usingboth==1){
00292     outcome2=chain_pot->Add(namefile_in);
00293   }
00294   //SetBranches();<--
00295   if(usingboth==1 && outcome!=outcome2){
00296     cout << "WARNING: did not add same number of files for main chain and for pot chain!!" << endl;
00297     cout << "--> Main chain: " << outcome << "; POT chain: " << outcome2 << endl;
00298   }
00299 
00300   return outcome;
00301 
00302 }

Float_t NNReader::CalculatePOT (  ) 

Definition at line 353 of file NNReader.cxx.

References chain_pot, good_pot, and usingboth.

00353                               {
00354 
00355   if(usingboth!=1){
00356     cout << "WARNING: Cannot calculate POT in this way; do not have pot tree (need to specify in constructor)" << endl;
00357     return -1;
00358   } else {
00359     Float_t pot_out=0;
00360     Int_t int_srCtr=0;
00361     while(chain_pot->GetEntry(int_srCtr)){
00362       ++int_srCtr;      
00363       pot_out+=good_pot;
00364     }
00365 
00366     return pot_out;
00367     
00368   }
00369 
00370 }

Float_t NNReader::CalculatePOT ( Int_t  filenum,
Int_t  filetype 
)

Definition at line 323 of file NNReader.cxx.

References MuELoss::e, isMC, POT_file_carrot_FD, POT_file_carrot_ND, POT_file_daikon_FD, and POT_file_daikon_ND.

00323                                                            {
00324 
00325   Float_t pot_out=0;
00326   if(isMC==true){
00327     if(filetype==0){//<--carrot FD
00328       pot_out=filenum*POT_file_carrot_FD*1e-12;
00329       cout << "Using carrot FD POT" << endl;
00330     }
00331     if(filetype==1){//<--daikon FD
00332       pot_out=filenum*POT_file_daikon_FD*1e-12;
00333       cout << "Using daikon FD POT " << endl;
00334     }
00335     if(filetype==2){//<--carrot ND
00336       pot_out=filenum*POT_file_carrot_ND*1e-12;
00337       cout << "Using carrot ND POT" << endl;
00338     }
00339     if(filetype==3){//<--daikon ND
00340       pot_out=filenum*POT_file_daikon_ND*1e-12;
00341       cout << "Using daikon ND POT " << endl;
00342     }
00343 
00344   }else {
00345     cout << "Don't know how to calculate POT for data; only MC so far; program me!" << endl;
00346   }
00347 
00348   return pot_out;
00349 
00350 }

MCNNBestMatch * NNReader::GetBestMatch ( Int_t  entry_in  ) 

Definition at line 787 of file NNReader.cxx.

References bmatch, MCNNBestMatch::dlnL, ComparisonResult::dLnL, ComparisonResult::eNu, MCNNBestMatch::fracQmatched, ComparisonResult::fractionQMatched, GetNumBestMatches(), ComparisonResult::idact, ComparisonResult::idnu, ComparisonResult::idres, MCNNBestMatch::interactionType, mar, MCNNBestMatch::nuFlavor, MCNNBestMatch::resonanceCode, MinosAnalysisResult::ResultList, ComparisonResult::run, MCNNBestMatch::run, ComparisonResult::snarl, MCNNBestMatch::snarl, MCNNBestMatch::stdhepsize, MCNNBestMatch::true_enu, MCNNBestMatch::true_y, and ComparisonResult::y.

Referenced by MCNNFiller::FillBestMatches().

00787                                                    {
00788 
00789   if(entry_in<GetNumBestMatches()){
00790     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(entry_in));
00791 
00792     //bmatch->Clear();
00793     //bmatch->Reset();
00794   
00795     bmatch->run=compres->run;
00796     bmatch->snarl=compres->snarl;
00797     bmatch->interactionType=compres->idact;
00798     bmatch->nuFlavor=compres->idnu;
00799     bmatch->true_enu=compres->eNu;
00800     bmatch->true_y=compres->y;
00801     bmatch->resonanceCode=compres->idres;
00802     bmatch->dlnL=compres->dLnL;
00803     bmatch->fracQmatched=compres->fractionQMatched;
00804     bmatch->stdhepsize=0;
00805     
00806     return bmatch;
00807 
00808   }
00809 
00810   else return NULL;
00811 
00812   }

Int_t NNReader::GetEntries (  ) 

Definition at line 316 of file NNReader.cxx.

References chain.

Referenced by MCNNMergeModule::BeginJob(), and FileLumper::FileLumper().

00316                           {
00317 
00318   return chain->GetEntries();
00319 
00320 }

Bool_t NNReader::GetEntry ( Int_t  srCtr_in  ) 

Definition at line 305 of file NNReader.cxx.

References branchesset, chain, current_entry, and SetBranches().

Referenced by FileLumper::FileLumper(), and MCNNMergeModule::Reco().

00305                                        {
00306 
00307   if(branchesset==false){
00308     SetBranches();
00309   }
00310   current_entry=srCtr_in;
00311   return chain->GetEntry(srCtr_in);
00312 
00313 }

Float_t NNReader::GetfracCC (  ) 

Definition at line 372 of file NNReader.cxx.

References ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, and ComparisonResult::run.

00372                            {
00373 
00374   Int_t nresults = mar->ResultList->GetEntries();
00375   Int_t match_nue = 0;
00376   Int_t matches = 0;
00377 
00378   Int_t bm=0;
00379   Int_t bma=0;
00380   while(bma<num_best_matches && bm<nresults){
00381         
00382     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00383 
00384     Int_t filetype=compres->run/100000;
00385     Int_t max_run=0;
00386     if(filetype==210){
00387       max_run=max_run_nc;
00388     } else {
00389       max_run=max_run_nue;
00390     }
00391     
00392     if(compres->run <= max_run){
00393 
00394       if(abs(compres->idnu)==12 && compres->idact==1){
00395         ++match_nue;
00396         ++matches;
00397       } else {
00398         ++matches;
00399       }  
00400       
00401       ++bma;
00402 
00403     }
00404     
00405     ++bm;      
00406 
00407   }//looping over first NUMBER_BEST_MATCHES best matches
00408   
00409   Float_t fracCC;
00410   //-->Calculating fracCC and filling histograms
00411   if(matches!=0){
00412     fracCC=match_nue*1./matches;
00413   } else {
00414     fracCC=-1;
00415   }   
00416 
00417   return fracCC;
00418 
00419 }

Float_t NNReader::GetfracCCy ( Float_t  y_cut  ) 

Definition at line 422 of file NNReader.cxx.

References ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, ComparisonResult::run, and ComparisonResult::y.

00422                                          {
00423 
00424   Int_t nresults = mar->ResultList->GetEntries();
00425   Int_t match_nue = 0;
00426   Int_t matches = 0;
00427 
00428   Int_t bm=0;
00429   Int_t bma=0;
00430 
00431   while(bma<num_best_matches && bm<nresults){
00432         
00433     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00434 
00435     Int_t filetype=compres->run/100000;
00436     Int_t max_run=0;
00437     if(filetype==210){
00438       max_run=max_run_nc;
00439     } else {
00440       max_run=max_run_nue;
00441     }
00442     
00443     if(compres->run <= max_run){
00444 
00445       if(abs(compres->idnu)==12 && compres->idact==1 && compres->y<y_cut){
00446         ++match_nue;
00447         ++matches;
00448       } else {
00449         ++matches; 
00450       }  
00451       
00452       ++bma;
00453 
00454     }
00455     
00456     ++bm;
00457 
00458   }//looping over first NUMBER_BEST_MATCHES best matches
00459   
00460   Float_t fracCCy;
00461   //-->Calculating fracCC and filling histograms
00462   if(matches!=0){
00463     fracCCy=match_nue*1./matches;
00464   } else {
00465     fracCCy=-1;
00466   }   
00467 
00468   return fracCCy;
00469 
00470 }

MinosCompactEvent * NNReader::GetInputCCE (  ) 

Definition at line 773 of file NNReader.cxx.

References cce.

Referenced by FileLumper::FileLumper(), and MCNNFiller::FillMCNN().

00773                                         {
00774   
00775   return cce;
00776 
00777 }

Float_t NNReader::GetMeanFracQMatched (  ) 

Definition at line 678 of file NNReader.cxx.

References ComparisonResult::fractionQMatched, ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, and ComparisonResult::run.

00678                                      {
00679 
00680   Int_t nresults = mar->ResultList->GetEntries();
00681   Int_t matches = 0;
00682   Float_t meanfracQmatched=0;
00683 
00684   Int_t bm=0;
00685   Int_t bma=0;
00686   while(bma<num_best_matches && bm<nresults){
00687         
00688     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00689     
00690     Int_t filetype=compres->run/100000;
00691     Int_t max_run=0;
00692     if(filetype==210){
00693       max_run=max_run_nc;
00694     } else {
00695       max_run=max_run_nue;
00696     }
00697 
00698     if(compres->run <= max_run){
00699 
00700       if(abs(compres->idnu)==12 && compres->idact==1){
00701         meanfracQmatched += compres->fractionQMatched;
00702         ++matches;
00703       }
00704 
00705       ++bma;
00706 
00707     }
00708     
00709     ++bm;
00710 
00711   }//looping over first NUMBER_BEST_MATCHES best matches
00712   
00713   //-->Calculating meanfracQmatched;
00714   if(matches!=0){
00715     meanfracQmatched=meanfracQmatched*1./matches;
00716   } else {
00717     meanfracQmatched=-1;
00718   }
00719 
00720   return meanfracQmatched;
00721 
00722 }

MinosAnalysisResult * NNReader::GetMinosAnalysisResult (  ) 

Definition at line 780 of file NNReader.cxx.

References mar.

Referenced by FileLumper::FileLumper().

00780                                                      {
00781   
00782   return mar;
00783 
00784 }

Float_t NNReader::GetNCMeanFracQMatched (  ) 

Definition at line 725 of file NNReader.cxx.

References ComparisonResult::fractionQMatched, ComparisonResult::idact, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, and ComparisonResult::run.

00725                                        {
00726 
00727   Int_t nresults = mar->ResultList->GetEntries();
00728   Int_t matches = 0;
00729   Float_t NCmeanfracQmatched=0;
00730 
00731   Int_t bm=0;
00732   Int_t bma=0;
00733   while(bma<num_best_matches && bm<nresults){
00734         
00735     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00736     
00737     Int_t filetype=compres->run/100000;
00738     Int_t max_run=0;
00739     if(filetype==210){
00740       max_run=max_run_nc;
00741     } else {
00742       max_run=max_run_nue;
00743     }
00744 
00745     if(compres->run <= max_run){
00746 
00747       if(compres->idact!=1){
00748         NCmeanfracQmatched += compres->fractionQMatched;
00749         ++matches;
00750       }
00751 
00752       ++bma;
00753 
00754     }
00755     
00756     ++bm;
00757 
00758   }//looping over first NUMBER_BEST_MATCHES best matches
00759   
00760   //-->Calculating NCmeanfracQmatched;
00761   if(matches!=0){
00762     NCmeanfracQmatched=NCmeanfracQmatched*1./matches;
00763   } else {
00764     NCmeanfracQmatched=-1;
00765   }
00766 
00767   return NCmeanfracQmatched;
00768 
00769 }

Float_t NNReader::GetNCymean (  ) 

Definition at line 602 of file NNReader.cxx.

References ComparisonResult::idact, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, ComparisonResult::run, and ComparisonResult::y.

00602                             {
00603 
00604   Float_t result=-1;
00605   Int_t matches=0;
00606   Int_t nresults = mar->ResultList->GetEntries();
00607   Float_t NCely=0;
00608   
00609 
00610   Int_t bm=0;
00611   Int_t bma=0;
00612   while(bma<num_best_matches && bm<nresults){
00613         
00614     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00615     
00616     Int_t filetype=compres->run/100000;
00617     Int_t max_run=0;
00618     if(filetype==210){
00619       max_run=max_run_nc;
00620     } else {
00621       max_run=max_run_nue;
00622     }
00623 
00624     if(compres->run <= max_run){
00625 
00626       if(compres->idact!=1){
00627         NCely += compres->y;
00628         ++matches;       
00629       }
00630       
00631       ++bma;
00632 
00633     }
00634   
00635     ++bm;
00636 
00637   }//looping over first NUMBER_BEST_MATCHES best matches
00638   
00639   if(matches!=0){
00640     result=NCely*1./matches;
00641   }
00642  
00643   return result;
00644 
00645 }

Int_t NNReader::GetNnue (  ) 

Definition at line 473 of file NNReader.cxx.

References ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, and ComparisonResult::run.

00473                        {
00474 
00475   Int_t nresults = mar->ResultList->GetEntries();
00476   Int_t match_nue = 0;
00477   //Int_t matches = 0;
00478 
00479   Int_t bm=0;
00480   Int_t bma=0;
00481   while(bma<num_best_matches && bm<nresults){
00482         
00483     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00484     
00485     Int_t filetype=compres->run/100000;
00486     Int_t max_run=0;
00487     if(filetype==210){
00488       max_run=max_run_nc;
00489     } else {
00490       max_run=max_run_nue;
00491     }
00492 
00493     if(compres->run <= max_run){
00494       
00495       if(abs(compres->idnu)==12 && compres->idact==1){
00496         ++match_nue;
00497         //++matches;
00498         //} else {
00499         //++matches;
00500       }  
00501 
00502       ++bma;
00503 
00504     }
00505 
00506     ++bm;
00507 
00508   }//looping over first NUMBER_BEST_MATCHES best matches
00509 
00510   return match_nue;
00511 
00512 }

Int_t NNReader::GetNnuey ( Float_t  y_cut  ) 

Definition at line 515 of file NNReader.cxx.

References ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, ComparisonResult::run, and ComparisonResult::y.

00515                                      {
00516 
00517   Int_t nresults = mar->ResultList->GetEntries();
00518   Int_t match_nue = 0;
00519   //Int_t matches = 0;
00520 
00521   Int_t bm=0;
00522   Int_t bma=0;
00523   while(bma<num_best_matches && bm<nresults){
00524         
00525     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00526     
00527     Int_t filetype=compres->run/100000;
00528     Int_t max_run=0;
00529     if(filetype==210){
00530       max_run=max_run_nc;
00531     } else {
00532       max_run=max_run_nue;
00533     }
00534 
00535     if(compres->run <= max_run){
00536       
00537       if(abs(compres->idnu)==12 && compres->idact==1 && compres->y<y_cut){
00538         ++match_nue;
00539         //  ++matches;
00540         //} else {
00541         //++matches; 
00542       }  
00543     
00544       ++bma;
00545   
00546     }
00547 
00548     ++bm;
00549 
00550   }//looping over first NUMBER_BEST_MATCHES best matches
00551  
00552   return match_nue;
00553 
00554 }

Int_t NNReader::GetNumBestMatches (  ) 

Definition at line 649 of file NNReader.cxx.

References mar, and MinosAnalysisResult::ResultList.

Referenced by MCNNFiller::FillMCNN(), and GetBestMatch().

00649                                  {
00650 
00651   return mar->ResultList->GetEntries();
00652 
00653 }

Float_t NNReader::GetWeightedfracCCy ( Float_t  y_cut  ) 

Definition at line 840 of file NNReader.cxx.

References ComparisonResult::fractionQMatched, h_frac_nc, h_frac_nue, ComparisonResult::idact, ComparisonResult::idnu, mar, num_best_matches, MinosAnalysisResult::ResultList, ComparisonResult::run, weightedmeanfracQmatched, and ComparisonResult::y.

00840                                                  {
00841 
00842   Int_t nresults = mar->ResultList->GetEntries();
00843   Int_t match_nue = 0;
00844   weightedmeanfracQmatched=0;
00845   Int_t matches = 0;
00846   Int_t matches_mfqm=0;
00847 
00848   Int_t bm=0;
00849   Int_t bma=0;
00850 
00851   while(bma<num_best_matches && bm<nresults){
00852         
00853     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00854 
00855     Int_t filetype=compres->run/100000;
00856     Int_t proba=0;
00857     if(filetype==210){
00858       proba=(int)h_frac_nc->GetRandom();
00859     } else {
00860       proba=(int)h_frac_nue->GetRandom();
00861     }
00862     
00863     //proba=1;
00864 
00865     if(proba==1){
00866 
00867       if(abs(compres->idnu)==12 && compres->idact==1){
00868         weightedmeanfracQmatched += compres->fractionQMatched;
00869         ++matches_mfqm;
00870         if(compres->y<y_cut){
00871           ++match_nue;
00872         }
00873         ++matches;
00874       } else {
00875         ++matches; 
00876       }  
00877       
00878       ++bma;
00879 
00880     }
00881     
00882     ++bm;
00883 
00884   }//looping over first NUMBER_BEST_MATCHES best matches
00885   
00886   Float_t fracCCy;
00887   //-->Calculating fracCC and filling histograms
00888   if(matches!=0){
00889    fracCCy=match_nue*1./matches; 
00890   } else {
00891     fracCCy=-1;
00892   }   
00893 
00894   if(matches_mfqm!=0){
00895     weightedmeanfracQmatched=weightedmeanfracQmatched*1./matches_mfqm;
00896   } else {
00897     weightedmeanfracQmatched=-1;
00898   }
00899 
00900   return fracCCy;
00901 
00902 }

Float_t NNReader::GetWeightedMeanFracQMatched (  ) 

Definition at line 905 of file NNReader.cxx.

References weightedmeanfracQmatched.

00905                                              {
00906 
00907   return weightedmeanfracQmatched;
00908 
00909 }

Float_t NNReader::Getymean (  ) 

Definition at line 557 of file NNReader.cxx.

References ComparisonResult::idact, ComparisonResult::idnu, mar, max_run_nc, max_run_nue, num_best_matches, MinosAnalysisResult::ResultList, ComparisonResult::run, and ComparisonResult::y.

00557                           {
00558 
00559   Float_t result=-1;
00560   Int_t matches=0;
00561   Int_t nresults = mar->ResultList->GetEntries();
00562   Float_t ely=0;
00563   
00564 
00565   Int_t bm=0;
00566   Int_t bma=0;
00567   while(bma<num_best_matches && bm<nresults){
00568         
00569     const ComparisonResult *compres = dynamic_cast<const ComparisonResult*>(mar->ResultList->At(bm));
00570     
00571     Int_t filetype=compres->run/100000;
00572     Int_t max_run=0;
00573     if(filetype==210){
00574       max_run=max_run_nc;
00575     } else {
00576       max_run=max_run_nue;
00577     }
00578 
00579     if(compres->run <= max_run){
00580 
00581       if(abs(compres->idnu)==12 && compres->idact==1){
00582         ely += compres->y;
00583         ++matches;       
00584       }
00585       
00586       ++bma;
00587 
00588     }
00589   
00590     ++bm;
00591 
00592   }//looping over first NUMBER_BEST_MATCHES best matches
00593   
00594   if(matches!=0){
00595     result=ely*1./matches;
00596   }
00597  
00598   return result;
00599 
00600 }

void NNReader::Reset (  ) 

Definition at line 815 of file NNReader.cxx.

References chain.

00815                     {
00816 
00817   chain->Reset();
00818 
00819 }

void NNReader::SetBranches (  ) 

Definition at line 80 of file NNReader.cxx.

References action, branchesset, cce, chain, chain_pot, datapresel, emfrac, evt, good_pot, good_snarl, ires, isMC, mar, mcpresel, npln, nplnu, nplnv, nstp, nue, nuenoosc, nuid, nuidnoosc, qtot, reco_nue, run, snarl, snarl_pot, total_pot, totpt, tptype, tpx, tpy, tpz, tvtxx, tvtxy, tvtxz, usingboth, vtxu, vtxv, vtxx, vtxy, vtxz, and w2.

Referenced by GetEntry().

00080                           {
00081 
00082   if(isMC==true){
00083     //cout << "Going over MC" << endl;
00084   } else {
00085     //cout << "Going over data" << endl;
00086   }
00087 
00088   //Branches
00089   //--------
00090   if(chain->GetBranchStatus("cce")){
00091     chain->SetBranchAddress("cce",&cce);
00092   }  
00093   if(chain->GetBranchStatus("comparisonResults")){
00094     chain->SetBranchAddress("comparisonResults",&mar);
00095   }
00096   if(chain->GetBranchStatus("run")){
00097     chain->SetBranchAddress("run",&run);
00098   }
00099   if(chain->GetBranchStatus("snarl")){
00100     chain->SetBranchAddress("snarl",&snarl);
00101   }  
00102   if(chain->GetBranchStatus("evt")){
00103     chain->SetBranchAddress("evt",&evt);
00104   }
00105   if(chain->GetBranchStatus("nuid")){
00106     chain->SetBranchAddress("nuid",&nuid);
00107   }
00108   if(chain->GetBranchStatus("nuidnoosc")){
00109     chain->SetBranchAddress("nuidnoosc",&nuidnoosc);
00110   }
00111   if(chain->GetBranchStatus("action")){
00112     chain->SetBranchAddress("action",&action);
00113   }
00114   if(chain->GetBranchStatus("nue")){
00115     chain->SetBranchAddress("nue",&nue);
00116   }
00117   if(chain->GetBranchStatus("nuenoosc")){
00118     chain->SetBranchAddress("nuenoosc",&nuenoosc);
00119   }
00120   if(chain->GetBranchStatus("reco_nue")){
00121     chain->SetBranchAddress("reco_nue",&reco_nue);
00122   }
00123   //if(chain->GetBranchStatus("y")){
00124   //Note: For some reason y comes out with default value even though it is correctly set. 
00125   // Do not understand this. I think could be conflicting with y in MinosCompactEvent since it's exactly same name, but don't know. 
00126   // To extract y from mcnn files, have to uncomment this and just use the y from the MinosCompactEvent  
00127   // as nread->GetInputCCE()->y 
00128   // chain->SetBranchAddress("y",&y);
00129   //}
00130   if(chain->GetBranchStatus("emfrac")){
00131     chain->SetBranchAddress("emfrac",&emfrac);
00132   }  
00133   if(chain->GetBranchStatus("ires")){
00134     chain->SetBranchAddress("ires",&ires);
00135   }   
00136   if(chain->GetBranchStatus("qtot")){
00137     chain->SetBranchAddress("qtot",&qtot);
00138   }
00139   if(chain->GetBranchStatus("vtxx")){
00140     chain->SetBranchAddress("vtxx",&vtxx);
00141   }
00142   if(chain->GetBranchStatus("vtxy")){
00143     chain->SetBranchAddress("vtxy",&vtxy);
00144   }
00145   if(chain->GetBranchStatus("vtxz")){
00146     chain->SetBranchAddress("vtxz",&vtxz);
00147   }
00148   if(chain->GetBranchStatus("vtxu")){
00149     chain->SetBranchAddress("vtxu",&vtxu);
00150   }
00151   if(chain->GetBranchStatus("vtxv")){
00152     chain->SetBranchAddress("vtxv",&vtxv);
00153   }
00154   if(chain->GetBranchStatus("tvtxx")){
00155     chain->SetBranchAddress("tvtxx",&tvtxx);
00156   }
00157   if(chain->GetBranchStatus("tvtxy")){
00158     chain->SetBranchAddress("tvtxy",&tvtxy);
00159   }
00160   if(chain->GetBranchStatus("tvtxz")){
00161     chain->SetBranchAddress("tvtxz",&tvtxz);
00162   }
00163   if(chain->GetBranchStatus("tptype")){
00164     chain->SetBranchAddress("tptype",&tptype);
00165   }
00166   if(chain->GetBranchStatus("tpx")){
00167     chain->SetBranchAddress("tpx",&tpx);
00168   }
00169   if(chain->GetBranchStatus("tpy")){
00170     chain->SetBranchAddress("tpy",&tpy);
00171   }  
00172   if(chain->GetBranchStatus("tpz")){
00173     chain->SetBranchAddress("tpz",&tpz);
00174   }
00175   if(chain->GetBranchStatus("npln")){
00176     chain->SetBranchAddress("npln",&npln);
00177   }
00178   if(chain->GetBranchStatus("nplnu")){
00179     chain->SetBranchAddress("nplnu",&nplnu);
00180   }
00181   if(chain->GetBranchStatus("nplnv")){
00182     chain->SetBranchAddress("nplnv",&nplnv);
00183   }
00184   if(chain->GetBranchStatus("nstp")){
00185     chain->SetBranchAddress("nstp",&nstp);
00186   }
00187   if(chain->GetBranchStatus("mcpresel")){
00188     chain->SetBranchAddress("mcpresel",&mcpresel);
00189   }
00190   if(chain->GetBranchStatus("datapresel")){
00191     chain->SetBranchAddress("datapresel",&datapresel);
00192   }
00193   if(chain->GetBranchStatus("snarl_pot")){
00194     chain->SetBranchAddress("snarl_pot",&snarl_pot);
00195   }
00196   if(chain->GetBranchStatus("good_snarl")){
00197     chain->SetBranchAddress("good_snarl",&good_snarl);
00198   }
00199 
00200   //Do not really understand why, but had to comment these out as they were giving seg. fault in /nfs/raid2/ochoa/mcnn/FD/9.6M_19.1M_Daikon-Daikon_PlaneOffsetOnly files, in particular with 21011116 run and with GetEntry(0)
00201   //-->They are not filled anyways !
00202   /*if(chain->GetBranchStatus("nxtalk")){
00203     chain->SetBranchAddress("nxtalk",&nxtalk);
00204   }
00205   if(chain->GetBranchStatus("nxtalk_tagged")){
00206     chain->SetBranchAddress("nxtalk_tagged",&nxtalk_tagged);
00207   }
00208   if(chain->GetBranchStatus("nxtalk_mistagged")){
00209     chain->SetBranchAddress("nxtalk_mistagged",&nxtalk_mistagged);
00210   }
00211   if(chain->GetBranchStatus("nphysics")){
00212     chain->SetBranchAddress("nphysics",&nphysics);
00213   }
00214   */
00215   if(chain->GetBranchStatus("w2")){
00216     chain->SetBranchAddress("w2",&w2);
00217   }
00218   if(chain->GetBranchStatus("totpt")){
00219     chain->SetBranchAddress("totpt",&totpt);
00220   }
00221     
00222   //POT chain
00223   if(usingboth==1 && chain_pot->GetBranchStatus("good_pot")){
00224     chain_pot->SetBranchAddress("good_pot",&good_pot);
00225   }
00226   if(usingboth==1 && chain_pot->GetBranchStatus("total_pot")){
00227     chain_pot->SetBranchAddress("total_pot",&total_pot);
00228   }
00229 
00230   branchesset=true;
00231   
00232 }

void NNReader::SetDefaults (  ) 

Definition at line 235 of file NNReader.cxx.

References action, branchesset, datapresel, emfrac, evt, good_pot, good_snarl, ires, mcpresel, nphysics, npln, nplnu, nplnv, nstp, nue, nuenoosc, nuid, nuidnoosc, nxtalk, nxtalk_mistagged, nxtalk_tagged, qtot, reco_nue, run, snarl, snarl_pot, total_pot, totpt, tptype, tpx, tpy, tpz, tvtxx, tvtxy, tvtxz, vtxu, vtxv, vtxx, vtxy, vtxz, w2, and y.

Referenced by NNReader().

00235                           {
00236 
00237   run=-1;
00238   snarl=-1;
00239   evt=-1;
00240   nuid=-1;
00241   nuidnoosc=-1;
00242   action=-1;
00243   nue=-1;
00244   nuenoosc=-1;
00245   reco_nue=-1;
00246   y=-1;
00247   emfrac=-1;
00248   ires=-1;
00249   qtot=-1;
00250   vtxx=-1;
00251   vtxy=-1;
00252   vtxz=-1;
00253   vtxu=-1;
00254   vtxv=-1;
00255   tvtxx=-1;
00256   tvtxy=-1;
00257   tvtxz=-1;
00258   tptype=-1;
00259   tpx=-1;
00260   tpy=-1;
00261   tpz=-1;
00262   npln=-1;  
00263   nplnu=-1;
00264   nplnv=-1;
00265   nstp=-1;
00266   mcpresel=-1;
00267   datapresel=-1;
00268   nxtalk=-1;
00269   nxtalk_tagged=-1;
00270   nxtalk_mistagged=-1;
00271   nphysics=-1;
00272   w2=-1;
00273   totpt=-1;
00274   
00275   //-->pot
00276   good_pot=-1;
00277   total_pot=-1;
00278   good_snarl=-1;
00279   snarl_pot=-1;
00280 
00281   //-->others
00282   branchesset=false;
00283 
00284 }

void NNReader::SetFracNC ( Float_t  frac_in  ) 

Definition at line 831 of file NNReader.cxx.

References h_frac_nc.

00831                                        {
00832 
00833   h_frac_nc->Reset();
00834   h_frac_nc->Fill(1.,frac_in);
00835   h_frac_nc->Fill(0.,1-frac_in);
00836 
00837 }

void NNReader::SetFracNue ( Float_t  frac_in  ) 

Definition at line 822 of file NNReader.cxx.

References h_frac_nue.

00822                                         {
00823 
00824   h_frac_nue->Reset();
00825   h_frac_nue->Fill(1.,frac_in);
00826   h_frac_nue->Fill(0.,1-frac_in);
00827 
00828 }

void NNReader::SetMaxNumBestMatches ( Int_t  nbm_in  ) 

Definition at line 656 of file NNReader.cxx.

References num_best_matches.

00656                                                {
00657 
00658   num_best_matches=nbm_in;
00659 
00660 }

void NNReader::SetMaxRunNC ( Int_t  run_in  ) 

Definition at line 663 of file NNReader.cxx.

References max_run_nc.

00663                                       {
00664 
00665   max_run_nc=run_in;
00666 
00667 }

void NNReader::SetMaxRunNue ( Int_t  run_in  ) 

Definition at line 670 of file NNReader.cxx.

References max_run_nue.

00670                                        {
00671 
00672   max_run_nue=run_in;
00673 
00674 }


Member Data Documentation

Definition at line 57 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 104 of file NNReader.h.

Definition at line 101 of file NNReader.h.

Definition at line 103 of file NNReader.h.

Definition at line 102 of file NNReader.h.

Definition at line 97 of file NNReader.h.

Definition at line 98 of file NNReader.h.

Definition at line 99 of file NNReader.h.

Definition at line 100 of file NNReader.h.

Definition at line 122 of file NNReader.h.

Referenced by GetBestMatch(), and NNReader().

Bool_t NNReader::branchesset [private]

Definition at line 121 of file NNReader.h.

Referenced by GetEntry(), SetBranches(), and SetDefaults().

Definition at line 107 of file NNReader.h.

Referenced by GetInputCCE(), NNReader(), and SetBranches().

TChain* NNReader::chain [private]

Definition at line 111 of file NNReader.h.

Referenced by Add(), GetEntries(), GetEntry(), NNReader(), Reset(), and SetBranches().

TChain* NNReader::chain_pot [private]

Definition at line 112 of file NNReader.h.

Referenced by Add(), CalculatePOT(), NNReader(), and SetBranches().

Definition at line 108 of file NNReader.h.

Referenced by GetEntry(), and NNReader().

Definition at line 82 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 62 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 91 of file NNReader.h.

Referenced by CalculatePOT(), SetBranches(), and SetDefaults().

Definition at line 93 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

TH1F* NNReader::h_frac_nc [private]

Definition at line 119 of file NNReader.h.

Referenced by GetWeightedfracCCy(), NNReader(), SetFracNC(), and ~NNReader().

TH1F* NNReader::h_frac_nue [private]

Definition at line 118 of file NNReader.h.

Referenced by GetWeightedfracCCy(), NNReader(), SetFracNue(), and ~NNReader().

Definition at line 63 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 19 of file NNReader.h.

Referenced by CalculatePOT(), NNReader(), and SetBranches().

Definition at line 81 of file NNReader.h.

Referenced by MCNNFiller::FillMCNN(), FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 86 of file NNReader.h.

Referenced by FileLumper::SetBranches(), and SetDefaults().

Definition at line 77 of file NNReader.h.

Referenced by PreselModif(), FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 78 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 79 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 80 of file NNReader.h.

Referenced by PreselModif(), FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::nue

Definition at line 58 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 59 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 55 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 56 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 83 of file NNReader.h.

Referenced by FileLumper::SetBranches(), and SetDefaults().

Definition at line 85 of file NNReader.h.

Referenced by FileLumper::SetBranches(), and SetDefaults().

Definition at line 84 of file NNReader.h.

Referenced by FileLumper::SetBranches(), and SetDefaults().

const Float_t NNReader::POT_file_carrot_FD = 2.91*1e20 [static, private]

Definition at line 113 of file NNReader.h.

Referenced by CalculatePOT().

const Float_t NNReader::POT_file_carrot_ND = 1.0024*1e16 [static, private]

Definition at line 115 of file NNReader.h.

Referenced by CalculatePOT().

const Float_t NNReader::POT_file_daikon_FD = 6.5*1e20 [static, private]

Definition at line 114 of file NNReader.h.

Referenced by CalculatePOT().

const Float_t NNReader::POT_file_daikon_ND = 1.936*1e16 [static, private]

Definition at line 116 of file NNReader.h.

Referenced by CalculatePOT().

Float_t NNReader::qtot

Definition at line 60 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 94 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 92 of file NNReader.h.

Referenced by SetBranches(), and SetDefaults().

Float_t NNReader::totpt

Definition at line 88 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 73 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tpx

Definition at line 74 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tpy

Definition at line 75 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tpz

Definition at line 76 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tvtxx

Definition at line 70 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tvtxy

Definition at line 71 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::tvtxz

Definition at line 72 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Int_t NNReader::usingboth [private]

Definition at line 117 of file NNReader.h.

Referenced by Add(), CalculatePOT(), NNReader(), and SetBranches().

Float_t NNReader::vtxu

Definition at line 68 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::vtxv

Definition at line 69 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Float_t NNReader::vtxx
Float_t NNReader::vtxy
Float_t NNReader::vtxz
Float_t NNReader::w2

Definition at line 87 of file NNReader.h.

Referenced by FileLumper::SetBranches(), SetBranches(), and SetDefaults().

Definition at line 120 of file NNReader.h.

Referenced by GetWeightedfracCCy(), and GetWeightedMeanFracQMatched().

Float_t NNReader::y

Definition at line 61 of file NNReader.h.

Referenced by FileLumper::SetBranches(), and SetDefaults().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1