FileLumper Class Reference

#include <FileLumper.h>

List of all members.

Public Member Functions

 FileLumper ()
 FileLumper (const char *path_to_unmerged, const char *filename, Int_t pieces_in)
 ~FileLumper ()

Private Member Functions

void SetBranches ()

Private Attributes

TTree * OutputTree
TFile * OutputFile
NNReadernread
Int_t tot_entries
MinosCompactEventcce
MinosAnalysisResultmar

Detailed Description

Definition at line 21 of file FileLumper.h.


Constructor & Destructor Documentation

FileLumper::FileLumper (  ) 

Definition at line 21 of file FileLumper.cxx.

References cce, mar, nread, OutputFile, and OutputTree.

00021                       {
00022   
00023   OutputFile = new TFile();
00024   OutputTree = new TTree("nn","Minos NuE Analysis Results");
00025   nread = new NNReader("nn",true);
00026 
00027   cce = new MinosCompactEvent();
00028 
00029   mar = new MinosAnalysisResult();
00030   
00031 }

FileLumper::FileLumper ( const char *  path_to_unmerged,
const char *  filename,
Int_t  pieces_in 
)

Definition at line 33 of file FileLumper.cxx.

References NNReader::Add(), cce, NNReader::GetEntries(), NNReader::GetEntry(), NNReader::GetInputCCE(), NNReader::GetMinosAnalysisResult(), gSystem(), mar, nread, OutputFile, OutputTree, SetBranches(), srCtr, and tot_entries.

00033                                                                                          {
00034 
00035   cce = new MinosCompactEvent();
00036   mar = new MinosAnalysisResult();
00037   
00038   Bool_t catastrophe=false;
00039   nread = new NNReader("nn",true);
00040 
00041   //-->Putting input files in chain
00042   for(int ii=0;ii<pieces_in;++ii){
00043     
00044     //make file name
00045     ostringstream line;
00046     line << path_to_unmerged << "/mc*nn_" << ii << "_" << filename;
00047     string linestr = line.str();
00048     //NOTE: did mc*nn instead of mcnn just to add a wildcard in there. For some reason in 
00049     // root 05-16-00 TChain:Add always returns 1 if file is completely specified without
00050     // wildcards, even if file name is bogus
00051     
00052     //Adding to chain
00053     Int_t filenum = nread->Add(linestr.c_str());
00054     cout << "Adding " << linestr.c_str() << endl;
00055     if(filenum!=1){
00056       cout << "WARNING: Could not add " << linestr.c_str() << endl;
00057       cout << "-->Aborting; Will not write lumped file." << endl;
00058       catastrophe=true;
00059       break;
00060     }   
00061   }
00062 
00063   tot_entries=nread->GetEntries();
00064   cout << "Have " << tot_entries << " in big nread chain" << endl;
00065   
00066   if(catastrophe==false){
00067 
00068     ostringstream fileoutput;
00069     // hardcoding $MCNNTMP as a hack
00070     fileoutput << "$MCNNTMP/mcnn_" << filename;
00071     string fileoutputstr = gSystem->ExpandPathName((fileoutput.str()).c_str());
00072 
00073     OutputFile = new TFile(fileoutputstr.c_str(),"recreate");
00074     OutputTree = new TTree("nn","Minos NuE Analysis Results");
00075     OutputTree->SetDirectory(OutputFile);   
00076     
00077     SetBranches();
00078     
00079     //Saving to output tree
00080     Int_t srCtr=0;
00081     while(nread->GetEntry(srCtr)){
00082       ++srCtr;
00083             
00084       cce = nread->GetInputCCE();
00085       mar = nread->GetMinosAnalysisResult();
00086       
00087       OutputTree->Fill();
00088       
00089     }
00090     
00091     OutputTree->Write();
00092     OutputFile->Close();
00093 
00094   }//only writing file if all input files were present
00095   
00096 }

FileLumper::~FileLumper (  ) 

Definition at line 98 of file FileLumper.cxx.

References cce, mar, nread, and OutputFile.

00098                        {
00099 
00100   delete OutputFile;
00101   delete nread;
00102   delete cce;
00103   delete mar;
00104 
00105 }


Member Function Documentation

void FileLumper::SetBranches (  )  [private]

Definition at line 108 of file FileLumper.cxx.

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

Referenced by FileLumper().

00108                             {
00109   
00110   OutputTree->Branch("cce","MinosCompactEvent",&cce);
00111   OutputTree->Branch("comparisonResults", "MinosAnalysisResult", &mar);
00112   OutputTree->Branch("run", &nread->run, "run/I");
00113   OutputTree->Branch("snarl", &nread->snarl, "snarl/I");
00114   OutputTree->Branch("evt", &nread->evt, "evt/I");
00115   OutputTree->Branch("nuid", &nread->nuid, "nuid/I");
00116   OutputTree->Branch("nuidnoosc",&nread->nuidnoosc,"nuidnoosc/I");
00117   OutputTree->Branch("action", &nread->action, "action/I");
00118   OutputTree->Branch("nue", &nread->nue, "nue/F");
00119   OutputTree->Branch("nuenoosc",&nread->nuenoosc,"nuenoosc/F");
00120   OutputTree->Branch("reco_nue",&nread->reco_nue,"reco_nue/F");
00121   OutputTree->Branch("y", &nread->y, "y/F");
00122   OutputTree->Branch("emfrac", &nread->emfrac, "emfrac/F");
00123   OutputTree->Branch("ires",&nread->ires,"ires/I");
00124   OutputTree->Branch("qtot", &nread->qtot, "qtot/F");
00125   OutputTree->Branch("vtxx", &nread->vtxx, "vtxx/F");
00126   OutputTree->Branch("vtxy", &nread->vtxy, "vtxy/F");
00127   OutputTree->Branch("vtxz", &nread->vtxz, "vtxz/F");
00128   OutputTree->Branch("vtxu", &nread->vtxu, "vtxu/F");
00129   OutputTree->Branch("vtxv", &nread->vtxv, "vtxv/F");
00130   OutputTree->Branch("tvtxx", &nread->tvtxx, "tvtxx/F");
00131   OutputTree->Branch("tvtxy", &nread->tvtxy, "tvtxy/F");
00132   OutputTree->Branch("tvtxz", &nread->tvtxz, "tvtxz/F");
00133   OutputTree->Branch("tptype",&nread->tptype,"tptype/I");
00134   OutputTree->Branch("tpx",&nread->tpx,"tpx/F");
00135   OutputTree->Branch("tpy",&nread->tpy,"tpy/F");
00136   OutputTree->Branch("tpz",&nread->tpz,"tpz/F");
00137   OutputTree->Branch("npln", &nread->npln, "npln/I");
00138   OutputTree->Branch("nstp", &nread->nstp, "nstp/I");
00139   OutputTree->Branch("nplnu", &nread->nplnu, "nplnu/I");
00140   OutputTree->Branch("nplnv", &nread->nplnv, "nplnv/I");          
00141   OutputTree->Branch("mcpresel",&nread->mcpresel,"mcpresel/I");
00142   OutputTree->Branch("datapresel",&nread->datapresel,"datapresel/I");
00143   OutputTree->Branch("nxtalk",&nread->nxtalk,"nxtalk/I");
00144   OutputTree->Branch("nxtalk_tagged",&nread->nxtalk_tagged,"nxtalk_tagged/I");
00145   OutputTree->Branch("nxtalk_mistagged",&nread->nxtalk_mistagged,"nxtalk_mistagged/I"); 
00146   OutputTree->Branch("nphysics",&nread->nphysics,"nphysics/I");
00147   OutputTree->Branch("w2",&nread->w2,"w2/F");
00148   OutputTree->Branch("totpt",&nread->totpt,"totpt/F");
00149   OutputTree->Branch("snarl_pot",&nread->snarl_pot,"snarl_pot/F");
00150   OutputTree->Branch("good_snarl",&nread->good_snarl,"good_snarl/I");
00151   OutputTree->SetDirectory(OutputFile);
00152 
00153 }


Member Data Documentation

Definition at line 35 of file FileLumper.h.

Referenced by FileLumper(), SetBranches(), and ~FileLumper().

Definition at line 36 of file FileLumper.h.

Referenced by FileLumper(), SetBranches(), and ~FileLumper().

Definition at line 33 of file FileLumper.h.

Referenced by FileLumper(), SetBranches(), and ~FileLumper().

TFile* FileLumper::OutputFile [private]

Definition at line 31 of file FileLumper.h.

Referenced by FileLumper(), SetBranches(), and ~FileLumper().

TTree* FileLumper::OutputTree [private]

Definition at line 30 of file FileLumper.h.

Referenced by FileLumper(), and SetBranches().

Int_t FileLumper::tot_entries [private]

Definition at line 34 of file FileLumper.h.

Referenced by FileLumper().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1