-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread2_apl.cc
126 lines (110 loc) · 3.35 KB
/
read2_apl.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <string>
#include <iostream>
using namespace std;
char *vector_char(int imin, int imax)
{
char *p;
p = (char *) malloc((size_t) ((imax-imin+1)*sizeof(char)));
if (!p) {
printf("Vector: eroare de alocare !\n");
exit(1);
}
return p-imin;
}
void read2()
{
int nchan = 5000;
stringstream ESingle;
TFile* in_file=new TFile("eliGammaSource.root");
char* rootName; rootName = vector_char(0,200);
char* aplName; aplName = vector_char(0,200);
int vacuum;
int N_sim;
ifstream in;
in.open("incident_fileName",ios::in);
in>>rootName; printf("\n file name is : %s",rootName);
in>>vacuum; printf("\n vacuum boolean is %i",vacuum);
in>>N_sim; printf("\n simulated for %i events",N_sim);
in.close();
sscanf(rootName,"%11s",aplName);
if (vacuum==1) ESingle<<aplName<<"_v_apl";
else ESingle<<aplName<<"_apl";
cout<<"\n new file name is: "<<ESingle.str().c_str()<<"\n";
printf("\n");
TH1F *l1 = (TH1F*)gDirectory->Get("H1trackLength");
ofstream ofile(ESingle.str().c_str(), ios::out);
for (Int_t i = 0; i < nchan; i++)
{
double y=l1->GetBinContent(i);
ofile<<y/N_sim<<endl;
}
ofile.close();
}
/*
stringstream ESingle,ESingleN,ESingleNorm,
ESingleInc,ESingleIncN,ESingleIncNorm,
AnglePol,AnglePolN;
double y, norm = 1.e+6, total;
TFile* in_file=new TFile("eliGammaSource.root");
//in_file->cd("eliLaBr");
TH1F *h1 = (TH1F*)gDirectory->Get("H1Sngl");
//h1->Draw();
ESingle<<"ESingle"<<nfile;
ofstream ofile(ESingle.str().c_str(), ios::out);
for (Int_t i = 0; i < nchan; i++)
{y=h1->GetBinContent(i);
ofile<<y<<endl;}
ofile.close();
TH1F *h2 = (TH1F*)gDirectory->Get("H1SnglN");
//h2->Draw();
//h2->Scale(norm*100./total);
total = h2->Integral();
ESingleN<<"ESingleN"<<nfile;
ofstream ofile(ESingleN.str().c_str(), ios::out);
ESingleNorm<<"ESingleNorm"<<nfile;
ofstream ofile1(ESingleNorm.str().c_str(), ios::out);
for (Int_t i = 0; i < nchan; i++)
{y=h2->GetBinContent(i);
ofile<<y<<endl;
ofile1<<y*norm/total<<endl;}
ofile.close();
ofile1.close();
TH1F *p1 = (TH1F*)gDirectory->Get("H1Inc");
//p1->Draw();
ESingleInc<<"ESingleInc"<<nfile;
ofstream ofile(ESingleInc.str().c_str(), ios::out);
for (Int_t i = 0; i < nchan; i++)
{y=p1->GetBinContent(i);
ofile<<y<<endl;}
ofile.close();
TH1F *p2 = (TH1F*)gDirectory->Get("H1IncN");
//p2->Draw()
// p2->Scale(norm*100./total);
total = p2->Integral();
ESingleIncN<<"ESingleIncN"<<nfile;
ofstream ofile(ESingleIncN.str().c_str(), ios::out);
ESingleIncNorm<<"ESingleIncNorm"<<nfile;
ofstream ofile1(ESingleIncNorm.str().c_str(), ios::out);
for (Int_t i = 0; i < nchan; i++)
{y=p2->GetBinContent(i);
ofile<<y<<endl;
ofile1<<y*norm/total<<endl;}
ofile.close();
ofile1.close();
TH1F *ang = (TH1F*)gDirectory->Get("Angle");
//ang->Draw();
AnglePol<<"PolAngle"<<nfile;
ofstream ofile(AnglePol.str().c_str(), ios::out);
for (Int_t i = 0; i < 3600; i++)
{y=ang->GetBinContent(i);
ofile<<y<<endl;}
ofile.close();
TH1F *ang1 = (TH1F*)gDirectory->Get("AngleN");
//ang1->Draw();
AnglePolN<<"PolAngleN"<<nfile;
ofstream ofile(AnglePolN.str().c_str(), ios::out);
for (Int_t i = 0; i < 3600; i++)
{y=ang1->GetBinContent(i);
ofile<<y<<endl;}
ofile.close();
*/