00001
00002
00003
00004
00005
00007
00008
00009 #ifndef H1K0S_h
00010 #define H1K0S_h
00011
00012 #include <TROOT.h>
00013 #include <TChain.h>
00014 #include <TFile.h>
00015
00016 class H1K0S {
00017 public :
00018 TTree *fChain;
00019 Int_t fCurrent;
00020
00021 Short_t myIvtyp;
00022 Float_t myVtx[3];
00023 Float_t pion1Par[5];
00024 Float_t pion2Par[5];
00025 Float_t pion1Cov[15];
00026 Float_t pion2Cov[15];
00027 Float_t pion1Mom[3];
00028 Float_t pion2Mom[3];
00029 Float_t K0Vert[3];
00030 Float_t K0VertCov[6];
00031 Float_t K0Mom[4];
00032 Int_t RunNumber;
00033 Int_t EventNumber;
00034 TClonesArray *PointerArray;
00035 TClonesArray *PointerArrayIndex;
00036
00037
00038 TBranch *b_myIvtyp;
00039 TBranch *b_myVtx;
00040 TBranch *b_pion1Par;
00041 TBranch *b_pion2Par;
00042 TBranch *b_pion1Cov;
00043 TBranch *b_pion2Cov;
00044 TBranch *b_pion1Mom;
00045 TBranch *b_pion2Mom;
00046 TBranch *b_K0Vert;
00047 TBranch *b_K0VertCov;
00048 TBranch *b_K0Mom;
00049 TBranch *b_RunNumber;
00050 TBranch *b_EventNumber;
00051 TBranch *b_PointerArray;
00052 TBranch *b_PointerArrayIndex;
00053
00054 H1K0S(TTree *tree=0);
00055 ~H1K0S();
00056 Int_t Cut(Int_t entry);
00057 Int_t GetEntry(Int_t entry);
00058 Int_t LoadTree(Int_t entry);
00059 void Init(TTree *tree);
00060 void Loop();
00061 Bool_t Notify();
00062 void Show(Int_t entry = -1);
00063 };
00064
00065 #endif
00066
00067 #ifdef H1K0S_cxx
00068 H1K0S::H1K0S(TTree *tree)
00069 {
00070
00071
00072 if (tree == 0) {
00073 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("h1-k0.root");
00074 if (!f) {
00075 f = new TFile("h1-k0.root");
00076 }
00077 tree = (TTree*)gDirectory->Get("USER");
00078
00079 }
00080 Init(tree);
00081 }
00082
00083 H1K0S::~H1K0S()
00084 {
00085 if (!fChain) return;
00086 delete fChain->GetCurrentFile();
00087 }
00088
00089 Int_t H1K0S::GetEntry(Int_t entry)
00090 {
00091
00092 if (!fChain) return 0;
00093 return fChain->GetEntry(entry);
00094 }
00095 Int_t H1K0S::LoadTree(Int_t entry)
00096 {
00097
00098 if (!fChain) return -5;
00099 Int_t centry = fChain->LoadTree(entry);
00100 if (centry < 0) return centry;
00101 if (fChain->IsA() != TChain::Class()) return centry;
00102 TChain *chain = (TChain*)fChain;
00103 if (chain->GetTreeNumber() != fCurrent) {
00104 fCurrent = chain->GetTreeNumber();
00105 Notify();
00106 }
00107 return centry;
00108 }
00109
00110 void H1K0S::Init(TTree *tree)
00111 {
00112
00113 PointerArray = 0;
00114 PointerArrayIndex = 0;
00115
00116 if (tree == 0) return;
00117 fChain = tree;
00118 fCurrent = -1;
00119 fChain->SetMakeClass(1);
00120
00121 fChain->SetBranchAddress("myIvtyp",&myIvtyp);
00122 fChain->SetBranchAddress("myVtx",myVtx);
00123 fChain->SetBranchAddress("pion1Par",pion1Par);
00124 fChain->SetBranchAddress("pion2Par",pion2Par);
00125 fChain->SetBranchAddress("pion1Cov",pion1Cov);
00126 fChain->SetBranchAddress("pion2Cov",pion2Cov);
00127 fChain->SetBranchAddress("pion1Mom",pion1Mom);
00128 fChain->SetBranchAddress("pion2Mom",pion2Mom);
00129 fChain->SetBranchAddress("K0Vert",K0Vert);
00130 fChain->SetBranchAddress("K0VertCov",K0VertCov);
00131 fChain->SetBranchAddress("K0Mom",K0Mom);
00132 fChain->SetBranchAddress("RunNumber",&RunNumber);
00133 fChain->SetBranchAddress("EventNumber",&EventNumber);
00134 fChain->SetBranchAddress("PointerArray",&PointerArray);
00135 fChain->SetBranchAddress("PointerArrayIndex",&PointerArrayIndex);
00136 Notify();
00137 }
00138
00139 Bool_t H1K0S::Notify()
00140 {
00141
00142
00143 b_myIvtyp = fChain->GetBranch("myIvtyp");
00144 b_myVtx = fChain->GetBranch("myVtx");
00145 b_pion1Par = fChain->GetBranch("pion1Par");
00146 b_pion2Par = fChain->GetBranch("pion2Par");
00147 b_pion1Cov = fChain->GetBranch("pion1Cov");
00148 b_pion2Cov = fChain->GetBranch("pion2Cov");
00149 b_pion1Mom = fChain->GetBranch("pion1Mom");
00150 b_pion2Mom = fChain->GetBranch("pion2Mom");
00151 b_K0Vert = fChain->GetBranch("K0Vert");
00152 b_K0VertCov = fChain->GetBranch("K0VertCov");
00153 b_K0Mom = fChain->GetBranch("K0Mom");
00154 b_RunNumber = fChain->GetBranch("RunNumber");
00155 b_EventNumber = fChain->GetBranch("EventNumber");
00156 b_PointerArray = fChain->GetBranch("PointerArray");
00157 b_PointerArrayIndex = fChain->GetBranch("PointerArrayIndex");
00158 return kTRUE;
00159 }
00160
00161 void H1K0S::Show(Int_t entry)
00162 {
00163
00164
00165 if (!fChain) return;
00166 fChain->Show(entry);
00167 }
00168 Int_t H1K0S::Cut(Int_t entry)
00169 {
00170
00171
00172
00173 return 1;
00174 }
00175 #endif // #ifdef H1K0S_cxx
00176