#define boselector_cxx #include "boselector.h" #include #include #include "TSelector.h" #include #include "TChain.h" #include "TFile.h" #include #include "TH2.h" #include "TCutG.h" #include "TMath.h" #include "TCanvas.h" using namespace std; Float_t forg, backg; TCanvas *c1 = new TCanvas(); TCanvas *c2 = new TCanvas(); TCanvas *c3 = new TCanvas(); TCanvas *c4 = new TCanvas(); TH2F *h1; //<============== void boselector::Begin(TTree * fChain) { c1->cd(); TString option = GetOption(); gStyle->SetPalette(1); c1->SetLogz(); h1 = new TH2F("h1","title",1000,0,10000,1000,0,10000); //<============== h1->SetDirectory(0); //<============== fChain->Draw("CHIO_Cal:EPL_R>>h1","","colz"); //<============== chiopl = (TCutG*) c1->WaitPrimitive("chiopl","CUTG"); chiopl->SetName("chiopl"); c2->cd(); fChain->Draw("CHIO_Cal:DcX1>>h2(1000,-400,400,10000,-500,15000)","chiopl","colz"); chiodc = (TCutG*) c2->WaitPrimitive("chiodc","CUTG"); chiodc->SetName("chiodc"); forge = new TH1F("forge","",1000,10,6000); backge = new TH1F("backge","",1000,10,6000); gROOT->ProcessLine(".ls"); i=1; } void boselector::SlaveBegin(TTree * /*tree*/) { TString option = GetOption(); } Bool_t boselector::Process(Long64_t entry) { // cout<<"here\n"<cd(); forge->Draw(); c3->Update(); c4->cd(); backge->Draw(); c4->Update();} // cout<<"here 1\n"<GetTree()->GetEntry(entry); if ( chiodc->IsInside(DcX1,CHIO_Cal) && chiopl->IsInside(EPL_R,CHIO_Cal) ) { // cout<<"here 2\n"<0.){forg = F_DC; forge->Fill(forg);} if(B_DC>0.){backg = B_DC; backge->Fill(backg);} // cout<<"here 3\n"<1500. && forg < 1900.) { istrue=1; } if ( backg >1500. && backg < 1900.) { istrue=1; } cout<<"here 4\n"<Fill(DcX1); } } return kTRUE; cout<<"here 5\n"<Draw("col"); forge->Draw(); backge->Draw(); TFile *f = new TFile("Oxygens.root"); TEventList *e1 = (TEventList*)f->Get("e1"); fChain->SetEventList(e1); TFile *f2 = new TFile("OxygenOnly.root","recreate"); TTree *small = fChain->CopyTree(""); small->Write(); small->Print(); f2->Close(); }