//*-- Author :    Damir Buskulic   11/07/00

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// VConditionSet                                                        //
//                                                                      //
// Class for managing sets of conditions, i.e. conditions               //
// that may have overlap(s) in time.                                    //
// A condition set is used as a selection and a pointer to a particular //
// point in time where the selection expression is verified.            //
// It is used in sequential access of frames or vectors satisfying some //
// conditions. Suppose for example that one wants to access all the     //
// frames that have triggered the condition "Trig3.amplitude>3", where  //
// Trig3 is a condition (or trigger) defined in the frames.             //
// If vd is a pointer to a valid info database containing               //
// the information, one would do :                                      //
//                                                                      //
// vega[] co = new VConditionSet(vd,"Trig3.amp>3")                      //
// vega[] fr = frchannel->GetNextFrame(co)                              //
//                                                                      //
// that would return him the first frame satisfying the condition.      //
// Issueing fr = frchannel->GetNextFrame(co) repeatedly will return     //
// sequentialy all the frames that satisfy the condition.               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "VConditionSet.h"

ClassImp(VConditionSet)

//______________________________________________________________________________
VConditionSet::VConditionSet()
{
//   Condition set default constructor
   Int_t i;
   mInfoDB = 0;
   mCondFormulaString = "";
   mSelFormulaString  = "";
   mCurConditions = new TObjArray();
   mActiveConditions = new TArrayC(10);
   mSelectionConditions = new TArrayC(10);
   mCurConditionStart = new TArrayD(10);
   mCurConditionEnd = new TArrayD(10);
   mFolConditionStart = new TArrayD(10);
   for ( i=0;i<10;i++) {
      (*mActiveConditions)[i]=0;
      (*mSelectionConditions)[i]=0;
      (*mCurConditionStart)[i]=0;
      (*mCurConditionEnd)[i]=0;
      (*mFolConditionStart)[i]=0;
   }
   mCondFormula = 0;
   mSelFormula  = 0;
}

//______________________________________________________________________________
VConditionSet::VConditionSet(VVirtualFrameInfoDB* infodb, const char* condfs, const char* selfs)
{
//   Condition set constructor
//   "infodb" is the parent infodatabase
//   "condf"  is a condition expression used to determine the active conditions
//   "selfs"  is a selection expression. Used in case one wants to follow a set
//            of conditions, given another set is present.
   
   Build(infodb, condfs, selfs);
}

//______________________________________________________________________________
VConditionSet::VConditionSet(VVirtualFrameChannel* fc, const char* condfs, const char* selfs)
{
//   Condition set constructor
//   "fc"     is the frame channel containing the parent infodatabase
//   "condf"  is a condition expression used to determine the active conditions
//   "selfs"  is a selection expression. Used in case one wants to follow a set
//            of conditions, given another set is present.
   
   Build(fc->GetFrameInfoDB(), condfs, selfs);
}

//______________________________________________________________________________
 void VConditionSet::Build(VVirtualFrameInfoDB* infodb, const char* condfs, const char* selfs)
{
//   Condition set building method. Used by the constructors
//   "infodb" is the parent infodatabase
//   "condf"  is a condition expression used to determine the active conditions
//   "selfs"  is a selection expression. Used in case one wants to follow a set
//            of conditions, given another set is present.
   
   Int_t i, nselcond;
   
   mInfoDB = infodb;
   Int_t maxconditions = mInfoDB->GetConditionNames()->GetNCNames();
   if (!maxconditions) maxconditions = 10;
   mCurConditions = new TObjArray(maxconditions);
   mActiveConditions = new TArrayC(maxconditions);
   mSelectionConditions = new TArrayC(maxconditions);
   mCurConditionStart = new TArrayD(maxconditions);
   mCurConditionEnd = new TArrayD(maxconditions);
   mFolConditionStart = new TArrayD(maxconditions);
   for ( i=0;i<maxconditions;i++) {
      (*mActiveConditions)[i]=0;
      (*mSelectionConditions)[i]=0;
      (*mCurConditionStart)[i]=0;
      (*mCurConditionEnd)[i]=0;
      (*mFolConditionStart)[i]=0;
   }
   if (condfs) mCondFormulaString = condfs;
   if (selfs)  mSelFormulaString  = selfs;
   mCondFormula = 0;
   mSelFormula  = 0;
}

//______________________________________________________________________________
VConditionSet::~VConditionSet()
{
//   Condition set default destructor
   mCurConditions->Delete();
   delete mCurConditions;
   delete mActiveConditions;
   delete mSelectionConditions;
   delete mCurConditionStart;
   delete mFolConditionStart;
   if (mCondFormula) delete mCondFormula;
   if (mSelFormula) delete mSelFormula;
}

//______________________________________________________________________________
 Int_t VConditionSet::NearestGESet(Double_t time)
{
//  Jumps to the condition set that contains time "time" or the nearest
//  next one. Loads the relevant conditions as current.
//  returns 0 = error, 1 = OK
   
   printf("Warning : VConditionSet::NearestGESet must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Int_t VConditionSet::NearestGEFormSet(Double_t time)
{
//  Jumps to the condition set that contains time "time" and satisfies recorded
// formula or the nearest next one. Loads the relevant conditions as current.
//  returns 0 = error, 1 = OK
   
   printf("Warning : VConditionSet::NearestGEFormSet must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Int_t VConditionSet::NextSet()
{
//  Jumps to the next condition set in time (with respect to current)
//  if a selection is present, will also require that the next set
//  intersects with the conditions forming the selection.
//  WARNING : if a selection is used, it may happen to return twice the same
//  set for two consecutive calls to NextSet(), in case more than one
//  selection is intersecting with that set.
//  returns 0 = error, 1 = OK
   
   printf("Warning : VConditionSet::NextSet must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Int_t VConditionSet::NextFormSet()
{
//  Jumps to the next condition set in time (with respect to current)
//  that verifies the condition formula if present.
//  if a selection is present, will also require that the set
//  intersects with the conditions forming the selection.
//  WARNING : if a selection is used, it may happen to return twice the same
//  set for two consecutive calls to NextSet(), in case more than one
//  selection is intersecting with that set.
//  returns 0 = error, 1 = OK

   printf("Warning : VConditionSet::NextFormSet must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetIntersectionStart()
{
//  Returns the start time of the overlap of this set of conditions
   
   printf("Warning : VConditionSet::GetIntersectionStart must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetIntersectionEnd()
{
//  Returns the end time of the overlap of this set of conditions
   
   printf("Warning : VConditionSet::GetIntersectionEnd( must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetIntersectSelectStart()
{
//  Returns the start time of the overlap of this set of conditions
// including the conditions used for selection
   
   printf("Warning : VConditionSet::GetIntersectSelectStart must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetIntersectSelectEnd()
{
//  Returns the end time of the overlap of this set of conditions
// including the conditions used for selection
   
   printf("Warning : VConditionSet::GetIntersectSelectEnd must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetLastConditionResult()
{
// Returns the result of the condition formula applied to the last condition set
   
   printf("Warning : VConditionSet::GetLastConditionResult must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::GetLastSelectionResult()
{
// Returns the result of the selection formula applied to the last condition set

   printf("Warning : VConditionSet::GetLastSelectionResult must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 Double_t VConditionSet::Eval(const char* formula)
{
// Evaluates the formula for the current condition set.
// Useful in case of interactive use.
   
   printf("Warning : VConditionSet::Eval must be overriddenn");
   return 0;
}

//______________________________________________________________________________
 void VConditionSet::SetActive(Int_t conditionnumber)
{
// Sets the condition "conditionnumber" as active
   
   VFrCondition* condition;
   
   (*mActiveConditions)[conditionnumber] = 1;
// If not present, build new condition objects for active conditions
   if ( !(mCurConditions->At(conditionnumber))) {
      condition = new VFrCondition();
      mCurConditions->AddAt(condition,conditionnumber);
   }
   return;
}

//______________________________________________________________________________
 void VConditionSet::SetSelection(Int_t conditionnumber)
{
// Sets the condition "conditionnumber" as used for selection
   
   printf("Warning : VConditionSet::SetSelection must be overriddenn");
   return;
}


- 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.