#ifndef MySelector_h #define MySelector_h #define RUN_DATA "/media/data1/School/Thesis/scripts/Electro_Scaling/run_data.root" #include #include #include #include class MySelector : public TSelector { public : TTree *fChain; // Tree variables & branches: headers Int_t fEvtHdr_fRun,fEvtHdr_fEvtType; TBranch *b_Event_Branch_fEvtHdr_fRun,*b_Event_Branch_fEvtHdr_fEvtType; // Tree variables & branches: R HRS Double_t R_gold_p, R_gold_ph, R_gold_th, ReactPt_R_z, R_tr_beta[18]; Double_t R_s1_time[6],R_s1_trpad[18],R_s2_time[16],R_s2_trpad[18]; Int_t Ndata_R_s1_time,Ndata_R_s1_trpad,Ndata_R_s2_time,Ndata_R_s2_trpad,Ndata_R_tr_beta; TBranch *b_R_gold_p, *b_R_gold_ph, *b_R_gold_th, *b_ReactPt_R_z, *b_R_tr_beta; TBranch *b_R_s1_time,*b_R_s1_trpad,*b_R_s2_time,*b_R_s2_trpad; TBranch *b_Ndata_R_s1_time,*b_Ndata_R_s1_trpad,*b_Ndata_R_s2_time,*b_Ndata_R_s2_trpad,*b_Ndata_R_tr_beta; // Tree variables & branches: L HRS Double_t L_gold_p, L_gold_ph, L_gold_th, ReactPt_L_z, L_tr_beta[18]; Double_t L_s1_time[6],L_s1_trpad[18],L_s2_time[16],L_s2_trpad[18]; Int_t Ndata_L_s1_time,Ndata_L_s1_trpad,Ndata_L_s2_time,Ndata_L_s2_trpad,Ndata_L_tr_beta; TBranch *b_L_gold_p, *b_L_gold_ph, *b_L_gold_th, *b_ReactPt_L_z, *b_L_tr_beta; TBranch *b_L_s1_time,*b_L_s1_trpad,*b_L_s2_time,*b_L_s2_trpad; TBranch *b_Ndata_L_s1_time,*b_Ndata_L_s1_trpad,*b_Ndata_L_s2_time,*b_Ndata_L_s2_trpad,*b_Ndata_L_tr_beta; // cut definition variables double tof_min,tof_max,th_min,th_max,ph_min,ph_max,p_min,p_max,zHe3_min,zHe3_max,zC12_min,zC12_max; // input variables TString input_HRS,input_target; float input_p; int bin_number; // prescale and charge tree variables & branches TTree *ps_Q_tree; int prescaleR,prescaleL; float Q,total_Q; TBranch *b_ps1,*b_ps3,*b_Q; // function declarations MySelector(TTree * /*tree*/ =0) { } virtual ~MySelector() { } virtual Int_t Version() const { return 2; } virtual void Begin(TTree *tree); virtual void SlaveBegin(TTree *tree); virtual void Init(TTree *tree); virtual Bool_t Notify(); virtual Bool_t Process(Long64_t entry); virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; } virtual void SetOption(const char *option) { fOption = option; } virtual void SetObject(TObject *obj) { fObject = obj; } virtual void SetInputList(TList *input) { fInput = input; } virtual TList *GetOutputList() const { return fOutput; } virtual void SlaveTerminate(); virtual void Terminate(); // TROOT::ClassDef(MySelector,0); }; #endif #ifdef MySelector_cxx void MySelector::Init(TTree *tree) { if (!tree) return; fChain = tree; fChain->SetMakeClass(1); // Set branch addresses: R HRS fChain->SetBranchAddress("R.gold.p",&R_gold_p,&b_R_gold_p); fChain->SetBranchAddress("ReactPt_R.z",&ReactPt_R_z,&b_ReactPt_R_z); fChain->SetBranchAddress("R.gold.ph",&R_gold_ph,&b_R_gold_ph); fChain->SetBranchAddress("R.gold.th",&R_gold_th,&b_R_gold_th); fChain->SetBranchAddress("R.s1.time", R_s1_time, &b_R_s1_time); fChain->SetBranchAddress("R.s1.trpad", R_s1_trpad, &b_R_s1_trpad); fChain->SetBranchAddress("R.s2.time", R_s2_time, &b_R_s2_time); fChain->SetBranchAddress("R.s2.trpad", R_s2_trpad, &b_R_s2_trpad); fChain->SetBranchAddress("Ndata.R.s1.time", &Ndata_R_s1_time, &b_Ndata_R_s1_time); fChain->SetBranchAddress("Ndata.R.s1.trpad", &Ndata_R_s1_trpad, &b_Ndata_R_s1_trpad); fChain->SetBranchAddress("Ndata.R.s2.time", &Ndata_R_s2_time, &b_Ndata_R_s2_time); fChain->SetBranchAddress("Ndata.R.s2.trpad", &Ndata_R_s2_trpad, &b_Ndata_R_s2_trpad); fChain->SetBranchAddress("Ndata.R.tr.beta", &Ndata_R_tr_beta, &b_Ndata_R_tr_beta); fChain->SetBranchAddress("R.tr.beta", R_tr_beta, &b_R_tr_beta); // Set branch addresses: L HRS fChain->SetBranchAddress("L.gold.p",&L_gold_p,&b_L_gold_p); fChain->SetBranchAddress("ReactPt_L.z",&ReactPt_L_z,&b_ReactPt_L_z); fChain->SetBranchAddress("L.gold.ph",&L_gold_ph,&b_L_gold_ph); fChain->SetBranchAddress("L.gold.th",&L_gold_th,&b_L_gold_th); fChain->SetBranchAddress("L.s1.time", L_s1_time, &b_L_s1_time); fChain->SetBranchAddress("L.s1.trpad", L_s1_trpad, &b_L_s1_trpad); fChain->SetBranchAddress("L.s2.time", L_s2_time, &b_L_s2_time); fChain->SetBranchAddress("L.s2.trpad", L_s2_trpad, &b_L_s2_trpad); fChain->SetBranchAddress("Ndata.L.s1.time", &Ndata_L_s1_time, &b_Ndata_L_s1_time); fChain->SetBranchAddress("Ndata.L.s1.trpad", &Ndata_L_s1_trpad, &b_Ndata_L_s1_trpad); fChain->SetBranchAddress("Ndata.L.s2.time", &Ndata_L_s2_time, &b_Ndata_L_s2_time); fChain->SetBranchAddress("Ndata.L.s2.trpad", &Ndata_L_s2_trpad, &b_Ndata_L_s2_trpad); fChain->SetBranchAddress("Ndata.L.tr.beta", &Ndata_L_tr_beta, &b_Ndata_L_tr_beta); fChain->SetBranchAddress("L.tr.beta", L_tr_beta, &b_L_tr_beta); // Set branch addresses: headers fChain->SetBranchAddress("fEvtHdr.fRun", &fEvtHdr_fRun, &b_Event_Branch_fEvtHdr_fRun); fChain->SetBranchAddress("fEvtHdr.fEvtType", &fEvtHdr_fEvtType, &b_Event_Branch_fEvtHdr_fEvtType); // read prescales from run_data.root TFile *f = new TFile("/media/data1/School/Thesis/scripts/Electro_Scaling/run_data.root"); ps_Q_tree = (TTree*)f->Get("T"); ps_Q_tree->SetBranchAddress("ps1",&prescaleR,&b_ps1); ps_Q_tree->SetBranchAddress("ps3",&prescaleL,&b_ps3); ps_Q_tree->SetBranchAddress("Q",&Q,&b_Q); } Bool_t MySelector::Notify() { return kTRUE; } #endif