File indexing completed on 2024-04-06 12:19:24
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef MinBias_h
0009 #define MinBias_h
0010
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014
0015 class MinBias {
0016 public :
0017 TTree *fChain;
0018 Int_t fCurrent;
0019
0020
0021 Int_t mydet;
0022 Int_t mysubd;
0023 Int_t depth;
0024 Int_t ieta;
0025 Int_t iphi;
0026 Float_t eta;
0027 Float_t phi;
0028 Float_t mom1;
0029 Float_t mom2;
0030 Float_t mom3;
0031 Float_t mom4;
0032
0033
0034 TBranch *b_mydet;
0035 TBranch *b_mysubd;
0036 TBranch *b_depth;
0037 TBranch *b_ieta;
0038 TBranch *b_iphi;
0039 TBranch *b_eta;
0040 TBranch *b_phi;
0041 TBranch *b_mom1;
0042 TBranch *b_mom2;
0043 TBranch *b_mom3;
0044 TBranch *b_mom4;
0045
0046 MinBias(TTree *tree=0);
0047 virtual ~MinBias();
0048 virtual Int_t Cut(Long64_t entry);
0049 virtual Int_t GetEntry(Long64_t entry);
0050 virtual Long64_t LoadTree(Long64_t entry);
0051 virtual void Init(TTree *tree);
0052 virtual void Loop();
0053 virtual Bool_t Notify();
0054 virtual void Show(Long64_t entry = -1);
0055 };
0056
0057 #endif
0058
0059 #ifdef MinBias_cxx
0060 MinBias::MinBias(TTree *tree)
0061 {
0062
0063
0064 if (tree == 0) {
0065 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("analysis.root");
0066 if (!f) {
0067 f = new TFile("analysis.root");
0068 }
0069 tree = (TTree*)gDirectory->Get("RecJet");
0070
0071 }
0072 Init(tree);
0073 }
0074
0075 MinBias::~MinBias()
0076 {
0077 if (!fChain) return;
0078 delete fChain->GetCurrentFile();
0079 }
0080
0081 Int_t MinBias::GetEntry(Long64_t entry)
0082 {
0083
0084 if (!fChain) return 0;
0085 return fChain->GetEntry(entry);
0086 }
0087 Long64_t MinBias::LoadTree(Long64_t entry)
0088 {
0089
0090 if (!fChain) return -5;
0091 Long64_t centry = fChain->LoadTree(entry);
0092 if (centry < 0) return centry;
0093 if (fChain->IsA() != TChain::Class()) return centry;
0094 TChain *chain = (TChain*)fChain;
0095 if (chain->GetTreeNumber() != fCurrent) {
0096 fCurrent = chain->GetTreeNumber();
0097 Notify();
0098 }
0099 return centry;
0100 }
0101
0102 void MinBias::Init(TTree *tree)
0103 {
0104
0105
0106
0107
0108
0109
0110
0111 if (tree == 0) return;
0112 fChain = tree;
0113 fCurrent = -1;
0114 fChain->SetMakeClass(1);
0115
0116 fChain->SetBranchAddress("mydet",&mydet);
0117 fChain->SetBranchAddress("mysubd",&mysubd);
0118 fChain->SetBranchAddress("depth",&depth);
0119 fChain->SetBranchAddress("ieta",&ieta);
0120 fChain->SetBranchAddress("iphi",&iphi);
0121 fChain->SetBranchAddress("eta",&eta);
0122 fChain->SetBranchAddress("phi",&phi);
0123 fChain->SetBranchAddress("mom1",&mom1);
0124 fChain->SetBranchAddress("mom2",&mom2);
0125 fChain->SetBranchAddress("mom3",&mom3);
0126 fChain->SetBranchAddress("mom4",&mom4);
0127 Notify();
0128 }
0129
0130 Bool_t MinBias::Notify()
0131 {
0132
0133
0134
0135
0136
0137
0138
0139
0140 b_mydet = fChain->GetBranch("mydet");
0141 b_mysubd = fChain->GetBranch("mysubd");
0142 b_depth = fChain->GetBranch("depth");
0143 b_ieta = fChain->GetBranch("ieta");
0144 b_iphi = fChain->GetBranch("iphi");
0145 b_eta = fChain->GetBranch("eta");
0146 b_phi = fChain->GetBranch("phi");
0147 b_mom1 = fChain->GetBranch("mom1");
0148 b_mom2 = fChain->GetBranch("mom2");
0149 b_mom3 = fChain->GetBranch("mom3");
0150 b_mom4 = fChain->GetBranch("mom4");
0151
0152 return kTRUE;
0153 }
0154
0155 void MinBias::Show(Long64_t entry)
0156 {
0157
0158
0159 if (!fChain) return;
0160 fChain->Show(entry);
0161 }
0162 Int_t MinBias::Cut(Long64_t entry)
0163 {
0164
0165
0166
0167 return 1;
0168 }
0169 #endif