File indexing completed on 2024-04-06 12:31:45
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef MuProp_h
0009 #define MuProp_h
0010
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014 #include <TH2.h>
0015 #include <TH1.h>
0016 #include <TProfile.h>
0017
0018
0019 #include <map>
0020
0021
0022 class MuProp {
0023 public :
0024 TTree *fChain;
0025 Int_t fCurrent;
0026
0027
0028 Int_t nPoints;
0029 Int_t q[250];
0030 Int_t pStatus[250][3];
0031 Float_t p3[250][9];
0032 Float_t r3[250][9];
0033 Int_t id[250];
0034 Float_t p3R[250][3];
0035 Float_t r3R[250][3];
0036 Float_t covFlat[250][21];
0037 Int_t run;
0038 Int_t event_;
0039
0040
0041 TBranch *b_nPoints;
0042 TBranch *b_q;
0043 TBranch *b_pStatus;
0044 TBranch *b_p3;
0045 TBranch *b_r3;
0046 TBranch *b_id;
0047 TBranch *b_p3R;
0048 TBranch *b_r3R;
0049 TBranch *b_covFlat;
0050 TBranch *b_run;
0051 TBranch *b_event;
0052
0053
0054 std::map<Int_t,TH1F*> dX_mh1;
0055 TH1F* dX_fh1(Int_t i){ return dX_mh1[i];}
0056
0057 std::map<Int_t,TH1F*> dXPull_mh1;
0058 TH1F* dXPull_fh1(Int_t i){ return dXPull_mh1[i];}
0059
0060 Int_t idDT(){return idDT_WhSt(0,0);}
0061 Int_t idCSC(){return idCSC_EnStRi(0,0,0);}
0062
0063 Int_t idDT_WhSt(Int_t wh, Int_t st) {
0064
0065 return ((0x2<<28) | (0x1<<25) | ((wh&0x7)<<15) | ((st&0x7)<<22) );
0066
0067
0068 }
0069
0070 Int_t idCSC_EnStRi(Int_t en, Int_t st, Int_t ri) {
0071 return ((0x2<<28) | (0x2<<25) | ((en&0x3)<<16) | ((st&0x7)<<13) | ((ri&0x7)<<10) );
0072 }
0073
0074 MuProp(TTree *tree=0);
0075 virtual ~MuProp();
0076 virtual Int_t GetEntry(Long64_t entry);
0077 virtual Long64_t LoadTree(Long64_t entry);
0078 virtual void Init(TTree *tree);
0079 virtual void Loop(Double_t maxEloss = 1e12);
0080 virtual Bool_t Notify();
0081 virtual void Show(Long64_t entry = -1);
0082 };
0083
0084 #endif
0085
0086 #ifdef MuProp_cxx
0087 MuProp::MuProp(TTree *tree)
0088 {
0089
0090
0091 if (tree == 0) {
0092 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("PropagatorDump.test_29.mup.root");
0093 if (!f) {
0094 f = new TFile("PropagatorDump.test_29.mup.root");
0095 }
0096 tree = (TTree*)gDirectory->Get("MuProp");
0097
0098 }
0099 Init(tree);
0100 }
0101
0102 MuProp::~MuProp()
0103 {
0104 if (!fChain) return;
0105 delete fChain->GetCurrentFile();
0106 }
0107
0108 Int_t MuProp::GetEntry(Long64_t entry)
0109 {
0110
0111 if (!fChain) return 0;
0112 return fChain->GetEntry(entry);
0113 }
0114 Long64_t MuProp::LoadTree(Long64_t entry)
0115 {
0116
0117 if (!fChain) return -5;
0118 Long64_t centry = fChain->LoadTree(entry);
0119 if (centry < 0) return centry;
0120 if (fChain->IsA() != TChain::Class()) return centry;
0121 TChain *chain = (TChain*)fChain;
0122 if (chain->GetTreeNumber() != fCurrent) {
0123 fCurrent = chain->GetTreeNumber();
0124 Notify();
0125 }
0126 return centry;
0127 }
0128
0129 void MuProp::Init(TTree *tree)
0130 {
0131
0132
0133
0134
0135
0136
0137
0138 if (tree == 0) return;
0139 fChain = tree;
0140 fCurrent = -1;
0141 fChain->SetMakeClass(1);
0142
0143 fChain->SetBranchAddress("nPoints",&nPoints);
0144 fChain->SetBranchAddress("q",q);
0145 fChain->SetBranchAddress("pStatus",pStatus);
0146 fChain->SetBranchAddress("p3",p3);
0147 fChain->SetBranchAddress("r3",r3);
0148 fChain->SetBranchAddress("id",id);
0149 fChain->SetBranchAddress("p3R",p3R);
0150 fChain->SetBranchAddress("r3R",r3R);
0151 fChain->SetBranchAddress("covFlat",covFlat);
0152 fChain->SetBranchAddress("run",&run);
0153 fChain->SetBranchAddress("event_",&event_);
0154 Notify();
0155 }
0156
0157 Bool_t MuProp::Notify()
0158 {
0159
0160
0161
0162
0163
0164
0165
0166
0167 b_nPoints = fChain->GetBranch("nPoints");
0168 b_q = fChain->GetBranch("q");
0169 b_pStatus = fChain->GetBranch("pStatus");
0170 b_p3 = fChain->GetBranch("p3");
0171 b_r3 = fChain->GetBranch("r3");
0172 b_id = fChain->GetBranch("id");
0173 b_p3R = fChain->GetBranch("p3R");
0174 b_r3R = fChain->GetBranch("r3R");
0175 b_covFlat = fChain->GetBranch("covFlat");
0176 b_run = fChain->GetBranch("run");
0177 b_event = fChain->GetBranch("event_");
0178
0179 return kTRUE;
0180 }
0181
0182 void MuProp::Show(Long64_t entry)
0183 {
0184
0185
0186 if (!fChain) return;
0187 fChain->Show(entry);
0188 }
0189 #endif