DataBlock.cxx File Reference

#include <cmath>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <sstream>
#include "TFile.h"
#include "PhysicsNtuple/Record.h"
#include "PhysicsNtuple/DataBlock.h"

Go to the source code of this file.

Functions

ostream & operator<< (ostream &o, const DataBlock &self)
const DataBlock FindDataBlock (const std::string &path, const std::string &name)

Function Documentation

const DataBlock FindDataBlock ( const std::string &  path,
const std::string &  name 
)

Definition at line 148 of file DataBlock.cxx.

00149 {
00150    TFile *file_ptr = new TFile(path.c_str(), "READ");
00151    if(!file_ptr || !file_ptr -> IsOpen())
00152    {
00153       cerr << "Failed to open root file " << path << endl;
00154       return DataBlock();
00155    }
00156    
00157    DataBlock *block_ptr = dynamic_cast<DataBlock *>(file_ptr -> Get(name.c_str()));
00158    if(!block_ptr)
00159    {
00160       cout << "Failed to find DataBlock" << endl;
00161       return DataBlock();
00162    }
00163 
00164    const DataBlock block = *block_ptr;
00165 
00166    file_ptr -> Close();
00167    
00168    return block;
00169 }

ostream& operator<< ( ostream &  o,
const DataBlock self 
)

Definition at line 141 of file DataBlock.cxx.

00142 {
00143    self.print(o);
00144    return o;
00145 }


Generated on 24 Apr 2018 for loon by  doxygen 1.6.1