File indexing completed on 2024-04-06 11:59:32
0001
0002
0003
0004
0005
0006
0007 #ifndef analyse_residuals_h
0008 #define analyse_residuals_h
0009
0010 #include <TROOT.h>
0011 #include <TChain.h>
0012 #include <TFile.h>
0013
0014 class analyse_residuals {
0015 public :
0016 TTree *fChain;
0017 Int_t fCurrent;
0018
0019
0020 Int_t evt;
0021 Int_t run;
0022 Int_t subdetId;
0023 Int_t layer;
0024 Int_t ladder;
0025 Int_t mod;
0026 Int_t side;
0027 Int_t disk;
0028 Int_t blade;
0029 Int_t panel;
0030 Int_t plaq;
0031 Int_t half;
0032 Int_t flipped;
0033 Float_t rechitx;
0034 Float_t rechity;
0035 Float_t rechitz;
0036 Float_t rechiterrx;
0037 Float_t rechiterry;
0038 Float_t rechitresx;
0039 Float_t rechitresy;
0040 Float_t rechitpullx;
0041 Float_t rechitpully;
0042 Int_t npix;
0043 Int_t nxpix;
0044 Int_t nypix;
0045 Float_t charge;
0046 Int_t edgex;
0047 Int_t edgey;
0048 Int_t bigx;
0049 Int_t bigy;
0050 Float_t alpha;
0051 Float_t beta;
0052 Float_t trk_alpha;
0053 Float_t trk_beta;
0054 Float_t phi;
0055 Float_t eta;
0056 Float_t simhitx;
0057 Float_t simhity;
0058 Int_t nsimhit;
0059 Int_t pidhit;
0060 Int_t simproc;
0061
0062
0063 TBranch *b_evt;
0064 TBranch *b_run;
0065 TBranch *b_subdetId;
0066 TBranch *b_layer;
0067 TBranch *b_ladder;
0068 TBranch *b_mod;
0069 TBranch *b_side;
0070 TBranch *b_disk;
0071 TBranch *b_blade;
0072 TBranch *b_panel;
0073 TBranch *b_plaq;
0074 TBranch *b_half;
0075 TBranch *b_flipped;
0076 TBranch *b_rechitx;
0077 TBranch *b_rechity;
0078 TBranch *b_rechitz;
0079 TBranch *b_rechiterrx;
0080 TBranch *b_rechiterry;
0081 TBranch *b_rechitresx;
0082 TBranch *b_rechitresy;
0083 TBranch *b_rechitpullx;
0084 TBranch *b_rechitpully;
0085 TBranch *b_npix;
0086 TBranch *b_nxpix;
0087 TBranch *b_nypix;
0088 TBranch *b_charge;
0089 TBranch *b_edgex;
0090 TBranch *b_edgey;
0091 TBranch *b_bigx;
0092 TBranch *b_bigy;
0093 TBranch *b_alpha;
0094 TBranch *b_beta;
0095 TBranch *b_trk_alpha;
0096 TBranch *b_trk_beta;
0097 TBranch *b_phi;
0098 TBranch *b_eta;
0099 TBranch *b_simhitx;
0100 TBranch *b_simhity;
0101 TBranch *b_nsimhit;
0102 TBranch *b_pidhit;
0103 TBranch *b_simproc;
0104
0105 analyse_residuals(TTree *tree=0);
0106 virtual ~analyse_residuals();
0107 virtual Int_t Cut(Long64_t entry);
0108 virtual Int_t GetEntry(Long64_t entry);
0109 virtual Long64_t LoadTree(Long64_t entry);
0110 virtual void Init(TTree *tree);
0111 virtual void Loop();
0112 virtual Bool_t Notify();
0113 virtual void Show(Long64_t entry = -1);
0114 };
0115
0116 #endif
0117
0118 #ifdef analyse_residuals_cxx
0119 analyse_residuals::analyse_residuals(TTree *tree)
0120 {
0121
0122
0123 if (tree == 0) {
0124
0125 #ifdef SINGLE_TREE
0126
0127
0128 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("Memory Directory");
0129 if (!f) {
0130 f = new TFile("Memory Directory");
0131 f->cd("Rint:/");
0132 }
0133 tree = (TTree*)gDirectory->Get("TrackHitNtuple");
0134
0135 #else
0136
0137
0138
0139 TChain * chain = new TChain("TrackHitNtuple","");
0140
0141 chain->Add("/uscms_data/d1/ggiurgiu/SiPixelErrorEstimation_Ntuple_after4.root/TrackHitNtuple");
0142
0143 tree = chain;
0144 #endif
0145
0146 }
0147 Init(tree);
0148 }
0149
0150 analyse_residuals::~analyse_residuals()
0151 {
0152 if (!fChain) return;
0153 delete fChain->GetCurrentFile();
0154 }
0155
0156 Int_t analyse_residuals::GetEntry(Long64_t entry)
0157 {
0158
0159 if (!fChain) return 0;
0160 return fChain->GetEntry(entry);
0161 }
0162 Long64_t analyse_residuals::LoadTree(Long64_t entry)
0163 {
0164
0165 if (!fChain) return -5;
0166 Long64_t centry = fChain->LoadTree(entry);
0167 if (centry < 0) return centry;
0168 if (!fChain->InheritsFrom(TChain::Class())) return centry;
0169 TChain *chain = (TChain*)fChain;
0170 if (chain->GetTreeNumber() != fCurrent) {
0171 fCurrent = chain->GetTreeNumber();
0172 Notify();
0173 }
0174 return centry;
0175 }
0176
0177 void analyse_residuals::Init(TTree *tree)
0178 {
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 if (!tree) return;
0189 fChain = tree;
0190 fCurrent = -1;
0191 fChain->SetMakeClass(1);
0192
0193 fChain->SetBranchAddress("evt", &evt, &b_evt);
0194 fChain->SetBranchAddress("run", &run, &b_run);
0195 fChain->SetBranchAddress("subdetId", &subdetId, &b_subdetId);
0196 fChain->SetBranchAddress("layer", &layer, &b_layer);
0197 fChain->SetBranchAddress("ladder", &ladder, &b_ladder);
0198 fChain->SetBranchAddress("mod", &mod, &b_mod);
0199 fChain->SetBranchAddress("side", &side, &b_side);
0200 fChain->SetBranchAddress("disk", &disk, &b_disk);
0201 fChain->SetBranchAddress("blade", &blade, &b_blade);
0202 fChain->SetBranchAddress("panel", &panel, &b_panel);
0203 fChain->SetBranchAddress("plaq", &plaq, &b_plaq);
0204 fChain->SetBranchAddress("half", &half, &b_half);
0205 fChain->SetBranchAddress("flipped", &flipped, &b_flipped);
0206 fChain->SetBranchAddress("rechitx", &rechitx, &b_rechitx);
0207 fChain->SetBranchAddress("rechity", &rechity, &b_rechity);
0208 fChain->SetBranchAddress("rechitz", &rechitz, &b_rechitz);
0209 fChain->SetBranchAddress("rechiterrx", &rechiterrx, &b_rechiterrx);
0210 fChain->SetBranchAddress("rechiterry", &rechiterry, &b_rechiterry);
0211 fChain->SetBranchAddress("rechitresx", &rechitresx, &b_rechitresx);
0212 fChain->SetBranchAddress("rechitresy", &rechitresy, &b_rechitresy);
0213 fChain->SetBranchAddress("rechitpullx", &rechitpullx, &b_rechitpullx);
0214 fChain->SetBranchAddress("rechitpully", &rechitpully, &b_rechitpully);
0215 fChain->SetBranchAddress("npix", &npix, &b_npix);
0216 fChain->SetBranchAddress("nxpix", &nxpix, &b_nxpix);
0217 fChain->SetBranchAddress("nypix", &nypix, &b_nypix);
0218 fChain->SetBranchAddress("charge", &charge, &b_charge);
0219 fChain->SetBranchAddress("edgex", &edgex, &b_edgex);
0220 fChain->SetBranchAddress("edgey", &edgey, &b_edgey);
0221 fChain->SetBranchAddress("bigx", &bigx, &b_bigx);
0222 fChain->SetBranchAddress("bigy", &bigy, &b_bigy);
0223 fChain->SetBranchAddress("alpha", &alpha, &b_alpha);
0224 fChain->SetBranchAddress("beta", &beta, &b_beta);
0225 fChain->SetBranchAddress("trk_alpha", &trk_alpha, &b_trk_alpha);
0226 fChain->SetBranchAddress("trk_beta", &trk_beta, &b_trk_beta);
0227 fChain->SetBranchAddress("phi", &phi, &b_phi);
0228 fChain->SetBranchAddress("eta", &eta, &b_eta);
0229 fChain->SetBranchAddress("simhitx", &simhitx, &b_simhitx);
0230 fChain->SetBranchAddress("simhity", &simhity, &b_simhity);
0231 fChain->SetBranchAddress("nsimhit", &nsimhit, &b_nsimhit);
0232 fChain->SetBranchAddress("pidhit", &pidhit, &b_pidhit);
0233 fChain->SetBranchAddress("simproc", &simproc, &b_simproc);
0234 Notify();
0235 }
0236
0237 Bool_t analyse_residuals::Notify()
0238 {
0239
0240
0241
0242
0243
0244
0245 return kTRUE;
0246 }
0247
0248 void analyse_residuals::Show(Long64_t entry)
0249 {
0250
0251
0252 if (!fChain) return;
0253 fChain->Show(entry);
0254 }
0255 Int_t analyse_residuals::Cut(Long64_t entry)
0256 {
0257
0258
0259
0260 return 1;
0261 }
0262 #endif