// Original Author: Rene Brun 05/02/97// Modified for use in VEGA by D. Buskulic 21/03/03////////////////////////////////////////////////////////////////////////////// //// A VSelector object is used by the VFrameChannel::Process to navigate //// in a VFrameChannel and make selections. //// //// The following members functions are called by the VFrameChannel //// functions. //// Init: Attach a new VFrameChannel during the loop //// Begin: called everytime a loop on the channel starts. //// a convenient place to create your histograms / plots. //// //// ProcessCut: called at the beginning of each entry to return a flag //// true if the entry must be analyzed. //// ProcessFill: called in the entry loop for all entries accepted //// by Select. //// Terminate: called at the end of a loop in a VFrameChannel. //// a convenient place to draw/fit your histograms. //// //////////////////////////////////////////////////////////////////////////////
#include "TROOT.h"
#include "TSystem.h"
#include "TError.h"
#include "VSelectorCint.h"
#include "Api.h"
ClassImp(VSelector)
//______________________________________________________________________________VSelector::VSelector() : TObject()
{
// Default selector ctor.mStatus = 0;
mObject = 0;
// mInput = 0;// mOutput = new THashList;// mOutput->SetOwner();
}
//______________________________________________________________________________VSelector::~VSelector()
{
// Selector destructor.// delete mOutput;
}
//______________________________________________________________________________VSelector *VSelector::GetSelector(const char *filename)
{
// The code in filename is loaded (interpreted or compiled , see below)// filename must contain a valid class implementation derived from VSelector.// where VSelector has the following member functions://// voidVSelector::Begin(): called everytime a loop on the frame channel starts,// a convenient place to create your histograms.// Bool_tVSelector::ProcessCut(): called at the beginning of each frame processing to return a flag,// true if the entry must be analyzed.// voidVSelector::ProcessFrame(): called in the frame loop for all frames accepted// by ProcessCut.// voidVSelector::ProcessVect(): called in the loop for specific vectors requested// voidVSelector::Terminate(): called at the end of a loop on the frame channel,// a convenient place to draw/fit your histograms.//// if filename is of the form file.C, the file will be interpreted.// if filename is of the form file.C++, the file file.C will be compiled// and dynamically loaded. The corresponding binary file and shared library// will be deleted at the end of the function.// if filename is of the form file.C+, the file file.C will be compiled// and dynamically loaded. At next call, if file.C is older than file.o// and file.so, the file.C is not compiled, only file.so is loaded.//// The static function returns a pointer to a VSelector object //Interpret/compile filename via CINTchar localname[256];
int olddispmsg = G__dispmsg;
G__dispmsg = 0;
sprintf(localname,".L %s",filename);
gROOT->ProcessLine(localname);
G__dispmsg = olddispmsg;
//loop on all classes known to CINT to find the class on filename //that derives from VSelector
const char *basename = gSystem->BaseName(filename);
if (basename==0) {
::Error("VSelector::GetSelector","Unable to determine the classname for file %s",filename);
return 0;
}
strcpy(localname,basename);
char *IsCompiled = strchr(localname,'+');
char *dot = strchr(localname,'.');
if (dot) dot[0] = 0;
G__ClassInfo cl;
Bool_t OK = kFALSE;
while (cl.Next()) {
if (strcmp(cl.Name(),localname)) continue;
if (cl.IsBase("VSelector")) OK = kTRUE;
break;
}
if (!OK) {
::Error("VSelector::GetSelector","file %s does not have a valid class deriving from VSelector",filename);
return 0;
}
// we can now create an instance of the classVSelector *selector = (VSelector*)cl.New();
if (!selector || IsCompiled) return selector;
//interpreted selector: cannot be used as such //create a fake selectorVSelectorCint *select = new VSelectorCint();
select->Build(selector,&cl);
return select;
}
- ROOT page - VEGA page - Class index - Top of the page This page has been automatically generated. If you have any comments or suggestions
about the page layout send a mail to
, or
contact
with any questions or problems regarding ROOT or VEGA.