Presentation is loading. Please wait.

Presentation is loading. Please wait.

E906 Data Analysis Frame on ROOT Jia-Ye Chen 2010.08.18.

Similar presentations


Presentation on theme: "E906 Data Analysis Frame on ROOT Jia-Ye Chen 2010.08.18."— Presentation transcript:

1 E906 Data Analysis Frame on ROOT Jia-Ye Chen

2 Contents  Motivations  Analysis Frame  Location  Header files  Source codes  Output a histogram file  Evaluation on histogram level  To paint and output a PS/EPS file  Execute ROOT file with arguments  Further study on acceptance evaluation

3 Motivations  Unifying the analytic frame.  Developing ROOT-base programs to analyze experimental or Monte Carlo data extracted from mySQL database.  Extending ROOT-base programs to compiled C++ analytic codes for numerous data analyses.

4 Analysis Frame – Location ipas012.phys.sinica.edu.tw Directory : /usrX/jychen/e906/diMuon/  Header files :./include.v3/*.h  Source files :./src.v3/*.cc  Object files :./obj/*.o  Binary files :./bin/executable_file  Makefile

5 Analysis Frame – Header Files (1) File :../include/arraySize.h #ifndef __ARRAY_SIZE_H__ #define __ARRAY_SIZE_H__ #define maxHistoNum 6 #endif /* __ARRAY_SIZE_H__ */

6 Analysis Frame – Header Files (2) File :../include/calVariable.h #ifndef __CALVARIABLE_H__ #define __CALVARIABLE_H__ Float_t calDimuonX1, calDimuonX2; #endif /* __CALVARIABLE_H__ */

7 Analysis Frame – Header Files (3) File :../include/hist.h #ifndef __HIST_H__ #define __HIST_H__ #include "arraySize.h" typedef struct{ TH1F* h1_[maxHistoNum]; // x1 TH1F* h2_[maxHistoNum]; // x2 TH2F* h3_[maxHistoNum]; // x1 vs x2 … } hist; #endif /* __HIST_H__ */

8 Analysis Frame – Header Files (4) File :../include/mcStruct.h #ifndef __MCSTRUCT_H__ #define __MCSTRUCT_H__ typedef struct { Double_t mWeight,mMandS,mMandU,mMandT,mPT,mInvarMass; Int_t eventID,runID,spillID,nDimuons,nTracks,mEventsGen; Char_t mProcessCode[32]; } EVENT; … #endif /* __MCSTRUCT_H__ */

9 Analysis Frame – Header Files (5) File :../include/switch.h #ifndef __SWITCH_H__ #define __SWITCH_H__ Int_t iAnaEvent = 0; … Int_t iAnaDimuon = 1; Int_t iAnaTrack = 0; … Int_t iDraw = 0; Int_t iOutputHst = 1; #endif /* __SWITCH_H__ */

10 Analysis Frame – Source codes  main file : dimuon.cc // ROOT Header Files … // USER Header Files … // USER Subroutines … // booking histograms hist H; histoInit(&H); // main analytic codes anaEvent(&event); … anaDimuon(&mdimuon, &H); anaTrack(&mtrack); … // painting paniting(); // Output a hisogram file histoSave(&H);

11 Analysis Frame – Source codes (1) void histoInit(hist *H) { if ( iOutputHst == 1 ){ for( Int_t i=0; i < maxHistoNum; i++ ){ H->h1_[i] = new TH1F(Form("h1%04d",i),"x1",11,0,1.1); H->h2_[i] = new TH1F(Form("h2%04d",i),"x2",12,0,1.2); H->h3_[i] = new TH2F(Form("h3%04d",i),"x1 vs x2",11,0,1.1,12,0,1.2); … } // i Loop } // IF iOutputHst == 1 }

12 Analysis Frame – Source codes (2) void anaDimuon(MDIMUON *mdimuon, hist *H) { H->h1_[0]->Fill(mdimuon->x1); H->h2_[0]->Fill(mdimuon->x2); … if ( mdimuon->acceptAll == 1 ){ H->h1_[1]->Fill(mdimuon->x1); H->h2_[1]->Fill(mdimuon->x2); … }

13 Analysis Frame – Source codes (3) void histoSave(hist *H) { if ( iOutputHst == 1 ){ // open a file for saving histogram TFile hfile("/sp8data5/jychen/rootFile/dimuon_ root","recreate"); for ( int i=0; i < maxHistoNum; i++ ){ H->h1_[i]->Write(); H->h2_[i]->Write(); … } // close the file hfile hfile.Close(); } // IF iOutputHst == 1 }

14 Evaluation on histogram level void accept(int ioption) { gStyle->SetOptStat( ); // reading a histograms from a file TFile *hfile = new TFile("/sp8data5/jychen/rootFile/dimuon_ root"); // list all histograms in current file hfile->ls(); // create one Canvas TCanvas *c1 = new TCanvas("c1","Canvas",3060,0,750,750); // open a PS/EPS for figures saving within canvas C1 if ( ioption==1 ){ c1->Print("/sp8data4/jychen/ps/e906/dimuon/accept.ps["); } else if ( ioption==2 ){ c1->Print("/sp8data4/jychen/eps/e906/dimuon/accept.eps["); } // building a multi-pad canvas c1->Divide(2,2); // change directory of pads c1->cd(1); h10000->SetLineColor(2); h10000->Draw("e"); h10001->SetLineColor(4); h10001->Draw("esame"); // after drawing, saving current page into PS/EPS file, one line for one page if ( ioption==1 ){ c1->Print("/sp8data4/jychen/ps/e906/dimuon/accept.ps"); } else if ( ioption==2 ){ c1->Print("/sp8data4/jychen/eps/e906/dimuon/accept.eps"); } // close this PS/EPS file if ( ioption==1 ){ c1->Print("/sp8data4/jychen/eps/e906/dimuon/accept.eps]"); } else if ( ioption==2 ){ c1->Print("/sp8data4/jychen/ps/e906/dimuon/accept.ps]"); }

15 Output EPS file

16 Execute ROOT File with Arguments src]$ root "accept.cc(1)“ or root [0].x accept.cc(1) void accept(int ioption) { … }


Download ppt "E906 Data Analysis Frame on ROOT Jia-Ye Chen 2010.08.18."

Similar presentations


Ads by Google