/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
RidxHandler Class Reference

#include <RidxHandler.h>

List of all members.

Public Member Functions

 RidxHandler (const std::vector< std::string > &ridxs)
virtual ~RidxHandler ()
bool seek (int n)
Int_t fIndex ()
Long64_t eIndex ()
const std::vector< std::string > & rootFiles ()

Private Member Functions

 RidxHandler ()

Private Attributes

Int_t m_fcount
Long64_t m_count
Long64_t m_max
Long64_t * m_offset
TChain * m_chain
std::vector< int > * m_entry
std::vector< std::string > m_roots

Detailed Description

Definition at line 6 of file RidxHandler.h.


Constructor & Destructor Documentation

RidxHandler::RidxHandler ( const std::vector< std::string > &  ridxs)

Definition at line 4 of file RidxHandler.cc.

    : m_fcount(-1),
      m_count(-1),
      m_max(0),
      m_entry(0)
{
    m_chain = new TChain("EvtIdx", "EvtIdx");
    for ( std::vector<std::string>::const_iterator it = ridxs.begin(); it != ridxs.end(); ++it ) {
        m_chain->AddFile(it->c_str());
    }
    std::string*       fname = 0;
    int                nEvt;
    m_chain->SetBranchStatus("entry", 0);
    m_chain->SetBranchAddress("fname", &fname);
    m_chain->SetBranchAddress("nEvt",  &nEvt);

    Long64_t nfiles = m_chain->GetEntries();
    m_offset = new Long64_t[nfiles+1];
    m_offset[0] = 0;

    for ( Long64_t i = 0; i < nfiles; ++i ) {
        m_chain->GetEntry(i);
        m_max += nEvt;
        m_offset[i+1] = m_max;
        m_roots.push_back(*fname);
    }

    m_chain->SetBranchStatus("*",     0);
    m_chain->SetBranchStatus("entry", 1);
    m_chain->SetBranchAddress("entry", &m_entry);
}
RidxHandler::~RidxHandler ( ) [virtual]

Definition at line 36 of file RidxHandler.cc.

{
    delete m_chain->GetCurrentFile();
    delete [] m_offset;
}
RidxHandler::RidxHandler ( ) [private]

Member Function Documentation

bool RidxHandler::seek ( int  n)

Definition at line 42 of file RidxHandler.cc.

{
    m_count = n;
    if ( m_count >= m_max ) return false;

    bool nextfile = false;
    while ( m_count >= m_offset[m_fcount+1] ) {
        ++m_fcount;
        nextfile = true;
    }

    if ( nextfile ) {
        m_chain->GetEntry(m_fcount);
    }

    return true;
}
Int_t RidxHandler::fIndex ( )

Definition at line 60 of file RidxHandler.cc.

{
    return m_fcount;
}
Long64_t RidxHandler::eIndex ( )

Definition at line 65 of file RidxHandler.cc.

{
    return m_entry->at( m_count - m_offset[m_fcount] );
}
const std::vector<std::string>& RidxHandler::rootFiles ( ) [inline]

Definition at line 17 of file RidxHandler.h.

{ return m_roots; }

Member Data Documentation

Int_t RidxHandler::m_fcount [private]

Definition at line 22 of file RidxHandler.h.

Long64_t RidxHandler::m_count [private]

Definition at line 23 of file RidxHandler.h.

Long64_t RidxHandler::m_max [private]

Definition at line 24 of file RidxHandler.h.

Long64_t* RidxHandler::m_offset [private]

Definition at line 25 of file RidxHandler.h.

TChain* RidxHandler::m_chain [private]

Definition at line 27 of file RidxHandler.h.

std::vector<int>* RidxHandler::m_entry [private]

Definition at line 28 of file RidxHandler.h.

std::vector<std::string> RidxHandler::m_roots [private]

Definition at line 29 of file RidxHandler.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:51:07 for ReconInputSvc by doxygen 1.7.4