#define timewalk2bset2_cxx #include "timewalk2bset2.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace RooFit; //TH1F *dataimport(); void timewalk2bset2::Loop(Int_t entries) { ostringstream var_set2,varml_set2,varsl_set2,varlan_set2,varframe_set2,vardh_set2; RooDataHist *dh[90000]; // In a ROOT session, you can do: // Root > .L timewalk2bset2.C // Root > timewalk2bset2 t // Root > t.GetEntry(12); // Fill t data members with entry number 12 // Root > t.Show(); // Show values of entry 12 // Root > t.Show(16); // Read and show values of entry 16 // Root > t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch if (fChain == 0) return; fio2b_set2=new TFile("timewalkcorrections2bset2.root","recreate"); Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for(int ievt=1;ievtGetEntry(jentry); nbytes += nb; ///cout<<"i am counting= "<=100 && <110) if(eventn_iev>entries) break; h2b_set2[eventn_iev-1]->Fill(eventn_count,eventn_adc1_raw); //if (eventn_iev==eventnum) //h_set2->Fill(eventn_count,eventn_adc1_raw); // if (Cut(ientry) < 0) continue; } cout<<"I have been executed"<Divide(5,4); //h_set2->Fit(hist_offset_set2,"","",0.5,100.5); //h_set2->Add(hist_offset_set2,-1); // h_set2->Draw(); for(int ievt=1;ievtFit(f_set2[ievt-1],"Q","N"); //double a= f_set2[ievt-1]->GetChisquare(); // double b= f_set2[ievt-1]->GetNDF(); //if(a>=2000) // cout<<" the chisquare value is = "<plotOn(xframe); cout<<"i am near landau"<cd(ievt); xframe->Draw(); c_set2->Update(); } //dataimport(); cout<<"done"<Write(); } /*TH1F *dataimport() { RooRealVar x("x","x",-0.5,100.5); TH1F *hh=(TH1F*)gDirectory->Get("set2"); RooDataHist *dh=new RooDataHist("dh","data histogram",x,hh); TH1F *qq=hh; double x1=qq->GetXaxis()->GetBinCenter(qq->GetMaximumBin()); //-----------------------------------------------------LANDAU PDF------------------------------------------------------------------------------------------------ RooRealVar ml("mean","mean of landau",x1); RooRealVar sl("sigma","sigma of landau",0.5,0.445,0.523); RooLandau landau("landau","landau pdf",x,ml,sl); //----------------------------------------------------GAUSSIAN PDF------------------------------------------------------------------------------------------------- RooRealVar mg("mean","mean of gaussian",x1); RooRealVar sg("sigma","sigma of gauss",1.0,0.449,1.02); RooGaussian gauss("gauss","gauss pdf",x,mg,sg); RooPlot *frame1=x.frame(Title("adc1_vs_count_set2_1757"),Bins(101)); dh->plotOn(frame1); landau.fitTo(*dh,Range(40.5,70.5)); landau.plotOn(frame1); cout<<"chisquare is= "<chiSquare()<SetGrid(); frame1->SetXTitle("count"); frame1->SetYTitle("adc1_raw"); frame1->Draw(); ml.Print(); sl.Print(); mg.Print(); sg.Print(); return hh; }*/ /*TH1F *dataimport() { ostringstream var_set2,varml_set2,varsl_set2,varlan_set2; cout<<"I reached here"<Divide(3,2); for(int ievt=1;ievt<4;ievt++) { var_set2<<"x_set1"<Get("histogram_set2"); RooDataHist *dh=new RooDataHist("dh","data hist",x,hh); varml_set2<<"ml_set2"<plotOn(frame1); landau.fitTo(*dh,Range(40.5,70.5)); landau.plotOn(frame1); c_set2->cd(ievt); frame1->Draw(); return hh;*/ /*RooRealVar x("x","x",-0.5,100.5); TH1F *hh=(TH1F*)gDirectory->Get("histogram_set2"); RooDataHist *dh=new RooDataHist("dh","data hist",x,hh); RooRealVar ml("ml","landau mean",53.0); RooRealVar sl("sl","landa sigma",1.0); RooLandau landau("landau","landau pdf",x,ml,sl); RooPlot *frame1=x.frame(Bins(101)); dh->plotOn(frame1); landau.fitTo(*dh,Range(40.5,70.5)); landau.plotOn(frame1); frame1->Draw(); return hh; } }*/