/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/examples/cpp/rootDict/treeDraw.C

Go to the documentation of this file.
00001 
00002 /** Example script for testing the ROOT LCIO dictionary.
00003  * 
00004  *  treeDraw: 
00005  *  use the TTree::Draw to create some plots from the 
00006  *  MCParticle tree created with writeTree.C  
00007  *
00008  */
00009 
00010 {
00011 
00012 
00013 if (!TClassTable::GetDict("IMPL::ReconstructedParticleImpl")) {
00014   unsigned res ;
00015   
00016   res = gSystem->Load("$LCIO/lib/liblcio.so"); 
00017   res = gSystem->Load("$LCIO/lib/liblcioDict.so"); 
00018 }
00019 
00020 
00021 TFile* f = new TFile("lcioTree.root","READ") ;
00022 
00023 
00024 // -------------------------
00025 TCanvas *c1 = new TCanvas("c1","LCIO root example",200,10,700,500);
00026 c1->Divide(2,2);
00027 c1->cd(1)  ;
00028 
00029 
00030 
00031 
00032 // define some cuts
00033 TCut sizeCut("abs(MCParticlesSkimmed._endpoint[][0])<1000.&&abs(MCParticlesSkimmed._endpoint[][1])<1000." ) ;
00034 
00035 TCut isPhoton("MCParticlesSkimmed.getPDG()==22" ) ;
00036 TCut isElectron("abs(MCParticlesSkimmed.getPDG())==11" ) ;
00037 
00038 
00039 // simple drawing of scalar variable (using API !) 
00040 //LCIO->Draw("MCParticlesSkimmed.getPDG()") ;
00041 
00042 LCIO->Draw("MCParticlesSkimmed.getPDG()", isPhoton || isElectron ) ;
00043 
00044 
00045 
00046 c1->cd(2)  ;
00047 LCIO->Draw("MCParticlesSkimmed._endpoint[][0]:MCParticlesSkimmed._endpoint[][1]", sizeCut && isPhoton ) ;
00048 
00049 c1->cd(3)  ;
00050 LCIO->Draw("MCParticlesSkimmed._endpoint[][0]:MCParticlesSkimmed._endpoint[][1]", sizeCut && isElectron ) ;
00051 
00052 
00053 // this syntax does not work !!!!
00054 // 
00055 //  in order to access array like data,
00056 //  you need to use the member variable names as shown above 
00057 //
00058 //LCIO->Draw("MCParticlesSkimmed.getEndpoint()[][0]:MCParticlesSkimmed.getEndpoint()[][1]", sizeCut) ;
00059 
00060 //LCIO->Draw("MCParticlesSkimmed.getEndpoint()[0]:MCParticlesSkimmed.getEndpoint()[1]" ) ;
00061 
00062 
00063 
00064 TH2F h_trkStop("h_trkStop","particles stopped vs in/out of tracker region" , 2 , -.5 , 1.5 , 2 , -.5 , 1.5 ) ; 
00065 
00066 c1->cd(4)  ;
00067 LCIO->Draw("MCParticlesSkimmed.isDecayedInTracker():MCParticlesSkimmed.isStopped()>>h_trkStop" ) ;
00068 
00069 }

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7