More information on this package is here.
//Begin_Html <!--
/* -->
<h1>TVirtualReader</h1>
<p>
TVirtualReader is the underlying class from which all reader implementations
in ClasTool must inherit.
Many of the methods of this class are dummies that must be overridden by the
real function of the reader class that inherits from TVirtualReader.
</p><p>
Some functions will be implemented in this class rather than in TClasTool if they
are "closer to the data", in other words, these functions would be useful for
different readers (general enough) yet are specific enough that some DST formats
would need an alternate implementation.
</p><p>
Note that to be useful, each method that is relevant for physics analysis (i.e. all
the public methods) must have a call implementation in TClasTool. Otherwise calls to
that method must be done on the pointer to the reader, which is highly in elegant.
That is the "price we pay" for a design that allows different readers using a pointer
to the reader instead of inheriting from the reader.
</p>
<pre>
<!-- */
// --> End_Html
#include "TVirtualReader.h"
Int_t TVirtualReader::fgInstanceCount =0;
ClassImp(TVirtualReader)
TVirtualReader::TVirtualReader(){
fThisInstance= ++fgInstanceCount;
}
TVirtualReader::~TVirtualReader(){
fgInstanceCount--;
if(fgInstanceCount==0){
}
}
Int_t TVirtualReader::Add(const Char_t *filename){
cout << "TVirtualReader::Addfile(filename) is not implemented in this class: " << GetReaderType() << endl;
return 0;
}
Int_t TVirtualReader::AddFile(const Char_t *filename,Int_t nentries){
cout << "TVirtualReader::Addfile(filename) is not implemented in this class: " << GetReaderType() << endl;
return -1;
}
Int_t TVirtualReader::AddEPICFile(const Char_t *filename, Int_t nentries){
cout << "TVirtualReader::AddEPICFile(filename) is not implemented in this class: " << GetReaderType() << endl;
return -1;
}
Int_t TVirtualReader::Next(){
cout << "TVirtualReader::Next() is not implemented in this class: " << GetReaderType() << endl;
return 0;
}
Int_t TVirtualReader::GetNFiles(){
cout << "TVirtualReader::GetNFiles() is not implemented in this class: " << GetReaderType() << endl;
return 0;
}
void TVirtualReader::Reset(){
cout << "TVirtualReader::Reset() is not implemented in this class: " << GetReaderType() << endl;
}
Int_t TVirtualReader::ReadEvent(Int_t event,Int_t runnum){
Int_t current_event = GetEventNumber();
Int_t current_run = GetRunNumber();
if(runnum != 0){
if(runnum < current_run ){
GetEntry(1);
current_run = GetRunNumber();
if(runnum < current_run) return(0);
}
while(runnum > current_run){
Next();
current_run = GetRunNumber();
}
}else{
runnum = current_run;
}
while(event < current_event && runnum >= current_run ){
fCurrentEvent = fCurrentEvent - 1000;
if(current_event>0){
GetEntry(fCurrentEvent);
current_event = GetEventNumber();
current_run = GetRunNumber();
}else {
GetEntry(0);
current_event = GetEventNumber();
current_run = GetRunNumber();
if(event<current_event || runnum<current_run)return(0);
}
}
return(0);
}
Int_t TVirtualReader::GetEntry(Int_t entry,Int_t getall){
cout << "TVirtualReader::GetEntry() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
GetEntries_return_t TVirtualReader::GetEntries() const{
cout << "TVirtualReader::GetEntries() is not implemented in this class. " << endl;
return((GetEntries_return_t)-999.);
}
GetEntries_return_t TVirtualReader::GetEntriesFast() const {
cout << "TVirtualReader::GetEntriesFast() is not implemented in this class: " << endl;
return((GetEntries_return_t)-999.);
}
Float_t TVirtualReader::GetEPICValue(const Char_t *fName){
cout << "TVirtualReader::GetEPICValue(const Char_t* fName) is not implemented in this class: " << endl;
return (0.);
}
void TVirtualReader::Browse(TBrowser *B){
cout << "TVirtualReader::Browse() is not implemented in this class: " << GetReaderType() << endl;
return;
}
Int_t TVirtualReader::Draw(const char *varexp, const char *selection, Option_t *option
,Int_t nentries, Int_t firstentry){
cout << "TVirtualReader::Draw() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
TObjArray *TVirtualReader::GetFiles(void){
cout << "TVirtualReader::GetFiles() is not implemented in this class: " << GetReaderType() << endl;
return(NULL);
}
Int_t TVirtualReader::GetNtrees(void){
cout << "TVirtualReader::GetNtrees() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
Int_t TVirtualReader::GetTreeNumber(void){
cout << "TVirtualReader::GetTreeNum() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
Bool_t TVirtualReader::Notify(){
if(GetNotify()){
return(GetNotify()->Notify());
}else{
cout << "TVirtualReader::Notify() did nothing for class: " << GetReaderType() << endl;
return(kFALSE);
}
}
void TVirtualReader::SetNotify(TObject *obj){
cout << "Cannot set notify in TVirtualReader class: " << GetReaderType()<< endl;
}
Int_t TVirtualReader::GetNPart(){
return GetNRows("EVNT");
}
TVector3 TVirtualReader::GetPart3Vector(Int_t indx){
TVector3 v3vec(0,0,0);
cout << "TVirtualReader::GetPart3Vector() is not implemented in this class: " << GetReaderType() << endl;
return v3vec;
}
TVector3 TVirtualReader::GetPartVertex(Int_t indx){
TVector3 v3vec(0,0,0);
cout << "TVirtualReader::GetPartVertex() is not implemented in this class: " << GetReaderType() << endl;
return v3vec;
}
Int_t TVirtualReader::GetPartID(Int_t indx){
cout << "TVirtualReader::GetPartID() is not implemented in this class: " << GetReaderType() << endl;
return(-9999);
}
Int_t TVirtualReader::GetPartCharge(Int_t indx){
cout << "TVirtualReader::GetPartID() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
TString TVirtualReader::GetReaderType(){
TString rtype("VIRTUAL");
return rtype;
}
TEPICClass *TVirtualReader::GetEPICClass(){
cout <<"GetEPICClass() not implemented in this class " << GetReaderType() << endl;
return NULL;
}
THEADERClass *TVirtualReader::GetHEADER(){
cout << "TVirtualReader::GetHead() is not implemented in this class: " << GetReaderType() << endl;
return NULL;
}
Int_t TVirtualReader::GetHelicity(){
Int_t helicity = 0;
cout << "TVirtualReader::GetHelicity() is not implemented in this class: " << GetReaderType() << endl;
return helicity;
}
TChain *TVirtualReader::GetTree(char *treename){
return NULL;
}
void TVirtualReader::Print(Int_t full){
cout << "TVirtualReader::Print() is not implemented correctly in this class: " << GetReaderType() << endl;
}
void TVirtualReader::PrintEventStatus(){
cout << "TVirtualReader::PrintEventStatus() is not implemented in this class: " << GetReaderType() << endl;
}
void TVirtualReader::PrintEPICPosition(){
cout << "TVirtualReader::PrintEPICPosition() notimplemented in this class: " << GetReaderType() << endl;
}
Int_t TVirtualReader::GetNRows(const Char_t *bankname){
cout << "TVirtualReader::GetNRows() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
TObject *TVirtualReader::GetBankRow(const Char_t *bankname,Int_t nrow){
cout << "TVirtualReader::GetBankRow() is not implemented in this class: " << GetReaderType() << endl;
return NULL;
}
Int_t TVirtualReader::GetEventNumber(){
cout << "TVirtualReader::GetEventNumber() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
Int_t TVirtualReader::GetRunNumber(){
cout << "TVirtualReader::GetEventNumber() is not implemented in this class: " << GetReaderType() << endl;
return(0);
}
Int_t TVirtualReader::GetCurrentEvent(){
cout << "TVirtualReader::GetEventNumber() is not implemented in this class: " << GetReaderType() << endl;
return(-999);
}
Author: Maurik Holtrop
Last update: VirtualReader/TVirtualReader:$Name: $:$Id: TVirtualReader.cc,v 1.12 2007/03/01 22:27:00 holtrop Exp $
CopyLeft - This code is freely available.
ROOT Home page - ClasTool Class index - Class Hierarchy - Top of the page