-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVM_BaseClass.hpp
More file actions
71 lines (60 loc) · 2.23 KB
/
VM_BaseClass.hpp
File metadata and controls
71 lines (60 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/************************************************************************
VM_BaseClass
All classes created specific for this package will inherit from VM_BaseClass.
This means that all the classes will inherit from TNamed and TObject.
This allows us to use the ROOT I/O methods and also use the ROOT containers
which handle TObject addresses.
For example:
The VM_BaseClass_Stack consists of a TList which is a doubly linked list of TObjects. Since VM_BaseClass inherits from TObject we can then add BaseClass object(i.e. any class in the ResoNeut package) to this TList. This stack then contains methods which mirror those of the class it contains (BaseClasses) that way, when you execute the particular method, it will execute all of the analagous methods in the stack.
Author: Nabin Rijal, 2015
***************************************************************************/
#ifndef __VMBASECLASS_H
#define __VMBASECLASS_H
//C and C++ libraries.
#include <iostream>
#include <vector>
//ROOT libraties
#include <TString.h>
#include <TObject.h>
#include <TNamed.h>
#include <TList.h>
#include <TTree.h>
class VM_BaseClass:public TNamed{
protected:
public:
using TObject::Execute;
using TNamed::Print;
VM_BaseClass(){}
VM_BaseClass(const TString&name, const TString&title="",const unsigned int& id=0);
virtual void Bind(){};
virtual void Execute(){};
virtual void Print(){};
virtual void Reset(){};
ClassDef(VM_BaseClass,1);
};
class VM_BaseClass_Stack:public VM_BaseClass{
protected:
TList *fVMStack;//!
public:
using TNamed::Print;
VM_BaseClass_Stack(const TString& name="");
~VM_BaseClass_Stack(){
if(fVMStack){
ClearStack();
delete fVMStack;
fVMStack=NULL;
}
}
virtual void Init();
virtual UInt_t GetSize()const{return fVMStack ? fVMStack->GetSize() : 0;}
virtual UInt_t GetNum() const{return GetSize();}
//virtual UInt_t AddBranches(TTree* _tree){return 0;}//
//virtual UInt_t SetBranches(TTree* _tree){return 0;}//
virtual UInt_t Add(VM_BaseClass * base);
virtual void ClearStack(){if(fVMStack)fVMStack->Clear();}
virtual void Print();
virtual void Reset();
ClassDef(VM_BaseClass_Stack,1);
};
#endif
///////////////////////////////////////////////////////////////////////////////////