/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/analyse/Iro/read_ntuples.C

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <cmath>
00003 #include <string>
00004 #include<vector>
00005 
00006 #include "TChain.h"
00007 #include "TProfile.h"
00008 #include "TFile.h"
00009 #include "TTree.h"
00010 #include "TString.h"
00011 
00012 void read_ntuples(){
00013   gStyle->SetOptStat(0);
00014 
00015   TFile *f1=new TFile("DSTPionsAllEM.root","READ");
00016   TTree *t1 = (TTree*)(f1->Get("Pions"));
00017 
00018   int num_entries=t1->GetEntries();
00019   cout << "entries " << num_entries << endl;
00020   double energy; double Nhtot; double Nhtot1; double Nhtot2; double Nhtot3; float ShCont1; double NbHitsRear; double NbHitsBoard; double Zstart;
00021   t1 -> SetBranchAddress("Ebeam",&energy);
00022   t1 -> SetBranchAddress("Nhtot",&Nhtot);
00023   t1 -> SetBranchAddress("Nhtot1",&Nhtot1);
00024   t1 -> SetBranchAddress("Nhtot2",&Nhtot2);
00025   t1 -> SetBranchAddress("Nhtot3",&Nhtot3);
00026   t1 -> SetBranchAddress("ShCont1",&ShCont1);
00027   t1 -> SetBranchAddress("NbHitsRear",&NbHitsRear);
00028   t1 -> SetBranchAddress("NbHitsBoard",&NbHitsBoard);
00029   t1 -> SetBranchAddress("Zstart",&Zstart);
00030 
00031   vector<double> energies;
00032   double energy_step=0;
00033 
00034   for ( int ient = 0; ient < num_entries; ient++ ) {
00035     t1->GetEntry(ient);
00036 
00037     if (energy!=energy_step) energies.push_back(energy);
00038     energy_step=energy;
00039 
00040   }
00041 
00042   int size_energies=energies.size();
00043   cout << "Nb of different energies " << size_energies << endl;
00044 
00045 }

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