Changeset 172 in JEM-EUSO for esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Analysis.C
- Timestamp:
- Jun 13, 2013, 3:11:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Analysis.C
r169 r172 12 12 const char* inputfile2="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/10_ns_TimeResolution__100_event/simu.root"; 13 13 const char* inputfile3="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/5_ns_TimeResolution__100_event/simu.root"; 14 const char* inputfile4="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/0_ns_TimeResolution__100_event/simu.root"; 15 14 16 15 17 EEvent* ev = 0; … … 18 20 EBunchPhotons* gBunchPhotons = NULL; 19 21 22 TProfile *hprof_multi[20]; 23 //TProfile *hprof; 24 TH1F *histo_multi[100]; 25 TCanvas *c3, *c4; 26 TH1F *histo_total; 27 TFile *f[20]; 28 TTree *etree[20]; 29 20 30 void gettree(); 21 31 void init(); … … 27 37 { 28 38 //Déclaration d'un tableau de TProfile permettant de stocker les TProfiles créé par l'analyse des fichiers 29 TProfile *hprof_multi[2]; 39 40 Float_t x[200], y[200]; 41 Float_t bin1, bin2; 42 const char hprof_name[50]; 30 43 31 44 //Initialisation & process du premier fichier 32 init(inputfile); 33 process_profile(); 34 TCanvas *c3 = new TCanvas("c3", "TProfile of the GTU distribution for 100 events for 30 ns dead time"); 35 hprof_multi[1] = hprof; 36 hprof_multi[1]->Draw(); 37 45 init(inputfile, 0); 46 // process_profile(0); 47 48 sprintf(hprof_name, "hprof_multi%d", 0); 49 hprof_multi[0] = new TProfile(hprof_name, "Average number of photons per GTU", 128, 0, 128); 50 51 //f[0]->Close(); 52 //etree[0]->Delete(); 53 54 gDirectory->ls(); 55 56 c3 = new TCanvas("c3", "c3 - TProfile of the GTU distribution for 100 events for 30 ns dead time"); 57 //hprof_multi[0] = hprof; 58 hprof_multi[0]->Print(); 59 // c3->cd(); 60 // hprof_multi[0]->Draw(); 61 38 62 //Initialisation & process du second fichier 39 init(inputfile3); 40 process_profile(); 41 TCanvas *c4 = new TCanvas("c4", "TProfile of the GTU distribution for 100 events for 5 ns dead time"); 42 hprof_multi[2] = hprof; 43 hprof_multi[2]->Draw(); 44 45 46 TCanvas *c4 = new TCanvas("c5", "Efficiency vs GTU"); 47 TProfile *hprof_efficiency = new TProfile("hprof_efficiency", "Efficiency vs GTU", 128, 0, 128); 63 init(inputfile4, 1); 64 //process_profile(1); 65 66 sprintf(hprof_name, "hprof_multi%d", 1); 67 hprof_multi[1] = new TProfile(hprof_name, "Average number of photons per GTU", 128, 0, 128); 68 69 //f[1]->Close(); 70 //etree[1]->Delete(); 71 72 73 c4 = new TCanvas("c4", "c4 - TProfile of the GTU distribution for 100 events for 0 ns dead time"); 74 //hprof_multi[1] = hprof; 75 hprof_multi[1]->Print(); 76 77 78 79 gDirectory->ls(); 80 81 // c4->cd(); 82 // hprof_multi[1]->Draw(); 83 84 85 /* 86 TCanvas *c5 = new TCanvas("c5", "Efficiency vs GTU"); 48 87 49 88 for (Int_t i=0; i<128; i++) 50 89 { 51 Float_t bin1 = hprof_multi[1]->GetBinContent(i); 52 Float_t bin2 = hprof_multi[2]->GetBinContent(i); 90 bin1 = hprof_multi[0]->GetBinContent(i); 91 bin2 = hprof_multi[1]->GetBinContent(i); 92 93 x[i] = i; 53 94 54 95 if (bin2 == 0) 55 96 { 56 hprof_efficiency->Fill(i, 0); //Il faut entrer des entiers dedans sinon ça ne marchera pas!!!!97 y[i] = 0; 57 98 } 58 99 59 100 else 60 101 { 61 hprof_efficiency->Fill(i, bin1/bin2); //Il faut entrer des entiers dedans sinon ça ne marchera pas!!!! 62 } 63 } 64 65 hprof_efficiency->Draw(); 66 } 67 68 //______________________________________________________________________________ 69 void process_profile() 102 y[i] = bin1/bin2; 103 } 104 } 105 TGraph *g_efficiency = new TGraph(128, x, y); 106 g_efficiency->SetLineColor(2); 107 g_efficiency->SetLineWidth(2)); 108 g_efficiency->SetMarkerColor(4); 109 g_efficiency->SetMarkerStyle(21); 110 g_efficiency->Draw("ACP");*/ 111 } 112 113 //______________________________________________________________________________ 114 void process_profile(int n) 70 115 //ici on récupÚre les données de temps pour les 100 événements afin de réaliser un TProfile 71 116 { 72 117 //Déclaration des histogrammes et autres 73 TH1F *histo_total = new TH1F("histo_total", "Histogram of photons read by the electronics for 100 showers", 128, 0, 128); 74 TH1F *histo_multi[100]; 75 hprof = new TProfile("hprof", "Average number of photons per GTU", 128, 0, 128); 76 77 histo_total->Reset(); 78 hprof->Reset(); 79 80 //Boucle sur l'ensemble des événements pour créer une distribution totale 118 // histo_total = new TH1F("histo_total", "Histogram of photons read by the electronics for 100 showers", 128, 0, 128); 119 120 const char hprof_name[50]; 121 sprintf(hprof_name, "hprof_multi%d", n); 122 hprof_multi[n] = new TProfile(hprof_name, "Average number of photons per GTU", 128, 0, 128); 123 124 //histo_total->Reset(); 125 //hprof->Reset(); 126 127 /* //Boucle sur l'ensemble des événements pour créer une distribution totale 81 128 for (Int_t i=0; i<nb_entries ; i++) 82 129 { … … 100 147 } 101 148 102 /*TCanvas *c1 = new TCanvas("c1", "Distribution totale");149 TCanvas *c1 = new TCanvas("c1", "Distribution totale"); 103 150 histo_total->GetXaxis()->SetTitle("GTU"); 104 151 histo_total->Draw(); */ … … 108 155 //c2->Divide(10,10); 109 156 110 for (Int_t i=0; i<nb_entries; i++) 111 { 112 histo_multi[i] = new TH1F("histo_multi", "Single shower histograms", 128, 0, 128); 113 histo_multi[i]->Reset(); 157 //TEST******* 158 159 /* for (Int_t i=0; i<nb_entries; i++) 160 { 161 162 const char histoname[50]; 163 sprintf(histoname,"histomulti%d",i); 164 histo_multi[i] = new TH1F(histoname, "Single shower histograms", 128, 0, 128); 114 165 } 115 166 … … 118 169 loadevent(i); 119 170 120 nb_photon = gDetector->GetNumPhotons();171 Int_t nb_photon = gDetector->GetNumPhotons(); 121 172 122 173 for (Int_t j=0; j<nb_photon; j++) 123 174 { 124 macrocell_status = gDetector->GetPhoton(j)->GetMacroCell();125 photon_type = gDetector->GetPhoton(j)->GetType();175 Int_t macrocell_status = gDetector->GetPhoton(j)->GetMacroCell(); 176 Int_t photon_type = gDetector->GetPhoton(j)->GetType(); 126 177 127 178 if (macrocell_status == 1 & photon_type != 2) //on ne sélectionne que les photons étant détectés par l'électronique & autre que les Cerenkov 128 179 { 129 gtu = gDetector->GetPhoton(j)->GetGtu();180 Float_t gtu = gDetector->GetPhoton(j)->GetGtu(); 130 181 histo_multi[i]->Fill(gtu); 131 182 } … … 142 193 for (Int_t i=0; i<128; i++) 143 194 { 144 hprof->Fill(i, histo_multi[j]->GetBinContent(i)); 145 } 146 147 } 148 149 } 150 151 //______________________________________________________________________________ 152 void init( const char* fname) 153 { 154 TFile *f = new TFile(fname); 155 gettree(); 156 } 157 158 //______________________________________________________________________________ 159 void gettree() 160 { 161 TTree *etree = (TTree*)gDirectory->Get("etree"); 162 if ( etree ) 163 { 164 nb_entries = etree->GetEntries(); 195 hprof_multi[n]->Fill(i, histo_multi[j]->GetBinContent(i)); 196 } 197 198 } 199 200 for (Int_t k=0; k<nb_entries; k++) 201 { 202 histo_multi[k]->Reset(); 203 } 204 */ 205 } 206 207 //______________________________________________________________________________ 208 void init( const char* fname, int n_file) 209 { 210 std::cout << "enter init #"<< n_file << std::endl; 211 212 f[n_file] = new TFile(fname); 213 gettree(n_file); 214 std::cout << "exit init" << std::endl; 215 } 216 217 //______________________________________________________________________________ 218 void gettree(int n_tree) 219 { 220 std::cout << "enter gettree #" << n_tree << std::endl; 221 222 etree[n_tree] = (TTree*)gDirectory->Get("etree"); 223 if ( etree[n_tree] ) 224 { 225 nb_entries = etree[n_tree]->GetEntries(); 165 226 Printf("etree found with %d events stored.", nb_entries); 166 227 } 228 229 std::cout << "exit gettree" << std::endl; 230 167 231 } 168 232
Note: See TracChangeset
for help on using the changeset viewer.