00001
00002
00003
00004
00005
00007
00008
00009 #ifndef H1Tracks_h
00010 #define H1Tracks_h
00011
00012 #include <TROOT.h>
00013 #include <TChain.h>
00014 #include <TFile.h>
00015
00016 class H1Tracks {
00017 public :
00018 TTree *fChain;
00019 Int_t fCurrent;
00020
00021 Short_t Ivtyp;
00022 Float_t Vtx[3];
00023 Int_t Ntracks;
00024 Int_t Ntracks3;
00025 Int_t Ntracks5;
00026 Int_t Ntracks15;
00027 Float_t Par[465];
00028 Float_t Cov[1395];
00029 Float_t Mom[279];
00030 Float_t Rstart[93];
00031 Float_t Rend [93];
00032 Short_t Ncst [93];
00033 Int_t RunNumber;
00034 Int_t EventNumber;
00035 TClonesArray *PointerArray;
00036 TClonesArray *PointerArrayIndex;
00037
00038
00039 TBranch *b_Ivtyp;
00040 TBranch *b_Vtx;
00041 TBranch *b_Ntracks;
00042 TBranch *b_Ntracks3;
00043 TBranch *b_Ntracks5;
00044 TBranch *b_Ntracks15;
00045 TBranch *b_Par;
00046 TBranch *b_Cov;
00047 TBranch *b_Mom;
00048 TBranch *b_Rstart;
00049 TBranch *b_Rend ;
00050 TBranch *b_Ncst ;
00051 TBranch *b_RunNumber;
00052 TBranch *b_EventNumber;
00053 TBranch *b_PointerArray;
00054 TBranch *b_PointerArrayIndex;
00055
00056 H1Tracks(TTree *tree=0);
00057 ~H1Tracks();
00058 Int_t Cut(Int_t entry);
00059 Int_t GetEntry(Int_t entry);
00060 Int_t LoadTree(Int_t entry);
00061 void Init(TTree *tree);
00062 void Loop();
00063 Bool_t Notify();
00064 void Show(Int_t entry = -1);
00065 };
00066
00067 #endif
00068
00069 #ifdef H1Tracks_cxx
00070 H1Tracks::H1Tracks(TTree *tree)
00071 {
00072
00073
00074 if (tree == 0) {
00075 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("tracks.root");
00076 if (!f) {
00077 f = new TFile("tracks.root");
00078 }
00079 tree = (TTree*)gDirectory->Get("Tracks");
00080
00081 }
00082 Init(tree);
00083 }
00084
00085 H1Tracks::~H1Tracks()
00086 {
00087 if (!fChain) return;
00088 delete fChain->GetCurrentFile();
00089 }
00090
00091 Int_t H1Tracks::GetEntry(Int_t entry)
00092 {
00093
00094 if (!fChain) return 0;
00095 return fChain->GetEntry(entry);
00096 }
00097 Int_t H1Tracks::LoadTree(Int_t entry)
00098 {
00099
00100 if (!fChain) return -5;
00101 Int_t centry = fChain->LoadTree(entry);
00102 if (centry < 0) return centry;
00103 if (fChain->IsA() != TChain::Class()) return centry;
00104 TChain *chain = (TChain*)fChain;
00105 if (chain->GetTreeNumber() != fCurrent) {
00106 fCurrent = chain->GetTreeNumber();
00107 Notify();
00108 }
00109 return centry;
00110 }
00111
00112 void H1Tracks::Init(TTree *tree)
00113 {
00114
00115 PointerArray = 0;
00116 PointerArrayIndex = 0;
00117
00118 if (tree == 0) return;
00119 fChain = tree;
00120 fCurrent = -1;
00121 fChain->SetMakeClass(1);
00122
00123 fChain->SetBranchAddress("Ivtyp",&Ivtyp);
00124 fChain->SetBranchAddress("Vtx",Vtx);
00125 fChain->SetBranchAddress("Ntracks",&Ntracks);
00126 fChain->SetBranchAddress("Ntracks3",&Ntracks3);
00127 fChain->SetBranchAddress("Ntracks5",&Ntracks5);
00128 fChain->SetBranchAddress("Ntracks15",&Ntracks15);
00129 fChain->SetBranchAddress("Par",Par);
00130 fChain->SetBranchAddress("Cov",Cov);
00131 fChain->SetBranchAddress("Mom",Mom);
00132 fChain->SetBranchAddress("Rstart",Rstart);
00133 fChain->SetBranchAddress("Rend ",Rend );
00134 fChain->SetBranchAddress("Ncst ",Ncst );
00135 fChain->SetBranchAddress("RunNumber",&RunNumber);
00136 fChain->SetBranchAddress("EventNumber",&EventNumber);
00137 fChain->SetBranchAddress("PointerArray",&PointerArray);
00138 fChain->SetBranchAddress("PointerArrayIndex",&PointerArrayIndex);
00139 Notify();
00140 }
00141
00142 Bool_t H1Tracks::Notify()
00143 {
00144
00145
00146 b_Ivtyp = fChain->GetBranch("Ivtyp");
00147 b_Vtx = fChain->GetBranch("Vtx");
00148 b_Ntracks = fChain->GetBranch("Ntracks");
00149 b_Ntracks3 = fChain->GetBranch("Ntracks3");
00150 b_Ntracks5 = fChain->GetBranch("Ntracks5");
00151 b_Ntracks15 = fChain->GetBranch("Ntracks15");
00152 b_Par = fChain->GetBranch("Par");
00153 b_Cov = fChain->GetBranch("Cov");
00154 b_Mom = fChain->GetBranch("Mom");
00155 b_Rstart = fChain->GetBranch("Rstart");
00156 b_Rend = fChain->GetBranch("Rend ");
00157 b_Ncst = fChain->GetBranch("Ncst ");
00158 b_RunNumber = fChain->GetBranch("RunNumber");
00159 b_EventNumber = fChain->GetBranch("EventNumber");
00160 b_PointerArray = fChain->GetBranch("PointerArray");
00161 b_PointerArrayIndex = fChain->GetBranch("PointerArrayIndex");
00162 return kTRUE;
00163 }
00164
00165 void H1Tracks::Show(Int_t entry)
00166 {
00167
00168
00169 if (!fChain) return;
00170 fChain->Show(entry);
00171 }
00172 Int_t H1Tracks::Cut(Int_t entry)
00173 {
00174
00175
00176
00177 return 1;
00178 }
00179 #endif // #ifdef H1Tracks_cxx
00180