/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
RidxSkimmer Class Reference

#include <RidxSkimmer.h>

Inheritance diagram for RidxSkimmer:
Inheritance graph
[legend]
Collaboration diagram for RidxSkimmer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RidxSkimmer (const std::string &name)
virtual ~RidxSkimmer ()
virtual bool write (PhyEvent *evt)
const std::string & name ()

Private Member Functions

void fill ()

Private Attributes

ReconInputSvcm_svc
TFile * m_file
TTree * m_tree
int m_fNum
std::string * m_fName
int m_nEvt
std::vector< int > * m_idx

Detailed Description

Definition at line 11 of file RidxSkimmer.h.


Constructor & Destructor Documentation

RidxSkimmer::RidxSkimmer ( const std::string &  name)

Definition at line 9 of file RidxSkimmer.cc.

    : ISkimmer(name),
      m_file(0),
      m_tree(0),
      m_fNum(-1),
      m_fName(0),
      m_idx(0)
{
    std::string fname;
    OptionParser::setOption(this->name(), "OutputFile", fname);
    if ( fname.empty() ) {
        throw LafException(this->name() + ".OutputFile is not set properly!");
    }

    const char* preDir = gDirectory->GetPath();
    m_file = new TFile(fname.c_str(), "RECREATE");
    m_tree = new TTree("EvtIdx", "index of filtered events");
    m_tree->Branch("fname", &m_fName);
    m_tree->Branch("nEvt",  &m_nEvt);
    m_tree->Branch("entry", &m_idx);
    gDirectory->cd(preDir);

    m_svc = SvcMgr::get<ReconInputSvc>("InputSvc");
    if ( m_svc == 0 ) {
        throw LafException(this->name() + ": Failed to get ReconInputSvc!");
    }
}
RidxSkimmer::~RidxSkimmer ( ) [virtual]

Definition at line 37 of file RidxSkimmer.cc.

{
    fill();
    m_file->Write();
    delete m_file;
}

Member Function Documentation

bool RidxSkimmer::write ( PhyEvent evt) [virtual]

Implements ISkimmer.

Definition at line 44 of file RidxSkimmer.cc.

{
    if ( evt->m_fileNum != m_fNum ) {
        fill();
        m_fNum = evt->m_fileNum;
        *m_fName = m_svc->fname(m_fNum);
        m_idx->clear();
    }

    //LogDebug << *m_fName << ": " << evt->m_localEntry << std::endl;
    m_idx->push_back(evt->m_localEntry);

    return true;
}
void RidxSkimmer::fill ( ) [private]

Definition at line 59 of file RidxSkimmer.cc.

{
    if ( m_fNum >= 0 ) {
        m_nEvt = m_idx->size();
        m_tree->Fill();
    }
}
const std::string& ISkimmer::name ( void  ) [inline, inherited]

Definition at line 17 of file ISkimmer.h.

{ return m_name; }

Member Data Documentation

Definition at line 24 of file RidxSkimmer.h.

TFile* RidxSkimmer::m_file [private]

Definition at line 26 of file RidxSkimmer.h.

TTree* RidxSkimmer::m_tree [private]

Definition at line 27 of file RidxSkimmer.h.

int RidxSkimmer::m_fNum [private]

Definition at line 28 of file RidxSkimmer.h.

std::string* RidxSkimmer::m_fName [private]

Definition at line 29 of file RidxSkimmer.h.

int RidxSkimmer::m_nEvt [private]

Definition at line 30 of file RidxSkimmer.h.

std::vector<int>* RidxSkimmer::m_idx [private]

Definition at line 31 of file RidxSkimmer.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:14 for EvtFilterSvc by doxygen 1.7.4