00001 00002 /* 00003 * 00004 * Copyright: Mathieu Trocme, mathieu.trocme@gmail.com (21 september 2009) 00005 * 00006 * This software is a computer program whose purpose is to: simulate the AlphaRad device. 00007 * 00008 * This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. 00009 * You can use, modify and/or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". 00010 * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. 00011 * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. 00012 * Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security. 00013 * 00014 * The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. 00015 * 00016 */ 00017 00018 00019 /// See my post: http://root.cern.ch/phpBB2/viewtopic.php?t=6172 00020 00021 { 00022 gROOT->ProcessLine(".L TMyRootEvent.hpp+") ; 00023 00024 TFile *fin = new TFile ("data/test.root") ; 00025 TTree *tree = (TTree*)fin->Get("tree") ; 00026 TMyRootEvent* evt = new TMyRootEvent() ; 00027 tree->SetBranchAddress("evt",&evt) ; 00028 00029 /// There are several ways to access a specific value in a given cell 00030 00031 // /// 1. From the cell number (standard) 00032 // tree->Draw("evt->GetEkin(1)","evt->GetParticleName()==\"alpha\" && evt->GetEkin(1)>0.") ; /// wrt cellNumber #1 00033 00034 // /// 2. From the cell name in an indirect way 00035 // tree->GetEntry(0) ; 00036 // Int_t cellNumber = evt->GetCellNumber("alphaRad_Sensor1_Siepi_SD") ; /// The cell names are defined in alphaRad_DetectorConstruction::ConstructFilters() 00037 // tree->Draw(TString(Form("evt->GetEkin(%d)",cellNumber))) ; 00038 00039 // /// 3. From the cell name directly 00040 // tree->Draw("evt->GetEkin(\"alphaRad_Sensor1_Siepi_SD\")","evt->GetParticleName()==\"alpha\" && evt->GetEkin(\"alphaRad_Sensor1_Siepi_SD\")>0.") ; 00041 00042 00043 /// In fullscreen multiplot mode, this would give: 00044 00045 TCanvas *canvas = new TCanvas("canvas","canvas",0,0,gClient->GetDisplayWidth(),gClient->GetDisplayHeight()) ; canvas->Divide(2,3) ; 00046 canvas->cd(1) ; tree->Draw("evt->GetEkin(0)","evt->GetParticleName()==\"alpha\"") ; 00047 canvas->cd(2) ; tree->Draw("evt->GetEkin(0)","evt->GetParticleName()==\"e-\"") ; 00048 canvas->cd(3) ; tree->Draw("evt->GetEkin(1)","evt->GetParticleName()==\"alpha\"") ; 00049 canvas->cd(4) ; tree->Draw("evt->GetEkin(1)","evt->GetParticleName()==\"e-\"") ; 00050 canvas->cd(5) ; tree->Draw("evt->GetEkin(2)","evt->GetParticleName()==\"alpha\"") ; 00051 canvas->cd(6) ; tree->Draw("evt->GetEkin(2)","evt->GetParticleName()==\"e-\"") ; 00052 00053 fin->Close() ; 00054 }