Presentation is loading. Please wait.

Presentation is loading. Please wait.

My ROOT Exercise with MC Ntuples Wen-Chen Chang 2010/12/15 1.

Similar presentations


Presentation on theme: "My ROOT Exercise with MC Ntuples Wen-Chen Chang 2010/12/15 1."— Presentation transcript:

1 My ROOT Exercise with MC Ntuples Wen-Chen Chang 2010/12/15 1

2 Outline 姚錫弘 successfully converts the MySQL tables of MC run into a ROOT ntuple file with an event-loop structure: /sp8data11/shyao/rootfile/r321test.root. As an exercise of ROOT, I study the E906 acceptance of dimuon pairs in mass, xf, x1, x2, phi_mu and theta_mu. 2

3 Ntuple Variables /sp8data11/shyao/rootfile/branchname.txt *Tree :event : A tree with data taken from SQL, 2010/12/01 * *Entries : 406055 : Total = 1835613408 bytes File Size = 1149489047 * *Br 0 :runID : runID/I * *Br 1 :seed : seed/I * *Br 2 :nEvGen : nEvGen/I * *Br 3 :extraWeight : extraWeight/D * *Br 4 :beamMomentum : beamMomentum/D * *Br 5 :beamCurrent : beamCurrent/D * *Br 6 :asciiFieldMap : asciiFieldMap/O * *Br 7 :energyCut : energyCut/D * *Br 8 :recordMethod : recordMethod[10]/C * *Br 9 :eventPos : eventPos[10]/C * *Br 10 :dimuonSource : dimuonSource[10]/C * *Br 11 :dimuonRepeat : dimuonRepeat/I * *Br 12 :magneticField : magneticField/O * *Br 13 :generator : generator[32]/C * *Br 14 :trackingEnergyCut : trackingEnergyCut/D * *Br 15 :trackingZCut : trackingZCut/D * *Br 16 :numSpills : numSpills/I * *Br 17 :numHits : numHits/I * *Br 18 :numTracks : numTracks/I * *Br 19 :numDimuons : numDimuons/I * *Br 20 :timeStart : timeStart[32]/C * *Br 21 :timeStop : timeStop[32]/C * *Br 22 :geoVersion : geoVersion[128]/C * *Br 23 :lastUpdate : lastUpdate[32]/C * *Br 24 :spillID : spillID/I * *Br 25 :target : target[32]/C * *Br 26 :eventID : eventID/I * *Tree :event : A tree with data taken from SQL, 2010/12/01 * *Entries : 406055 : Total = 1835613408 bytes File Size = 1149489047 * *Br 0 :runID : runID/I * *Br 1 :seed : seed/I * *Br 2 :nEvGen : nEvGen/I * *Br 3 :extraWeight : extraWeight/D * *Br 4 :beamMomentum : beamMomentum/D * *Br 5 :beamCurrent : beamCurrent/D * *Br 6 :asciiFieldMap : asciiFieldMap/O * *Br 7 :energyCut : energyCut/D * *Br 8 :recordMethod : recordMethod[10]/C * *Br 9 :eventPos : eventPos[10]/C * *Br 10 :dimuonSource : dimuonSource[10]/C * *Br 11 :dimuonRepeat : dimuonRepeat/I * *Br 12 :magneticField : magneticField/O * *Br 13 :generator : generator[32]/C * *Br 14 :trackingEnergyCut : trackingEnergyCut/D * *Br 15 :trackingZCut : trackingZCut/D * *Br 16 :numSpills : numSpills/I * *Br 17 :numHits : numHits/I * *Br 18 :numTracks : numTracks/I * *Br 19 :numDimuons : numDimuons/I * *Br 20 :timeStart : timeStart[32]/C * *Br 21 :timeStop : timeStop[32]/C * *Br 22 :geoVersion : geoVersion[128]/C * *Br 23 :lastUpdate : lastUpdate[32]/C * *Br 24 :spillID : spillID/I * *Br 25 :target : target[32]/C * *Br 26 :eventID : eventID/I * *Br 27 :nDimuons : nDimuons/I * *Br 28 :nTracks : nTracks/I * *Br 29 :mProcessCode : mProcessCode[32]/C * *Br 30 :mWeight : mWeight/D * *Br 31 :mMandS : mMandS/D * *Br 32 :mMandU : mMandU/D * *Br 33 :mMandT : mMandT/D * *Br 34 :mPT : mPT/D * *Br 35 :mInvarMass : mInvarMass/D * *Br 36 :mEventsGen : mEventsGen/I * *Br 37 :dimuonID : dimuonID/I * *Br 38 :trackID1 : trackID1/I * *Br 39 :trackID2 : trackID2/I * *Br 40 :mass : mass/D * *Br 41 :xF : xF/D * *Br 42 :x1 : x1/D * *Br 43 :x2 : x2/D * *Br 44 :pT : pT/D * *Br 45 :dx : dx/D * *Br 46 :dy : dy/D * *Br 47 :dz : dz/D * *Br 48 :dpx : dpx/D * *Br 49 :dpy : dpy/D * *Br 50 :dpz : dpz/D * *Br 51 :energy : energy/D * *Br 52 :phi_gam : phi_gam/D * *Br 53 :phi_mu : phi_mu/D * *Br 54 :theta_mu : theta_mu/D * *Br 55 :sigWeight : sigWeight/D * *Br 56 :acceptS123 : acceptS123/O * *Br 57 :acceptAll : acceptAll/O * *Br 27 :nDimuons : nDimuons/I * *Br 28 :nTracks : nTracks/I * *Br 29 :mProcessCode : mProcessCode[32]/C * *Br 30 :mWeight : mWeight/D * *Br 31 :mMandS : mMandS/D * *Br 32 :mMandU : mMandU/D * *Br 33 :mMandT : mMandT/D * *Br 34 :mPT : mPT/D * *Br 35 :mInvarMass : mInvarMass/D * *Br 36 :mEventsGen : mEventsGen/I * *Br 37 :dimuonID : dimuonID/I * *Br 38 :trackID1 : trackID1/I * *Br 39 :trackID2 : trackID2/I * *Br 40 :mass : mass/D * *Br 41 :xF : xF/D * *Br 42 :x1 : x1/D * *Br 43 :x2 : x2/D * *Br 44 :pT : pT/D * *Br 45 :dx : dx/D * *Br 46 :dy : dy/D * *Br 47 :dz : dz/D * *Br 48 :dpx : dpx/D * *Br 49 :dpy : dpy/D * *Br 50 :dpz : dpz/D * *Br 51 :energy : energy/D * *Br 52 :phi_gam : phi_gam/D * *Br 53 :phi_mu : phi_mu/D * *Br 54 :theta_mu : theta_mu/D * *Br 55 :sigWeight : sigWeight/D * *Br 56 :acceptS123 : acceptS123/O * *Br 57 :acceptAll : acceptAll/O * 3

4 Ntuple Variables /sp8data11/shyao/rootfile/branchname.txt *Br 58 :trackID : trackID[nTracks]/I * *Br 59 :parentID : parentID[nTracks]/I * *Br 60 :parentID2 : parentID2[nTracks]/I * *Br 61 :particleID : particleID[nTracks]/I * *Br 62 :parentParticleID : parentParticleID[nTracks]/I * *Br 63 :parentParticleID2 : parentParticleID2[nTracks]/I * *Br 64 :x0 : x0[nTracks]/D * *Br 65 :y0 : y0[nTracks]/D * *Br 66 :z0 : z0[nTracks]/D * *Br 67 :xf : xf[nTracks]/D * *Br 68 :yf : yf[nTracks]/D * *Br 69 :zf : zf[nTracks]/D * *Br 70 :px0 : px0[nTracks]/D * *Br 71 :py0 : py0[nTracks]/D * *Br 72 :pz0 : pz0[nTracks]/D * *Br 73 :pxf : pxf[nTracks]/D * *Br 74 :pyf : pyf[nTracks]/D * *Br 75 :pzf : pzf[nTracks]/D * *Br 76 :ke0 : ke0[nTracks]/D * *Br 77 :thxSt1 : thxSt1[nTracks]/D * *Br 78 :thySt1 : thySt1[nTracks]/D * *Br 79 :thxSt2 : thxSt2[nTracks]/D * *Br 80 :thySt2 : thySt2[nTracks]/D * *Br 81 :charge : charge[nTracks]/S * *Br 82 :hitSt1 : hitSt1[nTracks]/O * *Br 83 :hitSt2 : hitSt2[nTracks]/O * *Br 84 :hitSt3 : hitSt3[nTracks]/O * *Br 85 :hitSt4 : hitSt4[nTracks]/O * *Br 86 :protonID : protonID[nTracks]/I * *Br 58 :trackID : trackID[nTracks]/I * *Br 59 :parentID : parentID[nTracks]/I * *Br 60 :parentID2 : parentID2[nTracks]/I * *Br 61 :particleID : particleID[nTracks]/I * *Br 62 :parentParticleID : parentParticleID[nTracks]/I * *Br 63 :parentParticleID2 : parentParticleID2[nTracks]/I * *Br 64 :x0 : x0[nTracks]/D * *Br 65 :y0 : y0[nTracks]/D * *Br 66 :z0 : z0[nTracks]/D * *Br 67 :xf : xf[nTracks]/D * *Br 68 :yf : yf[nTracks]/D * *Br 69 :zf : zf[nTracks]/D * *Br 70 :px0 : px0[nTracks]/D * *Br 71 :py0 : py0[nTracks]/D * *Br 72 :pz0 : pz0[nTracks]/D * *Br 73 :pxf : pxf[nTracks]/D * *Br 74 :pyf : pyf[nTracks]/D * *Br 75 :pzf : pzf[nTracks]/D * *Br 76 :ke0 : ke0[nTracks]/D * *Br 77 :thxSt1 : thxSt1[nTracks]/D * *Br 78 :thySt1 : thySt1[nTracks]/D * *Br 79 :thxSt2 : thxSt2[nTracks]/D * *Br 80 :thySt2 : thySt2[nTracks]/D * *Br 81 :charge : charge[nTracks]/S * *Br 82 :hitSt1 : hitSt1[nTracks]/O * *Br 83 :hitSt2 : hitSt2[nTracks]/O * *Br 84 :hitSt3 : hitSt3[nTracks]/O * *Br 85 :hitSt4 : hitSt4[nTracks]/O * *Br 86 :protonID : protonID[nTracks]/I * *Br 87 :nHits : nHits/I * *Br 88 :hitID : hitID[nHits]/I * *Br 89 :hit_trackID : hit_trackID[nHits]/I * *Br 90 :deltaEnergy : deltaEnergy[nHits]/D * *Br 91 :hx : hx[nHits]/D * *Br 92 :hy : hy[nHits]/D * *Br 93 :hz : hz[nHits]/D * *Br 94 :hpx : hpx[nHits]/D * *Br 95 :hpy : hpy[nHits]/D * *Br 96 :hpz : hpz[nHits]/D * *Br 97 :hit_particleID : hit_particleID[nHits]/I * *Br 87 :nHits : nHits/I * *Br 88 :hitID : hitID[nHits]/I * *Br 89 :hit_trackID : hit_trackID[nHits]/I * *Br 90 :deltaEnergy : deltaEnergy[nHits]/D * *Br 91 :hx : hx[nHits]/D * *Br 92 :hy : hy[nHits]/D * *Br 93 :hz : hz[nHits]/D * *Br 94 :hpx : hpx[nHits]/D * *Br 95 :hpy : hpy[nHits]/D * *Br 96 :hpz : hpz[nHits]/D * *Br 97 :hit_particleID : hit_particleID[nHits]/I * 4

5 Acceptance = #of Event Accepted /# of Event Generated In principle, the variable “acceptAll” should be 1 if both mu+ and mu- are detected in ST1-ST4. But somehow it was always zero when I first looked into it. So I use “hitSt4[0]*hitSt3[0]*hitSt2[0]*hitSt1[0]*hitSt4 [1]*hitSt3[1]*hitSt2[1]*hitSt1[1]>0” to represent the cut condition of acceptance. Right now it seems that the problem of “acceptAll” is fixed. 5

6 Dimuon Vertex in z Target Beam dump 6

7 /usrX/wchang/E906/Root/ accept_all.cc void accept_xfmass(){ // open the ROOT ntuple TFile* f = new TFile("/sp8data11/shyao/rootfile/r321test.root","READ"); TTree* event = f->Get("event"); //define the cuts TCut *target = new TCut("z0[0]<0 && z0[1] <0"); TCut *bmdump = new TCut("z0[0]>0 && z0[1] >0"); TCut *accept = new TCut("hitSt4[0]*hitSt3[0]*hitSt2[0]*hitSt1[0]*hitSt4[1]*hitSt3[1]*hi tSt2[1]*hitSt1[1]>0"); //create the Canvas for plotting TCanvas* c1 = new TCanvas("c1","canvas title",1200,900); c1->Divide(2,2); //book the histrograms TH2F *gen = new TH2F("gen","generated events",20,0,10,20,-1,1); TH2F *acp = new TH2F("acp","accepted events",20,0,10,20,-1,1); TH2F *eff = new TH2F("eff","efficiency",20,0,10,20,-1,1); //place the labeling of axises gen->GetXaxis()->SetTitle("mass"); gen->GetYaxis()->SetTitle("xf"); acp->GetXaxis()->SetTitle("mass"); acp->GetYaxis()->SetTitle("xf"); eff->GetXaxis()->SetTitle("mass"); eff->GetYaxis()->SetTitle("xf"); eff->GetZaxis()->SetTitle("Efficency"); void accept_xfmass(){ // open the ROOT ntuple TFile* f = new TFile("/sp8data11/shyao/rootfile/r321test.root","READ"); TTree* event = f->Get("event"); //define the cuts TCut *target = new TCut("z0[0]<0 && z0[1] <0"); TCut *bmdump = new TCut("z0[0]>0 && z0[1] >0"); TCut *accept = new TCut("hitSt4[0]*hitSt3[0]*hitSt2[0]*hitSt1[0]*hitSt4[1]*hitSt3[1]*hi tSt2[1]*hitSt1[1]>0"); //create the Canvas for plotting TCanvas* c1 = new TCanvas("c1","canvas title",1200,900); c1->Divide(2,2); //book the histrograms TH2F *gen = new TH2F("gen","generated events",20,0,10,20,-1,1); TH2F *acp = new TH2F("acp","accepted events",20,0,10,20,-1,1); TH2F *eff = new TH2F("eff","efficiency",20,0,10,20,-1,1); //place the labeling of axises gen->GetXaxis()->SetTitle("mass"); gen->GetYaxis()->SetTitle("xf"); acp->GetXaxis()->SetTitle("mass"); acp->GetYaxis()->SetTitle("xf"); eff->GetXaxis()->SetTitle("mass"); eff->GetYaxis()->SetTitle("xf"); eff->GetZaxis()->SetTitle("Efficency"); // plot the figures one by one c1->cd(1); event->Draw("xf:mass>>gen", *target); c1->cd(2); event->Draw("xf:mass>>acp", *target && *accept); eff->Divide(acp, gen, 1., 1., "b"); // getting efficiency c1->cd(3); eff->Draw("cont"); c1->cd(4); eff->Draw("lego"); // Output the plots as eps or jpg files c1->Print("eff_xfmass.eps"); c1->Print("eff_xfmass.jpg"); //Save the Canvas and histrograms into a file TFile *picf = new TFile("./acpt_xfmass.root","RECREATE"); c1->Write(); gen->Write(); acp->Write(); eff->Write(); picf->Close(); //close the ROOT ntuple f->Close(); } // plot the figures one by one c1->cd(1); event->Draw("xf:mass>>gen", *target); c1->cd(2); event->Draw("xf:mass>>acp", *target && *accept); eff->Divide(acp, gen, 1., 1., "b"); // getting efficiency c1->cd(3); eff->Draw("cont"); c1->cd(4); eff->Draw("lego"); // Output the plots as eps or jpg files c1->Print("eff_xfmass.eps"); c1->Print("eff_xfmass.jpg"); //Save the Canvas and histrograms into a file TFile *picf = new TFile("./acpt_xfmass.root","RECREATE"); c1->Write(); gen->Write(); acp->Write(); eff->Write(); picf->Close(); //close the ROOT ntuple f->Close(); } 7

8 Acceptance in “mass” Events of J/psi and DY. 8

9 Acceptance in “xf” Somehow the acceptance in xf is rather flat.? 9

10 Acceptance in “xf vs. mass” 10

11 Acceptance in “x1” 11

12 Acceptance in “x2” 12

13 Acceptance in “x2 vs. x1” 13 Good acceptance in large x1 (beam) and small x2 (target).

14 Acceptance in “phi_mu” 14

15 Acceptance in “cos(theta_mu)” 15

16 Acceptance in “phi_my vs. cos(theta_mu)” 16

17 Conclusion The ROOT ntuple with the event-loop structure is easier for analysis. I urge the students to do the exercise ASAP. PAW to ROOT conversion table: http://root.cern.ch/root/HowtoConvertFromPAW.html. http://root.cern.ch/root/HowtoConvertFromPAW.html I have to admit that there is a non-negligible threshold of being experienced with ROOT for those who started with PAW for analysis. (I echo the comment given in http://qd.typepad.com/4/2005/08/i_hate_root.html.) http://qd.typepad.com/4/2005/08/i_hate_root.html For the consideration of being competitive in data analysis for people with ages >40 like me, it will be very much appreciated if 姚錫弘 could also convert the MySQL tables into a PAW ntuple file with an event-loop structure. 17


Download ppt "My ROOT Exercise with MC Ntuples Wen-Chen Chang 2010/12/15 1."

Similar presentations


Ads by Google