MINFile Class Reference

#include <MINFile.h>

List of all members.

Public Member Functions

 MINFile ()
void init ()
virtual ~MINFile ()
TFile * openREROOTFile ()
TFile * openREROOTFile (const Char_t *filename)
REROOT_GeomreadREROOTGeom (Int_t igeom)
REROOT_EventreadREROOTEvent (Int_t ievent)
Int_t Getngeos ()
Int_t Getnevts ()
Int_t Getigeo ()
Int_t Getievt ()
REROOT_Eventgetrevt ()
REROOT_Geomgetrgeo ()
TFile * gettf ()

Private Attributes

Char_t _iniFile [255]
Char_t _inputFileName [255]
Int_t _nevtot
Long_t _record
TFile * tf
TTree * tgeo
TTree * tevt
TBranch * bg
TBranch * be
REROOT_Geomrgeo
REROOT_Eventrevt
Int_t ngeos
Int_t nevts
Int_t nb
Int_t igeo
Int_t ievt

Detailed Description

Definition at line 29 of file MINFile.h.


Constructor & Destructor Documentation

MINFile::MINFile (  ) 

Definition at line 33 of file MINFile.cxx.

References init().

00033                  :
00034    tf(0)
00035 ,  tgeo(0)
00036 ,  tevt(0)
00037 ,  bg(0)
00038 ,  be(0)
00039 ,  rgeo(0)
00040 ,  revt(0)
00041 ,  ngeos(0)
00042 ,  nevts(0)
00043 ,  nb(0)
00044 ,  igeo(-1)
00045 ,  ievt(-1)
00046 {
00047    init();
00048 }

MINFile::~MINFile (  )  [virtual]

Definition at line 58 of file MINFile.cxx.

References tf.

00059 {
00060    delete tf;
00061 }


Member Function Documentation

Int_t MINFile::Getievt (  )  [inline]

Definition at line 74 of file MINFile.h.

References ievt.

Referenced by MINFast::GetEvent().

00074 {return ievt;}

Int_t MINFile::Getigeo (  )  [inline]

Definition at line 73 of file MINFile.h.

References igeo.

Referenced by MINFast::GetEvent().

00073 {return igeo;}

Int_t MINFile::Getnevts (  )  [inline]

Definition at line 72 of file MINFile.h.

References nevts.

Referenced by IoRerootStreamItr::IsOpenFile(), and IoRerootStreamItr::OpenFile().

00072 {return nevts;}

Int_t MINFile::Getngeos (  )  [inline]

Definition at line 71 of file MINFile.h.

References ngeos.

00071 {return ngeos;}

REROOT_Event* MINFile::getrevt (  )  [inline]

Definition at line 76 of file MINFile.h.

References revt.

00076 {return revt;}

REROOT_Geom* MINFile::getrgeo (  )  [inline]

Definition at line 77 of file MINFile.h.

References rgeo.

00077 {return rgeo;}

TFile* MINFile::gettf (  )  [inline]

Definition at line 78 of file MINFile.h.

References tf.

Referenced by RerootExodus::GetRerootFileName().

00078 {return tf;}

void MINFile::init (  ) 

Definition at line 51 of file MINFile.cxx.

References _nevtot, and _record.

00052 {
00053    _nevtot = 0;
00054    _record = 0;
00055 }

TFile * MINFile::openREROOTFile ( const Char_t *  filename  ) 

Definition at line 120 of file MINFile.cxx.

References be, bg, ievt, igeo, nevts, ngeos, revt, rgeo, tevt, tf, and tgeo.

00121 {
00122 
00123 // Attach reroot file of MINOS data.
00124    TFile *tf1 = TFile::Open(filename,"READ");
00125    if (!tf1) return 0;
00126 
00127    TTree *tevt1 = (TTree *) tf1->Get("GEVT");
00128    if (!tevt1) {
00129      printf("MINFile::openREROOTFile(%s) - GEVT TTree not found.\n",
00130                                                               filename);
00131      return 0;
00132    }
00133 
00134    TTree *tgeo1 = (TTree *) tf1->Get("GEOM");
00135    if (!tgeo1) {
00136      printf("MINFile::openREROOTFile(%s) - GEOM TTree not found.\n",
00137                                                               filename);
00138      return 0;
00139    }
00140 
00141    delete tf;
00142    tf = tf1;
00143 
00144 // Locate REROOT_Event branch of GEVT tree.
00145    tevt = tevt1;
00146    be = tevt->GetBranch("REROOT_Event");
00147    revt = new REROOT_Event;           
00148    be->SetAddress(&revt);
00149    nevts = (Int_t) tevt->GetEntries();
00150    printf("nevts = %d\n",nevts);
00151 
00152 // Locate REROOT_Geom branch of GEOM tree.
00153    tgeo = tgeo1;
00154    bg = tgeo->GetBranch("REROOT_Geom");
00155    rgeo = new REROOT_Geom;
00156    bg->SetAddress(&rgeo);
00157    ngeos = (Int_t) tgeo->GetEntries();
00158    printf("ngeos = %d\n",ngeos);
00159 
00160    igeo = -1;
00161    ievt = -1;
00162 
00163    return(tf);
00164 }

TFile * MINFile::openREROOTFile (  ) 

Definition at line 64 of file MINFile.cxx.

References be, bg, MINFast::Display(), MINFDisplay::GetMINFGUIPanel(), gMINFast, ievt, igeo, nevts, ngeos, revt, rgeo, tevt, tf, and tgeo.

Referenced by MINFast::MINFast(), and MINFast::OpenRerootFile().

00065 {
00066 
00067    const char *filetypes[] = { "ROOT files",    "*.root",
00068                                "ROOT macros",   "*.C",
00069                                "All files",     "*",
00070                                0,               0 };
00071 
00072 // Use file browser to let user choose input filename.
00073    TGFileInfo fi;
00074    fi.fFileTypes = filetypes;
00075    new TGFileDialog(gClient->GetRoot(), (TGWindow *)
00076                  (gMINFast->Display()->GetMINFGUIPanel()),kFDOpen, &fi);
00077    if (!fi.fFilename) return 0;
00078 
00079 // Attach reroot file of MINOS data.
00080    TFile *tf1 = TFile::Open(fi.fFilename,"READ");
00081    if (!tf1) return 0;
00082 
00083    TTree *tevt1 = (TTree *) tf1->Get("GEVT");
00084    if (!tevt1) {
00085      printf("MINFile::openREROOTFile() - GEVT TTree not found.\n");
00086      return 0;
00087    };
00088 
00089    TTree *tgeo1 = (TTree *) tf1->Get("GEOM");
00090    if (!tgeo1) {
00091      printf("MINFile::openREROOTFile() - GEOM TTree not found.\n");
00092      return 0;
00093    };
00094 
00095    delete tf;
00096    tf = tf1;
00097 
00098 // Locate REROOT_Event branch of GEVT tree.
00099    tevt = tevt1;
00100    be = tevt->GetBranch("REROOT_Event");
00101    revt = new REROOT_Event;           
00102    be->SetAddress(&revt);
00103    nevts = (Int_t) tevt->GetEntries();
00104    printf("nevts = %d\n",nevts);
00105 
00106 // Locate REROOT_Geom branch of GEOM tree.
00107    tgeo = tgeo1;
00108    bg = tgeo->GetBranch("REROOT_Geom");
00109    rgeo = new REROOT_Geom;
00110    bg->SetAddress(&rgeo);
00111    ngeos = (Int_t) tgeo->GetEntries();
00112    printf("ngeos = %d\n",ngeos);
00113    igeo = -1;
00114    ievt = -1;
00115 
00116    return(tf);
00117 }

REROOT_Event * MINFile::readREROOTEvent ( Int_t  ievent  ) 

Definition at line 197 of file MINFile.cxx.

References REROOT_Event::Clear(), ievt, nb, nevts, revt, rgeo, REROOT_Event::Set_curevent(), REROOT_Geom::Set_curgeom(), and tevt.

Referenced by MINFast::GetEvent().

00198 {
00199 
00200 // Check that record number exists.
00201    if (ievent < 0 || ievent >= nevts) {
00202      printf("MINFile:  Event record %d requested from nevts = %d\n",
00203                                                          ievent, nevts);
00204      return(revt);
00205    }
00206    
00207 // Zero out static TClonesArrays of previous REROOT_Event.
00208    if (revt) revt->Clear();
00209 
00210 // Get ievent'th event record in REROOT_Event branch.
00211    nb = tevt->GetEntry(ievent);                  // branch number ievent
00212    ievt = ievent;
00213 
00214    REROOT_Event::Set_curevent(revt);
00215    REROOT_Geom::Set_curgeom(rgeo);
00216 
00217    return(revt);
00218 }

REROOT_Geom * MINFile::readREROOTGeom ( Int_t  igeom  ) 

Definition at line 167 of file MINFile.cxx.

References REROOT_Geom::Clear(), REROOT_Geom::FillGlobalZ0Shift(), gREROOT_Geom, igeo, REROOT_Geom::IncrementReads(), nb, ngeos, rgeo, REROOT_Geom::Set_curgeom(), and tgeo.

Referenced by MINFast::GetEvent().

00168 {
00169 
00170 // Check that record number exists.
00171    if (igeom < 0 || igeom >= ngeos) {
00172      printf("MINFile:  Geometry record %d requested from ngeos = %d\n",
00173                                                           igeom, ngeos);
00174      return(rgeo);
00175    }
00176    
00177 // Zero out static TClonesArrays of previous REROOT_Geom.
00178    if (rgeo) rgeo->Clear();
00179 
00180 // Get igeom'th geometry record in REROOT_Geom branch.
00181    nb = tgeo->GetEntry(igeom);                    // branch number igeom
00182    igeo = igeom;
00183 
00184    REROOT_Geom::Set_curgeom(rgeo);
00185 
00186    gREROOT_Geom = rgeo;  // current global geometry
00187    // set global adjustment to z offsets
00188    gREROOT_Geom->FillGlobalZ0Shift();
00189    gREROOT_Geom->IncrementReads();
00190 //rwh:   cout << " gREROOT_Geom read  " << gREROOT_Geom->GetNumberRead() 
00191 //rwh:        << " geometries so far this job " << endl;
00192 
00193    return(rgeo);
00194 }


Member Data Documentation

Char_t MINFile::_iniFile[255] [private]

Definition at line 33 of file MINFile.h.

Char_t MINFile::_inputFileName[255] [private]

Definition at line 34 of file MINFile.h.

Int_t MINFile::_nevtot [private]

Definition at line 35 of file MINFile.h.

Referenced by init().

Long_t MINFile::_record [private]

Definition at line 36 of file MINFile.h.

Referenced by init().

TBranch* MINFile::be [private]

Definition at line 45 of file MINFile.h.

Referenced by openREROOTFile().

TBranch* MINFile::bg [private]

Definition at line 44 of file MINFile.h.

Referenced by openREROOTFile().

Int_t MINFile::ievt [private]

Definition at line 52 of file MINFile.h.

Referenced by Getievt(), openREROOTFile(), and readREROOTEvent().

Int_t MINFile::igeo [private]

Definition at line 51 of file MINFile.h.

Referenced by Getigeo(), openREROOTFile(), and readREROOTGeom().

Int_t MINFile::nb [private]

Definition at line 50 of file MINFile.h.

Referenced by readREROOTEvent(), and readREROOTGeom().

Int_t MINFile::nevts [private]

Definition at line 49 of file MINFile.h.

Referenced by Getnevts(), openREROOTFile(), and readREROOTEvent().

Int_t MINFile::ngeos [private]

Definition at line 48 of file MINFile.h.

Referenced by Getngeos(), openREROOTFile(), and readREROOTGeom().

Definition at line 47 of file MINFile.h.

Referenced by getrevt(), openREROOTFile(), and readREROOTEvent().

Definition at line 46 of file MINFile.h.

Referenced by getrgeo(), openREROOTFile(), readREROOTEvent(), and readREROOTGeom().

TTree* MINFile::tevt [private]

Definition at line 43 of file MINFile.h.

Referenced by openREROOTFile(), and readREROOTEvent().

TFile* MINFile::tf [private]

Definition at line 39 of file MINFile.h.

Referenced by gettf(), openREROOTFile(), and ~MINFile().

TTree* MINFile::tgeo [private]

Definition at line 42 of file MINFile.h.

Referenced by openREROOTFile(), and readREROOTGeom().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1